mirror of
https://github.com/LMMS/lmms.git
synced 2026-01-28 08:19:32 -05:00
made LADSPA-effect-hoster handle samplerate-changes so that we've proper effect-processing in HQ-mode
git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@914 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
30
ChangeLog
30
ChangeLog
@@ -1,3 +1,33 @@
|
||||
2008-04-12 Tobias Doerffel <tobydox/at/users/dot/sourceforge/dot/net>
|
||||
|
||||
* plugins/ladspa_effect/ladspa_effect.cpp:
|
||||
* plugins/ladspa_effect/ladspa_control_dialog.cpp:
|
||||
* plugins/ladspa_effect/ladspa_effect.h:
|
||||
* plugins/ladspa_effect/ladspa_controls.cpp:
|
||||
* plugins/ladspa_effect/Makefile.am:
|
||||
* plugins/ladspa_effect/ladspa_control_dialog.h:
|
||||
* plugins/ladspa_effect/ladspa_controls.h:
|
||||
* include/effect_control_dialog.h:
|
||||
made LADSPA-effect-hoster handle samplerate-changes so that we've
|
||||
proper effect-processing in HQ-mode
|
||||
|
||||
* include/lmms_constants.h:
|
||||
more accurate constants
|
||||
|
||||
* src/gui/export_project_dialog.cpp:
|
||||
fixed progress-bar after change of tick-resolution from 64 to 192
|
||||
|
||||
* include/mixer.h:
|
||||
* src/core/mixer.cpp:
|
||||
made clearAudioBuffer() static
|
||||
|
||||
* include/song.h:
|
||||
* src/core/ladspa_manager.cpp:
|
||||
coding-style-stuff
|
||||
|
||||
* src/core/oscillator.cpp:
|
||||
do not synthesize anything if frequency is above half of samplerate
|
||||
|
||||
2008-04-09 Tobias Doerffel <tobydox/at/users/dot/sourceforge/dot/net>
|
||||
|
||||
* plugins/flp_import/flp_import.cpp:
|
||||
|
||||
@@ -49,8 +49,6 @@ signals:
|
||||
protected:
|
||||
virtual void closeEvent( QCloseEvent * _ce );
|
||||
|
||||
|
||||
private:
|
||||
effectControls * m_effectControls;
|
||||
|
||||
} ;
|
||||
|
||||
@@ -15,7 +15,7 @@ AM_CXXFLAGS := $(AM_CXXFLAGS) $(QT_CXXFLAGS) -DPLUGIN_NAME="ladspaeffect"
|
||||
$(MOC) -o $@ $<
|
||||
|
||||
|
||||
MOC_FILES = ./ladspa_controls.moc
|
||||
MOC_FILES = ./ladspa_effect.moc ./ladspa_controls.moc ./ladspa_control_dialog.moc
|
||||
|
||||
|
||||
BUILT_SOURCES = $(MOC_FILES) ./embedded_resources.h
|
||||
|
||||
@@ -35,11 +35,49 @@
|
||||
|
||||
|
||||
ladspaControlDialog::ladspaControlDialog( ladspaControls * _ctl ) :
|
||||
effectControlDialog( _ctl )
|
||||
effectControlDialog( _ctl ),
|
||||
m_effectLayout( NULL ),
|
||||
m_stereoLink( NULL )
|
||||
{
|
||||
QVBoxLayout * mainLay = new QVBoxLayout( this );
|
||||
QHBoxLayout * effectLay = new QHBoxLayout();
|
||||
mainLay->addLayout( effectLay );
|
||||
|
||||
m_effectLayout = new QHBoxLayout();
|
||||
mainLay->addLayout( m_effectLayout );
|
||||
|
||||
updateEffectView( _ctl );
|
||||
|
||||
if( _ctl->m_processors > 1 )
|
||||
{
|
||||
mainLay->addSpacing( 3 );
|
||||
QHBoxLayout * center = new QHBoxLayout();
|
||||
mainLay->addLayout( center );
|
||||
m_stereoLink = new ledCheckBox( tr( "Link Channels" ), this );
|
||||
m_stereoLink->setModel( &_ctl->m_stereoLinkModel );
|
||||
center->addWidget( m_stereoLink );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
ladspaControlDialog::~ladspaControlDialog()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void ladspaControlDialog::updateEffectView( ladspaControls * _ctl )
|
||||
{
|
||||
QList<QGroupBox *> list = findChildren<QGroupBox *>();
|
||||
for( QList<QGroupBox *>::iterator it = list.begin(); it != list.end();
|
||||
++it )
|
||||
{
|
||||
delete *it;
|
||||
}
|
||||
|
||||
m_effectControls = _ctl;
|
||||
|
||||
|
||||
const int cols = static_cast<int>( sqrt(
|
||||
static_cast<double>( _ctl->m_controlCount /
|
||||
@@ -56,7 +94,7 @@ ladspaControlDialog::ladspaControlDialog( ladspaControls * _ctl ) :
|
||||
{
|
||||
grouper = new QGroupBox( tr( "Channel " ) +
|
||||
QString::number( proc + 1 ),
|
||||
this );
|
||||
this );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -94,26 +132,19 @@ ladspaControlDialog::ladspaControlDialog( ladspaControls * _ctl ) :
|
||||
}
|
||||
}
|
||||
|
||||
effectLay->addWidget( grouper );
|
||||
m_effectLayout->addWidget( grouper );
|
||||
}
|
||||
|
||||
if( _ctl->m_processors > 1 )
|
||||
if( _ctl->m_processors > 1 && m_stereoLink != NULL )
|
||||
{
|
||||
mainLay->addSpacing( 3 );
|
||||
QHBoxLayout * center = new QHBoxLayout();
|
||||
mainLay->addLayout( center );
|
||||
ledCheckBox * stereoLink = new ledCheckBox(
|
||||
tr( "Link Channels" ), this );
|
||||
stereoLink->setModel( &_ctl->m_stereoLinkModel );
|
||||
center->addWidget( stereoLink );
|
||||
m_stereoLink->setModel( &_ctl->m_stereoLinkModel );
|
||||
}
|
||||
|
||||
connect( _ctl, SIGNAL( effectModelChanged( ladspaControls * ) ),
|
||||
this, SLOT( updateEffectView( ladspaControls * ) ),
|
||||
Qt::DirectConnection );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
ladspaControlDialog::~ladspaControlDialog()
|
||||
{
|
||||
}
|
||||
|
||||
#include "ladspa_control_dialog.moc"
|
||||
|
||||
|
||||
@@ -29,16 +29,26 @@
|
||||
#include "effect_control_dialog.h"
|
||||
|
||||
|
||||
class QHBoxLayout;
|
||||
class ladspaControls;
|
||||
class ledCheckBox;
|
||||
|
||||
|
||||
class ladspaControlDialog : public effectControlDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
ladspaControlDialog( ladspaControls * _ctl );
|
||||
~ladspaControlDialog();
|
||||
|
||||
|
||||
private slots:
|
||||
void updateEffectView( ladspaControls * _ctl );
|
||||
|
||||
|
||||
private:
|
||||
QHBoxLayout * m_effectLayout;
|
||||
ledCheckBox * m_stereoLink;
|
||||
|
||||
} ;
|
||||
|
||||
|
||||
@@ -101,8 +101,7 @@ ladspaControls::~ladspaControls()
|
||||
|
||||
|
||||
|
||||
void FASTCALL ladspaControls::saveSettings( QDomDocument & _doc,
|
||||
QDomElement & _this )
|
||||
void ladspaControls::saveSettings( QDomDocument & _doc, QDomElement & _this )
|
||||
{
|
||||
if( m_processors > 1 )
|
||||
{
|
||||
@@ -123,7 +122,7 @@ void FASTCALL ladspaControls::saveSettings( QDomDocument & _doc,
|
||||
|
||||
|
||||
|
||||
void FASTCALL ladspaControls::loadSettings( const QDomElement & _this )
|
||||
void ladspaControls::loadSettings( const QDomElement & _this )
|
||||
{
|
||||
if( m_processors > 1 )
|
||||
{
|
||||
|
||||
@@ -47,9 +47,8 @@ public:
|
||||
return( m_controlCount );
|
||||
}
|
||||
|
||||
virtual void FASTCALL saveSettings( QDomDocument & _doc,
|
||||
QDomElement & _parent );
|
||||
virtual void FASTCALL loadSettings( const QDomElement & _this );
|
||||
virtual void saveSettings( QDomDocument & _doc, QDomElement & _parent );
|
||||
virtual void loadSettings( const QDomElement & _this );
|
||||
inline virtual QString nodeName( void ) const
|
||||
{
|
||||
return( "ladspacontrols" );
|
||||
@@ -77,6 +76,11 @@ private:
|
||||
|
||||
|
||||
friend class ladspaControlDialog;
|
||||
friend class ladspaEffect;
|
||||
|
||||
|
||||
signals:
|
||||
void effectModelChanged( ladspaControls * );
|
||||
|
||||
} ;
|
||||
|
||||
|
||||
@@ -23,10 +23,10 @@
|
||||
*/
|
||||
|
||||
|
||||
#include "ladspa_effect.h"
|
||||
|
||||
#include <QtGui/QMessageBox>
|
||||
|
||||
#include "ladspa_effect.h"
|
||||
#include "mmp.h"
|
||||
#include "audio_device.h"
|
||||
#include "config_mgr.h"
|
||||
#include "ladspa_2_lmms.h"
|
||||
@@ -78,7 +78,46 @@ ladspaEffect::ladspaEffect( model * _parent,
|
||||
}
|
||||
|
||||
setPublicName( manager->getShortName( m_key ) );
|
||||
|
||||
|
||||
pluginInstantiation();
|
||||
|
||||
connect( engine::getMixer(), SIGNAL( sampleRateChanged() ),
|
||||
this, SLOT( changeSampleRate() ) );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
ladspaEffect::~ladspaEffect()
|
||||
{
|
||||
pluginDestruction();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void ladspaEffect::changeSampleRate( void )
|
||||
{
|
||||
multimediaProject mmp( multimediaProject::EffectSettings );
|
||||
m_controls->saveState( mmp, mmp.content() );
|
||||
ladspaControls * controls = m_controls;
|
||||
m_controls = NULL;
|
||||
m_pluginMutex.lock();
|
||||
pluginDestruction();
|
||||
pluginInstantiation();
|
||||
m_pluginMutex.unlock();
|
||||
m_controls->restoreState( mmp.content().firstChild().toElement() );
|
||||
controls->effectModelChanged( m_controls );
|
||||
delete controls;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void ladspaEffect::pluginInstantiation( void )
|
||||
{
|
||||
ladspa2LMMS * manager = engine::getLADSPAManager();
|
||||
|
||||
// Calculate how many processing units are needed.
|
||||
const ch_cnt_t lmms_chnls = engine::getMixer()->audioDev()->channels();
|
||||
m_effectChannels = manager->getDescription( m_key )->inputChannels;
|
||||
@@ -293,8 +332,8 @@ ladspaEffect::ladspaEffect( model * _parent,
|
||||
{
|
||||
manager->activate( m_key, m_handles[proc] );
|
||||
}
|
||||
track * t = dynamic_cast<effectChain *>( _parent ) ?
|
||||
dynamic_cast<effectChain *>( _parent )->getTrack() :
|
||||
track * t = dynamic_cast<effectChain *>( parent() ) ?
|
||||
dynamic_cast<effectChain *>( parent() )->getTrack() :
|
||||
NULL;
|
||||
m_controls = new ladspaControls( this, t );
|
||||
}
|
||||
@@ -302,13 +341,15 @@ ladspaEffect::ladspaEffect( model * _parent,
|
||||
|
||||
|
||||
|
||||
ladspaEffect::~ladspaEffect()
|
||||
void ladspaEffect::pluginDestruction( void )
|
||||
{
|
||||
if( !isOkay() )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
delete m_controls;
|
||||
|
||||
for( ch_cnt_t proc = 0; proc < getProcessorCount(); proc++ )
|
||||
{
|
||||
ladspa2LMMS * manager = engine::getLADSPAManager();
|
||||
@@ -323,6 +364,7 @@ ladspaEffect::~ladspaEffect()
|
||||
}
|
||||
m_ports.clear();
|
||||
m_handles.clear();
|
||||
m_portControls.clear();
|
||||
}
|
||||
|
||||
|
||||
@@ -331,8 +373,10 @@ ladspaEffect::~ladspaEffect()
|
||||
bool ladspaEffect::processAudioBuffer( sampleFrame * _buf,
|
||||
const fpp_t _frames )
|
||||
{
|
||||
m_pluginMutex.lock();
|
||||
if( !isOkay() || dontRun() || !isRunning() || !isEnabled() )
|
||||
{
|
||||
m_pluginMutex.unlock();
|
||||
return( FALSE );
|
||||
}
|
||||
|
||||
@@ -455,13 +499,15 @@ bool ladspaEffect::processAudioBuffer( sampleFrame * _buf,
|
||||
resetBufferCount();
|
||||
}
|
||||
|
||||
return( isRunning() );
|
||||
bool is_running = isRunning();
|
||||
m_pluginMutex.unlock();
|
||||
return( is_running );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void FASTCALL ladspaEffect::setControl( Uint16 _control, LADSPA_Data _value )
|
||||
void ladspaEffect::setControl( Uint16 _control, LADSPA_Data _value )
|
||||
{
|
||||
if( !isOkay() )
|
||||
{
|
||||
@@ -484,3 +530,6 @@ plugin * lmms_plugin_main( model * _parent, void * _data )
|
||||
|
||||
}
|
||||
|
||||
|
||||
#include "ladspa_effect.moc"
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
#ifndef _LADSPA_EFFECT_H
|
||||
#define _LADSPA_EFFECT_H
|
||||
|
||||
#include <QtGui/QWorkspace>
|
||||
#include <QtCore/QMutex>
|
||||
|
||||
#include "effect.h"
|
||||
#include "engine.h"
|
||||
@@ -39,6 +39,7 @@ typedef QVector<port_desc_t *> multi_proc_t;
|
||||
|
||||
class ladspaEffect : public effect
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
ladspaEffect( model * _parent,
|
||||
const descriptor::subPluginFeatures::key * _key );
|
||||
@@ -47,7 +48,7 @@ public:
|
||||
virtual bool processAudioBuffer( sampleFrame * _buf,
|
||||
const fpp_t _frames );
|
||||
|
||||
void FASTCALL setControl( Uint16 _control, LADSPA_Data _data );
|
||||
void setControl( Uint16 _control, LADSPA_Data _data );
|
||||
|
||||
virtual effectControls * getControls( void )
|
||||
{
|
||||
@@ -70,7 +71,16 @@ public:
|
||||
}
|
||||
|
||||
|
||||
private slots:
|
||||
void changeSampleRate( void );
|
||||
|
||||
|
||||
private:
|
||||
void pluginInstantiation( void );
|
||||
void pluginDestruction( void );
|
||||
|
||||
|
||||
QMutex m_pluginMutex;
|
||||
ladspaControls * m_controls;
|
||||
|
||||
QString m_effName;
|
||||
|
||||
Reference in New Issue
Block a user