Codebase list libsdl2-mixer / 8f0a530
New upstream version 2.5.0~git20220509.g5c43733+dfsg Simon McVittie 1 year, 11 months ago
17 changed file(s) with 164 addition(s) and 150 deletion(s). Raw diff Collapse all Expand all
55
66 # Enable this if you want to support loading FLAC music with libFLAC
77 SUPPORT_FLAC ?= true
8 FLAC_LIBRARY_PATH := external/flac-1.3.3
8 FLAC_LIBRARY_PATH := external/flac
99
1010 # Enable this if you want to support loading OGG Vorbis music via Tremor
1111 SUPPORT_OGG ?= true
12 OGG_LIBRARY_PATH := external/libogg-1.3.2
13 VORBIS_LIBRARY_PATH := external/libvorbisidec-1.2.1
12 OGG_LIBRARY_PATH := external/ogg
13 VORBIS_LIBRARY_PATH := external/tremor
1414
1515 # Enable this if you want to support loading MP3 music via MPG123
1616 SUPPORT_MP3_MPG123 ?= true
17 MPG123_LIBRARY_PATH := external/mpg123-1.25.13
17 MPG123_LIBRARY_PATH := external/mpg123
1818
1919 # Enable this if you want to support loading MOD music via modplug
2020 SUPPORT_MOD_MODPLUG ?= true
21 MODPLUG_LIBRARY_PATH := external/libmodplug-0.8.9.0
21 MODPLUG_LIBRARY_PATH := external/libmodplug
2222
2323 # Enable this if you want to support TiMidity
2424 SUPPORT_MID_TIMIDITY ?= true
3838 PLAYWAVE_OBJECTS = @PLAYWAVE_OBJECTS@
3939 PLAYMUS_OBJECTS = @PLAYMUS_OBJECTS@
4040
41 SRC_DIST = LICENSE.txt README.txt CHANGES.txt Android.mk Makefile.in Makefile.os2 SDL2_mixer.pc.in SDL2_mixer.spec.in include/SDL_mixer.h VisualC VisualC-WinRT Xcode Xcode-iOS acinclude autogen.sh build-scripts configure configure.ac external gcc-fat.sh src/utils.c src/utils.h src/effect_position.c src/effect_stereoreverse.c src/effects_internal.c src/effects_internal.h src/codecs/load_aiff.c src/codecs/load_aiff.h src/codecs/load_voc.c src/codecs/load_voc.h src/codecs/mp3utils.c src/codecs/mp3utils.h src/mixer.c src/mixer.h src/music.c src/music.h src/codecs/music_cmd.c src/codecs/music_cmd.h src/codecs/music_flac.c src/codecs/music_flac.h src/codecs/music_fluidsynth.c src/codecs/music_fluidsynth.h src/codecs/music_mad.c src/codecs/music_mad.h src/codecs/music_mikmod.c src/codecs/music_mikmod.h src/codecs/music_modplug.c src/codecs/music_modplug.h src/codecs/music_xmp.c src/codecs/music_xmp.h src/codecs/music_mpg123.c src/codecs/music_mpg123.h src/codecs/music_nativemidi.c src/codecs/music_nativemidi.h src/codecs/music_ogg.c src/codecs/music_ogg.h src/codecs/music_opus.c src/codecs/music_opus.h src/codecs/music_timidity.c src/codecs/music_timidity.h src/codecs/music_wav.c src/codecs/music_wav.h src/codecs/native_midi playmus.c playwave.c src/codecs/timidity version.rc
41 SRC_DIST = LICENSE.txt README.txt CHANGES.txt Android.mk Makefile.in Makefile.os2 SDL2_mixer.pc.in SDL2_mixer.spec.in include/SDL_mixer.h VisualC VisualC-WinRT Xcode acinclude autogen.sh build-scripts configure configure.ac external gcc-fat.sh src/utils.c src/utils.h src/effect_position.c src/effect_stereoreverse.c src/effects_internal.c src/effects_internal.h src/codecs/load_aiff.c src/codecs/load_aiff.h src/codecs/load_voc.c src/codecs/load_voc.h src/codecs/mp3utils.c src/codecs/mp3utils.h src/mixer.c src/mixer.h src/music.c src/music.h src/codecs/music_cmd.c src/codecs/music_cmd.h src/codecs/music_flac.c src/codecs/music_flac.h src/codecs/music_fluidsynth.c src/codecs/music_fluidsynth.h src/codecs/music_mad.c src/codecs/music_mad.h src/codecs/music_mikmod.c src/codecs/music_mikmod.h src/codecs/music_modplug.c src/codecs/music_modplug.h src/codecs/music_xmp.c src/codecs/music_xmp.h src/codecs/music_mpg123.c src/codecs/music_mpg123.h src/codecs/music_nativemidi.c src/codecs/music_nativemidi.h src/codecs/music_ogg.c src/codecs/music_ogg.h src/codecs/music_opus.c src/codecs/music_opus.h src/codecs/music_timidity.c src/codecs/music_timidity.h src/codecs/music_wav.c src/codecs/music_wav.h src/codecs/native_midi playmus.c playwave.c src/codecs/timidity version.rc
4242 GEN_DIST = SDL2_mixer.spec
4343
4444 LT_AGE = @LT_AGE@
124124 $(SHELL) $(auxdir)/mkinstalldirs $(distdir)
125125 (cd $(srcdir); tar cf - $(SRC_DIST)) | (cd $(distdir); tar xf -)
126126 tar cf - $(GEN_DIST) | (cd $(distdir); tar xf -)
127 rm -rf `find $(distdir) -name .svn`
128 rm -f `find $(distdir) -name '.#*'`
129 tar cvf - $(distdir) | gzip --best >$(distfile)
127 -rm -rf `find $(distdir)/external -name '.git*'`
128 -rm -rf `find $(distdir)/external -name '.ci*'`
129 -rm -rf `find $(distdir)/external -name '*.yml'`
130 -rm -rf `find $(distdir)/external -name ci`
131 -rm -f `find $(distdir) -name '.#*'`
132 tar cf - $(distdir) | gzip --best >$(distfile)
130133 rm -rf $(distdir)
131134
132135 rpm: $(distfile)
44 # your own environment!.
55
66 LIBNAME = SDL2mix
7 VERSION = 2.0.4
7 MAJOR_VERSION = 2
8 MINOR_VERSION = 5
9 MICRO_VERSION = 0
10 VERSION = $(MAJOR_VERSION).$(MINOR_VERSION).$(MICRO_VERSION)
811
912 TITLENAME = $(LIBNAME) $(VERSION)
1013
134137 LIBS+= modplug.lib
135138 !endif
136139
140 # For the static assertions in mixer.c
141 CFLAGS+= -DSDL_BUILD_MAJOR_VERSION=$(MAJOR_VERSION)
142 CFLAGS+= -DSDL_BUILD_MINOR_VERSION=$(MINOR_VERSION)
143 CFLAGS+= -DSDL_BUILD_MICRO_VERSION=$(MICRO_VERSION)
144
137145 all: $(DLLFILE) playwave.exe playmus.exe
138146
139147 $(LIBFILE): $(DLLFILE)
00 %define name SDL2_mixer
1 %define version 2.0.4
1 %define version 2.5.0
22 %define release 1
33
44 Summary: Simple DirectMedia Layer - Sample Mixer Library
00 #!/bin/sh
1 #
1
2 set -e
3
24 echo "Generating build information using autoconf"
35 echo "This may take a while ..."
46
5 # Regenerate configuration files
67 cat acinclude/* >aclocal.m4
7 found=false
8 for autoconf in autoconf autoconf259 autoconf-2.59
9 do if which $autoconf >/dev/null 2>&1; then $autoconf && found=true; break; fi
10 done
11 if test x$found = xfalse; then
12 echo "Couldn't find autoconf, aborting"
13 exit 1
14 fi
8 "${AUTOCONF:-autoconf}"
9 rm aclocal.m4
10 rm -rf autom4te.cache
1511
1612 # Run configure for this platform
1713 echo "Now you are ready to run ./configure"
44
55 dnl Set various version strings - taken gratefully from the GTk sources
66
7 # Making releases:
8 # MICRO_VERSION += 1;
9 # INTERFACE_AGE += 1;
10 # BINARY_AGE += 1;
11 # if any functions have been added, set INTERFACE_AGE to 0.
12 # if backwards compatibility has been broken,
13 # set BINARY_AGE and INTERFACE_AGE to 0.
14 #
7 # See release_checklist.md
158 MAJOR_VERSION=2
16 MINOR_VERSION=0
17 MICRO_VERSION=4
18 INTERFACE_AGE=2
19 BINARY_AGE=4
9 MINOR_VERSION=5
10 MICRO_VERSION=0
2011 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION
12
13 BINARY_AGE=`expr $MINOR_VERSION \* 100 + $MICRO_VERSION`
14 AS_CASE(["$MINOR_VERSION"],
15 [*@<:@02468@:>@],
16 dnl Stable branch, 2.6.1 -> libSDL2_mixer-2.0.so.0.600.1
17 [INTERFACE_AGE="$MICRO_VERSION"],
18 [*],
19 dnl Development branch, 2.5.1 -> libSDL2_mixer-2.0.so.0.501.0
20 [INTERFACE_AGE=0])
2121
2222 AC_SUBST(MAJOR_VERSION)
2323 AC_SUBST(MINOR_VERSION)
2929 dnl libtool versioning
3030 LT_INIT([win32-dll])
3131
32 LT_RELEASE=$MAJOR_VERSION.$MINOR_VERSION
33 LT_CURRENT=`expr $MICRO_VERSION - $INTERFACE_AGE`
32 # For historical reasons, the library name redundantly includes the major
33 # version twice: libSDL2_mixer-2.0.so.0.
34 # TODO: in SDL 3, stop using -release, which will simplify it to libSDL3_mixer.so.0
35 LT_RELEASE=2.0
36
37 # Increment this if there is an incompatible change - but if that happens,
38 # we should rename the library from SDL2 to SDL3, at which point this would
39 # reset to 0 anyway.
40 LT_MAJOR=0
41
3442 LT_REVISION=$INTERFACE_AGE
3543 LT_AGE=`expr $BINARY_AGE - $INTERFACE_AGE`
44 LT_CURRENT=`expr $LT_MAJOR + $LT_AGE`
45
3646 LT_EXTRA="" dnl for OS2 dll name
3747 m4_pattern_allow([^LT_])
3848
4151 AC_SUBST(LT_REVISION)
4252 AC_SUBST(LT_AGE)
4353 AC_SUBST(LT_EXTRA)
54
55 dnl For use in static assertions
56 AC_DEFINE_UNQUOTED([SDL_BUILD_MAJOR_VERSION], $MAJOR_VERSION, [ ])
57 AC_DEFINE_UNQUOTED([SDL_BUILD_MINOR_VERSION], $MINOR_VERSION, [ ])
58 AC_DEFINE_UNQUOTED([SDL_BUILD_MICRO_VERSION], $MICRO_VERSION, [ ])
4459
4560 dnl Detect the canonical build and host environments
4661 dnl AC_CANONICAL_HOST
5166 AC_PROG_INSTALL
5267 AC_PROG_MAKE_SET
5368 LT_PROG_RC
69 PKG_PROG_PKG_CONFIG
5470
5571 dnl Set up the compiler and linker flags
5672 case "$host" in
135151 # Look for the location of the tools and install there
136152 if test "$BUILD_PREFIX" != ""; then
137153 ac_default_prefix=$BUILD_PREFIX
154 elif test "$MINGW_PREFIX" != ""; then
155 ac_default_prefix=$MINGW_PREFIX
138156 fi
139157 fi
140158 ;;
150168 SOURCES=`ls $srcdir/src/*.c $srcdir/src/codecs/*.c | fgrep -v playwave.c | fgrep -v playmus.c`
151169
152170 dnl set this to use on systems that use lib64 instead of lib
171 base_bindir=`echo \${bindir} | sed 's/.*\/\(.*\)/\1/; q'`
153172 base_libdir=`echo \${libdir} | sed 's/.*\/\(.*\)/\1/; q'`
154173
155174 dnl See if GCC's -Wall is supported.
219238 if test "$cross_compiling" = yes; then
220239 host_lib_path=""
221240 else
222 host_lib_path="/usr/$base_libdir /usr/local/$base_libdir"
241 host_lib_path="$ac_default_prefix/$base_libdir $ac_default_prefix/$base_bindir /usr/$base_libdir /usr/local/$base_libdir"
223242 fi
224243 for path in $env_lib_path $gcc_bin_path $gcc_lib_path $host_lib_path; do
225244 lib=[`ls -- $path/$1 2>/dev/null | sed -e '/\.so\..*\./d' -e 's,.*/,,' | sort | tail -1`]
707726 flac_lib=[`find_lib libFLAC.dylib`]
708727 ;;
709728 *-*-cygwin* | *-*-mingw*)
710 flac_lib=[`find_lib "libFLAC-*.dll"`]
729 flac_lib=[`find_lib "libFLAC*.dll"`]
711730 ;;
712731 *)
713732 flac_lib=[`find_lib "libFLAC[0-9]*.so.*"`]
3636 /* Printable format: "%d.%d.%d", MAJOR, MINOR, PATCHLEVEL
3737 */
3838 #define SDL_MIXER_MAJOR_VERSION 2
39 #define SDL_MIXER_MINOR_VERSION 0
40 #define SDL_MIXER_PATCHLEVEL 4
39 #define SDL_MIXER_MINOR_VERSION 5
40 #define SDL_MIXER_PATCHLEVEL 0
4141
4242 /* This macro can be used to fill a version structure with the compile-time
4343 * version of the SDL_mixer library.
5555 #define MIX_PATCHLEVEL SDL_MIXER_PATCHLEVEL
5656 #define MIX_VERSION(X) SDL_MIXER_VERSION(X)
5757
58 #if SDL_MIXER_MAJOR_VERSION < 3 && SDL_MAJOR_VERSION < 3
5859 /**
5960 * This is the version number macro for the current SDL_mixer version.
61 *
62 * In versions higher than 2.9.0, the minor version overflows into
63 * the thousands digit: for example, 2.23.0 is encoded as 4300.
64 * This macro will not be available in SDL 3.x or SDL_mixer 3.x.
65 *
66 * Deprecated, use SDL_MIXER_VERSION_ATLEAST or SDL_MIXER_VERSION instead.
6067 */
6168 #define SDL_MIXER_COMPILEDVERSION \
6269 SDL_VERSIONNUM(SDL_MIXER_MAJOR_VERSION, SDL_MIXER_MINOR_VERSION, SDL_MIXER_PATCHLEVEL)
70 #endif /* SDL_MIXER_MAJOR_VERSION < 3 && SDL_MAJOR_VERSION < 3 */
6371
6472 /**
6573 * This macro will evaluate to true if compiled with SDL_mixer at least X.Y.Z.
6674 */
6775 #define SDL_MIXER_VERSION_ATLEAST(X, Y, Z) \
68 (SDL_MIXER_COMPILEDVERSION >= SDL_VERSIONNUM(X, Y, Z))
76 ((SDL_MIXER_MAJOR_VERSION >= X) && \
77 (SDL_MIXER_MAJOR_VERSION > X || SDL_MIXER_MINOR_VERSION >= Y) && \
78 (SDL_MIXER_MAJOR_VERSION > X || SDL_MIXER_MINOR_VERSION > Y || SDL_MIXER_PATCHLEVEL >= Z))
6979
7080 /* This function gets the version of the dynamically linked SDL_mixer library.
7181 it should NOT be used to fill a version structure, instead you should
7676 if (flac.FUNC == NULL) { SDL_UnloadObject(flac.handle); return -1; }
7777 #else
7878 #define FUNCTION_LOADER(FUNC, SIG) \
79 flac.FUNC = FUNC;
79 flac.FUNC = FUNC; \
80 if (flac.FUNC == NULL) { Mix_SetError("Missing FLAC.framework"); return -1; }
8081 #endif
8182
8283 static int FLAC_Load(void)
8586 #ifdef FLAC_DYNAMIC
8687 flac.handle = SDL_LoadObject(FLAC_DYNAMIC);
8788 if (flac.handle == NULL) {
88 return -1;
89 }
90 #elif defined(__MACOSX__)
91 extern FLAC__StreamDecoder *FLAC__stream_decoder_new(void) __attribute__((weak_import));
92 if (FLAC__stream_decoder_new == NULL)
93 {
94 /* Missing weakly linked framework */
95 Mix_SetError("Missing FLAC.framework");
9689 return -1;
9790 }
9891 #endif
7979 if (mikmod.NAME == NULL) { SDL_UnloadObject(mikmod.handle); return -1; }
8080 #else
8181 #define FUNCTION_LOADER(FUNC, SIG) \
82 mikmod.FUNC = FUNC;
82 mikmod.FUNC = FUNC; \
83 if (mikmod.FUNC == NULL) { Mix_SetError("Missing mikmod.framework"); return -1; }
8384 #define VARIABLE_LOADER(NAME, SIG) \
8485 mikmod.NAME = &NAME;
8586 #endif
9091 #ifdef MIKMOD_DYNAMIC
9192 mikmod.handle = SDL_LoadObject(MIKMOD_DYNAMIC);
9293 if (mikmod.handle == NULL) {
93 return -1;
94 }
95 #elif defined(__MACOSX__)
96 extern void Player_Start(MODULE*) __attribute__((weak_import));
97 if (Player_Start == NULL)
98 {
99 /* Missing weakly linked framework */
100 Mix_SetError("Missing mikmod.framework");
10194 return -1;
10295 }
10396 #endif
5656 if (modplug.FUNC == NULL) { SDL_UnloadObject(modplug.handle); return -1; }
5757 #else
5858 #define FUNCTION_LOADER(FUNC, SIG) \
59 modplug.FUNC = FUNC;
59 modplug.FUNC = FUNC; \
60 if (modplug.FUNC == NULL) { Mix_SetError("Missing libmodplug.framework"); return -1; }
6061 #endif
6162
6263 static int MODPLUG_Load(void)
6566 #ifdef MODPLUG_DYNAMIC
6667 modplug.handle = SDL_LoadObject(MODPLUG_DYNAMIC);
6768 if (modplug.handle == NULL) {
68 return -1;
69 }
70 #elif defined(__MACOSX__)
71 extern ModPlugFile* ModPlug_Load(const void* data, int size) __attribute__((weak_import));
72 if (ModPlug_Load == NULL) {
73 /* Missing weakly linked framework */
74 Mix_SetError("Missing modplug.framework");
7569 return -1;
7670 }
7771 #endif
2929 #include "mp3utils.h"
3030
3131 #include <stdio.h> /* For SEEK_SET */
32 #ifdef MPG123_HEADER
33 #include MPG123_HEADER
34 #else
3235 #include <mpg123.h>
36 #endif
3337 #ifdef _MSC_VER
3438 typedef ptrdiff_t MIX_SSIZE_T;
3539 #else
7276 if (mpg123.FUNC == NULL) { SDL_UnloadObject(mpg123.handle); return -1; }
7377 #else
7478 #define FUNCTION_LOADER(FUNC, SIG) \
75 mpg123.FUNC = FUNC;
79 mpg123.FUNC = FUNC; \
80 if (mpg123.FUNC == NULL) { Mix_SetError("Missing mpg123.framework"); return -1; }
7681 #endif
7782
7883 static int MPG123_Load(void)
8186 #ifdef MPG123_DYNAMIC
8287 mpg123.handle = SDL_LoadObject(MPG123_DYNAMIC);
8388 if (mpg123.handle == NULL) {
84 return -1;
85 }
86 #elif defined(__MACOSX__)
87 extern int mpg123_init(void) __attribute__((weak_import));
88 if (mpg123_init == NULL)
89 {
90 /* Missing weakly linked framework */
91 Mix_SetError("Missing mpg123.framework");
9289 return -1;
9390 }
9491 #endif
6868 if (vorbis.FUNC == NULL) { SDL_UnloadObject(vorbis.handle); return -1; }
6969 #else
7070 #define FUNCTION_LOADER(FUNC, SIG) \
71 vorbis.FUNC = FUNC;
71 vorbis.FUNC = FUNC; \
72 if (vorbis.FUNC == NULL) { Mix_SetError("Missing vorbis.framework or tremor.framework"); return -1; }
7273 #endif
7374
7475 static int OGG_Load(void)
7778 #ifdef OGG_DYNAMIC
7879 vorbis.handle = SDL_LoadObject(OGG_DYNAMIC);
7980 if (vorbis.handle == NULL) {
80 return -1;
81 }
82 #elif defined(__MACOSX__)
83 extern int ov_open_callbacks(void*, OggVorbis_File*, const char*, long, ov_callbacks) __attribute__((weak_import));
84 if (ov_open_callbacks == NULL)
85 {
86 /* Missing weakly linked framework */
87 Mix_SetError("Missing Vorbis.framework");
8881 return -1;
8982 }
9083 #endif
177170
178171 static int sdl_seek_func(void *datasource, ogg_int64_t offset, int whence)
179172 {
180 return (int)SDL_RWseek((SDL_RWops*)datasource, offset, whence);
173 return (SDL_RWseek((SDL_RWops*)datasource, offset, whence) < 0)? -1 : 0;
181174 }
182175
183176 static long sdl_tell_func(void *datasource)
2727 #include "music_opus.h"
2828 #include "utils.h"
2929
30 #if defined(OPUS_HEADER)
31 #include OPUS_HEADER
32 #else
3330 #include <opus/opusfile.h>
34 #endif
3531
3632 typedef struct {
3733 int loaded;
5551 if (opus.FUNC == NULL) { SDL_UnloadObject(opus.handle); return -1; }
5652 #else
5753 #define FUNCTION_LOADER(FUNC, SIG) \
58 opus.FUNC = FUNC;
54 opus.FUNC = FUNC; \
55 if (opus.FUNC == NULL) { Mix_SetError("Missing opus.framework"); return -1; }
5956 #endif
6057
6158 static int OPUS_Load(void)
6461 #ifdef OPUS_DYNAMIC
6562 opus.handle = SDL_LoadObject(OPUS_DYNAMIC);
6663 if (opus.handle == NULL) {
67 return -1;
68 }
69 #elif defined(__MACOSX__)
70 extern OggOpusFile *op_open_callbacks(void *,const OpusFileCallbacks *,const unsigned char *,size_t,int *) __attribute__((weak_import));
71 if (op_open_callbacks == NULL) {
72 /* Missing weakly linked framework */
73 Mix_SetError("Missing OpusFile.framework");
7464 return -1;
7565 }
7666 #endif
3131 #endif
3232
3333 /* libxmp >= 4.5.0 constified several funcs */
34 /* and also added load using file callbacks */
3435 #if (XMP_VERCODE < 0x040500)
36 struct xmp_callbacks {
37 unsigned long (*read_func)(void *, unsigned long, unsigned long, void *);
38 int (*seek_func)(void *, long, int);
39 long (*tell_func)(void *);
40 int (*close_func)(void*);
41 };
3542 #define LIBXMP_CONST
3643 #else
3744 #define LIBXMP_CONST const
4350
4451 xmp_context (*xmp_create_context)(void);
4552 int (*xmp_load_module_from_memory)(xmp_context, LIBXMP_CONST void *, long);
53 int (*xmp_load_module_from_callbacks)(xmp_context, void *, struct xmp_callbacks);
4654 int (*xmp_start_player)(xmp_context, int, int);
4755 void (*xmp_end_player)(xmp_context);
4856 void (*xmp_get_module_info)(xmp_context, struct xmp_module_info *);
6371 if (libxmp.FUNC == NULL) { SDL_UnloadObject(libxmp.handle); return -1; }
6472 #else
6573 #define FUNCTION_LOADER(FUNC, SIG) \
66 libxmp.FUNC = FUNC;
74 libxmp.FUNC = FUNC; \
75 if (libxmp.FUNC == NULL) { Mix_SetError("Missing xmp.framework"); return -1; }
6776 #endif
6877
6978 static int XMP_Load(void)
7281 #ifdef XMP_DYNAMIC
7382 libxmp.handle = SDL_LoadObject(XMP_DYNAMIC);
7483 if (libxmp.handle == NULL) {
75 return -1;
76 }
77 #elif defined(__MACOSX__)
78 extern xmp_context xmp_create_context(void) __attribute__((weak_import));
79 if (xmp_create_context == NULL) {
80 /* Missing weakly linked framework */
81 Mix_SetError("Missing xmp.framework");
8284 return -1;
8385 }
8486 #endif
9496 FUNCTION_LOADER(xmp_stop_module, void(*)(xmp_context))
9597 FUNCTION_LOADER(xmp_release_module, void(*)(xmp_context))
9698 FUNCTION_LOADER(xmp_free_context, void(*)(xmp_context))
99 #if defined(XMP_DYNAMIC)
100 libxmp.xmp_load_module_from_callbacks = (int (*)(xmp_context,void*,struct xmp_callbacks)) SDL_LoadFunction(libxmp.handle, "xmp_load_module_from_callbacks");
101 #elif (XMP_VERCODE >= 0x040500)
102 libxmp.xmp_load_module_from_callbacks = xmp_load_module_from_callbacks;
103 #else
104 libxmp.xmp_load_module_from_callbacks = NULL;
105 #endif
97106 }
98107 ++libxmp.loaded;
99108
163172 Mix_SetError("XMP: %s", msg);
164173 }
165174
175 static unsigned long xmp_fread(void *dst, unsigned long len, unsigned long nmemb, void *src) {
176 return SDL_RWread((SDL_RWops*)src, dst, len, nmemb);
177 }
178 static int xmp_fseek(void *src, long offset, int whence) {
179 return (SDL_RWseek((SDL_RWops*)src, offset, whence) < 0)? -1 : 0;
180 }
181 static long xmp_ftell(void *src) {
182 return SDL_RWtell((SDL_RWops*)src);
183 }
184
166185 /* Load a libxmp stream from an SDL_RWops object */
167186 void *XMP_CreateFromRW(SDL_RWops *src, int freesrc)
168187 {
169188 XMP_Music *music;
170 void *mem;
171 size_t size;
172 int err;
189 struct xmp_callbacks file_callbacks = {
190 xmp_fread, xmp_fseek, xmp_ftell, NULL
191 };
192 int err = 0;
173193
174194 music = (XMP_Music *)SDL_calloc(1, sizeof(*music));
175195 if (!music) {
190210 goto e1;
191211 }
192212
193 mem = SDL_LoadFile_RW(src, &size, SDL_FALSE);
194 if (mem) {
213 if (libxmp.xmp_load_module_from_callbacks) {
214 err = libxmp.xmp_load_module_from_callbacks(music->ctx, src, file_callbacks);
215 } else {
216 size_t size;
217 void *mem = SDL_LoadFile_RW(src, &size, SDL_FALSE);
218 if (!mem) {
219 SDL_OutOfMemory();
220 goto e1;
221 }
195222 err = libxmp.xmp_load_module_from_memory(music->ctx, mem, (long)size);
196223 SDL_free(mem);
197 if (err < 0) {
198 libxmp_set_error(err);
199 goto e1;
200 }
201 } else {
202 SDL_OutOfMemory();
224 }
225
226 if (err < 0) {
227 libxmp_set_error(err);
203228 goto e1;
204229 }
205230
+0
-30
src/codecs/timidity/CMakeLists.txt less more
0 cmake_minimum_required(VERSION 2.8.11)
1 project(timidity_sdl C)
2
3 include(${CMAKE_CURRENT_SOURCE_DIR}/../../../external/audio_codec_common.cmake)
4
5 find_package(SDL2 REQUIRED)
6
7 add_library(timidity STATIC
8 common.c
9 instrum.c
10 mix.c
11 output.c
12 playmidi.c
13 readmidi.c
14 resample.c
15 tables.c
16 timidity.c
17 )
18
19 target_include_directories(timidity PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include)
20 target_include_directories(timidity PUBLIC ${SDL2_INCLUDE_DIRS})
21
22 install(TARGETS timidity
23 LIBRARY DESTINATION "lib"
24 ARCHIVE DESTINATION "lib"
25 INCLUDES DESTINATION "include")
26
27 install(FILES
28 timidity.h
29 DESTINATION include/)
3434 #define WAVE 0x45564157 /* "WAVE" */
3535 #define FORM 0x4d524f46 /* "FORM" */
3636 #define CREA 0x61657243 /* "Crea" */
37
38 #if defined(SDL_BUILD_MAJOR_VERSION) && defined(SDL_COMPILE_TIME_ASSERT)
39 SDL_COMPILE_TIME_ASSERT(SDL_BUILD_MAJOR_VERSION,
40 SDL_MIXER_MAJOR_VERSION == SDL_BUILD_MAJOR_VERSION);
41 SDL_COMPILE_TIME_ASSERT(SDL_BUILD_MINOR_VERSION,
42 SDL_MIXER_MINOR_VERSION == SDL_BUILD_MINOR_VERSION);
43 SDL_COMPILE_TIME_ASSERT(SDL_BUILD_MICRO_VERSION,
44 SDL_MIXER_PATCHLEVEL == SDL_BUILD_MICRO_VERSION);
45 #endif
46
47 #if defined(SDL_COMPILE_TIME_ASSERT)
48 SDL_COMPILE_TIME_ASSERT(SDL_MIXER_MAJOR_VERSION_min, SDL_MIXER_MAJOR_VERSION >= 0);
49 /* Limited only by the need to fit in SDL_version */
50 SDL_COMPILE_TIME_ASSERT(SDL_MIXER_MAJOR_VERSION_max, SDL_MIXER_MAJOR_VERSION <= 255);
51
52 SDL_COMPILE_TIME_ASSERT(SDL_MIXER_MINOR_VERSION_min, SDL_MIXER_MINOR_VERSION >= 0);
53 /* Limited only by the need to fit in SDL_version */
54 SDL_COMPILE_TIME_ASSERT(SDL_MIXER_MINOR_VERSION_max, SDL_MIXER_MINOR_VERSION <= 255);
55
56 SDL_COMPILE_TIME_ASSERT(SDL_MIXER_PATCHLEVEL_min, SDL_MIXER_PATCHLEVEL >= 0);
57 /* Limited by its encoding in SDL_VERSIONNUM and in the ABI versions */
58 SDL_COMPILE_TIME_ASSERT(SDL_MIXER_PATCHLEVEL_max, SDL_MIXER_PATCHLEVEL <= 99);
59 #endif
3760
3861 static int audio_opened = 0;
3962 static SDL_AudioSpec mixer;
88 //
99
1010 VS_VERSION_INFO VERSIONINFO
11 FILEVERSION 2,0,4,0
12 PRODUCTVERSION 2,0,4,0
11 FILEVERSION 2,5,0,0
12 PRODUCTVERSION 2,5,0,0
1313 FILEFLAGSMASK 0x3fL
1414 FILEFLAGS 0x0L
1515 FILEOS 0x40004L
2222 BEGIN
2323 VALUE "CompanyName", "\0"
2424 VALUE "FileDescription", "SDL_mixer\0"
25 VALUE "FileVersion", "2, 0, 4, 0\0"
25 VALUE "FileVersion", "2, 5, 0, 0\0"
2626 VALUE "InternalName", "SDL_mixer\0"
2727 VALUE "LegalCopyright", "Copyright © 2022 Sam Lantinga\0"
2828 VALUE "OriginalFilename", "SDL_mixer.dll\0"
2929 VALUE "ProductName", "Simple DirectMedia Layer\0"
30 VALUE "ProductVersion", "2, 0, 4, 0\0"
30 VALUE "ProductVersion", "2, 5, 0, 0\0"
3131 END
3232 END
3333 BLOCK "VarFileInfo"