- renamed a few functions in the public interface of ZMusic.

This commit is contained in:
Christoph Oelckers 2019-09-30 02:40:22 +02:00
parent 02507effe8
commit 2bc72f38cc
6 changed files with 20 additions and 19 deletions

View file

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

View file

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

View file

@ -148,7 +148,7 @@ static bool ungzip(uint8_t *data, int complen, std::vector<uint8_t> &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);

View file

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

View file

@ -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();
}

View file

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