I think I may have spotted a potential crash with the juce_ResamplingAudioSource class when used with the TransportSource class.
I am making a plugin that needs to support playback of samples with sample rates ranging from 44.1KHz to at least 96KHz. As a starting point I used the PlayingSoundFilesTutorial from the Juce tutorials page, by porting the code from the standalone project to an audio plugin.
The plugin I am building needs to allow the user to retrigger the sample by clicking the play button; by doing so the sample will be played from the beginning of the file. to do this I have slightly changed the changeState function in the MainComponent.cpp: if the newState argument is TransportState::playing then we call transportSource.setPosition (0.0);
this all seemed to work fine until I started to do some stress testing; after constantly retriggering the sample (by clicking my mouse) for around fifty five seconds I hit the jassert on line 145 of juce_ResamplingAudioSource.cpp:
jassert (sampsInBuffer > 0 && nextPos != endOfBufferPos);
I have repeated this operation many times and am sure that my problems are coming from juce_ResamplingAudioSource. To confirm this I have also set up a transportSource which bypasses juce_ResamplingAudioSource and have run the same stress tests by retriggering the sample for a solid five minutes (fun times ) and had no issues.
FYI I have had the same results with sample rates of 48KHz and 96KHz.
Do you think you guys might be able to look into this or perhaps provide a work around?
Thanks a lot.