Skip to content

SDL_emscriptenaudio.c only supports one default audio output device #5485

Closed
@connorjclark

Description

@connorjclark

I have an application that opens an output device for music (via SDL_Mixer) and for sfx/voices. With the current emscripten audio implementation, only the first opened device will work, and the subsequent one fails.

A cursory inspection of the emscripten audio showed me that it explicitly only supports one output device. In a moment of sheer hubris I thought simply changing OnlyHasDefaultOutputDevice from 1 to 0 might fix my problem ... and it did. I have no idea if this is just happened to work for me (now SFX and music work in my application) because I got lucky, or if this really is all that is necessary to support multiple output devices.

I don't know what would happen if I were to attempt closing these opened device handles (no need to do that in my application), so perhaps that is the only place where the support is lacking for multiple devices.

In the meantime, I've been patching my copy of SDL to fix this in my build script:

sed -i -e 's/impl->OnlyHasDefaultOutputDevice = 1/impl->OnlyHasDefaultOutputDevice = 0/' "$EMCC_CACHE_DIR/ports/sdl2/SDL-release-2.0.20/src/audio/emscripten/SDL_emscriptenaudio.c"

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions