Fix loading/saving for peakController
git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@1199 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
@@ -51,15 +51,23 @@ plugin::descriptor PLUGIN_EXPORT peakcontroller_effect_plugin_descriptor =
|
||||
|
||||
}
|
||||
|
||||
// We have to keep a list of all the peakController effects so that we can save
|
||||
// an peakEffect-ID to the project. This ID is referenced in the peakController
|
||||
// settings and is used to set the peakControllerEffect pointer upon load
|
||||
|
||||
//QVector<peakControllerEffect *> peakControllerEffect::s_effects;
|
||||
|
||||
peakControllerEffect::peakControllerEffect(
|
||||
model * _parent,
|
||||
const descriptor::subPluginFeatures::key * _key ) :
|
||||
effect( &peakcontroller_effect_plugin_descriptor, _parent, _key ),
|
||||
m_peakControls( this )
|
||||
m_effectId( ++peakController::s_lastEffectId ),
|
||||
m_peakControls( this ),
|
||||
m_autoController( NULL )
|
||||
{
|
||||
engine::getSong()->addController( new peakController( engine::getSong(), this ) );
|
||||
m_autoController = new peakController( engine::getSong(), this );
|
||||
engine::getSong()->addController( m_autoController );
|
||||
peakController::s_effects.append( this );
|
||||
}
|
||||
|
||||
|
||||
@@ -67,6 +75,11 @@ peakControllerEffect::peakControllerEffect(
|
||||
|
||||
peakControllerEffect::~peakControllerEffect()
|
||||
{
|
||||
int idx = peakController::s_effects.indexOf( this );
|
||||
if( idx >= 0 )
|
||||
{
|
||||
peakController::s_effects.remove( idx );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -53,6 +53,7 @@ public:
|
||||
return m_lastSample;
|
||||
}
|
||||
|
||||
int m_effectId;
|
||||
|
||||
private:
|
||||
peakControllerEffectControls m_peakControls;
|
||||
@@ -60,6 +61,8 @@ private:
|
||||
friend class peakControllerEffectControls;
|
||||
|
||||
float m_lastSample;
|
||||
|
||||
controller * m_autoController;
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "peak_controller.h"
|
||||
#include "peak_controller_effect_controls.h"
|
||||
#include "peak_controller_effect.h"
|
||||
|
||||
@@ -41,9 +42,23 @@ peakControllerEffectControls( peakControllerEffect * _eff ) :
|
||||
|
||||
void peakControllerEffectControls::loadSettings( const QDomElement & _this )
|
||||
{
|
||||
printf("peakControllerEffect loadSettings\n");
|
||||
m_baseModel.setValue( _this.attribute( "base" ).toFloat() );
|
||||
m_amountModel.setValue( _this.attribute( "amount" ).toFloat() );
|
||||
m_muteModel.setValue( _this.attribute( "mute" ).toFloat() );
|
||||
|
||||
int effectId = _this.attribute( "effectId" ).toInt();
|
||||
if( effectId > peakController::s_lastEffectId )
|
||||
{
|
||||
peakController::s_lastEffectId = effectId;
|
||||
}
|
||||
m_effect->m_effectId = effectId;
|
||||
|
||||
if( m_effect->m_autoController )
|
||||
{
|
||||
delete m_effect->m_autoController;
|
||||
m_effect->m_autoController = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -55,6 +70,7 @@ void peakControllerEffectControls::saveSettings( QDomDocument & _doc,
|
||||
_this.setAttribute( "base", m_baseModel.value() );
|
||||
_this.setAttribute( "amount", m_amountModel.value() );
|
||||
_this.setAttribute( "mute", m_muteModel.value() );
|
||||
_this.setAttribute( "effectId", m_effect->m_effectId );
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user