number of samples written can be less than out_samples when buf was interrupted with a flush or stop.
AudioRingBuffer.commit
uint commit(ref ulong sample, ubyte[] data, int outSamples, ref int accum)Commit in_samples samples pointed to by data to the ringbuffer buf.
in_samples and out_samples define the rate conversion to perform on the samples in data. For negative rates, out_samples must be negative and in_samples positive.
When out_samples is positive, the first sample will be written at position sample in the ringbuffer. When out_samples is negative, the last sample will be written to sample in reverse order.
out_samples does not need to be a multiple of the segment size of the ringbuffer although it is recommended for optimal performance.
accum will hold a temporary accumulator used in rate conversion and should be set to 0 when this function is first called. In case the commit operation is interrupted, one can resume the processing by passing the previously returned accum value back to this function.
MT safe.
Parameters
sample | the sample position of the data |
data | the data to commit |
outSamples | the number of samples to write to the ringbuffer |
accum | accumulator for rate conversion. |