setBuffer

fun setBuffer(pcmBuffer: ByteArray, offset: Int = 0, size: Int = pcmBuffer.size): Int

Replace the corresponding part of the synthetic buffer with PCM data. Data exceeding the buffer capacity is discarded.

Return

the number of bytes written.


fun setBuffer(pcmBuffer: ByteArray, timestampMicro: Long, offset: Int = 0, size: Int = pcmBuffer.size): Int

Replace the part of the synthetic buffer matching the provided timestamp.

The first call latches the base timestamp, mapped to the current read position (played as soon as possible). Following calls are placed relative to that base using the timestamp delta, so gaps between non contiguous buffers are kept as silence. Data whose time was already consumed or is further in the future than the buffer capacity is discarded.

Return

the number of bytes written.

Parameters

timestampMicro

buffer timestamp in microseconds, in the producer timebase.