AudioTrackAudioOutputProvider.Builder


class AudioTrackAudioOutputProvider.Builder


A builder to create AudioTrackAudioOutputProvider instances.

Summary

Public constructors

Builder(context: Context?)

Creates a new builder.

Public functions

AudioTrackAudioOutputProvider!

Builds the AudioTrackAudioOutputProvider.

AudioTrackAudioOutputProvider.Builder!

Sets an AudioOffloadSupportProvider to provide the provider's offload support capabilities for a given AudioOutputProvider.FormatConfig for calls to getFormatSupport.

AudioTrackAudioOutputProvider.Builder!

Sets an AudioTrackBufferSizeProvider to compute the buffer size when configure is called with specifiedBufferSize == 0.

AudioTrackAudioOutputProvider.Builder!

Sets a BiConsumer to modify the AudioTrack.Builder before building the AudioTrack.

AudioTrackAudioOutputProvider.Builder!

Sets the maximum playback speed that an AudioTrackAudioOutput provided by this instance is going to be configured for.

Public constructors

Builder

Builder(context: Context?)

Creates a new builder.

Parameters
context: Context?

The Context.

Public functions

setAudioOffloadSupportProvider

@UnstableApi
@CanIgnoreReturnValue
fun setAudioOffloadSupportProvider(
    audioOffloadSupportProvider: DefaultAudioSink.AudioOffloadSupportProvider!
): AudioTrackAudioOutputProvider.Builder!

Sets an AudioOffloadSupportProvider to provide the provider's offload support capabilities for a given AudioOutputProvider.FormatConfig for calls to getFormatSupport.

The default is an instance of DefaultAudioOffloadSupportProvider.

Parameters
audioOffloadSupportProvider: DefaultAudioSink.AudioOffloadSupportProvider!

The AudioOffloadSupportProvider to use.

Returns
AudioTrackAudioOutputProvider.Builder!

This builder.

setAudioTrackBufferSizeProvider

@UnstableApi
@CanIgnoreReturnValue
fun setAudioTrackBufferSizeProvider(
    bufferSizeProvider: DefaultAudioSink.AudioTrackBufferSizeProvider!
): AudioTrackAudioOutputProvider.Builder!

Sets an AudioTrackBufferSizeProvider to compute the buffer size when configure is called with specifiedBufferSize == 0.

The default value is DEFAULT.

Returns
AudioTrackAudioOutputProvider.Builder!

This builder.

setAudioTrackBuilderModifier

@CanIgnoreReturnValue
@RequiresApi(value = 24)
fun setAudioTrackBuilderModifier(
    audioTrackBuilderModifier: BiConsumer<AudioTrack.Builder!, AudioOutputProvider.OutputConfig!>!
): AudioTrackAudioOutputProvider.Builder!

Sets a BiConsumer to modify the AudioTrack.Builder before building the AudioTrack.

Parameters
audioTrackBuilderModifier: BiConsumer<AudioTrack.Builder!, AudioOutputProvider.OutputConfig!>!

A BiConsumer that accepts an AudioTrack.Builder and an OutputConfig.

Returns
AudioTrackAudioOutputProvider.Builder!

This builder.

setMaxPlaybackSpeed

@UnstableApi
@CanIgnoreReturnValue
fun setMaxPlaybackSpeed(maxPlaybackSpeed: Float): AudioTrackAudioOutputProvider.Builder!

Sets the maximum playback speed that an AudioTrackAudioOutput provided by this instance is going to be configured for. This is also used to allocate buffers that are big enough to not underrun at the maximum playback speed. This value has no effect if useAudioOutputPlaybackParams is disabled.

The default value is MAX_PLAYBACK_SPEED.

Parameters
maxPlaybackSpeed: Float

The maximum playback speed to use. Must be at least 1f.

Returns
AudioTrackAudioOutputProvider.Builder!

This builder.