Skip to content

MTY_AudioCreate

chrisd1100 edited this page Aug 25, 2022 · 2 revisions

Create an MTY_Audio context for playback.

MTY_Audio *MTY_AudioCreate(
    uint32_t     sampleRate,
    uint32_t     minBuffer,
    uint32_t     maxBuffer,
    uint8_t      channels,
    const char * deviceID,
    bool         fallback
);

Parameters

sampleRate (uint32_t)

Audio sample rate in KHz.

minBuffer (uint32_t)

The minimum amount of audio in milliseconds that must be queued before playback begins.

maxBuffer (uint32_t)

The maximum amount of audio in milliseconds that can be queued before audio begins getting dropped. The queue will flush to zero, then begin building back towards minBuffer again before playback resumes.

channels (uint8_t)

Number of audio channels.

deviceID (const char *)

Specify a specific audio device for playback, or NULL for the default device. Windows only.

fallback (bool)

If deviceID is not NULL, set to true to fallback to the default device, or false to cause this function to fail and return NULL. Windows only.

Return value

MTY_Audio *

On failure, NULL is returned. Call MTY_GetLog for details.

The returned MTY_Audio context must be destroyed with MTY_AudioDestroy.

Platform support

Windows   macOS   Android   Linux   Web  

See also

Module: Audio

Clone this wiki locally