I added in AudioDemo in the method void filenameComponentChanged (FilenameComponent*) after currentAudioFileSource = new AudioFormatReaderSource (reader, true);
the line audioSourcePlayer.setSource (currentAudioFileSource); But when quitting the app, I got an exception(-error/crash). The debugger stopps during the call oldSource->releaseResources(); form amalgamated
What did I wrong?
I just want to test, how to stream an (or my own modified) AudioSource directly with AudioSourcePlayer without using an AudioTransportSource.
Hard to tell from your description, but I’d guess that when it calls that releaseResources method, the source object it’s using will have already been deleted somewhere else.
To be more precise, here the code, what I changed in JUCE-AudioDemo.cpp
[code] currentFile = audioFile;
currentAudioFileSource = new AudioFormatReaderSource (reader, true);
audioSourcePlayer.setSource (currentAudioFileSource); // This was added by me!
// ..and plug it into our transport source
//transportSource.setSource (currentAudioFileSource,
// 32768, // tells it to buffer this many samples ahead
// reader->sampleRate);
Rather than asking us to guess what’s happening, why not just put a breakpoint in the class’s destructor, so that the debugger will show you exactly where it’s being deleted…
OK, I got it!
I misread “setSource(0);” I mistakenly thought, I would call audioSources´s Member, but it was that from transportSource. So oldSource->releaseResources() was trying to release an object, which was previously deleted by deleteAndZero (currentAudioFileSource).