Skip to content

Commit d0b3be7

Browse files
DomClarkPhysSong
authored andcommitted
Wait for reply when updating sample rate
1 parent 709fc79 commit d0b3be7

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

include/RemotePlugin.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -419,6 +419,7 @@ enum RemoteMessageIDs
419419
IdQuit,
420420
IdSampleRateInformation,
421421
IdBufferSizeInformation,
422+
IdInformationUpdated,
422423
IdMidiEvent,
423424
IdStartProcessing,
424425
IdProcessingDone,
@@ -807,6 +808,7 @@ class EXPORT RemotePlugin : public QObject, public RemotePluginBase
807808
{
808809
lock();
809810
sendMessage( message( IdSampleRateInformation ).addInt( _sr ) );
811+
waitForMessage( IdInformationUpdated, true );
810812
unlock();
811813
}
812814

@@ -1318,9 +1320,14 @@ bool RemotePluginClient::processMessage( const message & _m )
13181320
case IdSampleRateInformation:
13191321
m_sampleRate = _m.getInt();
13201322
updateSampleRate();
1323+
reply_message.id = IdInformationUpdated;
1324+
reply = true;
13211325
break;
13221326

13231327
case IdBufferSizeInformation:
1328+
// Should LMMS gain the ability to change buffer size
1329+
// without a restart, it must wait for this message to
1330+
// complete processing or else risk VST crashes
13241331
m_bufferSize = _m.getInt();
13251332
updateBufferSize();
13261333
break;

plugins/vst_base/RemoteVstPlugin.cpp

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -636,12 +636,7 @@ void RemoteVstPlugin::init( const std::string & _plugin_file )
636636

637637
updateInOutCount();
638638
updateBufferSize();
639-
640-
// some plugins have to set samplerate during init
641-
if( m_vstSyncData->hasSHM )
642-
{
643-
updateSampleRate();
644-
}
639+
updateSampleRate();
645640

646641
/* set program to zero */
647642
/* i comment this out because it breaks dfx Geometer

plugins/vst_base/VstPlugin.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,7 @@ void VstPlugin::updateSampleRate()
306306
lock();
307307
sendMessage( message( IdSampleRateInformation ).
308308
addInt( Engine::mixer()->processingSampleRate() ) );
309+
waitForMessage( IdInformationUpdated, true );
309310
unlock();
310311
}
311312

0 commit comments

Comments
 (0)