split effect into effect and ladspaEffect
git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@325 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
24
ChangeLog
24
ChangeLog
@@ -1,3 +1,27 @@
|
||||
2006-08-14 Danny McRae <khjklujn/at/users/dot/sourceforge/dot/net>
|
||||
* Makefile.am:
|
||||
* include/ladspa_effect.h:
|
||||
* src/core/ladspa_effect.cpp:
|
||||
* include/effect.h:
|
||||
* include/effect_chain.h:
|
||||
* include/ladspa_browser:
|
||||
* include/ladspa_control_dialog.h:
|
||||
* include/rack_plugin.h:
|
||||
* select_ladspa_dialog.h:
|
||||
* src/core/effect.cpp:
|
||||
* src/core/effect_chain.cpp:
|
||||
* src/core/ladspa_browser.cpp:
|
||||
* src/core/ladspa_control_dialog.cpp:
|
||||
* src/core/select_ladspa_dialog.cpp:
|
||||
* src/tracks/instrument_track.cpp:
|
||||
* src/tracks/sample_track.cpp:
|
||||
* src/widgets/ladspa_control.cpp:
|
||||
* src/widgets/rack_plugin.cpp:
|
||||
- separated ladspa specific stuff into a class derived from
|
||||
effect
|
||||
- changed the default value range for unhinted ports from
|
||||
(-99999,99999) to (0,1)
|
||||
|
||||
2006-08-13 Javier Serrano Polo <jasp00/at/terra/dot/es>
|
||||
|
||||
* src/tracks/sample_track.cpp:
|
||||
|
||||
@@ -153,6 +153,7 @@ lmms_SOURCES = \
|
||||
$(srcdir)/src/core/instrument.cpp \
|
||||
$(srcdir)/src/core/ladspa_browser.cpp \
|
||||
$(srcdir)/src/core/ladspa_control_dialog.cpp \
|
||||
$(srcdir)/src/core/ladspa_effect.cpp \
|
||||
$(srcdir)/src/core/ladspa_port_dialog.cpp \
|
||||
$(srcdir)/src/core/main_window.cpp \
|
||||
$(srcdir)/src/core/main.cpp \
|
||||
@@ -360,6 +361,7 @@ lmms_SOURCES = \
|
||||
$(srcdir)/include/rack_plugin.h \
|
||||
$(srcdir)/include/rack_view.h \
|
||||
$(srcdir)/include/select_ladspa_dialog.h \
|
||||
$(srcdir)/include/ladspa_effect.h \
|
||||
$(srcdir)/include/qxembed.h
|
||||
|
||||
|
||||
|
||||
166
include/effect.h
166
include/effect.h
@@ -46,81 +46,67 @@
|
||||
#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;
|
||||
bool is_scaled;
|
||||
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();
|
||||
effect( engine * _engine );
|
||||
virtual ~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 );
|
||||
}
|
||||
virtual bool FASTCALL processAudioBuffer( surroundSampleFrame * _buf, const fpab_t _frames );
|
||||
|
||||
inline ch_cnt_t getProcessorCount( void )
|
||||
{
|
||||
return( m_processors );
|
||||
}
|
||||
|
||||
inline void setRunning( void )
|
||||
inline void setProcessorCount( ch_cnt_t _processors )
|
||||
{
|
||||
m_processors = _processors;
|
||||
}
|
||||
|
||||
inline bool isOkay( void )
|
||||
{
|
||||
return( m_okay );
|
||||
}
|
||||
|
||||
inline void setOkay( bool _state )
|
||||
{
|
||||
m_okay = _state;
|
||||
}
|
||||
|
||||
|
||||
inline bool isRunning( void )
|
||||
{
|
||||
return( m_running );
|
||||
}
|
||||
|
||||
inline void startRunning( void )
|
||||
{
|
||||
m_bufferCount = 0;
|
||||
m_running = TRUE;
|
||||
};
|
||||
}
|
||||
|
||||
inline void stopRunning( void )
|
||||
{
|
||||
m_running = FALSE;
|
||||
}
|
||||
|
||||
inline bool isBypassed( void )
|
||||
{
|
||||
return( m_bypass );
|
||||
}
|
||||
|
||||
inline void setBypass( bool _mode )
|
||||
{
|
||||
m_bypass = _mode;
|
||||
}
|
||||
|
||||
inline bool isRunning( void )
|
||||
inline Uint32 getTimeout( void )
|
||||
{
|
||||
return( m_running );
|
||||
return( m_silenceTimeout );
|
||||
}
|
||||
|
||||
inline void setTimeout( Uint32 _time_out )
|
||||
@@ -128,7 +114,17 @@ public:
|
||||
m_silenceTimeout = _time_out;
|
||||
}
|
||||
|
||||
inline void setWetDry( float _wet )
|
||||
inline float getWetLevel( void )
|
||||
{
|
||||
return( m_wetDry );
|
||||
}
|
||||
|
||||
inline float getDryLevel( void )
|
||||
{
|
||||
return( 1.0f - m_wetDry );
|
||||
}
|
||||
|
||||
inline void setWetLevel( float _wet )
|
||||
{
|
||||
m_wetDry = _wet;
|
||||
}
|
||||
@@ -138,25 +134,61 @@ public:
|
||||
return( m_name );
|
||||
}
|
||||
|
||||
inline void setName( QString _name )
|
||||
{
|
||||
m_name = _name;
|
||||
}
|
||||
|
||||
inline float getGate( void )
|
||||
{
|
||||
return( m_gate );
|
||||
}
|
||||
|
||||
void FASTCALL setGate( float _level );
|
||||
|
||||
inline Uint32 getBufferCount( void )
|
||||
{
|
||||
return( m_bufferCount );
|
||||
}
|
||||
|
||||
inline void resetBufferCount( void )
|
||||
{
|
||||
m_bufferCount = 0;
|
||||
}
|
||||
|
||||
inline void incrementBufferCount( void )
|
||||
{
|
||||
m_bufferCount++;
|
||||
}
|
||||
|
||||
inline bool tryLock( void )
|
||||
{
|
||||
return( m_processLock.tryLock() );
|
||||
}
|
||||
|
||||
inline void lock( void )
|
||||
{
|
||||
m_processLock.lock();
|
||||
}
|
||||
|
||||
inline void unlock( void )
|
||||
{
|
||||
m_processLock.unlock();
|
||||
}
|
||||
|
||||
inline bool dontRun( void )
|
||||
{
|
||||
return( m_noRun );
|
||||
}
|
||||
|
||||
inline void setDontRun( bool _state )
|
||||
{
|
||||
m_noRun = _state;
|
||||
}
|
||||
|
||||
private:
|
||||
ladspa_key_t m_key;
|
||||
ladspa2LMMS * m_ladspa;
|
||||
QString m_name;
|
||||
|
||||
ch_cnt_t m_processors;
|
||||
Uint16 m_effectChannels;
|
||||
Uint16 m_portCount;
|
||||
fpab_t m_bufferSize;
|
||||
|
||||
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;
|
||||
|
||||
@@ -56,7 +56,7 @@ public:
|
||||
void FASTCALL moveDown( effect * _effect );
|
||||
void FASTCALL moveUp( effect * _effect );
|
||||
bool FASTCALL processAudioBuffer( surroundSampleFrame * _buf, const fpab_t _frames );
|
||||
void setRunning( void );
|
||||
void startRunning( void );
|
||||
bool isRunning( void );
|
||||
|
||||
inline void setBypass( bool _mode )
|
||||
|
||||
@@ -63,7 +63,6 @@ public:
|
||||
|
||||
public slots:
|
||||
void showPorts( const ladspa_key_t & _key );
|
||||
void testLADSPA( const ladspa_key_t & _key );
|
||||
void displayHelp( void );
|
||||
|
||||
private:
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
#include "journalling_object.h"
|
||||
#include "led_checkbox.h"
|
||||
#include "track.h"
|
||||
#include "effect.h"
|
||||
#include "ladspa_effect.h"
|
||||
#include "ladspa_control_dialog.h"
|
||||
#include "audio_port.h"
|
||||
|
||||
@@ -111,7 +111,7 @@ private:
|
||||
QGroupBox * m_controls;
|
||||
QLabel * m_label;
|
||||
QPushButton * m_editButton;
|
||||
effect * m_effect;
|
||||
ladspaEffect * m_effect;
|
||||
ladspaControlDialog * m_controlView;
|
||||
track * m_track;
|
||||
audioPort * m_port;
|
||||
|
||||
@@ -39,18 +39,10 @@
|
||||
|
||||
|
||||
#include "effect.h"
|
||||
#include "mixer.h"
|
||||
#include "config_mgr.h"
|
||||
#include "buffer_allocator.h"
|
||||
#include "audio_device.h"
|
||||
#include "ladspa_control.h"
|
||||
|
||||
|
||||
effect::effect( const ladspa_key_t & _key, engine * _engine ) :
|
||||
effect::effect( engine * _engine ) :
|
||||
engineObject( _engine ),
|
||||
m_key( _key ),
|
||||
m_ladspa( _engine->getLADSPAManager() ),
|
||||
m_output( NULL ),
|
||||
m_okay( TRUE ),
|
||||
m_noRun( FALSE ),
|
||||
m_running( FALSE ),
|
||||
@@ -60,183 +52,6 @@ effect::effect( const ladspa_key_t & _key, engine * _engine ) :
|
||||
m_wetDry( 1.0f ),
|
||||
m_gate( 0.0f )
|
||||
{
|
||||
if( m_ladspa->getDescription( _key ) == NULL )
|
||||
{
|
||||
QMessageBox::warning( 0, "Effect", "Uknown LADSPA plugin requested: " + _key.first, QMessageBox::Ok, QMessageBox::NoButton );
|
||||
m_okay = FALSE;
|
||||
return;
|
||||
}
|
||||
|
||||
m_name = m_ladspa->getShortName( _key );
|
||||
|
||||
// Calculate how many processing units are needed.
|
||||
ch_cnt_t lmms_chnls = eng()->getMixer()->audioDev()->channels();
|
||||
m_effectChannels = m_ladspa->getDescription( _key )->inputChannels;
|
||||
m_processors = lmms_chnls / m_effectChannels;
|
||||
|
||||
// Categorize the ports, and create the buffers.
|
||||
m_bufferSize = eng()->getMixer()->framesPerAudioBuffer();
|
||||
m_portCount = m_ladspa->getPortCount( _key );
|
||||
|
||||
for( ch_cnt_t proc = 0; proc < m_processors; proc++ )
|
||||
{
|
||||
multi_proc_t ports;
|
||||
for( Uint16 port = 0; port < m_portCount; port++ )
|
||||
{
|
||||
port_desc_t * p = new portDescription;
|
||||
|
||||
p->name = m_ladspa->getPortName( _key, port );
|
||||
p->proc = proc;
|
||||
p->port_id = port;
|
||||
|
||||
// Determine the port's category.
|
||||
if( m_ladspa->isPortAudio( _key, port ) )
|
||||
{
|
||||
// Nasty manual memory management--was having difficulty
|
||||
// with some prepackaged plugins that were segfaulting
|
||||
// during cleanup. It was easier to troubleshoot with the
|
||||
// memory management all taking place in one file.
|
||||
p->buffer = new LADSPA_Data[m_bufferSize];
|
||||
|
||||
if( p->name.upper().contains( "IN" ) && m_ladspa->isPortInput( _key, port ) )
|
||||
{
|
||||
p->rate = CHANNEL_IN;
|
||||
}
|
||||
else if( p->name.upper().contains( "OUT" ) && m_ladspa->isPortOutput( _key, port ) )
|
||||
{
|
||||
p->rate = CHANNEL_OUT;
|
||||
}
|
||||
else if( m_ladspa->isPortInput( _key, port ) )
|
||||
{
|
||||
p->rate = AUDIO_RATE_INPUT;
|
||||
}
|
||||
else
|
||||
{
|
||||
p->rate = AUDIO_RATE_OUTPUT;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
p->buffer = new LADSPA_Data;
|
||||
|
||||
if( m_ladspa->isPortInput( _key, port ) )
|
||||
{
|
||||
p->rate = CONTROL_RATE_INPUT;
|
||||
}
|
||||
else
|
||||
{
|
||||
p->rate = CONTROL_RATE_OUTPUT;
|
||||
}
|
||||
}
|
||||
|
||||
if( m_ladspa->isPortToggled( _key, port ) )
|
||||
{
|
||||
p->data_type = TOGGLED;
|
||||
}
|
||||
else if( m_ladspa->isInteger( _key, port ) )
|
||||
{
|
||||
p->data_type = INTEGER;
|
||||
}
|
||||
else
|
||||
{
|
||||
p->data_type = FLOAT;
|
||||
}
|
||||
|
||||
// Get the range and default values.
|
||||
p->is_scaled = m_ladspa->areHintsSampleRateDependent( _key, port );
|
||||
p->max = m_ladspa->getUpperBound( _key, port );
|
||||
if( p->max == NOHINT )
|
||||
{
|
||||
p->max = 999999.0f;
|
||||
}
|
||||
else if( p->is_scaled )
|
||||
{
|
||||
p->max *= eng()->getMixer()->sampleRate();
|
||||
}
|
||||
|
||||
p->min = m_ladspa->getLowerBound( _key, port );
|
||||
if( p->min == NOHINT )
|
||||
{
|
||||
p->min = -999999.0f;
|
||||
}
|
||||
else if( p->is_scaled )
|
||||
{
|
||||
p->min *= eng()->getMixer()->sampleRate();
|
||||
}
|
||||
|
||||
p->def = m_ladspa->getDefaultSetting( _key, port );
|
||||
if( p->def == NOHINT )
|
||||
{
|
||||
if( p->data_type != TOGGLED )
|
||||
{
|
||||
p->def = ( p->min + p->max ) / 2.0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
p->def = 1.0f;
|
||||
}
|
||||
}
|
||||
|
||||
p->value = p->def;
|
||||
|
||||
|
||||
ports.append( p );
|
||||
|
||||
// For convenience, keep a separate list of the ports that are used
|
||||
// to control the processors.
|
||||
if( p->rate == AUDIO_RATE_INPUT || p->rate == CONTROL_RATE_INPUT )
|
||||
{
|
||||
p->control_id = m_controls.count();
|
||||
m_controls.append( p );
|
||||
}
|
||||
}
|
||||
m_ports.append( ports );
|
||||
}
|
||||
|
||||
// Instantiate the processing units.
|
||||
m_descriptor = m_ladspa->getDescriptor( _key );
|
||||
if( m_descriptor == NULL )
|
||||
{
|
||||
QMessageBox::warning( 0, "Effect", "Can't get LADSPA descriptor function: " + _key.first, QMessageBox::Ok, QMessageBox::NoButton );
|
||||
m_okay = FALSE;
|
||||
return;
|
||||
}
|
||||
if( m_descriptor->run == NULL )
|
||||
{
|
||||
QMessageBox::warning( 0, "Effect", "Plugin has no processor: " + _key.first, QMessageBox::Ok, QMessageBox::NoButton );
|
||||
m_noRun = TRUE;
|
||||
}
|
||||
for( ch_cnt_t proc = 0; proc < m_processors; proc++ )
|
||||
{
|
||||
LADSPA_Handle effect = m_ladspa->instantiate( _key, eng()->getMixer()->sampleRate() );
|
||||
if( effect == NULL )
|
||||
{
|
||||
QMessageBox::warning( 0, "Effect", "Can't get LADSPA instance: " + _key.first, QMessageBox::Ok, QMessageBox::NoButton );
|
||||
m_okay = FALSE;
|
||||
return;
|
||||
}
|
||||
m_handles.append( effect );
|
||||
|
||||
}
|
||||
|
||||
// Connect the ports.
|
||||
for( ch_cnt_t proc = 0; proc < m_processors; proc++ )
|
||||
{
|
||||
for( Uint16 port = 0; port < m_portCount; port++ )
|
||||
{
|
||||
if( !m_ladspa->connectPort( _key, m_handles[proc], port, m_ports[proc][port]->buffer ) )
|
||||
{
|
||||
QMessageBox::warning( 0, "Effect", "Failed to connect port: " + _key.first, QMessageBox::Ok, QMessageBox::NoButton );
|
||||
m_noRun = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Activate the processing units.
|
||||
for( ch_cnt_t proc = 0; proc < m_processors; proc++ )
|
||||
{
|
||||
m_ladspa->activate( _key, m_handles[proc] );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -244,28 +59,6 @@ effect::effect( const ladspa_key_t & _key, engine * _engine ) :
|
||||
|
||||
effect::~effect()
|
||||
{
|
||||
if( !m_okay )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
m_processLock.lock();
|
||||
|
||||
for( ch_cnt_t proc = 0; proc < m_processors; proc++ )
|
||||
{
|
||||
m_ladspa->deactivate( m_key, m_handles[proc] );
|
||||
m_ladspa->cleanup( m_key, m_handles[proc] );
|
||||
for( Uint16 port = 0; port < m_portCount; port++ )
|
||||
{
|
||||
free( m_ports[proc][port]->buffer );
|
||||
free( m_ports[proc][port] );
|
||||
}
|
||||
m_ports[proc].clear();
|
||||
}
|
||||
m_ports.clear();
|
||||
m_handles.clear();
|
||||
|
||||
m_processLock.unlock();
|
||||
}
|
||||
|
||||
|
||||
@@ -273,120 +66,7 @@ effect::~effect()
|
||||
|
||||
bool FASTCALL effect::processAudioBuffer( surroundSampleFrame * _buf, const fpab_t _frames )
|
||||
{
|
||||
if( !m_okay || m_noRun || !m_running || m_bypass || !m_processLock.tryLock() )
|
||||
{
|
||||
return( FALSE );
|
||||
}
|
||||
|
||||
// Copy the LMMS audio buffer to the LADSPA input buffer and initialize
|
||||
// the control ports. Need to change this to handle non-in-place-broken
|
||||
// plugins--would speed things up to use the same buffer for both
|
||||
// LMMS and LADSPA.
|
||||
ch_cnt_t channel = 0;
|
||||
for( ch_cnt_t proc = 0; proc < m_processors; proc++)
|
||||
{
|
||||
for( Uint16 port = 0; port < m_portCount; port++ )
|
||||
{
|
||||
switch( m_ports[proc][port]->rate )
|
||||
{
|
||||
case CHANNEL_IN:
|
||||
for( fpab_t frame = 0; frame < _frames; frame++ )
|
||||
{
|
||||
m_ports[proc][port]->buffer[frame] = _buf[frame][channel];
|
||||
}
|
||||
channel++;
|
||||
break;
|
||||
case AUDIO_RATE_INPUT:
|
||||
m_ports[proc][port]->value = static_cast<LADSPA_Data>( m_ports[proc][port]->control->getValue() );
|
||||
// This only supports control rate ports, so the audio rates are
|
||||
// treated as though they were control rate by setting the
|
||||
// port buffer to all the same value.
|
||||
for( fpab_t frame = 0; frame < _frames; frame++ )
|
||||
{
|
||||
m_ports[proc][port]->buffer[frame] = m_ports[proc][port]->value;
|
||||
}
|
||||
break;
|
||||
case CONTROL_RATE_INPUT:
|
||||
m_ports[proc][port]->value = static_cast<LADSPA_Data>( m_ports[proc][port]->control->getValue() );
|
||||
m_ports[proc][port]->buffer[0] = m_ports[proc][port]->value;
|
||||
break;
|
||||
case CHANNEL_OUT:
|
||||
case AUDIO_RATE_OUTPUT:
|
||||
case CONTROL_RATE_OUTPUT:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Process the buffers.
|
||||
for( ch_cnt_t proc = 0; proc < m_processors; proc++ )
|
||||
{
|
||||
(m_descriptor->run)(m_handles[proc], _frames);
|
||||
}
|
||||
|
||||
// Copy the LADSPA output buffers to the LMMS buffer.
|
||||
double out_sum = 0.0;
|
||||
channel = 0;
|
||||
for( ch_cnt_t proc = 0; proc < m_processors; proc++)
|
||||
{
|
||||
for( Uint16 port = 0; port < m_portCount; port++ )
|
||||
{
|
||||
switch( m_ports[proc][port]->rate )
|
||||
{
|
||||
case CHANNEL_IN:
|
||||
case AUDIO_RATE_INPUT:
|
||||
case CONTROL_RATE_INPUT:
|
||||
break;
|
||||
case CHANNEL_OUT:
|
||||
for( fpab_t frame = 0; frame < _frames; frame++ )
|
||||
{
|
||||
_buf[frame][channel] = ( 1.0f - m_wetDry ) * _buf[frame][channel] + m_wetDry * m_ports[proc][port]->buffer[frame];
|
||||
out_sum += _buf[frame][channel] * _buf[frame][channel];
|
||||
}
|
||||
channel++;
|
||||
break;
|
||||
case AUDIO_RATE_OUTPUT:
|
||||
case CONTROL_RATE_OUTPUT:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Check whether we need to continue processing input. Restart the
|
||||
// counter if the threshold has been exceeded.
|
||||
if( out_sum <= ( m_gate ) )
|
||||
{
|
||||
m_bufferCount++;
|
||||
if( m_bufferCount > m_silenceTimeout )
|
||||
{
|
||||
m_running = FALSE;
|
||||
m_bufferCount = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_bufferCount = 0;
|
||||
}
|
||||
|
||||
m_processLock.unlock();
|
||||
return( m_running );
|
||||
}
|
||||
|
||||
|
||||
|
||||
void FASTCALL effect::setControl( Uint16 _control, LADSPA_Data _value )
|
||||
{
|
||||
if( !m_okay )
|
||||
{
|
||||
return;
|
||||
}
|
||||
m_processLock.lock();
|
||||
m_controls[_control]->value = _value;
|
||||
m_processLock.unlock();
|
||||
return( FALSE );
|
||||
}
|
||||
|
||||
|
||||
@@ -395,12 +75,13 @@ void FASTCALL effect::setControl( Uint16 _control, LADSPA_Data _value )
|
||||
void FASTCALL effect::setGate( float _level )
|
||||
{
|
||||
m_processLock.lock();
|
||||
m_gate = _level * _level * m_processors * m_bufferSize;
|
||||
m_gate = _level * _level * m_processors * eng()->getMixer()->framesPerAudioBuffer();
|
||||
m_processLock.unlock();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -143,7 +143,6 @@ bool FASTCALL effectChain::processAudioBuffer( surroundSampleFrame * _buf, const
|
||||
{
|
||||
return( FALSE );
|
||||
}
|
||||
|
||||
bool more_effects = FALSE;
|
||||
for( effect_list_t::iterator it = m_effects.begin(); it != m_effects.end(); it++ )
|
||||
{
|
||||
@@ -156,7 +155,7 @@ bool FASTCALL effectChain::processAudioBuffer( surroundSampleFrame * _buf, const
|
||||
|
||||
|
||||
|
||||
void effectChain::setRunning( void )
|
||||
void effectChain::startRunning( void )
|
||||
{
|
||||
if( m_bypassed )
|
||||
{
|
||||
@@ -165,7 +164,7 @@ void effectChain::setRunning( void )
|
||||
|
||||
for( effect_list_t::iterator it = m_effects.begin(); it != m_effects.end(); it++ )
|
||||
{
|
||||
(*it)->setRunning();
|
||||
(*it)->startRunning();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -54,7 +54,6 @@
|
||||
#include "tooltip.h"
|
||||
#include "ladspa_description.h"
|
||||
#include "ladspa_port_dialog.h"
|
||||
#include "effect.h"
|
||||
#include "audio_device.h"
|
||||
#include "buffer_allocator.h"
|
||||
#include "effect_chain.h"
|
||||
@@ -270,27 +269,6 @@ void ladspaBrowser::showPorts( const ladspa_key_t & _key )
|
||||
|
||||
|
||||
|
||||
void ladspaBrowser::testLADSPA( const ladspa_key_t & _key )
|
||||
{
|
||||
effect * eff1 = new effect( _key, eng() );
|
||||
effect * eff2 = new effect( _key, eng() );
|
||||
effectChain chain( eng() );
|
||||
|
||||
chain.appendEffect( eff1 );
|
||||
chain.appendEffect( eff2 );
|
||||
|
||||
fpab_t buf_size = eng()->getMixer()->audioDev()->channels();
|
||||
surroundSampleFrame * buffer = bufferAllocator::alloc<surroundSampleFrame>( buf_size );
|
||||
for( Uint8 i = 0; i < 100; i++ )
|
||||
{
|
||||
chain.processAudioBuffer( buffer, buf_size );
|
||||
}
|
||||
bufferAllocator::free( buffer );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void ladspaBrowser::displayHelp( void )
|
||||
{
|
||||
#ifdef QT4
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
#include "src/lib/oscillator.cpp"
|
||||
#include "src/lib/clipboard.cpp"
|
||||
#include "src/lib/sample_buffer.cpp"
|
||||
#include "src/core/ladspa_effect.cpp"
|
||||
#include "src/core/effect_chain.cpp"
|
||||
#include "src/core/effect.cpp"
|
||||
#include "src/core/ladspa_browser.cpp"
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
|
||||
#include "ladspa_manager.h"
|
||||
#ifdef LADSPA_SUPPORT
|
||||
#include "effect.h"
|
||||
#include "effect_chain.h"
|
||||
#include "effect_tab_widget.h"
|
||||
#endif
|
||||
@@ -569,7 +568,7 @@ void instrumentTrack::processAudioBuffer( sampleFrame * _buf,
|
||||
float v_scale = (float) getVolume() / DEFAULT_VOLUME;
|
||||
|
||||
#ifdef LADSPA_SUPPORT
|
||||
m_audioPort->getEffects()->setRunning();
|
||||
m_audioPort->getEffects()->startRunning();
|
||||
#endif
|
||||
|
||||
// instruments using instrument-play-handles will call this method
|
||||
|
||||
@@ -445,7 +445,7 @@ bool FASTCALL sampleTrack::play( const midiTime & _start,
|
||||
sendMidiTime( _start );
|
||||
|
||||
#ifdef LADSPA_SUPPORT
|
||||
m_audioPort->getEffects()->setRunning();
|
||||
m_audioPort->getEffects()->startRunning();
|
||||
#endif
|
||||
bool played_a_note = FALSE; // will be return variable
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
|
||||
|
||||
#include "ladspa_control.h"
|
||||
#include "effect.h"
|
||||
#include "ladspa_effect.h"
|
||||
|
||||
|
||||
ladspaControl::ladspaControl( QWidget * _parent, port_desc_t * _port, engine * _engine, track * _track ) :
|
||||
@@ -54,7 +54,6 @@ ladspaControl::ladspaControl( QWidget * _parent, port_desc_t * _port, engine * _
|
||||
{
|
||||
case TOGGLED:
|
||||
m_toggle = new ledCheckBox( m_port->name, this, "", eng(), m_track );
|
||||
// connect( m_toggle, SIGNAL( toggled( bool ) ), this SLOT( ledChange( bool ) ) );
|
||||
setFixedSize( m_toggle->width(), m_toggle->height() );
|
||||
if( m_port->def == 1.0f )
|
||||
{
|
||||
@@ -63,7 +62,6 @@ ladspaControl::ladspaControl( QWidget * _parent, port_desc_t * _port, engine * _
|
||||
break;
|
||||
case INTEGER:
|
||||
m_knob = new knob( knobBright_26, this, m_port->name, eng(), m_track);
|
||||
// connect( m_knob, SIGNAL( valueChanged( float ) ), this SLOT( knobChange( float ) ) );
|
||||
m_knob->setLabel( m_port->name );
|
||||
m_knob->setRange( static_cast<int>( m_port->max ), static_cast<int>( m_port->min ), 1 + static_cast<int>( m_port->max - m_port->min ) / 200 );
|
||||
m_knob->setInitValue( static_cast<int>( m_port->def ) );
|
||||
@@ -78,7 +76,6 @@ ladspaControl::ladspaControl( QWidget * _parent, port_desc_t * _port, engine * _
|
||||
break;
|
||||
case FLOAT:
|
||||
m_knob = new knob( knobBright_26, this, m_port->name, eng(), m_track);
|
||||
// connect( m_knob, SIGNAL( valueChanged( float ) ), this SLOT( knobChange( float ) ) );
|
||||
m_knob->setLabel( m_port->name );
|
||||
m_knob->setRange( m_port->min, m_port->max, ( m_port->max - m_port->min ) / 200.0f );
|
||||
m_knob->setInitValue( m_port->def );
|
||||
@@ -193,20 +190,6 @@ void FASTCALL ladspaControl::loadSettings( const QDomElement & _this, const QStr
|
||||
|
||||
|
||||
|
||||
// void ladspaControl::ledChange( bool _state )
|
||||
// {
|
||||
// printf("state %d\n", _state);
|
||||
// }
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
// void ladspaControl::knobChange( float _value )
|
||||
// {
|
||||
// printf("value %f\n", _value);
|
||||
// }
|
||||
|
||||
|
||||
#include "ladspa_control.moc"
|
||||
|
||||
#endif
|
||||
|
||||
@@ -72,7 +72,7 @@ rackPlugin::rackPlugin( QWidget * _parent, ladspa_key_t _key, track * _track, en
|
||||
m_key( _key ),
|
||||
m_show( TRUE )
|
||||
{
|
||||
m_effect = new effect( _key, eng() );
|
||||
m_effect = new ladspaEffect( _key, eng() );
|
||||
m_port->getEffects()->appendEffect( m_effect );
|
||||
|
||||
m_name = m_effect->getName();
|
||||
@@ -234,7 +234,7 @@ void rackPlugin::bypassed( bool _state )
|
||||
|
||||
void rackPlugin::setWetDry( float _value )
|
||||
{
|
||||
m_effect->setWetDry( _value );
|
||||
m_effect->setWetLevel( _value );
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user