Skip to content

aui::audio#

Audio playback library.

Detailed Description#

Experimental Feature

This API is experimental. Experimental APIs are likely to contain bugs, might be changed or removed in the future.

aui::audio plays sounds through the native audio API of the platform: PulseAudio on Linux, DirectSound on Windows, CoreAudio on macOS and iOS, Oboe on Android. On other platforms a stub player is used, which plays nothing.

The central class is IAudioPlayer. It is created from a url (a file, an AUI Assets resource, an http address) or from your own ISoundInputStream:

auto player = IAudioPlayer::fromUrl(":sound/click.ogg");
player->play();

WAV and Ogg Vorbis files are recognized automatically. Whatever the format of the source is, it is resampled and converted to what the audio device wants, so sounds of different formats can be played at the same time. All players that are playing at the moment are mixed together by AAudioMixer.

Warning

Recording (capturing audio from a microphone) and device enumeration are not implemented. The module only plays sound.