VstPlugin, RemoteVstPlugin: save/restore current program of VST plugin

Not all plugins save current program in their chunk (or do not restore
it properly). We therefore have to save and restore the current program
manually.

Closes #3581879.
This commit is contained in:
Tobias Doerffel
2012-11-26 19:30:26 +01:00
parent 56b07e29c2
commit 0d80f0c569
4 changed files with 31 additions and 1 deletions

View File

@@ -419,6 +419,10 @@ bool RemoteVstPlugin::processMessage( const message & _m )
sendMessage( IdVstSetProgram );
break;
case IdVstCurrentProgram:
sendMessage( message( IdVstCurrentProgram ).addInt( m_currentProgram ) );
break;
case IdVstRotateProgram:
rotateProgram( _m.getInt( 0 ) );
sendMessage( IdVstRotateProgram );

View File

@@ -90,7 +90,8 @@ VstPlugin::VstPlugin( const QString & _plugin ) :
m_productString(),
m_currentProgramName(),
m_allProgramNames(),
p_name()
p_name(),
m_currentProgram()
{
setSplittedChannels( true );
@@ -279,6 +280,10 @@ void VstPlugin::loadSettings( const QDomElement & _this )
setParameterDump( dump );
}
if( _this.hasAttribute( "program" ) )
{
setProgram( _this.attribute( "program" ).toInt() );
}
}
@@ -309,6 +314,8 @@ void VstPlugin::saveSettings( QDomDocument & _doc, QDomElement & _this )
_this.setAttribute( it.key(), it.value() );
}
}
_this.setAttribute( "program", currentProgram() );
}
@@ -335,6 +342,18 @@ void VstPlugin::updateSampleRate()
int VstPlugin::currentProgram()
{
lock();
sendMessage( message( IdVstCurrentProgram ) );
waitForMessage( IdVstCurrentProgram );
unlock();
return m_currentProgram;
}
const QMap<QString, QString> & VstPlugin::parameterDump()
{
lock();
@@ -406,6 +425,10 @@ bool VstPlugin::processMessage( const message & _m )
m_productString = _m.getQString();
break;
case IdVstCurrentProgram:
m_currentProgram = _m.getInt();
break;
case IdVstCurrentProgramName:
m_currentProgramName = _m.getQString();
break;

View File

@@ -145,6 +145,8 @@ private:
QMap<QString, QString> m_parameterDump;
int m_currentProgram;
} ;

View File

@@ -65,6 +65,7 @@ enum VstRemoteMessageIDs
IdVstSetParameterDump,
IdVstGetParameterProperties,
IdVstProgramNames,
IdVstCurrentProgram,
IdVstCurrentProgramName,
IdVstSetProgram,
IdVstRotateProgram,