class AudioObject

Defined at line 27 of file ../../src/media/audio/audio_core/audio_object.h

The simple base class for 4 major types of audio objects in the mixer: Outputs, Inputs,

AudioRenderers and AudioCapturers. It ensures that each is intrusively ref-counted, and remembers

its type so that it may be safely downcast from generic object to something more specific.

Public Methods

AudioObject & operator= (AudioObject )

Disallow copy, assign, and move.

Defined at line 30 of file ../../src/media/audio/audio_core/audio_object.h

void AudioObject (const AudioObject & )

Defined at line 31 of file ../../src/media/audio/audio_core/audio_object.h

void AudioObject (AudioObject && )

Defined at line 32 of file ../../src/media/audio/audio_core/audio_object.h

AudioObject & operator= (AudioObject && )

Defined at line 33 of file ../../src/media/audio/audio_core/audio_object.h

void ~AudioObject ()

Defined at line 35 of file ../../src/media/audio/audio_core/audio_object.h

fpromise::result<std::pair<std::shared_ptr<Mixer>, ExecutionDomain *>, zx_status_t> InitializeSourceLink (const AudioObject & source, std::shared_ptr<ReadableStream> stream)

Initialize(Source|Dest)Link

Called on the AudioCore's main message loop any time a source and a destination are being

linked via AudioObject::LinkObjects. By default, these hooks do nothing, but AudioObject

subclasses may use them to set the properties of a link (or reject the link) before the link

gets added to the source and destination link sets.

For example, Sources like an AudioRenderer override InitializeDestLink in order to set the

source gain and to make a copy of their pending packet queue. Destinations like an output

override InitializeSourceLink in order to choose and initialize an appropriate resampling

filter.

When initializing a source link, an implementor must provide a mixer and an ExecutionDomain

for that mixer to run in. The source object and their stream are provided.

Returns ZX_OK if initialization succeeded, or an appropriate error code otherwise.

Defined at line 60 of file ../../src/media/audio/audio_core/audio_object.h

fpromise::result<std::shared_ptr<ReadableStream>, zx_status_t> InitializeDestLink (const AudioObject & dest)

Defined at line 64 of file ../../src/media/audio/audio_core/audio_object.h

void CleanupSourceLink (const AudioObject & source, std::shared_ptr<ReadableStream> stream)

Defined at line 69 of file ../../src/media/audio/audio_core/audio_object.h

void CleanupDestLink (const AudioObject & dest)

Defined at line 71 of file ../../src/media/audio/audio_core/audio_object.h

void OnLinkAdded ()

Called immediately after a new link is added to the object.

Defined at line 74 of file ../../src/media/audio/audio_core/audio_object.h

std::optional<Format> format ()

Note: format() is subject to change and must only be accessed from the main message loop

thread. Outputs which are running on mixer threads should never access format() directly

from a mix thread. Instead, they should use the format which was assigned to the AudioLink

at the time the link was created.

Defined at line 80 of file ../../src/media/audio/audio_core/audio_object.h

std::optional<StreamUsage> usage ()

Defined at line 81 of file ../../src/media/audio/audio_core/audio_object.h

const PipelineConfig * pipeline_config ()

Defined at line 82 of file ../../src/media/audio/audio_core/audio_object.h

bool format_valid ()

Defined at line 84 of file ../../src/media/audio/audio_core/audio_object.h

AudioObject::Type type ()

Defined at line 86 of file ../../src/media/audio/audio_core/audio_object.h

bool is_output ()

Defined at line 88 of file ../../src/media/audio/audio_core/audio_object.h

bool is_input ()

Defined at line 89 of file ../../src/media/audio/audio_core/audio_object.h

bool is_audio_renderer ()

Defined at line 90 of file ../../src/media/audio/audio_core/audio_object.h

bool is_audio_capturer ()

Defined at line 91 of file ../../src/media/audio/audio_core/audio_object.h

Protected Methods

void AudioObject (Type type)

Defined at line 94 of file ../../src/media/audio/audio_core/audio_object.h

Enumerations

enum Type
Name Value
Output 0
Input 1
AudioRenderer 2
AudioCapturer 3

Defined at line 37 of file ../../src/media/audio/audio_core/audio_object.h