When I set the source for the first time - everything is ok.
Then I change the source and receive the exception
Exception thrown: read access violation.
this->source.object.object-> was 0xFFFFFFFFFFFFFFEF.
in this method
void BufferingAudioSource::releaseResources()
{
isPrepared = false;
backgroundThread.removeTimeSliceClient (this);
buffer.setSize (numberOfChannels, 0);
// MSVC2015 seems to need this if statement to not generate a warning during linking.
// As source is set in the constructor, there is no way that source could
// ever equal this, but it seems to make MSVC2015 happy.
if (source != this)
source->releaseResources();
}
exception in this line: source->releaseResources();
Have you tried adding a breakpoint on the second fileSource.setSource(...) call and stepping in to see what is causing this->source.object.object to not have a valid address?