Imported Upstream version 2.0.1+dfsg1
Manuel A. Fernandez Montecelo
7 years ago
5 | 5 | |
6 | 6 | # Enable this if you want to support loading MOD music via modplug |
7 | 7 | # The library path should be a relative path to this directory. |
8 | SUPPORT_MOD_MODPLUG := true | |
8 | SUPPORT_MOD_MODPLUG ?= true | |
9 | 9 | MODPLUG_LIBRARY_PATH := external/libmodplug-0.8.8.4 |
10 | 10 | |
11 | 11 | # Enable this if you want to support loading MOD music via mikmod |
12 | 12 | # The library path should be a relative path to this directory. |
13 | SUPPORT_MOD_MIKMOD := true | |
13 | SUPPORT_MOD_MIKMOD ?= true | |
14 | 14 | MIKMOD_LIBRARY_PATH := external/libmikmod-3.1.12 |
15 | 15 | |
16 | 16 | # Enable this if you want to support loading MP3 music via SMPEG |
17 | 17 | # The library path should be a relative path to this directory. |
18 | SUPPORT_MP3_SMPEG := true | |
18 | SUPPORT_MP3_SMPEG ?= true | |
19 | 19 | SMPEG_LIBRARY_PATH := external/smpeg2-2.0.0 |
20 | 20 | |
21 | 21 | # Enable this if you want to support loading OGG Vorbis music via Tremor |
22 | 22 | # The library path should be a relative path to this directory. |
23 | SUPPORT_OGG := true | |
23 | SUPPORT_OGG ?= true | |
24 | 24 | OGG_LIBRARY_PATH := external/libogg-1.3.1 |
25 | 25 | VORBIS_LIBRARY_PATH := external/libvorbisidec-1.2.1 |
26 | 26 | |
27 | 27 | |
28 | LOCAL_C_INCLUDES := $(LOCAL_PATH) | |
29 | LOCAL_CFLAGS := -DWAV_MUSIC | |
28 | # Enable this if you want to support TiMidity | |
29 | SUPPORT_TIMIDITY ?= true | |
30 | 30 | |
31 | LOCAL_SRC_FILES := $(notdir $(filter-out %/playmus.c %/playwave.c, $(wildcard $(LOCAL_PATH)/*.c))) | |
31 | LOCAL_C_INCLUDES := $(LOCAL_PATH) | |
32 | LOCAL_CFLAGS := -DWAV_MUSIC | |
33 | ||
34 | LOCAL_SRC_FILES := $(notdir $(filter-out %/playmus.c %/playwave.c, $(wildcard $(LOCAL_PATH)/*.c))) \ | |
35 | ||
32 | 36 | |
33 | 37 | LOCAL_LDLIBS := |
34 | 38 | LOCAL_STATIC_LIBRARIES := |
35 | 39 | LOCAL_SHARED_LIBRARIES := SDL2 |
36 | 40 | |
41 | ifeq ($(SUPPORT_TIMIDITY),true) | |
42 | LOCAL_C_INCLUDES += $(LOCAL_PATH)/timidity | |
43 | LOCAL_CFLAGS += -DMID_MUSIC -DUSE_TIMIDITY_MIDI | |
44 | LOCAL_SRC_FILES += $(subst $(LOCAL_PATH)/,,$(wildcard $(LOCAL_PATH)/timidity/*.c)) | |
45 | endif | |
46 | ||
37 | 47 | ifeq ($(SUPPORT_MOD_MODPLUG),true) |
38 | 48 | LOCAL_C_INCLUDES += $(LOCAL_PATH)/$(MODPLUG_LIBRARY_PATH)/src $(LOCAL_PATH)/$(MODPLUG_LIBRARY_PATH)/src/libmodplug |
39 | LOCAL_CFLAGS += -DMODPLUG_MUSIC -DHAVE_SETENV -DHAVE_SINF | |
49 | LOCAL_CFLAGS += -DMODPLUG_MUSIC -DMODPLUG_HEADER="<modplug.h>" -DHAVE_SETENV -DHAVE_SINF | |
40 | 50 | LOCAL_SRC_FILES += \ |
41 | 51 | $(MODPLUG_LIBRARY_PATH)/src/fastmix.cpp \ |
42 | 52 | $(MODPLUG_LIBRARY_PATH)/src/load_669.cpp \ |
88 | 98 | |
89 | 99 | ifeq ($(SUPPORT_OGG),true) |
90 | 100 | LOCAL_C_INCLUDES += $(LOCAL_PATH)/$(OGG_LIBRARY_PATH)/include $(LOCAL_PATH)/$(VORBIS_LIBRARY_PATH) |
91 | LOCAL_CFLAGS += -DOGG_MUSIC -DOGG_USE_TREMOR | |
101 | LOCAL_CFLAGS += -DOGG_MUSIC -DOGG_USE_TREMOR -DOGG_HEADER="<ivorbisfile.h>" | |
102 | ifeq ($(TARGET_ARCH_ABI),armeabi) | |
103 | LOCAL_CFLAGS += -D_ARM_ASSEM_ | |
104 | endif | |
105 | ifeq ($(TARGET_ARCH_ABI),armeabi-v7a) | |
106 | LOCAL_CFLAGS += -D_ARM_ASSEM_ | |
107 | endif | |
92 | 108 | LOCAL_SRC_FILES += \ |
93 | 109 | $(VORBIS_LIBRARY_PATH)/mdct.c \ |
94 | 110 | $(VORBIS_LIBRARY_PATH)/block.c \ |
109 | 125 | |
110 | 126 | LOCAL_EXPORT_C_INCLUDES += $(LOCAL_C_INCLUDES) |
111 | 127 | |
128 | LOCAL_ARM_MODE := arm | |
129 | ||
112 | 130 | include $(BUILD_SHARED_LIBRARY) |
0 | 2.0.1: | |
1 | Sam Lantinga - Tue Jul 7 11:40:33 PDT 2015 | |
2 | * Added support for 'smpl' format loop points in music WAV files | |
3 | Sam Lantinga - Sat Aug 23 10:57:26 2014 | |
4 | * Fixed floating point exception in Mix_Volume() | |
5 | David Ludwig - Mon Apr 14 22:15:36 2014 | |
6 | * Added support for building for Windows RT and Windows Phone | |
7 | Isaac Burns - Sun Sep 15 21:50:27 PDT 2013 | |
8 | * Added support for loading MP3 files as sound chunks | |
9 | ||
0 | 10 | 2.0.0: |
1 | 11 | Sam Lantinga - Sun Jun 9 14:45:30 PDT 2013 |
2 | 12 | * Made libmodplug the default MOD player as it is now in the public domain |
0 | 0 | /* |
1 | 1 | SDL_mixer: An audio mixer library based on the SDL library |
2 | Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org> | |
2 | Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org> | |
3 | 3 | |
4 | 4 | This software is provided 'as-is', without any express or implied |
5 | 5 | warranty. In no event will the authors be held liable for any damages |
38 | 38 | PLAYWAVE_OBJECTS = @PLAYWAVE_OBJECTS@ |
39 | 39 | PLAYMUS_OBJECTS = @PLAYMUS_OBJECTS@ |
40 | 40 | |
41 | DIST = *.txt Android.mk Makefile.in SDL2_mixer.pc.in SDL_mixer.h SDL2_mixer.spec SDL2_mixer.spec.in debian VisualC Xcode Xcode-iOS acinclude autogen.sh build-scripts configure configure.in dynamic_flac.c dynamic_flac.h dynamic_fluidsynth.c dynamic_fluidsynth.h dynamic_modplug.c dynamic_modplug.h dynamic_mod.c dynamic_mod.h dynamic_mp3.c dynamic_mp3.h dynamic_ogg.c dynamic_ogg.h effect_position.c effect_stereoreverse.c effects_internal.c effects_internal.h fluidsynth.c fluidsynth.h external gcc-fat.sh libmikmod-3.1.12.zip load_aiff.c load_aiff.h load_flac.c load_flac.h load_ogg.c load_ogg.h load_voc.c load_voc.h mixer.c music.c music_cmd.c music_cmd.h music_flac.c music_flac.h music_mad.c music_mad.h music_mod.c music_mod.h music_modplug.c music_modplug.h music_ogg.c music_ogg.h native_midi playmus.c playwave.c timidity wavestream.c wavestream.h version.rc | |
41 | DIST = *.txt Android.mk Makefile.in SDL2_mixer.pc.in SDL_mixer.h SDL2_mixer.spec SDL2_mixer.spec.in debian VisualC Xcode Xcode-iOS acinclude autogen.sh build-scripts configure configure.in dynamic_flac.c dynamic_flac.h dynamic_fluidsynth.c dynamic_fluidsynth.h dynamic_modplug.c dynamic_modplug.h dynamic_mod.c dynamic_mod.h dynamic_mp3.c dynamic_mp3.h dynamic_ogg.c dynamic_ogg.h effect_position.c effect_stereoreverse.c effects_internal.c effects_internal.h fluidsynth.c fluidsynth.h external gcc-fat.sh libmikmod-3.1.12.zip load_aiff.c load_aiff.h load_flac.c load_flac.h load_mp3.c load_mp3.h load_ogg.c load_ogg.h load_voc.c load_voc.h mixer.c music.c music_cmd.c music_cmd.h music_flac.c music_flac.h music_mad.c music_mad.h music_mod.c music_mod.h music_modplug.c music_modplug.h music_ogg.c music_ogg.h native_midi playmus.c playwave.c timidity wavestream.c wavestream.h version.rc | |
42 | 42 | |
43 | 43 | LT_AGE = @LT_AGE@ |
44 | 44 | LT_CURRENT = @LT_CURRENT@ |
0 | 0 | %define name SDL2_mixer |
1 | %define version 2.0.0 | |
1 | %define version 2.0.1 | |
2 | 2 | %define release 1 |
3 | 3 | |
4 | 4 | Summary: Simple DirectMedia Layer - Sample Mixer Library |
44 | 44 | |
45 | 45 | %files |
46 | 46 | %defattr(-,root,root) |
47 | %doc README CHANGES COPYING | |
47 | %doc README.txt CHANGES.txt COPYING.txt | |
48 | 48 | %{prefix}/lib/lib*.so.* |
49 | 49 | |
50 | 50 | %files devel |
0 | 0 | /* |
1 | 1 | SDL_mixer: An audio mixer library based on the SDL library |
2 | Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org> | |
2 | Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org> | |
3 | 3 | |
4 | 4 | This software is provided 'as-is', without any express or implied |
5 | 5 | warranty. In no event will the authors be held liable for any damages |
39 | 39 | */ |
40 | 40 | #define SDL_MIXER_MAJOR_VERSION 2 |
41 | 41 | #define SDL_MIXER_MINOR_VERSION 0 |
42 | #define SDL_MIXER_PATCHLEVEL 0 | |
42 | #define SDL_MIXER_PATCHLEVEL 1 | |
43 | 43 | |
44 | 44 | /* This macro can be used to fill a version structure with the compile-time |
45 | 45 | * version of the SDL_mixer library. |
206 | 206 | */ |
207 | 207 | extern DECLSPEC void SDLCALL Mix_HookMusic(void (*mix_func)(void *udata, Uint8 *stream, int len), void *arg); |
208 | 208 | |
209 | /* Add your own callback when the music has finished playing. | |
210 | This callback is only called if the music finishes naturally. | |
209 | /* Add your own callback for when the music has finished playing or when it is | |
210 | * stopped from a call to Mix_HaltMusic. | |
211 | 211 | */ |
212 | 212 | extern DECLSPEC void SDLCALL Mix_HookMusicFinished(void (*music_finished)(void)); |
213 | 213 |
0 | 0 | #! /bin/sh |
1 | 1 | # Attempt to guess a canonical system name. |
2 | 2 | # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, |
3 | # 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 | |
4 | # Free Software Foundation, Inc. | |
5 | ||
6 | timestamp='2009-09-18' | |
3 | # 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, | |
4 | # 2011, 2012 Free Software Foundation, Inc. | |
5 | ||
6 | timestamp='2012-08-14' | |
7 | 7 | |
8 | 8 | # This file is free software; you can redistribute it and/or modify it |
9 | 9 | # under the terms of the GNU General Public License as published by |
16 | 16 | # General Public License for more details. |
17 | 17 | # |
18 | 18 | # You should have received a copy of the GNU General Public License |
19 | # along with this program; if not, write to the Free Software | |
20 | # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA | |
21 | # 02110-1301, USA. | |
19 | # along with this program; if not, see <http://www.gnu.org/licenses/>. | |
22 | 20 | # |
23 | 21 | # As a special exception to the GNU General Public License, if you |
24 | 22 | # distribute this file as part of a program that contains a |
55 | 53 | GNU config.guess ($timestamp) |
56 | 54 | |
57 | 55 | Originally written by Per Bothner. |
58 | Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, | |
59 | 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. | |
56 | Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, | |
57 | 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 | |
58 | Free Software Foundation, Inc. | |
60 | 59 | |
61 | 60 | This is free software; see the source for copying conditions. There is NO |
62 | 61 | warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." |
143 | 142 | case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in |
144 | 143 | *:NetBSD:*:*) |
145 | 144 | # NetBSD (nbsd) targets should (where applicable) match one or |
146 | # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, | |
145 | # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, | |
147 | 146 | # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently |
148 | 147 | # switched to ELF, *-*-netbsd* would select the old |
149 | 148 | # object file format. This provides both forward |
179 | 178 | fi |
180 | 179 | ;; |
181 | 180 | *) |
182 | os=netbsd | |
181 | os=netbsd | |
183 | 182 | ;; |
184 | 183 | esac |
185 | 184 | # The OS release |
200 | 199 | # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. |
201 | 200 | echo "${machine}-${os}${release}" |
202 | 201 | exit ;; |
202 | *:Bitrig:*:*) | |
203 | UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` | |
204 | echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE} | |
205 | exit ;; | |
203 | 206 | *:OpenBSD:*:*) |
204 | 207 | UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` |
205 | 208 | echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} |
222 | 225 | UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` |
223 | 226 | ;; |
224 | 227 | *5.*) |
225 | UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` | |
228 | UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` | |
226 | 229 | ;; |
227 | 230 | esac |
228 | 231 | # According to Compaq, /usr/sbin/psrinfo has been available on |
268 | 271 | # A Xn.n version is an unreleased experimental baselevel. |
269 | 272 | # 1.2 uses "1.2" for uname -r. |
270 | 273 | echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` |
271 | exit ;; | |
274 | # Reset EXIT trap before exiting to avoid spurious non-zero exit code. | |
275 | exitcode=$? | |
276 | trap '' 0 | |
277 | exit $exitcode ;; | |
272 | 278 | Alpha\ *:Windows_NT*:*) |
273 | 279 | # How do we know it's Interix rather than the generic POSIX subsystem? |
274 | 280 | # Should we change UNAME_MACHINE based on the output of uname instead |
294 | 300 | echo s390-ibm-zvmoe |
295 | 301 | exit ;; |
296 | 302 | *:OS400:*:*) |
297 | echo powerpc-ibm-os400 | |
303 | echo powerpc-ibm-os400 | |
298 | 304 | exit ;; |
299 | 305 | arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) |
300 | 306 | echo arm-acorn-riscix${UNAME_RELEASE} |
331 | 337 | exit ;; |
332 | 338 | sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) |
333 | 339 | echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` |
340 | exit ;; | |
341 | i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) | |
342 | echo i386-pc-auroraux${UNAME_RELEASE} | |
334 | 343 | exit ;; |
335 | 344 | i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) |
336 | 345 | eval $set_cc_for_build |
390 | 399 | # MiNT. But MiNT is downward compatible to TOS, so this should |
391 | 400 | # be no problem. |
392 | 401 | atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) |
393 | echo m68k-atari-mint${UNAME_RELEASE} | |
402 | echo m68k-atari-mint${UNAME_RELEASE} | |
394 | 403 | exit ;; |
395 | 404 | atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) |
396 | 405 | echo m68k-atari-mint${UNAME_RELEASE} |
397 | exit ;; | |
406 | exit ;; | |
398 | 407 | *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) |
399 | echo m68k-atari-mint${UNAME_RELEASE} | |
408 | echo m68k-atari-mint${UNAME_RELEASE} | |
400 | 409 | exit ;; |
401 | 410 | milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) |
402 | echo m68k-milan-mint${UNAME_RELEASE} | |
403 | exit ;; | |
411 | echo m68k-milan-mint${UNAME_RELEASE} | |
412 | exit ;; | |
404 | 413 | hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) |
405 | echo m68k-hades-mint${UNAME_RELEASE} | |
406 | exit ;; | |
414 | echo m68k-hades-mint${UNAME_RELEASE} | |
415 | exit ;; | |
407 | 416 | *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) |
408 | echo m68k-unknown-mint${UNAME_RELEASE} | |
409 | exit ;; | |
417 | echo m68k-unknown-mint${UNAME_RELEASE} | |
418 | exit ;; | |
410 | 419 | m68k:machten:*:*) |
411 | 420 | echo m68k-apple-machten${UNAME_RELEASE} |
412 | 421 | exit ;; |
476 | 485 | echo m88k-motorola-sysv3 |
477 | 486 | exit ;; |
478 | 487 | AViiON:dgux:*:*) |
479 | # DG/UX returns AViiON for all architectures | |
480 | UNAME_PROCESSOR=`/usr/bin/uname -p` | |
488 | # DG/UX returns AViiON for all architectures | |
489 | UNAME_PROCESSOR=`/usr/bin/uname -p` | |
481 | 490 | if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] |
482 | 491 | then |
483 | 492 | if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ |
490 | 499 | else |
491 | 500 | echo i586-dg-dgux${UNAME_RELEASE} |
492 | 501 | fi |
493 | exit ;; | |
502 | exit ;; | |
494 | 503 | M88*:DolphinOS:*:*) # DolphinOS (SVR3) |
495 | 504 | echo m88k-dolphin-sysv3 |
496 | 505 | exit ;; |
547 | 556 | echo rs6000-ibm-aix3.2 |
548 | 557 | fi |
549 | 558 | exit ;; |
550 | *:AIX:*:[456]) | |
559 | *:AIX:*:[4567]) | |
551 | 560 | IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` |
552 | 561 | if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then |
553 | 562 | IBM_ARCH=rs6000 |
590 | 599 | 9000/[678][0-9][0-9]) |
591 | 600 | if [ -x /usr/bin/getconf ]; then |
592 | 601 | sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` |
593 | sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` | |
594 | case "${sc_cpu_version}" in | |
595 | 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 | |
596 | 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 | |
597 | 532) # CPU_PA_RISC2_0 | |
598 | case "${sc_kernel_bits}" in | |
599 | 32) HP_ARCH="hppa2.0n" ;; | |
600 | 64) HP_ARCH="hppa2.0w" ;; | |
602 | sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` | |
603 | case "${sc_cpu_version}" in | |
604 | 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 | |
605 | 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 | |
606 | 532) # CPU_PA_RISC2_0 | |
607 | case "${sc_kernel_bits}" in | |
608 | 32) HP_ARCH="hppa2.0n" ;; | |
609 | 64) HP_ARCH="hppa2.0w" ;; | |
601 | 610 | '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 |
602 | esac ;; | |
603 | esac | |
611 | esac ;; | |
612 | esac | |
604 | 613 | fi |
605 | 614 | if [ "${HP_ARCH}" = "" ]; then |
606 | 615 | eval $set_cc_for_build |
607 | sed 's/^ //' << EOF >$dummy.c | |
608 | ||
609 | #define _HPUX_SOURCE | |
610 | #include <stdlib.h> | |
611 | #include <unistd.h> | |
612 | ||
613 | int main () | |
614 | { | |
615 | #if defined(_SC_KERNEL_BITS) | |
616 | long bits = sysconf(_SC_KERNEL_BITS); | |
617 | #endif | |
618 | long cpu = sysconf (_SC_CPU_VERSION); | |
619 | ||
620 | switch (cpu) | |
621 | { | |
622 | case CPU_PA_RISC1_0: puts ("hppa1.0"); break; | |
623 | case CPU_PA_RISC1_1: puts ("hppa1.1"); break; | |
624 | case CPU_PA_RISC2_0: | |
625 | #if defined(_SC_KERNEL_BITS) | |
626 | switch (bits) | |
627 | { | |
628 | case 64: puts ("hppa2.0w"); break; | |
629 | case 32: puts ("hppa2.0n"); break; | |
630 | default: puts ("hppa2.0"); break; | |
631 | } break; | |
632 | #else /* !defined(_SC_KERNEL_BITS) */ | |
633 | puts ("hppa2.0"); break; | |
634 | #endif | |
635 | default: puts ("hppa1.0"); break; | |
636 | } | |
637 | exit (0); | |
638 | } | |
616 | sed 's/^ //' << EOF >$dummy.c | |
617 | ||
618 | #define _HPUX_SOURCE | |
619 | #include <stdlib.h> | |
620 | #include <unistd.h> | |
621 | ||
622 | int main () | |
623 | { | |
624 | #if defined(_SC_KERNEL_BITS) | |
625 | long bits = sysconf(_SC_KERNEL_BITS); | |
626 | #endif | |
627 | long cpu = sysconf (_SC_CPU_VERSION); | |
628 | ||
629 | switch (cpu) | |
630 | { | |
631 | case CPU_PA_RISC1_0: puts ("hppa1.0"); break; | |
632 | case CPU_PA_RISC1_1: puts ("hppa1.1"); break; | |
633 | case CPU_PA_RISC2_0: | |
634 | #if defined(_SC_KERNEL_BITS) | |
635 | switch (bits) | |
636 | { | |
637 | case 64: puts ("hppa2.0w"); break; | |
638 | case 32: puts ("hppa2.0n"); break; | |
639 | default: puts ("hppa2.0"); break; | |
640 | } break; | |
641 | #else /* !defined(_SC_KERNEL_BITS) */ | |
642 | puts ("hppa2.0"); break; | |
643 | #endif | |
644 | default: puts ("hppa1.0"); break; | |
645 | } | |
646 | exit (0); | |
647 | } | |
639 | 648 | EOF |
640 | 649 | (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` |
641 | 650 | test -z "$HP_ARCH" && HP_ARCH=hppa |
726 | 735 | exit ;; |
727 | 736 | C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) |
728 | 737 | echo c1-convex-bsd |
729 | exit ;; | |
738 | exit ;; | |
730 | 739 | C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) |
731 | 740 | if getsysinfo -f scalar_acc |
732 | 741 | then echo c32-convex-bsd |
733 | 742 | else echo c2-convex-bsd |
734 | 743 | fi |
735 | exit ;; | |
744 | exit ;; | |
736 | 745 | C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) |
737 | 746 | echo c34-convex-bsd |
738 | exit ;; | |
747 | exit ;; | |
739 | 748 | C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) |
740 | 749 | echo c38-convex-bsd |
741 | exit ;; | |
750 | exit ;; | |
742 | 751 | C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) |
743 | 752 | echo c4-convex-bsd |
744 | exit ;; | |
753 | exit ;; | |
745 | 754 | CRAY*Y-MP:*:*:*) |
746 | 755 | echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' |
747 | 756 | exit ;; |
765 | 774 | exit ;; |
766 | 775 | F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) |
767 | 776 | FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` |
768 | FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` | |
769 | FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` | |
770 | echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" | |
771 | exit ;; | |
777 | FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` | |
778 | FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` | |
779 | echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" | |
780 | exit ;; | |
772 | 781 | 5000:UNIX_System_V:4.*:*) |
773 | FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` | |
774 | FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` | |
775 | echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" | |
782 | FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` | |
783 | FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` | |
784 | echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" | |
776 | 785 | exit ;; |
777 | 786 | i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) |
778 | 787 | echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} |
784 | 793 | echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} |
785 | 794 | exit ;; |
786 | 795 | *:FreeBSD:*:*) |
787 | case ${UNAME_MACHINE} in | |
788 | pc98) | |
789 | echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; | |
796 | UNAME_PROCESSOR=`/usr/bin/uname -p` | |
797 | case ${UNAME_PROCESSOR} in | |
790 | 798 | amd64) |
791 | 799 | echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; |
792 | 800 | *) |
793 | echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; | |
801 | echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; | |
794 | 802 | esac |
795 | 803 | exit ;; |
796 | 804 | i*:CYGWIN*:*) |
797 | 805 | echo ${UNAME_MACHINE}-pc-cygwin |
798 | 806 | exit ;; |
807 | *:MINGW64*:*) | |
808 | echo ${UNAME_MACHINE}-pc-mingw64 | |
809 | exit ;; | |
799 | 810 | *:MINGW*:*) |
800 | 811 | echo ${UNAME_MACHINE}-pc-mingw32 |
801 | 812 | exit ;; |
813 | i*:MSYS*:*) | |
814 | echo ${UNAME_MACHINE}-pc-msys | |
815 | exit ;; | |
802 | 816 | i*:windows32*:*) |
803 | # uname -m includes "-pc" on this system. | |
804 | echo ${UNAME_MACHINE}-mingw32 | |
817 | # uname -m includes "-pc" on this system. | |
818 | echo ${UNAME_MACHINE}-mingw32 | |
805 | 819 | exit ;; |
806 | 820 | i*:PW*:*) |
807 | 821 | echo ${UNAME_MACHINE}-pc-pw32 |
808 | 822 | exit ;; |
809 | *:Interix*:[3456]*) | |
810 | case ${UNAME_MACHINE} in | |
823 | *:Interix*:*) | |
824 | case ${UNAME_MACHINE} in | |
811 | 825 | x86) |
812 | 826 | echo i586-pc-interix${UNAME_RELEASE} |
813 | 827 | exit ;; |
814 | EM64T | authenticamd | genuineintel) | |
828 | authenticamd | genuineintel | EM64T) | |
815 | 829 | echo x86_64-unknown-interix${UNAME_RELEASE} |
816 | 830 | exit ;; |
817 | 831 | IA64) |
852 | 866 | exit ;; |
853 | 867 | i*86:Minix:*:*) |
854 | 868 | echo ${UNAME_MACHINE}-pc-minix |
869 | exit ;; | |
870 | aarch64:Linux:*:*) | |
871 | echo ${UNAME_MACHINE}-unknown-linux-gnu | |
872 | exit ;; | |
873 | aarch64_be:Linux:*:*) | |
874 | UNAME_MACHINE=aarch64_be | |
875 | echo ${UNAME_MACHINE}-unknown-linux-gnu | |
855 | 876 | exit ;; |
856 | 877 | alpha:Linux:*:*) |
857 | 878 | case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in |
862 | 883 | EV6) UNAME_MACHINE=alphaev6 ;; |
863 | 884 | EV67) UNAME_MACHINE=alphaev67 ;; |
864 | 885 | EV68*) UNAME_MACHINE=alphaev68 ;; |
865 | esac | |
886 | esac | |
866 | 887 | objdump --private-headers /bin/sh | grep -q ld.so.1 |
867 | 888 | if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi |
868 | 889 | echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} |
874 | 895 | then |
875 | 896 | echo ${UNAME_MACHINE}-unknown-linux-gnu |
876 | 897 | else |
877 | echo ${UNAME_MACHINE}-unknown-linux-gnueabi | |
898 | case `sed -n '/^Hardware/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in | |
899 | BCM2708) MANUFACTURER=raspberry;; | |
900 | *) MANUFACTURER=unknown;; | |
901 | esac | |
902 | if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ | |
903 | | grep -q __ARM_PCS_VFP | |
904 | then | |
905 | echo ${UNAME_MACHINE}-${MANUFACTURER}-linux-gnueabi | |
906 | else | |
907 | echo ${UNAME_MACHINE}-${MANUFACTURER}-linux-gnueabihf | |
908 | fi | |
878 | 909 | fi |
879 | 910 | exit ;; |
880 | 911 | avr32*:Linux:*:*) |
881 | 912 | echo ${UNAME_MACHINE}-unknown-linux-gnu |
882 | 913 | exit ;; |
883 | 914 | cris:Linux:*:*) |
884 | echo cris-axis-linux-gnu | |
915 | echo ${UNAME_MACHINE}-axis-linux-gnu | |
885 | 916 | exit ;; |
886 | 917 | crisv32:Linux:*:*) |
887 | echo crisv32-axis-linux-gnu | |
918 | echo ${UNAME_MACHINE}-axis-linux-gnu | |
888 | 919 | exit ;; |
889 | 920 | frv:Linux:*:*) |
890 | echo frv-unknown-linux-gnu | |
921 | echo ${UNAME_MACHINE}-unknown-linux-gnu | |
922 | exit ;; | |
923 | hexagon:Linux:*:*) | |
924 | echo ${UNAME_MACHINE}-unknown-linux-gnu | |
891 | 925 | exit ;; |
892 | 926 | i*86:Linux:*:*) |
893 | echo ${UNAME_MACHINE}-pc-linux-gnu | |
927 | LIBC=gnu | |
928 | eval $set_cc_for_build | |
929 | sed 's/^ //' << EOF >$dummy.c | |
930 | #ifdef __dietlibc__ | |
931 | LIBC=dietlibc | |
932 | #endif | |
933 | EOF | |
934 | eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'` | |
935 | echo "${UNAME_MACHINE}-pc-linux-${LIBC}" | |
894 | 936 | exit ;; |
895 | 937 | ia64:Linux:*:*) |
896 | 938 | echo ${UNAME_MACHINE}-unknown-linux-gnu |
917 | 959 | #endif |
918 | 960 | #endif |
919 | 961 | EOF |
920 | eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' | |
921 | /^CPU/{ | |
922 | s: ::g | |
923 | p | |
924 | }'`" | |
962 | eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` | |
925 | 963 | test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } |
926 | 964 | ;; |
927 | 965 | or32:Linux:*:*) |
928 | echo or32-unknown-linux-gnu | |
966 | echo ${UNAME_MACHINE}-unknown-linux-gnu | |
929 | 967 | exit ;; |
930 | 968 | padre:Linux:*:*) |
931 | 969 | echo sparc-unknown-linux-gnu |
951 | 989 | echo ${UNAME_MACHINE}-ibm-linux |
952 | 990 | exit ;; |
953 | 991 | sh64*:Linux:*:*) |
954 | echo ${UNAME_MACHINE}-unknown-linux-gnu | |
992 | echo ${UNAME_MACHINE}-unknown-linux-gnu | |
955 | 993 | exit ;; |
956 | 994 | sh*:Linux:*:*) |
957 | 995 | echo ${UNAME_MACHINE}-unknown-linux-gnu |
959 | 997 | sparc:Linux:*:* | sparc64:Linux:*:*) |
960 | 998 | echo ${UNAME_MACHINE}-unknown-linux-gnu |
961 | 999 | exit ;; |
1000 | tile*:Linux:*:*) | |
1001 | echo ${UNAME_MACHINE}-unknown-linux-gnu | |
1002 | exit ;; | |
962 | 1003 | vax:Linux:*:*) |
963 | 1004 | echo ${UNAME_MACHINE}-dec-linux-gnu |
964 | 1005 | exit ;; |
965 | 1006 | x86_64:Linux:*:*) |
966 | echo x86_64-unknown-linux-gnu | |
1007 | echo ${UNAME_MACHINE}-unknown-linux-gnu | |
967 | 1008 | exit ;; |
968 | 1009 | xtensa*:Linux:*:*) |
969 | echo ${UNAME_MACHINE}-unknown-linux-gnu | |
1010 | echo ${UNAME_MACHINE}-unknown-linux-gnu | |
970 | 1011 | exit ;; |
971 | 1012 | i*86:DYNIX/ptx:4*:*) |
972 | 1013 | # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. |
975 | 1016 | echo i386-sequent-sysv4 |
976 | 1017 | exit ;; |
977 | 1018 | i*86:UNIX_SV:4.2MP:2.*) |
978 | # Unixware is an offshoot of SVR4, but it has its own version | |
979 | # number series starting with 2... | |
980 | # I am not positive that other SVR4 systems won't match this, | |
1019 | # Unixware is an offshoot of SVR4, but it has its own version | |
1020 | # number series starting with 2... | |
1021 | # I am not positive that other SVR4 systems won't match this, | |
981 | 1022 | # I just have to hope. -- rms. |
982 | # Use sysv4.2uw... so that sysv4* matches it. | |
1023 | # Use sysv4.2uw... so that sysv4* matches it. | |
983 | 1024 | echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} |
984 | 1025 | exit ;; |
985 | 1026 | i*86:OS/2:*:*) |
1011 | 1052 | fi |
1012 | 1053 | exit ;; |
1013 | 1054 | i*86:*:5:[678]*) |
1014 | # UnixWare 7.x, OpenUNIX and OpenServer 6. | |
1055 | # UnixWare 7.x, OpenUNIX and OpenServer 6. | |
1015 | 1056 | case `/bin/uname -X | grep "^Machine"` in |
1016 | 1057 | *486*) UNAME_MACHINE=i486 ;; |
1017 | 1058 | *Pentium) UNAME_MACHINE=i586 ;; |
1039 | 1080 | exit ;; |
1040 | 1081 | pc:*:*:*) |
1041 | 1082 | # Left here for compatibility: |
1042 | # uname -m prints for DJGPP always 'pc', but it prints nothing about | |
1043 | # the processor, so we play safe by assuming i586. | |
1083 | # uname -m prints for DJGPP always 'pc', but it prints nothing about | |
1084 | # the processor, so we play safe by assuming i586. | |
1044 | 1085 | # Note: whatever this is, it MUST be the same as what config.sub |
1045 | 1086 | # prints for the "djgpp" host, or else GDB configury will decide that |
1046 | 1087 | # this is a cross-build. |
1047 | 1088 | echo i586-pc-msdosdjgpp |
1048 | exit ;; | |
1089 | exit ;; | |
1049 | 1090 | Intel:Mach:3*:*) |
1050 | 1091 | echo i386-pc-mach3 |
1051 | 1092 | exit ;; |
1080 | 1121 | /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ |
1081 | 1122 | && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; |
1082 | 1123 | 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) |
1083 | /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ | |
1084 | && { echo i486-ncr-sysv4; exit; } ;; | |
1124 | /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ | |
1125 | && { echo i486-ncr-sysv4; exit; } ;; | |
1085 | 1126 | NCR*:*:4.2:* | MPRAS*:*:4.2:*) |
1086 | 1127 | OS_REL='.3' |
1087 | 1128 | test -r /etc/.relid \ |
1124 | 1165 | echo ns32k-sni-sysv |
1125 | 1166 | fi |
1126 | 1167 | exit ;; |
1127 | PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort | |
1128 | # says <Richard.M.Bartel@ccMail.Census.GOV> | |
1129 | echo i586-unisys-sysv4 | |
1130 | exit ;; | |
1168 | PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort | |
1169 | # says <Richard.M.Bartel@ccMail.Census.GOV> | |
1170 | echo i586-unisys-sysv4 | |
1171 | exit ;; | |
1131 | 1172 | *:UNIX_System_V:4*:FTX*) |
1132 | 1173 | # From Gerald Hewes <hewes@openmarket.com>. |
1133 | 1174 | # How about differentiating between stratus architectures? -djm |
1153 | 1194 | exit ;; |
1154 | 1195 | R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) |
1155 | 1196 | if [ -d /usr/nec ]; then |
1156 | echo mips-nec-sysv${UNAME_RELEASE} | |
1197 | echo mips-nec-sysv${UNAME_RELEASE} | |
1157 | 1198 | else |
1158 | echo mips-unknown-sysv${UNAME_RELEASE} | |
1159 | fi | |
1160 | exit ;; | |
1199 | echo mips-unknown-sysv${UNAME_RELEASE} | |
1200 | fi | |
1201 | exit ;; | |
1161 | 1202 | BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. |
1162 | 1203 | echo powerpc-be-beos |
1163 | 1204 | exit ;; |
1169 | 1210 | exit ;; |
1170 | 1211 | BePC:Haiku:*:*) # Haiku running on Intel PC compatible. |
1171 | 1212 | echo i586-pc-haiku |
1213 | exit ;; | |
1214 | x86_64:Haiku:*:*) | |
1215 | echo x86_64-unknown-haiku | |
1172 | 1216 | exit ;; |
1173 | 1217 | SX-4:SUPER-UX:*:*) |
1174 | 1218 | echo sx4-nec-superux${UNAME_RELEASE} |
1222 | 1266 | *:QNX:*:4*) |
1223 | 1267 | echo i386-pc-qnx |
1224 | 1268 | exit ;; |
1225 | NSE-?:NONSTOP_KERNEL:*:*) | |
1269 | NEO-?:NONSTOP_KERNEL:*:*) | |
1270 | echo neo-tandem-nsk${UNAME_RELEASE} | |
1271 | exit ;; | |
1272 | NSE-*:NONSTOP_KERNEL:*:*) | |
1226 | 1273 | echo nse-tandem-nsk${UNAME_RELEASE} |
1227 | 1274 | exit ;; |
1228 | 1275 | NSR-?:NONSTOP_KERNEL:*:*) |
1267 | 1314 | echo pdp10-unknown-its |
1268 | 1315 | exit ;; |
1269 | 1316 | SEI:*:*:SEIUX) |
1270 | echo mips-sei-seiux${UNAME_RELEASE} | |
1317 | echo mips-sei-seiux${UNAME_RELEASE} | |
1271 | 1318 | exit ;; |
1272 | 1319 | *:DragonFly:*:*) |
1273 | 1320 | echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` |
1274 | 1321 | exit ;; |
1275 | 1322 | *:*VMS:*:*) |
1276 | UNAME_MACHINE=`(uname -p) 2>/dev/null` | |
1323 | UNAME_MACHINE=`(uname -p) 2>/dev/null` | |
1277 | 1324 | case "${UNAME_MACHINE}" in |
1278 | 1325 | A*) echo alpha-dec-vms ; exit ;; |
1279 | 1326 | I*) echo ia64-dec-vms ; exit ;; |
1291 | 1338 | i*86:AROS:*:*) |
1292 | 1339 | echo ${UNAME_MACHINE}-pc-aros |
1293 | 1340 | exit ;; |
1341 | x86_64:VMkernel:*:*) | |
1342 | echo ${UNAME_MACHINE}-unknown-esx | |
1343 | exit ;; | |
1294 | 1344 | esac |
1295 | ||
1296 | #echo '(No uname command or uname output not recognized.)' 1>&2 | |
1297 | #echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 | |
1298 | 1345 | |
1299 | 1346 | eval $set_cc_for_build |
1300 | 1347 | cat >$dummy.c <<EOF |
1313 | 1360 | #include <sys/param.h> |
1314 | 1361 | printf ("m68k-sony-newsos%s\n", |
1315 | 1362 | #ifdef NEWSOS4 |
1316 | "4" | |
1363 | "4" | |
1317 | 1364 | #else |
1318 | "" | |
1319 | #endif | |
1320 | ); exit (0); | |
1365 | "" | |
1366 | #endif | |
1367 | ); exit (0); | |
1321 | 1368 | #endif |
1322 | 1369 | #endif |
1323 | 1370 |
0 | 0 | #! /bin/sh |
1 | 1 | # Configuration validation subroutine script. |
2 | 2 | # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, |
3 | # 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 | |
4 | # Free Software Foundation, Inc. | |
5 | ||
6 | timestamp='2009-10-07' | |
3 | # 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, | |
4 | # 2011, 2012 Free Software Foundation, Inc. | |
5 | ||
6 | timestamp='2012-08-18' | |
7 | 7 | |
8 | 8 | # This file is (in principle) common to ALL GNU software. |
9 | 9 | # The presence of a machine in this file suggests that SOME GNU software |
20 | 20 | # GNU General Public License for more details. |
21 | 21 | # |
22 | 22 | # You should have received a copy of the GNU General Public License |
23 | # along with this program; if not, write to the Free Software | |
24 | # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA | |
25 | # 02110-1301, USA. | |
23 | # along with this program; if not, see <http://www.gnu.org/licenses/>. | |
26 | 24 | # |
27 | 25 | # As a special exception to the GNU General Public License, if you |
28 | 26 | # distribute this file as part of a program that contains a |
74 | 72 | version="\ |
75 | 73 | GNU config.sub ($timestamp) |
76 | 74 | |
77 | Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, | |
78 | 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. | |
75 | Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, | |
76 | 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 | |
77 | Free Software Foundation, Inc. | |
79 | 78 | |
80 | 79 | This is free software; see the source for copying conditions. There is NO |
81 | 80 | warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." |
122 | 121 | # Here we must recognize all the valid KERNEL-OS combinations. |
123 | 122 | maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` |
124 | 123 | case $maybe_os in |
125 | nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \ | |
126 | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \ | |
124 | nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ | |
125 | linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ | |
126 | knetbsd*-gnu* | netbsd*-gnu* | \ | |
127 | 127 | kopensolaris*-gnu* | \ |
128 | 128 | storm-chaos* | os2-emx* | rtmk-nova*) |
129 | 129 | os=-$maybe_os |
130 | 130 | basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` |
131 | ;; | |
132 | android-linux) | |
133 | os=-linux-android | |
134 | basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown | |
131 | 135 | ;; |
132 | 136 | *) |
133 | 137 | basic_machine=`echo $1 | sed 's/-[^-]*$//'` |
155 | 159 | os= |
156 | 160 | basic_machine=$1 |
157 | 161 | ;; |
158 | -bluegene*) | |
159 | os=-cnk | |
162 | -bluegene*) | |
163 | os=-cnk | |
160 | 164 | ;; |
161 | 165 | -sim | -cisco | -oki | -wec | -winbond) |
162 | 166 | os= |
172 | 176 | os=-chorusos |
173 | 177 | basic_machine=$1 |
174 | 178 | ;; |
175 | -chorusrdb) | |
176 | os=-chorusrdb | |
179 | -chorusrdb) | |
180 | os=-chorusrdb | |
177 | 181 | basic_machine=$1 |
178 | ;; | |
182 | ;; | |
179 | 183 | -hiux*) |
180 | 184 | os=-hiuxwe2 |
181 | 185 | ;; |
219 | 223 | ;; |
220 | 224 | -isc*) |
221 | 225 | basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` |
226 | ;; | |
227 | -lynx*178) | |
228 | os=-lynxos178 | |
229 | ;; | |
230 | -lynx*5) | |
231 | os=-lynxos5 | |
222 | 232 | ;; |
223 | 233 | -lynx*) |
224 | 234 | os=-lynxos |
244 | 254 | # Some are omitted here because they have special meanings below. |
245 | 255 | 1750a | 580 \ |
246 | 256 | | a29k \ |
257 | | aarch64 | aarch64_be \ | |
247 | 258 | | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ |
248 | 259 | | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ |
249 | 260 | | am33_2.0 \ |
250 | 261 | | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ |
262 | | be32 | be64 \ | |
251 | 263 | | bfin \ |
252 | 264 | | c4x | clipper \ |
253 | 265 | | d10v | d30v | dlx | dsp16xx \ |
266 | | epiphany \ | |
254 | 267 | | fido | fr30 | frv \ |
255 | 268 | | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ |
269 | | hexagon \ | |
256 | 270 | | i370 | i860 | i960 | ia64 \ |
257 | 271 | | ip2k | iq2000 \ |
272 | | le32 | le64 \ | |
258 | 273 | | lm32 \ |
259 | 274 | | m32c | m32r | m32rle | m68000 | m68k | m88k \ |
260 | 275 | | maxq | mb | microblaze | mcore | mep | metag \ |
280 | 295 | | moxie \ |
281 | 296 | | mt \ |
282 | 297 | | msp430 \ |
298 | | nds32 | nds32le | nds32be \ | |
283 | 299 | | nios | nios2 \ |
284 | 300 | | ns16k | ns32k \ |
301 | | open8 \ | |
285 | 302 | | or32 \ |
286 | 303 | | pdp10 | pdp11 | pj | pjl \ |
287 | | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ | |
304 | | powerpc | powerpc64 | powerpc64le | powerpcle \ | |
288 | 305 | | pyramid \ |
289 | | rx \ | |
306 | | rl78 | rx \ | |
290 | 307 | | score \ |
291 | 308 | | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ |
292 | 309 | | sh64 | sh64le \ |
293 | 310 | | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ |
294 | 311 | | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ |
295 | | spu | strongarm \ | |
296 | | tahoe | thumb | tic4x | tic80 | tron \ | |
297 | | v850 | v850e \ | |
312 | | spu \ | |
313 | | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ | |
314 | | ubicom32 \ | |
315 | | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ | |
298 | 316 | | we32k \ |
299 | | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \ | |
317 | | x86 | xc16x | xstormy16 | xtensa \ | |
300 | 318 | | z8k | z80) |
301 | 319 | basic_machine=$basic_machine-unknown |
302 | 320 | ;; |
303 | m6811 | m68hc11 | m6812 | m68hc12 | picochip) | |
304 | # Motorola 68HC11/12. | |
321 | c54x) | |
322 | basic_machine=tic54x-unknown | |
323 | ;; | |
324 | c55x) | |
325 | basic_machine=tic55x-unknown | |
326 | ;; | |
327 | c6x) | |
328 | basic_machine=tic6x-unknown | |
329 | ;; | |
330 | m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | picochip) | |
305 | 331 | basic_machine=$basic_machine-unknown |
306 | 332 | os=-none |
307 | 333 | ;; |
309 | 335 | ;; |
310 | 336 | ms1) |
311 | 337 | basic_machine=mt-unknown |
338 | ;; | |
339 | ||
340 | strongarm | thumb | xscale) | |
341 | basic_machine=arm-unknown | |
342 | ;; | |
343 | xgate) | |
344 | basic_machine=$basic_machine-unknown | |
345 | os=-none | |
346 | ;; | |
347 | xscaleeb) | |
348 | basic_machine=armeb-unknown | |
349 | ;; | |
350 | ||
351 | xscaleel) | |
352 | basic_machine=armel-unknown | |
312 | 353 | ;; |
313 | 354 | |
314 | 355 | # We use `pc' rather than `unknown' |
317 | 358 | i*86 | x86_64) |
318 | 359 | basic_machine=$basic_machine-pc |
319 | 360 | ;; |
361 | nacl64*) | |
362 | basic_machine=x86_64-pc | |
363 | os=-nacl | |
364 | ;; | |
365 | nacl*) | |
366 | basic_machine=i686-pc | |
367 | os=-nacl | |
368 | ;; | |
369 | pnacl*) | |
370 | # le32-unknown-pnacl comes from http://www.chromium.org/nativeclient/pnacl/stability-of-the-pnacl-bitcode-abi | |
371 | basic_machine=le32-unknown | |
372 | os=-pnacl | |
373 | ;; | |
320 | 374 | # Object if more than one company name word. |
321 | 375 | *-*-*) |
322 | 376 | echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 |
325 | 379 | # Recognize the basic CPU types with company name. |
326 | 380 | 580-* \ |
327 | 381 | | a29k-* \ |
382 | | aarch64-* | aarch64_be-* \ | |
328 | 383 | | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ |
329 | 384 | | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ |
330 | 385 | | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ |
331 | 386 | | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ |
332 | 387 | | avr-* | avr32-* \ |
388 | | be32-* | be64-* \ | |
333 | 389 | | bfin-* | bs2000-* \ |
334 | | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ | |
390 | | c[123]* | c30-* | [cjt]90-* | c4x-* \ | |
335 | 391 | | clipper-* | craynv-* | cydra-* \ |
336 | 392 | | d10v-* | d30v-* | dlx-* \ |
337 | 393 | | elxsi-* \ |
338 | 394 | | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ |
339 | 395 | | h8300-* | h8500-* \ |
340 | 396 | | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ |
397 | | hexagon-* \ | |
341 | 398 | | i*86-* | i860-* | i960-* | ia64-* \ |
342 | 399 | | ip2k-* | iq2000-* \ |
400 | | le32-* | le64-* \ | |
343 | 401 | | lm32-* \ |
344 | 402 | | m32c-* | m32r-* | m32rle-* \ |
345 | 403 | | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ |
365 | 423 | | mmix-* \ |
366 | 424 | | mt-* \ |
367 | 425 | | msp430-* \ |
426 | | nds32-* | nds32le-* | nds32be-* \ | |
368 | 427 | | nios-* | nios2-* \ |
369 | 428 | | none-* | np1-* | ns16k-* | ns32k-* \ |
429 | | open8-* \ | |
370 | 430 | | orion-* \ |
371 | 431 | | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ |
372 | | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ | |
432 | | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ | |
373 | 433 | | pyramid-* \ |
374 | | romp-* | rs6000-* | rx-* \ | |
434 | | rl78-* | romp-* | rs6000-* | rx-* \ | |
375 | 435 | | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ |
376 | 436 | | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ |
377 | 437 | | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ |
378 | 438 | | sparclite-* \ |
379 | | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \ | |
380 | | tahoe-* | thumb-* \ | |
381 | | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* | tile-* \ | |
439 | | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \ | |
440 | | tahoe-* \ | |
441 | | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | |
442 | | tile*-* \ | |
382 | 443 | | tron-* \ |
383 | | v850-* | v850e-* | vax-* \ | |
444 | | ubicom32-* \ | |
445 | | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ | |
446 | | vax-* \ | |
384 | 447 | | we32k-* \ |
385 | | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \ | |
448 | | x86-* | x86_64-* | xc16x-* | xps100-* \ | |
386 | 449 | | xstormy16-* | xtensa*-* \ |
387 | 450 | | ymp-* \ |
388 | 451 | | z8k-* | z80-*) |
407 | 470 | basic_machine=a29k-amd |
408 | 471 | os=-udi |
409 | 472 | ;; |
410 | abacus) | |
473 | abacus) | |
411 | 474 | basic_machine=abacus-unknown |
412 | 475 | ;; |
413 | 476 | adobe68k) |
477 | 540 | basic_machine=powerpc-ibm |
478 | 541 | os=-cnk |
479 | 542 | ;; |
543 | c54x-*) | |
544 | basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'` | |
545 | ;; | |
546 | c55x-*) | |
547 | basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'` | |
548 | ;; | |
549 | c6x-*) | |
550 | basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'` | |
551 | ;; | |
480 | 552 | c90) |
481 | 553 | basic_machine=c90-cray |
482 | 554 | os=-unicos |
483 | 555 | ;; |
484 | cegcc) | |
556 | cegcc) | |
485 | 557 | basic_machine=arm-unknown |
486 | 558 | os=-cegcc |
487 | 559 | ;; |
513 | 585 | basic_machine=craynv-cray |
514 | 586 | os=-unicosmp |
515 | 587 | ;; |
516 | cr16) | |
588 | cr16 | cr16-*) | |
517 | 589 | basic_machine=cr16-unknown |
518 | 590 | os=-elf |
519 | 591 | ;; |
671 | 743 | i370-ibm* | ibm*) |
672 | 744 | basic_machine=i370-ibm |
673 | 745 | ;; |
674 | # I'm not sure what "Sysv32" means. Should this be sysv3.2? | |
675 | 746 | i*86v32) |
676 | 747 | basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` |
677 | 748 | os=-sysv32 |
729 | 800 | basic_machine=ns32k-utek |
730 | 801 | os=-sysv |
731 | 802 | ;; |
732 | microblaze) | |
803 | microblaze) | |
733 | 804 | basic_machine=microblaze-xilinx |
805 | ;; | |
806 | mingw64) | |
807 | basic_machine=x86_64-pc | |
808 | os=-mingw64 | |
734 | 809 | ;; |
735 | 810 | mingw32) |
736 | 811 | basic_machine=i386-pc |
768 | 843 | ms1-*) |
769 | 844 | basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` |
770 | 845 | ;; |
846 | msys) | |
847 | basic_machine=i386-pc | |
848 | os=-msys | |
849 | ;; | |
771 | 850 | mvs) |
772 | 851 | basic_machine=i370-ibm |
773 | 852 | os=-mvs |
853 | ;; | |
854 | nacl) | |
855 | basic_machine=le32-unknown | |
856 | os=-nacl | |
857 | ;; | |
858 | pnacl) | |
859 | basic_machine=le32-unknown | |
860 | os=-pnacl | |
774 | 861 | ;; |
775 | 862 | ncr3000) |
776 | 863 | basic_machine=i486-ncr |
836 | 923 | np1) |
837 | 924 | basic_machine=np1-gould |
838 | 925 | ;; |
926 | neo-tandem) | |
927 | basic_machine=neo-tandem | |
928 | ;; | |
929 | nse-tandem) | |
930 | basic_machine=nse-tandem | |
931 | ;; | |
839 | 932 | nsr-tandem) |
840 | 933 | basic_machine=nsr-tandem |
841 | 934 | ;; |
918 | 1011 | ;; |
919 | 1012 | power) basic_machine=power-ibm |
920 | 1013 | ;; |
921 | ppc) basic_machine=powerpc-unknown | |
922 | ;; | |
923 | ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` | |
1014 | ppc | ppcbe) basic_machine=powerpc-unknown | |
1015 | ;; | |
1016 | ppc-* | ppcbe-*) | |
1017 | basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` | |
924 | 1018 | ;; |
925 | 1019 | ppcle | powerpclittle | ppc-le | powerpc-little) |
926 | 1020 | basic_machine=powerpcle-unknown |
1014 | 1108 | basic_machine=i860-stratus |
1015 | 1109 | os=-sysv4 |
1016 | 1110 | ;; |
1111 | strongarm-* | thumb-*) | |
1112 | basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'` | |
1113 | ;; | |
1017 | 1114 | sun2) |
1018 | 1115 | basic_machine=m68000-sun |
1019 | 1116 | ;; |
1070 | 1167 | basic_machine=t90-cray |
1071 | 1168 | os=-unicos |
1072 | 1169 | ;; |
1073 | tic54x | c54x*) | |
1074 | basic_machine=tic54x-unknown | |
1075 | os=-coff | |
1076 | ;; | |
1077 | tic55x | c55x*) | |
1078 | basic_machine=tic55x-unknown | |
1079 | os=-coff | |
1080 | ;; | |
1081 | tic6x | c6x*) | |
1082 | basic_machine=tic6x-unknown | |
1083 | os=-coff | |
1084 | ;; | |
1085 | 1170 | tile*) |
1086 | basic_machine=tile-unknown | |
1171 | basic_machine=$basic_machine-unknown | |
1087 | 1172 | os=-linux-gnu |
1088 | 1173 | ;; |
1089 | 1174 | tx39) |
1152 | 1237 | ;; |
1153 | 1238 | xps | xps100) |
1154 | 1239 | basic_machine=xps100-honeywell |
1240 | ;; | |
1241 | xscale-* | xscalee[bl]-*) | |
1242 | basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'` | |
1155 | 1243 | ;; |
1156 | 1244 | ymp) |
1157 | 1245 | basic_machine=ymp-cray |
1250 | 1338 | if [ x"$os" != x"" ] |
1251 | 1339 | then |
1252 | 1340 | case $os in |
1253 | # First match some system type aliases | |
1254 | # that might get confused with valid system types. | |
1341 | # First match some system type aliases | |
1342 | # that might get confused with valid system types. | |
1255 | 1343 | # -solaris* is a basic system type, with this one exception. |
1344 | -auroraux) | |
1345 | os=-auroraux | |
1346 | ;; | |
1256 | 1347 | -solaris1 | -solaris1.*) |
1257 | 1348 | os=`echo $os | sed -e 's|solaris1|sunos4|'` |
1258 | 1349 | ;; |
1274 | 1365 | # -sysv* is not here because it comes later, after sysvr4. |
1275 | 1366 | -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ |
1276 | 1367 | | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ |
1277 | | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ | |
1278 | | -kopensolaris* \ | |
1368 | | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ | |
1369 | | -sym* | -kopensolaris* \ | |
1279 | 1370 | | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ |
1280 | 1371 | | -aos* | -aros* \ |
1281 | 1372 | | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ |
1282 | 1373 | | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ |
1283 | 1374 | | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ |
1284 | | -openbsd* | -solidbsd* \ | |
1375 | | -bitrig* | -openbsd* | -solidbsd* \ | |
1285 | 1376 | | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ |
1286 | 1377 | | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ |
1287 | 1378 | | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ |
1288 | 1379 | | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ |
1289 | 1380 | | -chorusos* | -chorusrdb* | -cegcc* \ |
1290 | | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | |
1291 | | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \ | |
1381 | | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | |
1382 | | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ | |
1383 | | -linux-newlib* | -linux-musl* | -linux-uclibc* \ | |
1292 | 1384 | | -uxpv* | -beos* | -mpeix* | -udk* \ |
1293 | 1385 | | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ |
1294 | 1386 | | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ |
1308 | 1400 | ;; |
1309 | 1401 | esac |
1310 | 1402 | ;; |
1403 | -nacl*) | |
1404 | os=-nacl | |
1405 | ;; | |
1406 | -pnacl*) | |
1407 | os=-pnacl | |
1408 | ;; | |
1311 | 1409 | -nto-qnx*) |
1312 | 1410 | ;; |
1313 | 1411 | -nto*) |
1335 | 1433 | -opened*) |
1336 | 1434 | os=-openedition |
1337 | 1435 | ;; |
1338 | -os400*) | |
1436 | -os400*) | |
1339 | 1437 | os=-os400 |
1340 | 1438 | ;; |
1341 | 1439 | -wince*) |
1384 | 1482 | -sinix*) |
1385 | 1483 | os=-sysv4 |
1386 | 1484 | ;; |
1387 | -tpf*) | |
1485 | -tpf*) | |
1388 | 1486 | os=-tpf |
1389 | 1487 | ;; |
1390 | 1488 | -triton*) |
1428 | 1526 | ;; |
1429 | 1527 | -dicos*) |
1430 | 1528 | os=-dicos |
1529 | ;; | |
1530 | -nacl*) | |
1531 | os=-nacl | |
1532 | ;; | |
1533 | -pnacl*) | |
1534 | os=-pnacl | |
1431 | 1535 | ;; |
1432 | 1536 | -none) |
1433 | 1537 | ;; |
1451 | 1555 | # system, and we'll never get to this point. |
1452 | 1556 | |
1453 | 1557 | case $basic_machine in |
1454 | score-*) | |
1558 | score-*) | |
1455 | 1559 | os=-elf |
1456 | 1560 | ;; |
1457 | spu-*) | |
1561 | spu-*) | |
1458 | 1562 | os=-elf |
1459 | 1563 | ;; |
1460 | 1564 | *-acorn) |
1466 | 1570 | arm*-semi) |
1467 | 1571 | os=-aout |
1468 | 1572 | ;; |
1469 | c4x-* | tic4x-*) | |
1470 | os=-coff | |
1573 | c4x-* | tic4x-*) | |
1574 | os=-coff | |
1575 | ;; | |
1576 | hexagon-*) | |
1577 | os=-elf | |
1578 | ;; | |
1579 | tic54x-*) | |
1580 | os=-coff | |
1581 | ;; | |
1582 | tic55x-*) | |
1583 | os=-coff | |
1584 | ;; | |
1585 | tic6x-*) | |
1586 | os=-coff | |
1471 | 1587 | ;; |
1472 | 1588 | # This must come before the *-dec entry. |
1473 | 1589 | pdp10-*) |
1487 | 1603 | ;; |
1488 | 1604 | m68000-sun) |
1489 | 1605 | os=-sunos3 |
1490 | # This also exists in the configure program, but was not the | |
1491 | # default. | |
1492 | # os=-sunos4 | |
1493 | 1606 | ;; |
1494 | 1607 | m68*-cisco) |
1495 | 1608 | os=-aout |
1496 | 1609 | ;; |
1497 | mep-*) | |
1610 | mep-*) | |
1498 | 1611 | os=-elf |
1499 | 1612 | ;; |
1500 | 1613 | mips*-cisco) |
1521 | 1634 | *-ibm) |
1522 | 1635 | os=-aix |
1523 | 1636 | ;; |
1524 | *-knuth) | |
1637 | *-knuth) | |
1525 | 1638 | os=-mmixware |
1526 | 1639 | ;; |
1527 | 1640 | *-wec) |
905 | 905 | enable_music_midi_timidity |
906 | 906 | enable_music_midi_native |
907 | 907 | enable_music_midi_fluidsynth |
908 | enable_music_fluidsynth_shared | |
908 | enable_music_midi_fluidsynth_shared | |
909 | 909 | enable_music_ogg |
910 | 910 | enable_music_ogg_tremor |
911 | 911 | enable_music_ogg_shared |
2438 | 2438 | # |
2439 | 2439 | MAJOR_VERSION=2 |
2440 | 2440 | MINOR_VERSION=0 |
2441 | MICRO_VERSION=0 | |
2442 | INTERFACE_AGE=0 | |
2443 | BINARY_AGE=0 | |
2441 | MICRO_VERSION=1 | |
2442 | INTERFACE_AGE=1 | |
2443 | BINARY_AGE=1 | |
2444 | 2444 | VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION |
2445 | 2445 | |
2446 | 2446 | |
11064 | 11064 | *mingw32ce*) |
11065 | 11065 | #VERSION_SOURCES="$srcdir/version.rc" |
11066 | 11066 | EXE=".exe" |
11067 | ;; | |
11067 | ;; | |
11068 | 11068 | *-*-cygwin* | *-*-mingw32*) |
11069 | 11069 | VERSION_SOURCES="$srcdir/version.rc" |
11070 | 11070 | EXE=".exe" |
11071 | 11071 | if test "$build" != "$host"; then # cross-compiling |
11072 | 11072 | # Default cross-compile location |
11073 | ac_default_prefix=/usr/local/cross-tools/i386-mingw32 | |
11073 | ac_default_prefix=/usr/local/cross-tools/$host | |
11074 | 11074 | else |
11075 | 11075 | # Look for the location of the tools and install there |
11076 | 11076 | if test "$BUILD_PREFIX" != ""; then |
11147 | 11147 | else |
11148 | 11148 | host_lib_path="/usr/$base_libdir /usr/local/$base_libdir" |
11149 | 11149 | fi |
11150 | for path in $gcc_bin_path $gcc_lib_path $env_lib_path $host_lib_path; do | |
11150 | for path in $env_lib_path $gcc_bin_path $gcc_lib_path $host_lib_path; do | |
11151 | 11151 | lib=`ls -- $path/$1 2>/dev/null | sed -e '/\.so\..*\./d' -e 's,.*/,,' | sort | tail -1` |
11152 | 11152 | if test x$lib != x; then |
11153 | 11153 | echo $lib |
11816 | 11816 | |
11817 | 11817 | { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 |
11818 | 11818 | $as_echo "no" >&6; } |
11819 | ac_fn_c_check_header_mongrel "$LINENO" "modplug.h" "ac_cv_header_modplug_h" "$ac_includes_default" | |
11820 | if test "x$ac_cv_header_modplug_h" = xyes; then : | |
11819 | ac_fn_c_check_header_mongrel "$LINENO" "libmodplug/modplug.h" "ac_cv_header_libmodplug_modplug_h" "$ac_includes_default" | |
11820 | if test "x$ac_cv_header_libmodplug_modplug_h" = xyes; then : | |
11821 | 11821 | have_libmodplug_hdr=yes |
11822 | 11822 | fi |
11823 | 11823 | |
11869 | 11869 | |
11870 | 11870 | |
11871 | 11871 | elif test $pkg_failed = untried; then |
11872 | ac_fn_c_check_header_mongrel "$LINENO" "modplug.h" "ac_cv_header_modplug_h" "$ac_includes_default" | |
11873 | if test "x$ac_cv_header_modplug_h" = xyes; then : | |
11872 | ac_fn_c_check_header_mongrel "$LINENO" "libmodplug/modplug.h" "ac_cv_header_libmodplug_modplug_h" "$ac_includes_default" | |
11873 | if test "x$ac_cv_header_libmodplug_modplug_h" = xyes; then : | |
11874 | 11874 | have_libmodplug_hdr=yes |
11875 | 11875 | fi |
11876 | 11876 | |
11953 | 11953 | echo "-- dynamic libmodplug -> $modplug_lib" |
11954 | 11954 | EXTRA_CFLAGS="$EXTRA_CFLAGS -DMODPLUG_DYNAMIC=\\\"$modplug_lib\\\"" |
11955 | 11955 | else |
11956 | EXTRA_LDFLAGS="$EXTRA_LDFLAGS $MODPLUG_LIBS" | |
11956 | EXTRA_LDFLAGS="$EXTRA_LDFLAGS $MODPLUG_LIBS" | |
11957 | 11957 | fi |
11958 | 11958 | else |
11959 | 11959 | { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: *** Unable to find ModPlug library (http://modplug-xmms.sourceforge.net/)" >&5 |
12094 | 12094 | fi |
12095 | 12095 | |
12096 | 12096 | if test x$have_libmodplug != xyes -a x$have_libmikmod != xyes ; then |
12097 | { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: MOD support disabled" >&5 | |
12097 | { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: MOD support disabled" >&5 | |
12098 | 12098 | $as_echo "$as_me: WARNING: MOD support disabled" >&2;} |
12099 | 12099 | fi |
12100 | 12100 | |
12160 | 12160 | enable_music_midi_fluidsynth=yes |
12161 | 12161 | fi |
12162 | 12162 | |
12163 | # Check whether --enable-music-fluidsynth-shared was given. | |
12164 | if test "${enable_music_fluidsynth_shared+set}" = set; then : | |
12165 | enableval=$enable_music_fluidsynth_shared; | |
12163 | # Check whether --enable-music-midi-fluidsynth-shared was given. | |
12164 | if test "${enable_music_midi_fluidsynth_shared+set}" = set; then : | |
12165 | enableval=$enable_music_midi_fluidsynth_shared; | |
12166 | 12166 | else |
12167 | 12167 | enable_music_midi_fluidsynth_shared=yes |
12168 | 12168 | fi |
12250 | 12250 | if test x$enable_music_midi_timidity != xyes -a \ |
12251 | 12251 | x$use_music_midi_native != xyes -a x$use_music_midi_native != xyes_cpp -a \ |
12252 | 12252 | x$have_fluidsynth != xyes; then |
12253 | { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: MIDI support disabled" >&5 | |
12253 | { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: MIDI support disabled" >&5 | |
12254 | 12254 | $as_echo "$as_me: WARNING: MIDI support disabled" >&2;} |
12255 | 12255 | fi |
12256 | 12256 | |
12896 | 12896 | $as_echo "$have_libmad" >&6; } |
12897 | 12897 | if test x$have_libmad = xyes; then |
12898 | 12898 | SOURCES="$SOURCES $srcdir/music_mad.c" |
12899 | if echo "$SOURCES" | grep "load_mp3.c" >/dev/null; then | |
12900 | : | |
12901 | else | |
12902 | SOURCES="$SOURCES $srcdir/load_mp3.c" | |
12903 | fi | |
12899 | 12904 | EXTRA_CFLAGS="$EXTRA_CFLAGS -DMP3_MAD_MUSIC" |
12900 | 12905 | EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lmad" |
12901 | 12906 | else |
13 | 13 | # |
14 | 14 | MAJOR_VERSION=2 |
15 | 15 | MINOR_VERSION=0 |
16 | MICRO_VERSION=0 | |
17 | INTERFACE_AGE=0 | |
18 | BINARY_AGE=0 | |
16 | MICRO_VERSION=1 | |
17 | INTERFACE_AGE=1 | |
18 | BINARY_AGE=1 | |
19 | 19 | VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION |
20 | 20 | |
21 | 21 | AC_SUBST(MAJOR_VERSION) |
114 | 114 | *mingw32ce*) |
115 | 115 | #VERSION_SOURCES="$srcdir/version.rc" |
116 | 116 | EXE=".exe" |
117 | ;; | |
117 | ;; | |
118 | 118 | *-*-cygwin* | *-*-mingw32*) |
119 | 119 | VERSION_SOURCES="$srcdir/version.rc" |
120 | 120 | EXE=".exe" |
121 | 121 | if test "$build" != "$host"; then # cross-compiling |
122 | 122 | # Default cross-compile location |
123 | ac_default_prefix=/usr/local/cross-tools/i386-mingw32 | |
123 | ac_default_prefix=/usr/local/cross-tools/$host | |
124 | 124 | else |
125 | 125 | # Look for the location of the tools and install there |
126 | 126 | if test "$BUILD_PREFIX" != ""; then |
185 | 185 | else |
186 | 186 | host_lib_path="/usr/$base_libdir /usr/local/$base_libdir" |
187 | 187 | fi |
188 | for path in $gcc_bin_path $gcc_lib_path $env_lib_path $host_lib_path; do | |
188 | for path in $env_lib_path $gcc_bin_path $gcc_lib_path $host_lib_path; do | |
189 | 189 | lib=[`ls -- $path/$1 2>/dev/null | sed -e '/\.so\..*\./d' -e 's,.*/,,' | sort | tail -1`] |
190 | 190 | if test x$lib != x; then |
191 | 191 | echo $lib |
256 | 256 | have_libmodplug_hdr=yes |
257 | 257 | have_libmodplug_lib=yes |
258 | 258 | ], [dnl |
259 | AC_CHECK_HEADER([modplug.h], [have_libmodplug_hdr=yes]) | |
259 | AC_CHECK_HEADER([libmodplug/modplug.h], [have_libmodplug_hdr=yes]) | |
260 | 260 | AC_CHECK_LIB([modplug], [have_libmodplug_lib=yes]) |
261 | 261 | ]) |
262 | 262 | |
282 | 282 | echo "-- dynamic libmodplug -> $modplug_lib" |
283 | 283 | EXTRA_CFLAGS="$EXTRA_CFLAGS -DMODPLUG_DYNAMIC=\\\"$modplug_lib\\\"" |
284 | 284 | else |
285 | EXTRA_LDFLAGS="$EXTRA_LDFLAGS $MODPLUG_LIBS" | |
285 | EXTRA_LDFLAGS="$EXTRA_LDFLAGS $MODPLUG_LIBS" | |
286 | 286 | fi |
287 | 287 | else |
288 | 288 | AC_MSG_WARN([*** Unable to find ModPlug library (http://modplug-xmms.sourceforge.net/)]) |
358 | 358 | fi |
359 | 359 | |
360 | 360 | if test x$have_libmodplug != xyes -a x$have_libmikmod != xyes ; then |
361 | AC_MSG_WARN([MOD support disabled]) | |
361 | AC_MSG_WARN([MOD support disabled]) | |
362 | 362 | fi |
363 | 363 | |
364 | 364 | AC_ARG_ENABLE([music-midi], |
407 | 407 | AC_ARG_ENABLE([music-midi-fluidsynth], |
408 | 408 | AC_HELP_STRING([--enable-music-midi-fluidsynth], [enable FluidSynth MIDI output [[default=yes]]]), |
409 | 409 | [], [enable_music_midi_fluidsynth=yes]) |
410 | AC_ARG_ENABLE([music-fluidsynth-shared], | |
410 | AC_ARG_ENABLE([music-midi-fluidsynth-shared], | |
411 | 411 | AC_HELP_STRING([--enable-music-midi-fluidsynth-shared], [dynamically load FluidSynth library [[default=yes]]]), |
412 | 412 | [], [enable_music_midi_fluidsynth_shared=yes]) |
413 | 413 | if test x$enable_music_midi_fluidsynth = xyes; then |
447 | 447 | if test x$enable_music_midi_timidity != xyes -a \ |
448 | 448 | x$use_music_midi_native != xyes -a x$use_music_midi_native != xyes_cpp -a \ |
449 | 449 | x$have_fluidsynth != xyes; then |
450 | AC_MSG_WARN([MIDI support disabled]) | |
450 | AC_MSG_WARN([MIDI support disabled]) | |
451 | 451 | fi |
452 | 452 | |
453 | 453 | AC_ARG_ENABLE([music-ogg], |
636 | 636 | AC_MSG_RESULT($have_libmad) |
637 | 637 | if test x$have_libmad = xyes; then |
638 | 638 | SOURCES="$SOURCES $srcdir/music_mad.c" |
639 | if echo "$SOURCES" | grep "load_mp3.c" >/dev/null; then | |
640 | : | |
641 | else | |
642 | SOURCES="$SOURCES $srcdir/load_mp3.c" | |
643 | fi | |
639 | 644 | EXTRA_CFLAGS="$EXTRA_CFLAGS -DMP3_MAD_MUSIC" |
640 | 645 | EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lmad" |
641 | 646 | else |
0 | 0 | /* |
1 | 1 | SDL_mixer: An audio mixer library based on the SDL library |
2 | Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org> | |
2 | Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org> | |
3 | 3 | |
4 | 4 | This software is provided 'as-is', without any express or implied |
5 | 5 | warranty. In no event will the authors be held liable for any damages |
0 | 0 | /* |
1 | 1 | SDL_mixer: An audio mixer library based on the SDL library |
2 | Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org> | |
2 | Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org> | |
3 | 3 | |
4 | 4 | This software is provided 'as-is', without any express or implied |
5 | 5 | warranty. In no event will the authors be held liable for any damages |
0 | 0 | /* |
1 | 1 | SDL_mixer: An audio mixer library based on the SDL library |
2 | Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org> | |
2 | Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org> | |
3 | 3 | |
4 | 4 | This software is provided 'as-is', without any express or implied |
5 | 5 | warranty. In no event will the authors be held liable for any damages |
0 | 0 | /* |
1 | 1 | SDL_mixer: An audio mixer library based on the SDL library |
2 | Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org> | |
2 | Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org> | |
3 | 3 | |
4 | 4 | This software is provided 'as-is', without any express or implied |
5 | 5 | warranty. In no event will the authors be held liable for any damages |
0 | 0 | /* |
1 | 1 | SDL_mixer: An audio mixer library based on the SDL library |
2 | Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org> | |
2 | Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org> | |
3 | 3 | |
4 | 4 | This software is provided 'as-is', without any express or implied |
5 | 5 | warranty. In no event will the authors be held liable for any damages |
0 | 0 | /* |
1 | 1 | SDL_mixer: An audio mixer library based on the SDL library |
2 | Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org> | |
2 | Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org> | |
3 | 3 | |
4 | 4 | This software is provided 'as-is', without any express or implied |
5 | 5 | warranty. In no event will the authors be held liable for any damages |
0 | 0 | /* |
1 | 1 | SDL_mixer: An audio mixer library based on the SDL library |
2 | Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org> | |
2 | Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org> | |
3 | 3 | |
4 | 4 | This software is provided 'as-is', without any express or implied |
5 | 5 | warranty. In no event will the authors be held liable for any damages |
0 | 0 | /* |
1 | 1 | SDL_mixer: An audio mixer library based on the SDL library |
2 | Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org> | |
2 | Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org> | |
3 | 3 | |
4 | 4 | This software is provided 'as-is', without any express or implied |
5 | 5 | warranty. In no event will the authors be held liable for any damages |
20 | 20 | |
21 | 21 | #ifdef MODPLUG_MUSIC |
22 | 22 | |
23 | #include "modplug.h" | |
23 | #ifdef MODPLUG_HEADER | |
24 | #include MODPLUG_HEADER | |
25 | #else | |
26 | #include <libmodplug/modplug.h> | |
27 | #endif | |
24 | 28 | |
25 | 29 | typedef struct { |
26 | 30 | int loaded; |
0 | 0 | /* |
1 | 1 | SDL_mixer: An audio mixer library based on the SDL library |
2 | Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org> | |
2 | Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org> | |
3 | 3 | |
4 | 4 | This software is provided 'as-is', without any express or implied |
5 | 5 | warranty. In no event will the authors be held liable for any damages |
0 | 0 | /* |
1 | 1 | SDL_mixer: An audio mixer library based on the SDL library |
2 | Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org> | |
2 | Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org> | |
3 | 3 | |
4 | 4 | This software is provided 'as-is', without any express or implied |
5 | 5 | warranty. In no event will the authors be held liable for any damages |
0 | 0 | /* |
1 | 1 | SDL_mixer: An audio mixer library based on the SDL library |
2 | Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org> | |
2 | Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org> | |
3 | 3 | |
4 | 4 | This software is provided 'as-is', without any express or implied |
5 | 5 | warranty. In no event will the authors be held liable for any damages |
0 | 0 | /* |
1 | 1 | SDL_mixer: An audio mixer library based on the SDL library |
2 | Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org> | |
2 | Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org> | |
3 | 3 | |
4 | 4 | This software is provided 'as-is', without any express or implied |
5 | 5 | warranty. In no event will the authors be held liable for any damages |
19 | 19 | */ |
20 | 20 | |
21 | 21 | #ifdef OGG_MUSIC |
22 | #ifdef OGG_USE_TREMOR | |
23 | #include <ivorbisfile.h> | |
22 | #if defined(OGG_HEADER) | |
23 | #include OGG_HEADER | |
24 | #elif defined(OGG_USE_TREMOR) | |
25 | #include <tremor/ivorbisfile.h> | |
24 | 26 | #else |
25 | 27 | #include <vorbis/vorbisfile.h> |
26 | 28 | #endif |
0 | 0 | /* |
1 | 1 | SDL_mixer: An audio mixer library based on the SDL library |
2 | Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org> | |
2 | Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org> | |
3 | 3 | |
4 | 4 | This software is provided 'as-is', without any express or implied |
5 | 5 | warranty. In no event will the authors be held liable for any damages |
0 | 0 | /* |
1 | 1 | SDL_mixer: An audio mixer library based on the SDL library |
2 | Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org> | |
2 | Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org> | |
3 | 3 | |
4 | 4 | This software is provided 'as-is', without any express or implied |
5 | 5 | warranty. In no event will the authors be held liable for any damages |
0 | 0 | /* |
1 | 1 | SDL_mixer: An audio mixer library based on the SDL library |
2 | Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org> | |
2 | Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org> | |
3 | 3 | |
4 | 4 | This software is provided 'as-is', without any express or implied |
5 | 5 | warranty. In no event will the authors be held liable for any damages |
0 | 0 | /* |
1 | 1 | SDL_mixer: An audio mixer library based on the SDL library |
2 | Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org> | |
2 | Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org> | |
3 | 3 | |
4 | 4 | This software is provided 'as-is', without any express or implied |
5 | 5 | warranty. In no event will the authors be held liable for any damages |
0 | 0 | /* |
1 | 1 | SDL_mixer: An audio mixer library based on the SDL library |
2 | Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org> | |
2 | Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org> | |
3 | 3 | |
4 | 4 | This software is provided 'as-is', without any express or implied |
5 | 5 | warranty. In no event will the authors be held liable for any damages |
123 | 123 | if ((buffer = (char*) SDL_malloc(size))) { |
124 | 124 | if(SDL_RWread(src, buffer, size, 1) == 1) { |
125 | 125 | if (fluidsynth.fluid_player_add_mem(song->player, buffer, size) == FLUID_OK) { |
126 | SDL_free(buffer); | |
126 | 127 | return 1; |
127 | 128 | } else { |
128 | 129 | Mix_SetError("FluidSynth failed to load in-memory song"); |
0 | 0 | /* |
1 | 1 | SDL_mixer: An audio mixer library based on the SDL library |
2 | Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org> | |
2 | Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org> | |
3 | 3 | |
4 | 4 | This software is provided 'as-is', without any express or implied |
5 | 5 | warranty. In no event will the authors be held liable for any damages |
0 | 0 | /* |
1 | 1 | SDL_mixer: An audio mixer library based on the SDL library |
2 | Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org> | |
2 | Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org> | |
3 | 3 | |
4 | 4 | This software is provided 'as-is', without any express or implied |
5 | 5 | warranty. In no event will the authors be held liable for any damages |
0 | 0 | /* |
1 | 1 | SDL_mixer: An audio mixer library based on the SDL library |
2 | Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org> | |
2 | Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org> | |
3 | 3 | |
4 | 4 | This software is provided 'as-is', without any express or implied |
5 | 5 | warranty. In no event will the authors be held liable for any damages |
0 | 0 | /* |
1 | 1 | SDL_mixer: An audio mixer library based on the SDL library |
2 | Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org> | |
2 | Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org> | |
3 | 3 | |
4 | 4 | This software is provided 'as-is', without any express or implied |
5 | 5 | warranty. In no event will the authors be held liable for any damages |
0 | 0 | /* |
1 | 1 | SDL_mixer: An audio mixer library based on the SDL library |
2 | Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org> | |
2 | Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org> | |
3 | 3 | |
4 | 4 | This software is provided 'as-is', without any express or implied |
5 | 5 | warranty. In no event will the authors be held liable for any damages |
0 | /* | |
1 | SDL_mixer: An audio mixer library based on the SDL library | |
2 | Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org> | |
3 | ||
4 | This software is provided 'as-is', without any express or implied | |
5 | warranty. In no event will the authors be held liable for any damages | |
6 | arising from the use of this software. | |
7 | ||
8 | Permission is granted to anyone to use this software for any purpose, | |
9 | including commercial applications, and to alter it and redistribute it | |
10 | freely, subject to the following restrictions: | |
11 | ||
12 | 1. The origin of this software must not be misrepresented; you must not | |
13 | claim that you wrote the original software. If you use this software | |
14 | in a product, an acknowledgment in the product documentation would be | |
15 | appreciated but is not required. | |
16 | 2. Altered source versions must be plainly marked as such, and must not be | |
17 | misrepresented as being the original software. | |
18 | 3. This notice may not be removed or altered from any source distribution. | |
19 | ||
20 | This is the source needed to decode an MP3 into a waveform. | |
21 | */ | |
22 | ||
23 | /* $Id$ */ | |
24 | ||
25 | #if defined(MP3_MUSIC) || defined(MP3_MAD_MUSIC) | |
26 | ||
27 | #include "SDL_mixer.h" | |
28 | ||
29 | #include "load_mp3.h" | |
30 | ||
31 | #if defined(MP3_MUSIC) | |
32 | #include "dynamic_mp3.h" | |
33 | #elif defined(MP3_MAD_MUSIC) | |
34 | #include "music_mad.h" | |
35 | #endif | |
36 | ||
37 | SDL_AudioSpec *Mix_LoadMP3_RW(SDL_RWops *src, int freesrc, SDL_AudioSpec *spec, Uint8 **audio_buf, Uint32 *audio_len) | |
38 | { | |
39 | /* note: spec is initialized to mixer spec */ | |
40 | ||
41 | #if defined(MP3_MUSIC) | |
42 | SMPEG* mp3; | |
43 | SMPEG_Info info; | |
44 | #elif defined(MP3_MAD_MUSIC) | |
45 | mad_data *mp3_mad; | |
46 | #endif | |
47 | long samplesize; | |
48 | int read_len; | |
49 | const Uint32 chunk_len = 4096; | |
50 | int err = 0; | |
51 | ||
52 | if ((!src) || (!spec) || (!audio_buf) || (!audio_len)) | |
53 | { | |
54 | return NULL; | |
55 | } | |
56 | ||
57 | if (!err) | |
58 | { | |
59 | *audio_len = 0; | |
60 | *audio_buf = (Uint8*) SDL_malloc(chunk_len); | |
61 | err = (*audio_buf == NULL); | |
62 | } | |
63 | ||
64 | if (!err) | |
65 | { | |
66 | err = ((Mix_Init(MIX_INIT_MP3) & MIX_INIT_MP3) == 0); | |
67 | } | |
68 | ||
69 | if (!err) | |
70 | { | |
71 | #if defined(MP3_MUSIC) | |
72 | mp3 = smpeg.SMPEG_new_rwops(src, &info, freesrc, 0); | |
73 | err = (mp3 == NULL); | |
74 | #elif defined(MP3_MAD_MUSIC) | |
75 | mp3_mad = mad_openFileRW(src, spec, freesrc); | |
76 | err = (mp3_mad == NULL); | |
77 | #endif | |
78 | } | |
79 | ||
80 | #if defined(MP3_MUSIC) | |
81 | if (!err) | |
82 | { | |
83 | err = !info.has_audio; | |
84 | } | |
85 | #endif | |
86 | ||
87 | if (!err) | |
88 | { | |
89 | #if defined(MP3_MUSIC) | |
90 | ||
91 | smpeg.SMPEG_actualSpec(mp3, spec); | |
92 | ||
93 | smpeg.SMPEG_enableaudio(mp3, 1); | |
94 | smpeg.SMPEG_enablevideo(mp3, 0); | |
95 | ||
96 | smpeg.SMPEG_play(mp3); | |
97 | ||
98 | /* read once for audio length */ | |
99 | while ((read_len = smpeg.SMPEG_playAudio(mp3, *audio_buf, chunk_len)) > 0) | |
100 | { | |
101 | *audio_len += read_len; | |
102 | } | |
103 | ||
104 | smpeg.SMPEG_stop(mp3); | |
105 | ||
106 | #elif defined(MP3_MAD_MUSIC) | |
107 | ||
108 | mad_start(mp3_mad); | |
109 | ||
110 | /* read once for audio length */ | |
111 | while ((read_len = mad_getSamples(mp3_mad, *audio_buf, chunk_len)) > 0) | |
112 | { | |
113 | *audio_len += read_len; | |
114 | } | |
115 | ||
116 | mad_stop(mp3_mad); | |
117 | ||
118 | #endif | |
119 | ||
120 | err = (read_len < 0); | |
121 | } | |
122 | ||
123 | if (!err) | |
124 | { | |
125 | /* reallocate, if needed */ | |
126 | if ((*audio_len > 0) && (*audio_len != chunk_len)) | |
127 | { | |
128 | *audio_buf = (Uint8*) SDL_realloc(*audio_buf, *audio_len); | |
129 | err = (*audio_buf == NULL); | |
130 | } | |
131 | } | |
132 | ||
133 | if (!err) | |
134 | { | |
135 | /* read again for audio buffer, if needed */ | |
136 | if (*audio_len > chunk_len) | |
137 | { | |
138 | #if defined(MP3_MUSIC) | |
139 | smpeg.SMPEG_rewind(mp3); | |
140 | smpeg.SMPEG_play(mp3); | |
141 | err = (*audio_len != smpeg.SMPEG_playAudio(mp3, *audio_buf, *audio_len)); | |
142 | smpeg.SMPEG_stop(mp3); | |
143 | #elif defined(MP3_MAD_MUSIC) | |
144 | mad_seek(mp3_mad, 0); | |
145 | mad_start(mp3_mad); | |
146 | err = (*audio_len != mad_getSamples(mp3_mad, *audio_buf, *audio_len)); | |
147 | mad_stop(mp3_mad); | |
148 | #endif | |
149 | } | |
150 | } | |
151 | ||
152 | if (!err) | |
153 | { | |
154 | /* Don't return a buffer that isn't a multiple of samplesize */ | |
155 | samplesize = ((spec->format & 0xFF)/8)*spec->channels; | |
156 | *audio_len &= ~(samplesize-1); | |
157 | } | |
158 | ||
159 | #if defined(MP3_MUSIC) | |
160 | if (mp3) | |
161 | { | |
162 | smpeg.SMPEG_delete(mp3); mp3 = NULL; | |
163 | /* Deleting the MP3 closed the source if desired */ | |
164 | freesrc = SDL_FALSE; | |
165 | } | |
166 | #elif defined(MP3_MAD_MUSIC) | |
167 | if (mp3_mad) | |
168 | { | |
169 | mad_closeFile(mp3_mad); mp3_mad = NULL; | |
170 | /* Deleting the MP3 closed the source if desired */ | |
171 | freesrc = SDL_FALSE; | |
172 | } | |
173 | #endif | |
174 | ||
175 | if (freesrc) | |
176 | { | |
177 | SDL_RWclose(src); src = NULL; | |
178 | } | |
179 | ||
180 | /* handle error */ | |
181 | if (err) | |
182 | { | |
183 | if (*audio_buf != NULL) | |
184 | { | |
185 | SDL_free(*audio_buf); *audio_buf = NULL; | |
186 | } | |
187 | *audio_len = 0; | |
188 | spec = NULL; | |
189 | } | |
190 | ||
191 | return spec; | |
192 | } | |
193 | ||
194 | #endif |
0 | /* | |
1 | SDL_mixer: An audio mixer library based on the SDL library | |
2 | Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org> | |
3 | ||
4 | This software is provided 'as-is', without any express or implied | |
5 | warranty. In no event will the authors be held liable for any damages | |
6 | arising from the use of this software. | |
7 | ||
8 | Permission is granted to anyone to use this software for any purpose, | |
9 | including commercial applications, and to alter it and redistribute it | |
10 | freely, subject to the following restrictions: | |
11 | ||
12 | 1. The origin of this software must not be misrepresented; you must not | |
13 | claim that you wrote the original software. If you use this software | |
14 | in a product, an acknowledgment in the product documentation would be | |
15 | appreciated but is not required. | |
16 | 2. Altered source versions must be plainly marked as such, and must not be | |
17 | misrepresented as being the original software. | |
18 | 3. This notice may not be removed or altered from any source distribution. | |
19 | ||
20 | This is the source needed to decode an MP3 into a waveform. | |
21 | */ | |
22 | ||
23 | /* $Id$ */ | |
24 | ||
25 | #if defined(MP3_MUSIC) || defined(MP3_MAD_MUSIC) | |
26 | /* Don't call this directly; use Mix_LoadWAV_RW() for now. */ | |
27 | SDL_AudioSpec *Mix_LoadMP3_RW (SDL_RWops *src, int freesrc, | |
28 | SDL_AudioSpec *spec, Uint8 **audio_buf, Uint32 *audio_len); | |
29 | #endif |
0 | 0 | /* |
1 | 1 | SDL_mixer: An audio mixer library based on the SDL library |
2 | Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org> | |
2 | Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org> | |
3 | 3 | |
4 | 4 | This software is provided 'as-is', without any express or implied |
5 | 5 | warranty. In no event will the authors be held liable for any damages |
42 | 42 | return SDL_RWread((SDL_RWops*)datasource, ptr, size, nmemb); |
43 | 43 | } |
44 | 44 | |
45 | static Sint64 sdl_seek_func(void *datasource, ogg_int64_t offset, int whence) | |
45 | static int sdl_seek_func(void *datasource, ogg_int64_t offset, int whence) | |
46 | 46 | { |
47 | return SDL_RWseek((SDL_RWops*)datasource, offset, whence); | |
47 | return (int)SDL_RWseek((SDL_RWops*)datasource, offset, whence); | |
48 | 48 | } |
49 | 49 | |
50 | static Sint64 sdl_close_func_freesrc(void *datasource) | |
50 | static int sdl_close_func_freesrc(void *datasource) | |
51 | 51 | { |
52 | 52 | return SDL_RWclose((SDL_RWops*)datasource); |
53 | 53 | } |
54 | 54 | |
55 | static Sint64 sdl_close_func_nofreesrc(void *datasource) | |
55 | static int sdl_close_func_nofreesrc(void *datasource) | |
56 | 56 | { |
57 | return SDL_RWseek((SDL_RWops*)datasource, 0, RW_SEEK_SET); | |
57 | SDL_RWseek((SDL_RWops*)datasource, 0, RW_SEEK_SET); | |
58 | return 0; | |
58 | 59 | } |
59 | 60 | |
60 | static Sint64 sdl_tell_func(void *datasource) | |
61 | static long sdl_tell_func(void *datasource) | |
61 | 62 | { |
62 | return SDL_RWtell((SDL_RWops*)datasource); | |
63 | return (long)SDL_RWtell((SDL_RWops*)datasource); | |
63 | 64 | } |
64 | 65 | |
65 | 66 |
0 | 0 | /* |
1 | 1 | SDL_mixer: An audio mixer library based on the SDL library |
2 | Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org> | |
2 | Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org> | |
3 | 3 | |
4 | 4 | This software is provided 'as-is', without any express or implied |
5 | 5 | warranty. In no event will the authors be held liable for any damages |
0 | 0 | /* |
1 | 1 | SDL_mixer: An audio mixer library based on the SDL library |
2 | Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org> | |
2 | Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org> | |
3 | 3 | |
4 | 4 | This software is provided 'as-is', without any express or implied |
5 | 5 | warranty. In no event will the authors be held liable for any damages |
0 | 0 | /* |
1 | 1 | SDL_mixer: An audio mixer library based on the SDL library |
2 | Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org> | |
2 | Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org> | |
3 | 3 | |
4 | 4 | This software is provided 'as-is', without any express or implied |
5 | 5 | warranty. In no event will the authors be held liable for any damages |
0 | 0 | /* |
1 | 1 | SDL_mixer: An audio mixer library based on the SDL library |
2 | Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org> | |
2 | Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org> | |
3 | 3 | |
4 | 4 | This software is provided 'as-is', without any express or implied |
5 | 5 | warranty. In no event will the authors be held liable for any damages |
31 | 31 | #include "SDL_mixer.h" |
32 | 32 | #include "load_aiff.h" |
33 | 33 | #include "load_voc.h" |
34 | #include "load_mp3.h" | |
34 | 35 | #include "load_ogg.h" |
35 | 36 | #include "load_flac.h" |
36 | 37 | #include "dynamic_flac.h" |
38 | #include "dynamic_fluidsynth.h" | |
37 | 39 | #include "dynamic_modplug.h" |
38 | 40 | #include "dynamic_mod.h" |
39 | 41 | #include "dynamic_mp3.h" |
181 | 183 | result |= MIX_INIT_MOD; |
182 | 184 | } |
183 | 185 | #else |
184 | Mix_SetError("Mixer not built with MOD timidity support"); | |
186 | Mix_SetError("Mixer not built with MOD mikmod support"); | |
185 | 187 | #endif |
186 | 188 | } |
187 | 189 | if (flags & MIX_INIT_MP3) { |
189 | 191 | if ((initialized & MIX_INIT_MP3) || Mix_InitMP3() == 0) { |
190 | 192 | result |= MIX_INIT_MP3; |
191 | 193 | } |
194 | #elif defined(MP3_MAD_MUSIC) | |
195 | result |= MIX_INIT_MP3; | |
192 | 196 | #else |
193 | 197 | Mix_SetError("Mixer not built with MP3 support"); |
194 | 198 | #endif |
317 | 321 | /* Mix any playing channels... */ |
318 | 322 | sdl_ticks = SDL_GetTicks(); |
319 | 323 | for ( i=0; i<num_channels; ++i ) { |
320 | if( ! mix_channel[i].paused ) { | |
324 | if ( !mix_channel[i].paused ) { | |
321 | 325 | if ( mix_channel[i].expire > 0 && mix_channel[i].expire < sdl_ticks ) { |
322 | 326 | /* Expiration delay for that channel is reached */ |
323 | 327 | mix_channel[i].playing = 0; |
327 | 331 | _Mix_channel_done_playing(i); |
328 | 332 | } else if ( mix_channel[i].fading != MIX_NO_FADING ) { |
329 | 333 | Uint32 ticks = sdl_ticks - mix_channel[i].ticks_fade; |
330 | if( ticks > mix_channel[i].fade_length ) { | |
334 | if ( ticks >= mix_channel[i].fade_length ) { | |
331 | 335 | Mix_Volume(i, mix_channel[i].fade_volume_reset); /* Restore the volume */ |
332 | 336 | if( mix_channel[i].fading == MIX_FADING_OUT ) { |
333 | 337 | mix_channel[i].playing = 0; |
337 | 341 | } |
338 | 342 | mix_channel[i].fading = MIX_NO_FADING; |
339 | 343 | } else { |
340 | if( mix_channel[i].fading == MIX_FADING_OUT ) { | |
344 | if ( mix_channel[i].fading == MIX_FADING_OUT ) { | |
341 | 345 | Mix_Volume(i, (mix_channel[i].fade_volume * (mix_channel[i].fade_length-ticks)) |
342 | 346 | / mix_channel[i].fade_length ); |
343 | 347 | } else { |
491 | 495 | #endif |
492 | 496 | #ifdef FLAC_MUSIC |
493 | 497 | add_chunk_decoder("FLAC"); |
498 | #endif | |
499 | #if defined(MP3_MUSIC) || defined(MP3_MAD_MUSIC) | |
500 | add_chunk_decoder("MP3"); | |
494 | 501 | #endif |
495 | 502 | |
496 | 503 | audio_opened = 1; |
556 | 563 | return(audio_opened); |
557 | 564 | } |
558 | 565 | |
559 | ||
560 | /* | |
561 | * !!! FIXME: Ideally, we want a Mix_LoadSample_RW(), which will handle the | |
562 | * generic setup, then call the correct file format loader. | |
563 | */ | |
566 | static int detect_mp3(Uint8 *magic) | |
567 | { | |
568 | if ( strncmp((char *)magic, "ID3", 3) == 0 ) { | |
569 | return 1; | |
570 | } | |
571 | ||
572 | /* Detection code lifted from SMPEG */ | |
573 | if(((magic[0] & 0xff) != 0xff) || // No sync bits | |
574 | ((magic[1] & 0xf0) != 0xf0) || // | |
575 | ((magic[2] & 0xf0) == 0x00) || // Bitrate is 0 | |
576 | ((magic[2] & 0xf0) == 0xf0) || // Bitrate is 15 | |
577 | ((magic[2] & 0x0c) == 0x0c) || // Frequency is 3 | |
578 | ((magic[1] & 0x06) == 0x00)) { // Layer is 4 | |
579 | return(0); | |
580 | } | |
581 | return 1; | |
582 | } | |
564 | 583 | |
565 | 584 | /* Load a wave file */ |
566 | 585 | Mix_Chunk *Mix_LoadWAV_RW(SDL_RWops *src, int freesrc) |
628 | 647 | (Uint8 **)&chunk->abuf, &chunk->alen); |
629 | 648 | break; |
630 | 649 | default: |
650 | #if defined(MP3_MUSIC) || defined(MP3_MAD_MUSIC) | |
651 | if (detect_mp3((Uint8*)&magic)) | |
652 | { | |
653 | /* note: send a copy of the mixer spec */ | |
654 | wavespec = mixer; | |
655 | loaded = Mix_LoadMP3_RW(src, freesrc, &wavespec, | |
656 | (Uint8 **)&chunk->abuf, &chunk->alen); | |
657 | break; | |
658 | } | |
659 | #endif | |
631 | 660 | SDL_SetError("Unrecognized sound file type"); |
632 | 661 | if ( freesrc ) { |
633 | 662 | SDL_RWclose(src); |
1066 | 1095 | (mix_channel[which].fading != MIX_FADING_OUT) ) { |
1067 | 1096 | mix_channel[which].fade_volume = mix_channel[which].volume; |
1068 | 1097 | mix_channel[which].fading = MIX_FADING_OUT; |
1069 | mix_channel[which].fade_length = ms; | |
1098 | mix_channel[which].fade_length = (Uint32)ms; | |
1070 | 1099 | mix_channel[which].ticks_fade = SDL_GetTicks(); |
1071 | 1100 | |
1072 | 1101 | /* only change fade_volume_reset if we're not fading. */ |
0 | 0 | /* |
1 | 1 | SDL_mixer: An audio mixer library based on the SDL library |
2 | Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org> | |
2 | Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org> | |
3 | 3 | |
4 | 4 | This software is provided 'as-is', without any express or implied |
5 | 5 | warranty. In no event will the authors be held liable for any damages |
573 | 573 | |
574 | 574 | /* We need to know if a specific error occurs; if not, we'll set a |
575 | 575 | * generic one, so we clear the current one. */ |
576 | Mix_SetError(""); | |
576 | SDL_ClearError(); | |
577 | 577 | music = Mix_LoadMUSType_RW(src, type, SDL_TRUE); |
578 | 578 | if ( music == NULL && Mix_GetError()[0] == '\0' ) { |
579 | 579 | Mix_SetError("Unrecognized music format"); |
0 | 0 | /* |
1 | 1 | SDL_mixer: An audio mixer library based on the SDL library |
2 | Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org> | |
2 | Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org> | |
3 | 3 | |
4 | 4 | This software is provided 'as-is', without any express or implied |
5 | 5 | warranty. In no event will the authors be held liable for any damages |
0 | 0 | /* |
1 | 1 | SDL_mixer: An audio mixer library based on the SDL library |
2 | Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org> | |
2 | Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org> | |
3 | 3 | |
4 | 4 | This software is provided 'as-is', without any express or implied |
5 | 5 | warranty. In no event will the authors be held liable for any damages |
0 | 0 | /* |
1 | 1 | SDL_mixer: An audio mixer library based on the SDL library |
2 | Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org> | |
2 | Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org> | |
3 | 3 | |
4 | 4 | This software is provided 'as-is', without any express or implied |
5 | 5 | warranty. In no event will the authors be held liable for any damages |
0 | 0 | /* |
1 | 1 | SDL_mixer: An audio mixer library based on the SDL library |
2 | Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org> | |
2 | Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org> | |
3 | 3 | |
4 | 4 | This software is provided 'as-is', without any express or implied |
5 | 5 | warranty. In no event will the authors be held liable for any damages |
0 | 0 | /* |
1 | 1 | SDL_mixer: An audio mixer library based on the SDL library |
2 | Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org> | |
2 | Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org> | |
3 | 3 | |
4 | 4 | This software is provided 'as-is', without any express or implied |
5 | 5 | warranty. In no event will the authors be held liable for any damages |
0 | 0 | /* |
1 | 1 | SDL_mixer: An audio mixer library based on the SDL library |
2 | Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org> | |
2 | Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org> | |
3 | 3 | |
4 | 4 | This software is provided 'as-is', without any express or implied |
5 | 5 | warranty. In no event will the authors be held liable for any damages |
0 | 0 | /* |
1 | 1 | SDL_mixer: An audio mixer library based on the SDL library |
2 | Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org> | |
2 | Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org> | |
3 | 3 | |
4 | 4 | This software is provided 'as-is', without any express or implied |
5 | 5 | warranty. In no event will the authors be held liable for any damages |
0 | 0 | /* |
1 | 1 | SDL_mixer: An audio mixer library based on the SDL library |
2 | Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org> | |
2 | Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org> | |
3 | 3 | |
4 | 4 | This software is provided 'as-is', without any express or implied |
5 | 5 | warranty. In no event will the authors be held liable for any damages |
0 | 0 | /* |
1 | 1 | SDL_mixer: An audio mixer library based on the SDL library |
2 | Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org> | |
2 | Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org> | |
3 | 3 | |
4 | 4 | This software is provided 'as-is', without any express or implied |
5 | 5 | warranty. In no event will the authors be held liable for any damages |
0 | 0 | /* |
1 | 1 | SDL_mixer: An audio mixer library based on the SDL library |
2 | Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org> | |
2 | Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org> | |
3 | 3 | |
4 | 4 | This software is provided 'as-is', without any express or implied |
5 | 5 | warranty. In no event will the authors be held liable for any damages |
20 | 20 | |
21 | 21 | #ifdef MODPLUG_MUSIC |
22 | 22 | |
23 | #include "modplug.h" | |
23 | #ifdef MODPLUG_HEADER | |
24 | #include MODPLUG_HEADER | |
25 | #else | |
26 | #include <libmodplug/modplug.h> | |
27 | #endif | |
24 | 28 | #include "SDL_rwops.h" |
25 | 29 | #include "SDL_audio.h" |
26 | 30 | #include "SDL_mixer.h" |
0 | 0 | /* |
1 | 1 | SDL_mixer: An audio mixer library based on the SDL library |
2 | Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org> | |
2 | Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org> | |
3 | 3 | |
4 | 4 | This software is provided 'as-is', without any express or implied |
5 | 5 | warranty. In no event will the authors be held liable for any damages |
55 | 55 | return SDL_RWread((SDL_RWops*)datasource, ptr, size, nmemb); |
56 | 56 | } |
57 | 57 | |
58 | static Sint64 sdl_seek_func(void *datasource, ogg_int64_t offset, int whence) | |
59 | { | |
60 | return SDL_RWseek((SDL_RWops*)datasource, offset, whence); | |
61 | } | |
62 | ||
63 | static Sint64 sdl_tell_func(void *datasource) | |
64 | { | |
65 | return SDL_RWtell((SDL_RWops*)datasource); | |
58 | static int sdl_seek_func(void *datasource, ogg_int64_t offset, int whence) | |
59 | { | |
60 | return (int)SDL_RWseek((SDL_RWops*)datasource, offset, whence); | |
61 | } | |
62 | ||
63 | static long sdl_tell_func(void *datasource) | |
64 | { | |
65 | return (long)SDL_RWtell((SDL_RWops*)datasource); | |
66 | 66 | } |
67 | 67 | |
68 | 68 | /* Load an OGG stream from an SDL_RWops object */ |
0 | 0 | /* |
1 | 1 | SDL_mixer: An audio mixer library based on the SDL library |
2 | Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org> | |
2 | Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org> | |
3 | 3 | |
4 | 4 | This software is provided 'as-is', without any express or implied |
5 | 5 | warranty. In no event will the authors be held liable for any damages |
24 | 24 | |
25 | 25 | /* This file supports Ogg Vorbis music streams */ |
26 | 26 | |
27 | #ifdef OGG_USE_TREMOR | |
28 | #include <ivorbisfile.h> | |
27 | #if defined(OGG_HEADER) | |
28 | #include OGG_HEADER | |
29 | #elif defined(OGG_USE_TREMOR) | |
30 | #include <tremor/ivorbisfile.h> | |
29 | 31 | #else |
30 | 32 | #include <vorbis/vorbisfile.h> |
31 | 33 | #endif |
229 | 229 | return NULL; |
230 | 230 | |
231 | 231 | track = (MIDIEvent**) calloc(1, sizeof(MIDIEvent*) * mididata->nTracks); |
232 | if (NULL == head) | |
232 | ||
233 | if (NULL == track) | |
233 | 234 | return NULL; |
234 | 235 | |
235 | 236 | /* First, convert all tracks to MIDIEvent lists */ |
0 | 0 | /* |
1 | 1 | PLAYMUS: A test application for the SDL mixer library. |
2 | Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org> | |
2 | Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org> | |
3 | 3 | |
4 | 4 | This software is provided 'as-is', without any express or implied |
5 | 5 | warranty. In no event will the authors be held liable for any damages |
0 | 0 | /* |
1 | 1 | PLAYWAVE: A test application for the SDL mixer library. |
2 | Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org> | |
2 | Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org> | |
3 | 3 | |
4 | 4 | This software is provided 'as-is', without any express or implied |
5 | 5 | warranty. In no event will the authors be held liable for any damages |
325 | 325 | { |
326 | 326 | int note = voice[v].sample->note_to_use; |
327 | 327 | if (note>0 && drumvolume[chan][note]>=0) vol = drumvolume[chan][note]; |
328 | if (note>0 && drumpanpot[chan][note]>=0) panning = drumvolume[chan][note]; | |
328 | if (note>0 && drumpanpot[chan][note]>=0) panning = drumpanpot[chan][note]; | |
329 | 329 | } |
330 | 330 | |
331 | 331 | if (opt_expression_curve == 2) curved_expression = 127.0 * vol_table[expr]; |
672 | 672 | meep->event.time, meep->event.channel + 1, |
673 | 673 | meep->event.type, meep->event.a, meep->event.b); |
674 | 674 | |
675 | if (meep->event.channel >= MAXCHAN) | |
676 | skip_this_event=1; | |
677 | else if (meep->event.type==ME_TEMPO) | |
675 | if (meep->event.type==ME_TEMPO) | |
678 | 676 | { |
679 | 677 | tempo= |
680 | 678 | meep->event.channel + meep->event.b * 256 + meep->event.a * 65536; |
681 | 679 | compute_sample_increment(tempo, divisions); |
682 | 680 | skip_this_event=1; |
683 | 681 | } |
682 | else if (meep->event.channel >= MAXCHAN) | |
683 | skip_this_event=1; | |
684 | 684 | else if ((quietchannels & (1<<meep->event.channel))) |
685 | 685 | skip_this_event=1; |
686 | 686 | else switch (meep->event.type) |
55 | 55 | line++; |
56 | 56 | w[words=0]=strtok(tmp, " \t\r\n\240"); |
57 | 57 | if (!w[0] || (*w[0]=='#')) continue; |
58 | while (w[words] && (words < MAXWORDS)) | |
58 | while (w[words] && (words < (MAXWORDS-1))) | |
59 | 59 | { |
60 | 60 | w[++words]=strtok(0," \t\r\n\240"); |
61 | 61 | if (w[words] && w[words][0]=='#') break; |
67 | 67 | { |
68 | 68 | ctl->cmsg(CMSG_ERROR, VERB_NORMAL, |
69 | 69 | "%s: line %d: No directory given\n", name, line); |
70 | close_file(fp); | |
70 | 71 | return -2; |
71 | 72 | } |
72 | 73 | for (i=1; i<words; i++) |
78 | 79 | { |
79 | 80 | ctl->cmsg(CMSG_ERROR, VERB_NORMAL, |
80 | 81 | "%s: line %d: No file name given\n", name, line); |
82 | close_file(fp); | |
81 | 83 | return -2; |
82 | 84 | } |
83 | 85 | for (i=1; i<words; i++) |
94 | 96 | ctl->cmsg(CMSG_ERROR, VERB_NORMAL, |
95 | 97 | "%s: line %d: Must specify exactly one patch name\n", |
96 | 98 | name, line); |
99 | close_file(fp); | |
97 | 100 | return -2; |
98 | 101 | } |
99 | 102 | strncpy(def_instr_name, w[1], 255); |
106 | 109 | ctl->cmsg(CMSG_ERROR, VERB_NORMAL, |
107 | 110 | "%s: line %d: No drum set number given\n", |
108 | 111 | name, line); |
112 | close_file(fp); | |
109 | 113 | return -2; |
110 | 114 | } |
111 | 115 | i=atoi(w[1]); |
114 | 118 | ctl->cmsg(CMSG_ERROR, VERB_NORMAL, |
115 | 119 | "%s: line %d: Drum set must be between 0 and 127\n", |
116 | 120 | name, line); |
121 | close_file(fp); | |
117 | 122 | return -2; |
118 | 123 | } |
119 | 124 | if (!drumset[i]) |
130 | 135 | ctl->cmsg(CMSG_ERROR, VERB_NORMAL, |
131 | 136 | "%s: line %d: No bank number given\n", |
132 | 137 | name, line); |
138 | close_file(fp); | |
133 | 139 | return -2; |
134 | 140 | } |
135 | 141 | i=atoi(w[1]); |
138 | 144 | ctl->cmsg(CMSG_ERROR, VERB_NORMAL, |
139 | 145 | "%s: line %d: Tone bank must be between 0 and 127\n", |
140 | 146 | name, line); |
147 | close_file(fp); | |
141 | 148 | return -2; |
142 | 149 | } |
143 | 150 | if (!tonebank[i]) |
160 | 167 | ctl->cmsg(CMSG_ERROR, VERB_NORMAL, |
161 | 168 | "%s: line %d: Program must be between 0 and 127\n", |
162 | 169 | name, line); |
170 | close_file(fp); | |
163 | 171 | return -2; |
164 | 172 | } |
165 | 173 | if (!bank) |
168 | 176 | "%s: line %d: Must specify tone bank or drum set " |
169 | 177 | "before assignment\n", |
170 | 178 | name, line); |
179 | close_file(fp); | |
171 | 180 | return -2; |
172 | 181 | } |
173 | 182 | if (bank->tone[i].name) |
183 | 192 | { |
184 | 193 | ctl->cmsg(CMSG_ERROR, VERB_NORMAL, "%s: line %d: bad patch option %s\n", |
185 | 194 | name, line, w[j]); |
195 | close_file(fp); | |
186 | 196 | return -2; |
187 | 197 | } |
188 | 198 | *cp++=0; |
194 | 204 | ctl->cmsg(CMSG_ERROR, VERB_NORMAL, |
195 | 205 | "%s: line %d: amplification must be between " |
196 | 206 | "0 and %d\n", name, line, MAX_AMPLIFICATION); |
207 | close_file(fp); | |
197 | 208 | return -2; |
198 | 209 | } |
199 | 210 | bank->tone[i].amp=k; |
206 | 217 | ctl->cmsg(CMSG_ERROR, VERB_NORMAL, |
207 | 218 | "%s: line %d: note must be between 0 and 127\n", |
208 | 219 | name, line); |
220 | close_file(fp); | |
209 | 221 | return -2; |
210 | 222 | } |
211 | 223 | bank->tone[i].note=k; |
227 | 239 | "%s: line %d: panning must be left, right, " |
228 | 240 | "center, or between -100 and 100\n", |
229 | 241 | name, line); |
242 | close_file(fp); | |
230 | 243 | return -2; |
231 | 244 | } |
232 | 245 | bank->tone[i].pan=k; |
241 | 254 | { |
242 | 255 | ctl->cmsg(CMSG_ERROR, VERB_NORMAL, |
243 | 256 | "%s: line %d: keep must be env or loop\n", name, line); |
257 | close_file(fp); | |
244 | 258 | return -2; |
245 | 259 | } |
246 | 260 | } |
257 | 271 | ctl->cmsg(CMSG_ERROR, VERB_NORMAL, |
258 | 272 | "%s: line %d: strip must be env, loop, or tail\n", |
259 | 273 | name, line); |
274 | close_file(fp); | |
260 | 275 | return -2; |
261 | 276 | } |
262 | 277 | } |
264 | 279 | { |
265 | 280 | ctl->cmsg(CMSG_ERROR, VERB_NORMAL, "%s: line %d: bad patch option %s\n", |
266 | 281 | name, line, w[j]); |
282 | close_file(fp); | |
267 | 283 | return -2; |
268 | 284 | } |
269 | 285 | } |
8 | 8 | // |
9 | 9 | |
10 | 10 | VS_VERSION_INFO VERSIONINFO |
11 | FILEVERSION 2,0,0,0 | |
12 | PRODUCTVERSION 2,0,0,0 | |
11 | FILEVERSION 2,0,1,0 | |
12 | PRODUCTVERSION 2,0,1,0 | |
13 | 13 | FILEFLAGSMASK 0x3fL |
14 | 14 | FILEFLAGS 0x0L |
15 | 15 | FILEOS 0x40004L |
22 | 22 | BEGIN |
23 | 23 | VALUE "CompanyName", "\0" |
24 | 24 | VALUE "FileDescription", "SDL_mixer\0" |
25 | VALUE "FileVersion", "2, 0, 0, 0\0" | |
25 | VALUE "FileVersion", "2, 0, 1, 0\0" | |
26 | 26 | VALUE "InternalName", "SDL_mixer\0" |
27 | VALUE "LegalCopyright", "Copyright © 2013 Sam Lantinga\0" | |
27 | VALUE "LegalCopyright", "Copyright © 2016 Sam Lantinga\0" | |
28 | 28 | VALUE "OriginalFilename", "SDL_mixer.dll\0" |
29 | 29 | VALUE "ProductName", "Simple DirectMedia Layer\0" |
30 | VALUE "ProductVersion", "2, 0, 0, 0\0" | |
30 | VALUE "ProductVersion", "2, 0, 1, 0\0" | |
31 | 31 | END |
32 | 32 | END |
33 | 33 | BLOCK "VarFileInfo" |
0 | 0 | /* |
1 | 1 | SDL_mixer: An audio mixer library based on the SDL library |
2 | Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org> | |
2 | Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org> | |
3 | 3 | |
4 | 4 | This software is provided 'as-is', without any express or implied |
5 | 5 | warranty. In no event will the authors be held liable for any damages |
46 | 46 | /*******************************************/ |
47 | 47 | #define RIFF 0x46464952 /* "RIFF" */ |
48 | 48 | #define WAVE 0x45564157 /* "WAVE" */ |
49 | #define FACT 0x74636166 /* "fact" */ | |
50 | #define LIST 0x5453494c /* "LIST" */ | |
51 | #define FMT 0x20746D66 /* "fmt " */ | |
49 | #define FMT 0x20746D66 /* "fmt " */ | |
52 | 50 | #define DATA 0x61746164 /* "data" */ |
51 | #define SMPL 0x6c706d73 /* "smpl" */ | |
53 | 52 | #define PCM_CODE 1 |
54 | 53 | #define ADPCM_CODE 2 |
55 | 54 | #define WAVE_MONO 1 |
56 | 55 | #define WAVE_STEREO 2 |
57 | 56 | |
58 | /* Normally, these three chunks come consecutively in a WAVE file */ | |
59 | typedef struct WaveFMT { | |
57 | typedef struct { | |
60 | 58 | /* Not saved in the chunk we read: |
61 | Uint32 FMTchunk; | |
62 | Uint32 fmtlen; | |
59 | Uint32 chunkID; | |
60 | Uint32 chunkLen; | |
63 | 61 | */ |
64 | 62 | Uint16 encoding; |
65 | 63 | Uint16 channels; /* 1 = mono, 2 = stereo */ |
69 | 67 | Uint16 bitspersample; /* One of 8, 12, 16, or 4 for ADPCM */ |
70 | 68 | } WaveFMT; |
71 | 69 | |
72 | /* The general chunk found in the WAVE file */ | |
73 | typedef struct Chunk { | |
74 | Uint32 magic; | |
75 | Uint32 length; | |
76 | Uint8 *data; /* Data includes magic and length */ | |
77 | } Chunk; | |
70 | typedef struct { | |
71 | Uint32 identifier; | |
72 | Uint32 type; | |
73 | Uint32 start; | |
74 | Uint32 end; | |
75 | Uint32 fraction; | |
76 | Uint32 play_count; | |
77 | } SampleLoop; | |
78 | ||
79 | typedef struct { | |
80 | /* Not saved in the chunk we read: | |
81 | Uint32 chunkID; | |
82 | Uint32 chunkLen; | |
83 | */ | |
84 | Uint32 manufacturer; | |
85 | Uint32 product; | |
86 | Uint32 sample_period; | |
87 | Uint32 MIDI_unity_note; | |
88 | Uint32 MIDI_pitch_fraction; | |
89 | Uint32 SMTPE_format; | |
90 | Uint32 SMTPE_offset; | |
91 | Uint32 sample_loops; | |
92 | Uint32 sampler_data; | |
93 | SampleLoop loops[]; | |
94 | } SamplerChunk; | |
78 | 95 | |
79 | 96 | /*********************************************/ |
80 | 97 | /* Define values for AIFF (IFF audio) format */ |
93 | 110 | static int wavestream_volume = MIX_MAX_VOLUME; |
94 | 111 | |
95 | 112 | /* Function to load the WAV/AIFF stream */ |
96 | static SDL_RWops *LoadWAVStream (SDL_RWops *rw, SDL_AudioSpec *spec, | |
97 | long *start, long *stop); | |
98 | static SDL_RWops *LoadAIFFStream (SDL_RWops *rw, SDL_AudioSpec *spec, | |
99 | long *start, long *stop); | |
113 | static SDL_bool LoadWAVStream(WAVStream *wave); | |
114 | static SDL_bool LoadAIFFStream(WAVStream *wave); | |
100 | 115 | |
101 | 116 | /* Initialize the WAVStream player, with the given mixer settings |
102 | 117 | This function returns 0, or -1 if there was an error. |
116 | 131 | WAVStream *WAVStream_LoadSong_RW(SDL_RWops *src, int freesrc) |
117 | 132 | { |
118 | 133 | WAVStream *wave; |
119 | SDL_AudioSpec wavespec; | |
120 | ||
121 | if ( ! mixer.format ) { | |
134 | SDL_bool loaded = SDL_FALSE; | |
135 | ||
136 | if (!mixer.format) { | |
122 | 137 | Mix_SetError("WAV music output not started"); |
123 | 138 | return(NULL); |
124 | 139 | } |
140 | ||
125 | 141 | wave = (WAVStream *)SDL_malloc(sizeof *wave); |
126 | if ( wave ) { | |
142 | if (wave) { | |
127 | 143 | Uint32 magic; |
128 | 144 | |
129 | 145 | SDL_zerop(wave); |
146 | wave->src = src; | |
130 | 147 | wave->freesrc = freesrc; |
131 | 148 | |
132 | 149 | magic = SDL_ReadLE32(src); |
133 | if ( magic == RIFF || magic == WAVE ) { | |
134 | wave->src = LoadWAVStream(src, &wavespec, &wave->start, &wave->stop); | |
135 | } else if ( magic == FORM ) { | |
136 | wave->src = LoadAIFFStream(src, &wavespec, &wave->start, &wave->stop); | |
150 | if (magic == RIFF || magic == WAVE) { | |
151 | loaded = LoadWAVStream(wave); | |
152 | } else if (magic == FORM) { | |
153 | loaded = LoadAIFFStream(wave); | |
137 | 154 | } else { |
138 | 155 | Mix_SetError("Unknown WAVE format"); |
139 | 156 | } |
140 | if ( wave->src == NULL ) { | |
141 | SDL_free(wave); | |
157 | if (!loaded) { | |
158 | WAVStream_FreeSong(wave); | |
142 | 159 | return(NULL); |
143 | 160 | } |
144 | 161 | SDL_BuildAudioCVT(&wave->cvt, |
145 | wavespec.format, wavespec.channels, wavespec.freq, | |
162 | wave->spec.format, wave->spec.channels, wave->spec.freq, | |
146 | 163 | mixer.format, mixer.channels, mixer.freq); |
147 | 164 | } else { |
148 | 165 | SDL_OutOfMemory(); |
154 | 171 | /* Start playback of a given WAV stream */ |
155 | 172 | void WAVStream_Start(WAVStream *wave) |
156 | 173 | { |
157 | SDL_RWseek (wave->src, wave->start, RW_SEEK_SET); | |
174 | int i; | |
175 | for (i = 0; i < wave->numloops; ++i) { | |
176 | WAVLoopPoint *loop = &wave->loops[i]; | |
177 | loop->active = SDL_TRUE; | |
178 | loop->current_play_count = loop->initial_play_count; | |
179 | } | |
180 | SDL_RWseek(wave->src, wave->start, RW_SEEK_SET); | |
158 | 181 | music = wave; |
159 | 182 | } |
160 | 183 | |
161 | 184 | /* Play some of a stream previously started with WAVStream_Start() */ |
162 | int WAVStream_PlaySome(Uint8 *stream, int len) | |
163 | { | |
164 | Sint64 pos; | |
165 | Sint64 left = 0; | |
166 | ||
167 | if ( music && ((pos=SDL_RWtell(music->src)) < music->stop) ) { | |
168 | if ( music->cvt.needed ) { | |
169 | int original_len; | |
170 | ||
171 | original_len=(int)((double)len/music->cvt.len_ratio); | |
172 | if ( music->cvt.len != original_len ) { | |
173 | int worksize; | |
174 | if ( music->cvt.buf != NULL ) { | |
175 | SDL_free(music->cvt.buf); | |
176 | } | |
177 | worksize = original_len*music->cvt.len_mult; | |
178 | music->cvt.buf=(Uint8 *)SDL_malloc(worksize); | |
179 | if ( music->cvt.buf == NULL ) { | |
180 | return 0; | |
181 | } | |
182 | music->cvt.len = original_len; | |
185 | static int PlaySome(Uint8 *stream, int len) | |
186 | { | |
187 | Sint64 pos, stop; | |
188 | WAVLoopPoint *loop; | |
189 | Sint64 loop_start; | |
190 | Sint64 loop_stop; | |
191 | int i; | |
192 | int consumed; | |
193 | ||
194 | pos = SDL_RWtell(music->src); | |
195 | stop = music->stop; | |
196 | loop = NULL; | |
197 | for (i = 0; i < music->numloops; ++i) { | |
198 | loop = &music->loops[i]; | |
199 | if (loop->active) { | |
200 | const int bytes_per_sample = (SDL_AUDIO_BITSIZE(music->spec.format) / 8) * music->spec.channels; | |
201 | loop_start = music->start + loop->start * bytes_per_sample; | |
202 | loop_stop = music->start + (loop->stop + 1) * bytes_per_sample; | |
203 | if (pos >= loop_start && pos < loop_stop) | |
204 | { | |
205 | stop = loop_stop; | |
206 | break; | |
183 | 207 | } |
184 | if ( (music->stop - pos) < original_len ) { | |
185 | left = (original_len - (music->stop - pos)); | |
186 | original_len -= (int)left; | |
187 | left = (int)((double)left*music->cvt.len_ratio); | |
208 | } | |
209 | loop = NULL; | |
210 | } | |
211 | ||
212 | if (music->cvt.needed) { | |
213 | int original_len; | |
214 | ||
215 | original_len = (int)((double)len/music->cvt.len_ratio); | |
216 | if (music->cvt.len != original_len) { | |
217 | int worksize; | |
218 | if (music->cvt.buf != NULL) { | |
219 | SDL_free(music->cvt.buf); | |
188 | 220 | } |
189 | original_len = SDL_RWread(music->src, music->cvt.buf,1,original_len); | |
190 | /* At least at the time of writing, SDL_ConvertAudio() | |
191 | does byte-order swapping starting at the end of the | |
192 | buffer. Thus, if we are reading 16-bit samples, we | |
193 | had better make damn sure that we get an even | |
194 | number of bytes, or we'll get garbage. | |
195 | */ | |
196 | if ( (music->cvt.src_format & 0x0010) && (original_len & 1) ) { | |
197 | original_len--; | |
221 | worksize = original_len*music->cvt.len_mult; | |
222 | music->cvt.buf=(Uint8 *)SDL_malloc(worksize); | |
223 | if (music->cvt.buf == NULL) { | |
224 | return 0; | |
198 | 225 | } |
199 | 226 | music->cvt.len = original_len; |
200 | SDL_ConvertAudio(&music->cvt); | |
201 | SDL_MixAudio(stream, music->cvt.buf, music->cvt.len_cvt, wavestream_volume); | |
227 | } | |
228 | if ((stop - pos) < original_len) { | |
229 | original_len = (int)(stop - pos); | |
230 | } | |
231 | original_len = SDL_RWread(music->src, music->cvt.buf, 1, original_len); | |
232 | /* At least at the time of writing, SDL_ConvertAudio() | |
233 | does byte-order swapping starting at the end of the | |
234 | buffer. Thus, if we are reading 16-bit samples, we | |
235 | had better make damn sure that we get an even | |
236 | number of bytes, or we'll get garbage. | |
237 | */ | |
238 | if ((music->cvt.src_format & 0x0010) && (original_len & 1)) { | |
239 | original_len--; | |
240 | } | |
241 | music->cvt.len = original_len; | |
242 | SDL_ConvertAudio(&music->cvt); | |
243 | SDL_MixAudio(stream, music->cvt.buf, music->cvt.len_cvt, wavestream_volume); | |
244 | consumed = music->cvt.len_cvt; | |
245 | } else { | |
246 | Uint8 *data; | |
247 | if ((stop - pos) < len) { | |
248 | len = (int)(stop - pos); | |
249 | } | |
250 | data = SDL_stack_alloc(Uint8, len); | |
251 | if (data) { | |
252 | len = SDL_RWread(music->src, data, 1, len); | |
253 | SDL_MixAudio(stream, data, len, wavestream_volume); | |
254 | SDL_stack_free(data); | |
255 | } | |
256 | consumed = len; | |
257 | } | |
258 | ||
259 | if (loop && SDL_RWtell(music->src) >= stop) { | |
260 | if (loop->current_play_count == 1) { | |
261 | loop->active = SDL_FALSE; | |
202 | 262 | } else { |
203 | Uint8 *data; | |
204 | if ( (music->stop - pos) < len ) { | |
205 | left = (len - (music->stop - pos)); | |
206 | len -= (int)left; | |
263 | if (loop->current_play_count > 0) { | |
264 | --loop->current_play_count; | |
207 | 265 | } |
208 | data = SDL_stack_alloc(Uint8, len); | |
209 | if (data) | |
210 | { | |
211 | SDL_RWread(music->src, data, len, 1); | |
212 | SDL_MixAudio(stream, data, len, wavestream_volume); | |
213 | SDL_stack_free(data); | |
214 | } | |
215 | } | |
216 | } | |
217 | return (int)left; | |
266 | SDL_RWseek(music->src, loop_start, RW_SEEK_SET); | |
267 | } | |
268 | } | |
269 | return consumed; | |
270 | } | |
271 | ||
272 | int WAVStream_PlaySome(Uint8 *stream, int len) | |
273 | { | |
274 | if (!music) | |
275 | return 0; | |
276 | ||
277 | while ((SDL_RWtell(music->src) < music->stop) && (len > 0)) { | |
278 | int consumed = PlaySome(stream, len); | |
279 | if (!consumed) | |
280 | break; | |
281 | ||
282 | stream += consumed; | |
283 | len -= consumed; | |
284 | } | |
285 | return len; | |
218 | 286 | } |
219 | 287 | |
220 | 288 | /* Stop playback of a stream previously started with WAVStream_Start() */ |
226 | 294 | /* Close the given WAV stream */ |
227 | 295 | void WAVStream_FreeSong(WAVStream *wave) |
228 | 296 | { |
229 | if ( wave ) { | |
297 | if (wave) { | |
230 | 298 | /* Clean up associated data */ |
231 | if ( wave->cvt.buf ) { | |
299 | if (wave->loops) { | |
300 | SDL_free(wave->loops); | |
301 | } | |
302 | if (wave->cvt.buf) { | |
232 | 303 | SDL_free(wave->cvt.buf); |
233 | 304 | } |
234 | if ( wave->freesrc ) { | |
305 | if (wave->freesrc) { | |
235 | 306 | SDL_RWclose(wave->src); |
236 | 307 | } |
237 | 308 | SDL_free(wave); |
244 | 315 | int active; |
245 | 316 | |
246 | 317 | active = 0; |
247 | if ( music && (SDL_RWtell(music->src) < music->stop) ) { | |
318 | if (music && (SDL_RWtell(music->src) < music->stop)) { | |
248 | 319 | active = 1; |
249 | 320 | } |
250 | 321 | return(active); |
251 | 322 | } |
252 | 323 | |
253 | static int ReadChunk(SDL_RWops *src, Chunk *chunk, int read_data) | |
254 | { | |
255 | chunk->magic = SDL_ReadLE32(src); | |
256 | chunk->length = SDL_ReadLE32(src); | |
257 | if ( read_data ) { | |
258 | chunk->data = (Uint8 *)SDL_malloc(chunk->length); | |
259 | if ( chunk->data == NULL ) { | |
260 | Mix_SetError("Out of memory"); | |
261 | return(-1); | |
262 | } | |
263 | if ( SDL_RWread(src, chunk->data, chunk->length, 1) != 1 ) { | |
264 | Mix_SetError("Couldn't read chunk"); | |
265 | SDL_free(chunk->data); | |
266 | return(-1); | |
267 | } | |
268 | } else { | |
269 | SDL_RWseek(src, chunk->length, RW_SEEK_CUR); | |
270 | } | |
271 | return(chunk->length); | |
272 | } | |
273 | ||
274 | static SDL_RWops *LoadWAVStream (SDL_RWops *src, SDL_AudioSpec *spec, | |
275 | long *start, long *stop) | |
276 | { | |
277 | int was_error; | |
278 | Chunk chunk; | |
279 | int lenread; | |
280 | ||
281 | /* WAV magic header */ | |
282 | Uint32 wavelen; | |
283 | Uint32 WAVEmagic; | |
284 | ||
285 | /* FMT chunk */ | |
286 | WaveFMT *format = NULL; | |
287 | ||
288 | was_error = 0; | |
289 | ||
290 | /* Check the magic header */ | |
291 | wavelen = SDL_ReadLE32(src); | |
292 | WAVEmagic = SDL_ReadLE32(src); | |
293 | ||
294 | /* Read the audio data format chunk */ | |
295 | chunk.data = NULL; | |
296 | do { | |
297 | /* FIXME! Add this logic to SDL_LoadWAV_RW() */ | |
298 | if ( chunk.data ) { | |
299 | SDL_free(chunk.data); | |
300 | } | |
301 | lenread = ReadChunk(src, &chunk, 1); | |
302 | if ( lenread < 0 ) { | |
303 | was_error = 1; | |
304 | goto done; | |
305 | } | |
306 | } while ( (chunk.magic == FACT) || (chunk.magic == LIST) ); | |
324 | static SDL_bool ParseFMT(WAVStream *wave, Uint32 chunk_length) | |
325 | { | |
326 | SDL_RWops *src = wave->src; | |
327 | SDL_AudioSpec *spec = &wave->spec; | |
328 | WaveFMT *format; | |
329 | Uint8 *data; | |
330 | SDL_bool loaded = SDL_FALSE; | |
331 | ||
332 | if (chunk_length < sizeof(*format)) { | |
333 | Mix_SetError("Wave format chunk too small"); | |
334 | return SDL_FALSE; | |
335 | } | |
336 | ||
337 | data = (Uint8 *)SDL_malloc(chunk_length); | |
338 | if (!data) { | |
339 | Mix_SetError("Out of memory"); | |
340 | return SDL_FALSE; | |
341 | } | |
342 | if (!SDL_RWread(wave->src, data, chunk_length, 1)) { | |
343 | Mix_SetError("Couldn't read %d bytes from WAV file", chunk_length); | |
344 | return SDL_FALSE; | |
345 | } | |
346 | format = (WaveFMT *)data; | |
307 | 347 | |
308 | 348 | /* Decode the audio data format */ |
309 | format = (WaveFMT *)chunk.data; | |
310 | if ( chunk.magic != FMT ) { | |
311 | SDL_free(chunk.data); | |
312 | Mix_SetError("Complex WAVE files not supported"); | |
313 | was_error = 1; | |
314 | goto done; | |
315 | } | |
316 | 349 | switch (SDL_SwapLE16(format->encoding)) { |
317 | 350 | case PCM_CODE: |
318 | 351 | /* We can understand this */ |
319 | 352 | break; |
320 | 353 | default: |
321 | 354 | Mix_SetError("Unknown WAVE data format"); |
322 | was_error = 1; | |
323 | 355 | goto done; |
324 | 356 | } |
325 | SDL_memset(spec, 0, (sizeof *spec)); | |
326 | 357 | spec->freq = SDL_SwapLE32(format->frequency); |
327 | 358 | switch (SDL_SwapLE16(format->bitspersample)) { |
328 | 359 | case 8: |
333 | 364 | break; |
334 | 365 | default: |
335 | 366 | Mix_SetError("Unknown PCM data format"); |
336 | was_error = 1; | |
337 | 367 | goto done; |
338 | 368 | } |
339 | 369 | spec->channels = (Uint8) SDL_SwapLE16(format->channels); |
340 | 370 | spec->samples = 4096; /* Good default buffer size */ |
341 | 371 | |
342 | /* Set the file offset to the DATA chunk data */ | |
343 | chunk.data = NULL; | |
344 | do { | |
345 | *start = (long)SDL_RWtell(src) + 2*sizeof(Uint32); | |
346 | lenread = ReadChunk(src, &chunk, 0); | |
347 | if ( lenread < 0 ) { | |
348 | was_error = 1; | |
349 | goto done; | |
350 | } | |
351 | } while ( chunk.magic != DATA ); | |
352 | *stop = (long)SDL_RWtell(src); | |
372 | loaded = SDL_TRUE; | |
353 | 373 | |
354 | 374 | done: |
355 | if ( format != NULL ) { | |
356 | SDL_free(format); | |
357 | } | |
358 | if ( was_error ) { | |
359 | return NULL; | |
360 | } | |
361 | return(src); | |
375 | SDL_free(data); | |
376 | return loaded; | |
377 | } | |
378 | ||
379 | static SDL_bool ParseDATA(WAVStream *wave, Uint32 chunk_length) | |
380 | { | |
381 | wave->start = SDL_RWtell(wave->src); | |
382 | wave->stop = wave->start + chunk_length; | |
383 | SDL_RWseek(wave->src, chunk_length, RW_SEEK_CUR); | |
384 | return SDL_TRUE; | |
385 | } | |
386 | ||
387 | static SDL_bool AddLoopPoint(WAVStream *wave, Uint32 play_count, Uint32 start, Uint32 stop) | |
388 | { | |
389 | WAVLoopPoint *loop; | |
390 | WAVLoopPoint *loops = SDL_realloc(wave->loops, (wave->numloops + 1)*sizeof(*wave->loops)); | |
391 | if (!loops) { | |
392 | Mix_SetError("Out of memory"); | |
393 | return SDL_FALSE; | |
394 | } | |
395 | ||
396 | loop = &loops[ wave->numloops ]; | |
397 | loop->start = start; | |
398 | loop->stop = stop; | |
399 | loop->initial_play_count = play_count; | |
400 | loop->current_play_count = play_count; | |
401 | ||
402 | wave->loops = loops; | |
403 | ++wave->numloops; | |
404 | return SDL_TRUE; | |
405 | } | |
406 | ||
407 | static SDL_bool ParseSMPL(WAVStream *wave, Uint32 chunk_length) | |
408 | { | |
409 | SamplerChunk *chunk; | |
410 | Uint8 *data; | |
411 | int i; | |
412 | SDL_bool loaded = SDL_FALSE; | |
413 | ||
414 | data = (Uint8 *)SDL_malloc(chunk_length); | |
415 | if (!data) { | |
416 | Mix_SetError("Out of memory"); | |
417 | return SDL_FALSE; | |
418 | } | |
419 | if (!SDL_RWread(wave->src, data, chunk_length, 1)) { | |
420 | Mix_SetError("Couldn't read %d bytes from WAV file", chunk_length); | |
421 | return SDL_FALSE; | |
422 | } | |
423 | chunk = (SamplerChunk *)data; | |
424 | ||
425 | for (i = 0; i < SDL_SwapLE32(chunk->sample_loops); ++i) { | |
426 | const Uint32 LOOP_TYPE_FORWARD = 0; | |
427 | Uint32 loop_type = SDL_SwapLE32(chunk->loops[i].type); | |
428 | if (loop_type == LOOP_TYPE_FORWARD) { | |
429 | AddLoopPoint(wave, SDL_SwapLE32(chunk->loops[i].play_count), SDL_SwapLE32(chunk->loops[i].start), SDL_SwapLE32(chunk->loops[i].end)); | |
430 | } | |
431 | } | |
432 | ||
433 | loaded = SDL_TRUE; | |
434 | ||
435 | done: | |
436 | SDL_free(data); | |
437 | return loaded; | |
438 | } | |
439 | ||
440 | static SDL_bool LoadWAVStream(WAVStream *wave) | |
441 | { | |
442 | SDL_RWops *src = wave->src; | |
443 | Uint32 chunk_type; | |
444 | Uint32 chunk_length; | |
445 | SDL_bool found_FMT = SDL_FALSE; | |
446 | SDL_bool found_DATA = SDL_FALSE; | |
447 | ||
448 | /* WAV magic header */ | |
449 | Uint32 wavelen; | |
450 | Uint32 WAVEmagic; | |
451 | ||
452 | /* Check the magic header */ | |
453 | wavelen = SDL_ReadLE32(src); | |
454 | WAVEmagic = SDL_ReadLE32(src); | |
455 | ||
456 | /* Read the chunks */ | |
457 | for (; ;) { | |
458 | chunk_type = SDL_ReadLE32(src); | |
459 | chunk_length = SDL_ReadLE32(src); | |
460 | ||
461 | if (chunk_length == 0) | |
462 | break; | |
463 | ||
464 | switch (chunk_type) | |
465 | { | |
466 | case FMT: | |
467 | found_FMT = SDL_TRUE; | |
468 | if (!ParseFMT(wave, chunk_length)) | |
469 | return SDL_FALSE; | |
470 | break; | |
471 | case DATA: | |
472 | found_DATA = SDL_TRUE; | |
473 | if (!ParseDATA(wave, chunk_length)) | |
474 | return SDL_FALSE; | |
475 | break; | |
476 | case SMPL: | |
477 | if (!ParseSMPL(wave, chunk_length)) | |
478 | return SDL_FALSE; | |
479 | break; | |
480 | default: | |
481 | SDL_RWseek(src, chunk_length, RW_SEEK_CUR); | |
482 | break; | |
483 | } | |
484 | } | |
485 | ||
486 | if (!found_FMT) { | |
487 | Mix_SetError("Bad WAV file (no FMT chunk)"); | |
488 | return SDL_FALSE; | |
489 | } | |
490 | ||
491 | if (!found_DATA) { | |
492 | Mix_SetError("Bad WAV file (no DATA chunk)"); | |
493 | return SDL_FALSE; | |
494 | } | |
495 | ||
496 | return SDL_TRUE; | |
362 | 497 | } |
363 | 498 | |
364 | 499 | /* I couldn't get SANE_to_double() to work, so I stole this from libsndfile. |
383 | 518 | if (sanebuf[0] == 0x40 && sanebuf[1] > 0x1C) |
384 | 519 | return 800000000; |
385 | 520 | |
386 | return ((sanebuf[2] << 23) | (sanebuf[3] << 15) | (sanebuf[4] << 7) | |
387 | | (sanebuf[5] >> 1)) >> (29 - sanebuf[1]); | |
388 | } | |
389 | ||
390 | static SDL_RWops *LoadAIFFStream (SDL_RWops *src, SDL_AudioSpec *spec, | |
391 | long *start, long *stop) | |
392 | { | |
393 | int was_error; | |
394 | int found_SSND; | |
395 | int found_COMM; | |
521 | return ((sanebuf[2] << 23) | (sanebuf[3] << 15) | (sanebuf[4] << 7) | | |
522 | (sanebuf[5] >> 1)) >> (29 - sanebuf[1]); | |
523 | } | |
524 | ||
525 | static SDL_bool LoadAIFFStream(WAVStream *wave) | |
526 | { | |
527 | SDL_RWops *src = wave->src; | |
528 | SDL_AudioSpec *spec = &wave->spec; | |
529 | SDL_bool found_SSND = SDL_FALSE; | |
530 | SDL_bool found_COMM = SDL_FALSE; | |
396 | 531 | |
397 | 532 | Uint32 chunk_type; |
398 | 533 | Uint32 chunk_length; |
410 | 545 | Uint8 sane_freq[10]; |
411 | 546 | Uint32 frequency = 0; |
412 | 547 | |
413 | was_error = 0; | |
414 | ||
415 | 548 | /* Check the magic header */ |
416 | chunk_length = SDL_ReadBE32(src); | |
417 | AIFFmagic = SDL_ReadLE32(src); | |
418 | if ( AIFFmagic != AIFF ) { | |
549 | chunk_length = SDL_ReadBE32(src); | |
550 | AIFFmagic = SDL_ReadLE32(src); | |
551 | if (AIFFmagic != AIFF) { | |
419 | 552 | Mix_SetError("Unrecognized file type (not AIFF)"); |
420 | was_error = 1; | |
421 | goto done; | |
553 | return SDL_FALSE; | |
422 | 554 | } |
423 | 555 | |
424 | 556 | /* From what I understand of the specification, chunks may appear in |
425 | * any order, and we should just ignore unknown ones. | |
557 | * any order, and we should just ignore unknown ones. | |
426 | 558 | * |
427 | 559 | * TODO: Better sanity-checking. E.g. what happens if the AIFF file |
428 | 560 | * contains compressed sound data? |
429 | 561 | */ |
430 | ||
431 | found_SSND = 0; | |
432 | found_COMM = 0; | |
433 | ||
434 | 562 | do { |
435 | 563 | chunk_type = SDL_ReadLE32(src); |
436 | 564 | chunk_length = SDL_ReadBE32(src); |
438 | 566 | |
439 | 567 | /* Paranoia to avoid infinite loops */ |
440 | 568 | if (chunk_length == 0) |
441 | break; | |
569 | break; | |
442 | 570 | |
443 | 571 | switch (chunk_type) { |
444 | 572 | case SSND: |
445 | found_SSND = 1; | |
446 | offset = SDL_ReadBE32(src); | |
447 | blocksize = SDL_ReadBE32(src); | |
448 | *start = (long)SDL_RWtell(src) + offset; | |
573 | found_SSND = SDL_TRUE; | |
574 | offset = SDL_ReadBE32(src); | |
575 | blocksize = SDL_ReadBE32(src); | |
576 | wave->start = SDL_RWtell(src) + offset; | |
449 | 577 | break; |
450 | 578 | |
451 | 579 | case COMM: |
452 | found_COMM = 1; | |
580 | found_COMM = SDL_TRUE; | |
453 | 581 | |
454 | 582 | /* Read the audio data format chunk */ |
455 | channels = SDL_ReadBE16(src); | |
456 | numsamples = SDL_ReadBE32(src); | |
457 | samplesize = SDL_ReadBE16(src); | |
583 | channels = SDL_ReadBE16(src); | |
584 | numsamples = SDL_ReadBE32(src); | |
585 | samplesize = SDL_ReadBE16(src); | |
458 | 586 | SDL_RWread(src, sane_freq, sizeof(sane_freq), 1); |
459 | frequency = SANE_to_Uint32(sane_freq); | |
587 | frequency = SANE_to_Uint32(sane_freq); | |
460 | 588 | break; |
461 | 589 | |
462 | 590 | default: |
467 | 595 | |
468 | 596 | if (!found_SSND) { |
469 | 597 | Mix_SetError("Bad AIFF file (no SSND chunk)"); |
470 | was_error = 1; | |
471 | goto done; | |
598 | return SDL_FALSE; | |
472 | 599 | } |
473 | 600 | |
474 | 601 | if (!found_COMM) { |
475 | 602 | Mix_SetError("Bad AIFF file (no COMM chunk)"); |
476 | was_error = 1; | |
477 | goto done; | |
478 | } | |
479 | ||
480 | *stop = *start + channels * numsamples * (samplesize / 8); | |
603 | return SDL_FALSE; | |
604 | } | |
605 | ||
606 | wave->stop = wave->start + channels * numsamples * (samplesize / 8); | |
481 | 607 | |
482 | 608 | /* Decode the audio data format */ |
483 | 609 | SDL_memset(spec, 0, (sizeof *spec)); |
491 | 617 | break; |
492 | 618 | default: |
493 | 619 | Mix_SetError("Unknown samplesize in data format"); |
494 | was_error = 1; | |
495 | goto done; | |
620 | return SDL_FALSE; | |
496 | 621 | } |
497 | 622 | spec->channels = (Uint8) channels; |
498 | 623 | spec->samples = 4096; /* Good default buffer size */ |
499 | 624 | |
500 | done: | |
501 | if ( was_error ) { | |
502 | return NULL; | |
503 | } | |
504 | return(src); | |
505 | } | |
506 | ||
625 | return SDL_TRUE; | |
626 | } | |
627 |