mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-11 15:22:16 +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)))
|
||||
{
|
||||
|
|
|
@ -79,13 +79,14 @@ typedef uint8_t *LPSTR;
|
|||
|
||||
class MIDIStreamer;
|
||||
|
||||
typedef void(*MidiCallback)(unsigned int, void *);
|
||||
class MIDIDevice
|
||||
{
|
||||
public:
|
||||
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 bool IsOpen() const = 0;
|
||||
virtual int GetTechnology() const = 0;
|
||||
|
@ -118,7 +119,7 @@ class WinMIDIDevice : public MIDIDevice
|
|||
public:
|
||||
WinMIDIDevice(int dev_id);
|
||||
~WinMIDIDevice();
|
||||
int Open(void (*callback)(unsigned int, void *, DWORD, DWORD), void *userdata);
|
||||
int Open(MidiCallback, void *userdata);
|
||||
void Close();
|
||||
bool IsOpen() const;
|
||||
int GetTechnology() const;
|
||||
|
@ -143,7 +144,7 @@ protected:
|
|||
DWORD SavedVolume;
|
||||
bool VolumeWorks;
|
||||
|
||||
void (*Callback)(unsigned int, void *, DWORD, DWORD);
|
||||
void (*Callback)(unsigned int, void *);
|
||||
void *CallbackData;
|
||||
};
|
||||
#endif
|
||||
|
@ -155,7 +156,7 @@ protected:
|
|||
class AudioToolboxMIDIDevice : public MIDIDevice
|
||||
{
|
||||
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 bool IsOpen() const override;
|
||||
virtual int GetTechnology() const override;
|
||||
|
@ -217,7 +218,7 @@ protected:
|
|||
class SndSysMIDIDevice : public PseudoMIDIDevice
|
||||
{
|
||||
public:
|
||||
int Open(void (*callback)(unsigned int, void *, DWORD, DWORD), void *userdata);
|
||||
int Open(MidiCallback, void *userdata);
|
||||
bool Preprocess(MIDIStreamer *song, bool looping);
|
||||
};
|
||||
|
||||
|
@ -229,7 +230,7 @@ public:
|
|||
TimidityPPMIDIDevice(const char *args);
|
||||
~TimidityPPMIDIDevice();
|
||||
|
||||
int Open(void (*callback)(unsigned int, void *, DWORD, DWORD), void *userdata);
|
||||
int Open(MidiCallback, void *userdata);
|
||||
bool Preprocess(MIDIStreamer *song, bool looping);
|
||||
bool IsOpen() const;
|
||||
int Resume();
|
||||
|
@ -292,12 +293,12 @@ protected:
|
|||
DWORD Position;
|
||||
int SampleRate;
|
||||
|
||||
void (*Callback)(unsigned int, void *, DWORD, DWORD);
|
||||
void (*Callback)(unsigned int, void *);
|
||||
void *CallbackData;
|
||||
|
||||
virtual void CalcTickRate();
|
||||
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);
|
||||
virtual bool ServiceStream (void *buff, int numbytes);
|
||||
|
||||
|
@ -312,7 +313,7 @@ class OPLMIDIDevice : public SoftSynthMIDIDevice, protected OPLmusicBlock
|
|||
{
|
||||
public:
|
||||
OPLMIDIDevice(const char *args);
|
||||
int Open(void (*callback)(unsigned int, void *, DWORD, DWORD), void *userdata);
|
||||
int Open(MidiCallback, void *userdata);
|
||||
void Close();
|
||||
int GetTechnology() const;
|
||||
FString GetStats();
|
||||
|
@ -347,7 +348,7 @@ public:
|
|||
TimidityMIDIDevice(const char *args);
|
||||
~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);
|
||||
FString GetStats();
|
||||
|
||||
|
@ -381,7 +382,7 @@ public:
|
|||
WildMIDIDevice(const char *args);
|
||||
~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);
|
||||
FString GetStats();
|
||||
|
||||
|
@ -413,7 +414,7 @@ public:
|
|||
FluidSynthMIDIDevice(const char *args);
|
||||
~FluidSynthMIDIDevice();
|
||||
|
||||
int Open(void (*callback)(unsigned int, void *, DWORD, DWORD), void *userdata);
|
||||
int Open(MidiCallback, void *userdata);
|
||||
FString GetStats();
|
||||
void FluidSettingInt(const char *setting, int value);
|
||||
void FluidSettingNum(const char *setting, double value);
|
||||
|
@ -505,7 +506,7 @@ protected:
|
|||
static EMidiDevice SelectMIDIDevice(EMidiDevice devtype);
|
||||
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
|
||||
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(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)
|
||||
{
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
if (!(flags & SoundStream::Mono))
|
||||
|
@ -363,7 +363,7 @@ int SoftSynthMIDIDevice::PlayTick()
|
|||
|
||||
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);
|
||||
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)
|
||||
{
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
@ -400,7 +400,7 @@ void CALLBACK WinMIDIDevice::CallbackFunc(HMIDIOUT hOut, UINT uMsg, DWORD_PTR dw
|
|||
WinMIDIDevice *self = (WinMIDIDevice *)dwInstance;
|
||||
if (self->Callback != NULL)
|
||||
{
|
||||
self->Callback(uMsg, self->CallbackData, dwParam1, dwParam2);
|
||||
self->Callback(uMsg, self->CallbackData);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue