diff --git a/ChangeLog b/ChangeLog index 83a5d7db7..240446b51 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +2008-04-14 Paul Giblock + + * plugins/stereo_matrix: + * plugins/stereo_matrix/stereo_matrix.cpp: + * plugins/stereo_matrix/stereo_matrix.h: + * plugins/stereo_matrix/stereomatrix_controls.cpp: + * plugins/stereo_matrix/stereomatrix_controls.h: + * plugins/stereo_matrix/stereomatrix_control_dialog.cpp: + * plugins/stereo_matrix/stereomatrix_control_dialog.h: + * plugins/stereo_matrix/logo.png: + * plugins/stereo_matrix/Makefile.am: + * configure.in: + * plugins/Makefile.am: + Add stereo matrix plugin for real panning and stereo-swapping + 2008-04-14 Tobias Doerffel * plugins/sf2_player/sf2_player.cpp: diff --git a/configure.in b/configure.in index 92b7d7bdb..b6bbdc13b 100644 --- a/configure.in +++ b/configure.in @@ -696,6 +696,7 @@ AC_CONFIG_FILES([Makefile plugins/vst_base/Makefile plugins/vst_effect/Makefile plugins/stereo_enhancer/Makefile + plugins/stereo_matrix/Makefile lmms.spec]) LOCAL_EXTRA_PLUGINS AC_OUTPUT diff --git a/plugins/Makefile.am b/plugins/Makefile.am index 8446e9c05..f9e6c1c16 100644 --- a/plugins/Makefile.am +++ b/plugins/Makefile.am @@ -30,4 +30,5 @@ SUBDIRS = \ $(VST_DIRS) \ vibed \ stereo_enhancer \ + stereo_matrix \ $(EXTRA_PLUGINS) diff --git a/plugins/stereo_matrix/Makefile.am b/plugins/stereo_matrix/Makefile.am new file mode 100644 index 000000000..cbc37e867 --- /dev/null +++ b/plugins/stereo_matrix/Makefile.am @@ -0,0 +1,38 @@ +AUTOMAKE_OPTIONS = foreign 1.4 + + +INCLUDES = -I$(top_srcdir)/include -I$(top_srcdir)/src/gui + + +AM_CXXFLAGS := $(AM_CXXFLAGS) $(QT_CXXFLAGS) -DPLUGIN_NAME="stereomatrix" + + +%.moc: ./%.h + $(MOC) -o $@ $< + + +MOC_FILES = ./stereomatrix_controls.moc + +BUILT_SOURCES = $(MOC_FILES) ./embedded_resources.h +EMBEDDED_RESOURCES = $(wildcard *png) + +./embedded_resources.h: $(EMBEDDED_RESOURCES) + $(BIN2RES) $(EMBEDDED_RESOURCES) > $@ + +EXTRA_DIST = $(EMBEDDED_RESOURCES) + + +CLEANFILES = $(MOC_FILES) ./embedded_resources.h + + + +pkglib_LTLIBRARIES= libstereomatrix.la + +libstereomatrix_la_SOURCES = stereo_matrix.cpp \ + stereo_matrix.h \ + stereomatrix_control_dialog.cpp \ + stereomatrix_control_dialog.h \ + stereomatrix_controls.cpp \ + stereomatrix_controls.h + +$(libstereomatrix_la_SOURCES): ./embedded_resources.h diff --git a/plugins/stereo_matrix/logo.png b/plugins/stereo_matrix/logo.png new file mode 100644 index 000000000..6d757a2b0 Binary files /dev/null and b/plugins/stereo_matrix/logo.png differ diff --git a/plugins/stereo_matrix/stereo_matrix.cpp b/plugins/stereo_matrix/stereo_matrix.cpp new file mode 100644 index 000000000..37e53bc77 --- /dev/null +++ b/plugins/stereo_matrix/stereo_matrix.cpp @@ -0,0 +1,111 @@ +/* + * stereo_matrix.cpp - stereo-matrix-effect-plugin + * + * Copyright (c) 2008 Paul Giblock + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + + +#include "stereo_matrix.h" + + +#undef SINGLE_SOURCE_COMPILE +#include "embed.cpp" + + +extern "C" +{ + +plugin::descriptor stereomatrix_plugin_descriptor = +{ + STRINGIFY_PLUGIN_NAME( PLUGIN_NAME ), + "Stereophonic Matrix", + QT_TRANSLATE_NOOP( "pluginBrowser", + "Plugin for freely manipulating stereo output" ), + "Paul Giblock ", + 0x0100, + plugin::Effect, + new QPixmap( PLUGIN_NAME::getIconPixmap( "logo" ) ), + NULL +} ; + +} + + + +stereoMatrixEffect::stereoMatrixEffect( + model * _parent, + const descriptor::subPluginFeatures::key * _key ) : + effect( &stereomatrix_plugin_descriptor, _parent, _key ), + m_smControls( this ) +{ +} + + + + +stereoMatrixEffect::~stereoMatrixEffect() +{ +} + + + +bool stereoMatrixEffect::processAudioBuffer( sampleFrame * _buf, + const fpp_t _frames ) +{ + + // This appears to be used for determining whether or not to continue processing + // audio with this effect + if( !isEnabled() || !isRunning() ) + { + return( FALSE ); + } + + + for( fpp_t f = 0; f < _frames; ++f ) + { + sample_t l = _buf[f][0]; + sample_t r = _buf[f][1]; + _buf[f][0] = m_smControls.m_llModel.value( f ) * l + + m_smControls.m_rlModel.value( f ) * r; + + _buf[f][1] = m_smControls.m_lrModel.value( f ) * l + + m_smControls.m_rrModel.value( f ) * r; + } + + return( isRunning() ); +} + + + + +extern "C" +{ + +// neccessary for getting instance out of shared lib +plugin * lmms_plugin_main( model * _parent, void * _data ) +{ + return( new stereoMatrixEffect( _parent, + static_cast( + _data ) ) ); +} + +} + diff --git a/plugins/stereo_matrix/stereo_matrix.h b/plugins/stereo_matrix/stereo_matrix.h new file mode 100644 index 000000000..6b2c7866d --- /dev/null +++ b/plugins/stereo_matrix/stereo_matrix.h @@ -0,0 +1,60 @@ +/* + * stereo_matrix.h - stereo-matrix-effect-plugin + * + * Copyright (c) 2008 Paul Giblock + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + + +#ifndef _STEREO_MATRIX_H +#define _STEREO_MATRIX_H + +#include + +#include "effect.h" +#include "effect_lib.h" +#include "engine.h" +#include "main_window.h" +#include "stereomatrix_controls.h" + +class stereoMatrixEffect : public effect +{ +public: + stereoMatrixEffect( model * parent, + const descriptor::subPluginFeatures::key * _key ); + virtual ~stereoMatrixEffect(); + virtual bool processAudioBuffer( sampleFrame * _buf, + const fpp_t _frames ); + + virtual effectControls * getControls( void ) + { + return( &m_smControls ); + } + + +private: + stereoMatrixControls m_smControls; + + friend class stereoMatrixControls; +} ; + + + +#endif diff --git a/plugins/stereo_matrix/stereomatrix_control_dialog.cpp b/plugins/stereo_matrix/stereomatrix_control_dialog.cpp new file mode 100644 index 000000000..86baa7eef --- /dev/null +++ b/plugins/stereo_matrix/stereomatrix_control_dialog.cpp @@ -0,0 +1,72 @@ +/* + * stereomatrix_control_dialog.cpp - control dialog for stereoMatrix-effect + * + * Copyright (c) 2008 Paul Giblock + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + + + +#include +#include + +#include "stereomatrix_control_dialog.h" +#include "stereomatrix_controls.h" + + + +stereoMatrixControlDialog::stereoMatrixControlDialog( + stereoMatrixControls * _controls ) : + effectControlDialog( _controls ) +{ + + setFixedSize( 64, 64 ); + + QGridLayout * l = new QGridLayout( this ); + + knob * llKnob = new knob( knobBright_26, this, tr( "Left to Left" ) ); + llKnob->setModel( &_controls->m_llModel ); + llKnob->setHintText( tr( "Volume:" ) + " ", "" ); + + knob * lrKnob = new knob( knobBright_26, this, tr( "Left to Right" ) ); + lrKnob->setModel( &_controls->m_lrModel ); + lrKnob->setHintText( tr( "Volume:" ) + " ", "" ); + + knob * rlKnob = new knob( knobBright_26, this, tr( "Right to Left" ) ); + rlKnob->setModel( &_controls->m_rlModel ); + rlKnob->setHintText( tr( "Volume:" ) + " ", "" ); + + knob * rrKnob = new knob( knobBright_26, this, tr( "Right to Right" ) ); + rrKnob->setModel( &_controls->m_rrModel ); + rrKnob->setHintText( tr( "Volume:" ) + " ", "" ); + + l->addWidget( new QLabel( "L", this ), 1, 0); + l->addWidget( new QLabel( "R", this ), 2, 0); + l->addWidget( new QLabel( "L", this ), 0, 1); + l->addWidget( new QLabel( "R", this ), 0, 2); + + l->addWidget( llKnob, 1, 1 ); + l->addWidget( lrKnob, 1, 2 ); + l->addWidget( rlKnob, 2, 1 ); + l->addWidget( rrKnob, 2, 2 ); + + this->setLayout(l); +} + diff --git a/plugins/stereo_matrix/stereomatrix_control_dialog.h b/plugins/stereo_matrix/stereomatrix_control_dialog.h new file mode 100644 index 000000000..c18945b92 --- /dev/null +++ b/plugins/stereo_matrix/stereomatrix_control_dialog.h @@ -0,0 +1,44 @@ +/* + * stereomatrix_control_dialog.h - control dialog for stereoMatrix-effect + * + * Copyright (c) 2008 Paul Giblock + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + +#ifndef _STEREOMATRIX_CONTROL_DIALOG_H +#define _STEREOMATRIX_CONTROL_DIALOG_H + +#include "effect_control_dialog.h" + +class stereoMatrixControls; + + +class stereoMatrixControlDialog : public effectControlDialog +{ +public: + stereoMatrixControlDialog( stereoMatrixControls * _controls ); + virtual ~stereoMatrixControlDialog() + { + } + +}; + + +#endif diff --git a/plugins/stereo_matrix/stereomatrix_controls.cpp b/plugins/stereo_matrix/stereomatrix_controls.cpp new file mode 100644 index 000000000..c2c4f8a70 --- /dev/null +++ b/plugins/stereo_matrix/stereomatrix_controls.cpp @@ -0,0 +1,82 @@ +/* + * stereomatrix_controls.cpp - controls for stereoMatrix-effect + * + * Copyright (c) 2008 Paul Giblock + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + +#include "stereomatrix_controls.h" +#include "stereo_matrix.h" +#include "automatable_model_templates.h" + + +stereoMatrixControls::stereoMatrixControls( stereoMatrixEffect * _eff ) : + effectControls( _eff ), + m_effect( _eff ), + m_llModel( 1.0f, 0.0f, 1.0f, 0.01f ), + m_lrModel( 0.0f, 0.0f, 1.0f, 0.01f ), + m_rlModel( 0.0f, 0.0f, 1.0f, 0.01f ), + m_rrModel( 1.0f, 0.0f, 1.0f, 0.01f ) +{ + connect( &m_llModel, SIGNAL( dataChanged( void ) ), + this, SLOT( changeMatrix( void ) ) ); + connect( &m_lrModel, SIGNAL( dataChanged( void ) ), + this, SLOT( changeMatrix( void ) ) ); + connect( &m_rlModel, SIGNAL( dataChanged( void ) ), + this, SLOT( changeMatrix( void ) ) ); + connect( &m_rrModel, SIGNAL( dataChanged( void ) ), + this, SLOT( changeMatrix( void ) ) ); + + changeMatrix(); +} + + + +void stereoMatrixControls::changeMatrix( void ) +{ +} + + + +void FASTCALL stereoMatrixControls::loadSettings( + const QDomElement & _this ) +{ + m_llModel.setValue( _this.attribute( "l-l" ).toFloat() ); + m_lrModel.setValue( _this.attribute( "l-r" ).toFloat() ); + m_rlModel.setValue( _this.attribute( "r-l" ).toFloat() ); + m_rrModel.setValue( _this.attribute( "r-r" ).toFloat() ); +} + + + + +void FASTCALL stereoMatrixControls::saveSettings( QDomDocument & _doc, + QDomElement & _this ) +{ + _this.setAttribute( "l-l", m_llModel.value() ); + _this.setAttribute( "l-r", m_llModel.value() ); + _this.setAttribute( "r-l", m_llModel.value() ); + _this.setAttribute( "r-r", m_llModel.value() ); +} + + + +#include "stereomatrix_controls.moc" + diff --git a/plugins/stereo_matrix/stereomatrix_controls.h b/plugins/stereo_matrix/stereomatrix_controls.h new file mode 100644 index 000000000..c10efa1f6 --- /dev/null +++ b/plugins/stereo_matrix/stereomatrix_controls.h @@ -0,0 +1,79 @@ +/* + * stereomatrix_controls.h - controls for stereoMatrix-effect + * + * Copyright (c) 2008 Paul Giblock + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + +#ifndef _STEREO_MATRIX_CONTROLS_H +#define _STEREO_MATRIX_CONTROLS_H + +#include "effect_controls.h" +#include "stereomatrix_control_dialog.h" +#include "knob.h" + +class stereoMatrixEffect; + +class stereoMatrixControls : public effectControls +{ + Q_OBJECT +public: + stereoMatrixControls( stereoMatrixEffect( * _eff ) ); + virtual ~stereoMatrixControls() + { + } + + virtual void saveSettings( QDomDocument & _doc, QDomElement & _parent ); + virtual void loadSettings( const QDomElement & _this ); + inline virtual QString nodeName( void ) const + { + return( "stereomatrixcontrols" ); + } + + virtual ch_cnt_t getControlCount( void ) + { + return( 1 ); + } + + virtual effectControlDialog * createView( void ) + { + return new stereoMatrixControlDialog( this ); + } + + +private slots: + void changeMatrix( void ); + + +private: + stereoMatrixEffect * m_effect; + + knobModel m_llModel; + knobModel m_lrModel; + knobModel m_rlModel; + knobModel m_rrModel; + + friend class stereoMatrixControlDialog; + friend class stereoMatrixEffect; + +} ; + + +#endif