ZynAddSubFX: save which controllers were modified and restore them

We must not only restore the controller knobs but also send updates
to ZynAddSubFX. However this only applies to knobs that were modified.
Therefore save and remember which knobs this applies for.
(cherry picked from commit b2cc802528)
This commit is contained in:
Tobias Doerffel
2010-09-02 17:12:50 +02:00
parent 2c99688f91
commit bac2b28ad7
2 changed files with 39 additions and 1 deletions

View File

@@ -158,6 +158,18 @@ void ZynAddSubFxInstrument::saveSettings( QDomDocument & _doc,
m_fmGainModel.saveSettings( _doc, _this, "fmgain" );
m_resCenterFreqModel.saveSettings( _doc, _this, "rescenterfreq" );
m_resBandwidthModel.saveSettings( _doc, _this, "resbandwidth" );
QString modifiedControllers;
for( QMap<int, bool>::ConstIterator it = m_modifiedControllers.begin();
it != m_modifiedControllers.end(); ++it )
{
if( it.value() )
{
modifiedControllers += QString( "%1," ).arg( it.key() );
}
}
_this.setAttribute( "modifiedcontrollers", modifiedControllers );
m_forwardMidiCcModel.saveSettings( _doc, _this, "forwardmidicc" );
QTemporaryFile tf;
@@ -242,6 +254,27 @@ void ZynAddSubFxInstrument::loadSettings( const QDomElement & _this )
}
m_pluginMutex.unlock();
m_modifiedControllers.clear();
foreach( const QString & c,
_this.attribute( "modifiedcontrollers" ).split( ',' ) )
{
if( !c.isEmpty() )
{
switch( c.toInt() )
{
case C_portamento: updatePortamento(); break;
case C_filtercutoff: updateFilterFreq(); break;
case C_filterq: updateFilterQ(); break;
case C_bandwidth: updateBandwidth(); break;
case C_fmamp: updateFmGain(); break;
case C_resonance_center: updateResCenterFreq(); break;
case C_resonance_bandwidth: updateResBandwidth(); break;
default:
break;
}
}
}
emit settingsChanged();
}
}
@@ -267,6 +300,8 @@ void ZynAddSubFxInstrument::loadFile( const QString & _file )
m_pluginMutex.unlock();
}
m_modifiedControllers.clear();
emit settingsChanged();
}
@@ -354,6 +389,7 @@ void ZynAddSubFxInstrument::reloadPlugin()
void ZynAddSubFxInstrument::slotname() \
{ \
sendControlChange( midictl, modelname.value() ); \
m_modifiedControllers[midictl] = true; \
}

View File

@@ -25,6 +25,7 @@
#ifndef _ZYNADDSUBFX_H
#define _ZYNADDSUBFX_H
#include <QtCore/QMap>
#include <QtCore/QMutex>
#include "AutomatableModel.h"
@@ -118,6 +119,8 @@ private:
FloatModel m_resBandwidthModel;
BoolModel m_forwardMidiCcModel;
QMap<int, bool> m_modifiedControllers;
friend class ZynAddSubFxView;
@@ -161,5 +164,4 @@ private slots:
} ;
#endif