WaveformAudioBufferSink


@UnstableApi
public class WaveformAudioBufferSink implements TeeAudioProcessor.AudioBufferSink


A sink for audio buffers that produces waveform bars.

Summary

Nested types

Listener for the audio waveform generation.

Aggregates a group of audio samples.

Public constructors

WaveformAudioBufferSink(
    int barsPerSecond,
    int outputChannelCount,
    WaveformAudioBufferSink.Listener listener
)

Creates a new instance.

Public methods

void
flush(int sampleRateHz, int channelCount, @C.PcmEncoding int encoding)

Called when the audio processor is flushed with a format of subsequent input.

void

Called when data is written to the audio processor.

Public constructors

WaveformAudioBufferSink

public WaveformAudioBufferSink(
    int barsPerSecond,
    int outputChannelCount,
    WaveformAudioBufferSink.Listener listener
)

Creates a new instance.

Parameters
int barsPerSecond

The number of bars that should be generated per each second of audio.

int outputChannelCount

The number of channels that the output waveform should contain. If this is different than the number of input channels, the audio will be mixed using the default mixing matrix.

WaveformAudioBufferSink.Listener listener

The listener to be notified when a new waveform bar has been generated.

Public methods

flush

public void flush(int sampleRateHz, int channelCount, @C.PcmEncoding int encoding)

Called when the audio processor is flushed with a format of subsequent input.

handleBuffer

public void handleBuffer(ByteBuffer buffer)

Called when data is written to the audio processor.

Parameters
ByteBuffer buffer

A read-only buffer containing input which the audio processor will handle.