I want to make a sampler. How do I send the packages correctly to ProcessDoubleReplacing ?
I tried to read from the audio file packets by 896k. The problem is that during the period when the audio sample buffer is read, time passes, this delays ProcessDoubleReplacing output and gaps appear when playing audio.
It is possible to send only a part of samples and send a message to the host that only a part of the sampleblock was sent? Does SetLatency (partial_samplesblock) do that? Something like
Code:
SetLatency(samplesblock);
for (int s=0; s < samplesblock; ++s) {
if (pos_counter>=buf_start+buf_size) {
SetLatency(s);
readBuf();
break;
}
// process samples from buffer here
}
Unfortunately the above code still introduce gaps on the audio output.