I am relatively new to juce and just programmed my first sampler. Now I want to add the functionality to start the loaded sample at a different point. E.g. there is a 5 second sample and it starts playing from second 2 when I play it. I see how you can edit the next .renderNextBlock, but I am not quite sure how to change the playing position for the whole sample.
I thought about creating a custom audio buffer that I can change and give this changed buffer to the processblock. But this results in either no sound, when I use my custom buffer or just the pprocessblock using its own and ignoring mine.
Basically, you just need to start the sample reading index from another position than 0. How you would do that, completely depends on how you have implemented your code, so I can’t give any further instructions on that. If you are using the Juce SamplerSound and SamplerVoice, you won’t really be able to do it, though. Those are quite limited classes and you can’t do much by inheriting from them, either.
Okay. I am still working on it. Thinking about a workaroung, where I use the AudioFormatWriter with the .write() method to create an edited audio stream and read this stream with an AudioFormatReader. But I right now my application stops when I am loading the file. I am still new to this all help is appreciated! Thank you in advance
This is the part of code that causes the stopping: