mirror of
https://github.com/ZDoom/ZMusic.git
synced 2025-02-07 08:01:14 +00:00
- added ZMusic_ prefixes to all declarations in the header.
This commit is contained in:
parent
fd518da5cd
commit
bba49323e3
20 changed files with 145 additions and 145 deletions
|
@ -14,46 +14,46 @@ typedef unsigned char zmusic_bool;
|
|||
// and should not be changed.
|
||||
typedef enum EZMusicMidiDeviceClass_
|
||||
{
|
||||
MIDIDEV_MIDIPORT = 1,
|
||||
MIDIDEV_SYNTH,
|
||||
MIDIDEV_SQSYNTH,
|
||||
MIDIDEV_FMSYNTH,
|
||||
MIDIDEV_MAPPER,
|
||||
MIDIDEV_WAVETABLE,
|
||||
MIDIDEV_SWSYNTH
|
||||
ZMUSIC_MIDIDEV_MIDIPORT = 1,
|
||||
ZMUSIC_MIDIDEV_SYNTH,
|
||||
ZMUSIC_MIDIDEV_SQSYNTH,
|
||||
ZMUSIC_MIDIDEV_FMSYNTH,
|
||||
ZMUSIC_MIDIDEV_MAPPER,
|
||||
ZMUSIC_MIDIDEV_WAVETABLE,
|
||||
ZMUSIC_MIDIDEV_SWSYNTH
|
||||
} EZMusicMidiDeviceClass;
|
||||
|
||||
typedef enum EZMusicMIDIType_
|
||||
typedef enum EZMusicMidiType_
|
||||
{
|
||||
MIDI_NOTMIDI,
|
||||
MIDI_MIDI,
|
||||
MIDI_HMI,
|
||||
MIDI_XMI,
|
||||
MIDI_MUS
|
||||
} EZMusicMIDIType;
|
||||
ZMUSIC_MIDI_NOTMIDI,
|
||||
ZMUSIC_MIDI_MIDI,
|
||||
ZMUSIC_MIDI_HMI,
|
||||
ZMUSIC_MIDI_XMI,
|
||||
ZMUSIC_MIDI_MUS
|
||||
} EZMusicMidiType;
|
||||
|
||||
typedef enum EZMusicMidiDevice_
|
||||
{
|
||||
MDEV_DEFAULT = -1,
|
||||
MDEV_STANDARD = 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,
|
||||
ZMUSIC_MDEV_DEFAULT = -1,
|
||||
ZMUSIC_MDEV_STANDARD = 0,
|
||||
ZMUSIC_MDEV_OPL = 1,
|
||||
ZMUSIC_MDEV_SNDSYS = 2,
|
||||
ZMUSIC_MDEV_TIMIDITY = 3,
|
||||
ZMUSIC_MDEV_FLUIDSYNTH = 4,
|
||||
ZMUSIC_MDEV_GUS = 5,
|
||||
ZMUSIC_MDEV_WILDMIDI = 6,
|
||||
ZMUSIC_MDEV_ADL = 7,
|
||||
ZMUSIC_MDEV_OPN = 8,
|
||||
|
||||
MDEV_COUNT
|
||||
ZMUSIC_MDEV_COUNT
|
||||
} EZMusicMidiDevice;
|
||||
|
||||
typedef enum EZMusicSoundFontTypes_
|
||||
{
|
||||
SF_SF2 = 1,
|
||||
SF_GUS = 2,
|
||||
SF_WOPL = 4,
|
||||
SF_WOPN = 8
|
||||
ZMUSIC_SF_SF2 = 1,
|
||||
ZMUSIC_SF_GUS = 2,
|
||||
ZMUSIC_SF_WOPL = 4,
|
||||
ZMUSIC_SF_WOPN = 8
|
||||
} EZMusicSoundFontTypes;
|
||||
|
||||
typedef struct ZMusicSoundStreamInfo_
|
||||
|
@ -294,8 +294,8 @@ extern "C"
|
|||
ZMUSIC_DLL_IMPORT const ZMusicConfigurationSetting* ZMusic_GetConfiguration();
|
||||
|
||||
// These exports are needed by the MIDI dumpers which need to remain on the client side because the need access to the client's file system.
|
||||
ZMUSIC_DLL_IMPORT EZMusicMIDIType ZMusic_IdentifyMIDIType(uint32_t* id, int size);
|
||||
ZMUSIC_DLL_IMPORT ZMusic_MidiSource ZMusic_CreateMIDISource(const uint8_t* data, size_t length, EZMusicMIDIType miditype);
|
||||
ZMUSIC_DLL_IMPORT EZMusicMidiType ZMusic_IdentifyMIDIType(uint32_t* id, int size);
|
||||
ZMUSIC_DLL_IMPORT ZMusic_MidiSource ZMusic_CreateMIDISource(const uint8_t* data, size_t length, EZMusicMidiType miditype);
|
||||
ZMUSIC_DLL_IMPORT zmusic_bool ZMusic_MIDIDumpWave(ZMusic_MidiSource source, EZMusicMidiDevice devtype, const char* devarg, const char* outname, int subsong, int samplerate);
|
||||
|
||||
ZMUSIC_DLL_IMPORT ZMusic_MusicStream ZMusic_OpenSong(ZMusicCustomReader* reader, EZMusicMidiDevice device, const char* Args);
|
||||
|
@ -383,8 +383,8 @@ typedef void (*pfn_ZMusic_SetGenMidi)(const uint8_t* data);
|
|||
typedef void (*pfn_ZMusic_SetWgOpn)(const void* data, unsigned len);
|
||||
typedef void (*pfn_ZMusic_SetDmxGus)(const void* data, unsigned len);
|
||||
typedef const ZMusicConfigurationSetting* (*pfn_ZMusic_GetConfiguration)();
|
||||
typedef EZMusicMIDIType (*pfn_ZMusic_IdentifyMIDIType)(uint32_t* id, int size);
|
||||
typedef ZMusic_MidiSource (*pfn_ZMusic_CreateMIDISource)(const uint8_t* data, size_t length, EZMusicMIDIType miditype);
|
||||
typedef EZMusicMidiType (*pfn_ZMusic_IdentifyMIDIType)(uint32_t* id, int size);
|
||||
typedef ZMusic_MidiSource (*pfn_ZMusic_CreateMIDISource)(const uint8_t* data, size_t length, EZMusicMidiType miditype);
|
||||
typedef zmusic_bool (*pfn_ZMusic_MIDIDumpWave)(ZMusic_MidiSource source, EZMusicMidiDevice devtype, const char* devarg, const char* outname, int subsong, int samplerate);
|
||||
typedef ZMusic_MusicStream (*pfn_ZMusic_OpenSong)(ZMusicCustomReader* reader, EZMusicMidiDevice device, const char* Args);
|
||||
typedef ZMusic_MusicStream (*pfn_ZMusic_OpenSongFile)(const char *filename, EZMusicMidiDevice device, const char* Args);
|
||||
|
|
|
@ -49,7 +49,7 @@ public:
|
|||
virtual void ChangeSettingNum(const char *setting, double value);
|
||||
virtual void ChangeSettingString(const char *setting, const char *value);
|
||||
virtual std::string GetStats();
|
||||
virtual int GetDeviceType() const { return MDEV_DEFAULT; }
|
||||
virtual int GetDeviceType() const { return ZMUSIC_MDEV_DEFAULT; }
|
||||
virtual bool CanHandleSysex() const { return true; }
|
||||
virtual ZMusicSoundStreamInfo GetStreamInfo() const;
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ public:
|
|||
~ADLMIDIDevice();
|
||||
|
||||
int OpenRenderer() override;
|
||||
int GetDeviceType() const override { return MDEV_ADL; }
|
||||
int GetDeviceType() const override { return ZMUSIC_MDEV_ADL; }
|
||||
|
||||
protected:
|
||||
|
||||
|
@ -249,7 +249,7 @@ MIDIDevice *CreateADLMIDIDevice(const char *Args)
|
|||
const char* info;
|
||||
if (musicCallbacks.PathForSoundfont)
|
||||
{
|
||||
info = musicCallbacks.PathForSoundfont(bank, SF_WOPL);
|
||||
info = musicCallbacks.PathForSoundfont(bank, ZMUSIC_SF_WOPL);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -68,7 +68,7 @@ public:
|
|||
void ChangeSettingInt(const char *setting, int value) override;
|
||||
void ChangeSettingNum(const char *setting, double value) override;
|
||||
void ChangeSettingString(const char *setting, const char *value) override;
|
||||
int GetDeviceType() const override { return MDEV_FLUIDSYNTH; }
|
||||
int GetDeviceType() const override { return ZMUSIC_MDEV_FLUIDSYNTH; }
|
||||
|
||||
protected:
|
||||
void HandleEvent(int status, int parm1, int parm2) override;
|
||||
|
@ -590,7 +590,7 @@ void Fluid_SetupConfig(const char* patches, std::vector<std::string> &patch_path
|
|||
|
||||
if (musicCallbacks.PathForSoundfont)
|
||||
{
|
||||
auto info = musicCallbacks.PathForSoundfont(patches, SF_SF2);
|
||||
auto info = musicCallbacks.PathForSoundfont(patches, ZMUSIC_SF_SF2);
|
||||
if (info) patches = info;
|
||||
}
|
||||
|
||||
|
|
|
@ -75,7 +75,7 @@ protected:
|
|||
void HandleLongEvent(const uint8_t *data, int len) override;
|
||||
void ComputeOutput(float *buffer, int len) override;
|
||||
bool ServiceStream(void *buff, int numbytes) override;
|
||||
int GetDeviceType() const override { return MDEV_OPL; }
|
||||
int GetDeviceType() const override { return ZMUSIC_MDEV_OPL; }
|
||||
};
|
||||
|
||||
|
||||
|
@ -137,7 +137,7 @@ void OPLMIDIDevice::Close()
|
|||
|
||||
int OPLMIDIDevice::GetTechnology() const
|
||||
{
|
||||
return MIDIDEV_FMSYNTH;
|
||||
return ZMUSIC_MIDIDEV_FMSYNTH;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
|
|
@ -51,7 +51,7 @@ public:
|
|||
|
||||
|
||||
int OpenRenderer() override;
|
||||
int GetDeviceType() const override { return MDEV_OPN; }
|
||||
int GetDeviceType() const override { return ZMUSIC_MDEV_OPN; }
|
||||
|
||||
protected:
|
||||
void HandleEvent(int status, int parm1, int parm2) override;
|
||||
|
@ -240,7 +240,7 @@ MIDIDevice *CreateOPNMIDIDevice(const char *Args)
|
|||
{
|
||||
if (musicCallbacks.PathForSoundfont)
|
||||
{
|
||||
auto info = musicCallbacks.PathForSoundfont(bank, SF_WOPN);
|
||||
auto info = musicCallbacks.PathForSoundfont(bank, ZMUSIC_SF_WOPN);
|
||||
if (info != nullptr) bank = info;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -147,7 +147,7 @@ bool SoftSynthMIDIDevice::IsOpen() const
|
|||
|
||||
int SoftSynthMIDIDevice::GetTechnology() const
|
||||
{
|
||||
return MIDIDEV_SWSYNTH;
|
||||
return ZMUSIC_MIDIDEV_SWSYNTH;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
|
|
@ -78,7 +78,7 @@ public:
|
|||
|
||||
int OpenRenderer() override;
|
||||
void PrecacheInstruments(const uint16_t *instruments, int count) override;
|
||||
int GetDeviceType() const override { return MDEV_GUS; }
|
||||
int GetDeviceType() const override { return ZMUSIC_MDEV_GUS; }
|
||||
|
||||
protected:
|
||||
Timidity::Renderer *Renderer;
|
||||
|
@ -270,7 +270,7 @@ bool GUS_SetupConfig(const char* args)
|
|||
if (*args == 0) args = gusConfig.gus_config.c_str();
|
||||
if (stricmp(gusConfig.loadedConfig.c_str(), args) == 0) return false; // aleady loaded
|
||||
|
||||
MusicIO::SoundFontReaderInterface* reader = MusicIO::ClientOpenSoundFont(args, SF_GUS | SF_SF2);
|
||||
MusicIO::SoundFontReaderInterface* reader = MusicIO::ClientOpenSoundFont(args, ZMUSIC_SF_GUS | ZMUSIC_SF_SF2);
|
||||
if (!reader && MusicIO::fileExists(args))
|
||||
{
|
||||
auto f = MusicIO::utf8_fopen(args, "rb");
|
||||
|
|
|
@ -54,7 +54,7 @@ public:
|
|||
int OpenRenderer() override;
|
||||
void PrecacheInstruments(const uint16_t *instruments, int count) override;
|
||||
//std::string GetStats();
|
||||
int GetDeviceType() const override { return MDEV_TIMIDITY; }
|
||||
int GetDeviceType() const override { return ZMUSIC_MDEV_TIMIDITY; }
|
||||
|
||||
double test[3] = { 0, 0, 0 };
|
||||
|
||||
|
@ -201,7 +201,7 @@ bool Timidity_SetupConfig(const char* args)
|
|||
if (*args == 0) args = timidityConfig.timidity_config.c_str();
|
||||
if (stricmp(timidityConfig.loadedConfig.c_str(), args) == 0) return false; // aleady loaded
|
||||
|
||||
MusicIO::SoundFontReaderInterface* reader = MusicIO::ClientOpenSoundFont(args, SF_GUS | SF_SF2);
|
||||
MusicIO::SoundFontReaderInterface* reader = MusicIO::ClientOpenSoundFont(args, ZMUSIC_SF_GUS | ZMUSIC_SF_SF2);
|
||||
if (!reader && MusicIO::fileExists(args))
|
||||
{
|
||||
auto f = MusicIO::utf8_fopen(args, "rb");
|
||||
|
|
|
@ -58,7 +58,7 @@ public:
|
|||
int OpenRenderer() override;
|
||||
void PrecacheInstruments(const uint16_t *instruments, int count) override;
|
||||
std::string GetStats() override;
|
||||
int GetDeviceType() const override { return MDEV_WILDMIDI; }
|
||||
int GetDeviceType() const override { return ZMUSIC_MDEV_WILDMIDI; }
|
||||
|
||||
protected:
|
||||
WildMidi::Renderer *Renderer;
|
||||
|
@ -248,7 +248,7 @@ bool WildMidi_SetupConfig(const char* args)
|
|||
if (*args == 0) args = wildMidiConfig.config.c_str();
|
||||
if (stricmp(wildMidiConfig.loadedConfig.c_str(), args) == 0) return false; // aleady loaded
|
||||
|
||||
MusicIO::SoundFontReaderInterface* reader = MusicIO::ClientOpenSoundFont(args, SF_GUS);
|
||||
MusicIO::SoundFontReaderInterface* reader = MusicIO::ClientOpenSoundFont(args, ZMUSIC_SF_GUS);
|
||||
if (!reader && MusicIO::fileExists(args))
|
||||
{
|
||||
reader = new MusicIO::FileSystemSoundFontReader(args, true);
|
||||
|
|
|
@ -667,15 +667,15 @@ static bool IgnoreMIDIVolume(UINT id)
|
|||
|
||||
if (MMSYSERR_NOERROR == midiOutGetDevCapsA(id, &caps, sizeof(caps)))
|
||||
{
|
||||
if (caps.wTechnology == MIDIDEV_MAPPER)
|
||||
if (caps.wTechnology == ZMUSIC_MIDIDEV_MAPPER)
|
||||
{
|
||||
// We cannot determine what this is so we have to assume the worst, as the default
|
||||
// devive's volume control is irreparably broken.
|
||||
return true;
|
||||
}
|
||||
// The Microsoft GS Wavetable Synth advertises itself as MIDIDEV_SWSYNTH with a VOLUME control.
|
||||
// The Microsoft GS Wavetable Synth advertises itself as ZMUSIC_MIDIDEV_SWSYNTH with a VOLUME control.
|
||||
// If the one we're using doesn't match that, we don't need to bother checking the name.
|
||||
if (caps.wTechnology == MIDIDEV_SWSYNTH && (caps.dwSupport & MIDICAPS_VOLUME))
|
||||
if (caps.wTechnology == ZMUSIC_MIDIDEV_SWSYNTH && (caps.dwSupport & MIDICAPS_VOLUME))
|
||||
{
|
||||
if (strncmp(caps.szPname, "Microsoft GS", 12) == 0)
|
||||
{
|
||||
|
|
|
@ -302,7 +302,7 @@ void MIDISource::CreateSMF(std::vector<uint8_t> &file, int looplimit)
|
|||
uint8_t running_status = 255;
|
||||
|
||||
// Always create songs aimed at GM devices.
|
||||
CheckCaps(MIDIDEV_MIDIPORT);
|
||||
CheckCaps(ZMUSIC_MIDIDEV_MIDIPORT);
|
||||
LoopLimit = looplimit <= 0 ? EXPORT_LOOP_LIMIT : looplimit;
|
||||
DoRestart();
|
||||
StartPlayback(false, LoopLimit);
|
||||
|
@ -418,13 +418,13 @@ extern int MUSHeaderSearch(const uint8_t *head, int len);
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
DLL_EXPORT EZMusicMIDIType ZMusic_IdentifyMIDIType(uint32_t *id, int size)
|
||||
DLL_EXPORT EZMusicMidiType ZMusic_IdentifyMIDIType(uint32_t *id, int size)
|
||||
{
|
||||
// Check for MUS format
|
||||
// Tolerate sloppy wads by searching up to 32 bytes for the header
|
||||
if (MUSHeaderSearch((uint8_t*)id, size) >= 0)
|
||||
{
|
||||
return MIDI_MUS;
|
||||
return ZMUSIC_MIDI_MUS;
|
||||
}
|
||||
// Check for HMI format
|
||||
else
|
||||
|
@ -432,14 +432,14 @@ DLL_EXPORT EZMusicMIDIType ZMusic_IdentifyMIDIType(uint32_t *id, int size)
|
|||
id[1] == MAKE_ID('M','I','D','I') &&
|
||||
id[2] == MAKE_ID('S','O','N','G'))
|
||||
{
|
||||
return MIDI_HMI;
|
||||
return ZMUSIC_MIDI_HMI;
|
||||
}
|
||||
// Check for HMP format
|
||||
else
|
||||
if (id[0] == MAKE_ID('H','M','I','M') &&
|
||||
id[1] == MAKE_ID('I','D','I','P'))
|
||||
{
|
||||
return MIDI_HMI;
|
||||
return ZMUSIC_MIDI_HMI;
|
||||
}
|
||||
// Check for XMI format
|
||||
else
|
||||
|
@ -448,16 +448,16 @@ DLL_EXPORT EZMusicMIDIType ZMusic_IdentifyMIDIType(uint32_t *id, int size)
|
|||
((id[0] == MAKE_ID('C','A','T',' ') || id[0] == MAKE_ID('F','O','R','M')) &&
|
||||
id[2] == MAKE_ID('X','M','I','D')))
|
||||
{
|
||||
return MIDI_XMI;
|
||||
return ZMUSIC_MIDI_XMI;
|
||||
}
|
||||
// Check for MIDI format
|
||||
else if (id[0] == MAKE_ID('M','T','h','d'))
|
||||
{
|
||||
return MIDI_MIDI;
|
||||
return ZMUSIC_MIDI_MIDI;
|
||||
}
|
||||
else
|
||||
{
|
||||
return MIDI_NOTMIDI;
|
||||
return ZMUSIC_MIDI_NOTMIDI;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -467,26 +467,26 @@ DLL_EXPORT EZMusicMIDIType ZMusic_IdentifyMIDIType(uint32_t *id, int size)
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
DLL_EXPORT ZMusic_MidiSource ZMusic_CreateMIDISource(const uint8_t *data, size_t length, EZMusicMIDIType miditype)
|
||||
DLL_EXPORT ZMusic_MidiSource ZMusic_CreateMIDISource(const uint8_t *data, size_t length, EZMusicMidiType miditype)
|
||||
{
|
||||
try
|
||||
{
|
||||
MIDISource* source;
|
||||
switch (miditype)
|
||||
{
|
||||
case MIDI_MUS:
|
||||
case ZMUSIC_MIDI_MUS:
|
||||
source = new MUSSong2(data, length);
|
||||
break;
|
||||
|
||||
case MIDI_MIDI:
|
||||
case ZMUSIC_MIDI_MIDI:
|
||||
source = new MIDISong2(data, length);
|
||||
break;
|
||||
|
||||
case MIDI_HMI:
|
||||
case ZMUSIC_MIDI_HMI:
|
||||
source = new HMISong(data, length);
|
||||
break;
|
||||
|
||||
case MIDI_XMI:
|
||||
case ZMUSIC_MIDI_XMI:
|
||||
source = new XMISong(data, length);
|
||||
break;
|
||||
|
||||
|
|
|
@ -354,11 +354,11 @@ void HMISong::SetupForHMP(int len)
|
|||
void HMISong::CheckCaps(int tech)
|
||||
{
|
||||
// What's the equivalent HMI device for our technology?
|
||||
if (tech == MIDIDEV_FMSYNTH)
|
||||
if (tech == ZMUSIC_MIDIDEV_FMSYNTH)
|
||||
{
|
||||
tech = HMI_DEV_OPL3;
|
||||
}
|
||||
else if (tech == MIDIDEV_MIDIPORT)
|
||||
else if (tech == ZMUSIC_MIDIDEV_MIDIPORT)
|
||||
{
|
||||
tech = HMI_DEV_MPU401;
|
||||
}
|
||||
|
|
|
@ -181,11 +181,11 @@ MIDISong2::MIDISong2 (const uint8_t* data, size_t len)
|
|||
void MIDISong2::CheckCaps(int tech)
|
||||
{
|
||||
DesignationMask = 0xFF0F;
|
||||
if (tech == MIDIDEV_FMSYNTH)
|
||||
if (tech == ZMUSIC_MIDIDEV_FMSYNTH)
|
||||
{
|
||||
DesignationMask = 0x00F0;
|
||||
}
|
||||
else if (tech == MIDIDEV_MIDIPORT)
|
||||
else if (tech == ZMUSIC_MIDIDEV_MIDIPORT)
|
||||
{
|
||||
DesignationMask = 0x0001;
|
||||
}
|
||||
|
|
|
@ -85,7 +85,7 @@ void CDSong::Pause ()
|
|||
{
|
||||
if (m_Status == STATE_Playing)
|
||||
{
|
||||
CD_Pause ();
|
||||
ZMusic_CD_Pause ();
|
||||
m_Status = STATE_Paused;
|
||||
}
|
||||
}
|
||||
|
@ -94,7 +94,7 @@ void CDSong::Resume ()
|
|||
{
|
||||
if (m_Status == STATE_Paused)
|
||||
{
|
||||
if (CD_Resume ())
|
||||
if (ZMusic_CD_Resume ())
|
||||
m_Status = STATE_Playing;
|
||||
}
|
||||
}
|
||||
|
@ -104,7 +104,7 @@ void CDSong::Stop ()
|
|||
if (m_Status != STATE_Stopped)
|
||||
{
|
||||
m_Status = STATE_Stopped;
|
||||
CD_Stop ();
|
||||
ZMusic_CD_Stop ();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -219,25 +219,25 @@ EZMusicMidiDevice MIDIStreamer::SelectMIDIDevice(EZMusicMidiDevice device)
|
|||
*/
|
||||
|
||||
// Choose the type of MIDI device we want.
|
||||
if (device != MDEV_DEFAULT)
|
||||
if (device != ZMUSIC_MDEV_DEFAULT)
|
||||
{
|
||||
return device;
|
||||
}
|
||||
switch (miscConfig.snd_mididevice)
|
||||
{
|
||||
case -1: return MDEV_SNDSYS;
|
||||
case -2: return MDEV_TIMIDITY;
|
||||
case -3: return MDEV_OPL;
|
||||
case -4: return MDEV_GUS;
|
||||
case -5: return MDEV_FLUIDSYNTH;
|
||||
case -6: return MDEV_WILDMIDI;
|
||||
case -7: return MDEV_ADL;
|
||||
case -8: return MDEV_OPN;
|
||||
case -1: return ZMUSIC_MDEV_SNDSYS;
|
||||
case -2: return ZMUSIC_MDEV_TIMIDITY;
|
||||
case -3: return ZMUSIC_MDEV_OPL;
|
||||
case -4: return ZMUSIC_MDEV_GUS;
|
||||
case -5: return ZMUSIC_MDEV_FLUIDSYNTH;
|
||||
case -6: return ZMUSIC_MDEV_WILDMIDI;
|
||||
case -7: return ZMUSIC_MDEV_ADL;
|
||||
case -8: return ZMUSIC_MDEV_OPN;
|
||||
default:
|
||||
#ifdef HAVE_SYSTEM_MIDI
|
||||
return MDEV_STANDARD;
|
||||
return ZMUSIC_MDEV_STANDARD;
|
||||
#else
|
||||
return MDEV_SNDSYS;
|
||||
return ZMUSIC_MDEV_SNDSYS;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
@ -252,10 +252,10 @@ static EZMusicMidiDevice lastRequestedDevice, lastSelectedDevice;
|
|||
|
||||
MIDIDevice *MIDIStreamer::CreateMIDIDevice(EZMusicMidiDevice devtype, int samplerate)
|
||||
{
|
||||
bool checked[MDEV_COUNT] = { false };
|
||||
bool checked[ZMUSIC_MDEV_COUNT] = { false };
|
||||
|
||||
MIDIDevice *dev = nullptr;
|
||||
if (devtype == MDEV_SNDSYS) devtype = MDEV_FLUIDSYNTH;
|
||||
if (devtype == ZMUSIC_MDEV_SNDSYS) devtype = ZMUSIC_MDEV_FLUIDSYNTH;
|
||||
EZMusicMidiDevice requestedDevice = devtype, selectedDevice;
|
||||
while (dev == nullptr)
|
||||
{
|
||||
|
@ -264,19 +264,19 @@ MIDIDevice *MIDIStreamer::CreateMIDIDevice(EZMusicMidiDevice devtype, int sample
|
|||
{
|
||||
switch (devtype)
|
||||
{
|
||||
case MDEV_GUS:
|
||||
case ZMUSIC_MDEV_GUS:
|
||||
dev = CreateTimidityMIDIDevice(Args.c_str(), samplerate);
|
||||
break;
|
||||
|
||||
case MDEV_ADL:
|
||||
case ZMUSIC_MDEV_ADL:
|
||||
dev = CreateADLMIDIDevice(Args.c_str());
|
||||
break;
|
||||
|
||||
case MDEV_OPN:
|
||||
case ZMUSIC_MDEV_OPN:
|
||||
dev = CreateOPNMIDIDevice(Args.c_str());
|
||||
break;
|
||||
|
||||
case MDEV_STANDARD:
|
||||
case ZMUSIC_MDEV_STANDARD:
|
||||
|
||||
#ifdef HAVE_SYSTEM_MIDI
|
||||
#ifdef _WIN32
|
||||
|
@ -288,19 +288,19 @@ MIDIDevice *MIDIStreamer::CreateMIDIDevice(EZMusicMidiDevice devtype, int sample
|
|||
#endif
|
||||
// Intentional fall-through for systems without standard midi support
|
||||
|
||||
case MDEV_FLUIDSYNTH:
|
||||
case ZMUSIC_MDEV_FLUIDSYNTH:
|
||||
dev = CreateFluidSynthMIDIDevice(samplerate, Args.c_str());
|
||||
break;
|
||||
|
||||
case MDEV_OPL:
|
||||
case ZMUSIC_MDEV_OPL:
|
||||
dev = CreateOplMIDIDevice(Args.c_str());
|
||||
break;
|
||||
|
||||
case MDEV_TIMIDITY:
|
||||
case ZMUSIC_MDEV_TIMIDITY:
|
||||
dev = CreateTimidityPPMIDIDevice(Args.c_str(), samplerate);
|
||||
break;
|
||||
|
||||
case MDEV_WILDMIDI:
|
||||
case ZMUSIC_MDEV_WILDMIDI:
|
||||
dev = CreateWildMIDIDevice(Args.c_str(), samplerate);
|
||||
break;
|
||||
|
||||
|
@ -312,20 +312,20 @@ MIDIDevice *MIDIStreamer::CreateMIDIDevice(EZMusicMidiDevice devtype, int sample
|
|||
{
|
||||
//DPrintf(DMSG_WARNING, "%s\n", err.what());
|
||||
checked[devtype] = true;
|
||||
devtype = MDEV_DEFAULT;
|
||||
devtype = ZMUSIC_MDEV_DEFAULT;
|
||||
// Opening the requested device did not work out so choose another one.
|
||||
if (!checked[MDEV_FLUIDSYNTH]) devtype = MDEV_FLUIDSYNTH;
|
||||
else if (!checked[MDEV_TIMIDITY]) devtype = MDEV_TIMIDITY;
|
||||
else if (!checked[MDEV_WILDMIDI]) devtype = MDEV_WILDMIDI;
|
||||
else if (!checked[MDEV_GUS]) devtype = MDEV_GUS;
|
||||
if (!checked[ZMUSIC_MDEV_FLUIDSYNTH]) devtype = ZMUSIC_MDEV_FLUIDSYNTH;
|
||||
else if (!checked[ZMUSIC_MDEV_TIMIDITY]) devtype = ZMUSIC_MDEV_TIMIDITY;
|
||||
else if (!checked[ZMUSIC_MDEV_WILDMIDI]) devtype = ZMUSIC_MDEV_WILDMIDI;
|
||||
else if (!checked[ZMUSIC_MDEV_GUS]) devtype = ZMUSIC_MDEV_GUS;
|
||||
#ifdef HAVE_SYSTEM_MIDI
|
||||
else if (!checked[MDEV_STANDARD]) devtype = MDEV_STANDARD;
|
||||
else if (!checked[ZMUSIC_MDEV_STANDARD]) devtype = ZMUSIC_MDEV_STANDARD;
|
||||
#endif
|
||||
else if (!checked[MDEV_ADL]) devtype = MDEV_ADL;
|
||||
else if (!checked[MDEV_OPN]) devtype = MDEV_OPN;
|
||||
else if (!checked[MDEV_OPL]) devtype = MDEV_OPL;
|
||||
else if (!checked[ZMUSIC_MDEV_ADL]) devtype = ZMUSIC_MDEV_ADL;
|
||||
else if (!checked[ZMUSIC_MDEV_OPN]) devtype = ZMUSIC_MDEV_OPN;
|
||||
else if (!checked[ZMUSIC_MDEV_OPL]) devtype = ZMUSIC_MDEV_OPL;
|
||||
|
||||
if (devtype == MDEV_DEFAULT)
|
||||
if (devtype == ZMUSIC_MDEV_DEFAULT)
|
||||
{
|
||||
std::string message = std::string(err.what()) + "\n\nFailed to play music: Unable to open any MIDI Device.";
|
||||
throw std::runtime_error(message);
|
||||
|
@ -387,7 +387,7 @@ bool MIDIStreamer::DumpWave(const char *filename, int subsong, int samplerate)
|
|||
|
||||
assert(MIDI == NULL);
|
||||
auto devtype = SelectMIDIDevice(DeviceType);
|
||||
if (devtype == MDEV_STANDARD)
|
||||
if (devtype == ZMUSIC_MDEV_STANDARD)
|
||||
{
|
||||
throw std::runtime_error("System MIDI device is not supported");
|
||||
}
|
||||
|
|
|
@ -55,7 +55,7 @@ struct Dummy
|
|||
void ChangeSettingString(const char*, const char*) {}
|
||||
};
|
||||
|
||||
#define devType() ((currSong)? (currSong)->GetDeviceType() : MDEV_DEFAULT)
|
||||
#define devType() ((currSong)? (currSong)->GetDeviceType() : ZMUSIC_MDEV_DEFAULT)
|
||||
|
||||
|
||||
MiscConfig miscConfig;
|
||||
|
@ -184,25 +184,25 @@ struct MidiDeviceList
|
|||
void Build()
|
||||
{
|
||||
#ifdef HAVE_OPN
|
||||
devices.push_back({ strdup("libOPN"), -8, MIDIDEV_FMSYNTH });
|
||||
devices.push_back({ strdup("libOPN"), -8, ZMUSIC_MIDIDEV_FMSYNTH });
|
||||
#endif
|
||||
#ifdef HAVE_ADL
|
||||
devices.push_back({ strdup("libADL"), -7, MIDIDEV_FMSYNTH });
|
||||
devices.push_back({ strdup("libADL"), -7, ZMUSIC_MIDIDEV_FMSYNTH });
|
||||
#endif
|
||||
#ifdef HAVE_WILDMIDI
|
||||
devices.push_back({ strdup("WildMidi"), -6, MIDIDEV_SWSYNTH });
|
||||
devices.push_back({ strdup("WildMidi"), -6, ZMUSIC_MIDIDEV_SWSYNTH });
|
||||
#endif
|
||||
#ifdef HAVE_FLUIDSYNTH
|
||||
devices.push_back({ strdup("FluidSynth"), -5, MIDIDEV_SWSYNTH });
|
||||
devices.push_back({ strdup("FluidSynth"), -5, ZMUSIC_MIDIDEV_SWSYNTH });
|
||||
#endif
|
||||
#ifdef HAVE_GUS
|
||||
devices.push_back({ strdup("GUS Emulation"), -4, MIDIDEV_SWSYNTH });
|
||||
devices.push_back({ strdup("GUS Emulation"), -4, ZMUSIC_MIDIDEV_SWSYNTH });
|
||||
#endif
|
||||
#ifdef HAVE_OPL
|
||||
devices.push_back({ strdup("OPL Synth Emulation"), -3, MIDIDEV_FMSYNTH });
|
||||
devices.push_back({ strdup("OPL Synth Emulation"), -3, ZMUSIC_MIDIDEV_FMSYNTH });
|
||||
#endif
|
||||
#ifdef HAVE_TIMIDITY
|
||||
devices.push_back({ strdup("TiMidity++"), -2, MIDIDEV_SWSYNTH });
|
||||
devices.push_back({ strdup("TiMidity++"), -2, ZMUSIC_MIDIDEV_SWSYNTH });
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYSTEM_MIDI
|
||||
|
@ -212,7 +212,7 @@ struct MidiDeviceList
|
|||
auto& dev = sequencer.GetInternalDevices();
|
||||
for (auto& d : dev)
|
||||
{
|
||||
ZMusicMidiOutDevice mdev = { strdup(d.Name.c_str()), d.ID, MIDIDEV_MAPPER }; // fixme: Correctly determine the type of the device.
|
||||
ZMusicMidiOutDevice mdev = { strdup(d.Name.c_str()), d.ID, ZMUSIC_MIDIDEV_MAPPER }; // fixme: Correctly determine the type of the device.
|
||||
devices.push_back(mdev);
|
||||
}
|
||||
#elif _WIN32
|
||||
|
@ -330,31 +330,31 @@ DLL_EXPORT zmusic_bool ChangeMusicSettingInt(EZMusicIntConfigKey key, MusInfo *c
|
|||
#ifdef HAVE_ADL
|
||||
case zmusic_adl_chips_count:
|
||||
ChangeAndReturn(adlConfig.adl_chips_count, value, pRealValue);
|
||||
return devType() == MDEV_ADL;
|
||||
return devType() == ZMUSIC_MDEV_ADL;
|
||||
|
||||
case zmusic_adl_emulator_id:
|
||||
ChangeAndReturn(adlConfig.adl_emulator_id, value, pRealValue);
|
||||
return devType() == MDEV_ADL;
|
||||
return devType() == ZMUSIC_MDEV_ADL;
|
||||
|
||||
case zmusic_adl_run_at_pcm_rate:
|
||||
ChangeAndReturn(adlConfig.adl_run_at_pcm_rate, value, pRealValue);
|
||||
return devType() == MDEV_ADL;
|
||||
return devType() == ZMUSIC_MDEV_ADL;
|
||||
|
||||
case zmusic_adl_fullpan:
|
||||
ChangeAndReturn(adlConfig.adl_fullpan, value, pRealValue);
|
||||
return devType() == MDEV_ADL;
|
||||
return devType() == ZMUSIC_MDEV_ADL;
|
||||
|
||||
case zmusic_adl_bank:
|
||||
ChangeAndReturn(adlConfig.adl_bank, value, pRealValue);
|
||||
return devType() == MDEV_ADL;
|
||||
return devType() == ZMUSIC_MDEV_ADL;
|
||||
|
||||
case zmusic_adl_use_custom_bank:
|
||||
ChangeAndReturn(adlConfig.adl_use_custom_bank, value, pRealValue);
|
||||
return devType() == MDEV_ADL;
|
||||
return devType() == ZMUSIC_MDEV_ADL;
|
||||
|
||||
case zmusic_adl_volume_model:
|
||||
ChangeAndReturn(adlConfig.adl_volume_model, value, pRealValue);
|
||||
return devType() == MDEV_ADL;
|
||||
return devType() == ZMUSIC_MDEV_ADL;
|
||||
#endif
|
||||
|
||||
case zmusic_fluid_reverb:
|
||||
|
@ -460,7 +460,7 @@ DLL_EXPORT zmusic_bool ChangeMusicSettingInt(EZMusicIntConfigKey key, MusInfo *c
|
|||
if (value < 0) value = 0;
|
||||
else if (value > 3) value = 3;
|
||||
ChangeAndReturn(oplConfig.core, value, pRealValue);
|
||||
return devType() == MDEV_OPL;
|
||||
return devType() == ZMUSIC_MDEV_OPL;
|
||||
|
||||
case zmusic_opl_fullpan:
|
||||
ChangeAndReturn(oplConfig.fullpan, value, pRealValue);
|
||||
|
@ -469,36 +469,36 @@ DLL_EXPORT zmusic_bool ChangeMusicSettingInt(EZMusicIntConfigKey key, MusInfo *c
|
|||
#ifdef HAVE_OPN
|
||||
case zmusic_opn_chips_count:
|
||||
ChangeAndReturn(opnConfig.opn_chips_count, value, pRealValue);
|
||||
return devType() == MDEV_OPN;
|
||||
return devType() == ZMUSIC_MDEV_OPN;
|
||||
|
||||
case zmusic_opn_emulator_id:
|
||||
ChangeAndReturn(opnConfig.opn_emulator_id, value, pRealValue);
|
||||
return devType() == MDEV_OPN;
|
||||
return devType() == ZMUSIC_MDEV_OPN;
|
||||
|
||||
case zmusic_opn_run_at_pcm_rate:
|
||||
ChangeAndReturn(opnConfig.opn_run_at_pcm_rate, value, pRealValue);
|
||||
return devType() == MDEV_OPN;
|
||||
return devType() == ZMUSIC_MDEV_OPN;
|
||||
|
||||
case zmusic_opn_fullpan:
|
||||
ChangeAndReturn(opnConfig.opn_fullpan, value, pRealValue);
|
||||
return devType() == MDEV_OPN;
|
||||
return devType() == ZMUSIC_MDEV_OPN;
|
||||
|
||||
case zmusic_opn_use_custom_bank:
|
||||
ChangeAndReturn(opnConfig.opn_use_custom_bank, value, pRealValue);
|
||||
return devType() == MDEV_OPN;
|
||||
return devType() == ZMUSIC_MDEV_OPN;
|
||||
#endif
|
||||
#ifdef HAVE_GUS
|
||||
case zmusic_gus_dmxgus:
|
||||
ChangeAndReturn(gusConfig.gus_dmxgus, value, pRealValue);
|
||||
return devType() == MDEV_GUS;
|
||||
return devType() == ZMUSIC_MDEV_GUS;
|
||||
|
||||
case zmusic_gus_midi_voices:
|
||||
ChangeAndReturn(gusConfig.midi_voices, value, pRealValue);
|
||||
return devType() == MDEV_GUS;
|
||||
return devType() == ZMUSIC_MDEV_GUS;
|
||||
|
||||
case zmusic_gus_memsize:
|
||||
ChangeAndReturn(gusConfig.gus_memsize, value, pRealValue);
|
||||
return devType() == MDEV_GUS && gusConfig.gus_dmxgus;
|
||||
return devType() == ZMUSIC_MDEV_GUS && gusConfig.gus_dmxgus;
|
||||
#endif
|
||||
#ifdef HAVE_TIMIDITY
|
||||
case zmusic_timidity_modulation_wheel:
|
||||
|
@ -533,7 +533,7 @@ DLL_EXPORT zmusic_bool ChangeMusicSettingInt(EZMusicIntConfigKey key, MusInfo *c
|
|||
case zmusic_timidity_surround_chorus:
|
||||
ChangeVarSync(TimidityPlus::timidity_surround_chorus, value);
|
||||
if (pRealValue) *pRealValue = value;
|
||||
return devType() == MDEV_TIMIDITY;
|
||||
return devType() == ZMUSIC_MDEV_TIMIDITY;
|
||||
|
||||
case zmusic_timidity_channel_pressure:
|
||||
ChangeVarSync(TimidityPlus::timidity_channel_pressure, value);
|
||||
|
@ -553,7 +553,7 @@ DLL_EXPORT zmusic_bool ChangeMusicSettingInt(EZMusicIntConfigKey key, MusInfo *c
|
|||
case zmusic_timidity_modulation_envelope:
|
||||
ChangeVarSync(TimidityPlus::timidity_modulation_envelope, value);
|
||||
if (pRealValue) *pRealValue = value;
|
||||
return devType() == MDEV_TIMIDITY;
|
||||
return devType() == ZMUSIC_MDEV_TIMIDITY;
|
||||
|
||||
case zmusic_timidity_overlap_voice_allow:
|
||||
ChangeVarSync(TimidityPlus::timidity_overlap_voice_allow, value);
|
||||
|
@ -815,7 +815,7 @@ DLL_EXPORT zmusic_bool ChangeMusicSettingString(EZMusicStringConfigKey key, MusI
|
|||
#ifdef HAVE_ADL
|
||||
case zmusic_adl_custom_bank:
|
||||
adlConfig.adl_custom_bank = value;
|
||||
return devType() == MDEV_ADL;
|
||||
return devType() == ZMUSIC_MDEV_ADL;
|
||||
#endif
|
||||
case zmusic_fluid_lib:
|
||||
fluidConfig.fluid_lib = value;
|
||||
|
@ -826,32 +826,32 @@ DLL_EXPORT zmusic_bool ChangeMusicSettingString(EZMusicStringConfigKey key, MusI
|
|||
#ifdef HAVE_TIMIDITY
|
||||
if (timidityConfig.timidity_config.empty()) timidityConfig.timidity_config = value; // Also use for Timidity++ if nothing has been set.
|
||||
#endif
|
||||
return devType() == MDEV_FLUIDSYNTH;
|
||||
return devType() == ZMUSIC_MDEV_FLUIDSYNTH;
|
||||
|
||||
#ifdef HAVE_OPN
|
||||
case zmusic_opn_custom_bank:
|
||||
opnConfig.opn_custom_bank = value;
|
||||
return devType() == MDEV_OPN && opnConfig.opn_use_custom_bank;
|
||||
return devType() == ZMUSIC_MDEV_OPN && opnConfig.opn_use_custom_bank;
|
||||
#endif
|
||||
#ifdef HAVE_GUS
|
||||
case zmusic_gus_config:
|
||||
gusConfig.gus_config = value;
|
||||
return devType() == MDEV_GUS;
|
||||
return devType() == ZMUSIC_MDEV_GUS;
|
||||
#endif
|
||||
#ifdef HAVE_GUS
|
||||
case zmusic_gus_patchdir:
|
||||
gusConfig.gus_patchdir = value;
|
||||
return devType() == MDEV_GUS && gusConfig.gus_dmxgus;
|
||||
return devType() == ZMUSIC_MDEV_GUS && gusConfig.gus_dmxgus;
|
||||
#endif
|
||||
#ifdef HAVE_TIMIDITY
|
||||
case zmusic_timidity_config:
|
||||
timidityConfig.timidity_config = value;
|
||||
return devType() == MDEV_TIMIDITY;
|
||||
return devType() == ZMUSIC_MDEV_TIMIDITY;
|
||||
#endif
|
||||
#ifdef HAVE_WILDMIDI
|
||||
case zmusic_wildmidi_config:
|
||||
wildMidiConfig.config = value;
|
||||
return devType() == MDEV_TIMIDITY;
|
||||
return devType() == ZMUSIC_MDEV_TIMIDITY;
|
||||
#endif
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -24,7 +24,7 @@ public:
|
|||
virtual bool SetPosition(unsigned int ms) { return false; }
|
||||
virtual bool SetSubsong (int subsong) { return false; }
|
||||
virtual void Update() {}
|
||||
virtual int GetDeviceType() const { return MDEV_DEFAULT; } // MDEV_DEFAULT stands in for anything that cannot change playback parameters which needs a restart.
|
||||
virtual int GetDeviceType() const { return ZMUSIC_MDEV_DEFAULT; } // ZMUSIC_MDEV_DEFAULT stands in for anything that cannot change playback parameters which needs a restart.
|
||||
virtual std::string GetStats() { return "No stats available for this song"; }
|
||||
virtual MusInfo* GetWaveDumper(const char* filename, int rate) { return nullptr; }
|
||||
virtual void ChangeSettingInt(const char* setting, int value) {} // FluidSynth settings
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
struct SoundDecoder
|
||||
{
|
||||
static SoundDecoder* CreateDecoder(MusicIO::FileInterface* reader);
|
||||
static SoundDecoder* ZMusic_CreateDecoder(MusicIO::FileInterface* reader);
|
||||
|
||||
virtual void getInfo(int *samplerate, EZMusicChannelConfig *chans, EZMusicSampleType *type) = 0;
|
||||
|
||||
|
|
|
@ -193,8 +193,8 @@ static MusInfo *ZMusic_OpenSongInternal (MusicIO::FileInterface *reader, EZMusi
|
|||
}
|
||||
}
|
||||
|
||||
EZMusicMIDIType miditype = ZMusic_IdentifyMIDIType(id, sizeof(id));
|
||||
if (miditype != MIDI_NOTMIDI)
|
||||
EZMusicMidiType miditype = ZMusic_IdentifyMIDIType(id, sizeof(id));
|
||||
if (miditype != ZMUSIC_MIDI_NOTMIDI)
|
||||
{
|
||||
std::vector<uint8_t> data(reader->filelength());
|
||||
if (reader->read(data.data(), (long)data.size()) != (long)data.size())
|
||||
|
@ -217,9 +217,9 @@ static MusInfo *ZMusic_OpenSongInternal (MusicIO::FileInterface *reader, EZMusi
|
|||
}
|
||||
|
||||
#ifndef HAVE_SYSTEM_MIDI
|
||||
// some platforms don't support MDEV_STANDARD so map to MDEV_SNDSYS
|
||||
if (device == MDEV_STANDARD)
|
||||
device = MDEV_SNDSYS;
|
||||
// some platforms don't support ZMUSIC_MDEV_STANDARD so map to ZMUSIC_MDEV_SNDSYS
|
||||
if (device == ZMUSIC_MDEV_STANDARD)
|
||||
device = ZMUSIC_MDEV_SNDSYS;
|
||||
#endif
|
||||
|
||||
info = CreateMIDIStreamer(source, device, Args? Args : "");
|
||||
|
|
Loading…
Reference in a new issue