AudioMixingUtil


@UnstableApi
class AudioMixingUtil


Utility for mixing audio buffers.

Summary

Public functions

java-static Boolean
java-static Boolean
canMix(
    inputAudioFormat: AudioProcessor.AudioFormat!,
    outputAudioFormat: AudioProcessor.AudioFormat!
)
java-static ByteBuffer!
mix(
    inputBuffer: ByteBuffer!,
    inputAudioFormat: AudioProcessor.AudioFormat!,
    mixingBuffer: ByteBuffer!,
    mixingAudioFormat: AudioProcessor.AudioFormat!,
    matrix: ChannelMixingMatrix!,
    framesToMix: Int,
    accumulate: Boolean,
    clipFloatOutput: Boolean
)

Mixes audio from the input buffer into the mixing buffer.

Public functions

canMix

java-static fun canMix(audioFormat: AudioProcessor.AudioFormat!): Boolean

canMix

java-static fun canMix(
    inputAudioFormat: AudioProcessor.AudioFormat!,
    outputAudioFormat: AudioProcessor.AudioFormat!
): Boolean

mix

java-static fun mix(
    inputBuffer: ByteBuffer!,
    inputAudioFormat: AudioProcessor.AudioFormat!,
    mixingBuffer: ByteBuffer!,
    mixingAudioFormat: AudioProcessor.AudioFormat!,
    matrix: ChannelMixingMatrix!,
    framesToMix: Int,
    accumulate: Boolean,
    clipFloatOutput: Boolean
): ByteBuffer!

Mixes audio from the input buffer into the mixing buffer.

canMix must return true for the formats.

Parameters
inputBuffer: ByteBuffer!

Input audio ByteBuffer, the position is advanced by the amount of bytes read and mixed.

inputAudioFormat: AudioProcessor.AudioFormat!

AudioFormat of the inputBuffer.

mixingBuffer: ByteBuffer!

Mixing audio ByteBuffer, the position is advanced by the amount of bytes written.

mixingAudioFormat: AudioProcessor.AudioFormat!

AudioFormat of the mixingBuffer.

matrix: ChannelMixingMatrix!

Scaled channel mapping from input to output.

framesToMix: Int

Number of audio frames to mix. Must be within the bounds of both buffers.

accumulate: Boolean

Whether to accumulate with the existing samples in the mixing buffer.

clipFloatOutput: Boolean

Whether to clip the output signal to be in the [-1.0, 1.0] range if the output encoding is ENCODING_PCM_FLOAT.

Returns
ByteBuffer!

The mixingBuffer, for convenience.