on Buffer
abstract fun onBuffer(buffer: ByteBuffer, audioFormat: Int, channelCount: Int, sampleRate: Int, bytesRead: Int, captureTimeNs: Long): Long
Called when new audio samples are ready.
Return
the capture timestamp in nanoseconds. Return 0 if not available.
Parameters
buffer
the buffer of audio bytes. Changes to this buffer will be published on the audio track.
audio Format
the audio encoding. See AudioFormat.ENCODING_PCM_8BIT, AudioFormat.ENCODING_PCM_16BIT, and AudioFormat.ENCODING_PCM_FLOAT. Note that AudioFormat.ENCODING_DEFAULT defaults to PCM-16bit.
channel Count
sample Rate
bytes Read
the byte count originally read from the microphone.
capture Time Ns
the capture timestamp of the original audio data in nanoseconds.