first attempt at adding effects

git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@294 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
Danny McRae
2006-08-08 01:26:01 +00:00
parent 7bd0c141d4
commit 95be1a9635
49 changed files with 3198 additions and 155 deletions

View File

@@ -38,6 +38,10 @@
#endif
#include "ladspa_manager.h"
#ifdef LADSPA_SUPPORT
#include "effect_chain.h"
#endif
#include "mixer.h"
#include "effect_board.h"
@@ -76,6 +80,13 @@ public:
return( m_nextFxChannel );
}
#ifdef LADSPA_SUPPORT
inline effectChain * getEffects( void )
{
return( m_effects );
}
#endif
void setNextFxChannel( const fx_ch_t _chnl )
{
m_nextFxChannel = _chnl;
@@ -94,7 +105,10 @@ public:
{
NONE, FIRST, BOTH
} m_bufferUsage;
#ifdef LADSPA_SUPPORT
inline bool processEffects( void ) { return( m_effects->processAudioBuffer( m_firstBuffer, m_frames ) ); };
#endif
private:
surroundSampleFrame * m_firstBuffer;
@@ -103,6 +117,11 @@ private:
fx_ch_t m_nextFxChannel;
QString m_name;
#ifdef LADSPA_SUPPORT
effectChain * m_effects;
fpab_t m_frames;
#endif
} ;

162
include/effect.h Normal file
View File

@@ -0,0 +1,162 @@
/*
* effect.h - base class for effects
*
* Copyright (c) 2006 Danny McRae <khjklujn/at/users.sourceforge.net>
*
* 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., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
*/
#ifndef _EFFECT_H
#define _EFFECT_H
#include "ladspa_manager.h"
#ifdef LADSPA_SUPPORT
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "qt3support.h"
#include "engine.h"
#include "ladspa_2_lmms.h"
#include "mixer.h"
#include "ladspa_control.h"
typedef enum bufferRates
{
CHANNEL_IN,
CHANNEL_OUT,
AUDIO_RATE_INPUT,
AUDIO_RATE_OUTPUT,
CONTROL_RATE_INPUT,
CONTROL_RATE_OUTPUT
} buffer_rate_t;
typedef enum bufferData
{
TOGGLED,
INTEGER,
FLOAT,
NONE
} buffer_data_t;
typedef struct portDescription
{
QString name;
ch_cnt_t proc;
Uint16 port_id;
Uint16 control_id;
buffer_rate_t rate;
buffer_data_t data_type;
LADSPA_Data max;
LADSPA_Data min;
LADSPA_Data def;
LADSPA_Data value;
LADSPA_Data * buffer;
ladspaControl * control;
} port_desc_t;
typedef vvector<port_desc_t *> multi_proc_t;
class effect: public engineObject
{
public:
effect( const ladspa_key_t & _key, engine * _engine );
~effect();
bool FASTCALL processAudioBuffer( surroundSampleFrame * _buf, const fpab_t _frames );
void FASTCALL setControl( Uint16 _control, LADSPA_Data _data );
inline const multi_proc_t & getControls( void )
{
return( m_controls );
}
inline ch_cnt_t getProcessorCount( void )
{
return( m_processors );
}
inline void setRunning( void )
{
m_bufferCount = 0;
m_running = TRUE;
};
inline void setBypass( bool _mode )
{
m_bypass = _mode;
}
inline bool isRunning( void )
{
return( m_running );
}
inline void setTimeout( Uint32 _time_out )
{
m_silenceTimeout = _time_out;
}
inline void setWetDry( float _wet )
{
m_wetDry = _wet;
}
inline const QString & getName( void )
{
return( m_name );
}
void FASTCALL setGate( float _level );
private:
ladspa_key_t m_key;
ladspa2LMMS * m_ladspa;
QString m_name;
ch_cnt_t m_processors;
Uint16 m_effectChannels;
Uint16 m_portCount;
const LADSPA_Descriptor * m_descriptor;
vvector<LADSPA_Handle> m_handles;
vvector<multi_proc_t> m_ports;
multi_proc_t m_controls;
effect * m_output;
bool m_okay;
bool m_noRun;
bool m_running;
bool m_bypass;
Uint32 m_bufferCount;
Uint32 m_silenceTimeout;
float m_wetDry;
float m_gate;
};
#endif
#endif

74
include/effect_chain.h Normal file
View File

@@ -0,0 +1,74 @@
/*
* effect_chain.h - class for processing and effects chain
*
* Copyright (c) 2006 Danny McRae <khjklujn/at/users.sourceforge.net>
*
* 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., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
*/
#ifndef _EFFECT_CHAIN_H
#define _EFFECT_CHAIN_H
#include "ladspa_manager.h"
#ifdef LADSPA_SUPPORT
#include "qt3support.h"
#include "engine.h"
#include "effect.h"
typedef vvector<effect *> effect_list_t;
class effectChain: public engineObject
{
public:
effectChain( engine * _engine );
~effectChain();
void FASTCALL appendEffect( effect * _effect );
bool FASTCALL processAudioBuffer( surroundSampleFrame * _buf, const fpab_t _frames );
void FASTCALL swapEffects( effect * _eff1, effect * _eff2 );
void setRunning( void );
bool isRunning( void );
inline void setBypass( bool _mode )
{
m_bypassed = _mode;
}
inline const effect_list_t & getEffects( void )
{
return( m_effects );
}
private:
effect_list_t m_effects;
bool m_bypassed;
};
#endif
#endif

View File

@@ -0,0 +1,99 @@
/*
* effect_tab_widget.h - tab-widget in channel-track-window for setting up
* effects
*
* Copyright (c) 2006 Danny McRae <khjklujn/at/users.sourceforge.net>
*
* 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., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
*/
#ifndef _EFFECT_TAB_WIDGET_H
#define _EFFECT_TAB_WIDGET_H
#include "ladspa_manager.h"
#ifdef LADSPA_SUPPORT
#include "qt3support.h"
#ifdef QT4
#include <QtGui/QWidget>
#else
#include <qwidget.h>
#include <qpushbutton.h>
#include <qlayout.h>
#include <qscrollview.h>
#include <qvbox.h>
#include <qptrlist.h>
#endif
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "journalling_object.h"
#include "engine.h"
#include "rack_plugin.h"
#include "rack_view.h"
class instrumentTrack;
class groupBox;
class effectTabWidget : public QWidget, public journallingObject
{
Q_OBJECT
public:
effectTabWidget( instrumentTrack * _channel_track );
virtual ~effectTabWidget();
virtual void FASTCALL saveSettings( QDomDocument & _doc,
QDomElement & _parent );
virtual void FASTCALL loadSettings( const QDomElement & _this );
inline virtual QString nodeName( void ) const
{
return( "fx" );
}
private slots:
void addEffect( void );
void setBypass( bool _state );
private:
instrumentTrack * m_instrumentTrack;
groupBox * m_effectsGroupBox;
QPushButton * m_addButton;
rackView * m_rack;
friend class instrumentTrack;
} ;
#endif
#endif

View File

@@ -35,6 +35,10 @@ class pianoRoll;
class projectNotes;
class songEditor;
#include "ladspa_manager.h"
#ifdef LADSPA_SUPPORT
class ladspa2LMMS;
#endif
class engine
{
@@ -103,6 +107,13 @@ public:
return( m_automationEditor );
}
#ifdef LADSPA_SUPPORT
inline ladspa2LMMS * getLADSPAManager( void )
{
return( m_ladspaManager );
}
#endif
void close( void );
float framesPerTact64th( void ) const
@@ -124,7 +135,11 @@ private:
pianoRoll * m_pianoRoll;
projectNotes * m_projectNotes;
projectJournal * m_projectJournal;
#ifdef LADSPA_SUPPORT
ladspa2LMMS * m_ladspaManager;
#endif
} ;

View File

@@ -39,6 +39,7 @@
#endif
#include "pixmap_button.h"
#include "ladspa_manager.h"
class QPixmap;
@@ -62,6 +63,10 @@ public slots:
void setState( bool _on, bool _anim = FALSE );
void animate( void );
#ifdef LADSPA_SUPPORT
signals:
void toggled( bool _state );
#endif
protected:
virtual void resizeEvent( QResizeEvent * _re );

View File

@@ -27,6 +27,8 @@
#ifndef _INSTRUMENT_TRACK_H
#define _INSTRUMENT_TRACK_H
#include "ladspa_manager.h"
#include "qt3support.h"
#ifdef QT4
@@ -70,6 +72,9 @@ class surroundArea;
class flpImport;
#ifdef LADSPA_SUPPORT
class effectTabWidget;
#endif
class instrumentTrack : public QWidget, public track, public midiEventProcessor
@@ -170,6 +175,11 @@ public:
{
return( m_pianoWidget );
}
inline audioPort * getAudioPort( void )
{
return( m_audioPort );
}
public slots:
@@ -239,7 +249,9 @@ private:
envelopeTabWidget * m_envWidget;
arpAndChordsTabWidget * m_arpWidget;
midiTabWidget * m_midiWidget;
#ifdef LADSPA_SUPPORT
effectTabWidget * m_effWidget;
#endif
// test-piano at the bottom of every instrument-settings-window
pianoWidget * m_pianoWidget;

86
include/ladspa_2_lmms.h Normal file
View File

@@ -0,0 +1,86 @@
/*
* ladspa_2_lmms.h - class that identifies and instantiates LADSPA effects
* for use with LMMS
*
* Copyright (c) 2005 Danny McRae <khjklujn@netscape.net>
*
* 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., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
*/
#ifndef _LADSPA_2_LMMS_H
#define _LADSPA_2_LMMS_H
#include "ladspa_manager.h"
#ifdef LADSPA_SUPPORT
#include "engine.h"
class ladspa2LMMS: public ladspaManager
{
public:
inline l_sortable_plugin_t getInstruments( void )
{
return( m_instruments );
}
inline l_sortable_plugin_t getValidEffects( void )
{
return( m_validEffects );
}
inline l_sortable_plugin_t getInvalidEffects( void )
{
return( m_invalidEffects );
}
inline l_sortable_plugin_t getAnalysisTools( void )
{
return( m_analysisTools );
}
inline l_sortable_plugin_t getOthers( void )
{
return( m_otherPlugins );
}
QString getShortName( const ladspa_key_t & _key );
private:
ladspa2LMMS( engine * _engine );
~ladspa2LMMS();
// engine * m_engine;
// ladspaManager * m_ladspa;
l_sortable_plugin_t m_instruments;
l_sortable_plugin_t m_validEffects;
l_sortable_plugin_t m_invalidEffects;
l_sortable_plugin_t m_analysisTools;
l_sortable_plugin_t m_otherPlugins;
friend class engine;
};
#endif
#endif

75
include/ladspa_browser.h Normal file
View File

@@ -0,0 +1,75 @@
/*
* ladspa_browser.h - dialog to display information about installed LADSPA
* plugins
*
* Copyright (c) 2006 Danny McRae <khjklujn/at/users.sourceforge.net>
*
* 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., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
*/
#ifndef _LADSPA_BROWSER_H
#define _LADSPA_BROWSER_H
#include "ladspa_manager.h"
#ifdef LADSPA_SUPPORT
#include "qt3support.h"
#ifdef QT4
#include <QtGui/QDialog>
#else
#include <qdialog.h>
#endif
#include "engine.h"
class QComboBox;
class QLabel;
class QLineEdit;
class QSlider;
class tabBar;
class ladspaBrowser : public QDialog, public engineObject
{
Q_OBJECT
public:
ladspaBrowser( engine * _engine );
virtual ~ladspaBrowser();
inline void labelWidget( QWidget * _w, const QString & _txt );
public slots:
void showPorts( const ladspa_key_t & _key );
void testLADSPA( const ladspa_key_t & _key );
private:
tabBar * m_tabBar;
} ;
#endif
#endif

58
include/ladspa_control.h Normal file
View File

@@ -0,0 +1,58 @@
/*
* ladspa_control.h - widget for controlling a LADSPA port
*
* Copyright (c) 2006 Danny McRae <khjklujn/at/users.sourceforge.net>
*
* 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., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
*/
#ifndef _LADSPA_CONTROL_H
#define _LADSPA_CONTROL_H
#include "ladspa_manager.h"
#ifdef LADSPA_SUPPORT
#include <qwidget.h>
#include "engine.h"
#include "instrument_track.h"
#include "knob.h"
#include "led_checkbox.h"
typedef struct portDescription port_desc_t;
class ladspaControl : public QWidget, public engineObject
{
Q_OBJECT
public:
ladspaControl( QWidget * _parent, port_desc_t * _port, engine * _engine, instrumentTrack * _track );
~ladspaControl();
LADSPA_Data getValue( void );
private:
port_desc_t * m_port;
ledCheckBox * m_toggle;
knob * m_knob;
};
#endif
#endif

View File

@@ -58,82 +58,107 @@
#include "types.h"
#include "qt3support.h"
class engine;
typedef QPair<QString, QString> ladspaKey;
const float NOHINT = -99342.2243f;
typedef QPair<QString, QString> ladspa_key_t;
typedef QPair<QString, ladspa_key_t> sortable_plugin_t;
typedef vlist<sortable_plugin_t> l_sortable_plugin_t;
typedef vlist<ladspa_key_t> l_ladspa_key_t;
/* ladspaManager provides a database of LADSPA plug-ins. Upon instantiation,
it loads all of the plug-ins found in the LADSPA_PATH environmental variable
and stores their access descriptors according in a dictionary keyed on
the filename the plug-in was loaded from and the label of the plug-in.
The can be retrieved by using ladspaKey. For example, to get the
The can be retrieved by using ladspa_key_t. For example, to get the
"Phase Modulated Voice" plug-in from the cmt library, you would perform the
calls using:
ladspaKey( "cmt.so", "phasemod" )
ladspa_key_t key( "cmt.so", "phasemod" )
as the plug-in key. */
enum pluginType
{
SOURCE,
TRANSFER,
VALID,
INVALID,
SINK,
OTHER
};
typedef struct ladspaManagerStorage
{
LADSPA_Descriptor_Function descriptorFunction;
Uint32 index;
pluginType type;
Uint16 inputChannels;
Uint16 outputChannels;
} ladspaManagerDescription;
class ladspaManager
{
public:
/* Provides access to the single instance of the class. */
static inline ladspaManager * inst( void )
{
if( s_instanceOfMe == NULL )
{
s_instanceOfMe = new ladspaManager();
}
return( s_instanceOfMe );
}
ladspaManager( engine * _engine );
~ladspaManager();
l_sortable_plugin_t getSortedPlugins();
ladspaManagerDescription * getDescription( const ladspa_key_t &
_plugin );
/* This identifier can be used as a unique, case-sensitive
identifier for the plugin type within the plugin file. Plugin
types should be identified by file and label rather than by index
or plugin name, which may be changed in new plugin
versions. Labels must not contain white-space characters. */
QString FASTCALL getLabel( const ladspaKey & _plugin );
QString FASTCALL getLabel( const ladspa_key_t & _plugin );
/* Indicates that the plugin has a real-time dependency
(e.g. listens to a MIDI device) and so its output must not
be cached or subject to significant latency. */
bool FASTCALL hasRealTimeDependency( const ladspaKey & _plugin );
bool FASTCALL hasRealTimeDependency( const ladspa_key_t & _plugin );
/* Indicates that the plugin may cease to work correctly if the
host elects to use the same data location for both input and output
(see connectPort). */
bool FASTCALL isInplaceBroken( const ladspaKey & _plugin );
bool FASTCALL isInplaceBroken( const ladspa_key_t & _plugin );
/* Indicates that the plugin is capable of running not only in a
conventional host but also in a 'hard real-time' environment. */
bool FASTCALL isRealTimeCapable( const ladspaKey & _plugin );
bool FASTCALL isRealTimeCapable( const ladspa_key_t & _plugin );
/* Returns the name of the plug-in */
QString FASTCALL getName( const ladspaKey & _plugin );
QString FASTCALL getName( const ladspa_key_t & _plugin );
/* Returns the the plug-in's author */
QString FASTCALL getMaker( const ladspaKey & _plugin );
QString FASTCALL getMaker( const ladspa_key_t & _plugin );
/* Returns the copyright for the plug-in */
QString FASTCALL getCopyright( const ladspaKey & _plugin );
QString FASTCALL getCopyright( const ladspa_key_t & _plugin );
/* This indicates the number of ports (input AND output) present on
the plugin. */
Uint32 FASTCALL getPortCount( const ladspaKey & _plugin );
Uint32 FASTCALL getPortCount( const ladspa_key_t & _plugin );
/* Indicates that the port is an input. */
bool FASTCALL isPortInput( const ladspaKey & _plugin, Uint32 _port );
bool FASTCALL isPortInput( const ladspa_key_t & _plugin, Uint32 _port );
/* Indicates that the port is an output. */
bool FASTCALL isPortOutput( const ladspaKey & _plugin, Uint32 _port );
bool FASTCALL isPortOutput( const ladspa_key_t & _plugin, Uint32 _port );
/* Indicates that the port is an audio. */
bool FASTCALL isPortAudio( const ladspaKey & _plugin, Uint32 _port );
bool FASTCALL isPortAudio( const ladspa_key_t & _plugin, Uint32 _port );
/* Indicates that the port is an control. */
bool FASTCALL isPortControl( const ladspaKey & _plugin, Uint32 _port );
bool FASTCALL isPortControl( const ladspa_key_t & _plugin, Uint32 _port );
/* Indicates that any bounds specified should be interpreted as
multiples of the sample rate. For instance, a frequency range from
@@ -141,44 +166,44 @@ public:
by this hint in conjunction with LowerBound = 0 and UpperBound = 0.5.
Hosts that support bounds at all must support this hint to retain
meaning. */
bool FASTCALL areHintsSampleRateDependent( const ladspaKey & _plugin,
bool FASTCALL areHintsSampleRateDependent( const ladspa_key_t & _plugin,
Uint32 _port );
/* Returns the lower boundary value for the given port. If
no lower bound is provided by the plug-in, returns -999e-99. When
areHintsSampleRateDependent() is also true then this value should be
multiplied by the relevant sample rate. */
float FASTCALL getLowerBound( const ladspaKey & _plugin, Uint32 _port );
float FASTCALL getLowerBound( const ladspa_key_t & _plugin, Uint32 _port );
/* Returns the upper boundary value for the given port. If
no upper bound is provided by the plug-in, returns -999e-99. When
areHintsSampleRateDependent() is also true then this value should be
multiplied by the relevant sample rate. */
float FASTCALL getUpperBound( const ladspaKey & _plugin, Uint32 _port );
float FASTCALL getUpperBound( const ladspa_key_t & _plugin, Uint32 _port );
/* Indicates whether the given port should be considered 0 or 1
boolean switch. */
bool FASTCALL isPortToggled( const ladspaKey & _plugin, Uint32 _port );
bool FASTCALL isPortToggled( const ladspa_key_t & _plugin, Uint32 _port );
/* Retrieves any default setting hints offered by the plug-in for
the given port. */
float FASTCALL getDefaultSetting( const ladspaKey & _plugin,
float FASTCALL getDefaultSetting( const ladspa_key_t & _plugin,
Uint32 _port );
/* Indicates that it is likely that the user will find it more
intuitive to view values using a logarithmic scale. This is
particularly useful for frequencies and gains. */
bool FASTCALL isLogarithmic( const ladspaKey & _plugin, Uint32 _port );
bool FASTCALL isLogarithmic( const ladspa_key_t & _plugin, Uint32 _port );
/* Indicates that a user interface would probably wish to provide a
stepped control taking only integer values. Any bounds set should be
slightly wider than the actual integer range required to avoid floating
point rounding errors. For instance, the integer set {0,1,2,3} might
be described as [-0.1, 3.1]. */
bool FASTCALL isInteger( const ladspaKey & _plugin, Uint32 _port );
bool FASTCALL isInteger( const ladspa_key_t & _plugin, Uint32 _port );
/* Returns the name of the port. */
QString FASTCALL getPortName( const ladspaKey & _plugin, Uint32 _port );
QString FASTCALL getPortName( const ladspa_key_t & _plugin, Uint32 _port );
/* This may be used by the plugin developer to pass any custom
@@ -187,13 +212,13 @@ public:
writers will not use this facility as LADSPA_Handle should be
used to hold instance data. */
const void * FASTCALL getImplementationData(
const ladspaKey & _plugin );
const ladspa_key_t & _plugin );
/* Returns a pointer to the plug-in's descriptor from which control
of the plug-in is accessible */
const LADSPA_Descriptor * FASTCALL getDescriptor(
const ladspaKey & _plugin );
const ladspa_key_t & _plugin );
/* The following methods are convenience functions for use during
@@ -203,7 +228,7 @@ public:
/* Returns a handle to an instantiation of the given plug-in. */
LADSPA_Handle FASTCALL instantiate( const ladspaKey & _plugin,
LADSPA_Handle FASTCALL instantiate( const ladspa_key_t & _plugin,
Uint32 _sample_rate );
/* This method calls a function pointer that connects a port on an
@@ -223,7 +248,7 @@ public:
connectPort() must be called at least once for each port before
run() or runAdding() is called. */
void FASTCALL connectPort( const ladspaKey & _plugin,
bool FASTCALL connectPort( const ladspa_key_t & _plugin,
LADSPA_Handle _instance,
Uint32 _port,
LADSPA_Data * _data_location );
@@ -247,7 +272,7 @@ public:
called again unless deactivate() is called first. Note that
connectPort() may be called before or after a call to
activate(). */
void FASTCALL activate( const ladspaKey & _plugin,
bool FASTCALL activate( const ladspa_key_t & _plugin,
LADSPA_Handle _instance );
/* This method calls a function pointer that runs an instance of a
@@ -260,7 +285,7 @@ public:
before run() or run_adding(). If deactivate() is called for a
plugin instance then the plugin instance may not be reused until
activate() has been called again. */
void FASTCALL run( const ladspaKey & _plugin, LADSPA_Handle _instance,
bool FASTCALL run( const ladspa_key_t & _plugin, LADSPA_Handle _instance,
Uint32 _sample_count );
/* This method calls a function pointer that runs an instance of a
@@ -276,7 +301,7 @@ public:
runAdding() is optional. When it is not provided by a plugin,
this function pointer must be set to NULL. When it is provided,
the function setRunAddingGain() must be provided also. */
void FASTCALL runAdding( const ladspaKey & _plugin,
bool FASTCALL runAdding( const ladspa_key_t & _plugin,
LADSPA_Handle _instance,
Uint32 _sample_count );
@@ -289,7 +314,7 @@ public:
This function should be provided by the plugin if and only if the
runAdding() function is provided. When it is absent this
function pointer must be set to NULL. */
void FASTCALL setRunAddingGain( const ladspaKey & _plugin,
bool FASTCALL setRunAddingGain( const ladspa_key_t & _plugin,
LADSPA_Handle _instance,
LADSPA_Data _gain );
@@ -306,7 +331,7 @@ public:
Deactivation is not similar to pausing as the plugin instance
will be reinitialised when activate() is called to reuse it. */
void FASTCALL deactivate( const ladspaKey & _plugin,
bool FASTCALL deactivate( const ladspa_key_t & _plugin,
LADSPA_Handle _instance );
/* Once an instance of a plugin has been finished with it can be
@@ -316,27 +341,21 @@ public:
If activate() was called for a plugin instance then a
corresponding call to deactivate() must be made before cleanup()
is called. */
void FASTCALL cleanup( const ladspaKey & _plugin,
bool FASTCALL cleanup( const ladspa_key_t & _plugin,
LADSPA_Handle _instance );
private:
void FASTCALL addPlugins( LADSPA_Descriptor_Function _descriptor_func,
const QString & _file );
const QString & _file );
Uint16 FASTCALL getPluginInputs( const LADSPA_Descriptor * _descriptor );
Uint16 FASTCALL getPluginOutputs( const LADSPA_Descriptor * _descriptor );
ladspaManager( void );
~ladspaManager();
static ladspaManager * s_instanceOfMe;
typedef struct ladspaManagerStorage
{
LADSPA_Descriptor_Function descriptorFunction;
Uint32 index;
} ladspaManagerDescription;
typedef QMap<ladspaKey, ladspaManagerDescription *> ladspaManagerMapType;
typedef QMap<ladspa_key_t, ladspaManagerDescription *>
ladspaManagerMapType;
ladspaManagerMapType m_ladspaManagerMap;
l_sortable_plugin_t m_sortedPlugins;
friend class engine;
} ;

View File

@@ -0,0 +1,61 @@
/*
* ladspa_port_dialog.h - dialog to test a LADSPA plugin
*
* Copyright (c) 2006 Danny McRae <khjklujn/at/users.sourceforge.net>
*
* 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., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
*/
#ifndef _LADSPA_PORT_DIALOG_H
#define _LADSPA_PORT_DIALOG_H
#include "ladspa_manager.h"
#ifdef LADSPA_SUPPORT
#ifdef QT4
#include <QtGui/QDialog>
#else
#include <qdialog.h>
#endif
#include "ladspa_2_lmms.h"
class ladspaPortDialog : public QDialog, public engineObject
{
Q_OBJECT
public:
ladspaPortDialog( const ladspa_key_t & _key,
engine * _engine );
virtual ~ladspaPortDialog();
private:
ladspa_key_t m_key;
ladspa2LMMS * m_ladspa;
};
#endif
#endif

View File

@@ -50,6 +50,7 @@
#include "types.h"
#include "engine.h"
#include "ladspa_manager.h"
class QDomElement;
@@ -118,6 +119,7 @@ public slots:
void showSettingsDialog( void );
void aboutLMMS( void );
void help( void );
void ladspaPluginBrowser( void );
void toggleAutomationEditorWin( void );
void toggleBBEditorWin( void );
void toggleSongEditorWin( void );

View File

@@ -185,10 +185,10 @@ private:
float syncInit( sampleFrame * _ab, const fpab_t _frames,
const ch_cnt_t _chnl );
bool syncOk( float _osc_coeff );
inline bool syncOk( float _osc_coeff );
sample_t getSample( const float _sample );
void FASTCALL recalcPhase( void );
inline sample_t getSample( const float _sample );
inline void FASTCALL recalcPhase( void );
} ;

82
include/rack_plugin.h Normal file
View File

@@ -0,0 +1,82 @@
/*
* effect_tab_widget.h - tab-widget in channel-track-window for setting up
* effects
*
* Copyright (c) 2006 Danny McRae <khjklujn/at/users.sourceforge.net>
*
* 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., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
*/
#ifndef _RACK_PLUGIN_H
#define _RACK_PLUGIN_H
#include "ladspa_manager.h"
#ifdef LADSPA_SUPPORT
#include <qwidget.h>
#include <qgroupbox.h>
#include <qpushbutton.h>
#include <qlabel.h>
#include "journalling_object.h"
#include "led_checkbox.h"
#include "instrument_track.h"
#include "embossed_font_label.h"
#include "effect.h"
#include "ladspa_control_dialog.h"
class knob;
class rackPlugin: public QWidget, public journallingObject
{
Q_OBJECT
public:
rackPlugin( QWidget * _parent, ladspa_key_t _key, instrumentTrack * _track, engine * _engine );
~rackPlugin();
QString nodeName( void ) const
{
return( "plugin" );
}
public slots:
void editControls( void );
void bypassed( bool _state );
void setWetDry( float _value );
void setAutoQuit( float _value );
void setGate( float _value );
private:
ledCheckBox * m_bypass;
knob * m_wetDry;
knob * m_autoQuit;
knob * m_gate;
QGroupBox * m_grouper;
QGroupBox * m_controls;
QLabel * m_label;
QPushButton * m_editButton;
effect * m_effect;
ladspaControlDialog * m_controlView;
};
#endif
#endif

65
include/rack_view.h Normal file
View File

@@ -0,0 +1,65 @@
/*
* right_frame.h - provides the display for the rackInsert instances
*
* Copyright (c) 2006 Danny McRae <khjklujn@netscape.net>
*
* 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., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
*/
#ifndef _RIGHT_FRAME_H
#define _RIGHT_FRAME_H
#include "ladspa_manager.h"
#ifdef LADSPA_SUPPORT
#include <qwidget.h>
#include <qlayout.h>
#include <qscrollview.h>
#include <qvbox.h>
#include <qptrlist.h>
#include "types.h"
#include "engine.h"
#include "rack_plugin.h"
#include "instrument_track.h"
class rackView: public QWidget, public engineObject
{
Q_OBJECT
public:
rackView( QWidget * _parent, engine * _engine, instrumentTrack * _track );
~rackView();
void addPlugin( ladspa_key_t _key );
private:
QPtrList<rackPlugin> m_rackInserts;
int m_insertIndex;
QVBoxLayout * m_mainLayout;
QScrollView * m_scrollView;
QVBox * m_rack;
instrumentTrack * m_instrumentTrack;
};
#endif
#endif