diff --git a/CMakeLists.txt b/CMakeLists.txt index a1bc0a2d1..e20ad93ff 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -388,6 +388,7 @@ set( OPN_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/libraries/opnmidi" ) set( TIMIDITYPP_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/libraries/timidityplus" ) set( TIMIDITY_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/libraries/timidity" ) set( WILDMIDI_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/libraries/wildmidi" ) +set( OPLSYNTH_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/libraries/oplsynth" ) if( NOT CMAKE_CROSSCOMPILING ) if( NOT CROSS_EXPORTS ) @@ -414,6 +415,7 @@ add_subdirectory( libraries/opnmidi ) add_subdirectory( libraries/timidity ) add_subdirectory( libraries/timidityplus ) add_subdirectory( libraries/wildmidi ) +add_subdirectory( libraries/oplsynth ) add_subdirectory( wadsrc ) add_subdirectory( wadsrc_bm ) add_subdirectory( wadsrc_lights ) diff --git a/libraries/oplsynth/CMakeLists.txt b/libraries/oplsynth/CMakeLists.txt new file mode 100644 index 000000000..7dc736e74 --- /dev/null +++ b/libraries/oplsynth/CMakeLists.txt @@ -0,0 +1,38 @@ +cmake_minimum_required( VERSION 2.8.7 ) + +make_release_only() + +if( ZD_CMAKE_COMPILER_IS_GNUC_COMPATIBLE ) + set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wno-unused-parameter -fomit-frame-pointer" ) + set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11" ) +endif() + +set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${ZD_FASTMATH_FLAG}") + +include( CheckFunctionExists ) + +CHECK_FUNCTION_EXISTS( stricmp STRICMP_EXISTS ) +if( NOT STRICMP_EXISTS ) + add_definitions( -Dstricmp=strcasecmp ) +endif() + +CHECK_FUNCTION_EXISTS( strnicmp STRNICMP_EXISTS ) +if( NOT STRNICMP_EXISTS ) + add_definitions( -Dstrnicmp=strncasecmp ) +endif() + +include_directories( oplsynth ) + +file( GLOB HEADER_FILES + oplsynth/*.h + ) +add_library( oplsynth STATIC + fmopl.cpp + musicblock.cpp + nukedopl3.cpp + opl_mus_player.cpp + OPL3.cpp + oplio.cpp + dosbox/opl.cpp + ) +target_link_libraries( oplsynth ) diff --git a/src/sound/oplsynth/OPL3.cpp b/libraries/oplsynth/OPL3.cpp similarity index 99% rename from src/sound/oplsynth/OPL3.cpp rename to libraries/oplsynth/OPL3.cpp index 5fd96a181..f7bbca0af 100644 --- a/src/sound/oplsynth/OPL3.cpp +++ b/libraries/oplsynth/OPL3.cpp @@ -44,6 +44,7 @@ */ #include <math.h> +#include <stdlib.h> #include <limits> #include "opl.h" diff --git a/src/sound/oplsynth/dosbox/opl.cpp b/libraries/oplsynth/dosbox/opl.cpp similarity index 99% rename from src/sound/oplsynth/dosbox/opl.cpp rename to libraries/oplsynth/dosbox/opl.cpp index 19aa71876..ffd056f73 100644 --- a/src/sound/oplsynth/dosbox/opl.cpp +++ b/libraries/oplsynth/dosbox/opl.cpp @@ -24,8 +24,10 @@ * Ken Silverman's official web site: "http://www.advsys.net/ken" */ -#include "../opl.h" -#include "../musicblock.h" +#include "../oplsynth/opl.h" +#include <stdlib.h> +#include <string.h> +#include <stdint.h> #include <math.h> typedef uintptr_t Bitu; diff --git a/src/sound/oplsynth/dosbox/opl.h b/libraries/oplsynth/dosbox/opl.h similarity index 100% rename from src/sound/oplsynth/dosbox/opl.h rename to libraries/oplsynth/dosbox/opl.h diff --git a/src/sound/oplsynth/fmopl.cpp b/libraries/oplsynth/fmopl.cpp similarity index 99% rename from src/sound/oplsynth/fmopl.cpp rename to libraries/oplsynth/fmopl.cpp index d50c0f329..0ee5d81db 100644 --- a/src/sound/oplsynth/fmopl.cpp +++ b/libraries/oplsynth/fmopl.cpp @@ -84,6 +84,8 @@ Revision History: #include <string.h> #include <stdarg.h> #include <math.h> +#include <stdint.h> +#include <string> //#include "driver.h" /* use M.A.M.E. */ #include "opl.h" @@ -1616,7 +1618,7 @@ public: } } - FString GetVoiceString(void *chip) + std::string GetVoiceString(void *chip) { FM_OPL *OPL = (FM_OPL *)chip; char out[9*3]; @@ -1637,7 +1639,7 @@ public: out[i*3+1] = color; out[i*3+2] = '*'; } - return FString (out, 9*3); + return std::string (out, 9*3); } }; diff --git a/src/sound/oplsynth/musicblock.cpp b/libraries/oplsynth/musicblock.cpp similarity index 100% rename from src/sound/oplsynth/musicblock.cpp rename to libraries/oplsynth/musicblock.cpp diff --git a/src/sound/oplsynth/nukedopl3.cpp b/libraries/oplsynth/nukedopl3.cpp similarity index 100% rename from src/sound/oplsynth/nukedopl3.cpp rename to libraries/oplsynth/nukedopl3.cpp diff --git a/src/sound/oplsynth/opl_mus_player.cpp b/libraries/oplsynth/opl_mus_player.cpp similarity index 100% rename from src/sound/oplsynth/opl_mus_player.cpp rename to libraries/oplsynth/opl_mus_player.cpp diff --git a/src/sound/oplsynth/oplio.cpp b/libraries/oplsynth/oplio.cpp similarity index 100% rename from src/sound/oplsynth/oplio.cpp rename to libraries/oplsynth/oplio.cpp diff --git a/src/sound/oplsynth/genmidi.h b/libraries/oplsynth/oplsynth/genmidi.h similarity index 100% rename from src/sound/oplsynth/genmidi.h rename to libraries/oplsynth/oplsynth/genmidi.h diff --git a/src/sound/oplsynth/musicblock.h b/libraries/oplsynth/oplsynth/musicblock.h similarity index 100% rename from src/sound/oplsynth/musicblock.h rename to libraries/oplsynth/oplsynth/musicblock.h diff --git a/src/sound/oplsynth/nukedopl3.h b/libraries/oplsynth/oplsynth/nukedopl3.h similarity index 100% rename from src/sound/oplsynth/nukedopl3.h rename to libraries/oplsynth/oplsynth/nukedopl3.h diff --git a/src/sound/oplsynth/o_swap.h b/libraries/oplsynth/oplsynth/o_swap.h similarity index 100% rename from src/sound/oplsynth/o_swap.h rename to libraries/oplsynth/oplsynth/o_swap.h diff --git a/src/sound/oplsynth/opl.h b/libraries/oplsynth/oplsynth/opl.h similarity index 100% rename from src/sound/oplsynth/opl.h rename to libraries/oplsynth/oplsynth/opl.h diff --git a/src/sound/oplsynth/opl3_Float.h b/libraries/oplsynth/oplsynth/opl3_Float.h similarity index 100% rename from src/sound/oplsynth/opl3_Float.h rename to libraries/oplsynth/oplsynth/opl3_Float.h diff --git a/src/sound/oplsynth/opl_mus_player.h b/libraries/oplsynth/oplsynth/opl_mus_player.h similarity index 100% rename from src/sound/oplsynth/opl_mus_player.h rename to libraries/oplsynth/oplsynth/opl_mus_player.h diff --git a/src/sound/oplsynth/oplio.h b/libraries/oplsynth/oplsynth/oplio.h similarity index 100% rename from src/sound/oplsynth/oplio.h rename to libraries/oplsynth/oplsynth/oplio.h diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index dbf78baf5..ee8db6493 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -488,7 +488,7 @@ add_custom_target( revision_check ALL message( STATUS "Fluid synth libs: ${FLUIDSYNTH_LIBRARIES}" ) set( ZDOOM_LIBS ${ZDOOM_LIBS} "${ZLIB_LIBRARIES}" "${JPEG_LIBRARIES}" "${BZIP2_LIBRARIES}" "${GME_LIBRARIES}" "${CMAKE_DL_LIBS}" ) -include_directories( "${ZLIB_INCLUDE_DIR}" "${BZIP2_INCLUDE_DIR}" "${LZMA_INCLUDE_DIR}" "${JPEG_INCLUDE_DIR}" "${GME_INCLUDE_DIR}" "${ADL_INCLUDE_DIR}" "${OPN_INCLUDE_DIR}" "${TIMIDITYPP_INCLUDE_DIR}" "${TIMIDITY_INCLUDE_DIR}" "${WILDMIDI_INCLUDE_DIR}" ) +include_directories( "${ZLIB_INCLUDE_DIR}" "${BZIP2_INCLUDE_DIR}" "${LZMA_INCLUDE_DIR}" "${JPEG_INCLUDE_DIR}" "${GME_INCLUDE_DIR}" "${ADL_INCLUDE_DIR}" "${OPN_INCLUDE_DIR}" "${TIMIDITYPP_INCLUDE_DIR}" "${TIMIDITY_INCLUDE_DIR}" "${WILDMIDI_INCLUDE_DIR}" "${OPLSYNTH_INCLUDE_DIR}" ) if( ${HAVE_VM_JIT} ) add_definitions( -DHAVE_VM_JIT ) @@ -678,8 +678,6 @@ file( GLOB HEADER_FILES sound/*.h sound/backend/*.h* sound/music/*.h* - sound/oplsynth/*.h - sound/oplsynth/dosbox/*.h posix/*.h posix/cocoa/*.h posix/sdl/*.h @@ -696,8 +694,6 @@ file( GLOB HEADER_FILES scripting/zscript/*.h scripting/vm/*.h sound/midisources/*.h - sound/oplsynth/*.h - sound/oplsynth/dosbox/*.h sound/thirdparty/*.h xlat/*.h swrenderer/*.h @@ -838,7 +834,6 @@ set( VM_JIT_SOURCES set( FASTMATH_SOURCES swrenderer/r_all.cpp polyrenderer/poly_all.cpp - sound/oplsynth/opl_mus_player.cpp sound/backend/mpg123_decoder.cpp sound/music/music_midi_base.cpp sound/backend/oalsound.cpp @@ -1210,12 +1205,6 @@ set (PCH_SOURCES sound/musicformats/music_opl.cpp sound/musicformats/music_stream.cpp sound/musicformats/music_xa.cpp - sound/oplsynth/fmopl.cpp - sound/oplsynth/musicblock.cpp - sound/oplsynth/oplio.cpp - sound/oplsynth/dosbox/opl.cpp - sound/oplsynth/OPL3.cpp - sound/oplsynth/nukedopl3.cpp events.cpp atterm.cpp GuillotineBinPack.cpp @@ -1282,7 +1271,7 @@ if( UNIX ) endif() endif() -target_link_libraries( zdoom ${ZDOOM_LIBS} gdtoa dumb lzma adl opn timidity timidityplus wildmidi ) +target_link_libraries( zdoom ${ZDOOM_LIBS} gdtoa dumb lzma adl opn timidity timidityplus wildmidi oplsynth ) include_directories( . g_statusbar @@ -1291,7 +1280,6 @@ include_directories( . sound sound/music sound/backend - sound/oplsynth textures xlat scripting @@ -1391,8 +1379,6 @@ install(TARGETS zdoom source_group("Audio Files" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/sound/.+") source_group("Audio Files\\Backend" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/sound/backend/.+") -source_group("Audio Files\\OPL Synth" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/sound/oplsynth/.+") -source_group("Audio Files\\OPL Synth\\DOSBox" FILES sound/oplsynth/dosbox/opl.cpp sound/oplsynth/dosbox/opl.h) source_group("Audio Files\\MIDI Devices" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/sound/mididevices/.+") source_group("Audio Files\\MIDI Sources" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/sound/midisources/.+") source_group("Audio Files\\Music formats" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/sound/musicformats/.+") diff --git a/src/sound/mididevices/music_opl_mididevice.cpp b/src/sound/mididevices/music_opl_mididevice.cpp index 560d235e5..592b7498e 100644 --- a/src/sound/mididevices/music_opl_mididevice.cpp +++ b/src/sound/mididevices/music_opl_mididevice.cpp @@ -41,8 +41,8 @@ #include "m_swap.h" #include "w_wad.h" #include "v_text.h" -#include "i_system.h" -#include "opl.h" +#include "doomerrors.h" +#include "oplsynth/opl.h" // MACROS ------------------------------------------------------------------