Skip to content

Commit 11e5e32

Browse files
committed
Tests: Added a test to process audio with different sample rate and block sizes but not call releaseResources in between
1 parent a02bafd commit 11e5e32

File tree

2 files changed

+36
-3
lines changed

2 files changed

+36
-3
lines changed

CHANGELIST.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# pluginval Change List
22

3+
### 0.2.8
4+
- Added a test to process audio with different sample rate and block sizes but not call releaseResources in between
5+
36
### 0.2.6
47
- Avoided a deadlock when opening plugin windows for the second time on Linux
58

Source/tests/BasicTests.cpp

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -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

230239
static 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
//==============================================================================
234264
struct PluginStateTest : public PluginTest
235265
{

0 commit comments

Comments
 (0)