diff --git a/src/oplsynth/music_opl_mididevice.cpp b/src/oplsynth/music_opl_mididevice.cpp index f6cfab30e..1a7894028 100644 --- a/src/oplsynth/music_opl_mididevice.cpp +++ b/src/oplsynth/music_opl_mididevice.cpp @@ -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))) { diff --git a/src/sound/i_musicinterns.h b/src/sound/i_musicinterns.h index 060e72e49..d8638afcf 100644 --- a/src/sound/i_musicinterns.h +++ b/src/sound/i_musicinterns.h @@ -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(); diff --git a/src/sound/music_audiotoolbox_mididevice.cpp b/src/sound/music_audiotoolbox_mididevice.cpp index 8ff54e141..8d36a0f5a 100644 --- a/src/sound/music_audiotoolbox_mididevice.cpp +++ b/src/sound/music_audiotoolbox_mididevice.cpp @@ -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); diff --git a/src/sound/music_fluidsynth_mididevice.cpp b/src/sound/music_fluidsynth_mididevice.cpp index 793fce0b1..087a0ce3d 100644 --- a/src/sound/music_fluidsynth_mididevice.cpp +++ b/src/sound/music_fluidsynth_mididevice.cpp @@ -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) { diff --git a/src/sound/music_midi_timidity.cpp b/src/sound/music_midi_timidity.cpp index 2f4025ca6..c3fbe31b1 100644 --- a/src/sound/music_midi_timidity.cpp +++ b/src/sound/music_midi_timidity.cpp @@ -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; diff --git a/src/sound/music_midistream.cpp b/src/sound/music_midistream.cpp index 83bdf6db7..58214d1a7 100644 --- a/src/sound/music_midistream.cpp +++ b/src/sound/music_midistream.cpp @@ -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; diff --git a/src/sound/music_pseudo_mididevice.cpp b/src/sound/music_pseudo_mididevice.cpp index ecfed0da2..388c31931 100644 --- a/src/sound/music_pseudo_mididevice.cpp +++ b/src/sound/music_pseudo_mididevice.cpp @@ -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; } diff --git a/src/sound/music_softsynth_mididevice.cpp b/src/sound/music_softsynth_mididevice.cpp index 1d4086e02..d0e8b7ef5 100644 --- a/src/sound/music_softsynth_mididevice.cpp +++ b/src/sound/music_softsynth_mididevice.cpp @@ -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); } } diff --git a/src/sound/music_timidity_mididevice.cpp b/src/sound/music_timidity_mididevice.cpp index 443d2f6bd..afc570ae1 100644 --- a/src/sound/music_timidity_mididevice.cpp +++ b/src/sound/music_timidity_mididevice.cpp @@ -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) diff --git a/src/sound/music_wildmidi_mididevice.cpp b/src/sound/music_wildmidi_mididevice.cpp index db14a873b..c446105a8 100644 --- a/src/sound/music_wildmidi_mididevice.cpp +++ b/src/sound/music_wildmidi_mididevice.cpp @@ -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) { diff --git a/src/sound/music_win_mididevice.cpp b/src/sound/music_win_mididevice.cpp index 0da1297d2..f6b9bc21c 100644 --- a/src/sound/music_win_mididevice.cpp +++ b/src/sound/music_win_mididevice.cpp @@ -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); } }