- made the OPL synth backend a separate library.

This commit is contained in:
Christoph Oelckers 2019-09-26 20:06:39 +02:00
parent b085ac3efb
commit d3df422031
20 changed files with 53 additions and 20 deletions

View file

@ -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 )

View file

@ -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 )

View file

@ -44,6 +44,8 @@
*/
#include <math.h>
#include <stdlib.h>
#include <limits>
#include "opl.h"
#include "opl3_Float.h"

View file

@ -24,7 +24,10 @@
* Ken Silverman's official web site: "http://www.advsys.net/ken"
*/
#include "../opl.h"
#include "../oplsynth/opl.h"
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include <math.h>
typedef uintptr_t Bitu;

View file

@ -83,6 +83,8 @@ Revision History:
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <stdint.h>
#include <string>
//#include "driver.h" /* use M.A.M.E. */
#include "opl.h"
@ -1615,7 +1617,7 @@ public:
}
}
FString GetVoiceString(void *chip)
std::string GetVoiceString(void *chip)
{
FM_OPL *OPL = (FM_OPL *)chip;
char out[9*3];
@ -1636,7 +1638,7 @@ public:
out[i*3+1] = color;
out[i*3+2] = '*';
}
return FString (out, 9*3);
return std::string (out, 9*3);
}
};

View file

@ -468,7 +468,7 @@ set( ZDOOM_LIBS ${ZDOOM_LIBS} "${ZLIB_LIBRARIES}" "${JPEG_LIBRARIES}" "${BZIP2_L
if (HAVE_VULKAN)
set( ZDOOM_LIBS ${ZDOOM_LIBS} "glslang" "SPIRV" "OGLCompiler")
endif()
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 )
@ -672,8 +672,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
@ -690,8 +688,6 @@ file( GLOB HEADER_FILES
scripting/zscript/*.h
scripting/vm/*.h
sound/midisources/*.h
sound/oplsynth/*.h
sound/oplsynth/dosbox/*.h
sound/thirdparty/*.h
rendering/*.h
rendering/2d/*.h
@ -838,7 +834,6 @@ set( FASTMATH_SOURCES
rendering/swrenderer/r_all.cpp
rendering/swrenderer/r_swscene.cpp
rendering/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
@ -1212,12 +1207,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
rendering/swrenderer/textures/r_swtexture.cpp
rendering/swrenderer/textures/warptexture.cpp
rendering/swrenderer/textures/swcanvastexture.cpp
@ -1314,7 +1303,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
@ -1331,7 +1320,6 @@ include_directories( .
sound
sound/music
sound/backend
sound/oplsynth
xlat
utility
utility/nodebuilder
@ -1441,8 +1429,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/.+")

View file

@ -39,7 +39,7 @@
#include "w_wad.h"
#include "v_text.h"
#include "doomerrors.h"
#include "opl.h"
#include "oplsynth/opl.h"
// MACROS ------------------------------------------------------------------