AudioRingBuffer.commit

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.

class AudioRingBuffer
uint
commit
(
ref ulong sample
,
ubyte[] data
,,
ref int accum
)

Parameters

sample ulong

the sample position of the data

data ubyte[]

the data to commit

outSamples int

the number of samples to write to the ringbuffer

accum int

accumulator for rate conversion.

Return Value

Type: uint

The number of samples written to the ringbuffer or -1 on error. The number of samples written can be less than out_samples when buf was interrupted with a flush or stop.