-
Notifications
You must be signed in to change notification settings - Fork 3.5k
[ports] SDL3_mixer 3.2.0 #26571
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
onesixromcom
wants to merge
12
commits into
emscripten-core:main
Choose a base branch
from
onesixromcom:sdl3-mixer-port
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
[ports] SDL3_mixer 3.2.0 #26571
Changes from 3 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
59372d4
Update SDL3 to latest 3.4.2 version
onesixromcom 33906c8
Simple SDL3_mixer port implementation
onesixromcom 3bae82e
Tests for sdl3_mixer
onesixromcom 317a13c
[ports] revert sdl3 update
onesixromcom e467103
[ports] SDL3_mixer fix archive link
onesixromcom bd28c37
[ports] SDL3_mixer add ogg and mp3 formats, tests updates
onesixromcom 17affb5
[ports] SDL3_mixer fix other tests
onesixromcom f787d0c
Merge branch 'main' into sdl3-mixer-port
onesixromcom 320a752
Changelog updates
onesixromcom 4c549ea
[ports] SDL3_mixer codestyle fixes
onesixromcom 3835624
Merge branch 'main' into sdl3-mixer-port
onesixromcom 2fcdbc8
[ports] SDL3_mixer codestyle fixes
onesixromcom File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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 <stdio.h> | ||
| #include <SDL3/SDL.h> | ||
| #include <SDL3/SDL_main.h> | ||
| #include <SDL3_mixer/SDL_mixer.h> | ||
| #include <emscripten.h> | ||
|
|
||
| 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; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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 | ||
|
onesixromcom marked this conversation as resolved.
Outdated
|
||
|
|
||
| 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", | ||
|
onesixromcom marked this conversation as resolved.
Outdated
|
||
| ] | ||
|
|
||
| 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)' | ||
|
onesixromcom marked this conversation as resolved.
Outdated
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.