# CapturingAudioSink

Artifact: [androidx.media3:media3-test-utils](https://developer.android.com/jetpack/androidx/releases/media3) [View Source](https://cs.android.com/search?q=file:androidx/media3/test/utils/CapturingAudioSink.java+class:androidx.media3.test.utils.CapturingAudioSink)

*** ** * ** ***


```
@UnstableApi
class CapturingAudioSink : ForwardingAudioSink, Dumper.Dumpable
```

<br />

|---|---|---|
| [kotlin.Any](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html) |||
| ↳ | [androidx.media3.exoplayer.audio.ForwardingAudioSink](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/audio/ForwardingAudioSink) ||
|   | ↳ | [androidx.media3.test.utils.CapturingAudioSink](https://developer.android.com/reference/kotlin/androidx/media3/test/utils/CapturingAudioSink) |

*** ** * ** ***

An `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/audio/AudioSink` forwarding to `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/audio/DefaultAudioSink` that captures configuration, discontinuity and buffer events.

## Summary

| ### Nested types |
|---|
| `class https://developer.android.com/reference/kotlin/androidx/media3/test/utils/CapturingAudioSink.InterceptingBufferSink : https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/audio/TeeAudioProcessor.AudioBufferSink` |
| `class https://developer.android.com/reference/kotlin/androidx/media3/test/utils/CapturingAudioSink.SampleInterceptingBufferSink : https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/audio/TeeAudioProcessor.AudioBufferSink` |

| ### Protected constructors |
|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/CapturingAudioSink#CapturingAudioSink(androidx.media3.exoplayer.audio.AudioSink,boolean)( sink: https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/audio/AudioSink!, shouldCaptureIndividualBuffers: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html )` |

| ### Public functions |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/CapturingAudioSink#configure(androidx.media3.exoplayer.audio.AudioSink.AudioSinkConfig)(audioSinkConfig: https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/audio/AudioSink.AudioSinkConfig!)` Configures (or reconfigures) the sink. |
| `java-static https://developer.android.com/reference/kotlin/androidx/media3/test/utils/CapturingAudioSink!` | `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/CapturingAudioSink#create()()` Creates the capturing audio sink. |
| `java-static https://developer.android.com/reference/kotlin/androidx/media3/test/utils/CapturingAudioSink!` | `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/CapturingAudioSink#createForSampleCapturing()()` |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/CapturingAudioSink#dump(androidx.media3.test.utils.Dumper)(dumper: https://developer.android.com/reference/kotlin/androidx/media3/test/utils/Dumper!)` Dumps the fields of the object using the `dumper`. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/CapturingAudioSink#flush()()` Flushes the sink, after which it is ready to receive buffers from a new playback position. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/CapturingAudioSink#handleBuffer(java.nio.ByteBuffer,long,int)( buffer: https://developer.android.com/reference/java/nio/ByteBuffer.html!, presentationTimeUs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html, encodedAccessUnitCount: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html )` Attempts to process data from a `https://developer.android.com/reference/java/nio/ByteBuffer.html`, starting from its current position and ending at its limit (exclusive). |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/CapturingAudioSink#handleDiscontinuity()()` Signals to the sink that the next buffer may be discontinuous with the previous buffer. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/CapturingAudioSink#hasPendingData()()` Returns whether the sink has data pending that has not been consumed yet. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/CapturingAudioSink#pause()()` Pauses playback. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/CapturingAudioSink#play()()` Starts or resumes consuming audio if initialized. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/CapturingAudioSink#reset()()` Resets the sink, releasing any resources that it currently holds. |

| ### Protected functions |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/audio/AudioSink!` | `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/CapturingAudioSink#getDelegateAudioSink()()` Returns the wrapped `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/audio/AudioSink`. |

### Inherited Constants

From [androidx.media3.exoplayer.audio.AudioSink](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/audio/AudioSink) `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/audio/AudioSink#CURRENT_POSITION_NOT_SET() = -9223372036854775808`

Returned by `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/audio/AudioSink#getCurrentPositionUs(boolean)` when the position is not set.
`const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/audio/AudioSink#OFFLOAD_MODE_DISABLED() = 0`

The audio sink will never play in offload mode.
`const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/audio/AudioSink#OFFLOAD_MODE_ENABLED_GAPLESS_NOT_REQUIRED() = 2`

The audio sink will prefer offload playback even if this might result in silence gaps between tracks.
`const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/audio/AudioSink#OFFLOAD_MODE_ENABLED_GAPLESS_REQUIRED() = 1`

The audio sink will prefer offload playback except in the case where both the track is gapless and the device does support gapless offload playback.
`const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/audio/AudioSink#SINK_FORMAT_SUPPORTED_DIRECTLY() = 2`

The sink supports the format directly, without the need for internal transcoding.
`const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/audio/AudioSink#SINK_FORMAT_SUPPORTED_WITH_TRANSCODING() = 1`

The sink supports the format, but needs to transcode it internally to do so.
`const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/audio/AudioSink#SINK_FORMAT_UNSUPPORTED() = 0`

The sink does not support the format.

### Inherited functions

From [androidx.media3.exoplayer.audio.AudioSink](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/audio/AudioSink) `abstract https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/audio/AudioSink#handleBuffer(java.nio.ByteBuffer,long,int)(
buffer: https://developer.android.com/reference/java/nio/ByteBuffer.html!,
presentationTimeUs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html,
encodedAccessUnitCount: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html
)`

Attempts to process data from a `https://developer.android.com/reference/java/nio/ByteBuffer.html`, starting from its current position and ending at its limit (exclusive).
From [androidx.media3.exoplayer.audio.ForwardingAudioSink](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/audio/ForwardingAudioSink) `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/audio/ForwardingAudioSink#configure(androidx.media3.common.Format,int,int[])(
inputFormat: https://developer.android.com/reference/kotlin/androidx/media3/common/Format!,
specifiedBufferSize: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html,
outputChannels: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html>?
)`

**This function is deprecated.**

Call and implement `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/audio/AudioSink#configure(androidx.media3.exoplayer.audio.AudioSink.AudioSinkConfig)` instead.

<br />

`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/audio/ForwardingAudioSink#disableTunneling()()`

Disables tunneling.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/audio/ForwardingAudioSink#enableTunnelingV21()()`

Enables tunneling, if possible.
`https://developer.android.com/reference/kotlin/androidx/media3/common/AudioAttributes?` `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/audio/ForwardingAudioSink#getAudioAttributes()()`

Returns the audio attributes used for audio playback, or `null` if the sink does not use audio attributes.
`https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/audio/AudioCapabilities?` `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/audio/ForwardingAudioSink#getAudioCapabilities()()`

Returns the AudioCapabilities of the sink, if supported by the sink implementation.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/audio/ForwardingAudioSink#getAudioTrackBufferSizeUs()()`

Returns the size of the underlying `https://developer.android.com/reference/android/media/AudioTrack.html` buffer in microseconds.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/audio/ForwardingAudioSink#getCurrentPositionUs(boolean)(sourceEnded: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)`

Returns the playback position in the stream starting at zero, in microseconds, or `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/audio/AudioSink#CURRENT_POSITION_NOT_SET()` if it is not yet available.
`https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/audio/AudioOffloadSupport!` `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/audio/ForwardingAudioSink#getFormatOffloadSupport(androidx.media3.common.Format)(format: https://developer.android.com/reference/kotlin/androidx/media3/common/Format!)`

Returns the level of offload support that the sink can provide for a given `https://developer.android.com/reference/kotlin/androidx/media3/common/Format`.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` `@https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/audio/AudioSink.SinkFormatSupport
https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/audio/ForwardingAudioSink#getFormatSupport(androidx.media3.common.Format)(format: https://developer.android.com/reference/kotlin/androidx/media3/common/Format!)`

Returns the level of support that the sink provides for a given `https://developer.android.com/reference/kotlin/androidx/media3/common/Format`.
`https://developer.android.com/reference/kotlin/androidx/media3/common/PlaybackParameters!` `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/audio/ForwardingAudioSink#getPlaybackParameters()()`

Returns the active `https://developer.android.com/reference/kotlin/androidx/media3/common/PlaybackParameters`.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/audio/ForwardingAudioSink#getSkipSilenceEnabled()()`

Returns whether silences are skipped in the audio stream.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/audio/ForwardingAudioSink#isEnded()()`

Returns whether `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/audio/AudioSink#playToEndOfStream()` has been called and all buffers have been processed.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/audio/ForwardingAudioSink#playToEndOfStream()()`

Processes any remaining data.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/audio/ForwardingAudioSink#release()()`

Releases the audio sink.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/audio/ForwardingAudioSink#setAudioAttributes(androidx.media3.common.AudioAttributes)(audioAttributes: https://developer.android.com/reference/kotlin/androidx/media3/common/AudioAttributes!)`

Sets attributes for audio playback.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/audio/ForwardingAudioSink#setAudioOutputProvider(androidx.media3.exoplayer.audio.AudioOutputProvider)(audioOutputProvider: https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/audio/AudioOutputProvider!)`

Sets the `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/audio/AudioOutputProvider` to use as the output path.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/audio/ForwardingAudioSink#setAudioSessionId(int)(audioSessionId: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`

Sets the audio session id.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/audio/ForwardingAudioSink#setAuxEffectInfo(androidx.media3.common.AuxEffectInfo)(auxEffectInfo: https://developer.android.com/reference/kotlin/androidx/media3/common/AuxEffectInfo!)`

Sets the auxiliary effect.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/audio/ForwardingAudioSink#setClock(androidx.media3.common.util.Clock)(clock: https://developer.android.com/reference/kotlin/androidx/media3/common/util/Clock!)`

Sets the `https://developer.android.com/reference/kotlin/androidx/media3/common/util/Clock` to use for timing in this audio sink.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/audio/ForwardingAudioSink#setEncoderPadding(int)(paddingInFrames: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`

Sets the number of audio frames to trim from the end of PCM audio passed to this sink.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/audio/ForwardingAudioSink#setListener(androidx.media3.exoplayer.audio.AudioSink.Listener)(listener: https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/audio/AudioSink.Listener!)`

Sets the listener for sink events, which should be the audio renderer.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `@https://developer.android.com/reference/kotlin/androidx/annotation/RequiresApi(value = 29)
https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/audio/ForwardingAudioSink#setOffloadDelayPadding(int,int)(delayInFrames: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, paddingInFrames: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`

Sets offload delay and padding on the `https://developer.android.com/reference/android/media/AudioTrack.html`, if possible.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `@https://developer.android.com/reference/kotlin/androidx/annotation/RequiresApi(value = 29)
https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/audio/ForwardingAudioSink#setOffloadMode(int)(@https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/audio/AudioSink.OffloadMode offloadMode: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`

Sets audio offload mode, if possible.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/audio/ForwardingAudioSink#setOutputStreamOffsetUs(long)(outputStreamOffsetUs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)`

Sets the offset that is added to the media timestamp before it is passed as `
presentationTimeUs` in `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/audio/AudioSink#handleBuffer(java.nio.ByteBuffer,long,int)`.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/audio/ForwardingAudioSink#setPlaybackParameters(androidx.media3.common.PlaybackParameters)(playbackParameters: https://developer.android.com/reference/kotlin/androidx/media3/common/PlaybackParameters!)`

Attempts to set the playback parameters.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/audio/ForwardingAudioSink#setPlayerId(androidx.media3.exoplayer.analytics.PlayerId)(playerId: https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/analytics/PlayerId?)`

Sets the `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/analytics/PlayerId` of the player using this audio sink.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/audio/ForwardingAudioSink#setPreferredDevice(android.media.AudioDeviceInfo)(audioDeviceInfo: https://developer.android.com/reference/android/media/AudioDeviceInfo.html?)`

Sets the preferred audio device.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/audio/ForwardingAudioSink#setSkipSilenceEnabled(boolean)(skipSilenceEnabled: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)`

Sets whether silences should be skipped in the audio stream.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/audio/ForwardingAudioSink#setVirtualDeviceId(int)(virtualDeviceId: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`

Sets the virtual device id.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/audio/ForwardingAudioSink#setVolume(float)(volume: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)`

Sets the playback volume.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/audio/ForwardingAudioSink#supportsFormat(androidx.media3.common.Format)(format: https://developer.android.com/reference/kotlin/androidx/media3/common/Format!)`

Returns whether the sink supports a given `https://developer.android.com/reference/kotlin/androidx/media3/common/Format`.

## Protected constructors

### CapturingAudioSink

```
protected CapturingAudioSink(
    sink: AudioSink!,
    shouldCaptureIndividualBuffers: Boolean
)
```

## Public functions

### configure

```
fun configure(audioSinkConfig: AudioSink.AudioSinkConfig!): Unit
```

Configures (or reconfigures) the sink.

| Parameters |
|---|---|
| `audioSinkConfig: https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/audio/AudioSink.AudioSinkConfig!` | The `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/audio/AudioSink.AudioSinkConfig`. |

| Throws |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/audio/AudioSink.ConfigurationException` | If an error occurs configuring the sink. |

### create

```
java-static fun create(): CapturingAudioSink!
```

Creates the capturing audio sink.

### createForSampleCapturing

```
java-static fun createForSampleCapturing(): CapturingAudioSink!
```

### dump

```
fun dump(dumper: Dumper!): Unit
```

Dumps the fields of the object using the `dumper`.

| Parameters |
|---|---|
| `dumper: https://developer.android.com/reference/kotlin/androidx/media3/test/utils/Dumper!` | The `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/Dumper` to be used to dump fields. |

### flush

```
fun flush(): Unit
```

Flushes the sink, after which it is ready to receive buffers from a new playback position.

The audio session may remain active until `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/audio/AudioSink#reset()` is called.

### handleBuffer

```
fun handleBuffer(
    buffer: ByteBuffer!,
    presentationTimeUs: Long,
    encodedAccessUnitCount: Int
): Boolean
```

Attempts to process data from a `https://developer.android.com/reference/java/nio/ByteBuffer.html`, starting from its current position and ending at its limit (exclusive). The position of the `https://developer.android.com/reference/java/nio/ByteBuffer.html` is advanced by the number of bytes that were handled. `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/audio/AudioSink.Listener#onPositionDiscontinuity()` will be called if `presentationTimeUs` is discontinuous with the last buffer handled since the last reset.

Returns whether the data was handled in full. If the data was not handled in full then the same `https://developer.android.com/reference/java/nio/ByteBuffer.html` must be provided to subsequent calls until it has been fully consumed, except in the case of an intervening call to `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/audio/AudioSink#flush()` (or to `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/audio/AudioSink#configure(androidx.media3.exoplayer.audio.AudioSink.AudioSinkConfig)` that causes the sink to be flushed).

| Parameters |
|---|---|
| `buffer: https://developer.android.com/reference/java/nio/ByteBuffer.html!` | The buffer containing audio data. |
| `presentationTimeUs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | The presentation timestamp of the buffer in microseconds. |
| `encodedAccessUnitCount: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The number of encoded access units in the buffer, or 1 if the buffer contains PCM audio. This allows batching multiple encoded access units in one buffer. |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | Whether the buffer was handled fully. |

| Throws |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/audio/AudioSink.InitializationException` | If an error occurs initializing the sink. |
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/audio/AudioSink.WriteException` | If an error occurs writing the audio data. |

### handleDiscontinuity

```
fun handleDiscontinuity(): Unit
```

Signals to the sink that the next buffer may be discontinuous with the previous buffer.

### hasPendingData

```
fun hasPendingData(): Boolean
```

Returns whether the sink has data pending that has not been consumed yet.

### pause

```
fun pause(): Unit
```

Pauses playback.

### play

```
fun play(): Unit
```

Starts or resumes consuming audio if initialized.

### reset

```
fun reset(): Unit
```

Resets the sink, releasing any resources that it currently holds.

## Protected functions

### getDelegateAudioSink

```
protected fun getDelegateAudioSink(): AudioSink!
```

Returns the wrapped `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/audio/AudioSink`.