View Single Post
Old 10-26-2020, 05:39 AM   #1
SaschArt
Human being with feelings
 
SaschArt's Avatar
 
Join Date: Aug 2013
Posts: 225
Default Audio sampler and right buffering

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.
__________________
Audio plugins | BrainWaveProducer | EmRysRa

Last edited by SaschArt; 10-26-2020 at 09:52 AM.
SaschArt is offline   Reply With Quote