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.
- Playing sounds covers playing files, controlling playback, volume and looping.
- Custom sound sources describes how to play generated or decoded-by-you audio.
Related Pages#
-
Interface for audio playback.
-
Implements audio gain filtering.
-
Base interface for representing sound input streams of different formats
-
Sample formats supported for mixing.
-
Describes PCM audio: channel count, sample rate and sample format.
-
Manages audio players and mixes them into one sound stream.
-
Sound stream that outputs raw samples
-
Sound stream for OGG format
-
Sound stream for WAV format