I want to try to trigger a WAV file to play back in sample-by-sample processing within my MPESynthVoice under renderNextBlock
. I am okay with the file location being hardcoded for simple testing.
eg. file is C:\testwav.wav
I would like a simple way of having it do something like this:
//To trigger playback:
playWav = true;
sampleIndex = 0;
//Playback:
if (playWav == true) {
double wavSampleOutput = wavSample[sampleIndex];
sampleIndex = sampleIndex +1;
}
I don’t want to manually put it all the wav file’s values into an array/vector or anything though. I just mean I want to step through the wav file sample-by-sample on command/trigger and get the values so I can use them elsewhere in my synth voice.
The tutorial I see on playing back audio samples is all about block/buffer based processing:
https://docs.juce.com/master/tutorial_playing_sound_files.html
Is there any simple way to do what I’m talking about? Could you share a bit of example code for how it would work? Thanks.