Skip to content

Commit

Permalink
Use dr_mp3 instead of minimp3 for default MP3 support
Browse files Browse the repository at this point in the history
  • Loading branch information
slouken committed May 21, 2022
1 parent b155b4c commit c94f6ce
Show file tree
Hide file tree
Showing 15 changed files with 4,916 additions and 3,821 deletions.
8 changes: 4 additions & 4 deletions Android.mk
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ SUPPORT_OGG ?= false
OGG_LIBRARY_PATH := external/ogg
VORBIS_LIBRARY_PATH := external/tremor

# Enable this if you want to support loading MP3 music via MINIMP3
SUPPORT_MP3_MINIMP3 ?= true
# Enable this if you want to support loading MP3 music via dr_mp3
SUPPORT_MP3_DRMP3 ?= true

# Enable this if you want to support loading MP3 music via MPG123
SUPPORT_MP3_MPG123 ?= false
Expand Down Expand Up @@ -97,8 +97,8 @@ ifeq ($(SUPPORT_OGG),true)
LOCAL_STATIC_LIBRARIES += ogg vorbisidec
endif

ifeq ($(SUPPORT_MP3_MINIMP3),true)
LOCAL_CFLAGS += -DMUSIC_MP3_MINIMP3
ifeq ($(SUPPORT_MP3_DRMP3),true)
LOCAL_CFLAGS += -DMUSIC_MP3_DRMP3
endif

# This needs to be a shared library to comply with the LGPL license
Expand Down
4 changes: 2 additions & 2 deletions CHANGES.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
2.0.5:
Vitaly Novichkov - Fri May 20 14:45:53 PDT 2022
* Added minimp3 codec library for MP3
Sam Lantinga - Fri May 20 20:50:29 PDT 2022
* Added support for playing MP3 files using dr_mp3
Mykola Rubets - Tue May 17 12:59:35 2022
* Implemented a master volume feature, Mix_MasterVolume added to
public api.
Expand Down
28 changes: 14 additions & 14 deletions Xcode/SDL_mixer.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@
AAE406041F9607C300EDAF53 /* effect_stereoreverse.c in Sources */ = {isa = PBXBuildFile; fileRef = AAE405E01F9607C300EDAF53 /* effect_stereoreverse.c */; };
AAE406051F9607C300EDAF53 /* effects_internal.h in Headers */ = {isa = PBXBuildFile; fileRef = AAE405E11F9607C300EDAF53 /* effects_internal.h */; };
BE1FA8CD07AF96B2004B6283 /* SDL_mixer.h in Headers */ = {isa = PBXBuildFile; fileRef = 1014BAEA010A4B677F000001 /* SDL_mixer.h */; settings = {ATTRIBUTES = (Public, ); }; };
F37A8CCA2838404700C38E95 /* music_minimp3.h in Headers */ = {isa = PBXBuildFile; fileRef = F37A8CC82838404700C38E95 /* music_minimp3.h */; };
F37A8CCB2838404700C38E95 /* music_minimp3.h in Headers */ = {isa = PBXBuildFile; fileRef = F37A8CC82838404700C38E95 /* music_minimp3.h */; };
F37A8CCC2838404700C38E95 /* music_minimp3.c in Sources */ = {isa = PBXBuildFile; fileRef = F37A8CC92838404700C38E95 /* music_minimp3.c */; };
F37A8CCD2838404700C38E95 /* music_minimp3.c in Sources */ = {isa = PBXBuildFile; fileRef = F37A8CC92838404700C38E95 /* music_minimp3.c */; };
F37A8D2D2838924900C38E95 /* music_drmp3.h in Headers */ = {isa = PBXBuildFile; fileRef = F37A8D2B2838924900C38E95 /* music_drmp3.h */; };
F37A8D2E2838924900C38E95 /* music_drmp3.h in Headers */ = {isa = PBXBuildFile; fileRef = F37A8D2B2838924900C38E95 /* music_drmp3.h */; };
F37A8D2F2838924900C38E95 /* music_drmp3.c in Sources */ = {isa = PBXBuildFile; fileRef = F37A8D2C2838924900C38E95 /* music_drmp3.c */; };
F37A8D302838924900C38E95 /* music_drmp3.c in Sources */ = {isa = PBXBuildFile; fileRef = F37A8D2C2838924900C38E95 /* music_drmp3.c */; };
F3823337273195CC00F7F527 /* utils.c in Sources */ = {isa = PBXBuildFile; fileRef = 639008C62385A822009019FA /* utils.c */; };
F3823338273195CF00F7F527 /* utils.h in Headers */ = {isa = PBXBuildFile; fileRef = 639008C72385A822009019FA /* utils.h */; };
F3823339273195D200F7F527 /* effect_position.c in Sources */ = {isa = PBXBuildFile; fileRef = AAE405D01F9607C100EDAF53 /* effect_position.c */; };
Expand Down Expand Up @@ -194,8 +194,8 @@
BE1FA90607AF96B2004B6283 /* SDL2_mixer.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SDL2_mixer.framework; sourceTree = BUILT_PRODUCTS_DIR; };
BE1FA95407AF96B2004B6283 /* libSDL2_mixer.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libSDL2_mixer.a; sourceTree = BUILT_PRODUCTS_DIR; };
BE1FA95807AF96B3004B6283 /* Create DMG */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = "Create DMG"; sourceTree = BUILT_PRODUCTS_DIR; };
F37A8CC82838404700C38E95 /* music_minimp3.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = music_minimp3.h; sourceTree = "<group>"; };
F37A8CC92838404700C38E95 /* music_minimp3.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = music_minimp3.c; sourceTree = "<group>"; };
F37A8D2B2838924900C38E95 /* music_drmp3.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = music_drmp3.h; sourceTree = "<group>"; };
F37A8D2C2838924900C38E95 /* music_drmp3.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = music_drmp3.c; sourceTree = "<group>"; };
F3968B90281F817E00661875 /* opus.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = opus.xcodeproj; path = opus/opus.xcodeproj; sourceTree = "<group>"; };
F3968D71281FB5E100661875 /* config.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = config.xcconfig; sourceTree = "<group>"; };
F3968D72281FB66200661875 /* tremor.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = tremor.xcodeproj; path = tremor/tremor.xcodeproj; sourceTree = "<group>"; };
Expand Down Expand Up @@ -301,6 +301,8 @@
639197F0239FE66700F1D8F8 /* mp3utils.h */,
AAE405DE1F9607C300EDAF53 /* music_cmd.c */,
AAE405DB1F9607C200EDAF53 /* music_cmd.h */,
F37A8D2C2838924900C38E95 /* music_drmp3.c */,
F37A8D2B2838924900C38E95 /* music_drmp3.h */,
AAE405D41F9607C100EDAF53 /* music_flac.c */,
AAE405C71F9607C000EDAF53 /* music_flac.h */,
AAE405C61F9607C000EDAF53 /* music_fluidsynth.c */,
Expand All @@ -309,8 +311,6 @@
AAE405DD1F9607C300EDAF53 /* music_mad.h */,
AAE405D81F9607C200EDAF53 /* music_mikmod.c */,
AAE405CF1F9607C100EDAF53 /* music_mikmod.h */,
F37A8CC92838404700C38E95 /* music_minimp3.c */,
F37A8CC82838404700C38E95 /* music_minimp3.h */,
AAE405C41F9607C000EDAF53 /* music_modplug.c */,
AAE405C51F9607C000EDAF53 /* music_modplug.h */,
AAE405DF1F9607C300EDAF53 /* music_mpg123.c */,
Expand Down Expand Up @@ -439,8 +439,8 @@
AAE405F61F9607C300EDAF53 /* load_aiff.h in Headers */,
AAE405E71F9607C300EDAF53 /* load_voc.h in Headers */,
AAE405EC1F9607C300EDAF53 /* music_wav.h in Headers */,
F37A8D2D2838924900C38E95 /* music_drmp3.h in Headers */,
AAE406011F9607C300EDAF53 /* music_mad.h in Headers */,
F37A8CCA2838404700C38E95 /* music_minimp3.h in Headers */,
AAE405E91F9607C300EDAF53 /* music_modplug.h in Headers */,
AAE405FE1F9607C300EDAF53 /* music_nativemidi.h in Headers */,
AAE405E41F9607C300EDAF53 /* mixer.h in Headers */,
Expand Down Expand Up @@ -477,12 +477,12 @@
F38233562731961C00F7F527 /* music_timidity.h in Headers */,
F38233542731961800F7F527 /* music_ogg.h in Headers */,
F382335C2731962B00F7F527 /* load_voc.h in Headers */,
F37A8CCB2838404700C38E95 /* music_minimp3.h in Headers */,
F382335D2731962D00F7F527 /* music_opus.h in Headers */,
F3823342273195E900F7F527 /* mp3utils.h in Headers */,
F38233602731963800F7F527 /* native_midi.h in Headers */,
F38233502731960F00F7F527 /* music_mpg123.h in Headers */,
F3823344273195EE00F7F527 /* music_cmd.h in Headers */,
F37A8D2E2838924900C38E95 /* music_drmp3.h in Headers */,
F38233582731962100F7F527 /* music_wav.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down Expand Up @@ -695,6 +695,7 @@
buildActionMask = 2147483647;
files = (
AAE405E21F9607C300EDAF53 /* load_aiff.c in Sources */,
F37A8D2F2838924900C38E95 /* music_drmp3.c in Sources */,
AAE405F01F9607C300EDAF53 /* load_voc.c in Sources */,
AAE405FC1F9607C300EDAF53 /* music_mikmod.c in Sources */,
AAE405EA1F9607C300EDAF53 /* music_fluidsynth.c in Sources */,
Expand All @@ -714,7 +715,6 @@
AAE405E51F9607C300EDAF53 /* mixer.c in Sources */,
0448E8AE108B937A00C9D3EA /* native_midi_macosx.c in Sources */,
630FBD8320D52105009867AB /* music_opus.c in Sources */,
F37A8CCC2838404700C38E95 /* music_minimp3.c in Sources */,
639008C82385A822009019FA /* utils.c in Sources */,
639197F1239FE66700F1D8F8 /* mp3utils.c in Sources */,
);
Expand All @@ -725,6 +725,7 @@
buildActionMask = 2147483647;
files = (
F38233552731961A00F7F527 /* music_timidity.c in Sources */,
F37A8D302838924900C38E95 /* music_drmp3.c in Sources */,
F382334F2731960C00F7F527 /* music_mpg123.c in Sources */,
F382333B273195D800F7F527 /* effects_internal.c in Sources */,
0448E8AF108B937A00C9D3EA /* native_midi_macosx.c in Sources */,
Expand All @@ -744,7 +745,6 @@
F38233572731961F00F7F527 /* music_wav.c in Sources */,
F38233512731961100F7F527 /* music_nativemidi.c in Sources */,
F38233532731961600F7F527 /* music_ogg.c in Sources */,
F37A8CCD2838404700C38E95 /* music_minimp3.c in Sources */,
F3823337273195CC00F7F527 /* utils.c in Sources */,
F3823339273195D200F7F527 /* effect_position.c in Sources */,
);
Expand Down Expand Up @@ -845,7 +845,7 @@
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_PREPROCESSOR_DEFINITIONS = (
MUSIC_MP3_MINIMP3,
MUSIC_MP3_DRMP3,
MUSIC_WAV,
"$(CONFIG_PREPROCESSOR_DEFINITIONS)",
);
Expand Down Expand Up @@ -892,7 +892,7 @@
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
MUSIC_MP3_MINIMP3,
MUSIC_MP3_DRMP3,
MUSIC_WAV,
"$(CONFIG_PREPROCESSOR_DEFINITIONS)",
);
Expand Down
20 changes: 10 additions & 10 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -937,7 +937,7 @@ enable_music_ogg_shared
enable_music_flac
enable_music_flac_shared
enable_music_mp3
enable_music_mp3_minimp3
enable_music_mp3_drmp3
enable_music_mp3_mad_gpl
enable_music_mp3_mad_gpl_dithering
enable_music_mp3_mpg123
Expand Down Expand Up @@ -1632,8 +1632,8 @@ Optional Features:
--enable-music-flac-shared
dynamically load FLAC library [default=yes]
--enable-music-mp3 enable MP3 music [default=yes]
--enable-music-mp3-minimp3
enable MP3 music via minimp3 [default=yes]
--enable-music-mp3-drmp3
enable MP3 music via dr_mp3 [default=yes]
--enable-music-mp3-mad-gpl
enable MP3 music via libmad GPL code [default=no]
--enable-music-mp3-mad-gpl-dithering
Expand Down Expand Up @@ -17312,15 +17312,15 @@ else
fi


# Check whether --enable-music-mp3-minimp3 was given.
if test "${enable_music_mp3_minimp3+set}" = set; then :
enableval=$enable_music_mp3_minimp3;
# Check whether --enable-music-mp3-drmp3 was given.
if test "${enable_music_mp3_drmp3+set}" = set; then :
enableval=$enable_music_mp3_drmp3;
else
enable_music_mp3_minimp3=yes
enable_music_mp3_drmp3=yes
fi

if test x$enable_music_mp3_minimp3 = xyes; then
EXTRA_CFLAGS="$EXTRA_CFLAGS -DMUSIC_MP3_MINIMP3"
if test x$enable_music_mp3_drmp3 = xyes; then
EXTRA_CFLAGS="$EXTRA_CFLAGS -DMUSIC_MP3_DRMP3"
fi

# Check whether --enable-music-mp3-mad-gpl was given.
Expand Down Expand Up @@ -17589,7 +17589,7 @@ $as_echo "$as_me: WARNING: mpg123 support disabled" >&2;}
fi
fi

if test x$enable_music_mp3_minimp3 = xyes -o x$have_libmad = xyes -o x$have_libmpg123 = xyes; then
if test x$enable_music_mp3_drmp3 = xyes -o x$have_libmad = xyes -o x$have_libmpg123 = xyes; then
:
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: MP3 support disabled" >&5
Expand Down
12 changes: 6 additions & 6 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -756,11 +756,11 @@ AC_ARG_ENABLE(music-mp3,
[AS_HELP_STRING([--enable-music-mp3], [enable MP3 music [default=yes]])],
[], enable_music_mp3=yes)

AC_ARG_ENABLE(music-mp3-minimp3,
[AS_HELP_STRING([--enable-music-mp3-minimp3], [enable MP3 music via minimp3 [default=yes]])],
[], [enable_music_mp3_minimp3=yes])
if test x$enable_music_mp3_minimp3 = xyes; then
EXTRA_CFLAGS="$EXTRA_CFLAGS -DMUSIC_MP3_MINIMP3"
AC_ARG_ENABLE(music-mp3-drmp3,
[AS_HELP_STRING([--enable-music-mp3-drmp3], [enable MP3 music via dr_mp3 [default=yes]])],
[], [enable_music_mp3_drmp3=yes])
if test x$enable_music_mp3_drmp3 = xyes; then
EXTRA_CFLAGS="$EXTRA_CFLAGS -DMUSIC_MP3_DRMP3"
fi

AC_ARG_ENABLE(music-mp3-mad-gpl,
Expand Down Expand Up @@ -835,7 +835,7 @@ if test x$enable_music_mp3_mpg123 = xyes; then
fi
fi

if test x$enable_music_mp3_minimp3 = xyes -o x$have_libmad = xyes -o x$have_libmpg123 = xyes; then
if test x$enable_music_mp3_drmp3 = xyes -o x$have_libmad = xyes -o x$have_libmpg123 = xyes; then
:
else
AC_MSG_WARN([MP3 support disabled])
Expand Down
Loading

2 comments on commit c94f6ce

@Wohlstand
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe place these files (dr_mp3.h and dr_flac.h) into own subdirectory? Just for the order.

@slouken
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe place these files (dr_mp3.h and dr_flac.h) into own subdirectory? Just for the order.

Done!

Please sign in to comment.