Value of currentTime

Hello,

I have a question about the value of AudioContext.currentTime. If I'm not wrong, the currentTime is a high-precision clock exposed in JavaScript as a floating-point number of seconds since the AudioContext was created. Therefore, as I understand, if I want to start two sources at a specific time I can't do something like this,

function start(){
	source1.start(audioContext.currentTime+1);
	source2.start(audioContext.currentTime+1);
}

because it's not possible to guarantee that the currentTime for these two instructions will be the same. Nevertheless, I did an experiment that show how the currentTime is increased like a "k-rate", that is to say, is increased as a multiple of blockTime. I have an experiment on this: http://jsfiddle.net/SN8Vm/5/
As you can see, the currentTime is always a multiple of blockTime = 128/44100.

Is the communication between the JavaScript thread and the audio thread done for each block-size? And then is the currentTime exposed in JavaScript just updated for each bloc-size?

Thank you!

Arnau

Received on Tuesday, 27 May 2014 14:06:38 UTC