Hello,
I am using a scoped pointer in the following way:
if (buttonThatWasClicked == textButton)
{
File file("C:\\Programming\\Mic1_C1.wav");
FileInputStream stream(file);
WavAudioFormat wavFormat;
ScopedPointer<AudioFormatReader> reader;
reader = wavFormat.createReaderFor(&stream, false);
}
But when I run the function I get a MS-Windows error: "Debug Assertion Failed! – Expression: _CrtIsValidHeapPointer(pUserData)"
This happens when the programs has left the function and is trying to free memory. And the problem seems to be the AudioFormatReader in combination with the scoped pointer.
So I thought, maybe the scoped pointer is not right in this case. Therefore I changed it to a normal pointer, i.e.
...
WavAudioFormat wavFormat;
AudioFormatReader* reader;
reader = wavFormat.createReaderFor(&stream, false);
...
That works better. Now I can execute the function. BUT when I close down the program, I get a JUCE assertion, telling me, that I am leaking memory and that I should use scoped pointers.
So right now I am a bit confused :o and dont know, how to handle this correctly.