SDL_HINT_AUD...E_STREAM_ROLE(3)
π SDL_HINT_AUDIO_DEVICE_STREAM_ROLE π
okay bestie, welcome to the SDL3 functions corner of the manual, and today's main character is SDL_HINT_AUDIO_DEVICE_STREAM_ROLE β the little string that tells the whole entire operating system what kind of audio you're doing. yes, it's giving "who is she" energy. let's get into it. π
β¨ NAME β¨
SDL_HINT_AUDIO_DEVICE_STREAM_ROLE β Specify an application role for an audio device. π§
πΈ SYNOPSIS πΈ
#include <SDL3/SDL_hints.h>
#define SDL_HINT_AUDIO_DEVICE_STREAM_ROLE "SDL_AUDIO_DEVICE_STREAM_ROLE"
π¦ DESCRIPTION π¦
so. some audio backends β Pipewire, for example, love that for her β actually let you describe the role of your audio stream. and bestie, this isn't just vibes for nothing: that description can literally show up in a system control panel, or in software that displays and manipulates media playback/recording graphs. it's your audio stream's whole little reputation. π
this hint is how you transmit that info to the OS. the contents of this hint are used while opening an audio device. so use a string that describes what your program is playing β Game, Music, Movie, etc...
setting this to "" or just leaving it unset? no worries, SDL will use a reasonable default: "Game" or something similar. she's got you. π
okay important note, don't get it twisted: even though this talks about audio streams, this is an OS-level concept. so it applies to a physical audio device in this case β not an SDL_AudioStream, and not an SDL logical audio device. different girls, different jobs. π«Ά
π Windows WASAPI roles π
for Windows WASAPI audio, these are the roles that are supported, and they map to AUDIO_STREAM_CATEGORY:
"Other"β the default"Communications"β real-time communications, such as VOIP or chat"Game"β game audio"GameChat"β game chat audio, similar to"Communications"except that this will not attenuate other audio streams"Movie"β music or sound with dialog"Media"β music or sound without dialog
π§ Android AAudio π§
Android's AAudio target supports this hint as of SDL 3.4.4. Android does not support the exact same options as WASAPI, but for portability it will attempt to map these same strings to the aaudio_usage_t constants. for example, "Movie" and "Media" will both map to AAUDIO_USAGE_MEDIA, etc. slay, she's bilingual. β¨
β one more thing, bestie β
if your application applies its own echo cancellation, gain control, and noise reduction, it should also set SDL_HINT_AUDIO_DEVICE_RAW_STREAM. that's the matching set, okay? don't split them up. π€
π₯ TIMING MATTERS: this hint should be set before an audio device is opened. set it late and it's giving... nothing. π
π AVAILABILITY π
this hint is available since SDL 3.2.0. periodt. π
and that's the whole page, bestie!! πΈ this was the SDL3 functions manual, shipped with Simple Directmedia Layer for SDL 3.4.18 β go forth and tell the OS what your audio is actually about ππ π¦
π¦ where this page comes from
- fedora 43: SDL3-devel 3.4.18-1.fc43 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 43: SDL3-devel 3.4.18-1.fc43 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 44: SDL3-devel 3.4.18-1.fc44 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 44: SDL3-devel 3.4.18-1.fc44 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms