diff --git a/libraries/zmusic/CMakeLists.txt b/libraries/zmusic/CMakeLists.txt index 4e75ac256..aaa7db274 100644 --- a/libraries/zmusic/CMakeLists.txt +++ b/libraries/zmusic/CMakeLists.txt @@ -49,6 +49,7 @@ file( GLOB HEADER_FILES zmusic/*.h mididevices/*.h midisources/*.h + musicformats/*.h decoder/*.h streamsources/*.h thirdparty/*.h @@ -76,6 +77,8 @@ add_library( zmusic STATIC streamsources/music_libsndfile.cpp streamsources/music_opl.cpp streamsources/music_xa.cpp + musicformats/music_stream.cpp + musicformats/music_midi.cpp decoder/sounddecoder.cpp decoder/sndfile_decoder.cpp decoder/mpg123_decoder.cpp @@ -87,6 +90,7 @@ 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("Music Formats" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/musicformats/.+") source_group("Public Interface" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/zmusic/.+") source_group("Sound Decoding" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/decoder/.+") source_group("Stream Sources" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/streamsources/.+") diff --git a/libraries/zmusic/mididevices/mididevice.h b/libraries/zmusic/mididevices/mididevice.h index 5cda68017..80dff086e 100644 --- a/libraries/zmusic/mididevices/mididevice.h +++ b/libraries/zmusic/mididevices/mididevice.h @@ -4,8 +4,6 @@ #include "zmusic/midiconfig.h" #include "zmusic/mididefs.h" -#include "mididevices/mididevice.h" - void TimidityPP_Shutdown(); typedef void(*MidiCallback)(void *); diff --git a/src/sound/musicformats/music_midistream.cpp b/libraries/zmusic/musicformats/music_midi.cpp similarity index 98% rename from src/sound/musicformats/music_midistream.cpp rename to libraries/zmusic/musicformats/music_midi.cpp index d22a397b7..909281f99 100644 --- a/src/sound/musicformats/music_midistream.cpp +++ b/libraries/zmusic/musicformats/music_midi.cpp @@ -34,7 +34,7 @@ // HEADER FILES ------------------------------------------------------------ - +#include #include "zmusic/musinfo.h" #include "mididevices/mididevice.h" #include "midisources/midisource.h" @@ -125,7 +125,7 @@ protected: EMidiDevice DeviceType; bool CallbackIsThreaded; int LoopLimit; - FString Args; + std::string Args; std::unique_ptr source; }; @@ -255,15 +255,15 @@ MIDIDevice *MIDIStreamer::CreateMIDIDevice(EMidiDevice devtype, int samplerate) switch (devtype) { case MDEV_GUS: - dev = CreateTimidityMIDIDevice(Args, samplerate); + dev = CreateTimidityMIDIDevice(Args.c_str(), samplerate); break; case MDEV_ADL: - dev = CreateADLMIDIDevice(Args); + dev = CreateADLMIDIDevice(Args.c_str()); break; case MDEV_OPN: - dev = CreateOPNMIDIDevice(Args); + dev = CreateOPNMIDIDevice(Args.c_str()); break; case MDEV_MMAPI: @@ -275,19 +275,19 @@ MIDIDevice *MIDIStreamer::CreateMIDIDevice(EMidiDevice devtype, int samplerate) // Intentional fall-through for non-Windows systems. case MDEV_FLUIDSYNTH: - dev = CreateFluidSynthMIDIDevice(samplerate, Args); + dev = CreateFluidSynthMIDIDevice(samplerate, Args.c_str()); break; case MDEV_OPL: - dev = CreateOplMIDIDevice(Args); + dev = CreateOplMIDIDevice(Args.c_str()); break; case MDEV_TIMIDITY: - dev = CreateTimidityPPMIDIDevice(Args, samplerate); + dev = CreateTimidityPPMIDIDevice(Args.c_str(), samplerate); break; case MDEV_WILDMIDI: - dev = CreateWildMIDIDevice(Args, samplerate); + dev = CreateWildMIDIDevice(Args.c_str(), samplerate); break; default: @@ -783,8 +783,7 @@ int MIDIStreamer::FillBuffer(int buffer_num, int max_events, uint32_t max_time) int i; uint32_t *events = Events[buffer_num], *max_event_p; - uint32_t tot_time = 0; - uint32_t time = 0; + // The final event is for a NOP to hold the delay from the last event. max_event_p = events + (max_events - 1) * 3; @@ -999,4 +998,4 @@ void MIDIDumpWave(MIDISource* source, EMidiDevice devtype, const char *devarg, c MIDIStreamer me(devtype, devarg); me.SetMIDISource(source); me.DumpWave(outname, subsong, samplerate); -} \ No newline at end of file +} diff --git a/src/sound/musicformats/music_stream.cpp b/libraries/zmusic/musicformats/music_stream.cpp similarity index 100% rename from src/sound/musicformats/music_stream.cpp rename to libraries/zmusic/musicformats/music_stream.cpp diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 62379c016..a4b148eb4 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1161,8 +1161,6 @@ set (PCH_SOURCES sound/backend/i_sound.cpp sound/music/music_config.cpp sound/musicformats/music_cd.cpp - sound/musicformats/music_midistream.cpp - sound/musicformats/music_stream.cpp rendering/swrenderer/textures/r_swtexture.cpp rendering/swrenderer/textures/warptexture.cpp rendering/swrenderer/textures/swcanvastexture.cpp