- renamed several structs and enums to contain a ZMusic prefix.

This commit is contained in:
Christoph Oelckers 2020-02-16 10:43:52 +01:00
parent 9097591879
commit fd518da5cd
23 changed files with 137 additions and 137 deletions

View file

@ -12,7 +12,7 @@ typedef unsigned char zmusic_bool;
// These constants must match the corresponding values of the Windows headers // These constants must match the corresponding values of the Windows headers
// to avoid readjustment in the native Windows device's playback functions // to avoid readjustment in the native Windows device's playback functions
// and should not be changed. // and should not be changed.
typedef enum EMidiDeviceClass_ typedef enum EZMusicMidiDeviceClass_
{ {
MIDIDEV_MIDIPORT = 1, MIDIDEV_MIDIPORT = 1,
MIDIDEV_SYNTH, MIDIDEV_SYNTH,
@ -21,18 +21,18 @@ typedef enum EMidiDeviceClass_
MIDIDEV_MAPPER, MIDIDEV_MAPPER,
MIDIDEV_WAVETABLE, MIDIDEV_WAVETABLE,
MIDIDEV_SWSYNTH MIDIDEV_SWSYNTH
} EMidiDeviceClass; } EZMusicMidiDeviceClass;
typedef enum EMIDIType_ typedef enum EZMusicMIDIType_
{ {
MIDI_NOTMIDI, MIDI_NOTMIDI,
MIDI_MIDI, MIDI_MIDI,
MIDI_HMI, MIDI_HMI,
MIDI_XMI, MIDI_XMI,
MIDI_MUS MIDI_MUS
} EMIDIType; } EZMusicMIDIType;
typedef enum EMidiDevice_ typedef enum EZMusicMidiDevice_
{ {
MDEV_DEFAULT = -1, MDEV_DEFAULT = -1,
MDEV_STANDARD = 0, MDEV_STANDARD = 0,
@ -46,36 +46,36 @@ typedef enum EMidiDevice_
MDEV_OPN = 8, MDEV_OPN = 8,
MDEV_COUNT MDEV_COUNT
} EMidiDevice; } EZMusicMidiDevice;
typedef enum ESoundFontTypes_ typedef enum EZMusicSoundFontTypes_
{ {
SF_SF2 = 1, SF_SF2 = 1,
SF_GUS = 2, SF_GUS = 2,
SF_WOPL = 4, SF_WOPL = 4,
SF_WOPN = 8 SF_WOPN = 8
} ESoundFontTypes; } EZMusicSoundFontTypes;
typedef struct SoundStreamInfo_ typedef struct ZMusicSoundStreamInfo_
{ {
int mBufferSize; // If mBufferSize is 0, the song doesn't use streaming but plays through a different interface. int mBufferSize; // If mBufferSize is 0, the song doesn't use streaming but plays through a different interface.
int mSampleRate; int mSampleRate;
int mNumChannels; // If mNumChannels is negative, 16 bit integer format is used instead of floating point. int mNumChannels; // If mNumChannels is negative, 16 bit integer format is used instead of floating point.
} SoundStreamInfo; } ZMusicSoundStreamInfo;
typedef enum SampleType_ typedef enum EZMusicSampleType_
{ {
SampleType_UInt8, SampleType_UInt8,
SampleType_Int16 SampleType_Int16
} SampleType; } EZMusicSampleType;
typedef enum ChannelConfig_ typedef enum EZMusicChannelConfig_
{ {
ChannelConfig_Mono, ChannelConfig_Mono,
ChannelConfig_Stereo ChannelConfig_Stereo
} ChannelConfig; } EZMusicChannelConfig;
typedef enum EIntConfigKey_ typedef enum EZMusicIntConfigKey_
{ {
zmusic_adl_chips_count, zmusic_adl_chips_count,
zmusic_adl_emulator_id, zmusic_adl_emulator_id,
@ -142,9 +142,9 @@ typedef enum EIntConfigKey_
zmusic_snd_outputrate, zmusic_snd_outputrate,
NUM_ZMUSIC_INT_CONFIGS NUM_ZMUSIC_INT_CONFIGS
} EIntConfigKey; } EZMusicIntConfigKey;
typedef enum EFloatConfigKey_ typedef enum EZMusicFloatConfigKey_
{ {
zmusic_fluid_gain = 1000, zmusic_fluid_gain = 1000,
zmusic_fluid_reverb_roomsize, zmusic_fluid_reverb_roomsize,
@ -167,9 +167,9 @@ typedef enum EFloatConfigKey_
zmusic_snd_mastervolume, zmusic_snd_mastervolume,
NUM_FLOAT_CONFIGS NUM_FLOAT_CONFIGS
} EFloatConfigKey; } EZMusicFloatConfigKey;
typedef enum EStringConfigKey_ typedef enum EZMusicStringConfigKey_
{ {
zmusic_adl_custom_bank = 2000, zmusic_adl_custom_bank = 2000,
zmusic_fluid_lib, zmusic_fluid_lib,
@ -181,7 +181,7 @@ typedef enum EStringConfigKey_
zmusic_wildmidi_config, zmusic_wildmidi_config,
NUM_STRING_CONFIGS NUM_STRING_CONFIGS
} EStringConfigKey; } EZMusicStringConfigKey;
typedef struct ZMusicCustomReader_ typedef struct ZMusicCustomReader_
@ -264,9 +264,9 @@ typedef struct ZMusicConfigurationSetting_
#ifndef ZMUSIC_INTERNAL #ifndef ZMUSIC_INTERNAL
#ifdef _MSC_VER #ifdef _MSC_VER
#define DLL_IMPORT _declspec(dllimport) #define ZMUSIC_DLL_IMPORT _declspec(dllimport)
#else // !_MSC_VER #else // !_MSC_VER
#define DLL_IMPORT #define ZMUSIC_DLL_IMPORT
#endif // _MSC_VER #endif // _MSC_VER
// Note that the internal 'class' definitions are not C compatible! // Note that the internal 'class' definitions are not C compatible!
typedef struct { int zm1; } *ZMusic_MidiSource; typedef struct { int zm1; } *ZMusic_MidiSource;
@ -279,96 +279,96 @@ struct SoundDecoder;
extern "C" extern "C"
{ {
#endif #endif
DLL_IMPORT const char* ZMusic_GetLastError(); ZMUSIC_DLL_IMPORT const char* ZMusic_GetLastError();
// Sets callbacks for functionality that the client needs to provide. // Sets callbacks for functionality that the client needs to provide.
DLL_IMPORT void ZMusic_SetCallbacks(const ZMusicCallbacks* callbacks); ZMUSIC_DLL_IMPORT void ZMusic_SetCallbacks(const ZMusicCallbacks* callbacks);
// Sets GenMidi data for OPL playback. If this isn't provided the OPL synth will not work. // Sets GenMidi data for OPL playback. If this isn't provided the OPL synth will not work.
DLL_IMPORT void ZMusic_SetGenMidi(const uint8_t* data); ZMUSIC_DLL_IMPORT void ZMusic_SetGenMidi(const uint8_t* data);
// Set default bank for OPN. Without this OPN only works with custom banks. // Set default bank for OPN. Without this OPN only works with custom banks.
DLL_IMPORT void ZMusic_SetWgOpn(const void* data, unsigned len); ZMUSIC_DLL_IMPORT void ZMusic_SetWgOpn(const void* data, unsigned len);
// Set DMXGUS data for running the GUS synth in actual GUS mode. // Set DMXGUS data for running the GUS synth in actual GUS mode.
DLL_IMPORT void ZMusic_SetDmxGus(const void* data, unsigned len); ZMUSIC_DLL_IMPORT void ZMusic_SetDmxGus(const void* data, unsigned len);
// Returns an array with all available configuration options - terminated with an empty entry where all elements are 0. // Returns an array with all available configuration options - terminated with an empty entry where all elements are 0.
DLL_IMPORT const ZMusicConfigurationSetting* ZMusic_GetConfiguration(); 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. // 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.
DLL_IMPORT EMIDIType ZMusic_IdentifyMIDIType(uint32_t* id, int size); ZMUSIC_DLL_IMPORT EZMusicMIDIType ZMusic_IdentifyMIDIType(uint32_t* id, int size);
DLL_IMPORT ZMusic_MidiSource ZMusic_CreateMIDISource(const uint8_t* data, size_t length, EMIDIType miditype); ZMUSIC_DLL_IMPORT ZMusic_MidiSource ZMusic_CreateMIDISource(const uint8_t* data, size_t length, EZMusicMIDIType miditype);
DLL_IMPORT zmusic_bool ZMusic_MIDIDumpWave(ZMusic_MidiSource source, EMidiDevice devtype, const char* devarg, const char* outname, int subsong, int samplerate); ZMUSIC_DLL_IMPORT zmusic_bool ZMusic_MIDIDumpWave(ZMusic_MidiSource source, EZMusicMidiDevice devtype, const char* devarg, const char* outname, int subsong, int samplerate);
DLL_IMPORT ZMusic_MusicStream ZMusic_OpenSong(ZMusicCustomReader* reader, EMidiDevice device, const char* Args); ZMUSIC_DLL_IMPORT ZMusic_MusicStream ZMusic_OpenSong(ZMusicCustomReader* reader, EZMusicMidiDevice device, const char* Args);
DLL_IMPORT ZMusic_MusicStream ZMusic_OpenSongFile(const char *filename, EMidiDevice device, const char* Args); ZMUSIC_DLL_IMPORT ZMusic_MusicStream ZMusic_OpenSongFile(const char *filename, EZMusicMidiDevice device, const char* Args);
DLL_IMPORT ZMusic_MusicStream ZMusic_OpenSongMem(const void *mem, size_t size, EMidiDevice device, const char* Args); ZMUSIC_DLL_IMPORT ZMusic_MusicStream ZMusic_OpenSongMem(const void *mem, size_t size, EZMusicMidiDevice device, const char* Args);
DLL_IMPORT ZMusic_MusicStream ZMusic_OpenCDSong(int track, int cdid); ZMUSIC_DLL_IMPORT ZMusic_MusicStream ZMusic_OpenCDSong(int track, int cdid);
DLL_IMPORT zmusic_bool ZMusic_FillStream(ZMusic_MusicStream stream, void* buff, int len); ZMUSIC_DLL_IMPORT zmusic_bool ZMusic_FillStream(ZMusic_MusicStream stream, void* buff, int len);
DLL_IMPORT zmusic_bool ZMusic_Start(ZMusic_MusicStream song, int subsong, zmusic_bool loop); ZMUSIC_DLL_IMPORT zmusic_bool ZMusic_Start(ZMusic_MusicStream song, int subsong, zmusic_bool loop);
DLL_IMPORT void ZMusic_Pause(ZMusic_MusicStream song); ZMUSIC_DLL_IMPORT void ZMusic_Pause(ZMusic_MusicStream song);
DLL_IMPORT void ZMusic_Resume(ZMusic_MusicStream song); ZMUSIC_DLL_IMPORT void ZMusic_Resume(ZMusic_MusicStream song);
DLL_IMPORT void ZMusic_Update(ZMusic_MusicStream song); ZMUSIC_DLL_IMPORT void ZMusic_Update(ZMusic_MusicStream song);
DLL_IMPORT zmusic_bool ZMusic_IsPlaying(ZMusic_MusicStream song); ZMUSIC_DLL_IMPORT zmusic_bool ZMusic_IsPlaying(ZMusic_MusicStream song);
DLL_IMPORT void ZMusic_Stop(ZMusic_MusicStream song); ZMUSIC_DLL_IMPORT void ZMusic_Stop(ZMusic_MusicStream song);
DLL_IMPORT void ZMusic_Close(ZMusic_MusicStream song); ZMUSIC_DLL_IMPORT void ZMusic_Close(ZMusic_MusicStream song);
DLL_IMPORT zmusic_bool ZMusic_SetSubsong(ZMusic_MusicStream song, int subsong); ZMUSIC_DLL_IMPORT zmusic_bool ZMusic_SetSubsong(ZMusic_MusicStream song, int subsong);
DLL_IMPORT zmusic_bool ZMusic_IsLooping(ZMusic_MusicStream song); ZMUSIC_DLL_IMPORT zmusic_bool ZMusic_IsLooping(ZMusic_MusicStream song);
DLL_IMPORT zmusic_bool ZMusic_IsMIDI(ZMusic_MusicStream song); ZMUSIC_DLL_IMPORT zmusic_bool ZMusic_IsMIDI(ZMusic_MusicStream song);
DLL_IMPORT void ZMusic_VolumeChanged(ZMusic_MusicStream song); ZMUSIC_DLL_IMPORT void ZMusic_VolumeChanged(ZMusic_MusicStream song);
DLL_IMPORT zmusic_bool ZMusic_WriteSMF(ZMusic_MidiSource source, const char* fn, int looplimit); ZMUSIC_DLL_IMPORT zmusic_bool ZMusic_WriteSMF(ZMusic_MidiSource source, const char* fn, int looplimit);
DLL_IMPORT void ZMusic_GetStreamInfo(ZMusic_MusicStream song, SoundStreamInfo *info); ZMUSIC_DLL_IMPORT void ZMusic_GetStreamInfo(ZMusic_MusicStream song, ZMusicSoundStreamInfo *info);
// Configuration interface. The return value specifies if a music restart is needed. // Configuration interface. The return value specifies if a music restart is needed.
// RealValue should be written back to the CVAR or whatever other method the client uses to store configuration state. // RealValue should be written back to the CVAR or whatever other method the client uses to store configuration state.
DLL_IMPORT zmusic_bool ChangeMusicSettingInt(EIntConfigKey key, ZMusic_MusicStream song, int value, int* pRealValue); ZMUSIC_DLL_IMPORT zmusic_bool ChangeMusicSettingInt(EZMusicIntConfigKey key, ZMusic_MusicStream song, int value, int* pRealValue);
DLL_IMPORT zmusic_bool ChangeMusicSettingFloat(EFloatConfigKey key, ZMusic_MusicStream song, float value, float* pRealValue); ZMUSIC_DLL_IMPORT zmusic_bool ChangeMusicSettingFloat(EZMusicFloatConfigKey key, ZMusic_MusicStream song, float value, float* pRealValue);
DLL_IMPORT zmusic_bool ChangeMusicSettingString(EStringConfigKey key, ZMusic_MusicStream song, const char* value); ZMUSIC_DLL_IMPORT zmusic_bool ChangeMusicSettingString(EZMusicStringConfigKey key, ZMusic_MusicStream song, const char* value);
DLL_IMPORT const char *ZMusic_GetStats(ZMusic_MusicStream song); ZMUSIC_DLL_IMPORT const char *ZMusic_GetStats(ZMusic_MusicStream song);
DLL_IMPORT struct SoundDecoder* CreateDecoder(const uint8_t* data, size_t size, zmusic_bool isstatic); ZMUSIC_DLL_IMPORT struct SoundDecoder* CreateDecoder(const uint8_t* data, size_t size, zmusic_bool isstatic);
DLL_IMPORT void SoundDecoder_GetInfo(struct SoundDecoder* decoder, int* samplerate, ChannelConfig* chans, SampleType* type); ZMUSIC_DLL_IMPORT void SoundDecoder_GetInfo(struct SoundDecoder* decoder, int* samplerate, EZMusicChannelConfig* chans, EZMusicSampleType* type);
DLL_IMPORT size_t SoundDecoder_Read(struct SoundDecoder* decoder, void* buffer, size_t length); ZMUSIC_DLL_IMPORT size_t SoundDecoder_Read(struct SoundDecoder* decoder, void* buffer, size_t length);
DLL_IMPORT void SoundDecoder_Close(struct SoundDecoder* decoder); ZMUSIC_DLL_IMPORT void SoundDecoder_Close(struct SoundDecoder* decoder);
DLL_IMPORT void FindLoopTags(const uint8_t* data, size_t size, uint32_t* start, zmusic_bool* startass, uint32_t* end, zmusic_bool* endass); ZMUSIC_DLL_IMPORT void FindLoopTags(const uint8_t* data, size_t size, uint32_t* start, zmusic_bool* startass, uint32_t* end, zmusic_bool* endass);
// The rest of the decoder interface is only useful for streaming music. // The rest of the decoder interface is only useful for streaming music.
DLL_IMPORT const ZMusicMidiOutDevice *ZMusic_GetMidiDevices(int *pAmount); ZMUSIC_DLL_IMPORT const ZMusicMidiOutDevice *ZMusic_GetMidiDevices(int *pAmount);
DLL_IMPORT int ZMusic_GetADLBanks(const char* const** pNames); ZMUSIC_DLL_IMPORT int ZMusic_GetADLBanks(const char* const** pNames);
// Direct access to the CD drive. // Direct access to the CD drive.
// Stops playing the CD // Stops playing the CD
DLL_IMPORT void CD_Stop(); ZMUSIC_DLL_IMPORT void CD_Stop();
// Pauses CD playing // Pauses CD playing
DLL_IMPORT void CD_Pause(); ZMUSIC_DLL_IMPORT void CD_Pause();
// Resumes CD playback after pausing // Resumes CD playback after pausing
DLL_IMPORT zmusic_bool CD_Resume(); ZMUSIC_DLL_IMPORT zmusic_bool CD_Resume();
// Eject the CD tray // Eject the CD tray
DLL_IMPORT void CD_Eject(); ZMUSIC_DLL_IMPORT void CD_Eject();
// Close the CD tray // Close the CD tray
DLL_IMPORT zmusic_bool CD_UnEject(); ZMUSIC_DLL_IMPORT zmusic_bool CD_UnEject();
// Closes a CD device previously opened with CD_Init // Closes a CD device previously opened with CD_Init
DLL_IMPORT void CD_Close(); ZMUSIC_DLL_IMPORT void CD_Close();
DLL_IMPORT zmusic_bool CD_Enable(const char* drive); ZMUSIC_DLL_IMPORT zmusic_bool CD_Enable(const char* drive);
#ifdef __cplusplus #ifdef __cplusplus
} }
inline bool ChangeMusicSetting(EIntConfigKey key, ZMusic_MusicStream song, int value, int* pRealValue = NULL) inline bool ChangeMusicSetting(EZMusicIntConfigKey key, ZMusic_MusicStream song, int value, int* pRealValue = NULL)
{ {
return ChangeMusicSettingInt(key, song, value, pRealValue); return ChangeMusicSettingInt(key, song, value, pRealValue);
} }
inline bool ChangeMusicSetting(EFloatConfigKey key, ZMusic_MusicStream song, float value, float* pRealValue = NULL) inline bool ChangeMusicSetting(EZMusicFloatConfigKey key, ZMusic_MusicStream song, float value, float* pRealValue = NULL)
{ {
return ChangeMusicSettingFloat(key, song, value, pRealValue); return ChangeMusicSettingFloat(key, song, value, pRealValue);
} }
inline bool ChangeMusicSetting(EStringConfigKey key, ZMusic_MusicStream song, const char* value) inline bool ChangeMusicSetting(EZMusicStringConfigKey key, ZMusic_MusicStream song, const char* value)
{ {
return ChangeMusicSettingString(key, song, value); return ChangeMusicSettingString(key, song, value);
} }
@ -383,12 +383,12 @@ typedef void (*pfn_ZMusic_SetGenMidi)(const uint8_t* data);
typedef void (*pfn_ZMusic_SetWgOpn)(const void* data, unsigned len); typedef void (*pfn_ZMusic_SetWgOpn)(const void* data, unsigned len);
typedef void (*pfn_ZMusic_SetDmxGus)(const void* data, unsigned len); typedef void (*pfn_ZMusic_SetDmxGus)(const void* data, unsigned len);
typedef const ZMusicConfigurationSetting* (*pfn_ZMusic_GetConfiguration)(); typedef const ZMusicConfigurationSetting* (*pfn_ZMusic_GetConfiguration)();
typedef EMIDIType (*pfn_ZMusic_IdentifyMIDIType)(uint32_t* id, int size); typedef EZMusicMIDIType (*pfn_ZMusic_IdentifyMIDIType)(uint32_t* id, int size);
typedef ZMusic_MidiSource (*pfn_ZMusic_CreateMIDISource)(const uint8_t* data, size_t length, EMIDIType miditype); typedef ZMusic_MidiSource (*pfn_ZMusic_CreateMIDISource)(const uint8_t* data, size_t length, EZMusicMIDIType miditype);
typedef zmusic_bool (*pfn_ZMusic_MIDIDumpWave)(ZMusic_MidiSource source, EMidiDevice devtype, const char* devarg, const char* outname, int subsong, int samplerate); 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, EMidiDevice device, const char* Args); typedef ZMusic_MusicStream (*pfn_ZMusic_OpenSong)(ZMusicCustomReader* reader, EZMusicMidiDevice device, const char* Args);
typedef ZMusic_MusicStream (*pfn_ZMusic_OpenSongFile)(const char *filename, EMidiDevice device, const char* Args); typedef ZMusic_MusicStream (*pfn_ZMusic_OpenSongFile)(const char *filename, EZMusicMidiDevice device, const char* Args);
typedef ZMusic_MusicStream (*pfn_ZMusic_OpenSongMem)(const void *mem, size_t size, EMidiDevice device, const char* Args); typedef ZMusic_MusicStream (*pfn_ZMusic_OpenSongMem)(const void *mem, size_t size, EZMusicMidiDevice device, const char* Args);
typedef ZMusic_MusicStream (*pfn_ZMusic_OpenCDSong)(int track, int cdid); typedef ZMusic_MusicStream (*pfn_ZMusic_OpenCDSong)(int track, int cdid);
typedef zmusic_bool (*pfn_ZMusic_FillStream)(ZMusic_MusicStream stream, void* buff, int len); typedef zmusic_bool (*pfn_ZMusic_FillStream)(ZMusic_MusicStream stream, void* buff, int len);
typedef zmusic_bool (*pfn_ZMusic_Start)(ZMusic_MusicStream song, int subsong, zmusic_bool loop); typedef zmusic_bool (*pfn_ZMusic_Start)(ZMusic_MusicStream song, int subsong, zmusic_bool loop);
@ -403,13 +403,13 @@ typedef zmusic_bool (*pfn_ZMusic_IsLooping)(ZMusic_MusicStream song);
typedef zmusic_bool (*pfn_ZMusic_IsMIDI)(ZMusic_MusicStream song); typedef zmusic_bool (*pfn_ZMusic_IsMIDI)(ZMusic_MusicStream song);
typedef void (*pfn_ZMusic_VolumeChanged)(ZMusic_MusicStream song); typedef void (*pfn_ZMusic_VolumeChanged)(ZMusic_MusicStream song);
typedef zmusic_bool (*pfn_ZMusic_WriteSMF)(ZMusic_MidiSource source, const char* fn, int looplimit); typedef zmusic_bool (*pfn_ZMusic_WriteSMF)(ZMusic_MidiSource source, const char* fn, int looplimit);
typedef void (*pfn_ZMusic_GetStreamInfo)(ZMusic_MusicStream song, SoundStreamInfo *info); typedef void (*pfn_ZMusic_GetStreamInfo)(ZMusic_MusicStream song, ZMusicSoundStreamInfo *info);
typedef zmusic_bool (*pfn_ChangeMusicSettingInt)(EIntConfigKey key, ZMusic_MusicStream song, int value, int* pRealValue); typedef zmusic_bool (*pfn_ChangeMusicSettingInt)(EZMusicIntConfigKey key, ZMusic_MusicStream song, int value, int* pRealValue);
typedef zmusic_bool (*pfn_ChangeMusicSettingFloat)(EFloatConfigKey key, ZMusic_MusicStream song, float value, float* pRealValue); typedef zmusic_bool (*pfn_ChangeMusicSettingFloat)(EZMusicFloatConfigKey key, ZMusic_MusicStream song, float value, float* pRealValue);
typedef zmusic_bool (*pfn_ChangeMusicSettingString)(EStringConfigKey key, ZMusic_MusicStream song, const char* value); typedef zmusic_bool (*pfn_ChangeMusicSettingString)(EZMusicStringConfigKey key, ZMusic_MusicStream song, const char* value);
typedef const char *(*pfn_ZMusic_GetStats)(ZMusic_MusicStream song); typedef const char *(*pfn_ZMusic_GetStats)(ZMusic_MusicStream song);
typedef struct SoundDecoder* (*pfn_CreateDecoder)(const uint8_t* data, size_t size, zmusic_bool isstatic); typedef struct SoundDecoder* (*pfn_CreateDecoder)(const uint8_t* data, size_t size, zmusic_bool isstatic);
typedef void (*pfn_SoundDecoder_GetInfo)(struct SoundDecoder* decoder, int* samplerate, ChannelConfig* chans, SampleType* type); typedef void (*pfn_SoundDecoder_GetInfo)(struct SoundDecoder* decoder, int* samplerate, EZMusicChannelConfig* chans, EZMusicSampleType* type);
typedef size_t (*pfn_SoundDecoder_Read)(struct SoundDecoder* decoder, void* buffer, size_t length); typedef size_t (*pfn_SoundDecoder_Read)(struct SoundDecoder* decoder, void* buffer, size_t length);
typedef void (*pfn_SoundDecoder_Close)(struct SoundDecoder* decoder); typedef void (*pfn_SoundDecoder_Close)(struct SoundDecoder* decoder);
typedef void (*pfn_FindLoopTags)(const uint8_t* data, size_t size, uint32_t* start, zmusic_bool* startass, uint32_t* end, zmusic_bool* endass); typedef void (*pfn_FindLoopTags)(const uint8_t* data, size_t size, uint32_t* start, zmusic_bool* startass, uint32_t* end, zmusic_bool* endass);

View file

@ -152,7 +152,7 @@ bool MPG123Decoder::open(MusicIO::FileInterface *reader)
return false; return false;
} }
void MPG123Decoder::getInfo(int *samplerate, ChannelConfig *chans, SampleType *type) void MPG123Decoder::getInfo(int *samplerate, EZMusicChannelConfig *chans, EZMusicSampleType *type)
{ {
int enc = 0, channels = 0; int enc = 0, channels = 0;
long srate = 0; long srate = 0;

View file

@ -18,7 +18,7 @@ typedef ptrdiff_t ssize_t;
struct MPG123Decoder : public SoundDecoder struct MPG123Decoder : public SoundDecoder
{ {
virtual void getInfo(int* samplerate, ChannelConfig* chans, SampleType* type) override; virtual void getInfo(int* samplerate, EZMusicChannelConfig* chans, EZMusicSampleType* type) override;
virtual size_t read(char* buffer, size_t bytes) override; virtual size_t read(char* buffer, size_t bytes) override;
virtual bool seek(size_t ms_offset, bool ms, bool mayrestart) override; virtual bool seek(size_t ms_offset, bool ms, bool mayrestart) override;

View file

@ -133,7 +133,7 @@ bool SndFileDecoder::open(MusicIO::FileInterface *reader)
return false; return false;
} }
void SndFileDecoder::getInfo(int *samplerate, ChannelConfig *chans, SampleType *type) void SndFileDecoder::getInfo(int *samplerate, EZMusicChannelConfig *chans, EZMusicSampleType *type)
{ {
*samplerate = SndInfo.samplerate; *samplerate = SndInfo.samplerate;

View file

@ -13,7 +13,7 @@
struct SndFileDecoder : public SoundDecoder struct SndFileDecoder : public SoundDecoder
{ {
virtual void getInfo(int *samplerate, ChannelConfig *chans, SampleType *type) override; virtual void getInfo(int *samplerate, EZMusicChannelConfig *chans, EZMusicSampleType *type) override;
virtual size_t read(char *buffer, size_t bytes) override; virtual size_t read(char *buffer, size_t bytes) override;
virtual std::vector<uint8_t> readAll() override; virtual std::vector<uint8_t> readAll() override;

View file

@ -90,8 +90,8 @@ extern "C"
short* dumb_decode_vorbis(int outlen, const void* oggstream, int sizebytes) short* dumb_decode_vorbis(int outlen, const void* oggstream, int sizebytes)
{ {
short* samples = (short*)calloc(1, outlen); short* samples = (short*)calloc(1, outlen);
ChannelConfig chans; EZMusicChannelConfig chans;
SampleType type; EZMusicSampleType type;
int srate; int srate;
// The decoder will take ownership of the reader if it succeeds so this may not be a local variable. // The decoder will take ownership of the reader if it succeeds so this may not be a local variable.
@ -126,7 +126,7 @@ DLL_EXPORT struct SoundDecoder* CreateDecoder(const uint8_t* data, size_t size,
return res; return res;
} }
DLL_EXPORT void SoundDecoder_GetInfo(struct SoundDecoder* decoder, int* samplerate, ChannelConfig* chans, SampleType* type) DLL_EXPORT void SoundDecoder_GetInfo(struct SoundDecoder* decoder, int* samplerate, EZMusicChannelConfig* chans, EZMusicSampleType* type)
{ {
if (decoder) decoder->getInfo(samplerate, chans, type); if (decoder) decoder->getInfo(samplerate, chans, type);
else if (samplerate) *samplerate = 0; else if (samplerate) *samplerate = 0;

View file

@ -51,7 +51,7 @@ public:
virtual std::string GetStats(); virtual std::string GetStats();
virtual int GetDeviceType() const { return MDEV_DEFAULT; } virtual int GetDeviceType() const { return MDEV_DEFAULT; }
virtual bool CanHandleSysex() const { return true; } virtual bool CanHandleSysex() const { return true; }
virtual SoundStreamInfo GetStreamInfo() const; virtual ZMusicSoundStreamInfo GetStreamInfo() const;
protected: protected:
MidiCallback Callback; MidiCallback Callback;
@ -81,7 +81,7 @@ public:
virtual int Open() override; virtual int Open() override;
virtual bool ServiceStream(void* buff, int numbytes); virtual bool ServiceStream(void* buff, int numbytes);
int GetSampleRate() const { return SampleRate; } int GetSampleRate() const { return SampleRate; }
SoundStreamInfo GetStreamInfo() const override; ZMusicSoundStreamInfo GetStreamInfo() const override;
protected: protected:
double Tempo; double Tempo;

View file

@ -176,7 +176,7 @@ std::string MIDIDevice::GetStats()
// //
//========================================================================== //==========================================================================
SoundStreamInfo MIDIDevice::GetStreamInfo() const ZMusicSoundStreamInfo MIDIDevice::GetStreamInfo() const
{ {
return { 0, 0, 0 }; // i.e. do not use streaming. return { 0, 0, 0 }; // i.e. do not use streaming.
} }

View file

@ -92,7 +92,7 @@ SoftSynthMIDIDevice::~SoftSynthMIDIDevice()
// //
//========================================================================== //==========================================================================
SoundStreamInfo SoftSynthMIDIDevice::GetStreamInfo() const ZMusicSoundStreamInfo SoftSynthMIDIDevice::GetStreamInfo() const
{ {
int chunksize = (SampleRate / StreamBlockSize) * 4; int chunksize = (SampleRate / StreamBlockSize) * 4;
if (!isMono) if (!isMono)

View file

@ -418,7 +418,7 @@ extern int MUSHeaderSearch(const uint8_t *head, int len);
// //
//========================================================================== //==========================================================================
DLL_EXPORT EMIDIType ZMusic_IdentifyMIDIType(uint32_t *id, int size) DLL_EXPORT EZMusicMIDIType ZMusic_IdentifyMIDIType(uint32_t *id, int size)
{ {
// Check for MUS format // Check for MUS format
// Tolerate sloppy wads by searching up to 32 bytes for the header // Tolerate sloppy wads by searching up to 32 bytes for the header
@ -467,7 +467,7 @@ DLL_EXPORT EMIDIType ZMusic_IdentifyMIDIType(uint32_t *id, int size)
// //
//========================================================================== //==========================================================================
DLL_EXPORT ZMusic_MidiSource ZMusic_CreateMIDISource(const uint8_t *data, size_t length, EMIDIType miditype) DLL_EXPORT ZMusic_MidiSource ZMusic_CreateMIDISource(const uint8_t *data, size_t length, EZMusicMIDIType miditype)
{ {
try try
{ {

View file

@ -67,7 +67,7 @@ enum
class MIDIStreamer : public MusInfo class MIDIStreamer : public MusInfo
{ {
public: public:
MIDIStreamer(EMidiDevice type, const char* args); MIDIStreamer(EZMusicMidiDevice type, const char* args);
~MIDIStreamer(); ~MIDIStreamer();
void MusicVolumeChanged() override; void MusicVolumeChanged() override;
@ -87,7 +87,7 @@ public:
int ServiceEvent(); int ServiceEvent();
void SetMIDISource(MIDISource* _source); void SetMIDISource(MIDISource* _source);
bool ServiceStream(void* buff, int len) override; bool ServiceStream(void* buff, int len) override;
SoundStreamInfo GetStreamInfo() const override; ZMusicSoundStreamInfo GetStreamInfo() const override;
int GetDeviceType() const override; int GetDeviceType() const override;
@ -95,7 +95,7 @@ public:
protected: protected:
MIDIStreamer(const char* dumpname, EMidiDevice type); MIDIStreamer(const char* dumpname, EZMusicMidiDevice type);
void OutputVolume(uint32_t volume); void OutputVolume(uint32_t volume);
int FillBuffer(int buffer_num, int max_events, uint32_t max_time); int FillBuffer(int buffer_num, int max_events, uint32_t max_time);
@ -110,8 +110,8 @@ protected:
//void SetMidiSynth(MIDIDevice *synth); //void SetMidiSynth(MIDIDevice *synth);
static EMidiDevice SelectMIDIDevice(EMidiDevice devtype); static EZMusicMidiDevice SelectMIDIDevice(EZMusicMidiDevice devtype);
MIDIDevice* CreateMIDIDevice(EMidiDevice devtype, int samplerate); MIDIDevice* CreateMIDIDevice(EZMusicMidiDevice devtype, int samplerate);
static void Callback(void* userdata); static void Callback(void* userdata);
@ -132,7 +132,7 @@ protected:
bool InitialPlayback; bool InitialPlayback;
uint32_t NewVolume; uint32_t NewVolume;
uint32_t Volume; uint32_t Volume;
EMidiDevice DeviceType; EZMusicMidiDevice DeviceType;
bool CallbackIsThreaded; bool CallbackIsThreaded;
int LoopLimit; int LoopLimit;
std::string Args; std::string Args;
@ -150,7 +150,7 @@ protected:
// //
//========================================================================== //==========================================================================
MIDIStreamer::MIDIStreamer(EMidiDevice type, const char *args) MIDIStreamer::MIDIStreamer(EZMusicMidiDevice type, const char *args)
: :
DeviceType(type), Args(args) DeviceType(type), Args(args)
{ {
@ -201,7 +201,7 @@ bool MIDIStreamer::IsValid() const
// //
//========================================================================== //==========================================================================
EMidiDevice MIDIStreamer::SelectMIDIDevice(EMidiDevice device) EZMusicMidiDevice MIDIStreamer::SelectMIDIDevice(EZMusicMidiDevice device)
{ {
/* MIDI are played as: /* MIDI are played as:
- OPL: - OPL:
@ -248,15 +248,15 @@ EMidiDevice MIDIStreamer::SelectMIDIDevice(EMidiDevice device)
// //
//========================================================================== //==========================================================================
static EMidiDevice lastRequestedDevice, lastSelectedDevice; static EZMusicMidiDevice lastRequestedDevice, lastSelectedDevice;
MIDIDevice *MIDIStreamer::CreateMIDIDevice(EMidiDevice devtype, int samplerate) MIDIDevice *MIDIStreamer::CreateMIDIDevice(EZMusicMidiDevice devtype, int samplerate)
{ {
bool checked[MDEV_COUNT] = { false }; bool checked[MDEV_COUNT] = { false };
MIDIDevice *dev = nullptr; MIDIDevice *dev = nullptr;
if (devtype == MDEV_SNDSYS) devtype = MDEV_FLUIDSYNTH; if (devtype == MDEV_SNDSYS) devtype = MDEV_FLUIDSYNTH;
EMidiDevice requestedDevice = devtype, selectedDevice; EZMusicMidiDevice requestedDevice = devtype, selectedDevice;
while (dev == nullptr) while (dev == nullptr)
{ {
selectedDevice = devtype; selectedDevice = devtype;
@ -361,7 +361,7 @@ MIDIDevice *MIDIStreamer::CreateMIDIDevice(EMidiDevice devtype, int samplerate)
void MIDIStreamer::Play(bool looping, int subsong) void MIDIStreamer::Play(bool looping, int subsong)
{ {
EMidiDevice devtype; EZMusicMidiDevice devtype;
if (source == nullptr) return; // We have nothing to play so abort. if (source == nullptr) return; // We have nothing to play so abort.
@ -446,7 +446,7 @@ bool MIDIStreamer::InitPlayback()
} }
} }
SoundStreamInfo MIDIStreamer::GetStreamInfo() const ZMusicSoundStreamInfo MIDIStreamer::GetStreamInfo() const
{ {
if (MIDI) return MIDI->GetStreamInfo(); if (MIDI) return MIDI->GetStreamInfo();
else return { 0, 0, 0 }; else return { 0, 0, 0 };
@ -1010,14 +1010,14 @@ bool MIDIStreamer::ServiceStream(void* buff, int len)
// //
//========================================================================== //==========================================================================
MusInfo* CreateMIDIStreamer(MIDISource *source, EMidiDevice devtype, const char* args) MusInfo* CreateMIDIStreamer(MIDISource *source, EZMusicMidiDevice devtype, const char* args)
{ {
auto me = new MIDIStreamer(devtype, args); auto me = new MIDIStreamer(devtype, args);
me->SetMIDISource(source); me->SetMIDISource(source);
return me; return me;
} }
DLL_EXPORT zmusic_bool ZMusic_MIDIDumpWave(ZMusic_MidiSource source, EMidiDevice devtype, const char *devarg, const char *outname, int subsong, int samplerate) DLL_EXPORT zmusic_bool ZMusic_MIDIDumpWave(ZMusic_MidiSource source, EZMusicMidiDevice devtype, const char *devarg, const char *outname, int subsong, int samplerate)
{ {
try try
{ {

View file

@ -54,7 +54,7 @@ public:
void ChangeSettingNum(const char *name, double value) override { if (m_Source) m_Source->ChangeSettingNum(name, value); } void ChangeSettingNum(const char *name, double value) override { if (m_Source) m_Source->ChangeSettingNum(name, value); }
void ChangeSettingString(const char *name, const char *value) override { if(m_Source) m_Source->ChangeSettingString(name, value); } void ChangeSettingString(const char *name, const char *value) override { if(m_Source) m_Source->ChangeSettingString(name, value); }
bool ServiceStream(void* buff, int len) override; bool ServiceStream(void* buff, int len) override;
SoundStreamInfo GetStreamInfo() const override { return m_Source->GetFormat(); } ZMusicSoundStreamInfo GetStreamInfo() const override { return m_Source->GetFormat(); }
protected: protected:

View file

@ -64,7 +64,7 @@ public:
//bool SetPosition(int ms); //bool SetPosition(int ms);
bool SetSubsong(int subsong) override; bool SetSubsong(int subsong) override;
bool Start() override; bool Start() override;
SoundStreamInfo GetFormat() override; ZMusicSoundStreamInfo GetFormat() override;
void ChangeSettingNum(const char* setting, double val) override; void ChangeSettingNum(const char* setting, double val) override;
std::string GetStats() override; std::string GetStats() override;
@ -1034,7 +1034,7 @@ DumbSong::~DumbSong()
// //
//========================================================================== //==========================================================================
SoundStreamInfo DumbSong::GetFormat() ZMusicSoundStreamInfo DumbSong::GetFormat()
{ {
return { 32*1024, srate, 2 }; return { 32*1024, srate, 2 };
} }

View file

@ -57,7 +57,7 @@ public:
void ChangeSettingNum(const char *name, double val) override; void ChangeSettingNum(const char *name, double val) override;
std::string GetStats() override; std::string GetStats() override;
bool GetData(void *buffer, size_t len) override; bool GetData(void *buffer, size_t len) override;
SoundStreamInfo GetFormat() override; ZMusicSoundStreamInfo GetFormat() override;
protected: protected:
Music_Emu *Emu; Music_Emu *Emu;
@ -167,7 +167,7 @@ GMESong::GMESong(Music_Emu *emu, int sample_rate)
} }
SoundStreamInfo GMESong::GetFormat() ZMusicSoundStreamInfo GMESong::GetFormat()
{ {
return { 32*1024, SampleRate, -2 }; return { 32*1024, SampleRate, -2 };
} }

View file

@ -50,7 +50,7 @@ public:
SndFileSong(SoundDecoder *decoder, uint32_t loop_start, uint32_t loop_end, bool startass, bool endass); SndFileSong(SoundDecoder *decoder, uint32_t loop_start, uint32_t loop_end, bool startass, bool endass);
~SndFileSong(); ~SndFileSong();
std::string GetStats() override; std::string GetStats() override;
SoundStreamInfo GetFormat() override; ZMusicSoundStreamInfo GetFormat() override;
bool GetData(void *buffer, size_t len) override; bool GetData(void *buffer, size_t len) override;
protected: protected:
@ -415,8 +415,8 @@ static int32_t Scale(int32_t a, int32_t b, int32_t c)
SndFileSong::SndFileSong(SoundDecoder *decoder, uint32_t loop_start, uint32_t loop_end, bool startass, bool endass) SndFileSong::SndFileSong(SoundDecoder *decoder, uint32_t loop_start, uint32_t loop_end, bool startass, bool endass)
{ {
ChannelConfig iChannels; EZMusicChannelConfig iChannels;
SampleType Type; EZMusicSampleType Type;
decoder->getInfo(&SampleRate, &iChannels, &Type); decoder->getInfo(&SampleRate, &iChannels, &Type);
@ -430,7 +430,7 @@ SndFileSong::SndFileSong(SoundDecoder *decoder, uint32_t loop_start, uint32_t lo
Channels = iChannels == ChannelConfig_Stereo? 2:1; Channels = iChannels == ChannelConfig_Stereo? 2:1;
} }
SoundStreamInfo SndFileSong::GetFormat() ZMusicSoundStreamInfo SndFileSong::GetFormat()
{ {
// deal with this once the configuration is handled better. // deal with this once the configuration is handled better.
return { 64/*snd_streambuffersize*/ * 1024, SampleRate, -Channels }; return { 64/*snd_streambuffersize*/ * 1024, SampleRate, -Channels };

View file

@ -51,7 +51,7 @@ public:
~OPLMUSSong (); ~OPLMUSSong ();
bool Start() override; bool Start() override;
void ChangeSettingInt(const char *name, int value) override; void ChangeSettingInt(const char *name, int value) override;
SoundStreamInfo GetFormat() override; ZMusicSoundStreamInfo GetFormat() override;
protected: protected:
bool GetData(void *buffer, size_t len) override; bool GetData(void *buffer, size_t len) override;
@ -90,7 +90,7 @@ OPLMUSSong::OPLMUSSong(MusicIO::FileInterface* reader, OPLConfig* config)
// //
//========================================================================== //==========================================================================
SoundStreamInfo OPLMUSSong::GetFormat() ZMusicSoundStreamInfo OPLMUSSong::GetFormat()
{ {
int samples = int(OPL_SAMPLE_RATE / 14); int samples = int(OPL_SAMPLE_RATE / 14);
return { samples * 4, int(OPL_SAMPLE_RATE), current_opl_core == 0? 1:2 }; return { samples * 4, int(OPL_SAMPLE_RATE), current_opl_core == 0? 1:2 };

View file

@ -235,7 +235,7 @@ class XASong : public StreamSource
{ {
public: public:
XASong(MusicIO::FileInterface *readr); XASong(MusicIO::FileInterface *readr);
SoundStreamInfo GetFormat() override; ZMusicSoundStreamInfo GetFormat() override;
bool Start() override; bool Start() override;
bool GetData(void *buffer, size_t len) override; bool GetData(void *buffer, size_t len) override;
@ -260,7 +260,7 @@ XASong::XASong(MusicIO::FileInterface * reader)
getNextXABlock(&xad, false); getNextXABlock(&xad, false);
} }
SoundStreamInfo XASong::GetFormat() ZMusicSoundStreamInfo XASong::GetFormat()
{ {
auto SampleRate = xad.blockIs18K? 18900 : 37800; auto SampleRate = xad.blockIs18K? 18900 : 37800;
return { 64*1024, SampleRate, 2}; return { 64*1024, SampleRate, 2};

View file

@ -21,7 +21,7 @@ public:
virtual bool SetPosition(unsigned position) { return false; } virtual bool SetPosition(unsigned position) { return false; }
virtual bool SetSubsong(int subsong) { return false; } virtual bool SetSubsong(int subsong) { return false; }
virtual bool GetData(void *buffer, size_t len) = 0; virtual bool GetData(void *buffer, size_t len) = 0;
virtual SoundStreamInfo GetFormat() { return {65536, m_OutputRate, 2 }; } // Default format is: System's output sample rate, 32 bit float, stereo virtual ZMusicSoundStreamInfo GetFormat() { return {65536, m_OutputRate, 2 }; } // Default format is: System's output sample rate, 32 bit float, stereo
virtual std::string GetStats() { return ""; } virtual std::string GetStats() { return ""; }
virtual void ChangeSettingInt(const char *name, int value) { } virtual void ChangeSettingInt(const char *name, int value) { }
virtual void ChangeSettingNum(const char *name, double value) { } virtual void ChangeSettingNum(const char *name, double value) { }

View file

@ -320,7 +320,7 @@ static void TimidityPlus_SetReverb()
// //
//========================================================================== //==========================================================================
DLL_EXPORT zmusic_bool ChangeMusicSettingInt(EIntConfigKey key, MusInfo *currSong, int value, int *pRealValue) DLL_EXPORT zmusic_bool ChangeMusicSettingInt(EZMusicIntConfigKey key, MusInfo *currSong, int value, int *pRealValue)
{ {
switch (key) switch (key)
{ {
@ -651,7 +651,7 @@ DLL_EXPORT zmusic_bool ChangeMusicSettingInt(EIntConfigKey key, MusInfo *currSon
return false; return false;
} }
DLL_EXPORT zmusic_bool ChangeMusicSettingFloat(EFloatConfigKey key, MusInfo* currSong, float value, float *pRealValue) DLL_EXPORT zmusic_bool ChangeMusicSettingFloat(EZMusicFloatConfigKey key, MusInfo* currSong, float value, float *pRealValue)
{ {
switch (key) switch (key)
{ {
@ -805,7 +805,7 @@ DLL_EXPORT zmusic_bool ChangeMusicSettingFloat(EFloatConfigKey key, MusInfo* cur
return false; return false;
} }
DLL_EXPORT zmusic_bool ChangeMusicSettingString(EStringConfigKey key, MusInfo* currSong, const char *value) DLL_EXPORT zmusic_bool ChangeMusicSettingString(EZMusicStringConfigKey key, MusInfo* currSong, const char *value)
{ {
switch (key) switch (key)
{ {

View file

@ -31,7 +31,7 @@ public:
virtual void ChangeSettingNum(const char* setting, double value) {} // " virtual void ChangeSettingNum(const char* setting, double value) {} // "
virtual void ChangeSettingString(const char* setting, const char* value) {} // " virtual void ChangeSettingString(const char* setting, const char* value) {} // "
virtual bool ServiceStream(void *buff, int len) { return false; } virtual bool ServiceStream(void *buff, int len) { return false; }
virtual SoundStreamInfo GetStreamInfo() const { return { 0,0,0 }; } virtual ZMusicSoundStreamInfo GetStreamInfo() const { return { 0,0,0 }; }
enum EState enum EState
{ {

View file

@ -7,7 +7,7 @@ struct SoundDecoder
{ {
static SoundDecoder* CreateDecoder(MusicIO::FileInterface* reader); static SoundDecoder* CreateDecoder(MusicIO::FileInterface* reader);
virtual void getInfo(int *samplerate, ChannelConfig *chans, SampleType *type) = 0; virtual void getInfo(int *samplerate, EZMusicChannelConfig *chans, EZMusicSampleType *type) = 0;
virtual size_t read(char *buffer, size_t bytes) = 0; virtual size_t read(char *buffer, size_t bytes) = 0;
virtual std::vector<uint8_t> readAll(); virtual std::vector<uint8_t> readAll();

View file

@ -65,7 +65,7 @@ MusInfo *OpenStreamSong(StreamSource *source);
const char *GME_CheckFormat(uint32_t header); const char *GME_CheckFormat(uint32_t header);
MusInfo* CDDA_OpenSong(MusicIO::FileInterface* reader); MusInfo* CDDA_OpenSong(MusicIO::FileInterface* reader);
MusInfo* CD_OpenSong(int track, int id); MusInfo* CD_OpenSong(int track, int id);
MusInfo* CreateMIDIStreamer(MIDISource *source, EMidiDevice devtype, const char* args); MusInfo* CreateMIDIStreamer(MIDISource *source, EZMusicMidiDevice devtype, const char* args);
//========================================================================== //==========================================================================
// //
@ -150,7 +150,7 @@ static bool ungzip(uint8_t *data, int complen, std::vector<uint8_t> &newdata)
// //
//========================================================================== //==========================================================================
static MusInfo *ZMusic_OpenSongInternal (MusicIO::FileInterface *reader, EMidiDevice device, const char *Args) static MusInfo *ZMusic_OpenSongInternal (MusicIO::FileInterface *reader, EZMusicMidiDevice device, const char *Args)
{ {
MusInfo *info = nullptr; MusInfo *info = nullptr;
StreamSource *streamsource = nullptr; StreamSource *streamsource = nullptr;
@ -193,7 +193,7 @@ static MusInfo *ZMusic_OpenSongInternal (MusicIO::FileInterface *reader, EMidiD
} }
} }
EMIDIType miditype = ZMusic_IdentifyMIDIType(id, sizeof(id)); EZMusicMIDIType miditype = ZMusic_IdentifyMIDIType(id, sizeof(id));
if (miditype != MIDI_NOTMIDI) if (miditype != MIDI_NOTMIDI)
{ {
std::vector<uint8_t> data(reader->filelength()); std::vector<uint8_t> data(reader->filelength());
@ -299,7 +299,7 @@ static MusInfo *ZMusic_OpenSongInternal (MusicIO::FileInterface *reader, EMidiD
} }
} }
DLL_EXPORT ZMusic_MusicStream ZMusic_OpenSongFile(const char* filename, EMidiDevice device, const char* Args) DLL_EXPORT ZMusic_MusicStream ZMusic_OpenSongFile(const char* filename, EZMusicMidiDevice device, const char* Args)
{ {
auto f = MusicIO::utf8_fopen(filename, "rb"); auto f = MusicIO::utf8_fopen(filename, "rb");
if (!f) if (!f)
@ -312,7 +312,7 @@ DLL_EXPORT ZMusic_MusicStream ZMusic_OpenSongFile(const char* filename, EMidiDev
return ZMusic_OpenSongInternal(fr, device, Args); return ZMusic_OpenSongInternal(fr, device, Args);
} }
DLL_EXPORT ZMusic_MusicStream ZMusic_OpenSongMem(const void* mem, size_t size, EMidiDevice device, const char* Args) DLL_EXPORT ZMusic_MusicStream ZMusic_OpenSongMem(const void* mem, size_t size, EZMusicMidiDevice device, const char* Args)
{ {
if (!mem || !size) if (!mem || !size)
{ {
@ -324,7 +324,7 @@ DLL_EXPORT ZMusic_MusicStream ZMusic_OpenSongMem(const void* mem, size_t size, E
return ZMusic_OpenSongInternal(mr, device, Args); return ZMusic_OpenSongInternal(mr, device, Args);
} }
DLL_EXPORT ZMusic_MusicStream ZMusic_OpenSong(ZMusicCustomReader* reader, EMidiDevice device, const char* Args) DLL_EXPORT ZMusic_MusicStream ZMusic_OpenSong(ZMusicCustomReader* reader, EZMusicMidiDevice device, const char* Args)
{ {
if (!reader) if (!reader)
{ {
@ -446,7 +446,7 @@ DLL_EXPORT zmusic_bool ZMusic_IsMIDI(MusInfo *song)
return song->IsMIDI(); return song->IsMIDI();
} }
DLL_EXPORT void ZMusic_GetStreamInfo(MusInfo *song, SoundStreamInfo *fmt) DLL_EXPORT void ZMusic_GetStreamInfo(MusInfo *song, ZMusicSoundStreamInfo *fmt)
{ {
if (!fmt) return; if (!fmt) return;
if (!song) *fmt = {}; if (!song) *fmt = {};

View file

@ -3,10 +3,10 @@
#ifdef _MSC_VER #ifdef _MSC_VER
#define DLL_EXPORT __declspec(dllexport) #define DLL_EXPORT __declspec(dllexport)
#define DLL_IMPORT __declspec(dllexport) // without this the compiler complains. #define ZMUSIC_DLL_IMPORT __declspec(dllexport) // without this the compiler complains.
#else // !_MSC_VER #else // !_MSC_VER
#define DLL_EXPORT #define DLL_EXPORT
#define DLL_IMPORT #define ZMUSIC_DLL_IMPORT
#endif // _MSC_VER #endif // _MSC_VER
typedef class MIDISource *ZMusic_MidiSource; typedef class MIDISource *ZMusic_MidiSource;