diff --git a/include/RemotePlugin.h b/include/RemotePlugin.h index f8080af7868..811827730ab 100644 --- a/include/RemotePlugin.h +++ b/include/RemotePlugin.h @@ -419,6 +419,7 @@ enum RemoteMessageIDs IdQuit, IdSampleRateInformation, IdBufferSizeInformation, + IdInformationUpdated, IdMidiEvent, IdStartProcessing, IdProcessingDone, @@ -807,6 +808,7 @@ class EXPORT RemotePlugin : public QObject, public RemotePluginBase { lock(); sendMessage( message( IdSampleRateInformation ).addInt( _sr ) ); + waitForMessage( IdInformationUpdated, true ); unlock(); } @@ -1318,9 +1320,14 @@ bool RemotePluginClient::processMessage( const message & _m ) case IdSampleRateInformation: m_sampleRate = _m.getInt(); updateSampleRate(); + reply_message.id = IdInformationUpdated; + reply = true; break; case IdBufferSizeInformation: + // Should LMMS gain the ability to change buffer size + // without a restart, it must wait for this message to + // complete processing or else risk VST crashes m_bufferSize = _m.getInt(); updateBufferSize(); break; diff --git a/plugins/vst_base/RemoteVstPlugin.cpp b/plugins/vst_base/RemoteVstPlugin.cpp index 38dde09c999..f1fc673b118 100644 --- a/plugins/vst_base/RemoteVstPlugin.cpp +++ b/plugins/vst_base/RemoteVstPlugin.cpp @@ -636,12 +636,7 @@ void RemoteVstPlugin::init( const std::string & _plugin_file ) updateInOutCount(); updateBufferSize(); - - // some plugins have to set samplerate during init - if( m_vstSyncData->hasSHM ) - { - updateSampleRate(); - } + updateSampleRate(); /* set program to zero */ /* i comment this out because it breaks dfx Geometer diff --git a/plugins/vst_base/VstPlugin.cpp b/plugins/vst_base/VstPlugin.cpp index e291e15bae8..a06663a7e95 100644 --- a/plugins/vst_base/VstPlugin.cpp +++ b/plugins/vst_base/VstPlugin.cpp @@ -306,6 +306,7 @@ void VstPlugin::updateSampleRate() lock(); sendMessage( message( IdSampleRateInformation ). addInt( Engine::mixer()->processingSampleRate() ) ); + waitForMessage( IdInformationUpdated, true ); unlock(); }