Skip to content

Commit 468174a

Browse files
authored
SDL2_mixer: add support for MID (#16556)
Enable SDL2_mixer to use timidity to provide MIDI support. To use, you must provide your own sound files. I sourced mine from https://www.npmjs.com/package/freepats And mount them here: --preload-file="../freepats@/etc/timidity" (that's the default place timidity will look for configuration)
1 parent 55e38d8 commit 468174a

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

src/settings.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1457,7 +1457,7 @@ var USE_MODPLUG = false;
14571457
// [link]
14581458
var SDL2_IMAGE_FORMATS = [];
14591459

1460-
// Formats to support in SDL2_mixer. Valid values: ogg, mp3
1460+
// Formats to support in SDL2_mixer. Valid values: ogg, mp3, mod, mid
14611461
// [link]
14621462
var SDL2_MIXER_FORMATS = ["ogg"];
14631463

tests/test_browser.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3275,6 +3275,8 @@ def test_sdl2_mixer_wav(self, flags):
32753275
'ogg': (['ogg'], 'MIX_INIT_OGG', 'alarmvictory_1.ogg'),
32763276
'mp3': (['mp3'], 'MIX_INIT_MP3', 'pudinha.mp3'),
32773277
'mod': (['mod'], 'MIX_INIT_MOD', 'bleep.xm'),
3278+
# TODO: need to source freepats.cfg and a midi file
3279+
# 'mod': (['mid'], 'MIX_INIT_MID', 'midi.mid'),
32783280
})
32793281
@requires_sound_hardware
32803282
def test_sdl2_mixer_music(self, formats, flags, music_name):

tools/ports/sdl2_mixer.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,11 @@ def create(final):
6363
'-DMUSIC_MOD_MODPLUG',
6464
]
6565

66+
if "mid" in settings.SDL2_MIXER_FORMATS:
67+
flags += [
68+
'-DMUSIC_MID_TIMIDITY',
69+
]
70+
6671
ports.build_port(
6772
dest_path,
6873
final,
@@ -74,7 +79,6 @@ def create(final):
7479
],
7580
exclude_dirs=[
7681
'native_midi',
77-
'timidity',
7882
'external',
7983
]
8084
)

0 commit comments

Comments
 (0)