Support formats option in sdl2 mixer#24158
Conversation
sbc100
left a comment
There was a problem hiding this comment.
Can you add a test for this?
Perhaps another test alongside test_sdl2_mixer_wav in test_other.py
tools/ports/sdl2_mixer.py
Outdated
|
|
||
|
|
||
| def get_formats(settings): | ||
| return set(settings.SDL2_MIXER_FORMATS).union(opts['formats']) |
There was a problem hiding this comment.
I think you can just write this as opts['formats'].union(settings.SDL2_MIXER_FORMATS) (i.e. union can take a list)
There was a problem hiding this comment.
Thanks. I changed it to opts['formats'].union(settings.SDL2_MIXER_FORMATS) (and update the similar code in sdl2_image as well).
|
I added some tests, but it seems like FROZEN_CACHE is not happy with sdl2_mixer variants, hmm... |
.circleci/config.yml
Outdated
| # There are tests that using libraries | ||
| # that are not included by "./embuilder build ALL". For example the | ||
| # different variant of libSDL2_mixer is used by test_sdl2_mixer_wav | ||
| frozen_cache: false |
There was a problem hiding this comment.
Better not to do this. Instead you can add the variant you are testing the variants list in sdl2_mixer.py.
There was a problem hiding this comment.
Thanks I removed this and used ogg format for a test case.
| def test_sdl2_mixer_wav(self): | ||
| self.emcc(test_file('browser/test_sdl2_mixer_wav.c'), ['-sUSE_SDL_MIXER=2'], output_filename='a.out.js') | ||
| self.emcc(test_file('browser/test_sdl2_mixer_wav.c'), ['--use-port=sdl2_mixer'], output_filename='a.out.js') | ||
| self.emcc(test_file('browser/test_sdl2_mixer_wav.c'), ['--use-port=sdl2_mixer:formats=ogg'], output_filename='a.out.js') |
There was a problem hiding this comment.
How does this test (which plays a wav file) work if only ogg is selected? Is this because wav is simply always available maybe?
There was a problem hiding this comment.
Yeah, I think so. wav is already available:
emscripten/tools/ports/sdl2_mixer.py
Lines 44 to 47 in 2328a81
This PR adds
handle_optionsfunction in the SDL2_mixer port so one can build SDL2_mixer with specific formats with embuilder, such asI found this syntax was added in #21345, but it was only applied to SDL2_image.