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:
@@ -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; \
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user