Hello,
I saw the MemoryMappedAudioFormatReader and I wondering if I use it in the correct way. I didn’t understand all the topics in the forum that deal with it.
ScopedPointer<MemoryMappedAudioFormatReader> loadSample(File wavFile) {
ScopedPointer<WavAudioFormat> audioFormat;
MemoryMappedAudioFormatReader* reader;
audioFormat = new WavAudioFormat();
reader = audioFormat->createMemoryMappedReader(wavFile);
if(reader) {
reader->mapEntireFile();
}
return reader;
}
float getSample(int numChannel, int numSample) {
float result[6];
reader->getSample(numSample, result);
return result[numChannel];
}
I need it for real time audio processing, to make sample based plugins.
- Is it better to use
mapEntireFile()
ormapSectionOfFile()
? - Is the example of
getSample()
function the good way to get samples in theprocessBlock()
? - I read something about a background thread to make some
touchSample()
; Should I do that withmapEntireFile()
?
(PS : It’s been few times I asked some questions in this forum, and I received answers from patient users or admin, and I’m gratefull about it, so thank you this time too ! )