@@ -178,8 +178,9 @@ struct AudioProcessingTest : public PluginTest
178178 : PluginTest (" Audio processing" , 3 )
179179 {
180180 }
181-
182- void runTest (PluginTests& ut, AudioPluginInstance& instance) override
181+
182+ static void runAudioProcessingTest (PluginTests& ut, AudioPluginInstance& instance,
183+ bool callReleaseResourcesBeforeSampleRateChange)
183184 {
184185 const bool isPluginInstrument = instance.getPluginDescription ().isInstrument ;
185186 const double sampleRates[] = { 44100.0 , 48000.0 , 96000.0 };
@@ -194,7 +195,10 @@ struct AudioProcessingTest : public PluginTest
194195 ut.logMessage (String (" Testing with sample rate [SR] and block size [BS]" )
195196 .replace (" SR" , String (sr, 0 ), false )
196197 .replace (" BS" , String (bs), false ));
197- instance.releaseResources ();
198+
199+ if (callReleaseResourcesBeforeSampleRateChange)
200+ instance.releaseResources ();
201+
198202 instance.prepareToPlay (sr, bs);
199203
200204 const int numChannelsRequired = jmax (instance.getTotalNumInputChannels (), instance.getTotalNumOutputChannels ());
@@ -225,11 +229,37 @@ struct AudioProcessingTest : public PluginTest
225229 }
226230 }
227231 }
232+
233+ void runTest (PluginTests& ut, AudioPluginInstance& instance) override
234+ {
235+ runAudioProcessingTest (ut, instance, true );
236+ }
228237};
229238
230239static AudioProcessingTest audioProcessingTest;
231240
232241
242+ // ==============================================================================
243+ /* *
244+ Test that process some audio changing the sample rate between runs but doesn't
245+ call releaseResources between calls to prepare to play.
246+ */
247+ struct NonReleasingAudioProcessingTest : public PluginTest
248+ {
249+ NonReleasingAudioProcessingTest ()
250+ : PluginTest (" Non-releasing audio processing" , 4 )
251+ {
252+ }
253+
254+ void runTest (PluginTests& ut, AudioPluginInstance& instance) override
255+ {
256+ AudioProcessingTest::runAudioProcessingTest (ut, instance, false );
257+ }
258+ };
259+
260+ static NonReleasingAudioProcessingTest nonReleasingAudioProcessingTest;
261+
262+
233263// ==============================================================================
234264struct PluginStateTest : public PluginTest
235265{
0 commit comments