What's the best way of tuning a sample in SamplerSound? I'm using several SamplerSounds and I need to tune each one individually and in real time (both tune/finetune). I copied the SamplerSound/SamplerVoice classes and played a bit with them, changing the pitchRatio worked for all sounds (but every now and then it crashes in the interpolation). I guess I can use an array but still there will be problem in the interpolation, don't know why.
I also tried changing the samplerate but everytime the sound stops and I need something in real time.
I don't immediately see a way of doing that without re-writing portions of SamplerSound. So perhaps take it as a template and make your own version. Which you've already done. And it causes a crash when you modify pitchRatio.
Now there's a test immediately after the pitchRatio is used:
if (sourceSamplePosition > playingSound->length)
{
stopNote (false);
break;
}
Which should stop you reading past the end of the buffer - the most likely reason for the crash. Jules seems to have included some padding in the buffer to stop the edge condition crashing.
I think you need to look into your crash with the debugger, and ignore my previous hasty reply! Do you have valid values for pos, for example, when it crashes.