From 59372d42b0e545e0b8587da0f02c950d44692482 Mon Sep 17 00:00:00 2001 From: onesixromcom <16732145+onesixromcom@users.noreply.github.com> Date: Sat, 28 Mar 2026 14:35:53 +0200 Subject: [PATCH 1/7] Update SDL3 to latest 3.4.2 version --- tools/ports/sdl3.py | 8 ++++---- tools/ports/sdl3/SDL_build_config.h | 2 ++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/tools/ports/sdl3.py b/tools/ports/sdl3.py index cb743e2b2b5c2..b41f291ac3d2c 100644 --- a/tools/ports/sdl3.py +++ b/tools/ports/sdl3.py @@ -9,9 +9,9 @@ from tools import diagnostics -VERSION = '3.2.30' +VERSION = '3.4.2' TAG = f'release-{VERSION}' -HASH = '80ef7b2f257f43fe47c7ea8aa0a64f1c6f23720d91065d5e9b42f0205c62fc98bcf8dd1f1834fe09c66bea2598a18a658b82212cb29810be2d2175dece0aadce' +HASH = 'a17fe538993a3956e0b85fda21e7b431244e803a5facb35bb7a2bfd9ee23f1aac65838ed3225f526b81410cae7c23da7c40693c2e791385281f0764239116bce' SUBDIR = f'SDL-{TAG}' variants = {'sdl3-mt': {'PTHREADS': 1}} @@ -29,7 +29,7 @@ def get(ports, settings, shared): diagnostics.warning('experimental', 'sdl3 port is still experimental') # get the port - ports.fetch_project('sdl3', f'https://github.com/libsdl-org/SDL/archive/{TAG}.zip', sha512hash=HASH) + ports.fetch_project('sdl3', f'https://github.com/libsdl-org/SDL/archive/refs/tags/{TAG}.zip', sha512hash=HASH) def create(final): root_dir = ports.get_dir('sdl3', SUBDIR) @@ -53,7 +53,7 @@ def create(final): 'atomic/*.c', 'audio/*.c', 'camera/*.c', - 'core/*.c', + 'core/unix/*.c', 'cpuinfo/*.c', 'dynapi/*.c', 'events/*.c', diff --git a/tools/ports/sdl3/SDL_build_config.h b/tools/ports/sdl3/SDL_build_config.h index 87fc5c822c3d2..25317e19e4300 100644 --- a/tools/ports/sdl3/SDL_build_config.h +++ b/tools/ports/sdl3/SDL_build_config.h @@ -47,6 +47,8 @@ #define HAVE_STRING_H 1 #define HAVE_SYS_TYPES_H 1 #define HAVE_WCHAR_H 1 +#define HAVE_GETRESGID 1 +#define HAVE_GETRESUID 1 /* #undef HAVE_PTHREAD_NP_H */ /* C library functions */ From 33906c8f224698e1b3937d31a517fe5b7a106524 Mon Sep 17 00:00:00 2001 From: onesixromcom <16732145+onesixromcom@users.noreply.github.com> Date: Sat, 28 Mar 2026 14:36:30 +0200 Subject: [PATCH 2/7] Simple SDL3_mixer port implementation --- tools/ports/sdl3_mixer.py | 77 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 tools/ports/sdl3_mixer.py diff --git a/tools/ports/sdl3_mixer.py b/tools/ports/sdl3_mixer.py new file mode 100644 index 0000000000000..52c1fa5e4d15f --- /dev/null +++ b/tools/ports/sdl3_mixer.py @@ -0,0 +1,77 @@ +# Copyright 2025 The Emscripten Authors. All rights reserved. +# Emscripten is available under two separate licenses, the MIT license and the +# University of Illinois/NCSA Open Source License. Both these licenses can be +# found in the LICENSE file. + +import os + +from typing import Dict, Set + +VERSION = '3.2.0' +TAG = f'release-{VERSION}' +HASH = '96f374b3ca96202973fca84228e7775db3d6e38888888573d0ba0d045bc1d3cc6f876984e50dcce1b65875c80f8e263b5ff687570f4b4c720f48ca3cfaff0648' +SUBDIR = f'SDL3_mixer-{TAG}' + +deps = ['sdl3'] + +variants = {'sdl3_mixer-mt': {'PTHREADS': 1}} + + +def needed(settings): + return settings.USE_SDL_MIXER == 3 + + +def get_lib_name(settings): + return 'libSDL3_mixer' + ('-mt' if settings.PTHREADS else '') + '.a' + + +def get(ports, settings, shared): + ports.fetch_project('sdl3_mixer', f'https://github.com/libsdl-org/SDL_mixer/archive/refs/tags/{TAG}.zip', sha512hash=HASH) + + def create(final): + src_root = ports.get_dir('sdl3_mixer', 'SDL_mixer-' + TAG) + ports.install_header_dir(os.path.join(src_root, 'include'), target='.') + srcs = [ + "src/SDL_mixer.c", + "src/SDL_mixer_metadata_tags.c", + "src/SDL_mixer_spatialization.c", + "src/decoder_aiff.c", + "src/decoder_au.c", + "src/decoder_drflac.c", + "src/decoder_drmp3.c", + "src/decoder_flac.c", + "src/decoder_fluidsynth.c", + "src/decoder_gme.c", + "src/decoder_mpg123.c", + "src/decoder_opus.c", + "src/decoder_raw.c", + "src/decoder_sinewave.c", + "src/decoder_stb_vorbis.c", + "src/decoder_timidity.c", + "src/decoder_voc.c", + "src/decoder_vorbis.c", + "src/decoder_wav.c", + "src/decoder_wavpack.c", + "src/decoder_xmp.c", + ] + + flags = ['-sUSE_SDL=3', '-DDECODER_WAV','-Wno-format-security', '-Wno-experimental'] + + if settings.PTHREADS: + flags += ['-pthread'] + + ports.build_port(src_root, final, 'sdl3_mixer', flags=flags, srcs=srcs) + + return [shared.cache.get_lib(get_lib_name(settings), create, what='port')] + + +def clear(ports, settings, shared): + shared.cache.erase_lib(get_lib_name(settings)) + + +def process_dependencies(settings): + settings.USE_SDL = 3 + + +def show(): + return 'sdl3_mixer (-sUSE_SDL_MIXER=3 or --use-port=sdl3_mixer; zlib license)' \ No newline at end of file From 3bae82e6f09b3a1fcb86173939db121a15a411d0 Mon Sep 17 00:00:00 2001 From: onesixromcom <16732145+onesixromcom@users.noreply.github.com> Date: Sat, 28 Mar 2026 15:28:03 +0200 Subject: [PATCH 3/7] Tests for sdl3_mixer --- test/browser/test_sdl3_mixer_wav.c | 79 ++++++++++++++++++++++++++++++ test/test_browser.py | 6 +++ test/test_other.py | 4 ++ 3 files changed, 89 insertions(+) create mode 100644 test/browser/test_sdl3_mixer_wav.c diff --git a/test/browser/test_sdl3_mixer_wav.c b/test/browser/test_sdl3_mixer_wav.c new file mode 100644 index 0000000000000..d0c8b87602d1d --- /dev/null +++ b/test/browser/test_sdl3_mixer_wav.c @@ -0,0 +1,79 @@ +/* + * Copyright 2025 The Emscripten Authors. All rights reserved. + * Emscripten is available under two separate licenses, the MIT license and the + * University of Illinois/NCSA Open Source License. Both these licenses can be + * found in the LICENSE file. + */ + +#include +#include +#include +#include +#include + +SDL_Window *window = NULL; +SDL_Renderer *renderer = NULL; +MIX_Audio *audio = NULL; +MIX_Track *track = NULL; +MIX_Mixer *mixer = NULL; + +#define WIDTH 640 +#define HEIGHT 480 + +#define WAV_PATH "/sound.wav" + +void sound_loop_then_quit() { + if (MIX_TrackPlaying(track)) + return; + + MIX_DestroyAudio(audio); + MIX_DestroyTrack(track); + MIX_DestroyMixer(mixer); + + emscripten_cancel_main_loop(); + printf("Shutting down\n"); + exit(0); +} + +int main(int argc, char *argv[]) { + SDL_Init(SDL_INIT_VIDEO); + + if (!MIX_Init()) { + printf("MIX_Init failed: %s\n", SDL_GetError()); + return 1; + } + + if (!SDL_CreateWindowAndRenderer("SDL3 MIXER", WIDTH, HEIGHT, 0, &window, &renderer)) { + printf("SDL_CreateWindowAndRenderer: %s\n", SDL_GetError()); + return 1; + } + + mixer = MIX_CreateMixerDevice(SDL_AUDIO_DEVICE_DEFAULT_PLAYBACK, NULL); + if (!mixer) { + printf("Couldn't create mixer on default device: %s", SDL_GetError()); + return 1; + } + + audio = MIX_LoadAudio(mixer, WAV_PATH, false); + if (!audio) { + printf("MIX_LoadAudio: %s\n", SDL_GetError()); + return 1; + } + + track = MIX_CreateTrack(mixer); + if (!track) { + printf("MIX_CreateTrack: %s\n", SDL_GetError()); + return 1; + } + + MIX_SetTrackAudio(track, audio); + SDL_PropertiesID props = SDL_CreateProperties(); + SDL_SetNumberProperty(props, MIX_PROP_PLAY_LOOPS_NUMBER, 0); + + printf("Starting sound play loop\n"); + MIX_PlayTrack(track, props); + + emscripten_set_main_loop(sound_loop_then_quit, 0, 1); + + return 0; +} diff --git a/test/test_browser.py b/test/test_browser.py index 6c6a33e1b1c76..43c868cc31347 100644 --- a/test/test_browser.py +++ b/test/test_browser.py @@ -3201,6 +3201,12 @@ def test_sdl3_canvas_write(self): self.cflags.append('-Wno-experimental') self.btest_exit('test_sdl3_canvas_write.c', cflags=['-sUSE_SDL=3']) + @requires_sound_hardware + def test_sdl3_mixer_wav(self): + copy_asset('sounds/the_entertainer.wav', 'sound.wav') + self.cflags.append('-Wno-experimental') + self.btest_exit('test_sdl3_mixer_wav.c', cflags=['-sUSE_SDL=3', '-sUSE_SDL_MIXER=3', '--preload-file', 'sound.wav']) + @requires_graphics_hardware @no_wasm64('cocos2d ports does not compile with wasm64') def test_cocos2d_hello(self): diff --git a/test/test_other.py b/test/test_other.py index f1ea94118a9b5..bcbff8ed5ac5d 100644 --- a/test/test_other.py +++ b/test/test_other.py @@ -2649,6 +2649,10 @@ def test_sdl3_ttf(self): self.emcc(test_file('browser/test_sdl3_ttf.c'), args=['-Wno-experimental', '-sUSE_SDL=3', '-sUSE_SDL_TTF=3']) self.emcc(test_file('browser/test_sdl3_ttf.c'), args=['-Wno-experimental', '--use-port=sdl3', '--use-port=sdl3_ttf']) + @requires_network + def test_sdl3_mixer(self): + self.emcc('browser/test_sdl3_mixer_wav.c', ['-Wno-experimental', '-sUSE_SDL=3', '-sUSE_SDL_MIXER=3', '-o', 'a.out.js']) + @requires_network def test_contrib_ports(self): # Verify that contrib ports can be used (using the only contrib port available ATM, but can be replaced From 317a13c6ea8956937c92fd0ece3cf6c027c25dcf Mon Sep 17 00:00:00 2001 From: onesixromcom <16732145+onesixromcom@users.noreply.github.com> Date: Sat, 28 Mar 2026 22:45:45 +0200 Subject: [PATCH 4/7] [ports] revert sdl3 update --- tools/ports/sdl3.py | 8 ++++---- tools/ports/sdl3/SDL_build_config.h | 2 -- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/tools/ports/sdl3.py b/tools/ports/sdl3.py index b41f291ac3d2c..cb743e2b2b5c2 100644 --- a/tools/ports/sdl3.py +++ b/tools/ports/sdl3.py @@ -9,9 +9,9 @@ from tools import diagnostics -VERSION = '3.4.2' +VERSION = '3.2.30' TAG = f'release-{VERSION}' -HASH = 'a17fe538993a3956e0b85fda21e7b431244e803a5facb35bb7a2bfd9ee23f1aac65838ed3225f526b81410cae7c23da7c40693c2e791385281f0764239116bce' +HASH = '80ef7b2f257f43fe47c7ea8aa0a64f1c6f23720d91065d5e9b42f0205c62fc98bcf8dd1f1834fe09c66bea2598a18a658b82212cb29810be2d2175dece0aadce' SUBDIR = f'SDL-{TAG}' variants = {'sdl3-mt': {'PTHREADS': 1}} @@ -29,7 +29,7 @@ def get(ports, settings, shared): diagnostics.warning('experimental', 'sdl3 port is still experimental') # get the port - ports.fetch_project('sdl3', f'https://github.com/libsdl-org/SDL/archive/refs/tags/{TAG}.zip', sha512hash=HASH) + ports.fetch_project('sdl3', f'https://github.com/libsdl-org/SDL/archive/{TAG}.zip', sha512hash=HASH) def create(final): root_dir = ports.get_dir('sdl3', SUBDIR) @@ -53,7 +53,7 @@ def create(final): 'atomic/*.c', 'audio/*.c', 'camera/*.c', - 'core/unix/*.c', + 'core/*.c', 'cpuinfo/*.c', 'dynapi/*.c', 'events/*.c', diff --git a/tools/ports/sdl3/SDL_build_config.h b/tools/ports/sdl3/SDL_build_config.h index 25317e19e4300..87fc5c822c3d2 100644 --- a/tools/ports/sdl3/SDL_build_config.h +++ b/tools/ports/sdl3/SDL_build_config.h @@ -47,8 +47,6 @@ #define HAVE_STRING_H 1 #define HAVE_SYS_TYPES_H 1 #define HAVE_WCHAR_H 1 -#define HAVE_GETRESGID 1 -#define HAVE_GETRESUID 1 /* #undef HAVE_PTHREAD_NP_H */ /* C library functions */ From e46710305c4dd22e5a884d0f2adc751b5aca721f Mon Sep 17 00:00:00 2001 From: onesixromcom <16732145+onesixromcom@users.noreply.github.com> Date: Sat, 28 Mar 2026 23:30:44 +0200 Subject: [PATCH 5/7] [ports] SDL3_mixer fix archive link --- tools/ports/sdl3_mixer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/ports/sdl3_mixer.py b/tools/ports/sdl3_mixer.py index 52c1fa5e4d15f..dc6ea7b87c434 100644 --- a/tools/ports/sdl3_mixer.py +++ b/tools/ports/sdl3_mixer.py @@ -26,7 +26,7 @@ def get_lib_name(settings): def get(ports, settings, shared): - ports.fetch_project('sdl3_mixer', f'https://github.com/libsdl-org/SDL_mixer/archive/refs/tags/{TAG}.zip', sha512hash=HASH) + ports.fetch_project('sdl3_mixer', f'https://github.com/libsdl-org/SDL_mixer/archive/{TAG}.zip', sha512hash=HASH) def create(final): src_root = ports.get_dir('sdl3_mixer', 'SDL_mixer-' + TAG) From bd28c37d315fa996133c5b72af3835bb98dff941 Mon Sep 17 00:00:00 2001 From: onesixromcom <16732145+onesixromcom@users.noreply.github.com> Date: Sun, 29 Mar 2026 00:49:07 +0200 Subject: [PATCH 6/7] [ports] SDL3_mixer add ogg and mp3 formats, tests updates --- src/settings.js | 4 + ...est_sdl3_mixer_wav.c => test_sdl3_mixer.c} | 6 +- test/test_browser.py | 25 +++++- test/test_other.py | 4 +- tools/ports/sdl3_mixer.py | 85 ++++++++++++++----- tools/settings.py | 1 + 6 files changed, 101 insertions(+), 24 deletions(-) rename test/browser/{test_sdl3_mixer_wav.c => test_sdl3_mixer.c} (94%) diff --git a/src/settings.js b/src/settings.js index 2aa74c60e20d1..161e0a5af332d 100644 --- a/src/settings.js +++ b/src/settings.js @@ -1580,6 +1580,10 @@ var SDL2_IMAGE_FORMATS = []; // [compile+link] var SDL2_MIXER_FORMATS = ["ogg"]; +// Formats to support in SDL3_mixer. Valid values: ogg, mp3 +// [compile+link] +var SDL3_MIXER_FORMATS = ["ogg", "mp3"]; + // 1 = use sqlite3 from emscripten-ports // Alternate syntax: --use-port=sqlite3 // [compile+link] diff --git a/test/browser/test_sdl3_mixer_wav.c b/test/browser/test_sdl3_mixer.c similarity index 94% rename from test/browser/test_sdl3_mixer_wav.c rename to test/browser/test_sdl3_mixer.c index d0c8b87602d1d..f14eca9b77f25 100644 --- a/test/browser/test_sdl3_mixer_wav.c +++ b/test/browser/test_sdl3_mixer.c @@ -20,7 +20,9 @@ MIX_Mixer *mixer = NULL; #define WIDTH 640 #define HEIGHT 480 -#define WAV_PATH "/sound.wav" +#ifndef SOUND_PATH +#error "must define SOUND_PATH" +#endif void sound_loop_then_quit() { if (MIX_TrackPlaying(track)) @@ -54,7 +56,7 @@ int main(int argc, char *argv[]) { return 1; } - audio = MIX_LoadAudio(mixer, WAV_PATH, false); + audio = MIX_LoadAudio(mixer, SOUND_PATH, false); if (!audio) { printf("MIX_LoadAudio: %s\n", SDL_GetError()); return 1; diff --git a/test/test_browser.py b/test/test_browser.py index 43c868cc31347..b36efe365ae55 100644 --- a/test/test_browser.py +++ b/test/test_browser.py @@ -3201,11 +3201,32 @@ def test_sdl3_canvas_write(self): self.cflags.append('-Wno-experimental') self.btest_exit('test_sdl3_canvas_write.c', cflags=['-sUSE_SDL=3']) + @parameterized({ + '': (['-sUSE_SDL=3', '-sUSE_SDL_MIXER=3'],), + 'dash_l': (['-lSDL3', '-lSDL3_mixer'],), + }) @requires_sound_hardware - def test_sdl3_mixer_wav(self): + def test_sdl3_mixer_wav(self, flags): copy_asset('sounds/the_entertainer.wav', 'sound.wav') self.cflags.append('-Wno-experimental') - self.btest_exit('test_sdl3_mixer_wav.c', cflags=['-sUSE_SDL=3', '-sUSE_SDL_MIXER=3', '--preload-file', 'sound.wav']) + self.btest_exit('test_sdl3_mixer.c', cflags=['--preload-file', 'sound.wav', '-DSOUND_PATH="sound.wav"'] + flags) + + @parameterized({ + 'ogg': (['ogg'], 'alarmvictory_1.ogg',), + 'mp3': (['mp3'], 'pudinha.mp3'), + }) + @requires_sound_hardware + def test_sdl3_mixer_music(self, formats, music_name): + copy_asset(f'sounds/{music_name}') + self.cflags.append('-Wno-experimental') + args = [ + '--preload-file', music_name, + '-DSOUND_PATH="%s"' % music_name, + '-sUSE_SDL=3', + '-sUSE_SDL_MIXER=3', + '-sSDL3_MIXER_FORMATS=' + ','.join(formats), + ] + self.btest_exit('test_sdl3_mixer.c', cflags=args) @requires_graphics_hardware @no_wasm64('cocos2d ports does not compile with wasm64') diff --git a/test/test_other.py b/test/test_other.py index bcbff8ed5ac5d..5fe42a127754b 100644 --- a/test/test_other.py +++ b/test/test_other.py @@ -2651,7 +2651,9 @@ def test_sdl3_ttf(self): @requires_network def test_sdl3_mixer(self): - self.emcc('browser/test_sdl3_mixer_wav.c', ['-Wno-experimental', '-sUSE_SDL=3', '-sUSE_SDL_MIXER=3', '-o', 'a.out.js']) + self.emcc('browser/test_sdl3_mixer.c', ['-Wno-experimental', '-sUSE_SDL=3', '-sUSE_SDL_MIXER=3', '-o', 'a.out.js']) + self.emcc('browser/test_sdl3_mixer.c', ['-Wno-experimental', '--use-port=sdl3_mixer', '-o', 'a.out.js']) + self.emcc('browser/test_sdl3_mixer.c', ['-Wno-experimental', '--use-port=sdl3_mixer:formats=ogg', '-o', 'a.out.js']) @requires_network def test_contrib_ports(self): diff --git a/tools/ports/sdl3_mixer.py b/tools/ports/sdl3_mixer.py index dc6ea7b87c434..aab1914106f7e 100644 --- a/tools/ports/sdl3_mixer.py +++ b/tools/ports/sdl3_mixer.py @@ -14,19 +14,49 @@ deps = ['sdl3'] -variants = {'sdl3_mixer-mt': {'PTHREADS': 1}} +variants = { + 'sdl3_mixer-ogg': {'SDL3_MIXER_FORMATS': ['ogg']}, + 'sdl3_mixer-none': {'SDL3_MIXER_FORMATS': []}, + 'sdl3_mixer-ogg-mt': {'SDL3_MIXER_FORMATS': ['ogg'], 'PTHREADS': 1}, + 'sdl3_mixer-none-mt': {'SDL3_MIXER_FORMATS': [], 'PTHREADS': 1}, +} + +OPTIONS = { + 'formats': 'A comma separated list of formats (ex: --use-port=sdl3_mixer:formats=ogg,mp3)', +} + +SUPPORTED_FORMATS = {'ogg', 'mp3'} + +# user options (from --use-port) +opts: dict[str, set] = { + 'formats': set(), +} def needed(settings): return settings.USE_SDL_MIXER == 3 +def get_formats(settings): + return opts['formats'].union(settings.SDL3_MIXER_FORMATS) + + def get_lib_name(settings): - return 'libSDL3_mixer' + ('-mt' if settings.PTHREADS else '') + '.a' + formats = '-'.join(sorted(get_formats(settings))) + + libname = 'libSDL3_mixer' + if formats != '': + libname += '-' + formats + if settings.PTHREADS: + libname += '-mt' + libname += '.a' + + return libname def get(ports, settings, shared): ports.fetch_project('sdl3_mixer', f'https://github.com/libsdl-org/SDL_mixer/archive/{TAG}.zip', sha512hash=HASH) + libname = get_lib_name(settings) def create(final): src_root = ports.get_dir('sdl3_mixer', 'SDL_mixer-' + TAG) @@ -35,24 +65,9 @@ def create(final): "src/SDL_mixer.c", "src/SDL_mixer_metadata_tags.c", "src/SDL_mixer_spatialization.c", - "src/decoder_aiff.c", - "src/decoder_au.c", - "src/decoder_drflac.c", - "src/decoder_drmp3.c", - "src/decoder_flac.c", - "src/decoder_fluidsynth.c", - "src/decoder_gme.c", - "src/decoder_mpg123.c", - "src/decoder_opus.c", "src/decoder_raw.c", "src/decoder_sinewave.c", - "src/decoder_stb_vorbis.c", - "src/decoder_timidity.c", - "src/decoder_voc.c", - "src/decoder_vorbis.c", "src/decoder_wav.c", - "src/decoder_wavpack.c", - "src/decoder_xmp.c", ] flags = ['-sUSE_SDL=3', '-DDECODER_WAV','-Wno-format-security', '-Wno-experimental'] @@ -60,9 +75,24 @@ def create(final): if settings.PTHREADS: flags += ['-pthread'] - ports.build_port(src_root, final, 'sdl3_mixer', flags=flags, srcs=srcs) + formats = get_formats(settings) + + if "ogg" in formats: + flags += [ + '-sUSE_VORBIS', + '-DDECODER_OGGVORBIS_VORBISFILE', + ] + srcs += ["src/decoder_vorbis.c",] - return [shared.cache.get_lib(get_lib_name(settings), create, what='port')] + if "mp3" in formats: + flags += [ + '-sUSE_MPG123', + '-DDECODER_MP3_MPG123', + ] + srcs += ["src/decoder_mpg123.c",] + + ports.build_port(src_root, final, 'sdl3_mixer', flags=flags, srcs=srcs) + return [shared.cache.get_lib(libname, create, what='port')] def clear(ports, settings, shared): @@ -71,6 +101,23 @@ def clear(ports, settings, shared): def process_dependencies(settings): settings.USE_SDL = 3 + formats = get_formats(settings) + if "ogg" in formats: + deps.append('vorbis') + settings.USE_VORBIS = 1 + if "mp3" in formats: + deps.append('mpg123') + settings.USE_MPG123 = 1 + + +def handle_options(options, error_handler): + formats = options['formats'].split(',') + for format in formats: + format = format.lower().strip() + if format not in SUPPORTED_FORMATS: + error_handler(f'{format} is not a supported format') + else: + opts['formats'].add(format) def show(): diff --git a/tools/settings.py b/tools/settings.py index 7032b99b86552..0e8959efe6112 100644 --- a/tools/settings.py +++ b/tools/settings.py @@ -53,6 +53,7 @@ 'USE_FREETYPE', 'SDL2_MIXER_FORMATS', 'SDL2_IMAGE_FORMATS', + 'SDL3_MIXER_FORMATS', 'USE_SQLITE3', } From 17affb5950a99f9b381b18dcd82e4b8d9f838ecf Mon Sep 17 00:00:00 2001 From: onesixromcom <16732145+onesixromcom@users.noreply.github.com> Date: Sun, 29 Mar 2026 01:09:51 +0200 Subject: [PATCH 7/7] [ports] SDL3_mixer fix other tests --- test/test_other.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/test_other.py b/test/test_other.py index 5fe42a127754b..248cfe73658c0 100644 --- a/test/test_other.py +++ b/test/test_other.py @@ -2651,9 +2651,9 @@ def test_sdl3_ttf(self): @requires_network def test_sdl3_mixer(self): - self.emcc('browser/test_sdl3_mixer.c', ['-Wno-experimental', '-sUSE_SDL=3', '-sUSE_SDL_MIXER=3', '-o', 'a.out.js']) - self.emcc('browser/test_sdl3_mixer.c', ['-Wno-experimental', '--use-port=sdl3_mixer', '-o', 'a.out.js']) - self.emcc('browser/test_sdl3_mixer.c', ['-Wno-experimental', '--use-port=sdl3_mixer:formats=ogg', '-o', 'a.out.js']) + self.emcc('browser/test_sdl3_mixer.c', ['-Wno-experimental', '-DSOUND_PATH="sound.wav"', '-sUSE_SDL=3', '-sUSE_SDL_MIXER=3', '-o', 'a.out.js']) + self.emcc('browser/test_sdl3_mixer.c', ['-Wno-experimental', '-DSOUND_PATH="sound.wav"', '--use-port=sdl3_mixer', '-o', 'a.out.js']) + self.emcc('browser/test_sdl3_mixer.c', ['-Wno-experimental', '-DSOUND_PATH="sound.wav"', '--use-port=sdl3_mixer:formats=ogg', '-o', 'a.out.js']) @requires_network def test_contrib_ports(self):