OutputDesc

class carb.audio.OutputDesc

Bases: pybind11_object

Descriptor of the audio output target to use for an audio context. This may be specified both when creating an audio context and when calling set_output(). An output may only consist of a real audio device from the Python side

Methods

__init__(self)

Attributes

device_index

The index of the device to open.

flags

Flags to indicate which output target is to be used.

frame_rate

The frame rate in Hertz to run the processing engine at.

speaker_mode

The output speaker mode to set.

__init__(self: carb.audio._audio.OutputDesc) None
property device_index

The index of the device to open. This must be greater than or equal to 0 and less than the most recent return value of `get_device_count()`. Set this to 0 to choose the system’s default playback device. This defaults to 0. This value is always ignored if the `OUTPUT_FLAG_DEVICE` flag is not used and the `flags` member is not 0.

property flags

Flags to indicate which output target is to be used. Currently only a single output target may be specified. This must be one of the `OUTPUT_FLAG_*` flags. Future versions may allow for multiple simultaneous outputs. If this is 0, the default output device will be selected. If more than zero flags are specified, the audio device index will specify which device to use.

property frame_rate

The frame rate in Hertz to run the processing engine at. This should be 0 for any output that targets a real hardware device (ie: the `OUTPUT_FLAG_DEVICE` is used in `flags` or `flags` is 0), It is possible to specify a non-zero value here when a hardware device is targeted, but that may lead to unexpected results depending on the value given. For example, this could be set to 1000Hz, but the device could run at 48000Hz. This would process the audio data properly, but it would sound awful since the processing data rate is so low. Conversely, if a frame rate of 200000Hz is specified but the device is running at 48000Hz, a lot of CPU processing time will be wasted.

When an output is targeting only a streamer table, this should be set to the frame rate to process audio at. If this is 0, a frame rate of 48000Hz will be used. This value should generally be a common audio processing rate such as 44100Hz, 48000Hz, etc. Other frame rates can be used, but the results may be unexpected if a frame cannot be perfectly aligned to the cycle period.

property speaker_mode

The output speaker mode to set. This is one of the `SPEAKER_MODE_*` names or a combination of the `SPEAKER_FLAG_*` speaker flags. This will determine the channel layout for the final output of the audio engine. This channel layout will be mapped to the selected device’s speaker mode before sending the final output to the device. This may be set to `SPEAKER_MODE_DEFAULT` to cause the engine’s output to match the output of the device that is eventually opened. This defaults to `SPEAKER_MODE_DEFAULT`.