mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-25 13:31:37 +00:00
- created a new zmusic library which will eventually contain all the music playback code.
Currently all it contains are the MIDI sources and the MIDI devices, the rest needs to be reworked first.
This commit is contained in:
parent
fc6eba0c26
commit
cfe89ef6e6
42 changed files with 397 additions and 122 deletions
|
@ -389,6 +389,7 @@ 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" )
|
||||
set( ZMUSIC_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/libraries/zmusic" )
|
||||
|
||||
if( NOT CMAKE_CROSSCOMPILING )
|
||||
if( NOT CROSS_EXPORTS )
|
||||
|
@ -416,6 +417,7 @@ add_subdirectory( libraries/timidity )
|
|||
add_subdirectory( libraries/timidityplus )
|
||||
add_subdirectory( libraries/wildmidi )
|
||||
add_subdirectory( libraries/oplsynth )
|
||||
add_subdirectory( libraries/zmusic )
|
||||
add_subdirectory( wadsrc )
|
||||
add_subdirectory( wadsrc_bm )
|
||||
add_subdirectory( wadsrc_lights )
|
||||
|
|
|
@ -55,6 +55,7 @@ enum
|
|||
};
|
||||
|
||||
struct GenMidiVoice;
|
||||
struct genmidi_op_t;
|
||||
|
||||
struct OPLio
|
||||
{
|
||||
|
|
58
libraries/zmusic/CMakeLists.txt
Normal file
58
libraries/zmusic/CMakeLists.txt
Normal file
|
@ -0,0 +1,58 @@
|
|||
cmake_minimum_required( VERSION 2.8.7 )
|
||||
|
||||
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 )
|
||||
|
||||
option( DYN_FLUIDSYNTH "Dynamically load fluidsynth" ON )
|
||||
|
||||
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( "${ADL_INCLUDE_DIR}" "${OPN_INCLUDE_DIR}" "${TIMIDITYPP_INCLUDE_DIR}" "${TIMIDITY_INCLUDE_DIR}" "${WILDMIDI_INCLUDE_DIR}" "${OPLSYNTH_INCLUDE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}" )
|
||||
|
||||
if (WIN32)
|
||||
set( PLAT_WIN32_SOURCES
|
||||
mididevices/music_win_mididevice.cpp)
|
||||
endif()
|
||||
|
||||
file( GLOB HEADER_FILES
|
||||
zmusic/*.h
|
||||
)
|
||||
add_library( zmusic STATIC
|
||||
i_module.cpp
|
||||
mididevices/music_base_mididevice.cpp
|
||||
mididevices/music_adlmidi_mididevice.cpp
|
||||
mididevices/music_opl_mididevice.cpp
|
||||
mididevices/music_opnmidi_mididevice.cpp
|
||||
mididevices/music_timiditypp_mididevice.cpp
|
||||
mididevices/music_fluidsynth_mididevice.cpp
|
||||
mididevices/music_softsynth_mididevice.cpp
|
||||
mididevices/music_timidity_mididevice.cpp
|
||||
mididevices/music_wildmidi_mididevice.cpp
|
||||
mididevices/music_wavewriter_mididevice.cpp
|
||||
midisources/midisource.cpp
|
||||
midisources/midisource_mus.cpp
|
||||
midisources/midisource_smf.cpp
|
||||
midisources/midisource_hmi.cpp
|
||||
midisources/midisource_xmi.cpp
|
||||
${PLAT_WIN32_SOURCES}
|
||||
)
|
||||
target_link_libraries( zmusic )
|
||||
|
||||
|
||||
source_group("MIDI Devices" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/mididevices/.+")
|
||||
source_group("MIDI Sources" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/midisources/.+")
|
||||
source_group("MIDI Headers" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/zmusic/.+")
|
|
@ -1,29 +1,16 @@
|
|||
#pragma once
|
||||
|
||||
#include <mutex>
|
||||
#include "midiconfig.h"
|
||||
#include "mididefs.h"
|
||||
#include "zmusic/midiconfig.h"
|
||||
#include "zmusic/mididefs.h"
|
||||
|
||||
#include "mididevices/mididevice.h"
|
||||
|
||||
void TimidityPP_Shutdown();
|
||||
typedef void(*MidiCallback)(void *);
|
||||
|
||||
// A device that provides a WinMM-like MIDI streaming interface -------------
|
||||
|
||||
enum EMidiDevice
|
||||
{
|
||||
MDEV_DEFAULT = -1,
|
||||
MDEV_MMAPI = 0,
|
||||
MDEV_OPL = 1,
|
||||
MDEV_SNDSYS = 2,
|
||||
MDEV_TIMIDITY = 3,
|
||||
MDEV_FLUIDSYNTH = 4,
|
||||
MDEV_GUS = 5,
|
||||
MDEV_WILDMIDI = 6,
|
||||
MDEV_ADL = 7,
|
||||
MDEV_OPN = 8,
|
||||
|
||||
MDEV_COUNT
|
||||
};
|
||||
|
||||
struct MidiHeader
|
||||
{
|
|
@ -37,11 +37,15 @@
|
|||
#include <mutex>
|
||||
#include <stdio.h>
|
||||
#include "mididevice.h"
|
||||
#include "mus2midi.h"
|
||||
#include "zmusic/mus2midi.h"
|
||||
|
||||
// FluidSynth implementation of a MIDI device -------------------------------
|
||||
|
||||
#ifndef DYN_FLUIDSYNTH
|
||||
#if !defined DYN_FLUIDSYNTH && defined _WIN32
|
||||
#define DYN_FLUIDSYNTH 1 // On Windows this is the only supported way to link to FluidSynth.
|
||||
#endif
|
||||
|
||||
#if !defined DYN_FLUIDSYNTH
|
||||
#include <fluidsynth.h>
|
||||
#else
|
||||
#include "i_module.h"
|
|
@ -36,7 +36,7 @@
|
|||
// HEADER FILES ------------------------------------------------------------
|
||||
|
||||
#include "mididevice.h"
|
||||
#include "mus2midi.h"
|
||||
#include "zmusic/mus2midi.h"
|
||||
#include "oplsynth/opl.h"
|
||||
#include "oplsynth/opl_mus_player.h"
|
||||
|
|
@ -35,6 +35,8 @@
|
|||
// HEADER FILES ------------------------------------------------------------
|
||||
|
||||
#include <mutex>
|
||||
#include <algorithm>
|
||||
#include <assert.h>
|
||||
#include "mididevice.h"
|
||||
|
||||
// MACROS ------------------------------------------------------------------
|
|
@ -93,16 +93,16 @@ void TimidityMIDIDevice::LoadInstruments(GUSConfig *config)
|
|||
if (config->dmxgus.size())
|
||||
{
|
||||
// Check if we got some GUS data before using it.
|
||||
FString ultradir = getenv("ULTRADIR");
|
||||
if (ultradir.IsNotEmpty() || config->gus_patchdir.length() != 0)
|
||||
std::string ultradir = getenv("ULTRADIR");
|
||||
if (ultradir.length() || config->gus_patchdir.length() != 0)
|
||||
{
|
||||
auto psreader = new Timidity::BaseSoundFontReader;
|
||||
|
||||
// The GUS put its patches in %ULTRADIR%/MIDI so we can try that
|
||||
if (ultradir.IsNotEmpty())
|
||||
if (ultradir.length())
|
||||
{
|
||||
ultradir += "/midi";
|
||||
psreader->timidity_add_path(ultradir);
|
||||
psreader->timidity_add_path(ultradir.c_str());
|
||||
}
|
||||
// Load DMXGUS lump and patches from gus_patchdir
|
||||
if (config->gus_patchdir.length() != 0) psreader->timidity_add_path(config->gus_patchdir.c_str());
|
|
@ -36,7 +36,7 @@
|
|||
// HEADER FILES ------------------------------------------------------------
|
||||
|
||||
#include "mididevice.h"
|
||||
#include "m_swap.h"
|
||||
#include "zmusic/m_swap.h"
|
||||
#include <errno.h>
|
||||
|
||||
// MACROS ------------------------------------------------------------------
|
||||
|
@ -184,8 +184,8 @@ bool MIDIWaveWriter::CloseFile()
|
|||
}
|
||||
fclose(File);
|
||||
File = nullptr;
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//==========================================================================
|
|
@ -44,8 +44,8 @@
|
|||
// HEADER FILES ------------------------------------------------------------
|
||||
|
||||
#include "mididevice.h"
|
||||
#include "m_swap.h"
|
||||
#include "mus2midi.h"
|
||||
#include "zmusic/m_swap.h"
|
||||
#include "zmusic/mus2midi.h"
|
||||
|
||||
#ifndef __GNUC__
|
||||
#include <mmdeviceapi.h>
|
|
@ -11,8 +11,8 @@
|
|||
#include <stdint.h>
|
||||
#include <functional>
|
||||
#include <vector>
|
||||
#include "mididevices/mus2midi.h"
|
||||
#include "mididevices/mididefs.h"
|
||||
#include "zmusic/mus2midi.h"
|
||||
#include "zmusic/mididefs.h"
|
||||
|
||||
extern char MIDI_EventLengths[7];
|
||||
extern char MIDI_CommonLengths[15];
|
|
@ -35,8 +35,9 @@
|
|||
// HEADER FILES ------------------------------------------------------------
|
||||
|
||||
#include <algorithm>
|
||||
#include <assert.h>
|
||||
#include "midisource.h"
|
||||
#include "m_swap.h"
|
||||
#include "zmusic/m_swap.h"
|
||||
|
||||
// MACROS ------------------------------------------------------------------
|
||||
|
|
@ -33,8 +33,9 @@
|
|||
|
||||
// HEADER FILES ------------------------------------------------------------
|
||||
|
||||
#include <algorithm>
|
||||
#include "midisource.h"
|
||||
#include "m_swap.h"
|
||||
#include "zmusic/m_swap.h"
|
||||
|
||||
// MACROS ------------------------------------------------------------------
|
||||
|
|
@ -35,7 +35,7 @@
|
|||
// HEADER FILES ------------------------------------------------------------
|
||||
|
||||
#include "midisource.h"
|
||||
#include "m_swap.h"
|
||||
#include "zmusic/m_swap.h"
|
||||
|
||||
// MACROS ------------------------------------------------------------------
|
||||
|
255
libraries/zmusic/zmusic/m_swap.h
Normal file
255
libraries/zmusic/zmusic/m_swap.h
Normal file
|
@ -0,0 +1,255 @@
|
|||
//
|
||||
// DESCRIPTION:
|
||||
// Endianess handling, swapping 16bit and 32bit.
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
|
||||
#ifndef __M_SWAP_H__
|
||||
#define __M_SWAP_H__
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
// Endianess handling.
|
||||
// WAD files are stored little endian.
|
||||
|
||||
#ifdef __APPLE__
|
||||
#include <libkern/OSByteOrder.h>
|
||||
|
||||
inline short LittleShort(short x)
|
||||
{
|
||||
return (short)OSSwapLittleToHostInt16((uint16_t)x);
|
||||
}
|
||||
|
||||
inline unsigned short LittleShort(unsigned short x)
|
||||
{
|
||||
return OSSwapLittleToHostInt16(x);
|
||||
}
|
||||
|
||||
inline short LittleShort(int x)
|
||||
{
|
||||
return OSSwapLittleToHostInt16((uint16_t)x);
|
||||
}
|
||||
|
||||
inline unsigned short LittleShort(unsigned int x)
|
||||
{
|
||||
return OSSwapLittleToHostInt16((uint16_t)x);
|
||||
}
|
||||
|
||||
inline int LittleLong(int x)
|
||||
{
|
||||
return OSSwapLittleToHostInt32((uint32_t)x);
|
||||
}
|
||||
|
||||
inline unsigned int LittleLong(unsigned int x)
|
||||
{
|
||||
return OSSwapLittleToHostInt32(x);
|
||||
}
|
||||
|
||||
inline short BigShort(short x)
|
||||
{
|
||||
return (short)OSSwapBigToHostInt16((uint16_t)x);
|
||||
}
|
||||
|
||||
inline unsigned short BigShort(unsigned short x)
|
||||
{
|
||||
return OSSwapBigToHostInt16(x);
|
||||
}
|
||||
|
||||
inline int BigLong(int x)
|
||||
{
|
||||
return OSSwapBigToHostInt32((uint32_t)x);
|
||||
}
|
||||
|
||||
inline unsigned int BigLong(unsigned int x)
|
||||
{
|
||||
return OSSwapBigToHostInt32(x);
|
||||
}
|
||||
|
||||
#elif defined __BIG_ENDIAN__
|
||||
|
||||
// Swap 16bit, that is, MSB and LSB byte.
|
||||
// No masking with 0xFF should be necessary.
|
||||
inline short LittleShort (short x)
|
||||
{
|
||||
return (short)((((unsigned short)x)>>8) | (((unsigned short)x)<<8));
|
||||
}
|
||||
|
||||
inline unsigned short LittleShort (unsigned short x)
|
||||
{
|
||||
return (unsigned short)((x>>8) | (x<<8));
|
||||
}
|
||||
|
||||
inline short LittleShort (int x)
|
||||
{
|
||||
return LittleShort((short)x);
|
||||
}
|
||||
|
||||
inline unsigned short LittleShort (unsigned int x)
|
||||
{
|
||||
return LittleShort((unsigned short)x);
|
||||
}
|
||||
|
||||
// Swapping 32bit.
|
||||
inline unsigned int LittleLong (unsigned int x)
|
||||
{
|
||||
return (unsigned int)(
|
||||
(x>>24)
|
||||
| ((x>>8) & 0xff00)
|
||||
| ((x<<8) & 0xff0000)
|
||||
| (x<<24));
|
||||
}
|
||||
|
||||
inline int LittleLong (int x)
|
||||
{
|
||||
return (int)(
|
||||
(((unsigned int)x)>>24)
|
||||
| ((((unsigned int)x)>>8) & 0xff00)
|
||||
| ((((unsigned int)x)<<8) & 0xff0000)
|
||||
| (((unsigned int)x)<<24));
|
||||
}
|
||||
|
||||
inline short BigShort(short x)
|
||||
{
|
||||
return x;
|
||||
}
|
||||
|
||||
inline unsigned short BigShort(unsigned short x)
|
||||
{
|
||||
return x;
|
||||
}
|
||||
|
||||
inline unsigned int BigLong(unsigned int x)
|
||||
{
|
||||
return x;
|
||||
}
|
||||
|
||||
inline int BigLong(int x)
|
||||
{
|
||||
return x;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
inline short LittleShort(short x)
|
||||
{
|
||||
return x;
|
||||
}
|
||||
|
||||
inline unsigned short LittleShort(unsigned short x)
|
||||
{
|
||||
return x;
|
||||
}
|
||||
|
||||
inline unsigned int LittleLong(unsigned int x)
|
||||
{
|
||||
return x;
|
||||
}
|
||||
|
||||
inline int LittleLong(int x)
|
||||
{
|
||||
return x;
|
||||
}
|
||||
|
||||
#ifdef _MSC_VER
|
||||
|
||||
inline short BigShort(short x)
|
||||
{
|
||||
return (short)_byteswap_ushort((unsigned short)x);
|
||||
}
|
||||
|
||||
inline unsigned short BigShort(unsigned short x)
|
||||
{
|
||||
return _byteswap_ushort(x);
|
||||
}
|
||||
|
||||
inline int BigLong(int x)
|
||||
{
|
||||
return (int)_byteswap_ulong((unsigned long)x);
|
||||
}
|
||||
|
||||
inline unsigned int BigLong(unsigned int x)
|
||||
{
|
||||
return (unsigned int)_byteswap_ulong((unsigned long)x);
|
||||
}
|
||||
#pragma warning (default: 4035)
|
||||
|
||||
#else
|
||||
|
||||
inline short BigShort (short x)
|
||||
{
|
||||
return (short)((((unsigned short)x)>>8) | (((unsigned short)x)<<8));
|
||||
}
|
||||
|
||||
inline unsigned short BigShort (unsigned short x)
|
||||
{
|
||||
return (unsigned short)((x>>8) | (x<<8));
|
||||
}
|
||||
|
||||
inline unsigned int BigLong (unsigned int x)
|
||||
{
|
||||
return (unsigned int)(
|
||||
(x>>24)
|
||||
| ((x>>8) & 0xff00)
|
||||
| ((x<<8) & 0xff0000)
|
||||
| (x<<24));
|
||||
}
|
||||
|
||||
inline int BigLong (int x)
|
||||
{
|
||||
return (int)(
|
||||
(((unsigned int)x)>>24)
|
||||
| ((((unsigned int)x)>>8) & 0xff00)
|
||||
| ((((unsigned int)x)<<8) & 0xff0000)
|
||||
| (((unsigned int)x)<<24));
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif // __BIG_ENDIAN__
|
||||
|
||||
// These may be destructive so they should create errors
|
||||
unsigned long BigLong(unsigned long) = delete;
|
||||
long BigLong(long) = delete;
|
||||
unsigned long LittleLong(unsigned long) = delete;
|
||||
long LittleLong(long) = delete;
|
||||
|
||||
|
||||
// Data accessors, since some data is highly likely to be unaligned.
|
||||
#if defined(_M_IX86) || defined(_M_X64) || defined(__i386__) || defined(__x86_64__)
|
||||
inline int GetShort(const unsigned char *foo)
|
||||
{
|
||||
return *(const short *)foo;
|
||||
}
|
||||
inline int GetInt(const unsigned char *foo)
|
||||
{
|
||||
return *(const int *)foo;
|
||||
}
|
||||
#else
|
||||
inline int GetShort(const unsigned char *foo)
|
||||
{
|
||||
return short(foo[0] | (foo[1] << 8));
|
||||
}
|
||||
inline int GetInt(const unsigned char *foo)
|
||||
{
|
||||
return int(foo[0] | (foo[1] << 8) | (foo[2] << 16) | (foo[3] << 24));
|
||||
}
|
||||
#endif
|
||||
inline int GetBigInt(const unsigned char *foo)
|
||||
{
|
||||
return int((foo[0] << 24) | (foo[1] << 16) | (foo[2] << 8) | foo[3]);
|
||||
}
|
||||
|
||||
#ifdef __BIG_ENDIAN__
|
||||
inline int GetNativeInt(const unsigned char *foo)
|
||||
{
|
||||
return GetBigInt(foo);
|
||||
}
|
||||
#else
|
||||
inline int GetNativeInt(const unsigned char *foo)
|
||||
{
|
||||
return GetInt(foo);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // __M_SWAP_H__
|
|
@ -37,14 +37,12 @@ struct FluidConfig
|
|||
float fluid_chorus_depth = 8;
|
||||
};
|
||||
|
||||
#include "oplsynth/genmidi.h"
|
||||
|
||||
struct OPLMidiConfig
|
||||
{
|
||||
int numchips = 2;
|
||||
int core = 0;
|
||||
bool fullpan = true;
|
||||
struct GenMidiInstrument OPLinstruments[GENMIDI_NUM_TOTAL];
|
||||
uint8_t OPLinstruments[36 * 175]; // it really is 'struct GenMidiInstrument OPLinstruments[GENMIDI_NUM_TOTAL]'; but since this is a public header it cannot pull in a dependency from oplsynth.
|
||||
};
|
||||
|
||||
struct OpnConfig
|
|
@ -29,3 +29,18 @@ enum : uint8_t
|
|||
MEVENT_LONGMSG = 128,
|
||||
};
|
||||
|
||||
enum EMidiDevice
|
||||
{
|
||||
MDEV_DEFAULT = -1,
|
||||
MDEV_MMAPI = 0,
|
||||
MDEV_OPL = 1,
|
||||
MDEV_SNDSYS = 2,
|
||||
MDEV_TIMIDITY = 3,
|
||||
MDEV_FLUIDSYNTH = 4,
|
||||
MDEV_GUS = 5,
|
||||
MDEV_WILDMIDI = 6,
|
||||
MDEV_ADL = 7,
|
||||
MDEV_OPN = 8,
|
||||
|
||||
MDEV_COUNT
|
||||
};
|
|
@ -23,7 +23,6 @@ if( ZD_CMAKE_COMPILER_IS_GNUCXX_COMPATIBLE )
|
|||
endif()
|
||||
endif()
|
||||
|
||||
option( DYN_FLUIDSYNTH "Dynamically load fluidsynth" ON )
|
||||
option( DYN_OPENAL "Dynamically load OpenAL" ON )
|
||||
option( DYN_SNDFILE "Dynamically load libsndfile" ON )
|
||||
option( DYN_MPG123 "Dynamically load libmpg123" ON )
|
||||
|
@ -468,7 +467,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}" "${OPLSYNTH_INCLUDE_DIR}" )
|
||||
include_directories( "${ZLIB_INCLUDE_DIR}" "${BZIP2_INCLUDE_DIR}" "${LZMA_INCLUDE_DIR}" "${JPEG_INCLUDE_DIR}" "${GME_INCLUDE_DIR}" "${ZMUSIC_INCLUDE_DIR}" )
|
||||
|
||||
if( ${HAVE_VM_JIT} )
|
||||
add_definitions( -DHAVE_VM_JIT )
|
||||
|
@ -493,7 +492,6 @@ endif()
|
|||
|
||||
# Start defining source files for ZDoom
|
||||
set( PLAT_WIN32_SOURCES
|
||||
sound/mididevices/music_win_mididevice.cpp
|
||||
win32/hardware.cpp
|
||||
win32/helperthread.cpp
|
||||
win32/i_cd.cpp
|
||||
|
@ -1185,22 +1183,7 @@ set (PCH_SOURCES
|
|||
sound/music/i_music.cpp
|
||||
sound/music/i_soundfont.cpp
|
||||
sound/backend/i_sound.cpp
|
||||
sound/mididevices/midi_cvars.cpp
|
||||
sound/mididevices/music_base_mididevice.cpp
|
||||
sound/mididevices/music_adlmidi_mididevice.cpp
|
||||
sound/mididevices/music_opl_mididevice.cpp
|
||||
sound/mididevices/music_opnmidi_mididevice.cpp
|
||||
sound/mididevices/music_timiditypp_mididevice.cpp
|
||||
sound/mididevices/music_fluidsynth_mididevice.cpp
|
||||
sound/mididevices/music_softsynth_mididevice.cpp
|
||||
sound/mididevices/music_timidity_mididevice.cpp
|
||||
sound/mididevices/music_wildmidi_mididevice.cpp
|
||||
sound/mididevices/music_wavewriter_mididevice.cpp
|
||||
sound/midisources/midisource.cpp
|
||||
sound/midisources/midisource_mus.cpp
|
||||
sound/midisources/midisource_smf.cpp
|
||||
sound/midisources/midisource_hmi.cpp
|
||||
sound/midisources/midisource_xmi.cpp
|
||||
sound/music/midi_cvars.cpp
|
||||
sound/musicformats/music_cd.cpp
|
||||
sound/musicformats/music_dumb.cpp
|
||||
sound/musicformats/music_gme.cpp
|
||||
|
@ -1231,7 +1214,6 @@ set (PCH_SOURCES
|
|||
utility/atterm.cpp
|
||||
utility/cmdlib.cpp
|
||||
utility/configfile.cpp
|
||||
utility/i_module.cpp
|
||||
utility/i_time.cpp
|
||||
utility/m_alloc.cpp
|
||||
utility/m_argv.cpp
|
||||
|
@ -1305,7 +1287,7 @@ if( UNIX )
|
|||
endif()
|
||||
endif()
|
||||
|
||||
target_link_libraries( zdoom ${ZDOOM_LIBS} gdtoa dumb lzma adl opn timidity timidityplus wildmidi oplsynth )
|
||||
target_link_libraries( zdoom ${ZDOOM_LIBS} gdtoa dumb lzma adl opn timidity timidityplus wildmidi oplsynth zmusic )
|
||||
|
||||
include_directories( .
|
||||
g_statusbar
|
||||
|
@ -1431,8 +1413,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\\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/.+")
|
||||
source_group("Audio Files\\Third-party" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/sound/thirdparty/.+")
|
||||
source_group("Game Data" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/gamedata/.+")
|
||||
|
|
|
@ -42,7 +42,6 @@
|
|||
#include "v_text.h"
|
||||
#include "i_module.h"
|
||||
#include "i_music.h"
|
||||
#include "i_musicinterns.h"
|
||||
#include "cmdlib.h"
|
||||
#include "menu/menu.h"
|
||||
|
||||
|
|
|
@ -45,9 +45,9 @@
|
|||
#include "c_dispatch.h"
|
||||
#include "templates.h"
|
||||
#include "stats.h"
|
||||
#include "timidity/timidity.h"
|
||||
#include "vm.h"
|
||||
#include "s_music.h"
|
||||
#include "..//libraries/zmusic/midisources/midisource.h"
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
#define __I_MUSIC_H__
|
||||
|
||||
#include "doomdef.h"
|
||||
#include "zmusic/mididefs.h"
|
||||
#include "i_soundinternal.h"
|
||||
|
||||
class FileReader;
|
||||
|
@ -75,7 +76,7 @@ public:
|
|||
virtual bool SetPosition (unsigned int ms);
|
||||
virtual bool SetSubsong (int subsong);
|
||||
virtual void Update();
|
||||
virtual int GetDeviceType() const { return -1; } // MDEV_DEFAULT stands in for anything that cannot change playback parameters which needs a restart.
|
||||
virtual int GetDeviceType() const { return MDEV_DEFAULT; } // MDEV_DEFAULT stands in for anything that cannot change playback parameters which needs a restart.
|
||||
virtual FString GetStats();
|
||||
virtual MusInfo *GetOPLDumper(const char *filename);
|
||||
virtual MusInfo *GetWaveDumper(const char *filename, int rate);
|
||||
|
|
|
@ -1,21 +1,22 @@
|
|||
|
||||
#include <mutex>
|
||||
#include <string>
|
||||
#include "oplsynth/opl_mus_player.h"
|
||||
#include "c_cvars.h"
|
||||
#include "mididevices/mus2midi.h"
|
||||
#include "i_sound.h"
|
||||
#include "i_music.h"
|
||||
#include "s_sound.h"
|
||||
#include "files.h"
|
||||
#include "wildmidi/wildmidi_lib.h"
|
||||
#include "midisources/midisource.h"
|
||||
#include "mididevices/mididevice.h"
|
||||
#include "zmusic/midiconfig.h"
|
||||
#include "zmusic/mididefs.h"
|
||||
|
||||
#include "zmusic/..//mididevices/mididevice.h" // this is still needed...
|
||||
|
||||
void I_InitMusicWin32 ();
|
||||
|
||||
extern float relative_volume;
|
||||
class MIDISource;
|
||||
class MIDIDevice;
|
||||
class OPLmusicFile;
|
||||
|
||||
|
||||
extern ADLConfig adlConfig;
|
||||
|
@ -55,12 +56,7 @@ public:
|
|||
int ServiceEvent();
|
||||
void SetMIDISource(MIDISource *_source);
|
||||
|
||||
int GetDeviceType() const override
|
||||
{
|
||||
return nullptr == MIDI
|
||||
? MusInfo::GetDeviceType()
|
||||
: MIDI->GetDeviceType();
|
||||
}
|
||||
int GetDeviceType() const override;
|
||||
|
||||
bool DumpWave(const char *filename, int subsong, int samplerate);
|
||||
static bool FillStream(SoundStream* stream, void* buff, int len, void* userdata);
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
#include "i_system.h"
|
||||
#include "gameconfigfile.h"
|
||||
#include "resourcefiles/resourcefile.h"
|
||||
#include "timiditypp/common.h"
|
||||
#include "../libraries/timidityplus/timiditypp/common.h"
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
|
|
|
@ -3,9 +3,9 @@
|
|||
#include "doomtype.h"
|
||||
#include "w_wad.h"
|
||||
#include "files.h"
|
||||
#include "timiditypp/timidity_file.h"
|
||||
#include "timidity/timidity_file.h"
|
||||
#include "wildmidi/wildmidi_file.h"
|
||||
#include "../libraries/timidityplus/timiditypp/timidity_file.h"
|
||||
#include "../libraries/timidity/timidity/timidity_file.h"
|
||||
#include "../libraries/wildmidi/wildmidi/wildmidi_file.h"
|
||||
|
||||
enum
|
||||
{
|
||||
|
|
|
@ -35,18 +35,15 @@
|
|||
*/
|
||||
#include "i_musicinterns.h"
|
||||
#include "i_soundfont.h"
|
||||
#include "adlmidi.h"
|
||||
#include "cmdlib.h"
|
||||
#include "doomerrors.h"
|
||||
#include "timidity/timidity.h"
|
||||
#include "timidity/playmidi.h"
|
||||
#include "timidity/instrum.h"
|
||||
#include "timiditypp/controls.h"
|
||||
#include "timiditypp/timidity.h"
|
||||
#include "timiditypp/instrum.h"
|
||||
#include "v_text.h"
|
||||
#include "c_console.h"
|
||||
|
||||
#include "../libraries/timidity/timidity/timidity.h"
|
||||
#include "../libraries/timidityplus/timiditypp/timidity.h"
|
||||
#include "../libraries/oplsynth/oplsynth/oplio.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
// do this without including windows.h for this one single prototype
|
||||
extern "C" unsigned __stdcall GetSystemDirectoryA(char* lpBuffer, unsigned uSize);
|
||||
|
@ -138,7 +135,7 @@ void ADL_SetupConfig(ADLConfig *config, const char *Args)
|
|||
}
|
||||
|
||||
|
||||
CUSTOM_CVAR(Int, adl_volume_model, ADLMIDI_VolumeModel_DMX, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
||||
CUSTOM_CVAR(Int, adl_volume_model, 3/*ADLMIDI_VolumeModel_DMX*/, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
||||
{
|
||||
adlConfig.adl_volume_model = self;
|
||||
CheckRestart(MDEV_ADL);
|
||||
|
@ -503,7 +500,7 @@ void OPL_SetupConfig(OPLMidiConfig *config, const char *args)
|
|||
uint8_t filehdr[8];
|
||||
data.Read(filehdr, 8);
|
||||
if (memcmp(filehdr, "#OPL_II#", 8)) throw std::runtime_error("Corrupt GENMIDI lump");
|
||||
data.Read(oplMidiConfig.OPLinstruments, sizeof(GenMidiInstrument) * GENMIDI_NUM_TOTAL);
|
||||
data.Read(oplMidiConfig.OPLinstruments, 175 * 36);
|
||||
|
||||
config->core = opl_core;
|
||||
if (args != NULL && *args >= '0' && *args < '4') config->core = *args - '0';
|
||||
|
@ -877,14 +874,14 @@ CUSTOM_CVAR(String, wildmidi_config, "", CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
|||
CUSTOM_CVAR(Bool, wildmidi_reverb, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOINITCALL)
|
||||
{
|
||||
if (currSong != NULL)
|
||||
currSong->ChangeSettingInt("wildmidi.reverb", self ? WildMidi::WM_MO_REVERB : 0);
|
||||
currSong->ChangeSettingInt("wildmidi.reverb", *self);
|
||||
wildMidiConfig.reverb = self;
|
||||
}
|
||||
|
||||
CUSTOM_CVAR(Bool, wildmidi_enhanced_resampling, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOINITCALL)
|
||||
{
|
||||
if (currSong != NULL)
|
||||
currSong->ChangeSettingInt("wildmidi.resampling", self ? WildMidi::WM_MO_ENHANCED_RESAMPLING : 0);
|
||||
currSong->ChangeSettingInt("wildmidi.resampling", *self);
|
||||
wildMidiConfig.enhanced_resampling = self;
|
||||
}
|
||||
|
|
@ -40,6 +40,9 @@
|
|||
#include "doomerrors.h"
|
||||
#include "v_text.h"
|
||||
|
||||
#include "mididevices/mididevice.h"
|
||||
#include "midisources/midisource.h"
|
||||
|
||||
// MACROS ------------------------------------------------------------------
|
||||
|
||||
#define MAX_TIME (1000000/10) // Send out 1/10 of a sec of events at a time.
|
||||
|
@ -885,6 +888,12 @@ void MIDIStreamer::SetMIDISource(MIDISource *_source)
|
|||
source->setTempoCallback([=](int tempo) { return !!MIDI->SetTempo(tempo); } );
|
||||
}
|
||||
|
||||
int MIDIStreamer::GetDeviceType() const
|
||||
{
|
||||
return nullptr == MIDI
|
||||
? MusInfo::GetDeviceType()
|
||||
: MIDI->GetDeviceType();
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
|
|
|
@ -32,7 +32,8 @@
|
|||
*/
|
||||
|
||||
#include "i_musicinterns.h"
|
||||
#include "oplsynth/opl.h"
|
||||
#include "../libraries/oplsynth/oplsynth/opl.h"
|
||||
#include "../libraries/oplsynth/oplsynth/opl_mus_player.h"
|
||||
|
||||
static bool OPL_Active;
|
||||
|
||||
|
|
|
@ -587,7 +587,7 @@ void S_StopMusic (bool force)
|
|||
mus_playing.name = "";
|
||||
}
|
||||
}
|
||||
catch (const std::runtime_error& err)
|
||||
catch (const std::runtime_error& )
|
||||
{
|
||||
//Printf("Unable to stop %s: %s\n", mus_playing.name.GetChars(), err.what());
|
||||
if (mus_playing.handle != nullptr)
|
||||
|
|
|
@ -79,8 +79,6 @@
|
|||
#include "stats.h"
|
||||
#include "st_start.h"
|
||||
|
||||
#include "optwin32.h"
|
||||
|
||||
// MACROS ------------------------------------------------------------------
|
||||
|
||||
// The main window's title.
|
||||
|
@ -142,14 +140,6 @@ FModule Kernel32Module{"Kernel32"};
|
|||
FModule Shell32Module{"Shell32"};
|
||||
FModule User32Module{"User32"};
|
||||
|
||||
namespace OptWin32 {
|
||||
#define DYN_WIN32_SYM(x) decltype(x) x{#x}
|
||||
|
||||
DYN_WIN32_SYM(SHGetKnownFolderPath);
|
||||
|
||||
#undef DYN_WIN32_SYM
|
||||
} // namespace OptWin32
|
||||
|
||||
// PRIVATE DATA DEFINITIONS ------------------------------------------------
|
||||
|
||||
static const WCHAR WinClassName[] = WGAMENAME "MainWindow";
|
||||
|
|
|
@ -42,8 +42,6 @@
|
|||
#include "m_misc.h"
|
||||
#include "version.h" // for GAMENAME
|
||||
|
||||
#include "optwin32.h"
|
||||
|
||||
// Vanilla MinGW does not have folder ids
|
||||
#if defined(__MINGW32__) && !defined(__MINGW64_VERSION_MAJOR)
|
||||
static const GUID FOLDERID_LocalAppData = { 0xf1b32785, 0x6fba, 0x4fcf, 0x9d, 0x55, 0x7b, 0x8e, 0x7f, 0x15, 0x70, 0x91 };
|
||||
|
|
|
@ -86,8 +86,6 @@
|
|||
#include "textures/bitmap.h"
|
||||
#include "atterm.h"
|
||||
|
||||
#include "optwin32.h"
|
||||
|
||||
// MACROS ------------------------------------------------------------------
|
||||
|
||||
#ifdef _MSC_VER
|
||||
|
|
|
@ -1,18 +0,0 @@
|
|||
#pragma once
|
||||
|
||||
// Forward declarations for optional Win32 API procedures
|
||||
// implemented in i_main.cpp
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#include <shlobj.h>
|
||||
|
||||
#include "i_module.h"
|
||||
|
||||
extern FModule Shell32Module;
|
||||
|
||||
namespace OptWin32 {
|
||||
|
||||
extern TOptProc<Shell32Module, HRESULT(WINAPI*)(REFKNOWNFOLDERID, DWORD, HANDLE, PWSTR *)> SHGetKnownFolderPath;
|
||||
|
||||
} // namespace OptWin32
|
Loading…
Reference in a new issue