@@ -18,10 +18,12 @@ class HostAudioProcessorImpl
1818{
1919public:
2020 HostAudioProcessorImpl ()
21- : AudioProcessor(BusesProperties()
22- .withInput(" Input" , AudioChannelSet::stereo(), true )
23- .withOutput(" Output" , AudioChannelSet::stereo(), true )
24- .withInput(" Sidechain" , AudioChannelSet::stereo(), false ))
21+ : AudioProcessor(
22+ BusesProperties ()
23+ .withInput(" Input" , AudioChannelSet::stereo(), true)
24+ .withOutput(" Output" , AudioChannelSet::stereo(), true)
25+ .withInput(" Sidechain" , AudioChannelSet::stereo(), false)
26+ )
2527
2628 {
2729 appProperties.setStorageParameters (
@@ -249,9 +251,6 @@ class HostAudioProcessorImpl
249251
250252 editorStyle = where;
251253
252- if (inner != nullptr && !mb.isEmpty ())
253- inner->setStateInformation (mb.getData (), (int )mb.getSize ());
254-
255254 // In a 'real' plugin, we'd also need to set the bus configuration of the inner plugin.
256255 // One possibility would be to match the bus configuration of the wrapper plugin, but
257256 // the inner plugin isn't guaranteed to support the same layout. Alternatively, we
@@ -321,15 +320,19 @@ class HostAudioProcessorImpl
321320 getBlockSize ()
322321 );
323322 }
324-
325- inner->prepareToPlay (getSampleRate (), getBlockSize ());
326323 }
327324
325+ this ->prepareToPlay (getSampleRate (), getBlockSize ());
326+
327+ if (inner != nullptr && !mb.isEmpty ())
328+ inner->setStateInformation (mb.getData (), (int )mb.getSize ());
329+
328330 if (needsPluginChanged)
329331 NullCheckedInvocation::invoke (pluginChanged);
330332 };
331333
332- pluginFormatManager.createPluginInstanceAsync (pd, getSampleRate (), getBlockSize (), callback);
334+ if (inner == nullptr || (inner != nullptr && inner->getPluginDescription ().name != pd.name ))
335+ pluginFormatManager.createPluginInstanceAsync (pd, getSampleRate (), getBlockSize (), callback);
333336 }
334337
335338 void clearPlugin ()
0 commit comments