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:
Paul Giblock
2008-06-29 08:32:27 +00:00
parent 941c3cdc78
commit d83b15ae14
8 changed files with 72 additions and 8 deletions

View File

@@ -103,14 +103,14 @@ effect * effect::instantiate( const QString & _plugin_name,
descriptor::subPluginFeatures::key * _key )
{
plugin * p = plugin::instantiate( _plugin_name, _parent, _key );
// check whether instantiated plugin is an instrument
// check whether instantiated plugin is an effect
if( dynamic_cast<effect *>( p ) != NULL )
{
// everything ok, so return pointer
return( dynamic_cast<effect *>( p ) );
}
// not quite... so delete plugin and return dummy instrument
// not quite... so delete plugin and return dummy effect
delete p;
return( new dummyEffect( _parent ) );
}

View File

@@ -38,6 +38,9 @@
#include "controller_dialog.h"
#include "plugins/peak_controller_effect/peak_controller_effect.h"
int peakController::s_lastEffectId = 0;
peakControllerEffectVector peakController::s_effects;
peakController::peakController( model * _parent,
peakControllerEffect * _peak_effect ) :
@@ -69,15 +72,29 @@ float peakController::value( int _offset )
void peakController::saveSettings( QDomDocument & _doc, QDomElement & _this )
{
// Probably not the best idea..
// controller::saveSettings( _doc, _this );
controller::saveSettings( _doc, _this );
_this.setAttribute( "effectId", m_peakEffect->m_effectId );
}
void peakController::loadSettings( const QDomElement & _this )
{
// controller::loadSettings( _this );
printf("peakController loadSettings\n");
int effectId = _this.attribute( "effectId" ).toInt();
peakControllerEffectVector::iterator i;
for( i = s_effects.begin(); i != s_effects.end(); ++i )
{
printf( "%d %d\n", (*i)->m_effectId , effectId );
if( (*i)->m_effectId == effectId )
{
if( (*i)->m_effectId == effectId )
m_peakEffect = *i;
return;
}
}
}

View File

@@ -1144,6 +1144,7 @@ void song::removeController( controller * _controller )
{
engine::getSong()->setModified();
}
emit dataChanged();
}
}