diff --git a/libs/SDLMixerX/CHANGES.X.txt b/libs/SDLMixerX/CHANGES.X.txt new file mode 100644 index 000000000..17b43d9af --- /dev/null +++ b/libs/SDLMixerX/CHANGES.X.txt @@ -0,0 +1,48 @@ +2.1.0: +Vitaly Novichkov - Sat, Jan 20, 2018 18:06:00 + * SDL Mixer X has been re-created from original again as official SDL Mixer had a big and incompatible rework + * Custom resampler is no more needed as SDL2 now finally uses new better resampler + * Added CMake build + * Added an ability to toggle MIDI playing libraries (NativeMidi, Timidity or FluidSynth) + * Added a full seekability with "tell" and "length" commands + * Added a basic support for Meta-Tags to show Title, Artist, Album and Copyright captured from music files. + * Added an extra arguments in music path string to support song individual settings per some codecs (for example, play different MIDI files with different MIDI playing libraries) + * Timidity: Added ability to set a config search pach, for example, inside of application directory API. + * Added OPNMIDI MIDI sequencer based on YM2612 chip emulation. Includes a complete General-MIDI embedded bank. + * Added functions to use custom bank files for ADL/OPN-MIDI sequencers (WOPL for ADLMIDI and WOPN for OPNMIDI) + * WAVE: Added support for PCM24, PCM32, Float32, Float64m, ALAW, and MULAW sample formats, + * AIFF: Added support for AIFF-C, also support for PCM24, PCM32, Float32, Float64, ALAW, and MULAW formats + * WAVE & AIFF: Added full seekability support (seek, tell, length) + * MP3: More accurate MP3 file detection as some weird MP3 files are can't be detected by existing code; Added usage lf libID3tag library to fetch ID3 tags and also detect begin offset inside of MP3 files as some MP3 files are causing libMAD play ID3 data as actual encoded sound data that causes weird playback and later crash. To avoid this, ID3 parse is needed to detect actual begin of audio data. + * Fixed: SMPEG: Fix a broken build + * Fixed: OGG: Fixed support for pre-defined count of loops when loop tags are presented + * Warning fixes + * Some C90 compatibility fixes + * Internally: Added MIX_UNUSED() macro to mute warnings on various compilers + +1.0.3: +Vitaly Novichkov - 2016 + * Implemented own resampler to don't use buggy SDL Audio's resampler + * Added support of path arguments to allow dynamic configuring of GME and MIDI playing per every file + * ModPlug now is part of SDL Mixer X in same project + * Link all dependent libraries (libOGG, libVorbis, libFLAC, libMAD) statically + +1.0.2: +Vitaly Novichkov - 2015 + * Added ADLMIDI MIDI sequencer which is completely independent MIDI sequencer which requires no extra bank files to play MIDI. + * Added ability to dynamically switch MIDI device (ADLMIDI, Timidity, Native MIDI, FluidSynth) + * Added meta-tag getting functions: Mix_GetMusicTitle, Mix_GetMusicTitleTag, Mix_GetMusicArtistTag, Mix_GetMusicAlbumTag, Mix_GetMusicCopyrightTag. + * Added ability to build VB6-Compatible version to use it as standalone audio library + +1.0.1: +Vitaly Novichkov - 2015 + * Added GME library to support many game music formats + * Added support of loop tags for OGG Vorbis files (based on vorbis comments "LOOPSTART" and "LOOPEND" (also supported "LOOPLENGTH" for RPG-Maker compatibility)) + * Added MIX_Timidity_addToPathList(const char *path) to customize Timidity path + +1.0.0: +Vitaly Novichkov - 2015 + * Added support of SPC playback + * Attempt to fix resampling + * Using QMake instead of autotools to build library + diff --git a/libs/SDLMixerX/CHANGES.txt b/libs/SDLMixerX/CHANGES.txt new file mode 100644 index 000000000..50c0fee0b --- /dev/null +++ b/libs/SDLMixerX/CHANGES.txt @@ -0,0 +1,184 @@ +2.0.3: +Sam Lantinga - Thu, Mar 1, 2018 9:06:58 AM + * Fixed regression where Mix_Init() would return 0 for available music formats + +2.0.2: +Sam Lantinga - Fri Oct 20 22:04:50 PDT 2017 + * Implemented 24-bit and surround sound support for FLAC audio files +Sam Lantinga - Thu Oct 12 21:32:44 PDT 2017 + * Updated external libraries flac-1.3.2, libmodplug-0.8.9.0, libogg-1.3.2 and libvorbis-1.3.5 +Ryan Gordon - Thu Oct 12 21:29:59 PDT 2017 + * Updated for SDL 2.0.6 and newer +Franc[e]sco - Thu Jul 20 22:03:19 2017 +0200 + * Added support for MP3 playback using mpg123 +David Ludwig - Sun Apr 10 22:35:38 2016 + * Added support for UWP / Windows 10 apps +Juha Kuikka - Fri Jan 29 12:44:01 PST 2016 + * Added Mix_OpenAudioDevice() so you can specify the audio device to open + +2.0.1: +Sam Lantinga - Tue Jul 7 11:40:33 PDT 2015 + * Added support for 'smpl' format loop points in music WAV files +Sam Lantinga - Sat Aug 23 10:57:26 2014 + * Fixed floating point exception in Mix_Volume() +David Ludwig - Mon Apr 14 22:15:36 2014 + * Added support for building for Windows RT and Windows Phone +Isaac Burns - Sun Sep 15 21:50:27 PDT 2013 + * Added support for loading MP3 files as sound chunks + +2.0.0: +Sam Lantinga - Sun Jun 9 14:45:30 PDT 2013 + * Made libmodplug the default MOD player as it is now in the public domain +Sam Lantinga - Sat Jun 1 19:11:08 PDT 2013 + * Updated for SDL 2.0 release + * SDL_LoadMUS_RW() now takes an argument telling whether or not the data source should be freed when done. + +1.2.13: +Paul P Komkoff Jr - Sun Jul 22 16:12:28 PDT 2012 + * Fixed malloc/free mismatch in the MikMod driver + +1.2.12: +Sam Lantinga - Sat Jan 14 22:00:29 2012 -0500 + * Fixed seek offset with SMPEG (was relative, should be absolute) +Sam Lantinga - Fri Jan 13 03:04:27 EST 2012 + * Fixed memory crash loading Ogg Vorbis files on Windows +Sam Lantinga - Thu Jan 05 22:51:54 2012 -0500 + * Added an Xcode project for iOS +Nikos Chantziaras - 2012-01-02 17:37:36 PST + * Added Mix_LoadMUSType_RW() so you can tell SDL_mixer what type the music is +Sam Lantinga - Sun Jan 01 16:45:58 2012 -0500 + * Fixed looping native MIDI on Mac OS X and Windows +Sam Lantinga - Sun Jan 01 01:00:51 2012 -0500 + * Added /usr/local/share/timidity to the timidity data path +Sam Lantinga - Sat Dec 31 21:26:46 2011 -0500 + * Fixed timidity loading of some MIDI files +Sam Lantinga - Sat Dec 31 19:11:59 EST 2011 + * Fixed dropping audio in the FLAC audio decoding +Sam Lantinga - Sat Dec 31 18:32:05 EST 2011 + * Fixed memory leak in SDL_LoadMUS() +Sam Lantinga - Sat Dec 31 10:22:05 EST 2011 + * Removed GPL native MIDI code for new licensing +Sam Lantinga - Sat Dec 31 10:22:05 EST 2011 + * SDL_mixer is now under the zlib license +Manuel Montezelo - 2011-12-28 11:42:44 PST + * Fixed drums playing on MIDI channel 16 with timidity +Ryan C. Gordon - Wed Jun 15 03:41:31 2011 -0400 + * The music-finished hook can start a track immediately +James Le Cuirot - Mon Mar 21 16:54:11 PDT 2011 + * Added support for FluidSynth +Egor Suvorov - Tue Jan 18 11:06:47 PST 2011 + * Added support for native MIDI on Haiku +Sam Lantinga - Tue Jan 11 01:29:19 2011 -0800 + * Added Android.mk to build on the Android platform +Jon Atkins - Sat Nov 14 13:00:18 PST 2009 + * Added support for libmodplug (disabled by default) + +1.2.11: +Sam Lantinga - Sat Nov 14 12:38:01 PST 2009 + * Fixed initialization error and crashes if MikMod library isn't available +Sam Lantinga - Sat Nov 14 11:22:14 PST 2009 + * Fixed bug loading multiple music files + +1.2.10: +Sam Lantinga - Sun Nov 8 08:34:48 PST 2009 + * Added Mix_Init()/Mix_Quit() to prevent constantly loading and unloading DLLs +Mike Frysinger - 2009-11-05 09:11:43 PST + * Check for fork/vfork on any platform, don't just assume it on UNIX +Jon Atkins - Thu Nov 5 00:02:50 2009 UTC + * Fixed export of Mix_GetNumChunkDecoders() and Mix_GetNumMusicDecoders() +C.W. Betts - 2009-11-02 00:16:21 PST + * Use newer MIDI API on Mac OS X 10.5+ + +1.2.9: +Ryan Gordon - Sun Oct 18 11:42:31 PDT 2009 + * Updated native MIDI support on Mac OS X for 10.6 +Ryan Gordon - Sun Oct 11 05:29:55 2009 UTC + * Reset channel volumes after a fade out interrupts a fade in. +Ryan Gordon - Sun Oct 11 02:59:12 2009 UTC + * Fixed crash race condition with position audio functions +Ryan Gordon - Sat Oct 10 17:05:45 2009 UTC + * Fixed stereo panning in 8-bit mode +Sam Lantinga - Sat Oct 10 11:07:15 2009 UTC + * Added /usr/share/timidity to the default timidity.cfg locations +Sam Lantinga - Sat Oct 3 13:33:36 PDT 2009 + * MOD support uses libmikmod and is dynamically loaded by default + * A patched version of libmikmod is included in libmikmod-3.1.12.zip + * The libmikmod patches fix security issues CVE-2007-6720 and CVE-2009-0179. +Sam Lantinga - Sat Oct 3 02:49:41 PDT 2009 + * Added TIMIDITY_CFG environment variable to fully locate timidity.cfg +Sam Lantinga - Fri Oct 2 07:15:35 PDT 2009 + * Implemented seamless looping for music playback +Forrest Voight - 2009-06-13 20:31:38 PDT + * ID3 files are now recognized as MP3 format +Steven Noonan - 2008-05-13 13:31:36 PDT + * Fixed native MIDI crash on 64-bit Windows +Ryan Gordon - Fri Jun 5 16:07:08 2009 UTC + * Added decoder enumeration API: + Mix_GetNumChunkDecoders(), Mix_GetChunkDecoder(), + Mix_GetNumMusicDecoders(), Mix_GetMusicDecoder() +Austen Dicken - Tue Feb 26 23:28:27 PST 2008 + * Added support for FLAC audio both as chunks and streaming +Tilman Sauerbeck - Tue Feb 26 03:44:47 PST 2008 + * Added support for streaming WAV files with Mix_LoadMUS_RW() +Ryan Gordon - Mon Feb 4 17:10:08 UTC 2008 + * Fixed crash caused by not resetting position_channels + +1.2.8: +Sam Lantinga - Wed Jul 18 09:45:54 PDT 2007 + * Improved detection of Ogg Vorbis and Tremor libraries +Ryan Gordon - Sun Jul 15 12:03:54 EDT 2007 + * Fixed memory leaks in Effects API. +David Rose - Sat Jul 14 22:16:09 PDT 2007 + * Added support for MP3 playback with libmad (for GPL projects only!) +Sam Lantinga - Sat Jul 14 21:39:30 PDT 2007 + * Fixed the final loop of audio samples of a certain size +Sam Lantinga - Sat Jul 14 21:05:09 PDT 2007 + * Fixed opening Ogg Vorbis files using different C runtimes on Windows +Philippe Simons - Sat Jul 14 20:33:17 PDT 2007 + * Added support for Ogg Vorbis playback with Tremor (an integer decoder) +Sam Lantinga - Sat Jul 14 07:02:09 PDT 2007 + * Fixed memory corruption in timidity resampling code +Ryan Gordon - Tue Jul 3 10:44:29 2007 UTC + * Fixed building SDL_mixer with SDL 1.3 pre-release +Ryan Gordon - Tue Feb 13 08:11:54 2007 UTC + * Fixed compiling both timidity and native midi in the same build +Hans de Goede - Sun Aug 20 23:25:46 2006 UTC + * Added volume control to playmus +Jonathan Atkins - Thu Aug 10 15:06:40 2006 UTC + * Fixed linking with system libmikmod +David Ergo - Fri Jun 23 09:07:19 2006 UTC + * Corrected no-op conditions in SetDistance(), SetPanning() and SetPosition() + * Fixed copy/paste errors in channel amplitudes + +1.2.7: +Sam Lantinga - Fri May 12 00:04:32 PDT 2006 + * Added support for dynamically loading SMPEG library +Sam Lantinga - Thu May 11 22:22:43 PDT 2006 + * Added support for dynamically loading Ogg Vorbis library +Sam Lantinga - Sun Apr 30 09:01:44 PDT 2006 + * Removed automake dependency, to allow Universal binaries on Mac OS X + * Added gcc-fat.sh for generating Universal binaries on Mac OS X +Sam Lantinga - Sun Apr 30 01:48:40 PDT 2006 + * Updated libtool support to version 1.5.22 +Patrice Mandin - Sat Jul 16 16:43:24 UTC 2005 + * Use SDL_RWops also for native midi mac and win32 +Patrice Mandin - Sat Jul 9 14:40:09 UTC 2005 + * Use SDL_RWops also for native midi gpl (todo: mac and win32) +Ryan C. Gordon - Sat Jul 9 01:54:03 EDT 2005 + * Tweaked Mix_Chunk's definition to make predeclaration easier. +Patrice Mandin - Mon Jul 4 19:45:40 UTC 2005 + * Search timidity.cfg also in /etc + * Fix memory leaks in timidity player + * Use also SDL_RWops to read midifiles for timidity +Ryan C. Gordon - Mon Jun 13 18:18:12 EDT 2005 + * Patch from Eric Wing to fix native midi compiling on MacOS/x86. +Sam Lantinga - Wed Dec 22 17:14:32 PST 2004 + * Disabled support for the system version of libmikmod by default +Sam Lantinga - Tue Dec 21 09:51:29 PST 2004 + * Fixed building mikmod support on UNIX + * Always build SDL_RWops music support + * Added SDL_RWops support for reading MP3 files + +1.2.6: +Jonathan Atkins - Wed, 15 Sep 2004 23:26:42 -0500 + * Added support for using the system version of libmikmod diff --git a/libs/SDLMixerX/CMakeLists.txt b/libs/SDLMixerX/CMakeLists.txt new file mode 100644 index 000000000..af55b0265 --- /dev/null +++ b/libs/SDLMixerX/CMakeLists.txt @@ -0,0 +1,818 @@ +cmake_minimum_required (VERSION 2.8.11) +project(SDLMixerX C) + +include(FindPkgConfig) +include(CheckIncludeFiles) +include(CheckFunctionExists) +include(CheckLibraryExists) +#include(CheckCSourceRuns) +#include(CheckCCompilerFlag) + +if(NOT CMAKE_VERSION VERSION_LESS 2.8.12) + set(CMAKE_MACOSX_RPATH 0) +endif() + +if(NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel." FORCE) + message("== Using default build configuration which is a Release!") +endif() + +if(CMAKE_BUILD_TYPE STREQUAL "Debug") + set(MIX_DEBUG_SUFFIX "d") +else() + set(MIX_DEBUG_SUFFIX "") +endif() + +if(WIN32) + set(CMAKE_SHARED_LIBRARY_PREFIX "") +endif() + +if(POLICY CMP0058) + cmake_policy(SET CMP0058 NEW) +endif() + +option(SSEMATH "Allow GCC to use SSE floating point math" ${OPT_DEF_SSEMATH}) +option(MMX "Use MMX assembly routines" ${OPT_DEF_ASM}) +option(3DNOW "Use 3Dnow! MMX assembly routines" ${OPT_DEF_ASM}) +option(SSE "Use SSE assembly routines" ${OPT_DEF_ASM}) +option(SSE2 "Use SSE2 assembly routines" ${OPT_DEF_SSEMATH}) +option(SSE3 "Use SSE3 assembly routines" ${OPT_DEF_SSEMATH}) + +# Settings +option(SDL_MIXER_X_STATIC "Build static library of SDL Mixer X" ON) +option(SDL_MIXER_X_SHARED "Build shared library of SDL Mixer X" ON) + +option(DOWNLOAD_AUDIO_CODECS_DEPENDENCY "Downloads and compiles AudioCodecs dependencies pack directly" OFF) +set(AUDIO_CODECS_REPO_PATH "" CACHE PATH "Path to the AudioCodecs dependencies pack") +set(AUDIO_CODECS_INSTALL_PATH "" CACHE PATH "Path to installed AudioCodecs prefix") + +if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX) + # Turn on warnings and legacy C/C++ standards to support more compilers + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -std=c90") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -pedantic -std=c++98") + # Deny undefined symbols + if(NOT APPLE) + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-undefined" ) + set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,--no-undefined" ) + endif() +endif() + +set(SDL_MIXER_INCLUDE_PATHS) + +if(NOT AUDIO_CODECS_REPO_PATH AND NOT AUDIO_CODECS_INSTALL_PATH) + # Try to resolve sqlite dependency + if(DOWNLOAD_AUDIO_CODECS_DEPENDENCY) + # Download and configure AudioCodecs dependency + set(SDL2_REPO_PATH ${CMAKE_INSTALL_PREFIX}) + set(SDL2_INCLUDE_PATH ${CMAKE_INSTALL_PREFIX}/include/SDL2) + set(SDL2_LIBS_PATH ${CMAKE_INSTALL_PREFIX}/lib) + include(cmake/DownloadAudioCodecs.cmake) + set(AUDIO_CODECS_REPO_PATH ${AUDIO_CODECS_REPOSITORY_PATH}) + set(AUDIO_CODECS_INSTALL_PATH ${AUDIO_CODECS_INSTALL_DIR}) + endif() +endif() + +set(FIND_PREFER_STATIC + "-static${MIX_DEBUG_SUFFIX}.a" + "-static${MIX_DEBUG_SUFFIX}.lib" + "${MIX_DEBUG_SUFFIX}.a" + "${MIX_DEBUG_SUFFIX}.lib" + "-static.a" + "-static.lib" + ".a" + ".lib" + "${MIX_DEBUG_SUFFIX}.dll.a" + "${MIX_DEBUG_SUFFIX}.dll.lib" + ".dll.a" + ".dll.lib" + "${MIX_DEBUG_SUFFIX}.so" + "${MIX_DEBUG_SUFFIX}.dylib" + ".so" + ".dylib" +) + +set(FIND_PREFER_SHARED + "${MIX_DEBUG_SUFFIX}.dll.a" + "${MIX_DEBUG_SUFFIX}.dll.lib" + ".dll.a" + ".dll.lib" + "${MIX_DEBUG_SUFFIX}.so" + "${MIX_DEBUG_SUFFIX}.dylib" + ".so" + ".dylib" + "-static${MIX_DEBUG_SUFFIX}.a" + "-static${MIX_DEBUG_SUFFIX}.lib" + "${MIX_DEBUG_SUFFIX}.a" + "${MIX_DEBUG_SUFFIX}.lib" + "-static.a" + "-static.lib" + ".a" + ".lib" +) + +if(AUDIO_CODECS_REPO_PATH OR AUDIO_CODECS_INSTALL_PATH) + set(AUDIO_CODECS_PATH ${AUDIO_CODECS_REPO_PATH}) + set(AUDIO_CODECS_INSTALL_DIR ${AUDIO_CODECS_INSTALL_PATH}) + set(SDL2_REPO_PATH ${AUDIO_CODECS_INSTALL_DIR}) + set(SDL2_INCLUDE_PATH ${AUDIO_CODECS_INSTALL_DIR}/include/SDL2) + link_directories(${AUDIO_CODECS_INSTALL_DIR}/lib) + list(APPEND SDL_MIXER_INCLUDE_PATHS ${AUDIO_CODECS_INSTALL_DIR}/include ${SDL2_INCLUDE_PATH}) + message("AudioCodecs will be used. No needed extra libraries installed in the system.") + set(USE_SYSTEM_AUDIO_LIBRARIES 0) + set(CMAKE_FIND_LIBRARY_SUFFIXES ${FIND_PREFER_STATIC}) +else() + message("AudioCodecs will NOT be used. Libraries will be recognized in the system.") + set(USE_SYSTEM_AUDIO_LIBRARIES 1) +endif() + +add_definitions(-DHAVE_INTTYPES_H -DHAVE_SETENV -DHAVE_SINF) +add_definitions(-Dmain=SDL_main -DPIC -D_REENTRANT -D_USE_MATH_DEFINES) + +set(SDLMixerX_SOURCES) +set(SDLMixerX_LINK_LIBS) + +# Recognize SDL2 library from the system +if(USE_SYSTEM_AUDIO_LIBRARIES) + find_package(PkgConfig) + pkg_check_modules(SDL2 REQUIRED sdl2) + list(APPEND SDL_MIXER_INCLUDE_PATHS ${SDL2_INCLUDE_DIRS}) + list(APPEND SDLMixerX_LINK_LIBS ${SDL2_LIBRARIES}) + message("== SDL2: ${SDL2_INCLUDE_DIRS} ${SDL2_LIBRARIES} ==") +endif() + +option(USE_WAV "Build with WAV codec" ON) +if(USE_WAV) + add_definitions(-DMUSIC_WAV) + list(APPEND SDLMixerX_SOURCES + ${SDLMixerX_SOURCE_DIR}/src/codecs/load_aiff.c + ${SDLMixerX_SOURCE_DIR}/src/codecs/load_voc.c + ${SDLMixerX_SOURCE_DIR}/src/codecs/music_wav.c) +endif() + +option(USE_OGG_VORBIS "Build with OGG Vorbis codec" ON) +if(USE_OGG_VORBIS) + if(USE_SYSTEM_AUDIO_LIBRARIES) + check_library_exists(vorbisfile ov_open "vorbis/vorbisfile.h" FOUND_VORBIS) + find_path(LIBVORBIS_INCLUDE_DIR vorbis/codec.h) + find_library(LIBVORBISFILE_LIB NAMES vorbisfile) + find_library(LIBVORBIS_LIB NAMES vorbis) + message("Vorbis: ${LIBVORBIS_INCLUDE_DIR} ${LIBVORBIS_LIB}") + else() + set(FOUND_VORBIS 1) + if(DOWNLOAD_AUDIO_CODECS_DEPENDENCY) + set(LIBVORBISFILE_LIB vorbisfile) + set(LIBVORBIS_LIB vorbis) + else() + find_library(LIBVORBISFILE_LIB NAMES vorbisfile + HINTS "${AUDIO_CODECS_INSTALL_PATH}/lib") + find_library(LIBVORBIS_LIB NAMES vorbis + HINTS "${AUDIO_CODECS_INSTALL_PATH}/lib") + endif() + endif() + if(FOUND_VORBIS) + message("== using Vorbis ==") + add_definitions(-DMUSIC_OGG) + list(APPEND SDL_MIXER_INCLUDE_PATHS + ${AUDIO_CODECS_PATH}/libogg/include + ${AUDIO_CODECS_PATH}/libvorbis/include + ) + list(APPEND SDLMixerX_LINK_LIBS ${LIBVORBISFILE_LIB} ${LIBVORBIS_LIB}) + set(LIBOGG_NEEDED ON) + list(APPEND SDLMixerX_SOURCES + ${SDLMixerX_SOURCE_DIR}/src/codecs/music_ogg.c) + endif() +endif() + +option(USE_OPUS "Build with OPUS codec" ON) +if(USE_OPUS) + if(USE_SYSTEM_AUDIO_LIBRARIES) + check_library_exists(opusfile op_open_file "opus/opusfile.h" FOUND_OPUS) + find_path(LIBOPUS_INCLUDE_DIR opus/opusfile.h) + find_library(LIBOPUSFILE_LIB NAMES opusfile) + find_library(LIBOPUS_LIB NAMES opusfile) + message("Opus: ${LIBOPUS_INCLUDE_DIR} ${LIBOPUSFILE_LIB} ${LIBOPUS_LIB}") + else() + set(FOUND_OPUS 1) + if(DOWNLOAD_AUDIO_CODECS_DEPENDENCY) + set(LIBOPUSFILE_LIB opusfile) + set(LIBOPUS_LIB opus) + else() + find_library(LIBOPUSFILE_LIB NAMES opusfile + HINTS "${AUDIO_CODECS_INSTALL_PATH}/lib") + find_library(LIBOPUS_LIB NAMES opus + HINTS "${AUDIO_CODECS_INSTALL_PATH}/lib") + endif() + endif() + if(FOUND_OPUS) + message("== using Opus ==") + add_definitions(-DMUSIC_OPUS) + if(AUDIO_CODECS_REPO_PATH) + list(APPEND SDL_MIXER_INCLUDE_PATHS + ${AUDIO_CODECS_PATH}/libogg/include + ${AUDIO_CODECS_PATH}/libopus/include + ${AUDIO_CODECS_PATH}/libopusfile/include + ) + endif() + if(AUDIO_CODECS_INSTALL_DIR) + list(APPEND SDL_MIXER_INCLUDE_PATHS ${AUDIO_CODECS_INSTALL_DIR}/include/opus) + endif() + list(APPEND SDLMixerX_LINK_LIBS ${LIBOPUSFILE_LIB} ${LIBOPUS_LIB}) + set(LIBOGG_NEEDED ON) + list(APPEND SDLMixerX_SOURCES + ${SDLMixerX_SOURCE_DIR}/src/codecs/music_opus.c) + endif() +endif() + +option(USE_FLAC "Build with FLAC codec" ON) +if(USE_FLAC) + if(USE_SYSTEM_AUDIO_LIBRARIES) + check_library_exists(FLAC FLAC__format_sample_rate_is_valid "FLAC/format.h" FOUND_FLAC) + find_path(LIBFLAC_INCLUDE_DIR "FLAC/all.h") + find_library(LIBFLAC_LIB NAMES FLAC) + message("FLAC: ${LIBFLAC_INCLUDE_DIR} ${LIBFLAC_LIB}") + else() + set(FOUND_FLAC 1) + if(DOWNLOAD_AUDIO_CODECS_DEPENDENCY) + set(LIBFLAC_LIB FLAC) + else() + find_library(LIBFLAC_LIB NAMES FLAC + HINTS "${AUDIO_CODECS_INSTALL_PATH}/lib") + endif() + endif() + if(FOUND_FLAC) + message("== using FLAC ==") + add_definitions(-DMUSIC_FLAC -DFLAC__NO_DLL) + if(AUDIO_CODECS_REPO_PATH) + list(APPEND SDL_MIXER_INCLUDE_PATHS + ${AUDIO_CODECS_PATH}/libogg/include + ${AUDIO_CODECS_PATH}/libFLAC/include + ) + endif() + set(LIBOGG_NEEDED ON) + list(APPEND SDLMixerX_LINK_LIBS ${LIBFLAC_LIB}) + list(APPEND SDLMixerX_SOURCES + ${SDLMixerX_SOURCE_DIR}/src/codecs/music_flac.c) + endif() +endif() + +if(LIBOGG_NEEDED) + if(USE_SYSTEM_AUDIO_LIBRARIES) + find_library(LIBOGG_LIB NAMES ogg) + else() + if(DOWNLOAD_AUDIO_CODECS_DEPENDENCY) + set(LIBOGG_LIB ogg) + else() + find_library(LIBOGG_LIB NAMES ogg + HINTS "${AUDIO_CODECS_INSTALL_PATH}/lib") + endif() + endif() + list(APPEND SDLMixerX_LINK_LIBS ${LIBOGG_LIB}) +endif() + +option(USE_MP3_ID3TAG "Build with MP3 Meta tags support provided by libID3Tag library" ON) +if(USE_MP3_ID3TAG AND NOT USE_SYSTEM_AUDIO_LIBRARIES) + message("== using ID3Tag (custom) ==") + add_definitions(-DMUSIC_MP3_ID3TAG) + if(AUDIO_CODECS_REPO_PATH) + list(APPEND SDL_MIXER_INCLUDE_PATHS ${AUDIO_CODECS_PATH}/libid3tag/include) + endif() + if(DOWNLOAD_AUDIO_CODECS_DEPENDENCY) + set(LIBID3TAG_LIB id3tag) + else() + find_library(LIBID3TAG_LIB NAMES id3tag + HINTS "${AUDIO_CODECS_INSTALL_PATH}/lib") + endif() + list(APPEND SDLMixerX_LINK_LIBS ${LIBID3TAG_LIB}) +endif() + +option(USE_MP3_MAD "Build with MAD MP3 codec" ON) +option(USE_MP3_MAD_GPL_DITHERING "Enable GPL-Licensed dithering functions for MAD library" ON) +if(USE_MP3_MAD) + if(USE_SYSTEM_AUDIO_LIBRARIES) + check_library_exists(mad mad_frame_init "mad.h" FOUND_MAD) + find_path(LIBMAD_INCLUDE_DIR "FLAC/all.h") + find_library(LIBMAD_LIB NAMES mad) + message("MAD: ${LIBMAD_INCLUDE_DIR} ${LIBMAD_LIB}") + else() + set(FOUND_MAD 1) + if(DOWNLOAD_AUDIO_CODECS_DEPENDENCY) + set(LIBMAD_LIB mad) + else() + find_library(LIBMAD_LIB NAMES mad + HINTS "${AUDIO_CODECS_INSTALL_PATH}/lib") + endif() + endif() + if(FOUND_MAD) + message("== using MAD ==") + add_definitions(-DMUSIC_MP3_MAD) + if(USE_MP3_MAD_GPL_DITHERING) + add_definitions(-DMUSIC_MP3_MAD_GPL_DITHERING) + endif() + list(APPEND SDLMixerX_LINK_LIBS ${LIBMAD_LIB}) + if(AUDIO_CODECS_REPO_PATH) + list(APPEND SDL_MIXER_INCLUDE_PATHS ${AUDIO_CODECS_PATH}/libmad/include) + endif() + list(APPEND SDLMixerX_SOURCES + ${SDLMixerX_SOURCE_DIR}/src/codecs/music_mad.c) + endif() +endif() + +option(USE_MP3_SMPEG "Build with SMPEG MP3 codec" OFF) +if(USE_MP3_SMPEG) + if(USE_SYSTEM_AUDIO_LIBRARIES) + check_library_exists(smpeg SMPEG_new "smpeg/smpeg.h" FOUND_SMPEG) + find_path(LIBSMPEG_INCLUDE_DIR "smpeg/smpeg.h") + find_library(LIBSMPEG_LIB NAMES smpeg) + message("SMPEG: ${LIBSMPEG_INCLUDE_DIR} ${LIBSMPEG_LIB}") + else() + set(FOUND_SMPEG 1) + if(DOWNLOAD_AUDIO_CODECS_DEPENDENCY) + set(LIBSMPEG_LIB smpeg) + else() + find_library(LIBSMPEG_LIB NAMES smpeg + HINTS "${AUDIO_CODECS_INSTALL_PATH}/lib") + endif() + endif() + if(FOUND_SMPEG) + message("== using SMPEG ==") + add_definitions(-DMUSIC_MP3_SMPEG) + list(APPEND SDLMixerX_LINK_LIBS ${LIBSMPEG_LIB}) + if(AUDIO_CODECS_REPO_PATH) + list(APPEND SDL_MIXER_INCLUDE_PATHS ${AUDIO_CODECS_PATH}/smpeg/include) + endif() + list(APPEND SDLMixerX_SOURCES + ${SDLMixerX_SOURCE_DIR}/src/codecs/music_smpeg.c) + endif() +endif() + +option(USE_MP3_MPG123 "[WIP, DON'T USE IT] Build with MPG123 MP3 codec" OFF) +if(USE_MP3_MPG123) + add_definitions(-DMUSIC_MP3_MPG123) + + message(WARNING "MPG123 SUPPORT IS WIP, DON'T USE IT IN PRODUCTION!!!") + # ======= Until AudioCodecs will receive buildable mpg123, detect it externally ======= + include(cmake/FindMpg123.cmake) + + if(NOT MPG123_FOUND) + message(FATAL_ERROR "MPG123 is not found!") + else() + message("MPG123 found in ${MPG123_INCLUDE_DIR} folder") + endif() + + list(APPEND SDL_MIXER_INCLUDE_PATHS ${MPG123_INCLUDE_DIRS}) + set(LIBS ${LIBS} ${MPG123_LIBRARIES}) + list(APPEND SDLMixerX_LINK_LIBS mpg123) + list(APPEND SDLMixerX_SOURCES + ${SDLMixerX_SOURCE_DIR}/src/codecs/music_mpg123.c) +endif() + +if(USE_MP3_MAD OR USE_MP3_MPG123 OR USE_MP3_SMPEG) + list(APPEND SDLMixerX_SOURCES + ${SDLMixerX_SOURCE_DIR}/src/codecs/music_id3tag.c) +endif() + +option(USE_MODPLUG "Build with ModPlug library" ON) +if(USE_MODPLUG) + if(USE_SYSTEM_AUDIO_LIBRARIES) + check_library_exists(modplug ModPlug_Load "libmodplug/modplug.h" FOUND_MODPLUG) + find_path(LIBMODPLUG_INCLUDE_DIR libmodplug/modplug.h) + find_library(LIBMODPLUG_LIB NAMES modplug) + message("ModPlug: ${LIBMODPLUG_INCLUDE_DIR} ${LIBMODPLUG_LIB}") + else() + set(FOUND_MODPLUG 1) + if(DOWNLOAD_AUDIO_CODECS_DEPENDENCY) + set(LIBMODPLUG_LIB modplug) + else() + find_library(LIBMODPLUG_LIB NAMES modplug + HINTS "${AUDIO_CODECS_INSTALL_PATH}/lib") + endif() + endif() + if(FOUND_MODPLUG) + message("== using libModPlug ==") + add_definitions(-DMUSIC_MOD_MODPLUG -DMODPLUG_STATIC) + if(AUDIO_CODECS_REPO_PATH) + list(APPEND SDL_MIXER_INCLUDE_PATHS ${AUDIO_CODECS_PATH}/libmodplug/include) + endif() + list(APPEND SDLMixerX_LINK_LIBS ${LIBMODPLUG_LIB}) + list(APPEND SDLMixerX_SOURCES + ${SDLMixerX_SOURCE_DIR}/src/codecs/music_modplug.c) + endif() +endif() + +option(USE_MIKMOD "Build with MikMod library" OFF) +if(USE_MIKMOD) + if(USE_SYSTEM_AUDIO_LIBRARIES) + check_library_exists(mikmod Player_Load "mikmod.h" FOUND_MIKMOD) + find_path(LIBMIKMOD_INCLUDE_DIR "mikmod.h") + find_library(LIBMIKMOD_LIB NAMES mikmod) + message("MikMod: ${LIBMIKMOD_INCLUDE_DIR} ${LIBMIKMOD_LIB}") + else() + set(FOUND_MIKMOD 1) + if(DOWNLOAD_AUDIO_CODECS_DEPENDENCY) + set(LIBMIKMOD_LIB mikmod) + else() + find_library(LIBMIKMOD_LIB NAMES mikmod + HINTS "${AUDIO_CODECS_INSTALL_PATH}/lib") + endif() + endif() + if(FOUND_MIKMOD) + message("== using MikMod ==") + add_definitions(-DMUSIC_MOD_MIKMOD) + if(AUDIO_CODECS_REPO_PATH) + list(APPEND SDL_MIXER_INCLUDE_PATHS ${AUDIO_CODECS_PATH}/libmikmod/include) + endif() + list(APPEND SDLMixerX_LINK_LIBS ${LIBMIKMOD_LIB}) + list(APPEND SDLMixerX_SOURCES + ${SDLMixerX_SOURCE_DIR}/src/codecs/music_mikmod.c) + endif() +endif() + +option(USE_GME "Build with Game Music Emulators library" ON) +if(USE_GME) + if(USE_SYSTEM_AUDIO_LIBRARIES) + check_library_exists(gme gme_load_file "gme.h" FOUND_GME) + find_path(LIBGME_INCLUDE_DIR "gme.h") + find_library(LIBGME_LIB NAMES gme) + find_library(LIBZLIB_LIB NAMES z zlib) + message("GME: ${LIBGME_INCLUDE_DIR} ${LIBGME_LIB}") + else() + set(FOUND_GME 1) + if(DOWNLOAD_AUDIO_CODECS_DEPENDENCY) + set(LIBGME_LIB gme) + set(LIBZLIB_LIB zlib) + else() + find_library(LIBGME_LIB NAMES gme + HINTS "${AUDIO_CODECS_INSTALL_PATH}/lib") + find_library(LIBZLIB_LIB NAMES zlib z + HINTS "${AUDIO_CODECS_INSTALL_PATH}/lib") + endif() + endif() + if(FOUND_GME) + message("== using GME ==") + add_definitions(-DMUSIC_GME) + if(AUDIO_CODECS_REPO_PATH) + list(APPEND SDL_MIXER_INCLUDE_PATHS ${AUDIO_CODECS_PATH}/libgme/include) + list(APPEND SDL_MIXER_INCLUDE_PATHS ${AUDIO_CODECS_PATH}/zlib/include) + endif() + list(APPEND SDLMixerX_LINK_LIBS ${LIBGME_LIB} ${LIBZLIB_LIB}) + list(APPEND SDLMixerX_SOURCES + ${SDLMixerX_SOURCE_DIR}/src/codecs/music_gme.c) + endif() +endif() + +if(NOT WIN32) # CMD Music is not supported on Windows + option(USE_CMD "Build with CMD music player support" ON) + if(USE_CMD) + message("== using CMD Music ==") + add_definitions(-DMUSIC_CMD -D_POSIX_C_SOURCE=1) + CHECK_FUNCTION_EXISTS(fork HAVE_FORK) + if(HAVE_FORK) + add_definitions(-DHAVE_FORK) + endif() + list(APPEND SDLMixerX_SOURCES + ${SDLMixerX_SOURCE_DIR}/src/codecs/music_cmd.c) + endif() +endif() + +option(USE_MIDI "Build with MIDI support" ON) +if(USE_MIDI) + + option(USE_MIDI_ADLMIDI "Build with libADLMIDI OPL3 Emulator based MIDI sequencer support" ON) + if(USE_MIDI_ADLMIDI) + if(USE_SYSTEM_AUDIO_LIBRARIES) + check_library_exists(ADLMIDI adl_init "adlmidi.h" FOUND_ADLMIDI) + find_path(LIBADLMIDI_INCLUDE_DIR "adlmidi.h") + find_library(LIBADLMIDI_LIB NAMES ADLMIDI) + message("ADLMIDI: ${LIBADLMIDI_INCLUDE_DIR} ${LIBADLMIDI_LIB}") + else() + set(FOUND_ADLMIDI 1) + if(DOWNLOAD_AUDIO_CODECS_DEPENDENCY) + set(LIBADLMIDI_LIB ADLMIDI) + else() + find_library(LIBADLMIDI_LIB NAMES ADLMIDI + HINTS "${AUDIO_CODECS_INSTALL_PATH}/lib") + endif() + endif() + if(FOUND_ADLMIDI) + message("== using ADLMIDI ==") + add_definitions(-DMUSIC_MID_ADLMIDI) + if(AUDIO_CODECS_REPO_PATH) + list(APPEND SDL_MIXER_INCLUDE_PATHS ${AUDIO_CODECS_PATH}/libADLMIDI/include) + endif() + set(LIBMATH_NEEDED 1) + list(APPEND SDLMixerX_LINK_LIBS ${LIBADLMIDI_LIB}) + list(APPEND SDLMixerX_SOURCES + ${SDLMixerX_SOURCE_DIR}/src/codecs/music_midi_adl.c) + endif() + endif() + + option(USE_MIDI_OPNMIDI "Build with libOPNMIDI OPN2 Emulator based MIDI sequencer support" ON) + if(USE_MIDI_OPNMIDI) + if(USE_SYSTEM_AUDIO_LIBRARIES) + check_library_exists(OPNMIDI opn_init "opnmidi.h" FOUND_OPNMIDI) + find_path(LIBOPNMIDI_INCLUDE_DIR "opnmidi.h") + find_library(LIBOPNMIDI_LIB NAMES OPNMIDI) + message("OPNMIDI: ${LIBOPNMIDI_INCLUDE_DIR} ${LIBOPNMIDI_LIB}") + else() + set(FOUND_OPNMIDI 1) + if(DOWNLOAD_AUDIO_CODECS_DEPENDENCY) + set(LIBOPNMIDI_LIB OPNMIDI) + else() + find_library(LIBOPNMIDI_LIB NAMES OPNMIDI + HINTS "${AUDIO_CODECS_INSTALL_PATH}/lib") + endif() + endif() + if(FOUND_OPNMIDI) + message("== using OPNMIDI ==") + add_definitions(-DMUSIC_MID_OPNMIDI) + if(AUDIO_CODECS_REPO_PATH) + list(APPEND SDL_MIXER_INCLUDE_PATHS ${AUDIO_CODECS_PATH}/libOPNMIDI/include) + endif() + set(LIBMATH_NEEDED 1) + list(APPEND SDLMixerX_LINK_LIBS ${LIBOPNMIDI_LIB}) + list(APPEND SDLMixerX_SOURCES + ${SDLMixerX_SOURCE_DIR}/src/codecs/music_midi_opn.c) + endif() + endif() + + option(USE_MIDI_TIMIDITY "Build with Timidity wave table MIDI sequencer support" ON) + if(USE_MIDI_TIMIDITY AND NOT USE_SYSTEM_AUDIO_LIBRARIES) + message("== using Timidity (custom) ==") + add_definitions(-DMUSIC_MID_TIMIDITY) + if(AUDIO_CODECS_REPO_PATH) + list(APPEND SDL_MIXER_INCLUDE_PATHS ${AUDIO_CODECS_PATH}/libtimidity/include) + endif() + if(DOWNLOAD_AUDIO_CODECS_DEPENDENCY) + set(LIBTIMIDITY_LIB timidity) + else() + find_library(LIBTIMIDITY_LIB NAMES timidity + HINTS "${AUDIO_CODECS_INSTALL_PATH}/lib") + endif() + list(APPEND SDLMixerX_LINK_LIBS ${LIBTIMIDITY_LIB}) + list(APPEND SDLMixerX_SOURCES + ${SDLMixerX_SOURCE_DIR}/src/codecs/music_timidity.c) + endif() + + option(USE_MIDI_FLUIDSYNTH "Build with FluidSynth wave table MIDI sequencer support" OFF) + if(USE_MIDI_FLUIDSYNTH) + if(USE_SYSTEM_AUDIO_LIBRARIES) + check_library_exists(fluidsynth new_fluid_midi_router "fluidsynth.h" FOUND_FLUIDSYNTH) + find_path(LIBFLUIDSYNTH_INCLUDE_DIR "fluidsynth.h") + find_library(LIBFLUIDSYNTH_LIB NAMES fluidsynth) + message("FluidSynth: ${LIBFLUIDSYNTH_INCLUDE_DIR} ${LIBFLUIDSYNTH_LIB}") + else() + set(FOUND_FLUIDSYNTH 1) + if(DOWNLOAD_AUDIO_CODECS_DEPENDENCY) + set(LIBFLUIDSYNTH_LIB fluidsynth) + else() + find_library(LIBFLUIDSYNTH_LIB NAMES fluidsynth + HINTS "${AUDIO_CODECS_INSTALL_PATH}/lib") + endif() + endif() + if(FOUND_FLUIDSYNTH) + message("== using FluidSynth ==") + add_definitions(-DMUSIC_MID_FLUIDSYNTH) + if(AUDIO_CODECS_REPO_PATH) + list(APPEND SDL_MIXER_INCLUDE_PATHS ${AUDIO_CODECS_PATH}/FluidLite/include) + endif() + list(APPEND SDLMixerX_LINK_LIBS ${LIBFLUIDSYNTH_LIB}) + list(APPEND SDLMixerX_SOURCES + ${SDLMixerX_SOURCE_DIR}/src/codecs/music_fluidsynth.c) + endif() + endif() + + # Native MIDI correctly works on Windows and macOS only. + if(WIN32 OR APPLE) + set(NATIVE_MIDI_SUPPORTED ON) + else() + set(NATIVE_MIDI_SUPPORTED OFF) + endif() + + option(USE_MIDI_NATIVE "Build with operating system native MIDI output support" ${NATIVE_MIDI_SUPPORTED}) + if(USE_MIDI_NATIVE) + add_definitions(-DMUSIC_MID_NATIVE) + list(APPEND SDLMixerX_SOURCES + ${SDLMixerX_SOURCE_DIR}/src/codecs/music_nativemidi.c + ${SDLMixerX_SOURCE_DIR}/src/codecs/native_midi/native_midi_common.c) + if(WIN32) + list(APPEND SDLMixerX_SOURCES + ${SDLMixerX_SOURCE_DIR}/src/codecs/native_midi/native_midi_win32.c) + list(APPEND SDLMixerX_LINK_LIBS winmm) + endif() + if(APPLE) + list(APPEND SDLMixerX_SOURCES + ${SDLMixerX_SOURCE_DIR}/src/codecs/native_midi/native_midi_macosx.c) + endif() + endif() + if(NOT USE_MIDI_ADLMIDI AND + NOT USE_MIDI_OPNMIDI AND + NOT USE_MIDI_TIMIDITY AND + NOT USE_MIDI_FLUIDSYNTH AND + NOT USE_MIDI_NATIVE) + message_error("To have MIDI support you must enable at least one MIDI sequencer library") + endif() + +endif() + +if(USE_SYSTEM_AUDIO_LIBRARIES) + find_library(LIBSDL2CUSTOM_LIB NAMES SDL2) +else() + if(DOWNLOAD_AUDIO_CODECS_DEPENDENCY) + set(LIBSDL2CUSTOM_LIB SDL2$<$:d>) + else() + set(CMAKE_FIND_LIBRARY_SUFFIXES ${FIND_PREFER_SHARED}) + find_library(LIBSDL2CUSTOM_LIB NAMES SDL2 + HINTS "${AUDIO_CODECS_INSTALL_PATH}/lib") + endif() +endif() +list(APPEND SDLMixerX_LINK_LIBS ${LIBSDL2CUSTOM_LIB}) + +if(LIBMATH_NEEDED AND NOT MSVC) + list(APPEND SDLMixerX_LINK_LIBS m) +endif() + +if(WIN32) + option(BUILD_AS_VB6_BINDING "Compile library into solid module compatible with VisualBasic 6" OFF) + if(BUILD_AS_VB6_BINDING) + message("== SDL Mixer X will be built as solid module that is ready for MS-VB6 binding! ==") + list(APPEND SDLMixerX_SOURCES ${SDLMixerX_SOURCE_DIR}/src/vb6_binding/vb6_sdl_binds.c) + list(REMOVE_ITEM SDLMixerX_LINK_LIBS SDL2) + list(REMOVE_ITEM SDLMixerX_LINK_LIBS SDL2$<$:d>) + list(APPEND SDLMixerX_LINK_LIBS + SDL2-static + uuid winmm ole32 imm32 version oleaut32 user32 gdi32) + if(NOT MSVC) + list(APPEND SDLMixerX_LINK_LIBS stdc++ gcc pthread) + endif() + endif() +endif() + +if(APPLE) + find_library(APPLE_CORE_AUDIO CoreAudio) + find_library(APPLE_IOKIT IOKit) + find_library(APPLE_COCOA Cocoa) + find_library(APPLE_AUDIOTOOLBOX AudioToolbox) + find_library(APPLE_CORE_VIDEO CoreVideo) + find_library(APPLE_CORE_FOUNDATION CoreFoundation) + find_library(APPLE_CARBON Carbon) + find_library(APPLE_FORCE_FEEDBACK ForceFeedback) + find_library(ICONV_LIB iconv) + list(APPEND SDLMixerX_LINK_LIBS + ${APPLE_CORE_AUDIO} + ${APPLE_COCOA} + ${APPLE_CORE_VIDEO} + ${APPLE_CORE_FOUNDATION} + ${APPLE_FORCE_FEEDBACK} + ${APPLE_IOKIT} + ${APPLE_CARBON} + ${APPLE_AUDIOTOOLBOX} + ${ICONV_LIB}) + list(APPEND SDLMixerX_LINK_LIBS objc) +endif() + +if(NOT MSVC) + list(APPEND SDLMixerX_LINK_LIBS stdc++) +endif() + +list(APPEND SDLMixerX_SOURCES + ${SDLMixerX_SOURCE_DIR}/src/effect_position.c + ${SDLMixerX_SOURCE_DIR}/src/effects_internal.c + ${SDLMixerX_SOURCE_DIR}/src/effect_stereoreverse.c + ${SDLMixerX_SOURCE_DIR}/src/mixer.c + ${SDLMixerX_SOURCE_DIR}/src/music.c + ${SDLMixerX_SOURCE_DIR}/src/mixer_x_deprecated.c + ) + +file(GLOB SDLMixerX_SOURCES ${SDLMixerX_SOURCES}) + +set(SDLMixerX_INSTALLS) + +if(SDL_MIXER_X_STATIC AND NOT BUILD_AS_VB6_BINDING) + add_library(SDL2_mixer_ext_Static STATIC ${SDLMixerX_SOURCES}) + if(WIN32) + set_target_properties(SDL2_mixer_ext_Static PROPERTIES OUTPUT_NAME SDL2_mixer_ext-static) + else() + set_target_properties(SDL2_mixer_ext_Static PROPERTIES OUTPUT_NAME SDL2_mixer_ext) + endif() + target_include_directories(SDL2_mixer_ext_Static PRIVATE + ${SDLMixerX_SOURCE_DIR}/include/SDL_mixer_ext + ${SDLMixerX_SOURCE_DIR}/src + ${SDLMixerX_SOURCE_DIR}/src/codecs + ${AUDIO_CODECS_INSTALL_DIR}/include/SDL2 + ) + target_include_directories(SDL2_mixer_ext_Static PUBLIC + ${SDLMixerX_SOURCE_DIR}/include + ${SDL_MIXER_INCLUDE_PATHS} + ) + if(DOWNLOAD_AUDIO_CODECS_DEPENDENCY AND AUDIO_CODECS_INSTALL_PATH) + add_dependencies(SDL2_mixer_ext_Static AudioCodecs) + endif() + set_target_properties(SDL2_mixer_ext_Static + PROPERTIES + ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib" + LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib" + RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin" + ) + if(DOWNLOAD_AUDIO_CODECS_DEPENDENCY) + add_custom_command( + TARGET SDL2_mixer_ext_Static POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy + ${CMAKE_SOURCE_DIR}/include/SDL_mixer_ext/SDL_mixer_ext.h + ${AUDIO_CODECS_INSTALL_DIR}/include/SDL2) + endif() + list(APPEND SDLMixerX_INSTALLS SDL2_mixer_ext_Static) +endif() + +if(WIN32) + list(APPEND SDLMixerX_SOURCES ${SDLMixerX_SOURCE_DIR}/version.rc) +endif() + +if(SDL_MIXER_X_SHARED AND NOT BUILD_AS_VB6_BINDING) + add_library(SDL2_mixer_ext SHARED ${SDLMixerX_SOURCES}) + target_link_libraries(SDL2_mixer_ext ${SDLMixerX_LINK_LIBS}) + target_include_directories(SDL2_mixer_ext PRIVATE + ${SDLMixerX_SOURCE_DIR}/include/SDL_mixer_ext + ${SDLMixerX_SOURCE_DIR}/src + ${SDLMixerX_SOURCE_DIR}/src/codecs + ${AUDIO_CODECS_INSTALL_DIR}/include/SDL2 + ) + target_include_directories(SDL2_mixer_ext PUBLIC + ${SDLMixerX_SOURCE_DIR}/include + ${SDL_MIXER_INCLUDE_PATHS} + ) + if(DOWNLOAD_AUDIO_CODECS_DEPENDENCY AND AUDIO_CODECS_INSTALL_PATH) + add_dependencies(SDL2_mixer_ext AudioCodecs) + endif() + set_target_properties(SDL2_mixer_ext + PROPERTIES + ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib" + LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib" + RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin" + ) + if(DOWNLOAD_AUDIO_CODECS_DEPENDENCY) + add_custom_command( + TARGET SDL2_mixer_ext POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy + ${CMAKE_SOURCE_DIR}/include/SDL_mixer_ext/SDL_mixer_ext.h + ${AUDIO_CODECS_INSTALL_DIR}/include/SDL2) + endif() + list(APPEND SDLMixerX_INSTALLS SDL2_mixer_ext) +endif() + +if(BUILD_AS_VB6_BINDING) + add_library(SDL2_mixer_ext_VB6 MODULE ${SDLMixerX_SOURCES}) + set_target_properties(SDL2_mixer_ext_VB6 PROPERTIES OUTPUT_NAME SDL2MixerVB) + set_target_properties(SDL2_mixer_ext_VB6 PROPERTIES PREFIX "") + target_compile_definitions(SDL2_mixer_ext_VB6 PRIVATE -DFORCE_STDCALLS) + target_link_libraries(SDL2_mixer_ext_VB6 ${SDLMixerX_LINK_LIBS}) + target_include_directories(SDL2_mixer_ext_VB6 PUBLIC + ${SDLMixerX_SOURCE_DIR}/include/SDL_mixer_ext + ${SDLMixerX_SOURCE_DIR}/src + ${SDLMixerX_SOURCE_DIR}/src/codecs + ${AUDIO_CODECS_INSTALL_DIR}/include/SDL2 + ) + target_include_directories(SDL2_mixer_ext_VB6 PUBLIC + ${SDLMixerX_SOURCE_DIR}/include + ${SDL_MIXER_INCLUDE_PATHS} + ) + set_target_properties(SDL2_mixer_ext_VB6 PROPERTIES LINK_FLAGS + "-Wl,--add-stdcall-alias -static-libgcc -static-libstdc++ -static -lpthread") + if(DOWNLOAD_AUDIO_CODECS_DEPENDENCY AND AUDIO_CODECS_INSTALL_PATH) + add_dependencies(SDL2_mixer_ext_VB6 AudioCodecs) + endif() + set_target_properties(SDL2_mixer_ext_VB6 + PROPERTIES + ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/sdl-mixer-vb6" + LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/sdl-mixer-vb6" + RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/sdl-mixer-vb6" + ) + add_custom_command( + TARGET SDL2_mixer_ext_VB6 POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy + ${CMAKE_SOURCE_DIR}/VB6_Wrapper/modSDL2_mixer_ext_vb6.bas + ${CMAKE_BINARY_DIR}/sdl-mixer-vb6) + list(APPEND SDLMixerX_INSTALLS SDL2_mixer_ext_VB6) +endif() + +install(TARGETS ${SDLMixerX_INSTALLS} + RUNTIME DESTINATION "bin" + LIBRARY DESTINATION "lib" + ARCHIVE DESTINATION "lib" + FRAMEWORK DESTINATION "lib" + INCLUDES DESTINATION "include") + +if(DOWNLOAD_AUDIO_CODECS_DEPENDENCY) + install(DIRECTORY ${AUDIO_CODECS_INSTALL_DIR}/bin + DESTINATION .) + install(DIRECTORY ${AUDIO_CODECS_INSTALL_DIR}/lib + DESTINATION .) + install(DIRECTORY ${AUDIO_CODECS_INSTALL_DIR}/include + DESTINATION .) +endif() + +install(FILES + include/SDL_mixer_ext/begin_code.h + include/SDL_mixer_ext/close_code.h + include/SDL_mixer_ext/SDL_mixer_ext.h + DESTINATION include/SDL2) + diff --git a/libs/SDLMixerX/COPYING.txt b/libs/SDLMixerX/COPYING.txt new file mode 100644 index 000000000..e8f8643f2 --- /dev/null +++ b/libs/SDLMixerX/COPYING.txt @@ -0,0 +1,24 @@ +/* + SDL Mixer X: An extended audio mixer library, forked from SDL_mixer + Copyright (C) 2014-2018 Vitaly Novichkov + + SDL_mixer: An audio mixer library based on the SDL library + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. + +*/ diff --git a/libs/SDLMixerX/GPLv2.txt b/libs/SDLMixerX/GPLv2.txt new file mode 100644 index 000000000..1f963da0d --- /dev/null +++ b/libs/SDLMixerX/GPLv2.txt @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. + diff --git a/libs/SDLMixerX/GPLv3.txt b/libs/SDLMixerX/GPLv3.txt new file mode 100644 index 000000000..10926e87f --- /dev/null +++ b/libs/SDLMixerX/GPLv3.txt @@ -0,0 +1,675 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. + diff --git a/libs/SDLMixerX/README.txt b/libs/SDLMixerX/README.txt new file mode 100644 index 000000000..998e0d9d3 --- /dev/null +++ b/libs/SDLMixerX/README.txt @@ -0,0 +1,248 @@ +SDL Mixer X (aka SDL Mixer 2.0 Modded or SDL_mixer_ext), +by Vitaly Novichkov , +forked from SDL Mixer 2.0 by Sam Lantinga + +vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv +WARNING: The licenses for libmad, ADLMIDI, OPNMIDI, and GME is GPL, + which means that in order to use it your application must + also be GPL! +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +The latest original version of this library is available from: +http://www.libsdl.org/projects/SDL_mixer/ + +Sources of modified library version is available in the PGE Project's sources: +https://github.com/Wohlhabend-Networks/PGE-Project/ + in the folder: _Libs/SDL2_mixer_modified/ +or: +https://bitbucket.org/Wohlstand/pge-project + in the folder: _Libs/SDL2_mixer_modified/ + +============================================================================= +Difference between original and this library: +----------------------------------------------------------------------------- ++ Added new codecs: + - Game Music Emulators (LGPL v2.1) which adds support of chip tunes + like NSF, VGM, SPC, HES, etc. + - libADLMIDI (GPL v3, LGPL v3) (remake from ADLMIDI) to play MIDI with + emulated OPL3 synthesiser, also supports loop points + "loopStart" and "loopEnd" + - libOPNMIDI (GPL v3, LGPL v3) to play MIDI with + emulated OPN2 synthesiser, also supports loop points + "loopStart" and "loopEnd" ++ Added some new functions ++ Added support of loop points for OGG files (via "LOOPSTART" and "LOOPEND" + (or "LOOPLENGTH" to be compatible with RPG Maker) vorbis comments) ++ Reorganized music codecs processing system ++ Added support to get current position and track lenght for a seekable codecs + +vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv +IMPORTANT: To choice a track number of NSF, GBM, HES, etc file, + you must append "|xxx" to end of file path for + Mix_LoadMUS function. + Where xxx - actual number of chip track, (from 0 to N-1) + Examples: "file.nsf|12", "file.hes|2" +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv +Arguments are passing like argument for a GME-based files (NSF, HES, etc.): +Syntax for MIDI is: + myfile.mid|xyy;xyy;xyy;...; + where x - parameter type + where y - value (every value must be ended with semicolon!) + +available parameters: + s - use a specific synthesiser + 0 - ADLMIDI + 1 - Native MIDI [Win32/OSX/Haiku only] + 2 - Timidity + 3 - Fluidsynth + b - value from 0 to 66 - number of ADLMIDI bank + t - (0 or 1) enable deep tremolo on ADLMIDI + v - (0 or 1) enable deep vibrato on ADLMIDI + m - (0 or 1) enable scalable modulation on ADLMIDI + a - (0 or 1) enable AdLib mode of percussion on ADLMIDI +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +============================================================================= +Added music codecs: +----------------------------------------------------------------------------- +General: +- MUS_GME - Game Music Emulatirs + +MIDI Playing: +- ADLMIDI - A software synthesizer is based on Yamaha OPL3 (YMF262) chip emulator +- OPNMIDI - A software synthesizer is based on Yamaha OPL3 (YM2612) chip emulator + +============================================================================= +Added functions: +----------------------------------------------------------------------------- +/* + Allows you to set up custom path for Timidify patches +*/ +void MIX_Timidity_addToPathList(const char *path); + +/* + Get music title from meta-tag if possible. If title tag is empty, filename will be returned +*/ +const char* Mix_GetMusicTitle(const Mix_Music *music); + +/* + Get music title from meta-tag if possible +*/ +const char* Mix_GetMusicTitleTag(const Mix_Music *music); + +/* + Get music artist from meta-tag if possible +*/ +const char* Mix_GetMusicArtistTag(const Mix_Music *music); + +/* + Get music album from meta-tag if possible +*/ +const char* Mix_GetMusicAlbumTag(const Mix_Music *music); + +/* + Get music copyright from meta-tag if possible +*/ +const char* Mix_GetMusicCopyrightTag(const Mix_Music *music); + +/* + Load music from memory with passing of extra arguments +*/ +Mix_Music * SDLCALLCC Mix_LoadMUS_RW_ARG(SDL_RWops *src, int freesrc, char *args) + +/* + Load music from memory with passing NSF/HES/etc. track number (accepts integer unlike SDLCALLCC Mix_LoadMUS_RW_ARG) +*/ +Mix_Music * SDLCALLCC Mix_LoadMUS_RW_GME(SDL_RWops *src, int freesrc, int trackID) + +typedef enum +{ + MIDI_ADLMIDI, + MIDI_Native, + MIDI_Timidity, + MIDI_OPNMIDI, + MIDI_Fluidsynth, + MIDI_KnuwnDevices /* Count of MIDI device types */ +} Mix_MIDI_Device; + +/* + Allows you to toggle MIDI Devices! + (change will be applied on re-opening of MIDI file) + Attempt to toggle unsupported MIDI device takes no effect + (for case when library built without linking of required library) +*/ +int Mix_SetMidiDevice(int device); + +/* + Returns current ADLMIDI bank number +*/ +int MIX_ADLMIDI_getBankID(); + +/* + Changes ADLMIDI bank number (changes applying on MIDI file reopen) +*/ +void MIX_ADLMIDI_setBankID(int bnk); + +/* + Returns current state of ADLMIDI deep tremolo flag +*/ +int MIX_ADLMIDI_getTremolo(); + +/* + Changes ADLMIDI deep tremolo flag (changes applying on MIDI file reopen) +*/ +void MIX_ADLMIDI_setTremolo(int tr); + +/* + Returns current state of ADLMIDI deep vibrato flag +*/ +int MIX_ADLMIDI_getVibrato(); + +/* + Changes ADLMIDI deep vibrato flag (changes applying on MIDI file reopen) +*/ +void MIX_ADLMIDI_setVibrato(int vib); + +/* + Returns current state of ADLMIDI deep scaling modulation flag +*/ +int MIX_ADLMIDI_getScaleMod(); + +/* + Changes ADLMIDI scaling modulation flag (changes applying on MIDI file reopen) +*/ +void MIX_ADLMIDI_setScaleMod(int sc); + +/* + Resets ADLMIDI flags and settings to default state +*/ +void MIX_ADLMIDI_setSetDefaults(); + +/* + Get the time current position of music stream + returns -1.0 if this feature is not supported for some codec +*/ +double Mix_GetMusicPosition(Mix_Music *music); +/* + Get the total time length of music stream + returns -1.0 if this feature is not supported for some codec + */ +double Mix_GetMusicTotalTime(Mix_Music *music); + +/* + Get the loop start time position of music stream + returns -1.0 if this feature is not used for this music or not supported for some codec +*/ +double Mix_GetMusicLoopStartTime(Mix_Music *music); +/* + Get the loop end time position of music stream + returns -1.0 if this feature is not used for this music or not supported for some codec +*/ +double Mix_GetMusicLoopEndTime(Mix_Music *music); +/* + Get the loop time length of music stream + returns -1.0 if this feature is not used for this music or not supported for some codec +*/ +double Mix_GetMusicLoopLengthTime(Mix_Music *music); + +============================================================================= + +Due to popular demand, here is a simple multi-channel audio mixer. +It supports 8 channels of 16 bit stereo audio, plus a single channel +of music, mixed by the Modplug MOD, Timidity MIDI, ADLMIDI, GME +and LibMAD MP3 libraries. + +See the header file SDL_mixer_ext.h for documentation on this mixer library. + +The mixer can currently load Microsoft WAVE files and Creative Labs VOC +files as audio samples, and can load MIDI files via Timidity and the +following music formats via MikMod: .MOD .S3M .IT .XM. It can load +Ogg Vorbis streams as music if built with Ogg Vorbis or Tremor libraries, +and finally it can load MP3 music using the SMPEG or libmad libraries. + +Tremor decoding is disabled by default; you can enable it by passing + --enable-music-ogg-tremor +to configure, or by defining OGG_MUSIC and OGG_USE_TREMOR. + +libmad decoding is disabled by default; you can enable it by passing + --enable-music-mp3-mad +to configure, or by defining MP3_MAD_MUSIC +vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv +WARNING: The license for libmad is GPL, which means that in order to + use it your application must also be GPL! +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +The process of mixing MIDI files to wave output is very CPU intensive, +so if playing regular WAVE files sound great, but playing MIDI files +sound choppy on slow computers, try using 8-bit audio, mono audio, +or lower frequencies. + +To play MIDI files via Timidity, you'll need to get a complete set of GUS patches +from: +http://www.libsdl.org/projects/mixer/timidity/timidity.tar.gz +and unpack them in /usr/local/lib under UNIX, and C:\ under Win32. + +This library is under the zlib license, see the file "COPYING.txt" for details. + + + diff --git a/libs/SDLMixerX/SDL2_mixer_ext.License.txt b/libs/SDLMixerX/SDL2_mixer_ext.License.txt new file mode 100644 index 000000000..58806358d --- /dev/null +++ b/libs/SDLMixerX/SDL2_mixer_ext.License.txt @@ -0,0 +1,104 @@ +======================================================================== +SDL_mixer_ext {aka SDL Mixer X, SDL Mixer 2.0 Modded}, by Vitaly Novichkov +forked from SDL Mixer 2.0 by Sam Lantinga +======================================================================== + +SDL_mixer_ext: An extended audio mixer library, forked from SDL_mixer +Copyright (C) 2014-2018 Vitaly Novichkov + +SDL_mixer: An audio mixer library based on the SDL library +Copyright (C) 1997-2018 Sam Lantinga + +Sources of modified library version is available on GitHub: +https://github.com/WohlSoft/SDL-Mixer-X + +This software is provided 'as-is', without any express or implied +warranty. In no event will the authors be held liable for any damages +arising from the use of this software. + +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it +freely, subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. +2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. +3. This notice may not be removed or altered from any source distribution. + +======================================================================== +Statically linked libraries: +======================================================================== +------------------------------------------------------------------------ +libADLMIDI: is a free MIDI to WAV conversion library with OPL3 emulation + +Original ADLMIDI code: Copyright (c) 2010-2014 Joel Yliluoma +ADLMIDI Library API: Copyright (c) 2015-2018 Vitaly Novichkov + +Library is based on the ADLMIDI, a MIDI player for Linux and Windows +with OPL3 emulation: +http://iki.fi/bisqwit/source/adlmidi.html + +Source code: https://github.com/Wohlstand/libADLMIDI + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +------------------------------------------------------------------------ + +Game Music Emulators: is a free chuptunes to WAV conversion library. + +Source code: https://bitbucket.org/mpyne/game-music-emu + +Copyright (C) 2003-2006 Shay Green. + +This module is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published +by the Free Software Foundation; either version 2.1 of the License, +or (at your option) any later version. + +This module is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public +License along with this module; +If not, see . + +------------------------------------------------------------------------ + +libmad: MPEG audio decoder library + +Copyright (C) 2000-2004 Underbit Technologies, Inc. + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +If you would like to negotiate alternate licensing terms, you may do +so by contacting: Underbit Technologies, Inc. + +------------------------------------------------------------------------ diff --git a/libs/SDLMixerX/SRB2Note.txt b/libs/SDLMixerX/SRB2Note.txt new file mode 100644 index 000000000..6036d394e --- /dev/null +++ b/libs/SDLMixerX/SRB2Note.txt @@ -0,0 +1,7 @@ +i686-w64-mingw32/bin/libfluidsynth-2.dll was grabbed from GZDoom v3.5.1, because this build does not have glib, gthread, or sndfile external dependencies. + +sdl_mixer_ext2.dll requires libgcc and libstdc++ external dependencies. While passing to the linker "-Bstatic -lgcc" works fine, adding "-lstdc++" to -Bstatic generates linker errors. + +Hence, libstdc++ needs to be bundled as DLL (and consequently, libgcc.) + +If you try to build yourself, make sure -lstdc++ does not follow -Bdynamic in the linker flags, because otherwise it will link to the DLL. diff --git a/libs/SDLMixerX/SRB2Note_cmakeflags.png b/libs/SDLMixerX/SRB2Note_cmakeflags.png new file mode 100644 index 000000000..ffcf269a4 Binary files /dev/null and b/libs/SDLMixerX/SRB2Note_cmakeflags.png differ diff --git a/libs/SDLMixerX/i686-w64-mingw32/bin/SDL2_mixer_ext.dll b/libs/SDLMixerX/i686-w64-mingw32/bin/SDL2_mixer_ext.dll new file mode 100644 index 000000000..158aad8c3 Binary files /dev/null and b/libs/SDLMixerX/i686-w64-mingw32/bin/SDL2_mixer_ext.dll differ diff --git a/libs/SDLMixerX/i686-w64-mingw32/bin/libfluidsynth-2.dll b/libs/SDLMixerX/i686-w64-mingw32/bin/libfluidsynth-2.dll new file mode 100644 index 000000000..1b768a6c1 Binary files /dev/null and b/libs/SDLMixerX/i686-w64-mingw32/bin/libfluidsynth-2.dll differ diff --git a/libs/SDLMixerX/i686-w64-mingw32/bin/libgcc_s_sjlj-1.dll b/libs/SDLMixerX/i686-w64-mingw32/bin/libgcc_s_sjlj-1.dll new file mode 100644 index 000000000..0a62946cb Binary files /dev/null and b/libs/SDLMixerX/i686-w64-mingw32/bin/libgcc_s_sjlj-1.dll differ diff --git a/libs/SDLMixerX/i686-w64-mingw32/bin/libstdc++-6.dll b/libs/SDLMixerX/i686-w64-mingw32/bin/libstdc++-6.dll new file mode 100644 index 000000000..e9feebaaa Binary files /dev/null and b/libs/SDLMixerX/i686-w64-mingw32/bin/libstdc++-6.dll differ diff --git a/libs/SDLMixerX/i686-w64-mingw32/include/SDL2/SDL_mixer_ext.h b/libs/SDLMixerX/i686-w64-mingw32/include/SDL2/SDL_mixer_ext.h new file mode 100644 index 000000000..3a6b91b50 --- /dev/null +++ b/libs/SDLMixerX/i686-w64-mingw32/include/SDL2/SDL_mixer_ext.h @@ -0,0 +1,867 @@ +/* + SDL Mixer X: An extended audio mixer library, forked from SDL_mixer + Copyright (C) 2014-2018 Vitaly Novichkov + + SDL_mixer: An audio mixer library based on the SDL library + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#ifndef SDL_MIXER_H_ +#define SDL_MIXER_H_ + +#include "SDL_stdinc.h" +#include "SDL_rwops.h" +#include "SDL_audio.h" +#include "SDL_endian.h" +#include "SDL_version.h" +#include "begin_code.h" + +/* Let applications recogonize which SDL Mixer edition is in use: Official or Extended fork by Wohlstand */ +#define SDL_MIXER_X 1 + +#define MIXSDLCALL + +#if defined(FORCE_STDCALLS) && defined(_WIN32) +#ifdef SDLCALL +#undef SDLCALL +#endif +#define SDLCALL __stdcall +#define SDLCALLCC __stdcall +#else +#define SDLCALLCC +#endif + +#ifndef DEPRECATED +#ifdef __GNUC__ +#define DEPRECATED(func) func __attribute__ ((deprecated)) +#elif defined(_MSC_VER) +#define DEPRECATED(func) __declspec(deprecated) func +#else +#pragma message("WARNING: You need to implement DEPRECATED for this compiler") +#define DEPRECATED(func) func +#endif +#endif + +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + +/* Printable format: "%d.%d.%d", MAJOR, MINOR, PATCHLEVEL +*/ +#define SDL_MIXER_MAJOR_VERSION 2 +#define SDL_MIXER_MINOR_VERSION 2 +#define SDL_MIXER_PATCHLEVEL 0 + +/* This macro can be used to fill a version structure with the compile-time + * version of the SDL_mixer library. + */ +#define SDL_MIXER_VERSION(X) \ +{ \ + (X)->major = SDL_MIXER_MAJOR_VERSION; \ + (X)->minor = SDL_MIXER_MINOR_VERSION; \ + (X)->patch = SDL_MIXER_PATCHLEVEL; \ +} + +/* Backwards compatibility */ +#define MIX_MAJOR_VERSION SDL_MIXER_MAJOR_VERSION +#define MIX_MINOR_VERSION SDL_MIXER_MINOR_VERSION +#define MIX_PATCHLEVEL SDL_MIXER_PATCHLEVEL +#define MIX_VERSION(X) SDL_MIXER_VERSION(X) + +/** + * This is the version number macro for the current SDL_mixer version. + */ +#define SDL_MIXER_COMPILEDVERSION \ + SDL_VERSIONNUM(SDL_MIXER_MAJOR_VERSION, SDL_MIXER_MINOR_VERSION, SDL_MIXER_PATCHLEVEL) + +/** + * This macro will evaluate to true if compiled with SDL_mixer at least X.Y.Z. + */ +#define SDL_MIXER_VERSION_ATLEAST(X, Y, Z) \ + (SDL_MIXER_COMPILEDVERSION >= SDL_VERSIONNUM(X, Y, Z)) + +/* This function gets the version of the dynamically linked SDL_mixer library. + it should NOT be used to fill a version structure, instead you should + use the SDL_MIXER_VERSION() macro. + */ +extern DECLSPEC const SDL_version * SDLCALL Mix_Linked_Version(void); + +typedef enum +{ + MIX_INIT_FLAC = 0x00000001, + MIX_INIT_MOD = 0x00000002, + MIX_INIT_MP3 = 0x00000008, + MIX_INIT_OGG = 0x00000010, + MIX_INIT_MID = 0x00000020, + MIX_INIT_OPUS = 0x00000040 +} MIX_InitFlags; + +/* Loads dynamic libraries and prepares them for use. Flags should be + one or more flags from MIX_InitFlags OR'd together. + It returns the flags successfully initialized, or 0 on failure. + */ +extern DECLSPEC int SDLCALL Mix_Init(int flags); + +/* Unloads libraries loaded with Mix_Init */ +extern DECLSPEC void SDLCALL Mix_Quit(void); + + +/* The default mixer has 8 simultaneous mixing channels */ +#ifndef MIX_CHANNELS +#define MIX_CHANNELS 8 +#endif + +/* Good default values for a PC soundcard */ +#define MIX_DEFAULT_FREQUENCY 44100 +#if SDL_BYTEORDER == SDL_LIL_ENDIAN +#define MIX_DEFAULT_FORMAT AUDIO_S16LSB +#else +#define MIX_DEFAULT_FORMAT AUDIO_S16MSB +#endif +#define MIX_DEFAULT_CHANNELS 2 +#define MIX_MAX_VOLUME SDL_MIX_MAXVOLUME /* Volume of a chunk */ + +/* The internal format for an audio chunk */ +typedef struct Mix_Chunk { + int allocated; + Uint8 *abuf; + Uint32 alen; + Uint8 volume; /* Per-sample volume, 0-128 */ +} Mix_Chunk; + +/* The different fading types supported */ +typedef enum { + MIX_NO_FADING, + MIX_FADING_OUT, + MIX_FADING_IN +} Mix_Fading; + +/* These are types of music files (not libraries used to load them) */ +typedef enum { + MUS_NONE, + MUS_CMD, + MUS_WAV, + MUS_MOD, + MUS_MID, + MUS_OGG, + MUS_MP3, + MUS_MP3_MAD_UNUSED, + MUS_FLAC, + MUS_MODPLUG_UNUSED, + MUS_OPUS, + MUS_GME, + MUS_ADLMIDI/*Use ADLMIDI coded for super-special formats like IMF, MUS or XMI are can't be played without ADLMIDI*/ +} Mix_MusicType; + +typedef enum { + MIDI_ADLMIDI, + MIDI_Native, + MIDI_Timidity, + MIDI_OPNMIDI, + MIDI_Fluidsynth, + MIDI_ANY, + MIDI_KnuwnDevices /* Count of MIDI device types */ +} Mix_MIDI_Device; + +/* Volume model type in the ADLMIDI */ +typedef enum { + ADLMIDI_VM_AUTO, + ADLMIDI_VM_GENERIC, + ADLMIDI_VM_CMF, + ADLMIDI_VM_DMX, + ADLMIDI_VM_APOGEE, + ADLMIDI_VM_9X +} Mix_ADLMIDI_VolumeModel; + +/* OPL3 chip emulators for ADLMIDI */ +typedef enum { + ADLMIDI_OPL3_EMU_DEFAULT = -1, + ADLMIDI_OPL3_EMU_NUKED = 0, + ADLMIDI_OPL3_EMU_NUKED_1_7_4, + ADLMIDI_OPL3_EMU_DOSBOX, +} Mix_ADLMIDI_Emulator; + +/* OPN2 chip emulators for OPNMIDI */ +typedef enum { + OPNMIDI_OPN2_EMU_DEFAULT = -1, + OPNMIDI_OPN2_EMU_MIME = 0, + OPNMIDI_OPN2_EMU_NUKED, + OPNMIDI_OPN2_EMU_GENS, +} Mix_OPNMIDI_Emulator; + +/* The internal format for a music chunk interpreted via mikmod */ +typedef struct _Mix_Music Mix_Music; + +/* Open the mixer with a certain audio format */ +extern DECLSPEC int SDLCALL Mix_OpenAudio(int frequency, Uint16 format, int channels, int chunksize); + +/* Open the mixer with specific device and certain audio format */ +extern DECLSPEC int SDLCALL Mix_OpenAudioDevice(int frequency, Uint16 format, int channels, int chunksize, const char* device, int allowed_changes); + +/* Dynamically change the number of channels managed by the mixer. + If decreasing the number of channels, the upper channels are + stopped. + This function returns the new number of allocated channels. + */ +extern DECLSPEC int SDLCALL Mix_AllocateChannels(int numchans); + +/* Find out what the actual audio device parameters are. + This function returns 1 if the audio has been opened, 0 otherwise. + */ +extern DECLSPEC int SDLCALL Mix_QuerySpec(int *frequency,Uint16 *format,int *channels); + +/* Load a wave file or a music (.mod .s3m .it .xm) file + IMPORTANT: To choice a track number of NSF, GBM, HES, etc file, + you must append "|xxx" to end of file path for + Mix_LoadMUS function. + Where xxx - actual number of chip track, (from 0 to N-1) + Examples: "file.nsf|12", "file.hes|2" +*/ +extern DECLSPEC Mix_Chunk * SDLCALL Mix_LoadWAV_RW(SDL_RWops *src, int freesrc); +#define Mix_LoadWAV(file) Mix_LoadWAV_RW(SDL_RWFromFile(file, "rb"), 1) +extern DECLSPEC Mix_Music * SDLCALL Mix_LoadMUS(const char *file); + +/* Load a music file from an SDL_RWop object + * Matt Campbell (matt@campbellhome.dhs.org) April 2000 */ +extern DECLSPEC Mix_Music * SDLCALL Mix_LoadMUS_RW(SDL_RWops *src, int freesrc); + +/* Load a music file from an SDL_RWop object with custom arguments (trackID for GME or settings for a MIDI playing) + * Arguments are taking no effect for file formats which are not supports extra arguments. + */ +extern DECLSPEC Mix_Music *SDLCALL Mix_LoadMUS_RW_ARG(SDL_RWops *src, int freesrc, const char *args); + +/* Load a music file from an SDL_RWop object with custom trackID for GME. + * trackID argument takes no effect for non-NSF,HES,GBM,etc. file formats. + * Default value should be 0 + */ +extern DECLSPEC Mix_Music *SDLCALL Mix_LoadMUS_RW_GME(SDL_RWops *src, int freesrc, int trackID); + +/* Load a music file from an SDL_RWop object assuming a specific format */ +extern DECLSPEC Mix_Music * SDLCALL Mix_LoadMUSType_RW(SDL_RWops *src, Mix_MusicType type, int freesrc); + +/* Load a music file from an SDL_RWop object assuming a specific format + with custom arguments (trackID for GME or settings for a MIDI playing) */ +extern DECLSPEC Mix_Music * SDLCALL Mix_LoadMUSType_RW_ARG(SDL_RWops *src, Mix_MusicType type, int freesrc, const char *args); + +/* Load a wave file of the mixer format from a memory buffer */ +extern DECLSPEC Mix_Chunk * SDLCALL Mix_QuickLoad_WAV(Uint8 *mem); + +/* Load raw audio data of the mixer format from a memory buffer */ +extern DECLSPEC Mix_Chunk * SDLCALL Mix_QuickLoad_RAW(Uint8 *mem, Uint32 len); + +/* Free an audio chunk previously loaded */ +extern DECLSPEC void SDLCALL Mix_FreeChunk(Mix_Chunk *chunk); +extern DECLSPEC void SDLCALL Mix_FreeMusic(Mix_Music *music); + +/* Get a list of chunk/music decoders that this build of SDL_mixer provides. + This list can change between builds AND runs of the program, if external + libraries that add functionality become available. + You must successfully call Mix_OpenAudio() before calling these functions. + This API is only available in SDL_mixer 1.2.9 and later. + + // usage... + int i; + const int total = Mix_GetNumChunkDecoders(); + for (i = 0; i < total; i++) + printf("Supported chunk decoder: [%s]\n", Mix_GetChunkDecoder(i)); + + Appearing in this list doesn't promise your specific audio file will + decode...but it's handy to know if you have, say, a functioning Timidity + install. + + These return values are static, read-only data; do not modify or free it. + The pointers remain valid until you call Mix_CloseAudio(). +*/ +extern DECLSPEC int SDLCALL Mix_GetNumChunkDecoders(void); +extern DECLSPEC const char * SDLCALL Mix_GetChunkDecoder(int index); +extern DECLSPEC SDL_bool SDLCALL Mix_HasChunkDecoder(const char *name); +extern DECLSPEC int SDLCALL Mix_GetNumMusicDecoders(void); +extern DECLSPEC const char * SDLCALL Mix_GetMusicDecoder(int index); +extern DECLSPEC SDL_bool SDLCALL Mix_HasMusicDecoder(const char *name); + +/* Find out the music format of a mixer music, or the currently playing + music, if 'music' is NULL. +*/ +extern DECLSPEC Mix_MusicType SDLCALL Mix_GetMusicType(const Mix_Music *music); + +/* Get music title from meta-tag if possible. If title tag is empty, filename will be returned */ +extern DECLSPEC const char *SDLCALL Mix_GetMusicTitle(const Mix_Music *music); +/* Get music title from meta-tag if possible */ +extern DECLSPEC const char *SDLCALL Mix_GetMusicTitleTag(const Mix_Music *music); +/* Get music artist from meta-tag if possible */ +extern DECLSPEC const char *SDLCALL Mix_GetMusicArtistTag(const Mix_Music *music); +/* Get music album from meta-tag if possible */ +extern DECLSPEC const char *SDLCALL Mix_GetMusicAlbumTag(const Mix_Music *music); +/* Get music copyright from meta-tag if possible */ +extern DECLSPEC const char *SDLCALL Mix_GetMusicCopyrightTag(const Mix_Music *music); + +/* Set a function that is called after all mixing is performed. + This can be used to provide real-time visual display of the audio stream + or add a custom mixer filter for the stream data. +*/ +extern DECLSPEC void SDLCALL Mix_SetPostMix(void (SDLCALL *mix_func)(void *udata, Uint8 *stream, int len), void *arg); + +/* Add your own music player or additional mixer function. + If 'mix_func' is NULL, the default music player is re-enabled. + */ +extern DECLSPEC void SDLCALL Mix_HookMusic(void (SDLCALL *mix_func)(void *udata, Uint8 *stream, int len), void *arg); + +/* Add your own callback for when the music has finished playing or when it is + * stopped from a call to Mix_HaltMusic. + */ +extern DECLSPEC void SDLCALL Mix_HookMusicFinished(void (SDLCALL *music_finished)(void)); + +/* Get a pointer to the user data for the current music hook */ +extern DECLSPEC void * SDLCALL Mix_GetMusicHookData(void); + +/* + * Add your own callback when a channel has finished playing. NULL + * to disable callback. The callback may be called from the mixer's audio + * callback or it could be called as a result of Mix_HaltChannel(), etc. + * do not call SDL_LockAudio() from this callback; you will either be + * inside the audio callback, or SDL_mixer will explicitly lock the audio + * before calling your callback. + */ +extern DECLSPEC void SDLCALL Mix_ChannelFinished(void (SDLCALL *channel_finished)(int channel)); + + +/* Special Effects API by ryan c. gordon. (icculus@icculus.org) */ + +#define MIX_CHANNEL_POST -2 + +/* This is the format of a special effect callback: + * + * myeffect(int chan, void *stream, int len, void *udata); + * + * (chan) is the channel number that your effect is affecting. (stream) is + * the buffer of data to work upon. (len) is the size of (stream), and + * (udata) is a user-defined bit of data, which you pass as the last arg of + * Mix_RegisterEffect(), and is passed back unmolested to your callback. + * Your effect changes the contents of (stream) based on whatever parameters + * are significant, or just leaves it be, if you prefer. You can do whatever + * you like to the buffer, though, and it will continue in its changed state + * down the mixing pipeline, through any other effect functions, then finally + * to be mixed with the rest of the channels and music for the final output + * stream. + * + * DO NOT EVER call SDL_LockAudio() from your callback function! + */ +typedef void (SDLCALL *Mix_EffectFunc_t)(int chan, void *stream, int len, void *udata); + +/* + * This is a callback that signifies that a channel has finished all its + * loops and has completed playback. This gets called if the buffer + * plays out normally, or if you call Mix_HaltChannel(), implicitly stop + * a channel via Mix_AllocateChannels(), or unregister a callback while + * it's still playing. + * + * DO NOT EVER call SDL_LockAudio() from your callback function! + */ +typedef void (SDLCALL *Mix_EffectDone_t)(int chan, void *udata); + + +/* Register a special effect function. At mixing time, the channel data is + * copied into a buffer and passed through each registered effect function. + * After it passes through all the functions, it is mixed into the final + * output stream. The copy to buffer is performed once, then each effect + * function performs on the output of the previous effect. Understand that + * this extra copy to a buffer is not performed if there are no effects + * registered for a given chunk, which saves CPU cycles, and any given + * effect will be extra cycles, too, so it is crucial that your code run + * fast. Also note that the data that your function is given is in the + * format of the sound device, and not the format you gave to Mix_OpenAudio(), + * although they may in reality be the same. This is an unfortunate but + * necessary speed concern. Use Mix_QuerySpec() to determine if you can + * handle the data before you register your effect, and take appropriate + * actions. + * You may also specify a callback (Mix_EffectDone_t) that is called when + * the channel finishes playing. This gives you a more fine-grained control + * than Mix_ChannelFinished(), in case you need to free effect-specific + * resources, etc. If you don't need this, you can specify NULL. + * You may set the callbacks before or after calling Mix_PlayChannel(). + * Things like Mix_SetPanning() are just internal special effect functions, + * so if you are using that, you've already incurred the overhead of a copy + * to a separate buffer, and that these effects will be in the queue with + * any functions you've registered. The list of registered effects for a + * channel is reset when a chunk finishes playing, so you need to explicitly + * set them with each call to Mix_PlayChannel*(). + * You may also register a special effect function that is to be run after + * final mixing occurs. The rules for these callbacks are identical to those + * in Mix_RegisterEffect, but they are run after all the channels and the + * music have been mixed into a single stream, whereas channel-specific + * effects run on a given channel before any other mixing occurs. These + * global effect callbacks are call "posteffects". Posteffects only have + * their Mix_EffectDone_t function called when they are unregistered (since + * the main output stream is never "done" in the same sense as a channel). + * You must unregister them manually when you've had enough. Your callback + * will be told that the channel being mixed is (MIX_CHANNEL_POST) if the + * processing is considered a posteffect. + * + * After all these effects have finished processing, the callback registered + * through Mix_SetPostMix() runs, and then the stream goes to the audio + * device. + * + * DO NOT EVER call SDL_LockAudio() from your callback function! + * + * returns zero if error (no such channel), nonzero if added. + * Error messages can be retrieved from Mix_GetError(). + */ +extern DECLSPEC int SDLCALL Mix_RegisterEffect(int chan, Mix_EffectFunc_t f, Mix_EffectDone_t d, void *arg); + + +/* You may not need to call this explicitly, unless you need to stop an + * effect from processing in the middle of a chunk's playback. + * Posteffects are never implicitly unregistered as they are for channels, + * but they may be explicitly unregistered through this function by + * specifying MIX_CHANNEL_POST for a channel. + * returns zero if error (no such channel or effect), nonzero if removed. + * Error messages can be retrieved from Mix_GetError(). + */ +extern DECLSPEC int SDLCALL Mix_UnregisterEffect(int channel, Mix_EffectFunc_t f); + + +/* You may not need to call this explicitly, unless you need to stop all + * effects from processing in the middle of a chunk's playback. Note that + * this will also shut off some internal effect processing, since + * Mix_SetPanning() and others may use this API under the hood. This is + * called internally when a channel completes playback. + * Posteffects are never implicitly unregistered as they are for channels, + * but they may be explicitly unregistered through this function by + * specifying MIX_CHANNEL_POST for a channel. + * returns zero if error (no such channel), nonzero if all effects removed. + * Error messages can be retrieved from Mix_GetError(). + */ +extern DECLSPEC int SDLCALL Mix_UnregisterAllEffects(int channel); + + +#define MIX_EFFECTSMAXSPEED "MIX_EFFECTSMAXSPEED" + +/* + * These are the internally-defined mixing effects. They use the same API that + * effects defined in the application use, but are provided here as a + * convenience. Some effects can reduce their quality or use more memory in + * the name of speed; to enable this, make sure the environment variable + * MIX_EFFECTSMAXSPEED (see above) is defined before you call + * Mix_OpenAudio(). + */ + + +/* Set the panning of a channel. The left and right channels are specified + * as integers between 0 and 255, quietest to loudest, respectively. + * + * Technically, this is just individual volume control for a sample with + * two (stereo) channels, so it can be used for more than just panning. + * If you want real panning, call it like this: + * + * Mix_SetPanning(channel, left, 255 - left); + * + * ...which isn't so hard. + * + * Setting (channel) to MIX_CHANNEL_POST registers this as a posteffect, and + * the panning will be done to the final mixed stream before passing it on + * to the audio device. + * + * This uses the Mix_RegisterEffect() API internally, and returns without + * registering the effect function if the audio device is not configured + * for stereo output. Setting both (left) and (right) to 255 causes this + * effect to be unregistered, since that is the data's normal state. + * + * returns zero if error (no such channel or Mix_RegisterEffect() fails), + * nonzero if panning effect enabled. Note that an audio device in mono + * mode is a no-op, but this call will return successful in that case. + * Error messages can be retrieved from Mix_GetError(). + */ +extern DECLSPEC int SDLCALL Mix_SetPanning(int channel, Uint8 left, Uint8 right); + + +/* Set the position of a channel. (angle) is an integer from 0 to 360, that + * specifies the location of the sound in relation to the listener. (angle) + * will be reduced as neccesary (540 becomes 180 degrees, -100 becomes 260). + * Angle 0 is due north, and rotates clockwise as the value increases. + * For efficiency, the precision of this effect may be limited (angles 1 + * through 7 might all produce the same effect, 8 through 15 are equal, etc). + * (distance) is an integer between 0 and 255 that specifies the space + * between the sound and the listener. The larger the number, the further + * away the sound is. Using 255 does not guarantee that the channel will be + * culled from the mixing process or be completely silent. For efficiency, + * the precision of this effect may be limited (distance 0 through 5 might + * all produce the same effect, 6 through 10 are equal, etc). Setting (angle) + * and (distance) to 0 unregisters this effect, since the data would be + * unchanged. + * + * If you need more precise positional audio, consider using OpenAL for + * spatialized effects instead of SDL_mixer. This is only meant to be a + * basic effect for simple "3D" games. + * + * If the audio device is configured for mono output, then you won't get + * any effectiveness from the angle; however, distance attenuation on the + * channel will still occur. While this effect will function with stereo + * voices, it makes more sense to use voices with only one channel of sound, + * so when they are mixed through this effect, the positioning will sound + * correct. You can convert them to mono through SDL before giving them to + * the mixer in the first place if you like. + * + * Setting (channel) to MIX_CHANNEL_POST registers this as a posteffect, and + * the positioning will be done to the final mixed stream before passing it + * on to the audio device. + * + * This is a convenience wrapper over Mix_SetDistance() and Mix_SetPanning(). + * + * returns zero if error (no such channel or Mix_RegisterEffect() fails), + * nonzero if position effect is enabled. + * Error messages can be retrieved from Mix_GetError(). + */ +extern DECLSPEC int SDLCALL Mix_SetPosition(int channel, Sint16 angle, Uint8 distance); + + +/* Set the "distance" of a channel. (distance) is an integer from 0 to 255 + * that specifies the location of the sound in relation to the listener. + * Distance 0 is overlapping the listener, and 255 is as far away as possible + * A distance of 255 does not guarantee silence; in such a case, you might + * want to try changing the chunk's volume, or just cull the sample from the + * mixing process with Mix_HaltChannel(). + * For efficiency, the precision of this effect may be limited (distances 1 + * through 7 might all produce the same effect, 8 through 15 are equal, etc). + * (distance) is an integer between 0 and 255 that specifies the space + * between the sound and the listener. The larger the number, the further + * away the sound is. + * Setting (distance) to 0 unregisters this effect, since the data would be + * unchanged. + * If you need more precise positional audio, consider using OpenAL for + * spatialized effects instead of SDL_mixer. This is only meant to be a + * basic effect for simple "3D" games. + * + * Setting (channel) to MIX_CHANNEL_POST registers this as a posteffect, and + * the distance attenuation will be done to the final mixed stream before + * passing it on to the audio device. + * + * This uses the Mix_RegisterEffect() API internally. + * + * returns zero if error (no such channel or Mix_RegisterEffect() fails), + * nonzero if position effect is enabled. + * Error messages can be retrieved from Mix_GetError(). + */ +extern DECLSPEC int SDLCALL Mix_SetDistance(int channel, Uint8 distance); + + +/* + * !!! FIXME : Haven't implemented, since the effect goes past the + * end of the sound buffer. Will have to think about this. + * --ryan. + */ +#if 0 +/* Causes an echo effect to be mixed into a sound. (echo) is the amount + * of echo to mix. 0 is no echo, 255 is infinite (and probably not + * what you want). + * + * Setting (channel) to MIX_CHANNEL_POST registers this as a posteffect, and + * the reverbing will be done to the final mixed stream before passing it on + * to the audio device. + * + * This uses the Mix_RegisterEffect() API internally. If you specify an echo + * of zero, the effect is unregistered, as the data is already in that state. + * + * returns zero if error (no such channel or Mix_RegisterEffect() fails), + * nonzero if reversing effect is enabled. + * Error messages can be retrieved from Mix_GetError(). + */ +extern no_parse_DECLSPEC int SDLCALL Mix_SetReverb(int channel, Uint8 echo); +#endif + +/* Causes a channel to reverse its stereo. This is handy if the user has his + * speakers hooked up backwards, or you would like to have a minor bit of + * psychedelia in your sound code. :) Calling this function with (flip) + * set to non-zero reverses the chunks's usual channels. If (flip) is zero, + * the effect is unregistered. + * + * This uses the Mix_RegisterEffect() API internally, and thus is probably + * more CPU intensive than having the user just plug in his speakers + * correctly. Mix_SetReverseStereo() returns without registering the effect + * function if the audio device is not configured for stereo output. + * + * If you specify MIX_CHANNEL_POST for (channel), then this the effect is used + * on the final mixed stream before sending it on to the audio device (a + * posteffect). + * + * returns zero if error (no such channel or Mix_RegisterEffect() fails), + * nonzero if reversing effect is enabled. Note that an audio device in mono + * mode is a no-op, but this call will return successful in that case. + * Error messages can be retrieved from Mix_GetError(). + */ +extern DECLSPEC int SDLCALL Mix_SetReverseStereo(int channel, int flip); + +/* end of effects API. --ryan. */ + + +/* Reserve the first channels (0 -> n-1) for the application, i.e. don't allocate + them dynamically to the next sample if requested with a -1 value below. + Returns the number of reserved channels. + */ +extern DECLSPEC int SDLCALL Mix_ReserveChannels(int num); + +/* Channel grouping functions */ + +/* Attach a tag to a channel. A tag can be assigned to several mixer + channels, to form groups of channels. + If 'tag' is -1, the tag is removed (actually -1 is the tag used to + represent the group of all the channels). + Returns true if everything was OK. + */ +extern DECLSPEC int SDLCALL Mix_GroupChannel(int which, int tag); +/* Assign several consecutive channels to a group */ +extern DECLSPEC int SDLCALL Mix_GroupChannels(int from, int to, int tag); +/* Finds the first available channel in a group of channels, + returning -1 if none are available. + */ +extern DECLSPEC int SDLCALL Mix_GroupAvailable(int tag); +/* Returns the number of channels in a group. This is also a subtle + way to get the total number of channels when 'tag' is -1 + */ +extern DECLSPEC int SDLCALL Mix_GroupCount(int tag); +/* Finds the "oldest" sample playing in a group of channels */ +extern DECLSPEC int SDLCALL Mix_GroupOldest(int tag); +/* Finds the "most recent" (i.e. last) sample playing in a group of channels */ +extern DECLSPEC int SDLCALL Mix_GroupNewer(int tag); + +/* Play an audio chunk on a specific channel. + If the specified channel is -1, play on the first free channel. + If 'loops' is greater than zero, loop the sound that many times. + If 'loops' is -1, loop inifinitely (~65000 times). + Returns which channel was used to play the sound. +*/ +#define Mix_PlayChannel(channel,chunk,loops) Mix_PlayChannelTimed(channel,chunk,loops,-1) +/* The same as above, but the sound is played at most 'ticks' milliseconds */ +extern DECLSPEC int SDLCALL Mix_PlayChannelTimed(int channel, Mix_Chunk *chunk, int loops, int ticks); +extern DECLSPEC int SDLCALL Mix_PlayMusic(Mix_Music *music, int loops); +#define Mix_PlayChannelVol(channel,chunk,loops,vol) Mix_PlayChannelTimedVolume(channel,chunk,loops,-1,vol)/*MIXER-X*/ +extern DECLSPEC int SDLCALL Mix_PlayChannelTimedVolume(int which, Mix_Chunk *chunk, int loops, int ticks, int volume);/*MIXER-X*/ + +/* Fade in music or a channel over "ms" milliseconds, same semantics as the "Play" functions */ +extern DECLSPEC int SDLCALL Mix_FadeInMusic(Mix_Music *music, int loops, int ms); +extern DECLSPEC int SDLCALL Mix_FadeInMusicPos(Mix_Music *music, int loops, int ms, double position); +#define Mix_FadeInChannel(channel,chunk,loops,ms) Mix_FadeInChannelTimed(channel,chunk,loops,ms,-1) +extern DECLSPEC int SDLCALL Mix_FadeInChannelTimed(int channel, Mix_Chunk *chunk, int loops, int ms, int ticks); +#define Mix_FadeInChannelVolume(channel,chunk,loops,ms,vol) Mix_FadeInChannelTimed(channel,chunk,loops,ms,-1,vol)/*MIXER-X*/ +extern DECLSPEC int SDLCALL Mix_FadeInChannelTimedVolume(int which, Mix_Chunk *chunk, int loops, int ms, int ticks, int volume);/*MIXER-X*/ + + +/* Set the volume in the range of 0-128 of a specific channel or chunk. + If the specified channel is -1, set volume for all channels. + Returns the original volume. + If the specified volume is -1, just return the current volume. +*/ +extern DECLSPEC int SDLCALL Mix_Volume(int channel, int volume); +extern DECLSPEC int SDLCALL Mix_VolumeChunk(Mix_Chunk *chunk, int volume); +extern DECLSPEC int SDLCALL Mix_VolumeMusic(int volume); + +/* Halt playing of a particular channel */ +extern DECLSPEC int SDLCALL Mix_HaltChannel(int channel); +extern DECLSPEC int SDLCALL Mix_HaltGroup(int tag); +extern DECLSPEC int SDLCALL Mix_HaltMusic(void); + +/* Change the expiration delay for a particular channel. + The sample will stop playing after the 'ticks' milliseconds have elapsed, + or remove the expiration if 'ticks' is -1 +*/ +extern DECLSPEC int SDLCALL Mix_ExpireChannel(int channel, int ticks); + +/* Halt a channel, fading it out progressively till it's silent + The ms parameter indicates the number of milliseconds the fading + will take. + */ +extern DECLSPEC int SDLCALL Mix_FadeOutChannel(int which, int ms); +extern DECLSPEC int SDLCALL Mix_FadeOutGroup(int tag, int ms); +extern DECLSPEC int SDLCALL Mix_FadeOutMusic(int ms); + +/* Query the fading status of a channel */ +extern DECLSPEC Mix_Fading SDLCALL Mix_FadingMusic(void); +extern DECLSPEC Mix_Fading SDLCALL Mix_FadingChannel(int which); + +/* Pause/Resume a particular channel */ +extern DECLSPEC void SDLCALL Mix_Pause(int channel); +extern DECLSPEC void SDLCALL Mix_Resume(int channel); +extern DECLSPEC int SDLCALL Mix_Paused(int channel); + +/* Pause/Resume the music stream */ +extern DECLSPEC void SDLCALL Mix_PauseMusic(void); +extern DECLSPEC void SDLCALL Mix_ResumeMusic(void); +extern DECLSPEC void SDLCALL Mix_RewindMusic(void); +extern DECLSPEC int SDLCALL Mix_PausedMusic(void); + +/* Set the current position in the music stream. + This returns 0 if successful, or -1 if it failed or isn't implemented. + This function is only implemented for MOD music formats (set pattern + order number) and for WAV, OGG, FLAC, MP3_MAD, MP3_MPG, and MODPLUG music + (set position in seconds), at the moment. +*/ +extern DECLSPEC int SDLCALL Mix_SetMusicPosition(double position); +/* + Get the time current position of music stream + returns -1.0 if this feature is not supported for some codec + */ +extern DECLSPEC double SDLCALL Mix_GetMusicPosition(Mix_Music *music); +/* + Get the total time length of music stream + returns -1.0 if this feature is not supported for some codec + */ +extern DECLSPEC double SDLCALL Mix_GetMusicTotalTime(Mix_Music *music); + +/* + Get the loop start time position of music stream + returns -1.0 if this feature is not used for this music or not supported for some codec + */ +extern DECLSPEC double SDLCALL Mix_GetMusicLoopStartTime(Mix_Music *music); +/* + Get the loop end time position of music stream + returns -1.0 if this feature is not used for this music or not supported for some codec + */ +extern DECLSPEC double SDLCALL Mix_GetMusicLoopEndTime(Mix_Music *music); +/* + Get the loop time length of music stream + returns -1.0 if this feature is not used for this music or not supported for some codec + */ +extern DECLSPEC double SDLCALL Mix_GetMusicLoopLengthTime(Mix_Music *music); + + +/* Check the status of a specific channel. + If the specified channel is -1, check all channels. +*/ +extern DECLSPEC int SDLCALL Mix_Playing(int channel); +extern DECLSPEC int SDLCALL Mix_PlayingMusic(void); + +/* Stop music and set external music playback command */ +extern DECLSPEC int SDLCALL Mix_SetMusicCMD(const char *command); + +/* Synchro value is set by MikMod from modules while playing */ +extern DECLSPEC int SDLCALL Mix_SetSynchroValue(int value); +extern DECLSPEC int SDLCALL Mix_GetSynchroValue(void); + +/* Set/Get/Iterate SoundFonts paths to use by supported MIDI backends */ +extern DECLSPEC int SDLCALL Mix_SetSoundFonts(const char *paths); +extern DECLSPEC const char* SDLCALL Mix_GetSoundFonts(void); +extern DECLSPEC int SDLCALL Mix_EachSoundFont(int (SDLCALL *function)(const char*, void*), void *data); + +/* Get the Mix_Chunk currently associated with a mixer channel + Returns NULL if it's an invalid channel, or there's no chunk associated. +*/ +extern DECLSPEC Mix_Chunk * SDLCALL Mix_GetChunk(int channel); + +/* Close the mixer, halting all playing audio */ +extern DECLSPEC void SDLCALL Mix_CloseAudio(void); + +/* Add additional Timidity bank path */ +extern DECLSPEC void SDLCALL Mix_Timidity_addToPathList(const char *path); + +/* ADLMIDI Setup functions */ +/* Get count of available hardcoded banks */ +extern DECLSPEC int SDLCALL Mix_ADLMIDI_getTotalBanks(void); +/* Get array of the bank names */ +extern DECLSPEC const char *const *SDLCALL Mix_ADLMIDI_getBankNames(void); +/* Get bank ID */ +extern DECLSPEC int SDLCALL Mix_ADLMIDI_getBankID(void); +/* Set bank ID (Applying on stop/play) */ +extern DECLSPEC void SDLCALL Mix_ADLMIDI_setBankID(int bnk); +/* Get state of deep vibrato */ +extern DECLSPEC int SDLCALL Mix_ADLMIDI_getTremolo(void); +/* Set deep tremolo mode (0 off, 1 on) (Applying on stop/play) */ +extern DECLSPEC void SDLCALL Mix_ADLMIDI_setTremolo(int tr); +/* Get state of deep vibrato */ +extern DECLSPEC int SDLCALL Mix_ADLMIDI_getVibrato(void); +/* Set deep vibrato mode (0 off, 1 on) (Applying on stop/play) */ +extern DECLSPEC void SDLCALL Mix_ADLMIDI_setVibrato(int vib); +/* Get state of scalable modulation mode */ +extern DECLSPEC int SDLCALL Mix_ADLMIDI_getScaleMod(void); +/* Set scalable modulation mode (0 off, 1 on) (Applying on stop/play) */ +extern DECLSPEC void SDLCALL Mix_ADLMIDI_setScaleMod(int sc); +/* Get state of adlib drums mode */ +extern DECLSPEC int SDLCALL Mix_ADLMIDI_getAdLibMode(void); +/* Set adlib drums mode mode (0 off, 1 on) (Applying on stop/play) */ +extern DECLSPEC void SDLCALL Mix_ADLMIDI_setAdLibMode(int tr); +/* Get state of logarithmic mode */ +extern DECLSPEC int SDLCALL Mix_ADLMIDI_getLogarithmicVolumes(void); +/* Set logarithmic volumes mode in the generic/CMF volume models (0 off, 1 on) (Applying on stop/play) */ +extern DECLSPEC void SDLCALL Mix_ADLMIDI_setLogarithmicVolumes(int lv); +/* Get current volume model ID */ +extern DECLSPEC int SDLCALL Mix_ADLMIDI_getVolumeModel(void); +/* Change current volumes model (Applying on stop/play) */ +extern DECLSPEC void SDLCALL Mix_ADLMIDI_setVolumeModel(int vm); +/* Get full range mode for CC74-Brightness controller */ +extern DECLSPEC int SDLCALL Mix_ADLMIDI_getFullRangeBrightness(void); +/* Set full range mode for CC74-Brightness controller */ +extern DECLSPEC void SDLCALL Mix_ADLMIDI_setFullRangeBrightness(int frb); +/* Get the current OPL3 Emulator for ADLMIDI */ +extern DECLSPEC int SDLCALL Mix_ADLMIDI_getEmulator(void); +/* Select the OPL3 Emulator for ADLMIDI */ +extern DECLSPEC void SDLCALL Mix_ADLMIDI_setEmulator(int emu); +/* Reset all ADLMIDI properties to default state */ +extern DECLSPEC void SDLCALL Mix_ADLMIDI_setSetDefaults(void); + +/* Sets WOPL bank file for ADLMIDI playing device, affects on MIDI file reopen */ +extern DECLSPEC void SDLCALL Mix_ADLMIDI_setCustomBankFile(const char *bank_wonl_path); + +/* Reset all OPNMIDI properties to default state */ +extern DECLSPEC void SDLCALL Mix_OPNMIDI_setSetDefaults(void); +/* Get full range mode for CC74-Brightness controller */ +extern DECLSPEC int SDLCALL Mix_OPNMIDI_getFullRangeBrightness(void); +/* Set full range mode for CC74-Brightness controller */ +extern DECLSPEC void SDLCALL Mix_OPNMIDI_setFullRangeBrightness(int frb); +/* Get the OPN2 Emulator for OPNMIDI */ +extern DECLSPEC int SDLCALL Mix_OPNMIDI_getEmulator(void); +/* Select the OPN2 Emulator for OPNMIDI */ +extern DECLSPEC void SDLCALL Mix_OPNMIDI_setEmulator(int emu); +/* Sets WOPN bank file for OPNMIDI playing device, affects on MIDI file reopen */ +extern DECLSPEC void SDLCALL Mix_OPNMIDI_setCustomBankFile(const char *bank_wonp_path); + +/* Get type of MIDI player library currently in use */ +extern DECLSPEC int SDLCALL Mix_GetMidiPlayer(void); + +/* Get type of MIDI player library prepared for next opening of MIDI file */ +extern DECLSPEC int SDLCALL Mix_GetNextMidiPlayer(void); + +/* Set the MIDI playing library (ADLMIDI, Timidity, Native MIDI (if available) and FluidSynth) */ +extern DECLSPEC int SDLCALL Mix_SetMidiPlayer(int player); + +/* Disables support of MIDI file arguments */ +extern DECLSPEC void SDLCALL Mix_SetLockMIDIArgs(int lock_midiargs); + +/* DEPRECATED NAMES for new-added SDL Mixer X functions + Those names are made with mistake - beginning with "MIX_" than "Mix_" + which makes confusion when you looking for Mix_ function in your IDE + because some applications are still use them, to don't break ABI we will keep those + aliases until we will remove all usages of them from applications and libraries are used them +*/ +DEPRECATED(extern DECLSPEC int SDLCALL Mix_GetMidiDevice(void)); +DEPRECATED(extern DECLSPEC int SDLCALL Mix_GetNextMidiDevice(void)); +DEPRECATED(extern DECLSPEC int SDLCALL Mix_SetMidiDevice(int player)); + +/* We'll use SDL for reporting errors */ +#define Mix_SetError SDL_SetError +#define Mix_GetError SDL_GetError +#define Mix_ClearError SDL_ClearError + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif +#include "close_code.h" + +#endif /* SDL_MIXER_H_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/libs/SDLMixerX/i686-w64-mingw32/include/SDL2/begin_code.h b/libs/SDLMixerX/i686-w64-mingw32/include/SDL2/begin_code.h new file mode 100644 index 000000000..6c2106246 --- /dev/null +++ b/libs/SDLMixerX/i686-w64-mingw32/include/SDL2/begin_code.h @@ -0,0 +1,167 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/** + * \file begin_code.h + * + * This file sets things up for C dynamic library function definitions, + * static inlined functions, and structures aligned at 4-byte alignment. + * If you don't like ugly C preprocessor code, don't look at this file. :) + */ + +/* This shouldn't be nested -- included it around code only. */ +#ifdef _begin_code_h +#error Nested inclusion of begin_code.h +#endif +#define _begin_code_h + +#ifndef SDL_DEPRECATED +# if (__GNUC__ >= 4) /* technically, this arrived in gcc 3.1, but oh well. */ +# define SDL_DEPRECATED __attribute__((deprecated)) +# else +# define SDL_DEPRECATED +# endif +#endif + +#ifndef SDL_UNUSED +# ifdef __GNUC__ +# define SDL_UNUSED __attribute__((unused)) +# else +# define SDL_UNUSED +# endif +#endif + +/* Some compilers use a special export keyword */ +#ifndef DECLSPEC +# if defined(__WIN32__) || defined(__WINRT__) +# ifdef __BORLANDC__ +# ifdef BUILD_SDL +# define DECLSPEC +# else +# define DECLSPEC __declspec(dllimport) +# endif +# else +# define DECLSPEC __declspec(dllexport) +# endif +# elif defined(__OS2__) +# ifdef BUILD_SDL +# define DECLSPEC __declspec(dllexport) +# else +# define DECLSPEC +# endif +# else +# if defined(__GNUC__) && __GNUC__ >= 4 +# define DECLSPEC __attribute__ ((visibility("default"))) +# else +# define DECLSPEC +# endif +# endif +#endif + +/* By default SDL uses the C calling convention */ +#ifndef SDLCALL +#if (defined(__WIN32__) || defined(__WINRT__)) && !defined(__GNUC__) +#define SDLCALL __cdecl +#elif defined(__OS2__) || defined(__EMX__) +#define SDLCALL _System +# if defined (__GNUC__) && !defined(_System) +# define _System /* for old EMX/GCC compat. */ +# endif +#else +#define SDLCALL +#endif +#endif /* SDLCALL */ + +/* Removed DECLSPEC on Symbian OS because SDL cannot be a DLL in EPOC */ +#ifdef __SYMBIAN32__ +#undef DECLSPEC +#define DECLSPEC +#endif /* __SYMBIAN32__ */ + +/* Force structure packing at 4 byte alignment. + This is necessary if the header is included in code which has structure + packing set to an alternate value, say for loading structures from disk. + The packing is reset to the previous value in close_code.h + */ +#if defined(_MSC_VER) || defined(__MWERKS__) || defined(__BORLANDC__) +#ifdef _MSC_VER +#pragma warning(disable: 4103) +#endif +#ifdef __BORLANDC__ +#pragma nopackwarning +#endif +#ifdef _M_X64 +/* Use 8-byte alignment on 64-bit architectures, so pointers are aligned */ +#pragma pack(push,8) +#else +#pragma pack(push,4) +#endif +#endif /* Compiler needs structure packing set */ + +#ifndef SDL_INLINE +#if defined(__GNUC__) +#define SDL_INLINE __inline__ +#elif defined(_MSC_VER) || defined(__BORLANDC__) || \ + defined(__DMC__) || defined(__SC__) || \ + defined(__WATCOMC__) || defined(__LCC__) || \ + defined(__DECC) || defined(__CC_ARM) +#define SDL_INLINE __inline +#ifndef __inline__ +#define __inline__ __inline +#endif +#else +#define SDL_INLINE inline +#ifndef __inline__ +#define __inline__ inline +#endif +#endif +#endif /* SDL_INLINE not defined */ + +#ifndef SDL_FORCE_INLINE +#if defined(_MSC_VER) +#define SDL_FORCE_INLINE __forceinline +#elif ( (defined(__GNUC__) && (__GNUC__ >= 4)) || defined(__clang__) ) +#define SDL_FORCE_INLINE __attribute__((always_inline)) static __inline__ +#else +#define SDL_FORCE_INLINE static SDL_INLINE +#endif +#endif /* SDL_FORCE_INLINE not defined */ + +#ifndef SDL_NORETURN +#if defined(__GNUC__) +#define SDL_NORETURN __attribute__((noreturn)) +#elif defined(_MSC_VER) +#define SDL_NORETURN __declspec(noreturn) +#else +#define SDL_NORETURN +#endif +#endif /* SDL_NORETURN not defined */ + +/* Apparently this is needed by several Windows compilers */ +#if !defined(__MACH__) +#ifndef NULL +#ifdef __cplusplus +#define NULL 0 +#else +#define NULL ((void *)0) +#endif +#endif /* NULL */ +#endif /* ! Mac OS X - breaks precompiled headers */ diff --git a/libs/SDLMixerX/i686-w64-mingw32/include/SDL2/close_code.h b/libs/SDLMixerX/i686-w64-mingw32/include/SDL2/close_code.h new file mode 100644 index 000000000..b3b70a4c8 --- /dev/null +++ b/libs/SDLMixerX/i686-w64-mingw32/include/SDL2/close_code.h @@ -0,0 +1,37 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/** + * \file close_code.h + * + * This file reverses the effects of begin_code.h and should be included + * after you finish any function and structure declarations in your headers + */ + +#undef _begin_code_h + +/* Reset structure packing at previous byte alignment */ +#if defined(_MSC_VER) || defined(__MWERKS__) || defined(__BORLANDC__) +#ifdef __BORLANDC__ +#pragma nopackwarning +#endif +#pragma pack(pop) +#endif /* Compiler needs structure packing set */ diff --git a/libs/SDLMixerX/i686-w64-mingw32/lib/libSDL2_mixer_ext-static.a b/libs/SDLMixerX/i686-w64-mingw32/lib/libSDL2_mixer_ext-static.a new file mode 100644 index 000000000..8a59b5a61 Binary files /dev/null and b/libs/SDLMixerX/i686-w64-mingw32/lib/libSDL2_mixer_ext-static.a differ diff --git a/libs/SDLMixerX/i686-w64-mingw32/lib/libSDL2_mixer_ext.dll.a b/libs/SDLMixerX/i686-w64-mingw32/lib/libSDL2_mixer_ext.dll.a new file mode 100644 index 000000000..b5e43ef62 Binary files /dev/null and b/libs/SDLMixerX/i686-w64-mingw32/lib/libSDL2_mixer_ext.dll.a differ diff --git a/libs/SDLMixerX/x86_64-w64-mingw32/bin/SDL2_mixer_ext.dll b/libs/SDLMixerX/x86_64-w64-mingw32/bin/SDL2_mixer_ext.dll new file mode 100644 index 000000000..7762d5e8d Binary files /dev/null and b/libs/SDLMixerX/x86_64-w64-mingw32/bin/SDL2_mixer_ext.dll differ diff --git a/libs/SDLMixerX/x86_64-w64-mingw32/bin/libfluidsynth-2.dll b/libs/SDLMixerX/x86_64-w64-mingw32/bin/libfluidsynth-2.dll new file mode 100644 index 000000000..5dbcac34a Binary files /dev/null and b/libs/SDLMixerX/x86_64-w64-mingw32/bin/libfluidsynth-2.dll differ diff --git a/libs/SDLMixerX/x86_64-w64-mingw32/bin/libgcc_s_sjlj-1.dll b/libs/SDLMixerX/x86_64-w64-mingw32/bin/libgcc_s_sjlj-1.dll new file mode 100644 index 000000000..9684a2155 Binary files /dev/null and b/libs/SDLMixerX/x86_64-w64-mingw32/bin/libgcc_s_sjlj-1.dll differ diff --git a/libs/SDLMixerX/x86_64-w64-mingw32/bin/libstdc++-6.dll b/libs/SDLMixerX/x86_64-w64-mingw32/bin/libstdc++-6.dll new file mode 100644 index 000000000..220099c40 Binary files /dev/null and b/libs/SDLMixerX/x86_64-w64-mingw32/bin/libstdc++-6.dll differ diff --git a/libs/SDLMixerX/x86_64-w64-mingw32/include/SDL2/SDL_mixer_ext.h b/libs/SDLMixerX/x86_64-w64-mingw32/include/SDL2/SDL_mixer_ext.h new file mode 100644 index 000000000..3a6b91b50 --- /dev/null +++ b/libs/SDLMixerX/x86_64-w64-mingw32/include/SDL2/SDL_mixer_ext.h @@ -0,0 +1,867 @@ +/* + SDL Mixer X: An extended audio mixer library, forked from SDL_mixer + Copyright (C) 2014-2018 Vitaly Novichkov + + SDL_mixer: An audio mixer library based on the SDL library + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#ifndef SDL_MIXER_H_ +#define SDL_MIXER_H_ + +#include "SDL_stdinc.h" +#include "SDL_rwops.h" +#include "SDL_audio.h" +#include "SDL_endian.h" +#include "SDL_version.h" +#include "begin_code.h" + +/* Let applications recogonize which SDL Mixer edition is in use: Official or Extended fork by Wohlstand */ +#define SDL_MIXER_X 1 + +#define MIXSDLCALL + +#if defined(FORCE_STDCALLS) && defined(_WIN32) +#ifdef SDLCALL +#undef SDLCALL +#endif +#define SDLCALL __stdcall +#define SDLCALLCC __stdcall +#else +#define SDLCALLCC +#endif + +#ifndef DEPRECATED +#ifdef __GNUC__ +#define DEPRECATED(func) func __attribute__ ((deprecated)) +#elif defined(_MSC_VER) +#define DEPRECATED(func) __declspec(deprecated) func +#else +#pragma message("WARNING: You need to implement DEPRECATED for this compiler") +#define DEPRECATED(func) func +#endif +#endif + +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + +/* Printable format: "%d.%d.%d", MAJOR, MINOR, PATCHLEVEL +*/ +#define SDL_MIXER_MAJOR_VERSION 2 +#define SDL_MIXER_MINOR_VERSION 2 +#define SDL_MIXER_PATCHLEVEL 0 + +/* This macro can be used to fill a version structure with the compile-time + * version of the SDL_mixer library. + */ +#define SDL_MIXER_VERSION(X) \ +{ \ + (X)->major = SDL_MIXER_MAJOR_VERSION; \ + (X)->minor = SDL_MIXER_MINOR_VERSION; \ + (X)->patch = SDL_MIXER_PATCHLEVEL; \ +} + +/* Backwards compatibility */ +#define MIX_MAJOR_VERSION SDL_MIXER_MAJOR_VERSION +#define MIX_MINOR_VERSION SDL_MIXER_MINOR_VERSION +#define MIX_PATCHLEVEL SDL_MIXER_PATCHLEVEL +#define MIX_VERSION(X) SDL_MIXER_VERSION(X) + +/** + * This is the version number macro for the current SDL_mixer version. + */ +#define SDL_MIXER_COMPILEDVERSION \ + SDL_VERSIONNUM(SDL_MIXER_MAJOR_VERSION, SDL_MIXER_MINOR_VERSION, SDL_MIXER_PATCHLEVEL) + +/** + * This macro will evaluate to true if compiled with SDL_mixer at least X.Y.Z. + */ +#define SDL_MIXER_VERSION_ATLEAST(X, Y, Z) \ + (SDL_MIXER_COMPILEDVERSION >= SDL_VERSIONNUM(X, Y, Z)) + +/* This function gets the version of the dynamically linked SDL_mixer library. + it should NOT be used to fill a version structure, instead you should + use the SDL_MIXER_VERSION() macro. + */ +extern DECLSPEC const SDL_version * SDLCALL Mix_Linked_Version(void); + +typedef enum +{ + MIX_INIT_FLAC = 0x00000001, + MIX_INIT_MOD = 0x00000002, + MIX_INIT_MP3 = 0x00000008, + MIX_INIT_OGG = 0x00000010, + MIX_INIT_MID = 0x00000020, + MIX_INIT_OPUS = 0x00000040 +} MIX_InitFlags; + +/* Loads dynamic libraries and prepares them for use. Flags should be + one or more flags from MIX_InitFlags OR'd together. + It returns the flags successfully initialized, or 0 on failure. + */ +extern DECLSPEC int SDLCALL Mix_Init(int flags); + +/* Unloads libraries loaded with Mix_Init */ +extern DECLSPEC void SDLCALL Mix_Quit(void); + + +/* The default mixer has 8 simultaneous mixing channels */ +#ifndef MIX_CHANNELS +#define MIX_CHANNELS 8 +#endif + +/* Good default values for a PC soundcard */ +#define MIX_DEFAULT_FREQUENCY 44100 +#if SDL_BYTEORDER == SDL_LIL_ENDIAN +#define MIX_DEFAULT_FORMAT AUDIO_S16LSB +#else +#define MIX_DEFAULT_FORMAT AUDIO_S16MSB +#endif +#define MIX_DEFAULT_CHANNELS 2 +#define MIX_MAX_VOLUME SDL_MIX_MAXVOLUME /* Volume of a chunk */ + +/* The internal format for an audio chunk */ +typedef struct Mix_Chunk { + int allocated; + Uint8 *abuf; + Uint32 alen; + Uint8 volume; /* Per-sample volume, 0-128 */ +} Mix_Chunk; + +/* The different fading types supported */ +typedef enum { + MIX_NO_FADING, + MIX_FADING_OUT, + MIX_FADING_IN +} Mix_Fading; + +/* These are types of music files (not libraries used to load them) */ +typedef enum { + MUS_NONE, + MUS_CMD, + MUS_WAV, + MUS_MOD, + MUS_MID, + MUS_OGG, + MUS_MP3, + MUS_MP3_MAD_UNUSED, + MUS_FLAC, + MUS_MODPLUG_UNUSED, + MUS_OPUS, + MUS_GME, + MUS_ADLMIDI/*Use ADLMIDI coded for super-special formats like IMF, MUS or XMI are can't be played without ADLMIDI*/ +} Mix_MusicType; + +typedef enum { + MIDI_ADLMIDI, + MIDI_Native, + MIDI_Timidity, + MIDI_OPNMIDI, + MIDI_Fluidsynth, + MIDI_ANY, + MIDI_KnuwnDevices /* Count of MIDI device types */ +} Mix_MIDI_Device; + +/* Volume model type in the ADLMIDI */ +typedef enum { + ADLMIDI_VM_AUTO, + ADLMIDI_VM_GENERIC, + ADLMIDI_VM_CMF, + ADLMIDI_VM_DMX, + ADLMIDI_VM_APOGEE, + ADLMIDI_VM_9X +} Mix_ADLMIDI_VolumeModel; + +/* OPL3 chip emulators for ADLMIDI */ +typedef enum { + ADLMIDI_OPL3_EMU_DEFAULT = -1, + ADLMIDI_OPL3_EMU_NUKED = 0, + ADLMIDI_OPL3_EMU_NUKED_1_7_4, + ADLMIDI_OPL3_EMU_DOSBOX, +} Mix_ADLMIDI_Emulator; + +/* OPN2 chip emulators for OPNMIDI */ +typedef enum { + OPNMIDI_OPN2_EMU_DEFAULT = -1, + OPNMIDI_OPN2_EMU_MIME = 0, + OPNMIDI_OPN2_EMU_NUKED, + OPNMIDI_OPN2_EMU_GENS, +} Mix_OPNMIDI_Emulator; + +/* The internal format for a music chunk interpreted via mikmod */ +typedef struct _Mix_Music Mix_Music; + +/* Open the mixer with a certain audio format */ +extern DECLSPEC int SDLCALL Mix_OpenAudio(int frequency, Uint16 format, int channels, int chunksize); + +/* Open the mixer with specific device and certain audio format */ +extern DECLSPEC int SDLCALL Mix_OpenAudioDevice(int frequency, Uint16 format, int channels, int chunksize, const char* device, int allowed_changes); + +/* Dynamically change the number of channels managed by the mixer. + If decreasing the number of channels, the upper channels are + stopped. + This function returns the new number of allocated channels. + */ +extern DECLSPEC int SDLCALL Mix_AllocateChannels(int numchans); + +/* Find out what the actual audio device parameters are. + This function returns 1 if the audio has been opened, 0 otherwise. + */ +extern DECLSPEC int SDLCALL Mix_QuerySpec(int *frequency,Uint16 *format,int *channels); + +/* Load a wave file or a music (.mod .s3m .it .xm) file + IMPORTANT: To choice a track number of NSF, GBM, HES, etc file, + you must append "|xxx" to end of file path for + Mix_LoadMUS function. + Where xxx - actual number of chip track, (from 0 to N-1) + Examples: "file.nsf|12", "file.hes|2" +*/ +extern DECLSPEC Mix_Chunk * SDLCALL Mix_LoadWAV_RW(SDL_RWops *src, int freesrc); +#define Mix_LoadWAV(file) Mix_LoadWAV_RW(SDL_RWFromFile(file, "rb"), 1) +extern DECLSPEC Mix_Music * SDLCALL Mix_LoadMUS(const char *file); + +/* Load a music file from an SDL_RWop object + * Matt Campbell (matt@campbellhome.dhs.org) April 2000 */ +extern DECLSPEC Mix_Music * SDLCALL Mix_LoadMUS_RW(SDL_RWops *src, int freesrc); + +/* Load a music file from an SDL_RWop object with custom arguments (trackID for GME or settings for a MIDI playing) + * Arguments are taking no effect for file formats which are not supports extra arguments. + */ +extern DECLSPEC Mix_Music *SDLCALL Mix_LoadMUS_RW_ARG(SDL_RWops *src, int freesrc, const char *args); + +/* Load a music file from an SDL_RWop object with custom trackID for GME. + * trackID argument takes no effect for non-NSF,HES,GBM,etc. file formats. + * Default value should be 0 + */ +extern DECLSPEC Mix_Music *SDLCALL Mix_LoadMUS_RW_GME(SDL_RWops *src, int freesrc, int trackID); + +/* Load a music file from an SDL_RWop object assuming a specific format */ +extern DECLSPEC Mix_Music * SDLCALL Mix_LoadMUSType_RW(SDL_RWops *src, Mix_MusicType type, int freesrc); + +/* Load a music file from an SDL_RWop object assuming a specific format + with custom arguments (trackID for GME or settings for a MIDI playing) */ +extern DECLSPEC Mix_Music * SDLCALL Mix_LoadMUSType_RW_ARG(SDL_RWops *src, Mix_MusicType type, int freesrc, const char *args); + +/* Load a wave file of the mixer format from a memory buffer */ +extern DECLSPEC Mix_Chunk * SDLCALL Mix_QuickLoad_WAV(Uint8 *mem); + +/* Load raw audio data of the mixer format from a memory buffer */ +extern DECLSPEC Mix_Chunk * SDLCALL Mix_QuickLoad_RAW(Uint8 *mem, Uint32 len); + +/* Free an audio chunk previously loaded */ +extern DECLSPEC void SDLCALL Mix_FreeChunk(Mix_Chunk *chunk); +extern DECLSPEC void SDLCALL Mix_FreeMusic(Mix_Music *music); + +/* Get a list of chunk/music decoders that this build of SDL_mixer provides. + This list can change between builds AND runs of the program, if external + libraries that add functionality become available. + You must successfully call Mix_OpenAudio() before calling these functions. + This API is only available in SDL_mixer 1.2.9 and later. + + // usage... + int i; + const int total = Mix_GetNumChunkDecoders(); + for (i = 0; i < total; i++) + printf("Supported chunk decoder: [%s]\n", Mix_GetChunkDecoder(i)); + + Appearing in this list doesn't promise your specific audio file will + decode...but it's handy to know if you have, say, a functioning Timidity + install. + + These return values are static, read-only data; do not modify or free it. + The pointers remain valid until you call Mix_CloseAudio(). +*/ +extern DECLSPEC int SDLCALL Mix_GetNumChunkDecoders(void); +extern DECLSPEC const char * SDLCALL Mix_GetChunkDecoder(int index); +extern DECLSPEC SDL_bool SDLCALL Mix_HasChunkDecoder(const char *name); +extern DECLSPEC int SDLCALL Mix_GetNumMusicDecoders(void); +extern DECLSPEC const char * SDLCALL Mix_GetMusicDecoder(int index); +extern DECLSPEC SDL_bool SDLCALL Mix_HasMusicDecoder(const char *name); + +/* Find out the music format of a mixer music, or the currently playing + music, if 'music' is NULL. +*/ +extern DECLSPEC Mix_MusicType SDLCALL Mix_GetMusicType(const Mix_Music *music); + +/* Get music title from meta-tag if possible. If title tag is empty, filename will be returned */ +extern DECLSPEC const char *SDLCALL Mix_GetMusicTitle(const Mix_Music *music); +/* Get music title from meta-tag if possible */ +extern DECLSPEC const char *SDLCALL Mix_GetMusicTitleTag(const Mix_Music *music); +/* Get music artist from meta-tag if possible */ +extern DECLSPEC const char *SDLCALL Mix_GetMusicArtistTag(const Mix_Music *music); +/* Get music album from meta-tag if possible */ +extern DECLSPEC const char *SDLCALL Mix_GetMusicAlbumTag(const Mix_Music *music); +/* Get music copyright from meta-tag if possible */ +extern DECLSPEC const char *SDLCALL Mix_GetMusicCopyrightTag(const Mix_Music *music); + +/* Set a function that is called after all mixing is performed. + This can be used to provide real-time visual display of the audio stream + or add a custom mixer filter for the stream data. +*/ +extern DECLSPEC void SDLCALL Mix_SetPostMix(void (SDLCALL *mix_func)(void *udata, Uint8 *stream, int len), void *arg); + +/* Add your own music player or additional mixer function. + If 'mix_func' is NULL, the default music player is re-enabled. + */ +extern DECLSPEC void SDLCALL Mix_HookMusic(void (SDLCALL *mix_func)(void *udata, Uint8 *stream, int len), void *arg); + +/* Add your own callback for when the music has finished playing or when it is + * stopped from a call to Mix_HaltMusic. + */ +extern DECLSPEC void SDLCALL Mix_HookMusicFinished(void (SDLCALL *music_finished)(void)); + +/* Get a pointer to the user data for the current music hook */ +extern DECLSPEC void * SDLCALL Mix_GetMusicHookData(void); + +/* + * Add your own callback when a channel has finished playing. NULL + * to disable callback. The callback may be called from the mixer's audio + * callback or it could be called as a result of Mix_HaltChannel(), etc. + * do not call SDL_LockAudio() from this callback; you will either be + * inside the audio callback, or SDL_mixer will explicitly lock the audio + * before calling your callback. + */ +extern DECLSPEC void SDLCALL Mix_ChannelFinished(void (SDLCALL *channel_finished)(int channel)); + + +/* Special Effects API by ryan c. gordon. (icculus@icculus.org) */ + +#define MIX_CHANNEL_POST -2 + +/* This is the format of a special effect callback: + * + * myeffect(int chan, void *stream, int len, void *udata); + * + * (chan) is the channel number that your effect is affecting. (stream) is + * the buffer of data to work upon. (len) is the size of (stream), and + * (udata) is a user-defined bit of data, which you pass as the last arg of + * Mix_RegisterEffect(), and is passed back unmolested to your callback. + * Your effect changes the contents of (stream) based on whatever parameters + * are significant, or just leaves it be, if you prefer. You can do whatever + * you like to the buffer, though, and it will continue in its changed state + * down the mixing pipeline, through any other effect functions, then finally + * to be mixed with the rest of the channels and music for the final output + * stream. + * + * DO NOT EVER call SDL_LockAudio() from your callback function! + */ +typedef void (SDLCALL *Mix_EffectFunc_t)(int chan, void *stream, int len, void *udata); + +/* + * This is a callback that signifies that a channel has finished all its + * loops and has completed playback. This gets called if the buffer + * plays out normally, or if you call Mix_HaltChannel(), implicitly stop + * a channel via Mix_AllocateChannels(), or unregister a callback while + * it's still playing. + * + * DO NOT EVER call SDL_LockAudio() from your callback function! + */ +typedef void (SDLCALL *Mix_EffectDone_t)(int chan, void *udata); + + +/* Register a special effect function. At mixing time, the channel data is + * copied into a buffer and passed through each registered effect function. + * After it passes through all the functions, it is mixed into the final + * output stream. The copy to buffer is performed once, then each effect + * function performs on the output of the previous effect. Understand that + * this extra copy to a buffer is not performed if there are no effects + * registered for a given chunk, which saves CPU cycles, and any given + * effect will be extra cycles, too, so it is crucial that your code run + * fast. Also note that the data that your function is given is in the + * format of the sound device, and not the format you gave to Mix_OpenAudio(), + * although they may in reality be the same. This is an unfortunate but + * necessary speed concern. Use Mix_QuerySpec() to determine if you can + * handle the data before you register your effect, and take appropriate + * actions. + * You may also specify a callback (Mix_EffectDone_t) that is called when + * the channel finishes playing. This gives you a more fine-grained control + * than Mix_ChannelFinished(), in case you need to free effect-specific + * resources, etc. If you don't need this, you can specify NULL. + * You may set the callbacks before or after calling Mix_PlayChannel(). + * Things like Mix_SetPanning() are just internal special effect functions, + * so if you are using that, you've already incurred the overhead of a copy + * to a separate buffer, and that these effects will be in the queue with + * any functions you've registered. The list of registered effects for a + * channel is reset when a chunk finishes playing, so you need to explicitly + * set them with each call to Mix_PlayChannel*(). + * You may also register a special effect function that is to be run after + * final mixing occurs. The rules for these callbacks are identical to those + * in Mix_RegisterEffect, but they are run after all the channels and the + * music have been mixed into a single stream, whereas channel-specific + * effects run on a given channel before any other mixing occurs. These + * global effect callbacks are call "posteffects". Posteffects only have + * their Mix_EffectDone_t function called when they are unregistered (since + * the main output stream is never "done" in the same sense as a channel). + * You must unregister them manually when you've had enough. Your callback + * will be told that the channel being mixed is (MIX_CHANNEL_POST) if the + * processing is considered a posteffect. + * + * After all these effects have finished processing, the callback registered + * through Mix_SetPostMix() runs, and then the stream goes to the audio + * device. + * + * DO NOT EVER call SDL_LockAudio() from your callback function! + * + * returns zero if error (no such channel), nonzero if added. + * Error messages can be retrieved from Mix_GetError(). + */ +extern DECLSPEC int SDLCALL Mix_RegisterEffect(int chan, Mix_EffectFunc_t f, Mix_EffectDone_t d, void *arg); + + +/* You may not need to call this explicitly, unless you need to stop an + * effect from processing in the middle of a chunk's playback. + * Posteffects are never implicitly unregistered as they are for channels, + * but they may be explicitly unregistered through this function by + * specifying MIX_CHANNEL_POST for a channel. + * returns zero if error (no such channel or effect), nonzero if removed. + * Error messages can be retrieved from Mix_GetError(). + */ +extern DECLSPEC int SDLCALL Mix_UnregisterEffect(int channel, Mix_EffectFunc_t f); + + +/* You may not need to call this explicitly, unless you need to stop all + * effects from processing in the middle of a chunk's playback. Note that + * this will also shut off some internal effect processing, since + * Mix_SetPanning() and others may use this API under the hood. This is + * called internally when a channel completes playback. + * Posteffects are never implicitly unregistered as they are for channels, + * but they may be explicitly unregistered through this function by + * specifying MIX_CHANNEL_POST for a channel. + * returns zero if error (no such channel), nonzero if all effects removed. + * Error messages can be retrieved from Mix_GetError(). + */ +extern DECLSPEC int SDLCALL Mix_UnregisterAllEffects(int channel); + + +#define MIX_EFFECTSMAXSPEED "MIX_EFFECTSMAXSPEED" + +/* + * These are the internally-defined mixing effects. They use the same API that + * effects defined in the application use, but are provided here as a + * convenience. Some effects can reduce their quality or use more memory in + * the name of speed; to enable this, make sure the environment variable + * MIX_EFFECTSMAXSPEED (see above) is defined before you call + * Mix_OpenAudio(). + */ + + +/* Set the panning of a channel. The left and right channels are specified + * as integers between 0 and 255, quietest to loudest, respectively. + * + * Technically, this is just individual volume control for a sample with + * two (stereo) channels, so it can be used for more than just panning. + * If you want real panning, call it like this: + * + * Mix_SetPanning(channel, left, 255 - left); + * + * ...which isn't so hard. + * + * Setting (channel) to MIX_CHANNEL_POST registers this as a posteffect, and + * the panning will be done to the final mixed stream before passing it on + * to the audio device. + * + * This uses the Mix_RegisterEffect() API internally, and returns without + * registering the effect function if the audio device is not configured + * for stereo output. Setting both (left) and (right) to 255 causes this + * effect to be unregistered, since that is the data's normal state. + * + * returns zero if error (no such channel or Mix_RegisterEffect() fails), + * nonzero if panning effect enabled. Note that an audio device in mono + * mode is a no-op, but this call will return successful in that case. + * Error messages can be retrieved from Mix_GetError(). + */ +extern DECLSPEC int SDLCALL Mix_SetPanning(int channel, Uint8 left, Uint8 right); + + +/* Set the position of a channel. (angle) is an integer from 0 to 360, that + * specifies the location of the sound in relation to the listener. (angle) + * will be reduced as neccesary (540 becomes 180 degrees, -100 becomes 260). + * Angle 0 is due north, and rotates clockwise as the value increases. + * For efficiency, the precision of this effect may be limited (angles 1 + * through 7 might all produce the same effect, 8 through 15 are equal, etc). + * (distance) is an integer between 0 and 255 that specifies the space + * between the sound and the listener. The larger the number, the further + * away the sound is. Using 255 does not guarantee that the channel will be + * culled from the mixing process or be completely silent. For efficiency, + * the precision of this effect may be limited (distance 0 through 5 might + * all produce the same effect, 6 through 10 are equal, etc). Setting (angle) + * and (distance) to 0 unregisters this effect, since the data would be + * unchanged. + * + * If you need more precise positional audio, consider using OpenAL for + * spatialized effects instead of SDL_mixer. This is only meant to be a + * basic effect for simple "3D" games. + * + * If the audio device is configured for mono output, then you won't get + * any effectiveness from the angle; however, distance attenuation on the + * channel will still occur. While this effect will function with stereo + * voices, it makes more sense to use voices with only one channel of sound, + * so when they are mixed through this effect, the positioning will sound + * correct. You can convert them to mono through SDL before giving them to + * the mixer in the first place if you like. + * + * Setting (channel) to MIX_CHANNEL_POST registers this as a posteffect, and + * the positioning will be done to the final mixed stream before passing it + * on to the audio device. + * + * This is a convenience wrapper over Mix_SetDistance() and Mix_SetPanning(). + * + * returns zero if error (no such channel or Mix_RegisterEffect() fails), + * nonzero if position effect is enabled. + * Error messages can be retrieved from Mix_GetError(). + */ +extern DECLSPEC int SDLCALL Mix_SetPosition(int channel, Sint16 angle, Uint8 distance); + + +/* Set the "distance" of a channel. (distance) is an integer from 0 to 255 + * that specifies the location of the sound in relation to the listener. + * Distance 0 is overlapping the listener, and 255 is as far away as possible + * A distance of 255 does not guarantee silence; in such a case, you might + * want to try changing the chunk's volume, or just cull the sample from the + * mixing process with Mix_HaltChannel(). + * For efficiency, the precision of this effect may be limited (distances 1 + * through 7 might all produce the same effect, 8 through 15 are equal, etc). + * (distance) is an integer between 0 and 255 that specifies the space + * between the sound and the listener. The larger the number, the further + * away the sound is. + * Setting (distance) to 0 unregisters this effect, since the data would be + * unchanged. + * If you need more precise positional audio, consider using OpenAL for + * spatialized effects instead of SDL_mixer. This is only meant to be a + * basic effect for simple "3D" games. + * + * Setting (channel) to MIX_CHANNEL_POST registers this as a posteffect, and + * the distance attenuation will be done to the final mixed stream before + * passing it on to the audio device. + * + * This uses the Mix_RegisterEffect() API internally. + * + * returns zero if error (no such channel or Mix_RegisterEffect() fails), + * nonzero if position effect is enabled. + * Error messages can be retrieved from Mix_GetError(). + */ +extern DECLSPEC int SDLCALL Mix_SetDistance(int channel, Uint8 distance); + + +/* + * !!! FIXME : Haven't implemented, since the effect goes past the + * end of the sound buffer. Will have to think about this. + * --ryan. + */ +#if 0 +/* Causes an echo effect to be mixed into a sound. (echo) is the amount + * of echo to mix. 0 is no echo, 255 is infinite (and probably not + * what you want). + * + * Setting (channel) to MIX_CHANNEL_POST registers this as a posteffect, and + * the reverbing will be done to the final mixed stream before passing it on + * to the audio device. + * + * This uses the Mix_RegisterEffect() API internally. If you specify an echo + * of zero, the effect is unregistered, as the data is already in that state. + * + * returns zero if error (no such channel or Mix_RegisterEffect() fails), + * nonzero if reversing effect is enabled. + * Error messages can be retrieved from Mix_GetError(). + */ +extern no_parse_DECLSPEC int SDLCALL Mix_SetReverb(int channel, Uint8 echo); +#endif + +/* Causes a channel to reverse its stereo. This is handy if the user has his + * speakers hooked up backwards, or you would like to have a minor bit of + * psychedelia in your sound code. :) Calling this function with (flip) + * set to non-zero reverses the chunks's usual channels. If (flip) is zero, + * the effect is unregistered. + * + * This uses the Mix_RegisterEffect() API internally, and thus is probably + * more CPU intensive than having the user just plug in his speakers + * correctly. Mix_SetReverseStereo() returns without registering the effect + * function if the audio device is not configured for stereo output. + * + * If you specify MIX_CHANNEL_POST for (channel), then this the effect is used + * on the final mixed stream before sending it on to the audio device (a + * posteffect). + * + * returns zero if error (no such channel or Mix_RegisterEffect() fails), + * nonzero if reversing effect is enabled. Note that an audio device in mono + * mode is a no-op, but this call will return successful in that case. + * Error messages can be retrieved from Mix_GetError(). + */ +extern DECLSPEC int SDLCALL Mix_SetReverseStereo(int channel, int flip); + +/* end of effects API. --ryan. */ + + +/* Reserve the first channels (0 -> n-1) for the application, i.e. don't allocate + them dynamically to the next sample if requested with a -1 value below. + Returns the number of reserved channels. + */ +extern DECLSPEC int SDLCALL Mix_ReserveChannels(int num); + +/* Channel grouping functions */ + +/* Attach a tag to a channel. A tag can be assigned to several mixer + channels, to form groups of channels. + If 'tag' is -1, the tag is removed (actually -1 is the tag used to + represent the group of all the channels). + Returns true if everything was OK. + */ +extern DECLSPEC int SDLCALL Mix_GroupChannel(int which, int tag); +/* Assign several consecutive channels to a group */ +extern DECLSPEC int SDLCALL Mix_GroupChannels(int from, int to, int tag); +/* Finds the first available channel in a group of channels, + returning -1 if none are available. + */ +extern DECLSPEC int SDLCALL Mix_GroupAvailable(int tag); +/* Returns the number of channels in a group. This is also a subtle + way to get the total number of channels when 'tag' is -1 + */ +extern DECLSPEC int SDLCALL Mix_GroupCount(int tag); +/* Finds the "oldest" sample playing in a group of channels */ +extern DECLSPEC int SDLCALL Mix_GroupOldest(int tag); +/* Finds the "most recent" (i.e. last) sample playing in a group of channels */ +extern DECLSPEC int SDLCALL Mix_GroupNewer(int tag); + +/* Play an audio chunk on a specific channel. + If the specified channel is -1, play on the first free channel. + If 'loops' is greater than zero, loop the sound that many times. + If 'loops' is -1, loop inifinitely (~65000 times). + Returns which channel was used to play the sound. +*/ +#define Mix_PlayChannel(channel,chunk,loops) Mix_PlayChannelTimed(channel,chunk,loops,-1) +/* The same as above, but the sound is played at most 'ticks' milliseconds */ +extern DECLSPEC int SDLCALL Mix_PlayChannelTimed(int channel, Mix_Chunk *chunk, int loops, int ticks); +extern DECLSPEC int SDLCALL Mix_PlayMusic(Mix_Music *music, int loops); +#define Mix_PlayChannelVol(channel,chunk,loops,vol) Mix_PlayChannelTimedVolume(channel,chunk,loops,-1,vol)/*MIXER-X*/ +extern DECLSPEC int SDLCALL Mix_PlayChannelTimedVolume(int which, Mix_Chunk *chunk, int loops, int ticks, int volume);/*MIXER-X*/ + +/* Fade in music or a channel over "ms" milliseconds, same semantics as the "Play" functions */ +extern DECLSPEC int SDLCALL Mix_FadeInMusic(Mix_Music *music, int loops, int ms); +extern DECLSPEC int SDLCALL Mix_FadeInMusicPos(Mix_Music *music, int loops, int ms, double position); +#define Mix_FadeInChannel(channel,chunk,loops,ms) Mix_FadeInChannelTimed(channel,chunk,loops,ms,-1) +extern DECLSPEC int SDLCALL Mix_FadeInChannelTimed(int channel, Mix_Chunk *chunk, int loops, int ms, int ticks); +#define Mix_FadeInChannelVolume(channel,chunk,loops,ms,vol) Mix_FadeInChannelTimed(channel,chunk,loops,ms,-1,vol)/*MIXER-X*/ +extern DECLSPEC int SDLCALL Mix_FadeInChannelTimedVolume(int which, Mix_Chunk *chunk, int loops, int ms, int ticks, int volume);/*MIXER-X*/ + + +/* Set the volume in the range of 0-128 of a specific channel or chunk. + If the specified channel is -1, set volume for all channels. + Returns the original volume. + If the specified volume is -1, just return the current volume. +*/ +extern DECLSPEC int SDLCALL Mix_Volume(int channel, int volume); +extern DECLSPEC int SDLCALL Mix_VolumeChunk(Mix_Chunk *chunk, int volume); +extern DECLSPEC int SDLCALL Mix_VolumeMusic(int volume); + +/* Halt playing of a particular channel */ +extern DECLSPEC int SDLCALL Mix_HaltChannel(int channel); +extern DECLSPEC int SDLCALL Mix_HaltGroup(int tag); +extern DECLSPEC int SDLCALL Mix_HaltMusic(void); + +/* Change the expiration delay for a particular channel. + The sample will stop playing after the 'ticks' milliseconds have elapsed, + or remove the expiration if 'ticks' is -1 +*/ +extern DECLSPEC int SDLCALL Mix_ExpireChannel(int channel, int ticks); + +/* Halt a channel, fading it out progressively till it's silent + The ms parameter indicates the number of milliseconds the fading + will take. + */ +extern DECLSPEC int SDLCALL Mix_FadeOutChannel(int which, int ms); +extern DECLSPEC int SDLCALL Mix_FadeOutGroup(int tag, int ms); +extern DECLSPEC int SDLCALL Mix_FadeOutMusic(int ms); + +/* Query the fading status of a channel */ +extern DECLSPEC Mix_Fading SDLCALL Mix_FadingMusic(void); +extern DECLSPEC Mix_Fading SDLCALL Mix_FadingChannel(int which); + +/* Pause/Resume a particular channel */ +extern DECLSPEC void SDLCALL Mix_Pause(int channel); +extern DECLSPEC void SDLCALL Mix_Resume(int channel); +extern DECLSPEC int SDLCALL Mix_Paused(int channel); + +/* Pause/Resume the music stream */ +extern DECLSPEC void SDLCALL Mix_PauseMusic(void); +extern DECLSPEC void SDLCALL Mix_ResumeMusic(void); +extern DECLSPEC void SDLCALL Mix_RewindMusic(void); +extern DECLSPEC int SDLCALL Mix_PausedMusic(void); + +/* Set the current position in the music stream. + This returns 0 if successful, or -1 if it failed or isn't implemented. + This function is only implemented for MOD music formats (set pattern + order number) and for WAV, OGG, FLAC, MP3_MAD, MP3_MPG, and MODPLUG music + (set position in seconds), at the moment. +*/ +extern DECLSPEC int SDLCALL Mix_SetMusicPosition(double position); +/* + Get the time current position of music stream + returns -1.0 if this feature is not supported for some codec + */ +extern DECLSPEC double SDLCALL Mix_GetMusicPosition(Mix_Music *music); +/* + Get the total time length of music stream + returns -1.0 if this feature is not supported for some codec + */ +extern DECLSPEC double SDLCALL Mix_GetMusicTotalTime(Mix_Music *music); + +/* + Get the loop start time position of music stream + returns -1.0 if this feature is not used for this music or not supported for some codec + */ +extern DECLSPEC double SDLCALL Mix_GetMusicLoopStartTime(Mix_Music *music); +/* + Get the loop end time position of music stream + returns -1.0 if this feature is not used for this music or not supported for some codec + */ +extern DECLSPEC double SDLCALL Mix_GetMusicLoopEndTime(Mix_Music *music); +/* + Get the loop time length of music stream + returns -1.0 if this feature is not used for this music or not supported for some codec + */ +extern DECLSPEC double SDLCALL Mix_GetMusicLoopLengthTime(Mix_Music *music); + + +/* Check the status of a specific channel. + If the specified channel is -1, check all channels. +*/ +extern DECLSPEC int SDLCALL Mix_Playing(int channel); +extern DECLSPEC int SDLCALL Mix_PlayingMusic(void); + +/* Stop music and set external music playback command */ +extern DECLSPEC int SDLCALL Mix_SetMusicCMD(const char *command); + +/* Synchro value is set by MikMod from modules while playing */ +extern DECLSPEC int SDLCALL Mix_SetSynchroValue(int value); +extern DECLSPEC int SDLCALL Mix_GetSynchroValue(void); + +/* Set/Get/Iterate SoundFonts paths to use by supported MIDI backends */ +extern DECLSPEC int SDLCALL Mix_SetSoundFonts(const char *paths); +extern DECLSPEC const char* SDLCALL Mix_GetSoundFonts(void); +extern DECLSPEC int SDLCALL Mix_EachSoundFont(int (SDLCALL *function)(const char*, void*), void *data); + +/* Get the Mix_Chunk currently associated with a mixer channel + Returns NULL if it's an invalid channel, or there's no chunk associated. +*/ +extern DECLSPEC Mix_Chunk * SDLCALL Mix_GetChunk(int channel); + +/* Close the mixer, halting all playing audio */ +extern DECLSPEC void SDLCALL Mix_CloseAudio(void); + +/* Add additional Timidity bank path */ +extern DECLSPEC void SDLCALL Mix_Timidity_addToPathList(const char *path); + +/* ADLMIDI Setup functions */ +/* Get count of available hardcoded banks */ +extern DECLSPEC int SDLCALL Mix_ADLMIDI_getTotalBanks(void); +/* Get array of the bank names */ +extern DECLSPEC const char *const *SDLCALL Mix_ADLMIDI_getBankNames(void); +/* Get bank ID */ +extern DECLSPEC int SDLCALL Mix_ADLMIDI_getBankID(void); +/* Set bank ID (Applying on stop/play) */ +extern DECLSPEC void SDLCALL Mix_ADLMIDI_setBankID(int bnk); +/* Get state of deep vibrato */ +extern DECLSPEC int SDLCALL Mix_ADLMIDI_getTremolo(void); +/* Set deep tremolo mode (0 off, 1 on) (Applying on stop/play) */ +extern DECLSPEC void SDLCALL Mix_ADLMIDI_setTremolo(int tr); +/* Get state of deep vibrato */ +extern DECLSPEC int SDLCALL Mix_ADLMIDI_getVibrato(void); +/* Set deep vibrato mode (0 off, 1 on) (Applying on stop/play) */ +extern DECLSPEC void SDLCALL Mix_ADLMIDI_setVibrato(int vib); +/* Get state of scalable modulation mode */ +extern DECLSPEC int SDLCALL Mix_ADLMIDI_getScaleMod(void); +/* Set scalable modulation mode (0 off, 1 on) (Applying on stop/play) */ +extern DECLSPEC void SDLCALL Mix_ADLMIDI_setScaleMod(int sc); +/* Get state of adlib drums mode */ +extern DECLSPEC int SDLCALL Mix_ADLMIDI_getAdLibMode(void); +/* Set adlib drums mode mode (0 off, 1 on) (Applying on stop/play) */ +extern DECLSPEC void SDLCALL Mix_ADLMIDI_setAdLibMode(int tr); +/* Get state of logarithmic mode */ +extern DECLSPEC int SDLCALL Mix_ADLMIDI_getLogarithmicVolumes(void); +/* Set logarithmic volumes mode in the generic/CMF volume models (0 off, 1 on) (Applying on stop/play) */ +extern DECLSPEC void SDLCALL Mix_ADLMIDI_setLogarithmicVolumes(int lv); +/* Get current volume model ID */ +extern DECLSPEC int SDLCALL Mix_ADLMIDI_getVolumeModel(void); +/* Change current volumes model (Applying on stop/play) */ +extern DECLSPEC void SDLCALL Mix_ADLMIDI_setVolumeModel(int vm); +/* Get full range mode for CC74-Brightness controller */ +extern DECLSPEC int SDLCALL Mix_ADLMIDI_getFullRangeBrightness(void); +/* Set full range mode for CC74-Brightness controller */ +extern DECLSPEC void SDLCALL Mix_ADLMIDI_setFullRangeBrightness(int frb); +/* Get the current OPL3 Emulator for ADLMIDI */ +extern DECLSPEC int SDLCALL Mix_ADLMIDI_getEmulator(void); +/* Select the OPL3 Emulator for ADLMIDI */ +extern DECLSPEC void SDLCALL Mix_ADLMIDI_setEmulator(int emu); +/* Reset all ADLMIDI properties to default state */ +extern DECLSPEC void SDLCALL Mix_ADLMIDI_setSetDefaults(void); + +/* Sets WOPL bank file for ADLMIDI playing device, affects on MIDI file reopen */ +extern DECLSPEC void SDLCALL Mix_ADLMIDI_setCustomBankFile(const char *bank_wonl_path); + +/* Reset all OPNMIDI properties to default state */ +extern DECLSPEC void SDLCALL Mix_OPNMIDI_setSetDefaults(void); +/* Get full range mode for CC74-Brightness controller */ +extern DECLSPEC int SDLCALL Mix_OPNMIDI_getFullRangeBrightness(void); +/* Set full range mode for CC74-Brightness controller */ +extern DECLSPEC void SDLCALL Mix_OPNMIDI_setFullRangeBrightness(int frb); +/* Get the OPN2 Emulator for OPNMIDI */ +extern DECLSPEC int SDLCALL Mix_OPNMIDI_getEmulator(void); +/* Select the OPN2 Emulator for OPNMIDI */ +extern DECLSPEC void SDLCALL Mix_OPNMIDI_setEmulator(int emu); +/* Sets WOPN bank file for OPNMIDI playing device, affects on MIDI file reopen */ +extern DECLSPEC void SDLCALL Mix_OPNMIDI_setCustomBankFile(const char *bank_wonp_path); + +/* Get type of MIDI player library currently in use */ +extern DECLSPEC int SDLCALL Mix_GetMidiPlayer(void); + +/* Get type of MIDI player library prepared for next opening of MIDI file */ +extern DECLSPEC int SDLCALL Mix_GetNextMidiPlayer(void); + +/* Set the MIDI playing library (ADLMIDI, Timidity, Native MIDI (if available) and FluidSynth) */ +extern DECLSPEC int SDLCALL Mix_SetMidiPlayer(int player); + +/* Disables support of MIDI file arguments */ +extern DECLSPEC void SDLCALL Mix_SetLockMIDIArgs(int lock_midiargs); + +/* DEPRECATED NAMES for new-added SDL Mixer X functions + Those names are made with mistake - beginning with "MIX_" than "Mix_" + which makes confusion when you looking for Mix_ function in your IDE + because some applications are still use them, to don't break ABI we will keep those + aliases until we will remove all usages of them from applications and libraries are used them +*/ +DEPRECATED(extern DECLSPEC int SDLCALL Mix_GetMidiDevice(void)); +DEPRECATED(extern DECLSPEC int SDLCALL Mix_GetNextMidiDevice(void)); +DEPRECATED(extern DECLSPEC int SDLCALL Mix_SetMidiDevice(int player)); + +/* We'll use SDL for reporting errors */ +#define Mix_SetError SDL_SetError +#define Mix_GetError SDL_GetError +#define Mix_ClearError SDL_ClearError + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif +#include "close_code.h" + +#endif /* SDL_MIXER_H_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/libs/SDLMixerX/x86_64-w64-mingw32/include/SDL2/begin_code.h b/libs/SDLMixerX/x86_64-w64-mingw32/include/SDL2/begin_code.h new file mode 100644 index 000000000..6c2106246 --- /dev/null +++ b/libs/SDLMixerX/x86_64-w64-mingw32/include/SDL2/begin_code.h @@ -0,0 +1,167 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/** + * \file begin_code.h + * + * This file sets things up for C dynamic library function definitions, + * static inlined functions, and structures aligned at 4-byte alignment. + * If you don't like ugly C preprocessor code, don't look at this file. :) + */ + +/* This shouldn't be nested -- included it around code only. */ +#ifdef _begin_code_h +#error Nested inclusion of begin_code.h +#endif +#define _begin_code_h + +#ifndef SDL_DEPRECATED +# if (__GNUC__ >= 4) /* technically, this arrived in gcc 3.1, but oh well. */ +# define SDL_DEPRECATED __attribute__((deprecated)) +# else +# define SDL_DEPRECATED +# endif +#endif + +#ifndef SDL_UNUSED +# ifdef __GNUC__ +# define SDL_UNUSED __attribute__((unused)) +# else +# define SDL_UNUSED +# endif +#endif + +/* Some compilers use a special export keyword */ +#ifndef DECLSPEC +# if defined(__WIN32__) || defined(__WINRT__) +# ifdef __BORLANDC__ +# ifdef BUILD_SDL +# define DECLSPEC +# else +# define DECLSPEC __declspec(dllimport) +# endif +# else +# define DECLSPEC __declspec(dllexport) +# endif +# elif defined(__OS2__) +# ifdef BUILD_SDL +# define DECLSPEC __declspec(dllexport) +# else +# define DECLSPEC +# endif +# else +# if defined(__GNUC__) && __GNUC__ >= 4 +# define DECLSPEC __attribute__ ((visibility("default"))) +# else +# define DECLSPEC +# endif +# endif +#endif + +/* By default SDL uses the C calling convention */ +#ifndef SDLCALL +#if (defined(__WIN32__) || defined(__WINRT__)) && !defined(__GNUC__) +#define SDLCALL __cdecl +#elif defined(__OS2__) || defined(__EMX__) +#define SDLCALL _System +# if defined (__GNUC__) && !defined(_System) +# define _System /* for old EMX/GCC compat. */ +# endif +#else +#define SDLCALL +#endif +#endif /* SDLCALL */ + +/* Removed DECLSPEC on Symbian OS because SDL cannot be a DLL in EPOC */ +#ifdef __SYMBIAN32__ +#undef DECLSPEC +#define DECLSPEC +#endif /* __SYMBIAN32__ */ + +/* Force structure packing at 4 byte alignment. + This is necessary if the header is included in code which has structure + packing set to an alternate value, say for loading structures from disk. + The packing is reset to the previous value in close_code.h + */ +#if defined(_MSC_VER) || defined(__MWERKS__) || defined(__BORLANDC__) +#ifdef _MSC_VER +#pragma warning(disable: 4103) +#endif +#ifdef __BORLANDC__ +#pragma nopackwarning +#endif +#ifdef _M_X64 +/* Use 8-byte alignment on 64-bit architectures, so pointers are aligned */ +#pragma pack(push,8) +#else +#pragma pack(push,4) +#endif +#endif /* Compiler needs structure packing set */ + +#ifndef SDL_INLINE +#if defined(__GNUC__) +#define SDL_INLINE __inline__ +#elif defined(_MSC_VER) || defined(__BORLANDC__) || \ + defined(__DMC__) || defined(__SC__) || \ + defined(__WATCOMC__) || defined(__LCC__) || \ + defined(__DECC) || defined(__CC_ARM) +#define SDL_INLINE __inline +#ifndef __inline__ +#define __inline__ __inline +#endif +#else +#define SDL_INLINE inline +#ifndef __inline__ +#define __inline__ inline +#endif +#endif +#endif /* SDL_INLINE not defined */ + +#ifndef SDL_FORCE_INLINE +#if defined(_MSC_VER) +#define SDL_FORCE_INLINE __forceinline +#elif ( (defined(__GNUC__) && (__GNUC__ >= 4)) || defined(__clang__) ) +#define SDL_FORCE_INLINE __attribute__((always_inline)) static __inline__ +#else +#define SDL_FORCE_INLINE static SDL_INLINE +#endif +#endif /* SDL_FORCE_INLINE not defined */ + +#ifndef SDL_NORETURN +#if defined(__GNUC__) +#define SDL_NORETURN __attribute__((noreturn)) +#elif defined(_MSC_VER) +#define SDL_NORETURN __declspec(noreturn) +#else +#define SDL_NORETURN +#endif +#endif /* SDL_NORETURN not defined */ + +/* Apparently this is needed by several Windows compilers */ +#if !defined(__MACH__) +#ifndef NULL +#ifdef __cplusplus +#define NULL 0 +#else +#define NULL ((void *)0) +#endif +#endif /* NULL */ +#endif /* ! Mac OS X - breaks precompiled headers */ diff --git a/libs/SDLMixerX/x86_64-w64-mingw32/include/SDL2/close_code.h b/libs/SDLMixerX/x86_64-w64-mingw32/include/SDL2/close_code.h new file mode 100644 index 000000000..b3b70a4c8 --- /dev/null +++ b/libs/SDLMixerX/x86_64-w64-mingw32/include/SDL2/close_code.h @@ -0,0 +1,37 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/** + * \file close_code.h + * + * This file reverses the effects of begin_code.h and should be included + * after you finish any function and structure declarations in your headers + */ + +#undef _begin_code_h + +/* Reset structure packing at previous byte alignment */ +#if defined(_MSC_VER) || defined(__MWERKS__) || defined(__BORLANDC__) +#ifdef __BORLANDC__ +#pragma nopackwarning +#endif +#pragma pack(pop) +#endif /* Compiler needs structure packing set */ diff --git a/libs/SDLMixerX/x86_64-w64-mingw32/lib/libSDL2_mixer_ext.dll.a b/libs/SDLMixerX/x86_64-w64-mingw32/lib/libSDL2_mixer_ext.dll.a new file mode 100644 index 000000000..c1cede98d Binary files /dev/null and b/libs/SDLMixerX/x86_64-w64-mingw32/lib/libSDL2_mixer_ext.dll.a differ diff --git a/src/Makefile b/src/Makefile index 5fd5a871e..3015aa5d6 100644 --- a/src/Makefile +++ b/src/Makefile @@ -69,6 +69,8 @@ # Addon for SDL: # To Cross-Compile, add 'SDL_CONFIG=/usr/*/bin/sdl-config' # Compile without SDL_Mixer, add 'NOMIXER=1' +# Compile without SDL_Mixer_X, add 'NOMIXERX=1' (Win32 only) +# Compile without GME, add 'NOGME=1' # Compile without BSD API, add 'NONET=1' # Compile without IPX/SPX, add 'NOIPX=1' # Compile Mingw/SDL with S_DS3S, add 'DS3D=1' diff --git a/src/d_main.c b/src/d_main.c index 32e874f07..eaeae4b10 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -113,7 +113,7 @@ INT32 postimgparam; postimg_t postimgtype2 = postimg_none; INT32 postimgparam2; -// These variables are only true if +// These variables are in effect // whether the respective sound system is disabled // or they're init'ed, but the player just toggled them boolean midi_disabled = false; diff --git a/src/dehacked.c b/src/dehacked.c index 0cb7330d0..53bd3dc03 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -1172,6 +1172,15 @@ static void readlevelheader(MYFILE *f, INT32 num) else if (fastcmp(word, "MUSICINTER")) deh_strlcpy(mapheaderinfo[num-1]->musintername, word2, sizeof(mapheaderinfo[num-1]->musintername), va("Level header %d: intermission music", num)); + else if (fastcmp(word, "MUSICPOSTBOSS")) + deh_strlcpy(mapheaderinfo[num-1]->muspostbossname, word2, + sizeof(mapheaderinfo[num-1]->muspostbossname), va("Level header %d: post-boss music", num)); + else if (fastcmp(word, "MUSICPOSTBOSSTRACK")) + mapheaderinfo[num-1]->muspostbosstrack = ((UINT16)i - 1); + else if (fastcmp(word, "MUSICPOSTBOSSPOS")) + mapheaderinfo[num-1]->muspostbosspos = (UINT32)get_number(word2); + else if (fastcmp(word, "MUSICPOSTBOSSFADEIN")) + mapheaderinfo[num-1]->muspostbossfadein = (UINT32)get_number(word2); else if (fastcmp(word, "FORCECHARACTER")) { strlcpy(mapheaderinfo[num-1]->forcecharacter, word2, SKINNAMESIZE+1); @@ -8696,6 +8705,23 @@ struct { {"GT_HIDEANDSEEK",GT_HIDEANDSEEK}, {"GT_CTF",GT_CTF}, + // Jingles (jingletype_t) + {"JT_NONE",JT_NONE}, + {"JT_OTHER",JT_OTHER}, + {"JT_MASTER",JT_MASTER}, + {"JT_1UP",JT_1UP}, + {"JT_SHOES",JT_SHOES}, + {"JT_INV",JT_INV}, + {"JT_MINV",JT_MINV}, + {"JT_DROWN",JT_DROWN}, + {"JT_SUPER",JT_SUPER}, + {"JT_GOVER",JT_GOVER}, + {"JT_NIGHTSTIMEOUT",JT_NIGHTSTIMEOUT}, + {"JT_SSTIMEOUT",JT_SSTIMEOUT}, + // {"JT_LCLEAR",JT_LCLEAR}, + // {"JT_RACENT",JT_RACENT}, + // {"JT_CONTSC",JT_CONTSC}, + // Player state (playerstate_t) {"PST_LIVE",PST_LIVE}, // Playing or camping. {"PST_DEAD",PST_DEAD}, // Dead on the ground, view follows killer. diff --git a/src/djgppdos/i_sound.c b/src/djgppdos/i_sound.c index 88b598622..847853a89 100644 --- a/src/djgppdos/i_sound.c +++ b/src/djgppdos/i_sound.c @@ -550,6 +550,7 @@ void I_ResumeSong (INT32 handle) songpaused = false; } + void I_SetMusicVolume(INT32 volume) { if (midi_disabled) diff --git a/src/doomstat.h b/src/doomstat.h index 18300967c..b6c376d1c 100644 --- a/src/doomstat.h +++ b/src/doomstat.h @@ -327,6 +327,11 @@ typedef struct // Music stuff. UINT32 musinterfadeout; ///< Fade out level music on intermission screen in milliseconds char musintername[7]; ///< Intermission screen music. + + char muspostbossname[7]; ///< Post-bossdeath music. + UINT16 muspostbosstrack; ///< Post-bossdeath track. + UINT32 muspostbosspos; ///< Post-bossdeath position + UINT32 muspostbossfadein; ///< Post-bossdeath fade-in milliseconds. // Lua stuff. // (This is not ifdeffed so the map header structure can stay identical, just in case.) diff --git a/src/i_sound.h b/src/i_sound.h index d427881d2..4b2999857 100644 --- a/src/i_sound.h +++ b/src/i_sound.h @@ -31,7 +31,8 @@ typedef enum { MU_FLAC, MU_MODPLUG_UNUSED, // use MU_MOD instead MU_GME, - MU_MOD_EX // libopenmpt + MU_MOD_EX, // libopenmpt + MU_MID_EX // Non-native MIDI } musictype_t; /** \brief Sound subsystem runing and waiting diff --git a/src/locale/en.po b/src/locale/en.po index 5f4592079..83e118772 100644 --- a/src/locale/en.po +++ b/src/locale/en.po @@ -3825,7 +3825,7 @@ msgid "Music lump is not MID music format\n" msgstr "" #: win32/win_snd.c:2128 -msgid "I_RegisterSong: StreamBufferSetup FAILED" +msgid "I_LoadSong: StreamBufferSetup FAILED" msgstr "" #: win32/win_sys.c:892 diff --git a/src/locale/srb2.pot b/src/locale/srb2.pot index 552e9edb1..087c8720c 100644 --- a/src/locale/srb2.pot +++ b/src/locale/srb2.pot @@ -4021,7 +4021,7 @@ msgid "Music lump is not MID music format\n" msgstr "" #: win32/win_snd.c:2126 -msgid "I_RegisterSong: StreamBufferSetup FAILED" +msgid "I_LoadSong: StreamBufferSetup FAILED" msgstr "" #: win32/win_sys.c:894 diff --git a/src/lua_maplib.c b/src/lua_maplib.c index 82843db4e..74b259921 100644 --- a/src/lua_maplib.c +++ b/src/lua_maplib.c @@ -2009,6 +2009,14 @@ static int mapheaderinfo_get(lua_State *L) lua_pushinteger(L, header->musinterfadeout); else if (fastcmp(field,"musintername")) lua_pushstring(L, header->musintername); + else if (fastcmp(field,"muspostbossname")) + lua_pushstring(L, header->muspostbossname); + else if (fastcmp(field,"muspostbosstrack")) + lua_pushinteger(L, header->muspostbosstrack); + else if (fastcmp(field,"muspostbosspos")) + lua_pushinteger(L, header->muspostbosspos); + else if (fastcmp(field,"muspostbossfadein")) + lua_pushinteger(L, header->muspostbossfadein); else if (fastcmp(field,"forcecharacter")) lua_pushstring(L, header->forcecharacter); else if (fastcmp(field,"weather")) diff --git a/src/m_menu.c b/src/m_menu.c index 38326257b..a3e986fdf 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -292,6 +292,9 @@ menu_t OP_VideoOptionsDef, OP_VideoModeDef, OP_ColorOptionsDef; menu_t OP_OpenGLOptionsDef, OP_OpenGLFogDef, OP_OpenGLColorDef; #endif menu_t OP_SoundOptionsDef; +#ifdef HAVE_MIXERX +menu_t OP_SoundAdvancedDef; +#endif //Misc menu_t OP_DataOptionsDef, OP_ScreenshotOptionsDef, OP_EraseDataDef; @@ -1302,15 +1305,42 @@ static menuitem_t OP_SoundOptionsMenu[] = {IT_STRING | IT_CVAR, NULL, "MIDI Music", &cv_gamemidimusic, 73}, // 36 {IT_STRING | IT_CVAR | IT_CV_SLIDER, NULL, "MIDI Music Volume", &cv_midimusicvolume, 83}, // 41 - {IT_HEADER, NULL, "Advanced", NULL, 103}, // 50 + {IT_HEADER, NULL, "Accessibility", NULL, 103}, // 50 {IT_STRING | IT_CVAR, NULL, "Closed Captioning", &cv_closedcaptioning, 115}, // 56 + {IT_STRING | IT_CVAR, NULL, "Reset Music Upon Dying", &cv_resetmusic, 125}, // 62 -#ifdef HAVE_OPENMPT - {IT_HEADER, NULL, "OpenMPT Settings", NULL, 133}, - {IT_STRING | IT_CVAR, NULL, "Instrument Filter", &cv_modfilter, 145} +#if defined(HAVE_OPENMPT) || defined(HAVE_MIXERX) + {IT_STRING | IT_SUBMENU, NULL, "Advanced Settings...", &OP_SoundAdvancedDef, 143}, #endif }; +#if defined(HAVE_OPENMPT) || defined(HAVE_MIXERX) + +#ifdef HAVE_OPENMPT +#define OPENMPT_MENUOFFSET 32 +#else +#define OPENMPT_MENUOFFSET 0 +#endif + +static menuitem_t OP_SoundAdvancedMenu[] = +{ +#ifdef HAVE_OPENMPT + {IT_HEADER, NULL, "OpenMPT Settings", NULL, 10}, + {IT_STRING | IT_CVAR, NULL, "Instrument Filter", &cv_modfilter, 22}, +#endif + +#ifdef HAVE_MIXERX + {IT_HEADER, NULL, "MIDI Settings", NULL, OPENMPT_MENUOFFSET+10}, + {IT_STRING | IT_CVAR, NULL, "MIDI Player", &cv_midiplayer, OPENMPT_MENUOFFSET+22}, + {IT_STRING | IT_CVAR | IT_CV_STRING, NULL, "FluidSynth Sound Font File", &cv_midisoundfontpath, OPENMPT_MENUOFFSET+34}, + {IT_STRING | IT_CVAR | IT_CV_STRING, NULL, "TiMidity++ Config Folder", &cv_miditimiditypath, OPENMPT_MENUOFFSET+61} +#endif +}; + +#undef OPENMPT_MENUOFFSET + +#endif + static menuitem_t OP_DataOptionsMenu[] = { {IT_STRING | IT_CALL, NULL, "Add-on Options...", M_AddonsOptions, 10}, @@ -1896,6 +1926,9 @@ menu_t OP_SoundOptionsDef = 0, NULL }; +#ifdef HAVE_MIXERX +menu_t OP_SoundAdvancedDef = DEFAULTMENUSTYLE(MN_OP_MAIN + (MN_OP_SOUND << 6), "M_SOUND", OP_SoundAdvancedMenu, &OP_SoundOptionsDef, 30, 30); +#endif menu_t OP_ServerOptionsDef = DEFAULTSCROLLMENUSTYLE( MN_OP_MAIN + (MN_OP_SERVER << 6), diff --git a/src/p_enemy.c b/src/p_enemy.c index 18d6f20c0..3e7431e40 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -3812,6 +3812,24 @@ void A_BossDeath(mobj_t *mo) EV_DoElevator(&junk, elevateUp, false); junk.tag = LE_CAPSULE2; EV_DoElevator(&junk, elevateHighest, false); + + if (mapheaderinfo[gamemap-1]->muspostbossname[0] && + S_MusicExists(mapheaderinfo[gamemap-1]->muspostbossname, !midi_disabled, !digital_disabled)) + { + // Touching the egg trap button calls P_DoPlayerExit, which calls P_RestoreMusic. + // So just park ourselves in the mapmus variables. + boolean changed = strnicmp(mapheaderinfo[gamemap-1]->musname, mapmusname, 7); + strncpy(mapmusname, mapheaderinfo[gamemap-1]->muspostbossname, 7); + mapmusname[6] = 0; + mapmusflags = (mapheaderinfo[gamemap-1]->muspostbosstrack & MUSIC_TRACKMASK) | MUSIC_RELOADRESET; + mapmusposition = mapheaderinfo[gamemap-1]->muspostbosspos; + + // don't change if we're in another tune + // but in case we're in jingle, use our parked mapmus variables so the correct track restores + if (!changed) + S_ChangeMusicEx(mapmusname, mapmusflags, true, mapmusposition, (1*MUSICRATE)+(MUSICRATE/2), + mapheaderinfo[gamemap-1]->muspostbossfadein); + } } bossjustdie: @@ -4104,12 +4122,11 @@ void A_Invincibility(mobj_t *actor) if (P_IsLocalPlayer(player) && !player->powers[pw_super]) { - S_StopMusic(); if (mariomode) G_GhostAddColor(GHC_INVINCIBLE); strlcpy(S_sfx[sfx_None].caption, "Invincibility", 14); S_StartCaption(sfx_None, -1, player->powers[pw_invulnerability]); - S_ChangeMusicInternal((mariomode) ? "_minv" : "_inv", false); + P_PlayJingle(player, (mariomode) ? JT_MINV : JT_INV); } } @@ -4143,10 +4160,7 @@ void A_SuperSneakers(mobj_t *actor) if (S_SpeedMusic(0.0f) && (mapheaderinfo[gamemap-1]->levelflags & LF_SPEEDMUSIC)) S_SpeedMusic(1.4f); else - { - S_StopMusic(); - S_ChangeMusicInternal("_shoes", false); - } + P_PlayJingle(player, JT_SHOES); strlcpy(S_sfx[sfx_None].caption, "Speed shoes", 12); S_StartCaption(sfx_None, -1, player->powers[pw_sneakers]); } diff --git a/src/p_inter.c b/src/p_inter.c index 0489bab90..cbf5ce54a 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -1700,7 +1700,10 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) // Eaten by player! if ((!player->bot) && (player->powers[pw_underwater] && player->powers[pw_underwater] <= 12*TICRATE + 1)) + { + player->powers[pw_underwater] = underwatertics + 1; P_RestoreMusic(player); + } if (player->powers[pw_underwater] < underwatertics + 1) player->powers[pw_underwater] = underwatertics + 1; @@ -2467,10 +2470,7 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, UINT8 damaget gameovermus = true; if (gameovermus) - { - S_StopMusic(); // Stop the Music! Tails 03-14-2000 - S_ChangeMusicInternal("_gover", false); // Yousa dead now, Okieday? Tails 03-14-2000 - } + P_PlayJingle(target->player, JT_GOVER); // Yousa dead now, Okieday? Tails 03-14-2000 if (!(netgame || multiplayer || demoplayback || demorecording || metalrecording || modeattacking) && numgameovers < maxgameovers) { @@ -2918,7 +2918,7 @@ static inline void P_NiGHTSDamage(mobj_t *target, mobj_t *source) S_StartSound(NULL, sfx_timeup); // that creepy "out of time" music from NiGHTS. } else - S_ChangeMusicInternal((((maptol & TOL_NIGHTS) && !G_IsSpecialStage(gamemap)) ? "_ntime" : "_drown"), false); + P_PlayJingle(player, ((maptol & TOL_NIGHTS) && !G_IsSpecialStage(gamemap)) ? JT_NIGHTSTIMEOUT : JT_SSTIMEOUT); } } } diff --git a/src/p_local.h b/src/p_local.h index 3c62d6277..3a0146e54 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -208,6 +208,47 @@ boolean P_GetLives(player_t *player); boolean P_SpectatorJoinGame(player_t *player); void P_RestoreMultiMusic(player_t *player); +/// ------------------------ +/// Jingle stuff +/// ------------------------ + +typedef enum +{ + JT_NONE, // Null state + JT_OTHER, // Other state + JT_MASTER, // Main level music + JT_1UP, // Extra life + JT_SHOES, // Speed shoes + JT_INV, // Invincibility + JT_MINV, // Mario Invincibility + JT_DROWN, // Drowning + JT_SUPER, // Super Sonic + JT_GOVER, // Game Over + JT_NIGHTSTIMEOUT, // NiGHTS Time Out (10 seconds) + JT_SSTIMEOUT, // NiGHTS Special Stage Time Out (10 seconds) + + // these are not jingles + // JT_LCLEAR, // Level Clear + // JT_RACENT, // Multiplayer Intermission + // JT_CONTSC, // Continue + + NUMJINGLES +} jingletype_t; + +typedef struct +{ + char musname[7]; + boolean looping; +} jingle_t; + +extern jingle_t jingleinfo[NUMJINGLES]; + +#define JINGLEPOSTFADE 1000 + +void P_PlayJingle(player_t *player, jingletype_t jingletype); +boolean P_EvaluateMusicStatus(UINT16 status); +void P_PlayJingleMusic(player_t *player, const char *musname, UINT16 musflags, boolean looping, UINT16 status); + // // P_MOBJ // diff --git a/src/p_setup.c b/src/p_setup.c index c2872a836..b7d53349b 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -217,6 +217,10 @@ static void P_ClearSingleMapHeaderInfo(INT16 i) mapheaderinfo[num]->muspos = 0; mapheaderinfo[num]->musinterfadeout = 0; mapheaderinfo[num]->musintername[0] = '\0'; + mapheaderinfo[num]->muspostbossname[6] = 0; + mapheaderinfo[num]->muspostbosstrack = 0; + mapheaderinfo[num]->muspostbosspos = 0; + mapheaderinfo[num]->muspostbossfadein = 0; mapheaderinfo[num]->forcecharacter[0] = '\0'; mapheaderinfo[num]->weather = 0; mapheaderinfo[num]->skynum = 1; @@ -2686,6 +2690,12 @@ boolean P_SetupLevel(boolean skipprecip) S_StartSound(NULL, sfx_s3kaf); + // Fade music! Time it to S3KAF: 0.25 seconds is snappy. + if (cv_resetmusic.value || + strnicmp(S_MusicName(), + (mapmusflags & MUSIC_RELOADRESET) ? mapheaderinfo[gamemap-1]->musname : mapmusname, 7)) + S_FadeOutStopMusic(MUSICRATE/4); //FixedMul(FixedDiv(F_GetWipeLength(wipedefs[wipe_speclevel_towhite])*NEWTICRATERATIO, NEWTICRATE), MUSICRATE) + F_WipeStartScreen(); V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 0); @@ -2693,6 +2703,7 @@ boolean P_SetupLevel(boolean skipprecip) F_RunWipe(wipedefs[wipe_speclevel_towhite], false); nowtime = lastwipetic; + // Hold on white for extra effect. while (nowtime < endtime) { @@ -2711,12 +2722,13 @@ boolean P_SetupLevel(boolean skipprecip) S_StopSounds(); S_ClearSfx(); - if (!titlemapinaction) - { - // As oddly named as this is, this handles music only. - // We should be fine starting it here. - S_Start(); - } + // Fade out music here. Deduct 2 tics so the fade volume actually reaches 0. + // But don't halt the music! S_Start will take care of that. This dodges a MIDI crash bug. + if (!titlemapinaction && (cv_resetmusic.value || + strnicmp(S_MusicName(), + (mapmusflags & MUSIC_RELOADRESET) ? mapheaderinfo[gamemap-1]->musname : mapmusname, 7))) + S_FadeMusic(0, FixedMul( + FixedDiv((F_GetWipeLength(wipedefs[wipe_level_toblack])-2)*NEWTICRATERATIO, NEWTICRATE), MUSICRATE)); // Let's fade to black here // But only if we didn't do the special stage wipe @@ -2756,6 +2768,11 @@ boolean P_SetupLevel(boolean skipprecip) V_DrawSmallString(1, 195, V_ALLOWLOWERCASE, tx); I_UpdateNoVsync(); } + + // As oddly named as this is, this handles music only. + // We should be fine starting it here. + // Don't do this during titlemap, because the menu code handles music by itself. + S_Start(); } levelfadecol = (ranspecialwipe) ? 0 : 31; diff --git a/src/p_tick.c b/src/p_tick.c index cfdd54eb2..5ec0fb048 100644 --- a/src/p_tick.c +++ b/src/p_tick.c @@ -601,13 +601,20 @@ void P_Ticker(boolean run) OP_ObjectplaceMovement(&players[0]); P_MoveChaseCamera(&players[0], &camera, false); P_MapEnd(); + S_SetStackAdjustmentStart(); return; } } // Check for pause or menu up in single player if (paused || P_AutoPause()) + { + S_SetStackAdjustmentStart(); return; + } + + if (!S_MusicPaused()) + S_AdjustMusicStackTics(); postimgtype = postimgtype2 = postimg_none; diff --git a/src/p_user.c b/src/p_user.c index e14e922ac..63c7ee5ee 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -56,6 +56,29 @@ static void P_NukeAllPlayers(player_t *player); #endif +// +// Jingle stuff. +// + +jingle_t jingleinfo[NUMJINGLES] = { + // {musname, looping, reset, nest} + {"" , false}, // JT_NONE + {"" , false}, // JT_OTHER + {"" , false}, // JT_MASTER + {"_1up" , false}, + {"_shoes" , true}, + {"_inv" , false}, + {"_minv" , false}, + {"_drown" , false}, + {"_super" , true}, + {"_gover" , false}, + {"_ntime" , false}, // JT_NIGHTSTIMEOUT + {"_drown" , false} // JT_SSTIMEOUT + // {"_clear" , false}, + // {"_inter" , true}, + // {"_conti" , true} +}; + // // Movement. // @@ -696,7 +719,10 @@ static void P_DeNightserizePlayer(player_t *player) S_SetMusicPosition(0); } else + { + music_stack_fadein = 0; // HACK: Change fade-in for restore music P_RestoreMusic(player); + } P_RunDeNightserizeExecutors(player->mo); } @@ -753,7 +779,10 @@ void P_NightserizePlayer(player_t *player, INT32 nighttime) S_SetInternalMusicVolume(100); } else + { + music_stack_fadein = 0; // HACK: Change fade-in for restore music P_RestoreMusic(player); + } P_SetPlayerMobjState(player->mo, S_PLAY_NIGHTS_TRANS1); @@ -1219,10 +1248,7 @@ void P_DoSuperTransformation(player_t *player, boolean giverings) { player->powers[pw_super] = 1; if (!(mapheaderinfo[gamemap-1]->levelflags & LF_NOSSMUSIC) && P_IsLocalPlayer(player)) - { - S_StopMusic(); - S_ChangeMusicInternal("_super", true); - } + P_PlayJingle(player, JT_SUPER); S_StartSound(NULL, sfx_supert); //let all players hear it -mattw_cfi @@ -1388,14 +1414,115 @@ void P_PlayLivesJingle(player_t *player) else { if (player) - player->powers[pw_extralife] = extralifetics+1; - S_StopMusic(); // otherwise it won't restart if this is done twice in a row + player->powers[pw_extralife] = extralifetics + 1; strlcpy(S_sfx[sfx_None].caption, "One-up", 7); S_StartCaption(sfx_None, -1, extralifetics+1); - S_ChangeMusicInternal("_1up", false); + P_PlayJingle(player, JT_1UP); } } +void P_PlayJingle(player_t *player, jingletype_t jingletype) +{ + const char *musname = jingleinfo[jingletype].musname; + UINT16 musflags = 0; + boolean looping = jingleinfo[jingletype].looping; + + char newmusic[7]; + strncpy(newmusic, musname, 7); +#if defined(HAVE_BLUA) && defined(HAVE_LUA_MUSICPLUS) + if(LUAh_MusicJingle(jingletype, newmusic, &musflags, &looping)) + return; +#endif + newmusic[6] = 0; + + P_PlayJingleMusic(player, newmusic, musflags, looping, jingletype); +} + +// +// P_PlayJingleMusic +// +void P_PlayJingleMusic(player_t *player, const char *musname, UINT16 musflags, boolean looping, UINT16 status) +{ + // If gamestate != GS_LEVEL, always play the jingle (1-up intermission) + if (gamestate == GS_LEVEL && !P_IsLocalPlayer(player)) + return; + + S_RetainMusic(musname, musflags, looping, 0, status); + S_StopMusic(); + S_ChangeMusicInternal(musname, looping); +} + +boolean P_EvaluateMusicStatus(UINT16 status) +{ + // \todo lua hook + int i; + boolean result = false; + + for (i = 0; i < MAXPLAYERS; i++) + { + if (!P_IsLocalPlayer(&players[i])) + continue; + + switch(status) + { + case JT_1UP: // Extra life + result = (players[i].powers[pw_extralife] > 1); + break; + + case JT_SHOES: // Speed shoes + if (players[i].powers[pw_sneakers] > 1 && !players[i].powers[pw_super]) + { + //strlcpy(S_sfx[sfx_None].caption, "Speed shoes", 12); + //S_StartCaption(sfx_None, -1, players[i].powers[pw_sneakers]); + result = true; + } + else + result = false; + break; + + case JT_INV: // Invincibility + case JT_MINV: // Mario Invincibility + if (players[i].powers[pw_invulnerability] > 1) + { + //strlcpy(S_sfx[sfx_None].caption, "Invincibility", 14); + //S_StartCaption(sfx_None, -1, players[i].powers[pw_invulnerability]); + result = true; + } + else + result = false; + break; + + case JT_DROWN: // Drowning + result = (players[i].powers[pw_underwater] && players[i].powers[pw_underwater] <= 11*TICRATE + 1); + break; + + case JT_SUPER: // Super Sonic + result = (players[i].powers[pw_super] && !(mapheaderinfo[gamemap-1]->levelflags & LF_NOSSMUSIC)); + break; + + case JT_GOVER: // Game Over + result = (players[i].lives <= 0); + break; + + case JT_NIGHTSTIMEOUT: // NiGHTS Time Out (10 seconds) + case JT_SSTIMEOUT: + result = (players[i].nightstime && players[i].nightstime <= 10*TICRATE); + break; + + case JT_NONE: // Null state + case JT_OTHER: // Other state + case JT_MASTER: // Main level music + default: + result = true; + } + + if (result) + break; + } + + return result; + } + // // P_RestoreMusic // @@ -1406,17 +1533,30 @@ void P_RestoreMusic(player_t *player) if (!P_IsLocalPlayer(player)) // Only applies to a local player return; + S_SpeedMusic(1.0f); + + // Jingles have a priority in this order, so follow it + // and as a default case, go down the music stack. + + // Extra life if (player->powers[pw_extralife] > 1) return; - S_SpeedMusic(1.0f); - if (player->powers[pw_super] && !(mapheaderinfo[gamemap-1]->levelflags & LF_NOSSMUSIC)) - S_ChangeMusicInternal("_super", true); + + // Super + else if (player->powers[pw_super] && !(mapheaderinfo[gamemap-1]->levelflags & LF_NOSSMUSIC) + && !S_RecallMusic(JT_SUPER, false)) + P_PlayJingle(player, JT_SUPER); + + // Invulnerability else if (player->powers[pw_invulnerability] > 1) { strlcpy(S_sfx[sfx_None].caption, "Invincibility", 14); S_StartCaption(sfx_None, -1, player->powers[pw_invulnerability]); - S_ChangeMusicInternal((mariomode) ? "_minv" : "_inv", false); + if (!S_RecallMusic(JT_INV, false) && !S_RecallMusic(JT_MINV, false)) + P_PlayJingle(player, (mariomode) ? JT_MINV : JT_INV); } + + // Shoes else if (player->powers[pw_sneakers] > 1 && !player->powers[pw_super]) { strlcpy(S_sfx[sfx_None].caption, "Speed shoes", 12); @@ -1424,13 +1564,19 @@ void P_RestoreMusic(player_t *player) if (mapheaderinfo[gamemap-1]->levelflags & LF_SPEEDMUSIC) { S_SpeedMusic(1.4f); - S_ChangeMusicEx(mapmusname, mapmusflags, true, mapmusposition, 0, 0); + if (!S_RecallMusic(JT_MASTER, true)) + S_ChangeMusicEx(mapmusname, mapmusflags, true, mapmusposition, 0, 0); } - else - S_ChangeMusicInternal("_shoes", true); + else if (!S_RecallMusic(JT_SHOES, false)) + P_PlayJingle(player, JT_SHOES); } - else - S_ChangeMusicEx(mapmusname, mapmusflags, true, mapmusposition, 0, 0); + + // Default + else if (!S_RecallMusic(JT_NONE, false)) // go down the stack + { + CONS_Debug(DBG_BASIC, "Cannot find any music in resume stack!\n"); + S_ChangeMusicEx(mapmusname, mapmusflags, true, mapmusposition, 0, 0); + } } // @@ -1760,9 +1906,12 @@ void P_SwitchShield(player_t *player, UINT16 shieldtype) if (shieldtype & SH_PROTECTWATER) { if (player->powers[pw_underwater] && player->powers[pw_underwater] <= 12*TICRATE + 1) + { + player->powers[pw_underwater] = 0; P_RestoreMusic(player); - - player->powers[pw_underwater] = 0; + } + else + player->powers[pw_underwater] = 0; if (player->powers[pw_spacetime] > 1) { @@ -2603,10 +2752,6 @@ static void P_CheckQuicksand(player_t *player) // static void P_CheckSneakerAndLivesTimer(player_t *player) { - if ((player->powers[pw_underwater] <= 11*TICRATE + 1) - && (player->powers[pw_underwater] > 1)) - return; // don't restore music if drowning music is playing - if (player->powers[pw_extralife] == 1) // Extra Life! P_RestoreMusic(player); @@ -2674,16 +2819,16 @@ static void P_CheckUnderwaterAndSpaceTimer(player_t *player) if (!(player->mo->eflags & MFE_UNDERWATER) && player->powers[pw_underwater]) { if (player->powers[pw_underwater] <= 12*TICRATE + 1) + { + player->powers[pw_underwater] = 0; P_RestoreMusic(player); - - player->powers[pw_underwater] = 0; + } + else + player->powers[pw_underwater] = 0; } if (player->powers[pw_spacetime] > 1 && !P_InSpaceSector(player->mo)) - { - P_RestoreMusic(player); player->powers[pw_spacetime] = 0; - } // Underwater audio cues if (P_IsLocalPlayer(player) && !player->bot) @@ -2696,8 +2841,7 @@ static void P_CheckUnderwaterAndSpaceTimer(player_t *player) if (player->powers[pw_underwater] == 11*TICRATE + 1 && player == &players[consoleplayer]) { - S_StopMusic(); - S_ChangeMusicInternal("_drown", false); + P_PlayJingle(player, JT_DROWN); } } } @@ -2744,10 +2888,6 @@ static void P_CheckInvincibilityTimer(player_t *player) P_SpawnShieldOrb(player); } - if ((player->powers[pw_underwater] <= 11*TICRATE + 1) - && (player->powers[pw_underwater] > 1)) - return; // don't restore music if drowning music is playing - if (!player->powers[pw_super] || (mapheaderinfo[gamemap-1]->levelflags & LF_NOSSMUSIC)) P_RestoreMusic(player); } @@ -3961,6 +4101,8 @@ static void P_DoSuperStuff(player_t *player) { player->powers[pw_super] = 0; P_SetPlayerMobjState(player->mo, S_PLAY_STND); + music_stack_noposition = true; // HACK: Do not reposition next music + music_stack_fadeout = MUSICRATE/2; // HACK: Fade out current music P_RestoreMusic(player); P_SpawnShieldOrb(player); @@ -4042,6 +4184,8 @@ static void P_DoSuperStuff(player_t *player) } // Resume normal music if you're the console player + music_stack_noposition = true; // HACK: Do not reposition next music + music_stack_fadeout = MUSICRATE/2; // HACK: Fade out current music P_RestoreMusic(player); // If you had a shield, restore its visual significance. @@ -6610,7 +6754,7 @@ static void P_NiGHTSMovement(player_t *player) S_StartSound(NULL, sfx_timeup); // that creepy "out of time" music from NiGHTS. } else - S_ChangeMusicInternal((((maptol & TOL_NIGHTS) && !G_IsSpecialStage(gamemap)) ? "_ntime" : "_drown"), false); + P_PlayJingle(player, ((maptol & TOL_NIGHTS) && !G_IsSpecialStage(gamemap)) ? JT_NIGHTSTIMEOUT : JT_SSTIMEOUT); } if (player->mo->z < player->mo->floorz) @@ -10496,7 +10640,7 @@ void P_PlayerThink(player_t *player) // If 11 seconds are left on the timer, // begin the drown music for countdown! if (countdown == 11*TICRATE - 1 && P_IsLocalPlayer(player)) - S_ChangeMusicInternal("_drown", false); + P_PlayJingle(player, JT_DROWN); // If you've hit the countdown and you haven't made // it to the exit, you're a goner! @@ -10985,9 +11129,12 @@ void P_PlayerThink(player_t *player) if (player->powers[pw_underwater] && (player->pflags & PF_GODMODE || (player->powers[pw_shield] & SH_PROTECTWATER))) { if (player->powers[pw_underwater] <= 12*TICRATE+1) + { + player->powers[pw_underwater] = 0; P_RestoreMusic(player); //incase they were about to drown - - player->powers[pw_underwater] = 0; + } + else + player->powers[pw_underwater] = 0; } else if (player->powers[pw_underwater] && !(maptol & TOL_NIGHTS) && !((netgame || multiplayer) && player->spectator)) // underwater timer player->powers[pw_underwater]--; diff --git a/src/s_sound.c b/src/s_sound.c index 61f93766c..2c6faf041 100644 --- a/src/s_sound.c +++ b/src/s_sound.c @@ -62,6 +62,8 @@ static void GameDigiMusic_OnChange(void); static void ModFilter_OnChange(void); +static lumpnum_t S_GetMusicLumpNum(const char *mname); + // commands for music and sound servers #ifdef MUSSERV consvar_t musserver_cmd = {"musserver_cmd", "musserver", CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL}; @@ -106,7 +108,7 @@ consvar_t cv_closedcaptioning = {"closedcaptioning", "Off", CV_SAVE|CV_CALL, CV_ consvar_t cv_numChannels = {"snd_channels", "32", CV_SAVE|CV_CALL, CV_Unsigned, SetChannelsNum, 0, NULL, NULL, 0, 0, NULL}; static consvar_t surround = {"surround", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_resetmusic = {"resetmusic", "No", CV_SAVE, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_resetmusic = {"resetmusic", "Yes", CV_SAVE, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL}; // Sound system toggles, saved into the config consvar_t cv_gamedigimusic = {"digimusic", "On", CV_SAVE|CV_CALL|CV_NOINIT, CV_OnOff, GameDigiMusic_OnChange, 0, NULL, NULL, 0, 0, NULL}; @@ -279,6 +281,11 @@ void S_RegisterSoundStuff(void) #ifdef HAVE_OPENMPT CV_RegisterVar(&cv_modfilter); #endif +#ifdef HAVE_MIXERX + CV_RegisterVar(&cv_midiplayer); + CV_RegisterVar(&cv_midisoundfontpath); + CV_RegisterVar(&cv_miditimiditypath); +#endif COM_AddCommand("tunes", Command_Tunes_f); COM_AddCommand("restartaudio", Command_RestartAudio_f); @@ -1363,21 +1370,21 @@ void S_InitSfxChannels(INT32 sfxVolume) #ifdef MUSICSLOT_COMPATIBILITY const char *compat_special_music_slots[16] = { - "titles", // 1036 title screen - "read_m", // 1037 intro - "lclear", // 1038 level clear - "invinc", // 1039 invincibility - "shoes", // 1040 super sneakers - "minvnc", // 1041 Mario invincibility - "drown", // 1042 drowning - "gmover", // 1043 game over - "xtlife", // 1044 extra life - "contsc", // 1045 continue screen - "supers", // 1046 Super Sonic - "chrsel", // 1047 character select - "credit", // 1048 credits - "racent", // 1049 Race Results - "stjr", // 1050 Sonic Team Jr. Presents + "_title", // 1036 title screen + "_intro", // 1037 intro + "_clear", // 1038 level clear + "_inv", // 1039 invincibility + "_shoes", // 1040 super sneakers + "_minv", // 1041 Mario invincibility + "_drown", // 1042 drowning + "_gover", // 1043 game over + "_1up", // 1044 extra life + "_conti", // 1045 continue screen + "_super", // 1046 Super Sonic + "_chsel", // 1047 character select + "_creds", // 1048 credits + "_inter", // 1049 Race Results + "_stjr", // 1050 Sonic Team Jr. Presents "" }; #endif @@ -1393,6 +1400,8 @@ static boolean queue_looping; static UINT32 queue_position; static UINT32 queue_fadeinms; +static tic_t pause_starttic; + /// ------------------------ /// Music Status /// ------------------------ @@ -1491,10 +1500,304 @@ UINT32 S_GetMusicPosition(void) return I_GetSongPosition(); } +/// ------------------------ +/// Music Stacking (Jingles) +/// In this section: mazmazz doesn't know how to do dynamic arrays or struct pointers! +/// ------------------------ + +static musicstack_t *music_stacks = NULL; +static musicstack_t *last_music_stack = NULL; + +void S_SetStackAdjustmentStart(void) +{ + if (!pause_starttic) + pause_starttic = gametic; +} + +void S_AdjustMusicStackTics(void) +{ + if (pause_starttic) + { + musicstack_t *mst; + for (mst = music_stacks; mst; mst = mst->next) + mst->tic += gametic - pause_starttic; + pause_starttic = 0; + } +} + +static void S_ResetMusicStack(void) +{ + musicstack_t *mst, *mst_next; + for (mst = music_stacks; mst; mst = mst_next) + { + mst_next = mst->next; + Z_Free(mst); + } + music_stacks = last_music_stack = NULL; +} + +static void S_RemoveMusicStackEntry(musicstack_t *entry) +{ + musicstack_t *mst; + for (mst = music_stacks; mst; mst = mst->next) + { + if (mst == entry) + { + // Remove ourselves from the chain and link + // prev and next together + + if (mst->prev) + mst->prev->next = mst->next; + else + music_stacks = mst->next; + + if (mst->next) + mst->next->prev = mst->prev; + else + last_music_stack = mst->prev; + + break; + } + } + Z_Free(entry); +} + +static void S_RemoveMusicStackEntryByStatus(UINT16 status) +{ + musicstack_t *mst, *mst_next; + + if (!status) + return; + + for (mst = music_stacks; mst; mst = mst_next) + { + mst_next = mst->next; + if (mst->status == status) + S_RemoveMusicStackEntry(mst); + } +} + +static void S_AddMusicStackEntry(const char *mname, UINT16 mflags, boolean looping, UINT32 position, UINT16 status) +{ + musicstack_t *mst, *new_mst; + + // if the first entry is empty, force master onto it + if (!music_stacks) + { + music_stacks = Z_Calloc(sizeof (*mst), PU_MUSIC, NULL); + strncpy(music_stacks->musname, (status == JT_MASTER ? mname : mapmusname), 7); + music_stacks->musflags = (status == JT_MASTER ? mflags : mapmusflags); + music_stacks->looping = (status == JT_MASTER ? looping : true); + music_stacks->position = (status == JT_MASTER ? position : S_GetMusicPosition()); + music_stacks->tic = gametic; + music_stacks->status = JT_MASTER; + music_stacks->mlumpnum = S_GetMusicLumpNum(music_stacks->musname); + + if (status == JT_MASTER) + return; // we just added the user's entry here + } + + // look for an empty slot to park ourselves + for (mst = music_stacks; mst->next; mst = mst->next); + + // create our new entry + new_mst = Z_Calloc(sizeof (*new_mst), PU_MUSIC, NULL); + strncpy(new_mst->musname, mname, 7); + new_mst->musname[6] = 0; + new_mst->musflags = mflags; + new_mst->looping = looping; + new_mst->position = position; + new_mst->tic = gametic; + new_mst->status = status; + new_mst->mlumpnum = S_GetMusicLumpNum(new_mst->musname); + + mst->next = new_mst; + new_mst->prev = mst; + new_mst->next = NULL; + last_music_stack = new_mst; +} + +static musicstack_t *S_GetMusicStackEntry(UINT16 status, boolean fromfirst, INT16 startindex) +{ + musicstack_t *mst, *start_mst = NULL, *mst_next; + + // if the first entry is empty, force master onto it + // fixes a memory corruption bug + if (!music_stacks && status != JT_MASTER) + S_AddMusicStackEntry(mapmusname, mapmusflags, true, S_GetMusicPosition(), JT_MASTER); + + if (startindex >= 0) + { + INT16 i = 0; + for (mst = music_stacks; mst && i <= startindex; mst = mst->next, i++) + start_mst = mst; + } + else + start_mst = (fromfirst ? music_stacks : last_music_stack); + + for (mst = start_mst; mst; mst = mst_next) + { + mst_next = (fromfirst ? mst->next : mst->prev); + + if (!status || mst->status == status) + { + if (P_EvaluateMusicStatus(mst->status)) + { + if (!S_MusicExists(mst->musname, !midi_disabled, !digital_disabled)) // paranoia + S_RemoveMusicStackEntry(mst); // then continue + else + return mst; + } + else + S_RemoveMusicStackEntry(mst); // then continue + } + } + + return NULL; +} + +void S_RetainMusic(const char *mname, UINT16 mflags, boolean looping, UINT32 position, UINT16 status) +{ + musicstack_t *mst; + + if (!status) // we use this as a null indicator, don't push + { + CONS_Alert(CONS_ERROR, "Music stack entry must have a nonzero status.\n"); + return; + } + else if (status == JT_MASTER) // enforce only one JT_MASTER + { + for (mst = music_stacks; mst; mst = mst->next) + { + if (mst->status == JT_MASTER) + { + CONS_Alert(CONS_ERROR, "Music stack can only have one JT_MASTER entry.\n"); + return; + } + } + } + else // remove any existing status + S_RemoveMusicStackEntryByStatus(status); + + S_AddMusicStackEntry(mname, mflags, looping, position, status); +} + +boolean S_RecallMusic(UINT16 status, boolean fromfirst) +{ + UINT32 newpos = 0; + boolean mapmuschanged = false; + musicstack_t *result; + musicstack_t *entry = Z_Calloc(sizeof (*result), PU_MUSIC, NULL); + + if (status) + result = S_GetMusicStackEntry(status, fromfirst, -1); + else + result = S_GetMusicStackEntry(JT_NONE, false, -1); + + if (result && !S_MusicExists(result->musname, !midi_disabled, !digital_disabled)) + { + Z_Free(entry); + return false; // music doesn't exist, so don't do anything + } + + // make a copy of result, since we make modifications to our copy + if (result) + { + *entry = *result; + strncpy(entry->musname, result->musname, 7); + } + + // no result, just grab mapmusname + if (!result || !entry->musname[0] || ((status == JT_MASTER || (music_stacks ? !music_stacks->status : false)) && !entry->status)) + { + strncpy(entry->musname, mapmusname, 7); + entry->musflags = mapmusflags; + entry->looping = true; + entry->position = mapmusposition; + entry->tic = gametic; + entry->status = JT_MASTER; + entry->mlumpnum = S_GetMusicLumpNum(entry->musname); + } + + if (entry->status == JT_MASTER) + { + mapmuschanged = strnicmp(entry->musname, mapmusname, 7); + S_ResetMusicStack(); + } + else if (!entry->status) + { + Z_Free(entry); + return false; + } + + if (!mapmuschanged && strncmp(entry->musname, S_MusicName(), 7)) // don't restart music if we're already playing it + { + if (music_stack_fadeout) + S_ChangeMusicEx(entry->musname, entry->musflags, entry->looping, 0, music_stack_fadeout, 0); + else + { + S_ChangeMusicEx(entry->musname, entry->musflags, entry->looping, 0, 0, music_stack_fadein); + + if (!music_stack_noposition) // HACK: Global boolean to toggle position resuming, e.g., de-superize + { + UINT32 poslapse = 0; + + // To prevent the game from jumping past the end of the music, we need + // to check if we can get the song's length. Otherwise, if the lapsed resume time goes + // over a LOOPPOINT, mixer_sound.c will be unable to calculate the new resume position. + if (S_GetMusicLength()) + poslapse = (UINT32)((float)(gametic - entry->tic)/(float)TICRATE*(float)MUSICRATE); + + newpos = entry->position + poslapse; + } + + // If the newly recalled music lumpnum does not match the lumpnum that we stored in stack, + // then discard the new position. That way, we will not recall an invalid position + // when the music is replaced or digital/MIDI is toggled. + if (newpos > 0 && S_MusicPlaying() && S_GetMusicLumpNum(entry->musname) == entry->mlumpnum) + S_SetMusicPosition(newpos); + else + { + S_StopFadingMusic(); + S_SetInternalMusicVolume(100); + } + } + music_stack_noposition = false; + music_stack_fadeout = 0; + music_stack_fadein = JINGLEPOSTFADE; + } + + Z_Free(entry); + return true; +} + /// ------------------------ /// Music Playback /// ------------------------ +static lumpnum_t S_GetMusicLumpNum(const char *mname) +{ + if (!S_DigMusicDisabled() && S_DigExists(mname)) + return W_GetNumForName(va("o_%s", mname)); + else if (!S_MIDIMusicDisabled() && S_MIDIExists(mname)) + return W_GetNumForName(va("d_%s", mname)); + else if (S_DigMusicDisabled() && S_DigExists(mname)) + { + CONS_Alert(CONS_NOTICE, "Digital music is disabled!\n"); + return LUMPERROR; + } + else if (S_MIDIMusicDisabled() && S_MIDIExists(mname)) + { + CONS_Alert(CONS_NOTICE, "MIDI music is disabled!\n"); + return LUMPERROR; + } + else + { + CONS_Alert(CONS_ERROR, M_GetText("Music lump %.6s not found!\n"), mname); + return LUMPERROR; + } +} + static boolean S_LoadMusic(const char *mname) { lumpnum_t mlumpnum; @@ -1503,25 +1806,10 @@ static boolean S_LoadMusic(const char *mname) if (S_MusicDisabled()) return false; - if (!S_DigMusicDisabled() && S_DigExists(mname)) - mlumpnum = W_GetNumForName(va("o_%s", mname)); - else if (!S_MIDIMusicDisabled() && S_MIDIExists(mname)) - mlumpnum = W_GetNumForName(va("d_%s", mname)); - else if (S_DigMusicDisabled() && S_DigExists(mname)) - { - CONS_Alert(CONS_NOTICE, "Digital music is disabled!\n"); + mlumpnum = S_GetMusicLumpNum(mname); + + if (mlumpnum == LUMPERROR) return false; - } - else if (S_MIDIMusicDisabled() && S_MIDIExists(mname)) - { - CONS_Alert(CONS_NOTICE, "MIDI music is disabled!\n"); - return false; - } - else - { - CONS_Alert(CONS_ERROR, M_GetText("Music lump %.6s not found!\n"), mname); - return false; - } // load & register it mdata = W_CacheLumpNum(mlumpnum, PU_MUSIC); @@ -1623,7 +1911,8 @@ void S_ChangeMusicEx(const char *mmusic, UINT16 mflags, boolean looping, UINT32 return; } - if (prefadems && S_MusicPlaying()) // queue music change for after fade // allow even if the music is the same + if (prefadems) // queue music change for after fade // allow even if the music is the same + // && S_MusicPlaying() // Let the delay happen even if we're not playing music { CONS_Debug(DBG_DETAILED, "Now fading out song %s\n", music_name); S_QueueMusic(newmusic, mflags, looping, position, fadeinms); @@ -1711,6 +2000,8 @@ void S_PauseAudio(void) #else I_StopCD(); #endif + + S_SetStackAdjustmentStart(); } void S_ResumeAudio(void) @@ -1720,6 +2011,8 @@ void S_ResumeAudio(void) // resume cd music I_ResumeCD(); + + S_AdjustMusicStackTics(); } void S_SetMusicVolume(INT32 digvolume, INT32 seqvolume) @@ -1746,6 +2039,7 @@ void S_SetMusicVolume(INT32 digvolume, INT32 seqvolume) switch(I_SongType()) { case MU_MID: + case MU_MID_EX: //case MU_MOD: //case MU_GME: I_SetMusicVolume(seqvolume&31); @@ -1792,7 +2086,7 @@ boolean S_FadeOutStopMusic(UINT32 ms) // Kills playing sounds at start of level, // determines music if any, changes music. // -void S_Start(void) +void S_StartEx(boolean reset) { if (mapmusflags & MUSIC_RELOADRESET) { @@ -1802,9 +2096,14 @@ void S_Start(void) mapmusposition = mapheaderinfo[gamemap-1]->muspos; } - if (cv_resetmusic.value) + if (cv_resetmusic.value || reset) S_StopMusic(); S_ChangeMusicEx(mapmusname, mapmusflags, true, mapmusposition, 0, 0); + + S_ResetMusicStack(); + music_stack_noposition = false; + music_stack_fadeout = 0; + music_stack_fadein = JINGLEPOSTFADE; } static void Command_Tunes_f(void) diff --git a/src/s_sound.h b/src/s_sound.h index c17a4cf48..e0737eff7 100644 --- a/src/s_sound.h +++ b/src/s_sound.h @@ -40,6 +40,12 @@ extern consvar_t cv_gamesounds; extern consvar_t cv_modfilter; #endif +#ifdef HAVE_MIXERX +extern consvar_t cv_midiplayer; +extern consvar_t cv_midisoundfontpath; +extern consvar_t cv_miditimiditypath; +#endif + #ifdef SNDSERV extern consvar_t sndserver_cmd, sndserver_arg; #endif @@ -121,7 +127,8 @@ void S_InitSfxChannels(INT32 sfxVolume); // void S_StopSounds(void); void S_ClearSfx(void); -void S_Start(void); +void S_StartEx(boolean reset); +#define S_Start() S_StartEx(false) // // Basically a W_GetNumForName that adds "ds" at the beginning of the string. Returns a lumpnum. @@ -181,6 +188,34 @@ boolean S_SetMusicPosition(UINT32 position); // Get Position of Music UINT32 S_GetMusicPosition(void); +// +// Music Stacking (Jingles) +// + +typedef struct musicstack_s +{ + char musname[7]; + UINT16 musflags; + boolean looping; + UINT32 position; + tic_t tic; + UINT16 status; + lumpnum_t mlumpnum; + + struct musicstack_s *prev; + struct musicstack_s *next; +} musicstack_t; + +char music_stack_nextmusname[7]; +boolean music_stack_noposition; +UINT32 music_stack_fadeout; +UINT32 music_stack_fadein; + +void S_SetStackAdjustmentStart(void); +void S_AdjustMusicStackTics(void); +void S_RetainMusic(const char *mname, UINT16 mflags, boolean looping, UINT32 position, UINT16 status); +boolean S_RecallMusic(UINT16 status, boolean fromfirst); + // // Music Playback // diff --git a/src/sdl/Makefile.cfg b/src/sdl/Makefile.cfg index 58c4d0861..05b60f7a3 100644 --- a/src/sdl/Makefile.cfg +++ b/src/sdl/Makefile.cfg @@ -80,8 +80,13 @@ ifdef NOMIXER else i_sound_o=$(OBJDIR)/mixer_sound.o OPTS+=-DHAVE_MIXER +ifdef HAVE_MIXERX + OPTS+=-DHAVE_MIXERX + SDL_LDFLAGS+=-lSDL2_mixer_ext +else SDL_LDFLAGS+=-lSDL2_mixer endif +endif ifdef SDL_TTF OPTS+=-DHAVE_TTF diff --git a/src/sdl/i_video.c b/src/sdl/i_video.c index b4f1a2a9d..5a4fd7a02 100644 --- a/src/sdl/i_video.c +++ b/src/sdl/i_video.c @@ -64,7 +64,6 @@ #include "../m_menu.h" #include "../d_main.h" #include "../s_sound.h" -#include "../i_sound.h" // midi pause/unpause #include "../i_joy.h" #include "../st_stuff.h" #include "../g_game.h" @@ -573,7 +572,7 @@ static void Impl_HandleWindowEvent(SDL_WindowEvent evt) // Tell game we got focus back, resume music if necessary window_notinfocus = false; if (!paused) - I_ResumeSong(); //resume it + S_ResumeAudio(); //resume it if (!firsttimeonmouse) { @@ -585,7 +584,7 @@ static void Impl_HandleWindowEvent(SDL_WindowEvent evt) { // Tell game we lost focus, pause music window_notinfocus = true; - I_PauseSong(); + S_PauseAudio(); if (!disable_mouse) { diff --git a/src/sdl/mixer_sound.c b/src/sdl/mixer_sound.c index 7bf67559c..ff2b029a5 100644 --- a/src/sdl/mixer_sound.c +++ b/src/sdl/mixer_sound.c @@ -10,6 +10,7 @@ /// \brief SDL Mixer interface for sound #include "../doomdef.h" +#include "../doomstat.h" // menuactive #if defined(HAVE_SDL) && defined(HAVE_MIXER) && SOUND==SOUND_MIXER @@ -28,7 +29,11 @@ #pragma warning(default : 4214 4244) #endif +#ifdef HAVE_MIXERX +#include "SDL_mixer_ext.h" +#else #include "SDL_mixer.h" +#endif /* This is the version number macro for the current SDL_mixer version: */ #ifndef SDL_MIXER_COMPILEDVERSION @@ -101,6 +106,7 @@ static UINT32 fading_timer; static UINT32 fading_duration; static INT32 fading_id; static void (*fading_callback)(void); +static boolean fading_nocleanup; #ifdef HAVE_LIBGME static Music_Emu *gme; @@ -115,6 +121,80 @@ static size_t probesize; static int result; #endif +#ifdef HAVE_MIXERX +static void Midiplayer_Onchange(void) +{ + boolean restart = false; + + if (I_SongType() != MU_NONE && I_SongType() != MU_MID_EX && I_SongType() != MU_MID) + return; + + if (Mix_GetMidiPlayer() != cv_midiplayer.value) + { + if (Mix_SetMidiPlayer(cv_midiplayer.value)) // <> 0 means error + CONS_Alert(CONS_ERROR, "Midi player error: %s", Mix_GetError()); + else + restart = true; + } + + if (stricmp(Mix_GetSoundFonts(), cv_midisoundfontpath.string)) + { + if (!Mix_SetSoundFonts(cv_midisoundfontpath.string)) // == 0 means error + CONS_Alert(CONS_ERROR, "Sound font error: %s", Mix_GetError()); + else + restart = true; + } + + Mix_Timidity_addToPathList(cv_miditimiditypath.string); + + if (restart) + S_StartEx(true); +} + +static void MidiSoundfontPath_Onchange(void) +{ + if (Mix_GetMidiPlayer() != MIDI_Fluidsynth || (I_SongType() != MU_NONE && I_SongType() != MU_MID_EX)) + return; + + if (stricmp(Mix_GetSoundFonts(), cv_midisoundfontpath.string)) + { + char *token; + char *source = strdup(cv_midisoundfontpath.string); + boolean proceed = true; + // check if file exists; menu calls this method at every keystroke + + while ((token = strtok_r(source, ";", &source))) + { + SDL_RWops *rw = SDL_RWFromFile(token, "r"); + if (rw != NULL) + SDL_RWclose(rw); + else + { + proceed = false; + break; + } + } + + free(source); + + if (proceed) + { + if (!Mix_SetSoundFonts(cv_midisoundfontpath.string)) + CONS_Alert(CONS_ERROR, "Sound font error: %s", Mix_GetError()); + else + S_StartEx(true); + } + } +} + +// make sure that s_sound.c does not already verify these +// which happens when: defined(HAVE_MIXERX) && !defined(HAVE_MIXER) +static CV_PossibleValue_t midiplayer_cons_t[] = {{MIDI_OPNMIDI, "OPNMIDI"}, {MIDI_Fluidsynth, "Fluidsynth"}, {MIDI_Timidity, "Timidity"}, {MIDI_Native, "Native"}, {0, NULL}}; +consvar_t cv_midiplayer = {"midiplayer", "OPNMIDI" /*MIDI_OPNMIDI*/, CV_CALL|CV_NOINIT|CV_SAVE, midiplayer_cons_t, Midiplayer_Onchange, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_midisoundfontpath = {"midisoundfont", "sf2/8bitsf.SF2", CV_CALL|CV_NOINIT|CV_SAVE, NULL, MidiSoundfontPath_Onchange, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_miditimiditypath = {"midisoundbank", "./timidity", CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL}; +#endif + static void var_cleanup(void) { song_length = loop_point = 0.0f; @@ -124,18 +204,24 @@ static void var_cleanup(void) songpaused = is_looping =\ is_fading = false; - fading_callback = NULL; + // HACK: See music_loop, where we want the fade timing to proceed after a non-looping + // song has stopped playing + if (!fading_nocleanup) + fading_callback = NULL; + else + fading_nocleanup = false; // use it once, set it back immediately internal_volume = 100; } - /// ------------------------ /// Audio System /// ------------------------ void I_StartupSound(void) { - I_Assert(!sound_started); + //I_Assert(!sound_started); + if (sound_started) + return; #ifdef _WIN32 // Force DirectSound instead of WASAPI @@ -156,11 +242,18 @@ void I_StartupSound(void) return; } + fading_nocleanup = false; + var_cleanup(); music = NULL; music_volume = sfx_volume = 0; +#ifdef HAVE_MIXERX + Mix_SetMidiPlayer(cv_midiplayer.value); + Mix_SetSoundFonts(cv_midisoundfontpath.string); + Mix_Timidity_addToPathList(cv_miditimiditypath.string); +#endif #if SDL_MIXER_VERSION_ATLEAST(1,2,11) Mix_Init(MIX_INIT_FLAC|MIX_INIT_MP3|MIX_INIT_OGG|MIX_INIT_MOD); #endif @@ -600,7 +693,15 @@ static void music_loop(void) music_bytes = (UINT32)(loop_point*44100.0L*4); //assume 44.1khz, 4-byte length (see I_GetSongPosition) } else + { + // HACK: Let fade timing proceed beyond the end of a + // non-looping song. This is a specific case where the timing + // should persist after stopping a song, so I don't believe + // this should apply every time the user stops a song. + // This is auto-unset in var_cleanup, called by I_StopSong + fading_nocleanup = true; I_StopSong(); + } } static UINT32 music_fade(UINT32 interval, void *param) @@ -718,7 +819,14 @@ musictype_t I_SongType(void) if (!music) return MU_NONE; else if (Mix_GetMusicType(music) == MUS_MID) + { +#ifdef HAVE_MIXERX + if (Mix_GetMidiPlayer() != MIDI_Native) + return MU_MID_EX; + else +#endif return MU_MID; + } else if (Mix_GetMusicType(music) == MUS_MOD || Mix_GetMusicType(music) == MUS_MODPLUG) return MU_MOD; else if (Mix_GetMusicType(music) == MUS_MP3 || Mix_GetMusicType(music) == MUS_MP3_MAD) @@ -824,6 +932,11 @@ UINT32 I_GetSongLength(void) return 0; else { +#ifdef HAVE_MIXERX + double xlength = Mix_GetMusicTotalTime(music); + if (xlength >= 0) + return (UINT32)(xlength*1000); +#endif // VERY IMPORTANT to set your LENGTHMS= in your song files, folks! // SDL mixer can't read music length itself. length = (UINT32)(song_length*1000); @@ -983,10 +1096,17 @@ UINT32 I_GetSongPosition(void) if (!music || I_SongType() == MU_MID) return 0; else + { +#ifdef HAVE_MIXERX + double xposition = Mix_GetMusicPosition(music); + if (xposition >= 0) + return (UINT32)(xposition*1000); +#endif return (UINT32)(music_bytes/44100.0L*1000.0L/4); //assume 44.1khz // 4 = byte length for 16-bit samples (AUDIO_S16SYS), stereo (2-channel) // This is hardcoded in I_StartupSound. Other formats for factor: // 8M: 1 | 8S: 2 | 16M: 2 | 16S: 4 + } } /// ------------------------ @@ -1001,7 +1121,6 @@ boolean I_LoadSong(char *data, size_t len) const size_t key1len = strlen(key1); const size_t key2len = strlen(key2); const size_t key3len = strlen(key3); - char *p = data; SDL_RWops *rw; @@ -1114,6 +1233,14 @@ boolean I_LoadSong(char *data, size_t len) } #endif +#ifdef HAVE_MIXERX + if (Mix_GetMidiPlayer() != cv_midiplayer.value) + Mix_SetMidiPlayer(cv_midiplayer.value); + if (stricmp(Mix_GetSoundFonts(), cv_midisoundfontpath.string)) + Mix_SetSoundFonts(cv_midisoundfontpath.string); + Mix_Timidity_addToPathList(cv_miditimiditypath.string); // this overwrites previous custom path +#endif + #ifdef HAVE_OPENMPT /* If the size of the data to be checked is bigger than the recommended size (> 2048) @@ -1145,7 +1272,6 @@ boolean I_LoadSong(char *data, size_t len) // Let's see if Mixer is able to load this. rw = SDL_RWFromMem(data, len); - if (rw != NULL) { music = Mix_LoadMUS_RW(rw, 1); } @@ -1250,7 +1376,7 @@ boolean I_PlaySong(boolean looping) CONS_Alert(CONS_ERROR, "Mix_PlayMusic: %s\n", Mix_GetError()); return false; } - else if ((I_SongType() == MU_MOD || I_SongType() == MU_MID) && Mix_PlayMusic(music, looping ? -1 : 0) == -1) // if MOD, loop forever + else if ((I_SongType() == MU_MOD || I_SongType() == MU_MID || I_SongType() == MU_MID_EX) && Mix_PlayMusic(music, looping ? -1 : 0) == -1) // if MOD, loop forever { CONS_Alert(CONS_ERROR, "Mix_PlayMusic: %s\n", Mix_GetError()); return false; @@ -1260,10 +1386,10 @@ boolean I_PlaySong(boolean looping) I_SetMusicVolume(music_volume); - if (I_SongType() != MU_MOD && I_SongType() != MU_MID) + if (I_SongType() != MU_MOD && I_SongType() != MU_MID && I_SongType() != MU_MID_EX) Mix_HookMusicFinished(music_loop); // don't bother counting if MOD - if(I_SongType() != MU_MOD && I_SongType() != MU_MID && !Mix_RegisterEffect(MIX_CHANNEL_POST, count_music_bytes, NULL, NULL)) + if(I_SongType() != MU_MOD && I_SongType() != MU_MID && I_SongType() != MU_MID_EX && !Mix_RegisterEffect(MIX_CHANNEL_POST, count_music_bytes, NULL, NULL)) CONS_Alert(CONS_WARNING, "Error registering SDL music position counter: %s\n", Mix_GetError()); return true; @@ -1271,7 +1397,10 @@ boolean I_PlaySong(boolean looping) void I_StopSong(void) { - I_StopFadingSong(); + // HACK: See music_loop on why we want fade timing to proceed + // after end of song + if (!fading_nocleanup) + I_StopFadingSong(); #ifdef HAVE_LIBGME if (gme) @@ -1388,6 +1517,8 @@ boolean I_SetSongTrack(int track) return false; } #endif + if (I_SongType() == MU_MOD) + return !Mix_SetMusicPosition(track); (void)track; return false; } @@ -1410,6 +1541,8 @@ void I_StopFadingSong(void) SDL_RemoveTimer(fading_id); is_fading = false; fading_source = fading_target = fading_timer = fading_duration = fading_id = 0; + // don't unset fading_nocleanup here just yet; fading_callback is cleaned up + // in var_cleanup() } boolean I_FadeSongFromVolume(UINT8 target_volume, UINT8 source_volume, UINT32 ms, void (*callback)(void)) diff --git a/src/sdl/sdl_sound.c b/src/sdl/sdl_sound.c index d9967ae03..a371c4d37 100644 --- a/src/sdl/sdl_sound.c +++ b/src/sdl/sdl_sound.c @@ -32,7 +32,7 @@ #endif #ifdef HAVE_MIXER -#include "SDL_mixer.h" +#include /* This is the version number macro for the current SDL_mixer version: */ #ifndef SDL_MIXER_COMPILEDVERSION #define SDL_MIXER_COMPILEDVERSION \ @@ -1386,8 +1386,8 @@ UINT32 I_GetSongLength(void) boolean I_SetSongLoopPoint(UINT32 looppoint) { - (void)looppoint; - return false; + (void)looppoint; + return false; } UINT32 I_GetSongLoopPoint(void) diff --git a/src/win32/Makefile.cfg b/src/win32/Makefile.cfg index 11f3c9140..a57920932 100644 --- a/src/win32/Makefile.cfg +++ b/src/win32/Makefile.cfg @@ -10,27 +10,35 @@ ifdef MINGW64 HAVE_LIBGME=1 LIBGME_CFLAGS=-I../libs/gme/include LIBGME_LDFLAGS=-L../libs/gme/win64 -lgme - ifdef HAVE_OPENMPT LIBOPENMPT_CFLAGS?=-I../libs/libopenmpt/inc LIBOPENMPT_LDFLAGS?=-L../libs/libopenmpt/lib/x86_64/mingw -lopenmpt endif - +ifndef NOMIXERX + HAVE_MIXERX=1 + SDL_CFLAGS?=-I../libs/SDL2/x86_64-w64-mingw32/include/SDL2 -I../libs/SDLMixerX/x86_64-w64-mingw32/include/SDL2 -Dmain=SDL_main + SDL_LDFLAGS?=-L../libs/SDL2/x86_64-w64-mingw32/lib -L../libs/SDLMixerX/x86_64-w64-mingw32/lib -lmingw32 -lSDL2main -lSDL2 -mwindows +else SDL_CFLAGS?=-I../libs/SDL2/x86_64-w64-mingw32/include/SDL2 -I../libs/SDL2_mixer/x86_64-w64-mingw32/include/SDL2 -Dmain=SDL_main SDL_LDFLAGS?=-L../libs/SDL2/x86_64-w64-mingw32/lib -L../libs/SDL2_mixer/x86_64-w64-mingw32/lib -lmingw32 -lSDL2main -lSDL2 -mwindows +endif else HAVE_LIBGME=1 LIBGME_CFLAGS=-I../libs/gme/include LIBGME_LDFLAGS=-L../libs/gme/win32 -lgme - ifdef HAVE_OPENMPT LIBOPENMPT_CFLAGS?=-I../libs/libopenmpt/inc LIBOPENMPT_LDFLAGS?=-L../libs/libopenmpt/lib/x86/mingw -lopenmpt endif - +ifndef NOMIXERX + HAVE_MIXERX=1 + SDL_CFLAGS?=-I../libs/SDL2/i686-w64-mingw32/include/SDL2 -I../libs/SDLMixerX/i686-w64-mingw32/include/SDL2 -Dmain=SDL_main + SDL_LDFLAGS?=-L../libs/SDL2/i686-w64-mingw32/lib -L../libs/SDLMixerX/i686-w64-mingw32/lib -lmingw32 -lSDL2main -lSDL2 -mwindows +else SDL_CFLAGS?=-I../libs/SDL2/i686-w64-mingw32/include/SDL2 -I../libs/SDL2_mixer/i686-w64-mingw32/include/SDL2 -Dmain=SDL_main SDL_LDFLAGS?=-L../libs/SDL2/i686-w64-mingw32/lib -L../libs/SDL2_mixer/i686-w64-mingw32/lib -lmingw32 -lSDL2main -lSDL2 -mwindows endif +endif ifndef NOASM USEASM=1 diff --git a/src/win32/win_main.c b/src/win32/win_main.c index bfe620a43..8a29f7e18 100644 --- a/src/win32/win_main.c +++ b/src/win32/win_main.c @@ -42,7 +42,7 @@ #include "fabdxlib.h" #include "win_main.h" #include "win_dbg.h" -#include "../i_sound.h" // midi pause/unpause +#include "../s_sound.h" // pause sound with handling #include "../g_input.h" // KEY_MOUSEWHEELxxx #include "../screen.h" // for BASEVID* @@ -110,9 +110,9 @@ static LRESULT CALLBACK MainWndproc(HWND hWnd, UINT message, WPARAM wParam, LPAR // pause music when alt-tab if (appActive && !paused) - I_ResumeSong(); + S_ResumeAudio(); else if (!paused) - I_PauseSong(); + S_PauseAudio(); { HANDLE ci = GetStdHandle(STD_INPUT_HANDLE); DWORD mode; diff --git a/src/win32/win_snd.c b/src/win32/win_snd.c index f3e3bbed4..13f766728 100644 --- a/src/win32/win_snd.c +++ b/src/win32/win_snd.c @@ -842,6 +842,7 @@ boolean I_SetSongPosition(UINT32 position) // Dummy out; this works for some MIDI, but not others. // SDL does not support this for any MIDI. return false; + e = FMOD_Channel_SetPosition(music_channel, position, FMOD_TIMEUNIT_MS); if (e == FMOD_OK) return true;