From 2bc72f38ccd84c8fd7e2df459bc7d7edfc0e7dd1 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 30 Sep 2019 02:40:22 +0200 Subject: [PATCH] - renamed a few functions in the public interface of ZMusic. --- libraries/zmusic/musicformats/music_cd.cpp | 2 +- libraries/zmusic/zmusic/configuration.cpp | 8 ++++---- libraries/zmusic/zmusic/zmusic.cpp | 4 ++-- libraries/zmusic/zmusic/zmusic.h | 12 ++++++------ src/sound/music/i_music.cpp | 9 +++++---- src/sound/s_music.cpp | 4 ++-- 6 files changed, 20 insertions(+), 19 deletions(-) diff --git a/libraries/zmusic/musicformats/music_cd.cpp b/libraries/zmusic/musicformats/music_cd.cpp index 2a586f6de..6cfddefef 100644 --- a/libraries/zmusic/musicformats/music_cd.cpp +++ b/libraries/zmusic/musicformats/music_cd.cpp @@ -156,7 +156,7 @@ CDDAFile::CDDAFile (MusicIO::FileInterface* reader) uint32_t discid; auto endpos = reader->tell() + reader->filelength() - 8; - // I_RegisterSong already identified this as a CDDA file, so we + // ZMusic_OpenSong already identified this as a CDDA file, so we // just need to check the contents we're interested in. reader->seek(12, SEEK_CUR); diff --git a/libraries/zmusic/zmusic/configuration.cpp b/libraries/zmusic/zmusic/configuration.cpp index c583b17fe..9fcc3fae2 100644 --- a/libraries/zmusic/zmusic/configuration.cpp +++ b/libraries/zmusic/zmusic/configuration.cpp @@ -54,25 +54,25 @@ struct Dummy MiscConfig miscConfig; Callbacks musicCallbacks; -void SetCallbacks(const Callbacks* cb) +void ZMusic_SetCallbacks(const Callbacks* cb) { dumb_decode_vorbis = cb->DumbVorbisDecode; musicCallbacks = *cb; } -void SetGenMidi(const uint8_t* data) +void ZMusic_SetGenMidi(const uint8_t* data) { memcpy(oplConfig.OPLinstruments, data, 175 * 36); oplConfig.genmidiset = true; } -void SetWgOpn(const void* data, unsigned len) +void ZMusic_SetWgOpn(const void* data, unsigned len) { opnConfig.default_bank.resize(len); memcpy(opnConfig.default_bank.data(), data, len); } -void SetDmxGus(const void* data, unsigned len) +void ZMusic_SetDmxGus(const void* data, unsigned len) { gusConfig.dmxgus.resize(len); memcpy(gusConfig.dmxgus.data(), data, len); diff --git a/libraries/zmusic/zmusic/zmusic.cpp b/libraries/zmusic/zmusic/zmusic.cpp index f5a0e384e..72fc0651e 100644 --- a/libraries/zmusic/zmusic/zmusic.cpp +++ b/libraries/zmusic/zmusic/zmusic.cpp @@ -148,7 +148,7 @@ static bool ungzip(uint8_t *data, int complen, std::vector &newdata) // //========================================================================== -MusInfo *I_RegisterSong (MusicIO::FileInterface *reader, EMidiDevice device, const char *Args) +MusInfo *ZMusic_OpenSong (MusicIO::FileInterface *reader, EMidiDevice device, const char *Args) { MusInfo *info = nullptr; StreamSource *streamsource = nullptr; @@ -304,7 +304,7 @@ MusInfo *I_RegisterSong (MusicIO::FileInterface *reader, EMidiDevice device, con // //========================================================================== -MusInfo *I_RegisterCDSong (int track, int id) +MusInfo *ZMusic_OpenCDSong (int track, int id) { MusInfo *info = CD_OpenSong (track, id); diff --git a/libraries/zmusic/zmusic/zmusic.h b/libraries/zmusic/zmusic/zmusic.h index ac2580cb2..dedd1f196 100644 --- a/libraries/zmusic/zmusic/zmusic.h +++ b/libraries/zmusic/zmusic/zmusic.h @@ -141,13 +141,13 @@ struct Callbacks }; // Sets callbacks for functionality that the client needs to provide. -void SetCallbacks(const Callbacks *callbacks); +void ZMusic_SetCallbacks(const Callbacks *callbacks); // Sets GenMidi data for OPL playback. If this isn't provided the OPL synth will not work. -void SetGenMidi(const uint8_t* data); +void ZMusic_SetGenMidi(const uint8_t* data); // Set default bank for OPN. Without this OPN only works with custom banks. -void SetWgOpn(const void* data, unsigned len); +void ZMusic_SetWgOpn(const void* data, unsigned len); // Set DMXGUS data for running the GUS synth in actual GUS mode. -void SetDmxGus(const void* data, unsigned len); +void ZMusic_SetDmxGus(const void* data, unsigned len); // These exports are needed by the MIDI dumpers which need to remain on the client side. class MIDISource; // abstract for the client @@ -156,8 +156,8 @@ EMIDIType IdentifyMIDIType(uint32_t *id, int size); MIDISource *CreateMIDISource(const uint8_t *data, size_t length, EMIDIType miditype); void MIDIDumpWave(MIDISource* source, EMidiDevice devtype, const char* devarg, const char* outname, int subsong, int samplerate); -MusInfo *I_RegisterSong (MusicIO::FileInterface *reader, EMidiDevice device, const char *Args); -MusInfo *I_RegisterCDSong (int track, int cdid = 0); +MusInfo *ZMusic_OpenSong (MusicIO::FileInterface *reader, EMidiDevice device, const char *Args); +MusInfo *ZMusic_OpenCDSong (int track, int cdid = 0); void ZMusic_Shutdown(); diff --git a/src/sound/music/i_music.cpp b/src/sound/music/i_music.cpp index d8b01ac35..79b0e72c0 100644 --- a/src/sound/music/i_music.cpp +++ b/src/sound/music/i_music.cpp @@ -192,7 +192,7 @@ static void SetupGenMidi() auto genmidi = data.Read(); if (genmidi.Size() < 8 + 175 * 36 || memcmp(genmidi.Data(), "#OPL_II#", 8)) return; - SetGenMidi(genmidi.Data()+8); + ZMusic_SetGenMidi(genmidi.Data()+8); } static void SetupWgOpn() @@ -203,7 +203,7 @@ static void SetupWgOpn() return; } FMemLump data = Wads.ReadLump(lump); - SetWgOpn(data.GetMem(), (uint32_t)data.GetSize()); + ZMusic_SetWgOpn(data.GetMem(), (uint32_t)data.GetSize()); } static void SetupDMXGUS() @@ -214,7 +214,7 @@ static void SetupDMXGUS() return; } FMemLump data = Wads.ReadLump(lump); - SetDmxGus(data.GetMem(), (uint32_t)data.GetSize()); + ZMusic_SetDmxGus(data.GetMem(), (uint32_t)data.GetSize()); } @@ -249,9 +249,10 @@ void I_InitMusic (void) callbacks.OpenSoundFont = mus_openSoundFont; callbacks.DumbVorbisDecode = dumb_decode_vorbis_; - SetCallbacks(&callbacks); + ZMusic_SetCallbacks(&callbacks); SetupGenMidi(); SetupDMXGUS(); + SetupWgOpn(); } diff --git a/src/sound/s_music.cpp b/src/sound/s_music.cpp index fd344dcdd..76d287ad7 100644 --- a/src/sound/s_music.cpp +++ b/src/sound/s_music.cpp @@ -478,7 +478,7 @@ bool S_ChangeMusic (const char *musicname, int order, bool looping, bool force) id = strtoul (more+1, nullptr, 16); } S_StopMusic (true); - mus_playing.handle = I_RegisterCDSong (track, id); + mus_playing.handle = ZMusic_OpenCDSong (track, id); } else { @@ -542,7 +542,7 @@ bool S_ChangeMusic (const char *musicname, int order, bool looping, bool force) try { auto mreader = new FileReaderMusicInterface(reader); - mus_playing.handle = I_RegisterSong(mreader, devp? (EMidiDevice)devp->device : MDEV_DEFAULT, devp? devp->args.GetChars() : ""); + mus_playing.handle = ZMusic_OpenSong(mreader, devp? (EMidiDevice)devp->device : MDEV_DEFAULT, devp? devp->args.GetChars() : ""); } catch (const std::runtime_error& err) {