OutputSource

interface OutputSource

What the audio sink needs from the app. The sink is written against this and PcmOutput, so a test can give it a fake output and no DAC.

Inheritors

Functions

Link copied to clipboard
open fun canRecover(error: DacException): Boolean

Whether this source can recreate an output after this typed failure and a decoder seek.

Link copied to clipboard
abstract fun close(output: OpenedOutput)

Closes output and everything opened for it. Blocks.

Link copied to clipboard
open fun formatSupport(request: StreamRequest): OutputSupport

Whether the sink should accept request, answered from cached capabilities only. Do not open, negotiate, or probe here. UsbDacAudioSink.getFormatSupport asks it for every raw PCM format.

Link copied to clipboard
open fun onRecoveryPosition(output: OpenedOutput?, positionUs: Long?)

Last sink position observed on the playback thread, or null after a flush/reconfiguration. This is an advisory recovery point, not proof of samples audible at the instant of loss.

Link copied to clipboard
abstract fun open(request: StreamRequest): OpenedOutput

Opens the best output for request. Blocks for 100 ms or more: the sink calls it off the main thread.

Link copied to clipboard
open fun reconfigure(output: OpenedOutput, request: StreamRequest): OutputReconfiguration?

Optional transactional format change after drain; null retains the close/open fallback.

Link copied to clipboard
abstract fun setVolumeMultiplier(multiplier: Float)

Android's ducking and the app's own player volume, as a multiplier from 0 to 1.

Link copied to clipboard
abstract fun takeLookAgain(): Boolean

True once if the settings or the devices changed since the last time the output was opened.