Added stereophonic matrix
git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@921 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
@@ -30,4 +30,5 @@ SUBDIRS = \
|
||||
$(VST_DIRS) \
|
||||
vibed \
|
||||
stereo_enhancer \
|
||||
stereo_matrix \
|
||||
$(EXTRA_PLUGINS)
|
||||
|
||||
38
plugins/stereo_matrix/Makefile.am
Normal file
38
plugins/stereo_matrix/Makefile.am
Normal file
@@ -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
|
||||
BIN
plugins/stereo_matrix/logo.png
Normal file
BIN
plugins/stereo_matrix/logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.2 KiB |
111
plugins/stereo_matrix/stereo_matrix.cpp
Normal file
111
plugins/stereo_matrix/stereo_matrix.cpp
Normal file
@@ -0,0 +1,111 @@
|
||||
/*
|
||||
* stereo_matrix.cpp - stereo-matrix-effect-plugin
|
||||
*
|
||||
* Copyright (c) 2008 Paul Giblock <drfaygo/at/gmail/dot/com>
|
||||
*
|
||||
* 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 <lherard/at/gmail.com>",
|
||||
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<const plugin::descriptor::subPluginFeatures::key *>(
|
||||
_data ) ) );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
60
plugins/stereo_matrix/stereo_matrix.h
Normal file
60
plugins/stereo_matrix/stereo_matrix.h
Normal file
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
* stereo_matrix.h - stereo-matrix-effect-plugin
|
||||
*
|
||||
* Copyright (c) 2008 Paul Giblock <drfaygo/at/gmail/dot/com>
|
||||
*
|
||||
* 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 <QtGui/QWorkspace>
|
||||
|
||||
#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
|
||||
72
plugins/stereo_matrix/stereomatrix_control_dialog.cpp
Normal file
72
plugins/stereo_matrix/stereomatrix_control_dialog.cpp
Normal file
@@ -0,0 +1,72 @@
|
||||
/*
|
||||
* stereomatrix_control_dialog.cpp - control dialog for stereoMatrix-effect
|
||||
*
|
||||
* Copyright (c) 2008 Paul Giblock <drfaygo/at/gmail/dot/com>
|
||||
*
|
||||
* 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 <QtGui/QLayout>
|
||||
#include <QtGui/QLabel>
|
||||
|
||||
#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);
|
||||
}
|
||||
|
||||
44
plugins/stereo_matrix/stereomatrix_control_dialog.h
Normal file
44
plugins/stereo_matrix/stereomatrix_control_dialog.h
Normal file
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* stereomatrix_control_dialog.h - control dialog for stereoMatrix-effect
|
||||
*
|
||||
* Copyright (c) 2008 Paul Giblock <drfaygo/at/gmail/dot/com>
|
||||
*
|
||||
* 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
|
||||
82
plugins/stereo_matrix/stereomatrix_controls.cpp
Normal file
82
plugins/stereo_matrix/stereomatrix_controls.cpp
Normal file
@@ -0,0 +1,82 @@
|
||||
/*
|
||||
* stereomatrix_controls.cpp - controls for stereoMatrix-effect
|
||||
*
|
||||
* Copyright (c) 2008 Paul Giblock <drfaygo/at/gmail/dot/com>
|
||||
*
|
||||
* 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"
|
||||
|
||||
79
plugins/stereo_matrix/stereomatrix_controls.h
Normal file
79
plugins/stereo_matrix/stereomatrix_controls.h
Normal file
@@ -0,0 +1,79 @@
|
||||
/*
|
||||
* stereomatrix_controls.h - controls for stereoMatrix-effect
|
||||
*
|
||||
* Copyright (c) 2008 Paul Giblock <drfaygo/at/gmail/dot/com>
|
||||
*
|
||||
* 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
|
||||
Reference in New Issue
Block a user