commit
Description:
Commit data.length
samples pointed to by data
to the ringbuffer this.
data.length
and out_samples
define the rate conversion to perform on the samples in data
. For negative
rates, out_samples
must be negative and data.length
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:
this |
the RingBuffer to commit |
sample |
the sample position of the data |
data |
the data to commit |
out_samples |
the number of samples to write to the ringbuffer |
accum |
accumulator for rate conversion. |
in_samples |
the number of samples in the data to commit |
Returns:
The number of samples written to the ringbuffer or -1 on error. The number of samples written can be less than |