carb::audio::PlaybackContextDesc

Defined in carb/audio/IAudioPlayback.h

struct PlaybackContextDesc

descriptor used to indicate the options passed to the createContext() function.

This determines the how the context will behave.

Public Members

PlaybackContextFlags flags = 0

flags to indicate some additional behavior of the context.

No flags are currently defined. This should be set to 0. In future versions, these flags may be used to determine how the ext member is interpreted.

ContextCallback callback = nullptr

a callback function to be registered with the new context object.

This callback will be performed any time the output device list changes. This notification will only indicate that a change has occurred, not which specific change occurred. It is the caller’s responsibility to re-enumerate devices to determine if any further action is necessary for the updated device list. This may be nullptr if no device change notifications are needed.

void *callbackContext = nullptr

an opaque context value to be passed to the callback whenever it is performed.

This value will never be accessed by the context object and will only be passed unmodified to the callback function. This value is only used if a device change callback is provided.

size_t maxBuses = 0

the maximum number of data buses to process simultaneously.

This is equivalent to the maximum number of potentially audible sounds that could possibly affect the output on the speakers. If more voices than this are active, the quietest or furthest voice will be deactivated. The default value for this is 64. Set this to 0 to use the default for the platform.

For a baking context, this should be set to a value that is large enough to guarantee that no voices will become virtualized. If a voice becomes virtualized in a baking context and it is set to simulate that voice’s current position, the resulting position when it becomes a real voice again is unlikely to match the expected position. This is because there is no fixed time base to simulate the voice on. The voice will be simulated as if it were playing in real time.

OutputDesc output = {}

descriptor for the output to choose for the new audio context.

This must specify at least one output target.

const char *outputDisplayName = nullptr

A name to use for any audio device connection that requires one.

This can be set to nullptr to use a generic default name, if necessary. This is useful in situations where a platform, such as Pulse Audio, will display a name to the user for each individual audio connection. This string is copied internally, so the memory can be discarded after calling createContext().

void *ext = nullptr

extended information for this descriptor.

This is reserved for future expansion and should be set to nullptr.