mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-11 15:22:15 +00:00
- did a bit of cleanup on the MIDI callback interface, made the function type a typedef and removed the two unused parameters. Only the native Windows player passed something, but it wasn't used by the callback.
This commit is contained in:
parent
9b87a167d7
commit
6325fbc491
11 changed files with 26 additions and 25 deletions
|
@ -95,7 +95,7 @@ OPLMIDIDevice::OPLMIDIDevice(const char *args)
|
||||||
//
|
//
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
||||||
int OPLMIDIDevice::Open(void (*callback)(unsigned int, void *, DWORD, DWORD), void *userdata)
|
int OPLMIDIDevice::Open(MidiCallback callback, void *userdata)
|
||||||
{
|
{
|
||||||
if (io == NULL || 0 == (NumChips = io->OPLinit(opl_numchips, FullPan, true)))
|
if (io == NULL || 0 == (NumChips = io->OPLinit(opl_numchips, FullPan, true)))
|
||||||
{
|
{
|
||||||
|
|
|
@ -79,13 +79,14 @@ typedef uint8_t *LPSTR;
|
||||||
|
|
||||||
class MIDIStreamer;
|
class MIDIStreamer;
|
||||||
|
|
||||||
|
typedef void(*MidiCallback)(unsigned int, void *);
|
||||||
class MIDIDevice
|
class MIDIDevice
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
MIDIDevice();
|
MIDIDevice();
|
||||||
virtual ~MIDIDevice();
|
virtual ~MIDIDevice();
|
||||||
|
|
||||||
virtual int Open(void (*callback)(unsigned int, void *, DWORD, DWORD), void *userdata) = 0;
|
virtual int Open(MidiCallback, void *userdata) = 0;
|
||||||
virtual void Close() = 0;
|
virtual void Close() = 0;
|
||||||
virtual bool IsOpen() const = 0;
|
virtual bool IsOpen() const = 0;
|
||||||
virtual int GetTechnology() const = 0;
|
virtual int GetTechnology() const = 0;
|
||||||
|
@ -118,7 +119,7 @@ class WinMIDIDevice : public MIDIDevice
|
||||||
public:
|
public:
|
||||||
WinMIDIDevice(int dev_id);
|
WinMIDIDevice(int dev_id);
|
||||||
~WinMIDIDevice();
|
~WinMIDIDevice();
|
||||||
int Open(void (*callback)(unsigned int, void *, DWORD, DWORD), void *userdata);
|
int Open(MidiCallback, void *userdata);
|
||||||
void Close();
|
void Close();
|
||||||
bool IsOpen() const;
|
bool IsOpen() const;
|
||||||
int GetTechnology() const;
|
int GetTechnology() const;
|
||||||
|
@ -143,7 +144,7 @@ protected:
|
||||||
DWORD SavedVolume;
|
DWORD SavedVolume;
|
||||||
bool VolumeWorks;
|
bool VolumeWorks;
|
||||||
|
|
||||||
void (*Callback)(unsigned int, void *, DWORD, DWORD);
|
void (*Callback)(unsigned int, void *);
|
||||||
void *CallbackData;
|
void *CallbackData;
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
@ -155,7 +156,7 @@ protected:
|
||||||
class AudioToolboxMIDIDevice : public MIDIDevice
|
class AudioToolboxMIDIDevice : public MIDIDevice
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual int Open(void (*callback)(unsigned int, void *, DWORD, DWORD), void *userData) override;
|
virtual int Open(MidiCallback, void *userData) override;
|
||||||
virtual void Close() override;
|
virtual void Close() override;
|
||||||
virtual bool IsOpen() const override;
|
virtual bool IsOpen() const override;
|
||||||
virtual int GetTechnology() const override;
|
virtual int GetTechnology() const override;
|
||||||
|
@ -217,7 +218,7 @@ protected:
|
||||||
class SndSysMIDIDevice : public PseudoMIDIDevice
|
class SndSysMIDIDevice : public PseudoMIDIDevice
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
int Open(void (*callback)(unsigned int, void *, DWORD, DWORD), void *userdata);
|
int Open(MidiCallback, void *userdata);
|
||||||
bool Preprocess(MIDIStreamer *song, bool looping);
|
bool Preprocess(MIDIStreamer *song, bool looping);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -229,7 +230,7 @@ public:
|
||||||
TimidityPPMIDIDevice(const char *args);
|
TimidityPPMIDIDevice(const char *args);
|
||||||
~TimidityPPMIDIDevice();
|
~TimidityPPMIDIDevice();
|
||||||
|
|
||||||
int Open(void (*callback)(unsigned int, void *, DWORD, DWORD), void *userdata);
|
int Open(MidiCallback, void *userdata);
|
||||||
bool Preprocess(MIDIStreamer *song, bool looping);
|
bool Preprocess(MIDIStreamer *song, bool looping);
|
||||||
bool IsOpen() const;
|
bool IsOpen() const;
|
||||||
int Resume();
|
int Resume();
|
||||||
|
@ -292,12 +293,12 @@ protected:
|
||||||
DWORD Position;
|
DWORD Position;
|
||||||
int SampleRate;
|
int SampleRate;
|
||||||
|
|
||||||
void (*Callback)(unsigned int, void *, DWORD, DWORD);
|
void (*Callback)(unsigned int, void *);
|
||||||
void *CallbackData;
|
void *CallbackData;
|
||||||
|
|
||||||
virtual void CalcTickRate();
|
virtual void CalcTickRate();
|
||||||
int PlayTick();
|
int PlayTick();
|
||||||
int OpenStream(int chunks, int flags, void (*callback)(unsigned int, void *, DWORD, DWORD), void *userdata);
|
int OpenStream(int chunks, int flags, MidiCallback, void *userdata);
|
||||||
static bool FillStream(SoundStream *stream, void *buff, int len, void *userdata);
|
static bool FillStream(SoundStream *stream, void *buff, int len, void *userdata);
|
||||||
virtual bool ServiceStream (void *buff, int numbytes);
|
virtual bool ServiceStream (void *buff, int numbytes);
|
||||||
|
|
||||||
|
@ -312,7 +313,7 @@ class OPLMIDIDevice : public SoftSynthMIDIDevice, protected OPLmusicBlock
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
OPLMIDIDevice(const char *args);
|
OPLMIDIDevice(const char *args);
|
||||||
int Open(void (*callback)(unsigned int, void *, DWORD, DWORD), void *userdata);
|
int Open(MidiCallback, void *userdata);
|
||||||
void Close();
|
void Close();
|
||||||
int GetTechnology() const;
|
int GetTechnology() const;
|
||||||
FString GetStats();
|
FString GetStats();
|
||||||
|
@ -347,7 +348,7 @@ public:
|
||||||
TimidityMIDIDevice(const char *args);
|
TimidityMIDIDevice(const char *args);
|
||||||
~TimidityMIDIDevice();
|
~TimidityMIDIDevice();
|
||||||
|
|
||||||
int Open(void (*callback)(unsigned int, void *, DWORD, DWORD), void *userdata);
|
int Open(MidiCallback, void *userdata);
|
||||||
void PrecacheInstruments(const uint16_t *instruments, int count);
|
void PrecacheInstruments(const uint16_t *instruments, int count);
|
||||||
FString GetStats();
|
FString GetStats();
|
||||||
|
|
||||||
|
@ -381,7 +382,7 @@ public:
|
||||||
WildMIDIDevice(const char *args);
|
WildMIDIDevice(const char *args);
|
||||||
~WildMIDIDevice();
|
~WildMIDIDevice();
|
||||||
|
|
||||||
int Open(void (*callback)(unsigned int, void *, DWORD, DWORD), void *userdata);
|
int Open(MidiCallback, void *userdata);
|
||||||
void PrecacheInstruments(const uint16_t *instruments, int count);
|
void PrecacheInstruments(const uint16_t *instruments, int count);
|
||||||
FString GetStats();
|
FString GetStats();
|
||||||
|
|
||||||
|
@ -413,7 +414,7 @@ public:
|
||||||
FluidSynthMIDIDevice(const char *args);
|
FluidSynthMIDIDevice(const char *args);
|
||||||
~FluidSynthMIDIDevice();
|
~FluidSynthMIDIDevice();
|
||||||
|
|
||||||
int Open(void (*callback)(unsigned int, void *, DWORD, DWORD), void *userdata);
|
int Open(MidiCallback, void *userdata);
|
||||||
FString GetStats();
|
FString GetStats();
|
||||||
void FluidSettingInt(const char *setting, int value);
|
void FluidSettingInt(const char *setting, int value);
|
||||||
void FluidSettingNum(const char *setting, double value);
|
void FluidSettingNum(const char *setting, double value);
|
||||||
|
@ -505,7 +506,7 @@ protected:
|
||||||
static EMidiDevice SelectMIDIDevice(EMidiDevice devtype);
|
static EMidiDevice SelectMIDIDevice(EMidiDevice devtype);
|
||||||
MIDIDevice *CreateMIDIDevice(EMidiDevice devtype) const;
|
MIDIDevice *CreateMIDIDevice(EMidiDevice devtype) const;
|
||||||
|
|
||||||
static void Callback(unsigned int uMsg, void *userdata, DWORD dwParam1, DWORD dwParam2);
|
static void Callback(unsigned int uMsg, void *userdata);
|
||||||
|
|
||||||
// Virtuals for subclasses to override
|
// Virtuals for subclasses to override
|
||||||
virtual void StartPlayback();
|
virtual void StartPlayback();
|
||||||
|
|
|
@ -40,7 +40,7 @@
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
|
|
||||||
int AudioToolboxMIDIDevice::Open(void (*callback)(unsigned int, void *, DWORD, DWORD), void *userData)
|
int AudioToolboxMIDIDevice::Open(MidiCallback callback, void *userData)
|
||||||
{
|
{
|
||||||
AT_MIDI_CHECK_ERROR(NewMusicPlayer(&m_player), false);
|
AT_MIDI_CHECK_ERROR(NewMusicPlayer(&m_player), false);
|
||||||
AT_MIDI_CHECK_ERROR(NewMusicSequence(&m_sequence), false);
|
AT_MIDI_CHECK_ERROR(NewMusicSequence(&m_sequence), false);
|
||||||
|
|
|
@ -372,7 +372,7 @@ FluidSynthMIDIDevice::~FluidSynthMIDIDevice()
|
||||||
//
|
//
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
||||||
int FluidSynthMIDIDevice::Open(void (*callback)(unsigned int, void *, DWORD, DWORD), void *userdata)
|
int FluidSynthMIDIDevice::Open(MidiCallback callback, void *userdata)
|
||||||
{
|
{
|
||||||
if (FluidSynth == NULL)
|
if (FluidSynth == NULL)
|
||||||
{
|
{
|
||||||
|
|
|
@ -178,7 +178,7 @@ bool TimidityPPMIDIDevice::Preprocess(MIDIStreamer *song, bool looping)
|
||||||
//
|
//
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
||||||
int TimidityPPMIDIDevice::Open(void (*callback)(unsigned int, void *, DWORD, DWORD), void *userdata)
|
int TimidityPPMIDIDevice::Open(MidiCallback callback, void *userdata)
|
||||||
{
|
{
|
||||||
int pipeSize;
|
int pipeSize;
|
||||||
|
|
||||||
|
|
|
@ -691,7 +691,7 @@ int MIDIStreamer::VolumeControllerChange(int channel, int volume)
|
||||||
//
|
//
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
||||||
void MIDIStreamer::Callback(unsigned int uMsg, void *userdata, DWORD dwParam1, DWORD dwParam2)
|
void MIDIStreamer::Callback(unsigned int uMsg, void *userdata)
|
||||||
{
|
{
|
||||||
MIDIStreamer *self = (MIDIStreamer *)userdata;
|
MIDIStreamer *self = (MIDIStreamer *)userdata;
|
||||||
|
|
||||||
|
|
|
@ -239,7 +239,7 @@ FString PseudoMIDIDevice::GetStats()
|
||||||
//
|
//
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
||||||
int SndSysMIDIDevice::Open(void (*callback)(unsigned int, void *, DWORD, DWORD), void *userdata)
|
int SndSysMIDIDevice::Open(MidiCallback callback, void *userdata)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -95,7 +95,7 @@ SoftSynthMIDIDevice::~SoftSynthMIDIDevice()
|
||||||
//
|
//
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
||||||
int SoftSynthMIDIDevice::OpenStream(int chunks, int flags, void (*callback)(unsigned int, void *, DWORD, DWORD), void *userdata)
|
int SoftSynthMIDIDevice::OpenStream(int chunks, int flags, MidiCallback callback, void *userdata)
|
||||||
{
|
{
|
||||||
int chunksize = (SampleRate / chunks) * 4;
|
int chunksize = (SampleRate / chunks) * 4;
|
||||||
if (!(flags & SoundStream::Mono))
|
if (!(flags & SoundStream::Mono))
|
||||||
|
@ -363,7 +363,7 @@ int SoftSynthMIDIDevice::PlayTick()
|
||||||
|
|
||||||
if (Callback != NULL)
|
if (Callback != NULL)
|
||||||
{
|
{
|
||||||
Callback(MOM_DONE, CallbackData, 0, 0);
|
Callback(MOM_DONE, CallbackData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -115,7 +115,7 @@ TimidityMIDIDevice::~TimidityMIDIDevice()
|
||||||
//
|
//
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
||||||
int TimidityMIDIDevice::Open(void (*callback)(unsigned int, void *, DWORD, DWORD), void *userdata)
|
int TimidityMIDIDevice::Open(MidiCallback callback, void *userdata)
|
||||||
{
|
{
|
||||||
int ret = OpenStream(2, 0, callback, userdata);
|
int ret = OpenStream(2, 0, callback, userdata);
|
||||||
if (ret == 0)
|
if (ret == 0)
|
||||||
|
|
|
@ -142,7 +142,7 @@ WildMIDIDevice::~WildMIDIDevice()
|
||||||
//
|
//
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
||||||
int WildMIDIDevice::Open(void (*callback)(unsigned int, void *, DWORD, DWORD), void *userdata)
|
int WildMIDIDevice::Open(MidiCallback callback, void *userdata)
|
||||||
{
|
{
|
||||||
if (Renderer == NULL)
|
if (Renderer == NULL)
|
||||||
{
|
{
|
||||||
|
|
|
@ -94,7 +94,7 @@ WinMIDIDevice::~WinMIDIDevice()
|
||||||
//
|
//
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
||||||
int WinMIDIDevice::Open(void (*callback)(UINT, void *, DWORD, DWORD), void *userdata)
|
int WinMIDIDevice::Open(MidiCallback callback, void *userdata)
|
||||||
{
|
{
|
||||||
MMRESULT err;
|
MMRESULT err;
|
||||||
|
|
||||||
|
@ -400,7 +400,7 @@ void CALLBACK WinMIDIDevice::CallbackFunc(HMIDIOUT hOut, UINT uMsg, DWORD_PTR dw
|
||||||
WinMIDIDevice *self = (WinMIDIDevice *)dwInstance;
|
WinMIDIDevice *self = (WinMIDIDevice *)dwInstance;
|
||||||
if (self->Callback != NULL)
|
if (self->Callback != NULL)
|
||||||
{
|
{
|
||||||
self->Callback(uMsg, self->CallbackData, dwParam1, dwParam2);
|
self->Callback(uMsg, self->CallbackData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue