An audio mixer that supports various file formats for Simple Directmedia Layer.

Overview
SDL_mixer 2.0

The latest version of this library is available from:
http://www.libsdl.org/projects/SDL_mixer/

Due to popular demand, here is a simple multi-channel audio mixer.
It supports 8 channels of 16 bit stereo audio, plus a single channel
of music.

See the header file SDL_mixer.h and the examples playwave.c and playmus.c
for documentation on this mixer library.

The mixer can currently load Microsoft WAVE files and Creative Labs VOC
files as audio samples, it can load FLAC files with libFLAC, it can load
Ogg Vorbis files with Ogg Vorbis or Tremor libraries, it can load MP3 files
using mpg123 or libmad, and it can load MIDI files with Timidity,
FluidSynth, and natively on Windows, Mac OSX, and Linux, and finally it can
load the following file formats via ModPlug or MikMod: .MOD .S3M .IT .XM.

Tremor decoding is disabled by default; you can enable it by passing
	--enable-music-ogg-tremor
to configure, or by defining MUSIC_OGG and OGG_USE_TREMOR.

libmad decoding is disabled by default; you can enable it by passing
	--enable-music-mp3-mad
to configure, or by defining MUSIC_MP3_MAD
vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
WARNING: The license for libmad is GPL, which means that in order to
         use it your application must also be GPL!
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

The process of mixing MIDI files to wave output is very CPU intensive,
so if playing regular WAVE files sound great, but playing MIDI files
sound choppy, try using 8-bit audio, mono audio, or lower frequencies.

To play MIDI files using FluidSynth, you'll need to set the SDL_SOUNDFONTS
environment variable to a Sound Font 2 (.sf2) file containing the musical
instruments you want to use for MIDI playback.
(On some Linux distributions you can install the fluid-soundfont-gm package)

To play MIDI files using Timidity, you'll need to get a complete set of
GUS patches from:
http://www.libsdl.org/projects/mixer/timidity/timidity.tar.gz
and unpack them in /usr/local/lib under UNIX, and C:\ under Win32.

iOS:
In order to use this library on iOS, you should include the SDL.xcodeproj
and Xcode-iOS/SDL_mixer.xcodeproj in your application, add the SDL/include
and SDL_mixer directories to your "Header Search Paths" setting, then add the
libSDL2.a and libSDL2_mixer.a to your "Link Binary with Libraries" setting.

This library is under the zlib license, see the file "COPYING.txt" for details.

Comments
  • Android build with SDL2MIXER_FLAC=ON can't find libFLAC.so

    Android build with SDL2MIXER_FLAC=ON can't find libFLAC.so

    The build can't find libFLAC.so with SDL2MIXER_FLAC=ON on an Android build, causing the build to fail:

    $ ./gradlew build
    
    ...
    
    > Task :buildCMakeDebug FAILED
    
    FAILURE: Build failed with an exception.
    
    * What went wrong:
    Execution failed for task ':buildCMakeDebug'.
    > Expected output file at /project-name/android/build/intermediates/cxx/Debug/6w2m3w14/obj/arm64-v8a/libFLAC.so for target FLAC but there was none
    
    ...
    

    CMakeLists.txt:

    cmake_minimum_required( VERSION 3.18.0 )
    cmake_policy( SET CMP0091 NEW )
    project( appname )
    
    set( SDL_LIBC ON CACHE BOOL "" FORCE )
    set( SDL_TEST OFF CACHE BOOL "" FORCE )
    # https://github.com/libsdl-org/SDL.git
    # release-2.24.1
    add_subdirectory( external/sdl )
    
    set( BUILD_SHARED_LIBS OFF CACHE BOOL "" FORCE )
    set( SDL2MIXER_FLAC ON CACHE BOOL "" FORCE )
    set( SDL2MIXER_OPUS OFF CACHE BOOL "" FORCE )
    set( SDL2MIXER_SAMPLES OFF CACHE BOOL "" FORCE )
    set( SDL2MIXER_VENDORED ON CACHE BOOL "" FORCE )
    # https://github.com/libsdl-org/SDL_mixer.git
    # HEAD of 'main' branch as of today: db9da3d416077195a2f84403b2fb40955518b4ab
    add_subdirectory( external/sdl-mixer )
    
    set( SRCS "src/main.cpp" )
    
    set( LIBS
        SDL2::SDL2main
        SDL2::SDL2-static
        SDL2_mixer::SDL2_mixer-static
        )
    
    if( ${CMAKE_SYSTEM_NAME} MATCHES "Android")
        add_library( main SHARED ${SRCS} )
        target_link_libraries( main ${LIBS} )
    else()
        add_executable( ${CMAKE_PROJECT_NAME} ${SRCS} )
        target_link_libraries( ${CMAKE_PROJECT_NAME} ${LIBS} )
    endif()
    

    src/main.cpp:

    #include <SDL.h>
    #include <SDL_mixer.h>
    
    int main( int argc, char** argv )
    {
        SDL_Init( SDL_INIT_EVERYTHING );
        SDL_Quit();
        return 0;
    }
    

    The same CMakeLists.txt builds successfully with SDL2MIXER_FLAC=OFF, as well as on the host Debian 11 system with:

    cmake -B build -G "Ninja Multi-Config" .
    cmake --build build --config Release --parallel $(nproc)
    
    opened by genpfault 22
  • Rebase and update stb_vorbis.h to SDL_sound's version :

    Rebase and update stb_vorbis.h to SDL_sound's version :

    • Keeps the original stb_vorbis as intact as possible so that future updates from mainstream would be painless.
    • Reduces STB_VORBIS_MAX_CHANNELS from 16 to 6 (objections?)
    • Adds several missing libm function overrides,
    • SDL_mixer now requires SDL >= 2.0.9 because of SDL_exp()
    • Fixes slow loads and leaks in start_decoder: https://github.com/nothings/stb/pull/1174
    • Fixes submap array out-of-bounds indexing bug: https://github.com/nothings/stb/pull/1312
    • Replace signed overflow clamps with unsigned overflow: https://github.com/nothings/stb/issues/1168
    • Replaces alloca() usage with setup_malloc() (from libxmp.)
    • Fixes '-Wmaybe-uninitialized' warnings in get_seek_page_info: https://github.com/nothings/stb/pull/1172
    • A minor UBSan fix and suppression: https://github.com/nothings/stb/issues/1168
    • Fixes signature of dummy realloc() for STB_VORBIS_NO_CRT: https://github.com/nothings/stb/pull/1198
    • Renames BUFFER_SIZE macro to STB_BUFFER_SIZE: https://github.com/nothings/stb/pull/1078
    • Pulls in sample-accurate offset patch of Vitaly Novichkov: (stb_vorbis_get_playback_sample_offset, because it's used in OGG_Tell and OGG_GetSome): https://github.com/nothings/stb/issues/1294 https://github.com/nothings/stb/pull/1295
    • Fixes a few warnings here and there in some environments.
    • Replaces two dummy '(void) 0' with 'do {} while(0)'
    opened by sezero 22
  • Use after free bug in Mixer's `OPUS_Delete()` on macOS

    Use after free bug in Mixer's `OPUS_Delete()` on macOS

    There's some background on this issue in the rust-sdl2 project. It seems that on the Mac while Wave files work happily if mixer is unload before the music file is but Opus causes a SEGFAULT.

    Digging deeper, it turns out that there isn't a proper guard in OPUS_Delete to make sure that the Opus library is still loaded.

    The fix seems to be to make sure "opus.loaded" is greater than zero before calling opus.op_free().

    Does this seem reasonable? Also, I noticed that you can leak the Opus libraries if calling OPUS_Load() more than once.

    If this does make sense, I'm happy to write a merge request here. It seems like @Wohlstand would be a good mentor for this if they're willing to help me out.

    invalid 
    opened by RandomInsano 21
  • MOD, native MIDI, and Opus support removed from macOS binaries?

    MOD, native MIDI, and Opus support removed from macOS binaries?

    Hi all,

    This is essentially the same as my issue for SDL_image (https://github.com/libsdl-org/SDL_image/issues/288). Basically, native MIDI as well as decoders for Modplug and Opus have been removed from the official macOS binaries, while they are all still enabled/included (albeit in an "optional" folder) for the Windows binaries.

    I understand making various dependency libraries optional, but is there a way to have pre-built optional dependencies included for the macOS release, the same way they are for Windows? A folder of pre-built frameworks that can be dragged inside the mixer framework or into the same folder as the framework?

    Thanks in advance!

    Austin

    opened by a-hurst 20
  • Fixes of the master_volume behaviour

    Fixes of the master_volume behaviour

    • Make the master_volume variable being atomic
    • Fixed the master_volume behavior at the music (there a middle buffer should be allocated to safely apply the volume effect)

    Bonus: whitespace clean-up at the mixer.c.

    opened by Wohlstand 19
  • Added support of quoted strings in Timidity config

    Added support of quoted strings in Timidity config

    Resolves #334

    An argument of property in Timidity config can be surrounded with " or ' characters to prevent splitting into several arguments if it contains spaces or other delimiter characters.

    If an argument itself contains " characters it should be surrounded with ' characters and vice versa.

    opened by Dasperal 18
  • Release plans

    Release plans

    As far as I can tell, the last release was 2018 and there have been > 300 commits since then. Any chance for a new release? Or perhaps there are blockers for that?

    opened by fingolfin 15
  • Add 'Libs.private' field to pkg-config file

    Add 'Libs.private' field to pkg-config file

    In order to support static linking, SDL_mixer.pc should include a 'Libs.private' field listing all the libraries that SDL_mixer requires.

    This patch adds such a field and also modifies configure.ac so that EXTRA_LDFLAGS (which is now also used as the value of 'Libs.private') no longer includes SDL_LIBS. This is done so as to prevent libraries required by SDL from being listed twice when 'pkg-config --libs --static SDL_mixer' is run (they're already shown because of the 'Requires: sdl' line in SDL_mixer.pc). Makefile.in is also adjusted accordingly.

    Upstream status: submitted https://bugzilla.libsdl.org/show_bug.cgi?id=3278

    Signed-off-by: Rodrigo Rebello [email protected] [Retrieved from: https://git.buildroot.net/buildroot/tree/package/sdl_mixer/0001-Add-Libs.private-field-to-pkg-config-file.patch] Signed-off-by: Fabrice Fontaine [email protected]

    opened by ffontaine 15
  • CMake support for libxmp?

    CMake support for libxmp?

    The current CI fails because libxmp is missing vendored library CMake support: https://github.com/libsdl-org/SDL_mixer/runs/7365768492?check_suite_focus=true

    Maybe we don't need it? It's provided for Visual Studio in VisualC/external

    What's the best way to fix this?

    opened by slouken 14
  • VCRUNTIME140.dll dependency in SDL2_mixer.dll

    VCRUNTIME140.dll dependency in SDL2_mixer.dll

    due to the compiler option /MD and the use of memcpy and memset, including SDL2_mixer.dll will create a dependency on the visual studio run time DLLs, which isn't desirable. Either use SDL_memset / SDL_memcpy or /MT instead of /MD.

    opened by AntTheAlchemist 14
  • wrong mp3 duration with libmad backend

    wrong mp3 duration with libmad backend

    One mp3 I have reports 56.607347s duration instead of about 31.320816s with libmad backend: I can attach the mp3 in question here.

    Originally posted in https://github.com/libsdl-org/SDL_mixer/issues/300#issuecomment-1140079544

    opened by sezero 14
  • Failure to static link.

    Failure to static link.

    When fixing the sdl2-mixer static builds on vcpkg, I noticed a few issues when trying to link the library. The same issues were noticed when building release-2.6.2 from source.

    Configuration was done as follows:

    cmake -S<src> -Bbuild -G Ninja -DCMAKE_BUILD_TYPE=Release
    -DCMAKE_OSX_ARCHITECTURES=arm64
    -DCMAKE_SYSTEM_NAME=Darwin
    -DBUILD_SHARED_LIBS=OFF
    -DSDL2MIXER_DEPS_SHARED=0
    -DSDL2MIXER_VENDORED=OFF
    -DSDL2MIXER_SAMPLES=OFF
    -DSDL2MIXER_MIDI_FLUIDSYNTH=ON
    -DSDL2MIXER_MIDI_NATIVE=ON
    -DSDL2MIXER_FLAC_LIBFLAC=ON
    -DSDL2MIXER_FLAC_DRFLAC=OFF
    -DSDL2MIXER_MOD=ON
    -DSDL2MIXER_MOD_MODPLUG=ON
    -DSDL2MIXER_VORBIS=VORBISFILE
    -DSDL2MIXER_VORBIS_VORBISFILE=ON
    -DSDL2MIXER_MP3_MPG123=ON
    -DSDL2MIXER_MP3_DRMP3=OFF
    -DSDL2MIXER_OPUS=ON
    

    My test project CMakeLists is as follows:

    cmake_minimum_required(VERSION 3.0.0)
    project(mixer-example VERSION 0.1.0 LANGUAGES C CXX)
    
    add_executable(mixer-example main.cpp)
    
    find_package(SDL2 CONFIG REQUIRED)
    find_package(SDL2_mixer CONFIG REQUIRED)
    target_link_libraries(mixer-example PRIVATE SDL2_mixer::SDL2_mixer-static SDL2::SDL2main SDL2::SDL2-static)
    

    And the main.cpp file is just a simple hello world that initialises SDL_mixer:

    #include <SDL.h>
    #include <SDL_mixer.h>
    
    int main(int, char**) {
      if (SDL_Init(SDL_INIT_AUDIO) < 0) {
        SDL_Log("Failed SDL_Init: %s\n", SDL_GetError());
        return 1;
      }
    
      constexpr int MIXER_FLAGS = MIX_INIT_FLAC | MIX_INIT_MID | MIX_INIT_MOD | MIX_INIT_MP3 | MIX_INIT_OGG | MIX_INIT_OPUS;
      if (Mix_Init(MIXER_FLAGS) != MIXER_FLAGS) {
        SDL_Log("Failed Mix_Init: %s\n", Mix_GetError());
        SDL_Quit();
        return 1;
      }
    
      Mix_Quit();
      SDL_Quit();
      return 0;
    }
    

    The first issue with this configuration is linking libFLAC, the LINK_LIBRARIES is:

    vcpkg_installed/arm64-osx/debug/lib/libSDL2maind.a
    vcpkg_installed/arm64-osx/debug/lib/libSDL2d.a
    vcpkg_installed/arm64-osx/debug/lib/libSDL2_mixerd.a
    -lm  -liconv  -Wl,-framework,CoreVideo  -Wl,-framework,Cocoa  -Wl,-framework,IOKit  -Wl,-framework,ForceFeedback  -Wl,-framework,Carbon  -Wl,-framework,CoreAudio  -Wl,-framework,AudioToolbox  -Wl,-framework,AVFoundation  -Wl,-framework,Foundation  -Wl,-weak_framework,GameController  -Wl,-weak_framework,Metal  -Wl,-weak_framework,QuartzCore  -Wl,-weak_framework,CoreHaptics  
    -lFLAC
    vcpkg_installed/arm64-osx/debug/lib/libmodplug.a
    vcpkg_installed/arm64-osx/debug/lib/libmpg123.a
    vcpkg_installed/arm64-osx/debug/lib/libfluidsynth.a
    

    Failing with:

    ld: library not found for -lFLAC
    

    Manually replacing -lFLAC with vcpkg_installed/arm64-osx/debug/lib/libFLAC.a fixes this issue, but now returns undefined references for fluidsynth and FLAC. It seems to be lacking glib, openmp (for fluidsynth), and libogg (for FLAC).

    Here is the details of the error
    [build] Undefined symbols for architecture arm64:
    [build]   "___kmpc_barrier", referenced from:
    [build]       _.omp_outlined._debug__ in libfluidsynth.a(fluid_defsfont.c.o)
    [build]   "___kmpc_critical", referenced from:
    [build]       _.omp_task_entry. in libfluidsynth.a(fluid_defsfont.c.o)
    [build]       _.omp_task_entry..10 in libfluidsynth.a(fluid_defsfont.c.o)
    [build]   "___kmpc_end_critical", referenced from:
    [build]       _.omp_task_entry. in libfluidsynth.a(fluid_defsfont.c.o)
    [build]       _.omp_task_entry..10 in libfluidsynth.a(fluid_defsfont.c.o)
    [build]   "___kmpc_end_single", referenced from:
    [build]       _.omp_outlined._debug__ in libfluidsynth.a(fluid_defsfont.c.o)
    [build]   "___kmpc_fork_call", referenced from:
    [build]       _fluid_defsfont_load_all_sampledata in libfluidsynth.a(fluid_defsfont.c.o)
    [build]   "___kmpc_omp_task", referenced from:
    [build]       _.omp_outlined._debug__ in libfluidsynth.a(fluid_defsfont.c.o)
    [build]   "___kmpc_omp_task_alloc", referenced from:
    [build]       _.omp_outlined._debug__ in libfluidsynth.a(fluid_defsfont.c.o)
    [build]   "___kmpc_single", referenced from:
    [build]       _.omp_outlined._debug__ in libfluidsynth.a(fluid_defsfont.c.o)
    [build]   "_g_assertion_message_expr", referenced from:
    [build]       _delete_fluid_num_setting in libfluidsynth.a(fluid_settings.c.o)
    [build]       _delete_fluid_int_setting in libfluidsynth.a(fluid_settings.c.o)
    [build]       _delete_fluid_str_setting in libfluidsynth.a(fluid_settings.c.o)
    [build]       _delete_fluid_set_setting in libfluidsynth.a(fluid_settings.c.o)
    [build]       _fluid_align_ptr in libfluidsynth.a(fluid_rvoice_mixer.c.o)
    [build]       _fluid_rvoice_buffers_mix in libfluidsynth.a(fluid_rvoice_mixer.c.o)
    [build]   "_g_clear_error", referenced from:
    [build]       _new_fluid_thread in libfluidsynth.a(fluid_sys.c.o)
    [build]   "_g_cond_broadcast", referenced from:
    [build]       _delete_rvoice_mixer_threads in libfluidsynth.a(fluid_rvoice_mixer.c.o)
    [build]       _fluid_render_loop_multithread in libfluidsynth.a(fluid_rvoice_mixer.c.o)
    [build]   "_g_cond_clear", referenced from:
    [build]       _delete_fluid_cond in libfluidsynth.a(fluid_rvoice_mixer.c.o)
    [build]   "_g_cond_init", referenced from:
    [build]       _new_fluid_cond in libfluidsynth.a(fluid_rvoice_mixer.c.o)
    [build]   "_g_cond_signal", referenced from:
    [build]       _fluid_mixer_thread_func in libfluidsynth.a(fluid_rvoice_mixer.c.o)
    [build]   "_g_cond_wait", referenced from:
    [build]       _fluid_mixer_thread_func in libfluidsynth.a(fluid_rvoice_mixer.c.o)
    [build]       _fluid_render_loop_multithread in libfluidsynth.a(fluid_rvoice_mixer.c.o)
    [build]   "_g_file_test", referenced from:
    [build]       _fluid_file_open in libfluidsynth.a(fluid_sys.c.o)
    [build]   "_g_free", referenced from:
    [build]       _delete_fluid_cond in libfluidsynth.a(fluid_rvoice_mixer.c.o)
    [build]       _delete_fluid_cond_mutex in libfluidsynth.a(fluid_rvoice_mixer.c.o)
    [build]   "_g_get_monotonic_time", referenced from:
    [build]       _fluid_utime in libfluidsynth.a(fluid_sys.c.o)
    [build]   "_g_malloc_n", referenced from:
    [build]       _new_fluid_cond in libfluidsynth.a(fluid_rvoice_mixer.c.o)
    [build]       _new_fluid_cond_mutex in libfluidsynth.a(fluid_rvoice_mixer.c.o)
    [build]   "_g_mutex_clear", referenced from:
    [build]       _delete_fluid_cond_mutex in libfluidsynth.a(fluid_rvoice_mixer.c.o)
    [build]       _delete_fluid_midi_router in libfluidsynth.a(fluid_midi_router.c.o)
    [build]   "_g_mutex_init", referenced from:
    [build]       _new_fluid_cond_mutex in libfluidsynth.a(fluid_rvoice_mixer.c.o)
    [build]       _new_fluid_server2 in libfluidsynth.a(fluid_cmd.c.o)
    [build]       _new_fluid_midi_router in libfluidsynth.a(fluid_midi_router.c.o)
    [build]   "_g_mutex_lock", referenced from:
    [build]       _delete_rvoice_mixer_threads in libfluidsynth.a(fluid_rvoice_mixer.c.o)
    [build]       _fluid_mixer_thread_func in libfluidsynth.a(fluid_rvoice_mixer.c.o)
    [build]       _fluid_render_loop_multithread in libfluidsynth.a(fluid_rvoice_mixer.c.o)
    [build]       _fluid_server_add_client in libfluidsynth.a(fluid_cmd.c.o)
    [build]       _fluid_server_remove_client in libfluidsynth.a(fluid_cmd.c.o)
    [build]       _fluid_server_close in libfluidsynth.a(fluid_cmd.c.o)
    [build]       _fluid_midi_router_set_default_rules in libfluidsynth.a(fluid_midi_router.c.o)
    [build]       ...
    [build]   "_g_mutex_unlock", referenced from:
    [build]       _delete_rvoice_mixer_threads in libfluidsynth.a(fluid_rvoice_mixer.c.o)
    [build]       _fluid_mixer_thread_func in libfluidsynth.a(fluid_rvoice_mixer.c.o)
    [build]       _fluid_render_loop_multithread in libfluidsynth.a(fluid_rvoice_mixer.c.o)
    [build]       _fluid_server_add_client in libfluidsynth.a(fluid_cmd.c.o)
    [build]       _fluid_server_remove_client in libfluidsynth.a(fluid_cmd.c.o)
    [build]       _fluid_server_close in libfluidsynth.a(fluid_cmd.c.o)
    [build]       _fluid_midi_router_set_default_rules in libfluidsynth.a(fluid_midi_router.c.o)
    [build]       ...
    [build]   "_g_private_get", referenced from:
    [build]       _fluid_synth_tuning_iteration_next in libfluidsynth.a(fluid_synth.c.o)
    [build]   "_g_private_set", referenced from:
    [build]       _fluid_synth_tuning_iteration_start in libfluidsynth.a(fluid_synth.c.o)
    [build]       _fluid_synth_tuning_iteration_next in libfluidsynth.a(fluid_synth.c.o)
    [build]   "_g_rec_mutex_clear", referenced from:
    [build]       _delete_fluid_settings in libfluidsynth.a(fluid_settings.c.o)
    [build]       _delete_fluid_synth in libfluidsynth.a(fluid_synth.c.o)
    [build]       _fluid_sffile_close in libfluidsynth.a(fluid_sffile.c.o)
    [build]   "_g_rec_mutex_init", referenced from:
    [build]       _new_fluid_settings in libfluidsynth.a(fluid_settings.c.o)
    [build]       _new_fluid_synth in libfluidsynth.a(fluid_synth.c.o)
    [build]       _fluid_sffile_open in libfluidsynth.a(fluid_sffile.c.o)
    [build]   "_g_rec_mutex_lock", referenced from:
    [build]       _fluid_settings_register_str in libfluidsynth.a(fluid_settings.c.o)
    [build]       _fluid_settings_register_num in libfluidsynth.a(fluid_settings.c.o)
    [build]       _fluid_settings_register_int in libfluidsynth.a(fluid_settings.c.o)
    [build]       _fluid_settings_callback_str in libfluidsynth.a(fluid_settings.c.o)
    [build]       _fluid_settings_callback_num in libfluidsynth.a(fluid_settings.c.o)
    [build]       _fluid_settings_callback_int in libfluidsynth.a(fluid_settings.c.o)
    [build]       _fluid_settings_get_user_data in libfluidsynth.a(fluid_settings.c.o)
    [build]       ...
    [build]   "_g_rec_mutex_unlock", referenced from:
    [build]       _fluid_settings_register_str in libfluidsynth.a(fluid_settings.c.o)
    [build]       _fluid_settings_register_num in libfluidsynth.a(fluid_settings.c.o)
    [build]       _fluid_settings_register_int in libfluidsynth.a(fluid_settings.c.o)
    [build]       _fluid_settings_callback_str in libfluidsynth.a(fluid_settings.c.o)
    [build]       _fluid_settings_callback_num in libfluidsynth.a(fluid_settings.c.o)
    [build]       _fluid_settings_callback_int in libfluidsynth.a(fluid_settings.c.o)
    [build]       _fluid_settings_get_user_data in libfluidsynth.a(fluid_settings.c.o)
    [build]       ...
    [build]   "_g_return_if_fail_warning", referenced from:
    [build]       _new_fluid_thread in libfluidsynth.a(fluid_sys.c.o)
    [build]   "_g_shell_parse_argv", referenced from:
    [build]       _fluid_command in libfluidsynth.a(fluid_cmd.c.o)
    [build]   "_g_strfreev", referenced from:
    [build]       _fluid_command in libfluidsynth.a(fluid_cmd.c.o)
    [build]   "_g_thread_join", referenced from:
    [build]       _fluid_thread_join in libfluidsynth.a(fluid_sys.c.o)
    [build]   "_g_thread_try_new", referenced from:
    [build]       _new_fluid_thread in libfluidsynth.a(fluid_sys.c.o)
    [build]   "_g_thread_unref", referenced from:
    [build]       _new_fluid_thread in libfluidsynth.a(fluid_sys.c.o)
    [build]   "_g_usleep", referenced from:
    [build]       _fluid_msleep in libfluidsynth.a(fluid_sys.c.o)
    [build]   "_ogg_page_serialno", referenced from:
    [build]       _FLAC__ogg_decoder_aspect_read_callback_wrapper in libFLAC.a(ogg_decoder_aspect.c.o)
    [build]   "_ogg_stream_clear", referenced from:
    [build]       _FLAC__ogg_decoder_aspect_finish in libFLAC.a(ogg_decoder_aspect.c.o)
    [build]   "_ogg_stream_init", referenced from:
    [build]       _FLAC__ogg_decoder_aspect_init in libFLAC.a(ogg_decoder_aspect.c.o)
    [build]   "_ogg_stream_packetout", referenced from:
    [build]       _FLAC__ogg_decoder_aspect_read_callback_wrapper in libFLAC.a(ogg_decoder_aspect.c.o)
    [build]   "_ogg_stream_pagein", referenced from:
    [build]       _FLAC__ogg_decoder_aspect_read_callback_wrapper in libFLAC.a(ogg_decoder_aspect.c.o)
    [build]   "_ogg_stream_reset", referenced from:
    [build]       _FLAC__ogg_decoder_aspect_flush in libFLAC.a(ogg_decoder_aspect.c.o)
    [build]   "_ogg_sync_buffer", referenced from:
    [build]       _FLAC__ogg_decoder_aspect_read_callback_wrapper in libFLAC.a(ogg_decoder_aspect.c.o)
    [build]   "_ogg_sync_clear", referenced from:
    [build]       _FLAC__ogg_decoder_aspect_finish in libFLAC.a(ogg_decoder_aspect.c.o)
    [build]   "_ogg_sync_init", referenced from:
    [build]       _FLAC__ogg_decoder_aspect_init in libFLAC.a(ogg_decoder_aspect.c.o)
    [build]   "_ogg_sync_pageout", referenced from:
    [build]       _FLAC__ogg_decoder_aspect_read_callback_wrapper in libFLAC.a(ogg_decoder_aspect.c.o)
    [build]   "_ogg_sync_reset", referenced from:
    [build]       _FLAC__ogg_decoder_aspect_flush in libFLAC.a(ogg_decoder_aspect.c.o)
    [build]   "_ogg_sync_wrote", referenced from:
    [build]       _FLAC__ogg_decoder_aspect_read_callback_wrapper in libFLAC.a(ogg_decoder_aspect.c.o)
    

    This can be fixed by adding: vcpkg_installed/arm64-osx/debug/lib/libogg.a vcpkg_installed/arm64-osx/debug/lib/libglib-2.0.a vcpkg_installed/arm64-osx/debug/lib/libintl.a /opt/homebrew/lib/libomp.a to the LINK_LIBRARIES. OpenMP may be an upstream issue as Apple's toolchains do not ship with it, but the fluidsynth build found one from another toolchain.

    Lastly, despite building with OGG support using VORBISFILE and Opus support, they do not seem to be built in as even manually adding them to the build command fails at runtime with OPUS/OGG support not available.

    Additional info:

    The issue could not be reproduced when building shared libraries, apart from SDL_mixer being built without OPUS support.

    CMake configuration logs
    -- The C compiler identification is AppleClang 14.0.0.14000029
    -- Detecting C compiler ABI info
    -- Detecting C compiler ABI info - done
    -- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc - skipped
    -- Detecting C compile features
    -- Detecting C compile features - done
    -- Configuring SDL2_mixer 2.6.1
    -- Using system opusfile
    -- Found opusfile: /Users/.../git/vcpkg/installed/arm64-osx/lib/libopusfile.a  
    -- Dynamic opus (opusfile): libopusfile.a
    -- Using system vorbisfile
    -- Found vorbisfile: /Users/.../git/vcpkg/installed/arm64-osx/lib/libvorbisfile.a  
    -- Dynamic vorbisfile: libvorbisfile.a
    -- Using system libflac
    -- Found FLAC: /Users/.../git/vcpkg/installed/arm64-osx/lib/libFLAC.a  
    -- Using system libmodplug
    -- Found modplug: /Users/.../git/vcpkg/installed/arm64-osx/lib/libmodplug.a  
    -- Using system mpg123
    -- Found MPG123: /Users/.../git/vcpkg/installed/arm64-osx/lib/libmpg123.a  
    -- Using system FluidSynth
    -- Found FluidSynth: /Users/.../git/vcpkg/installed/arm64-osx/lib/libfluidsynth.a  
    -- Configuring done
    -- Generating done
    
    Variables set in SDL_mixerConfig.cmake
    set(SDL2_mixer_FOUND                ON)
    
    set(SDL2MIXER_VENDORED              OFF)
    
    set(SDL2MIXER_CMD                   OFF)
    
    set(SDL2MIXER_FLAC_LIBFLAC          ON)
    set(SDL2MIXER_FLAC_DRFLAC           OFF)
    
    set(SDL2MIXER_MOD                   ON)
    set(SDL2MIXER_MOD_MODPLUG           ON)
    set(SDL2MIXER_MOD_XMP               OFF)
    set(SDL2MIXER_MOD_XMP_LITE          OFF)
    
    set(SDL2MIXER_MP3                   ON)
    set(SDL2MIXER_MP3_DRMP3             OFF)
    set(SDL2MIXER_MP3_MPG123            ON)
    
    set(SDL2MIXER_MIDI                  ON)
    set(SDL2MIXER_MIDI_FLUIDSYNTH       ON)
    set(SDL2MIXER_MIDI_NATIVE           ON)
    set(SDL2MIXER_MIDI_TIMIDITY         ON)
    
    set(SDL2MIXER_OPUS                  ON)
    
    set(SDL2MIXER_VORBIS                VORBISFILE)
    set(SDL2MIXER_VORBIS_STB            OFF)
    set(SDL2MIXER_VORBIS_TREMOR         OFF)
    set(SDL2MIXER_VORBIS_VORBISFILE     ON)
    
    set(SDL2MIXER_WAVE                  ON)
    
    opened by FtZPetruska 4
  • Mix_Chunk sound is buggy and broken (in Windows11)

    Mix_Chunk sound is buggy and broken (in Windows11)

    I was using version 2.0.4 of SDL_mixer and everything worked correctly, after I changed to 2.6.2 the sounds that come out when I play the mix_chunk come out all broken and buggy... but when I all a mix_music everything works correctly... edit1: In addition to these errors, which are generalized to any sound .wav file, also had 1 file .wav (Name: RetroGame.wav, is on github along with all the code) which approximately 10% of the time that started the app, the "Mix_LoadWAV" function of the error saying that "attempt to write protected memory"

    I am using C#, but I am confident that this is not the problem, here is my program code:

    to facilitate c# code analysis, translations of c# links have some changes such as Mix_Chunk ==> Chunk and MixChunk* ==> PChunk 
    and the functions that returned MixChunk* were changed to the last argument of them to be a reference of the returned argument...
    function(..., out chunck)
    
    using SDL_Sharp.Mixer;
    using System;
    
    namespace SDL_PLUS_EXTENSIONS;
    class SoundChunk
    {
        PChunk chunk;
        int volume = MIX.MAX_VOLUME;
    
        public static SoundChunk CreateSoundChunk(string path)
        {
            return new SoundChunk(path);
        }
    
        SoundChunk(string path)
        {
            MIX.LoadWAV(path, out chunk);
            //Console.WriteLine(MIX.GetError());
            if (chunk.IsNull)
                throw new Exception("PChunk not create");
            MIX.VolumeChunk(chunk, volume);
        }
    
        public void Play(int loop)
        {
            if (MIX.PlayChannel(0, chunk, loop) == -1)
            {
                Console.WriteLine(MIX.GetError());
            }
        }
    
        public void SetVolume(int volume)
        {
            this.volume = volume;
            MIX.VolumeChunk(chunk, volume);
        }
    
        ~SoundChunk()
        {
            MIX.FreeChunk(chunk);
        }
    }
    
    class SoundMusic
    {
        public Music music;
        public static SoundMusic CurrentMusic { get; private set; }
    
        static int volume = MIX.MAX_VOLUME;
        public static int CurrentVolume { get => volume; }
    
        public static SoundMusic CreateSoundMusic(string path)
        {
            return new SoundMusic(path);
        }
    
        SoundMusic(string path)
        {
            music = MIX.LoadMUS(path);
            if (music.IsNull)
                throw new Exception("Music not create");
        }
    
        public static void PlayMusic(SoundMusic music, int loop)
        {
            CurrentMusic = music;
            if (MIX.PlayMusic(music.music, loop) == -1)
            {
                Console.WriteLine(MIX.GetError());
            }
        }
    
        public static void SetVolume(int volume)
        {
            SoundMusic.volume = volume;
            MIX.VolumeMusic(SoundMusic.volume);
        }
    
        ~SoundMusic()
        {
            MIX.FreeMusic(music);
        }
    }
    
    static void Main(){
    ...
            SDL.Init(SdlInitFlags.Video | SdlInitFlags.Video);
            MIX.Init(MixInitFlags.Mod);
            const int audio_buffer = 4096;
            MIX.OpenAudio(MIX.DEFAULT_FREQUENCY, MIX.DEFAULT_FORMAT, MIX.DEFAULT_CHANNELS, audio_buffer);
            MIX.AllocateChannels(MIX.CHANNELS);
            //Init SDL/Image/Mixer/Ttf
    
            SoundMusic soundMusic = SoundMusic.CreateSoundMusic("./Files/MUSIC.wav");
            SoundMusic.SetVolume(8);
            SoundMusic.PlayMusic(soundMusic, -1);
    
            SoundChunk soundChunk = SoundChunk.CreateSoundChunk("./Files/RetroGame.wav");
            soundChunk.SetVolume(32);
            soundChunk.Play(3);
    ... loop ...
            MIX.CloseAudio();
            MIX.Quit();
    }
    

    edit2: c++ code (continues with the same error)

    #include <iostream>
    #include "SDL2/SDL.h"
    #include "SDL2/SDL_mixer.h"
    
    int SDL_main(int argc, char* args[]) {
        std::cout << "app start" << std::endl;
    
        SDL_Init(SDL_INIT_EVERYTHING);
        Mix_Init(MIX_INIT_MOD);
        std::cout << "SDL_Init && Mix_Init" << std::endl;
    
        const int audio_buffer = 4096;
        Mix_OpenAudio(MIX_DEFAULT_FREQUENCY, MIX_DEFAULT_FORMAT, MIX_DEFAULT_CHANNELS, audio_buffer);
        Mix_AllocateChannels(MIX_CHANNELS);
        std::cout << "Mixer Open" << std::endl;
    
        Mix_Chunk* chunk;
        chunk = Mix_LoadWAV("./MUSIC.wav");
        Mix_VolumeChunk(chunk, MIX_MAX_VOLUME);
        std::cout << "Mix_Chunk Load" << std::endl;
    
        Mix_PlayChannel(0, chunk, -1);
    
        bool loop = true;
        while (loop) { /* loop */ }
    
        Mix_FreeChunk(chunk);
        SDL_Quit();
        Mix_Quit();
    
        return 0;
    }
    

    What is wrong with this code? The complete code for this program is on github: https://github.com/GabrielFrigo4/SDL-Sharp/tree/master/Exemples/SDL_EXTENSIONS

    (This is my first time I do an issue, any error or lack of information warns me that I fix)

    opened by GabrielFrigo4 7
  • How to run a application inside the build folder, using completely vendored SDL_mixer?

    How to run a application inside the build folder, using completely vendored SDL_mixer?

    When building a project using vendored SDL2_mixer + vendored dynamically loaded 3rd party libraries, all external modules are built in various subdirectories. Running this program will fail because the system does not know how to find any 3rd party libraries. Runpaths are usually used to accomplish this but because dlopen is in libSDL2.so, the runpath of SDL2_mixer or any program is not taken into account.

    Reproducer:

    Assume a Linux development machine, having only installed cmake+gcc+ninja+SDL2 (no libmodplug/libxmp/...). Assume you're vendoring SDL_mixer inside your own project. Assume you're using using vendored modules ==> use SDL_mixer's submodules

    Paste the following to the bottom of SDL_mixer's CMakeLists.txt.

    file(WRITE use_mod_shared_module.c [[
    #include "SDL.h"
    #include "SDL_mixer.h"
    
    int main() {
      int r = SDL_Init(SDL_INIT_AUDIO);
      if (r != 0) {
        fprintf(stderr, "ERROR: SDL_Init returned %d\n", r);
        return 1;
      }
      r = Mix_Init(MIX_INIT_MOD);
      if (r != MIX_INIT_MOD) {
        fprintf(stderr, "ERROR: MIX_Init returned %d\n", r);
        fprintf(stderr, "err=%s\n", Mix_GetError());
        return 1;
      }
      Mix_Quit();
    
      SDL_Quit();
    }
    ]])
    add_executable(use_mod_test use_mod_shared_module.c)
    target_link_libraries(use_mod_test PRIVATE SDL2::SDL2 SDL2_mixer)
    

    Then configure and build the project with -DSDL2MIXER_VENDORED=ON -DSDL2MIXER_MOD_MODPLUG=ON -DSDL2MIXER_MOD_MODPLUG_SHARED=ON.

    Running ./use_mod_test gives the following output:

    ERROR: MIX_Init returned 0
    err=MOD support not available
    

    This is because use_mod_test is unable to find libmodplug.so.1. Adding the library containing libmodplug.so.1 to the run path of either libSDL2_mixer.so and use_mod_test does not fix the issue. Adding it to the runpath of libSDL2.so fixes this. But this is obviously unwanted. Setting LD_LIBRARY_PATH to the location of libmodplug.so.1 also fixes it.

    This begs the question of how are external projects supposed to know the location of these vendored libraries? It is possible for the CMake project to provide these location such that external projects can add this to LD_LIBRARY_PATH. The external project would need to add this to every invocation, which is easy to miss.

    Another solution would be to move SDL_LoadObject to SDL_mixer (or at least do dlopen inside libSDL_mixer.so. Then, by adding the location of the 3rd party libraries to the runpath of libSDL_mixer.so, the program is able to find its vendored submodules. In this case, external projects require no extra code.

    (this question is motivated by https://github.com/libsdl-org/SDL_mixer/issues/448#issuecomment-1251618132)

    opened by madebr 0
  • Mix_MusicDuration return value incorrect with dr_mp3 backend?

    Mix_MusicDuration return value incorrect with dr_mp3 backend?

    Hi all,

    Just happened on a potential bug in SDL_mixer with the new dr_mp3 backend, thanks to the efforts of @smcv: https://github.com/py-sdl/py-sdl2/issues/243

    Essentially, with the default dr_mp3 backend, Mix_MusicDuration seems to be over-reporting its duration: on my system with the official macOS mixer 2.6.1 binaries, I get 0.209 seconds for the test MP3 (available here: https://github.com/py-sdl/py-sdl2/blob/master/sdl2/test/resources/soundtest.mp3), whereas with the libmpg123 backend it reports 0.1502 seconds for the same file (which @smcv helpfully confirmed was the correct duration in the linked issue above). Since the unit test I wrote based on that 0.209 number has been passing on Windows, macOS, and Linux CI runners (all with the dr_mp3 backend), I'm fairly certain it's not a platform specific issue.

    Any ideas what's going on?

    opened by a-hurst 1
  • Is default MP3 implementation broken?

    Is default MP3 implementation broken?

    Hello, I'm having some problems running mp3 files in the PS2 port.

    First of all, let me tell you how I'm compiling the library:

    cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=$PS2DEV/ps2sdk/ps2dev.cmake  -DCMAKE_INSTALL_PREFIX=$PS2SDK/ports -DBUILD_SHARED_LIBS=OFF \
        -DCMAKE_POSITION_INDEPENDENT_CODE=OFF -DSDL2MIXER_DEPS_SHARED=OFF -DSDL2MIXER_OPUS=OFF -DSDL2MIXER_MIDI=OFF -DSDL2MIXER_FLAC=OFF \
        -DSDL2MIXER_MOD=ON -DSDL2MIXER_SAMPLES=OFF ..
    

    Then I have created the next example:

    #include <stdio.h>
    #include <stdlib.h>
    #include <stdbool.h>
    
    #include <SDL2/SDL.h>
    #include <SDL2/SDL_mixer.h>
    
    static const int width = 640;
    static const int height = 480;
    
    int main(int argc, char **argv)
    {
        // Initialize SDL video and audio systems
        SDL_Init(SDL_INIT_AUDIO | SDL_INIT_JOYSTICK | SDL_INIT_VIDEO);
    
        // Initialize SDL mixer
        Mix_OpenAudio(44100, MIX_DEFAULT_FORMAT, 2, 2048);
    
        int flags = 0;
        flags |= MIX_INIT_MP3;
        int initted = Mix_Init(flags);
        if((initted & flags) != flags)
        {
            printf("Mix_Init: Failed to init required mod support!\n");
            printf("Mix_Init: %s\n", Mix_GetError());
            return 1;
        }
    
        // Load audio files
        Mix_Music *backgroundSound = Mix_LoadMUS("background.mp3");
        Mix_Chunk *jumpEffect = Mix_LoadWAV("jumpEffect.wav");
    
        // Create a SDL window
        SDL_Window *window = SDL_CreateWindow("Hello, SDL2", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, width, height, SDL_WINDOW_FULLSCREEN);
    
        // Create a renderer (accelerated and in sync with the display refresh rate)
        SDL_Renderer *renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC);
        SDL_SetRenderDrawColor(renderer, 255, 0, 0, 255);
    
        // Loading Controller
        SDL_Joystick *joy = SDL_JoystickOpen(0);
    
        // Start the background music
        Mix_PlayMusic(backgroundSound, -1);
    
        bool running = true;
        SDL_Event event;
        while(running)
        {
            // Process events
            while(SDL_PollEvent(&event))
            {
                if(event.type == SDL_QUIT)
                {
                    running = false;
                }
                else if(event.type == SDL_JOYBUTTONDOWN)
                {
                    printf("Playing jumpEffect\n");
                    Mix_PlayChannel(-1, jumpEffect, 0);
                }
            }
    
            // Clear screen
            SDL_RenderClear(renderer);
    
            // Show what was drawn
            SDL_RenderPresent(renderer);
        }
    
        // Release resources
    
        SDL_DestroyRenderer(renderer);
        SDL_DestroyWindow(window);
        Mix_FreeMusic(backgroundSound);
        Mix_FreeChunk(jumpEffect);
        Mix_CloseAudio();
        SDL_JoystickClose(joy);
        SDL_Quit();
    
        return 0;
    }
    

    I'm able to reproduce wav file without any issue every time that I press a key, however, the background music is not properly decoded, making a lot of noise:

    https://user-images.githubusercontent.com/10010409/184988656-5f5a0286-e5e0-45a3-8287-638fd12837ea.mp4

    Here you have also the original audio files:

    PS2_mp3_issue.zip

    Cheers

    opened by fjtrujy 2
Releases(release-2.6.2)
  • release-2.6.1(Jul 12, 2022)

    This is a minor bug-fix release, fixing a packaging issue on Linux.

    Here are the highlights for the 2.6.0 release:

    • API documentation is now available on the wiki: https://wiki.libsdl.org/SDL_mixer
    • Added support for building with CMake
    • Added support for playing Ogg files using stb_vorbis, which is now the default Vorbis backend. To use libvorbis instead, configure using --disable-music-ogg-stb --enable-music-ogg-vorbis
    • Added support for playing FLAC files using dr_flac, which is now the default FLAC music backend. To use libflac instead, configure using --disable-music-flac-drflac --enable-music-flac-libflac
    • Added support for playing MP3 files using dr_mp3, which is now the default MP3 music backend. To use libmpg123 instead, configure using --disable-music-mp3-drmp3 --enable-music-mp3-mpg123
    • Added libxmp support for mod music playback. Modplug is still the default backend for MOD music. To use libxmp instead, configure using --disable-music-mod-modplug --enable-music-mod-xmp
    • Removed support for libmad as a MP3 music backend.
    • Removed support for libmikmod as a MOD music backend.
    • Added Mix_MasterVolume() for additional volume control over all channels
    • Update Mix_Init() return value to match documentation, including MIXER_INIT_* flags for already-initialized modules
    • Added Mix_HasMusicDecoder()
    • Memory leak fixes and F32 format support to fluidsynth player
    • Fixed distorted MIDI playback with FluidSynth if sample rate is out of library's limits
    • Added Mix_ModMusicJumpToOrder() for mod music formats
    • Enabled module internal loops in modplug player
    • Respect original mp3 file offset
    • Support setting soundfont via SDL_SOUNDFONTS in OSX native midi
    • Fixed mp3 file detection
    • Fixes to ogg playback on big-endian devices
    • Added functions to get metadata information: Mix_GetMusicTitle() Mix_GetMusicTitleTag() Mix_GetMusicArtistTag() Mix_GetMusicAlbumTag() Mix_GetMusicCopyrightTag()
    • Add functions to get loop point information: Mix_GetMusicLoopStartTime() Mix_GetMusicLoopEndTime() Mix_GetMusicLoopLengthTime()
    • Added Mix_GetMusicVolume() and Mix_GetMusicPosition()
    • Added Mix_MusicDuration() to return music duration in seconds
    • Fixed music_mpg123 seek bug when sample rate of the file and the stream don't match
    • Timidity improvements, added Mix_SetTimidityCfg()
    • Improved mp3 tag detection/skipping
    • Extended support for WAV files
    • Allow rmid files be opened by native midi
    • Fixed possible crash in win32 native midi
    • Prevent clipping due to volume settings in modplug music
    • Added looping support for Opus files
    • Added looping support for FLAC files
    • Improved OGG looping support
    • Fixed loading Opus audio as audio chunks
    Source code(tar.gz)
    Source code(zip)
    SDL2_mixer-2.6.1-win32-x64.zip(526.13 KB)
    SDL2_mixer-2.6.1-win32-x86.zip(501.57 KB)
    SDL2_mixer-2.6.1.dmg(308.30 KB)
    SDL2_mixer-2.6.1.tar.gz(9.46 MB)
    SDL2_mixer-2.6.1.tar.gz.sig(95 bytes)
    SDL2_mixer-2.6.1.zip(12.74 MB)
    SDL2_mixer-2.6.1.zip.sig(95 bytes)
    SDL2_mixer-devel-2.6.1-mingw.tar.gz(2.70 MB)
    SDL2_mixer-devel-2.6.1-mingw.zip(2.71 MB)
    SDL2_mixer-devel-2.6.1-VC.zip(1.04 MB)
  • release-2.6.0(Jul 8, 2022)

    In addition to new CMake support by @madebr and many bug fixes, here are the highlights since the last release:

    • API documentation is now available on the wiki: https://wiki.libsdl.org/SDL_mixer
    • Added support for building with CMake
    • Added support for playing Ogg files using stb_vorbis, which is now the default Vorbis backend. To use libvorbis instead, configure using --disable-music-ogg-stb --enable-music-ogg-vorbis
    • Added support for playing FLAC files using dr_flac, which is now the default FLAC music backend. To use libflac instead, configure using --disable-music-flac-drflac --enable-music-flac-libflac
    • Added support for playing MP3 files using dr_mp3, which is now the default MP3 music backend. To use libmpg123 instead, configure using --disable-music-mp3-drmp3 --enable-music-mp3-mpg123
    • Added libxmp support for mod music playback. Modplug is still the default backend for MOD music. To use libxmp instead, configure using --disable-music-mod-modplug --enable-music-mod-xmp
    • Removed support for libmad as a MP3 music backend.
    • Removed support for libmikmod as a MOD music backend.
    • Added Mix_MasterVolume() for additional volume control over all channels
    • Update Mix_Init() return value to match documentation, including MIXER_INIT_* flags for already-initialized modules
    • Added Mix_HasMusicDecoder()
    • Memory leak fixes and F32 format support to fluidsynth player
    • Fixed distorted MIDI playback with FluidSynth if sample rate is out of library's limits
    • Added Mix_ModMusicJumpToOrder() for mod music formats
    • Enabled module internal loops in modplug player
    • Respect original mp3 file offset
    • Support setting soundfont via SDL_SOUNDFONTS in OSX native midi
    • Fixed mp3 file detection
    • Fixes to ogg playback on big-endian devices
    • Added functions to get metadata information: Mix_GetMusicTitle() Mix_GetMusicTitleTag() Mix_GetMusicArtistTag() Mix_GetMusicAlbumTag() Mix_GetMusicCopyrightTag()
    • Add functions to get loop point information: Mix_GetMusicLoopStartTime() Mix_GetMusicLoopEndTime() Mix_GetMusicLoopLengthTime()
    • Added Mix_GetMusicVolume() and Mix_GetMusicPosition()
    • Added Mix_MusicDuration() to return music duration in seconds
    • Fixed music_mpg123 seek bug when sample rate of the file and the stream don't match
    • Timidity improvements, added Mix_SetTimidityCfg()
    • Improved mp3 tag detection/skipping
    • Extended support for WAV files
    • Allow rmid files be opened by native midi
    • Fixed possible crash in win32 native midi
    • Prevent clipping due to volume settings in modplug music
    • Added looping support for Opus files
    • Added looping support for FLAC files
    • Improved OGG looping support
    • Fixed loading Opus audio as audio chunks
    Source code(tar.gz)
    Source code(zip)
    SDL2_mixer-2.6.0-win32-x64.zip(526.13 KB)
    SDL2_mixer-2.6.0-win32-x86.zip(501.57 KB)
    SDL2_mixer-2.6.0.dmg(308.28 KB)
    SDL2_mixer-2.6.0.tar.gz(9.46 MB)
    SDL2_mixer-2.6.0.tar.gz.sig(95 bytes)
    SDL2_mixer-2.6.0.zip(12.74 MB)
    SDL2_mixer-2.6.0.zip.sig(95 bytes)
    SDL2_mixer-devel-2.6.0-mingw.tar.gz(2.70 MB)
    SDL2_mixer-devel-2.6.0-mingw.zip(2.71 MB)
    SDL2_mixer-devel-2.6.0-VC.zip(1.04 MB)
  • prerelease-2.5.2(Jun 17, 2022)

    This is a release candidate for 2.6.0.

    In addition to new CMake support by @madebr and many bug fixes, here are the highlights since the last release:

    • Added support for playing Ogg files using stb_vorbis, which is now the default Vorbis backend. To use libvorbis instead, configure using --disable-music-ogg-stb --enable-music-ogg-vorbis
    • Added support for playing FLAC files using dr_flac, which is now the default FLAC music backend. To use libflac instead, configure using --disable-music-flac-drflac --enable-music-flac-libflac
    • Added support for playing MP3 files using dr_mp3, which is now the default MP3 music backend. To use libmpg123 instead, configure using --disable-music-mp3-drmp3 --enable-music-mp3-mpg123
    • Added libxmp support for mod music playback. Modplug is still the default backend for MOD music. To use libxmp instead, configure using --disable-music-mod-modplug --enable-music-mod-xmp
    • Removed support for libmad as a MP3 music backend.
    • Removed support for libmikmod as a MOD music backend.
    • Added Mix_MasterVolume() for additional volume control over all channels
    • Update Mix_Init() return value to match documentation, including MIXER_INIT_* flags for already-initialized modules
    • Added Mix_HasMusicDecoder()
    • Memory leak fixes and F32 format support to fluidsynth player
    • Fixed distorted MIDI playback with FluidSynth if sample rate is out of library's limits
    • Added Mix_ModMusicJumpToOrder() for mod music formats
    • Enabled module internal loops in modplug player
    • Respect original mp3 file offset
    • Support setting soundfont via SDL_SOUNDFONTS in OSX native midi
    • Fixed mp3 file detection
    • Fixes to ogg playback on big-endian devices
    • Added functions to get metadata information: Mix_GetMusicTitle() Mix_GetMusicTitleTag() Mix_GetMusicArtistTag() Mix_GetMusicAlbumTag() Mix_GetMusicCopyrightTag()
    • Add functions to get loop point information: Mix_GetMusicLoopStartTime() Mix_GetMusicLoopEndTime() Mix_GetMusicLoopLengthTime()
    • Added Mix_GetMusicVolume() and Mix_GetMusicPosition()
    • Added Mix_MusicDuration() to return music duration in seconds
    • Fixed music_mpg123 seek bug when sample rate of the file and the stream don't match
    • Timidity improvements, added Mix_SetTimidityCfg()
    • Improved mp3 tag detection/skipping
    • Extended support for WAV files
    • Allow rmid files be opened by native midi
    • Fixed possible crash in win32 native midi
    • Prevent clipping due to volume settings in modplug music
    • Added looping support for Opus files
    • Added looping support for FLAC files
    • Improved OGG looping support
    • Fixed loading Opus audio as audio chunks
    Source code(tar.gz)
    Source code(zip)
    SDL2_mixer-2.5.2-win32-x64.zip(522.23 KB)
    SDL2_mixer-2.5.2-win32-x86.zip(497.98 KB)
    SDL2_mixer-2.5.2.dmg(289.20 KB)
    SDL2_mixer-2.5.2.tar.gz(9.45 MB)
    SDL2_mixer-2.5.2.zip(12.73 MB)
    SDL2_mixer-devel-2.5.2-mingw.tar.gz(2.40 MB)
    SDL2_mixer-devel-2.5.2-mingw.zip(2.41 MB)
    SDL2_mixer-devel-2.5.2-VC.zip(1.02 MB)
  • candidate-2.5.1(May 25, 2022)

  • release-2.0.4(Jan 11, 2022)

    Changes in this release:

    • Removed smpeg support for mp3 music, now that it's replaced by libmpg123
    • Fixed mp3 mad decoder to skip tags, which otherwise would lead to crashes
    • Added support for Opus music playback using opusfile library
    Source code(tar.gz)
    Source code(zip)
Owner
Simple Directmedia Layer
Simple Directmedia Layer (SDL) is a framework for creating cross-platform games and applications.
Simple Directmedia Layer
simple audio mixer for native and web

?? auph ?? Trivial audio mixer API for native and web targets. Online Demo ⚠️ Work in progress! API is constantly changing. The native playback at the

Elias Ku 13 Jul 1, 2022
A simple CLI to extract & save artwork of a 🎵 music/audio file.

artwork-extractor A simple CLI to extract & save artwork of a ?? music/audio file. Usage Dependencies MediaInfoLib On Debian based distros, one may in

Hitesh Kumar Saini 5 Aug 4, 2021
PortAudio is a portable audio I/O library designed for cross-platform support of audio

PortAudio is a cross-platform, open-source C language library for real-time audio input and output.

PortAudio 758 Nov 28, 2022
Single file audio playback and capture library written in C.

A single file library for audio playback and capture. Example - Documentation - Supported Platforms - Backends - Major Features - Building - Unofficia

David Reid 2.5k Nov 25, 2022
Audio File Library

Audio File Library

michael pruett 138 Nov 10, 2022
Single file C library for decoding MPEG1 Video and MP2 Audio

PL_MPEG - MPEG1 Video decoder, MP2 Audio decoder, MPEG-PS demuxer Single-file MIT licensed library for C/C++ See pl_mpeg.h for the documentation. Why?

Dominic Szablewski 598 Nov 30, 2022
🎵 Music notation engraving library for MEI with MusicXML and Humdrum support and various toolkits (JavaScript, Python)

Verovio is a fast, portable and lightweight library for engraving Music Encoding Initiative (MEI) digital scores into SVG images. Verovio also contain

RISM Switzerland 513 Nov 28, 2022
cute_dsp is a C API for various DSP effects suitable for video games

cute_dsp is a C API for various DSP effects suitable for video games and meant to interface directly with the cute_sound library created by Randy Gaul

Matt Rosen 13 May 29, 2021
A simple C++ library for reading and writing audio files.

AudioFile A simple header-only C++ library for reading and writing audio files. Current supported formats: WAV AIFF Author AudioFile is written and ma

Adam Stark 667 Nov 22, 2022
SimplE Lossless Audio

SELA SimplE Lossless Audio A lossless audio codec which aims to be as simple as possible while still having good enough compression ratios. Code Quali

Ratul Saha 207 Sep 13, 2022
A simple and easy-to-use audio library based on miniaudio

raudio A simple and easy-to-use audio library based on miniaudio raudio forks from raylib.audio module to become an standalone library. Actually, it w

Ray 61 Oct 5, 2022
ASS: Audio Stupidly Simple

A single header library for audio decoding and playback

Danny Angelo Carminati Grein 32 Nov 13, 2022
A C library for reading and writing sound files containing sampled audio data.

libsndfile libsndfile is a C library for reading and writing files containing sampled audio data. Authors The libsndfile project was originally develo

null 1.1k Dec 1, 2022
C library for cross-platform real-time audio input and output

libsoundio C library providing cross-platform audio input and output. The API is suitable for real-time software such as digital audio workstations as

Andrew Kelley 1.6k Nov 22, 2022
C++ Audio and Music DSP Library

_____ _____ ___ __ _ _____ __ __ __ ____ ____ / \\_ \\ \/ / |/ \| | | | \_ \/ \ | Y Y \/ /_ \> <| | Y Y \ | |_|

Mick Grierson 1.4k Nov 26, 2022
Easy and efficient audio synthesis in C++

Tonic Fast and easy audio synthesis in C++. Prefer coding to patching? Love clean syntax? Care about performance? That's how we feel too, and why we m

null 479 Nov 22, 2022
Explore fractals in an audio-visual sandbox

Fractal Sound Explorer Explore fractals in an audio-visual sandbox Download executable on my itch.io page: https://codeparade.itch.io/fractal-sound-ex

null 976 Nov 24, 2022
Audio out with an FTDI UART cable

Audio out with an FTDI UART cable This encodes audio as either PDM (using a first order sigma-delta stage), 32-bits PWM or 64-bits PWM and sends it as

Konrad Beckmann 42 Jun 23, 2022
Sexy, audio-responsive effects on LED strips.

Striptease Sexy, audio-responsive effects on LED strips. For Teensy 4 with Audio Adapter Board, by PJRC. Quick demo Shooting video of LEDs is very tri

Luca Paolini 35 Jun 19, 2022