Potential crash report using AudioTransportSource


#1

Hi there,

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 :slight_smile: ) 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.


#2

We’d certainly like to look into it, but it’s difficult without some more detail about how to reproduce it… I’d be reluctant to spend time writing our own version of what you describe, as we don’t know for sure whether it’s just something else going wrong in your implementation, e.g. some non-thread-safe stuff you might be doing, which sounds likely to me, since it does sound like a race condition.


#3

I feel an idiot, don’t know why that hadn’t occurred to me. of course, you were right :slight_smile: thanks for your help and sorry for wasting your time! Happy New Year!