Changes

Jump to: navigation, search

Audio Data API

21 bytes added, 17:34, 11 September 2010
Writing Audio
Audio data written using the '''mozWriteAudio()''' method needs to be written at a regular interval in equal portions, in order to keep a little ahead of the current sample offset (current sample offset of hardware can be obtained with '''mozCurrentSampleOffset()'''), where a little means something on the order of 500ms of samples. For example, if working with 2 channels at 44100 samples per second, a writing interval of 100ms, and a pre-buffer equal to 500ms, one would write an array of (2 * 44100 / 10) = 8820 samples, and a total of (currentSampleOffset + 2 * 44100 / 2).
It's also possible to auto detect the minimal duration of the pre-buffer, so such that the sound is playing played without interruptions , and lag between writing and playback is minimal. To do that, this start writing the data in small portions and wait when for the value returned by '''mozCurrentSampleOffset()''' will to be more than 0.
<pre>
Confirm
656
edits

Navigation menu