- removed all dependencies on Windows-defined constants, rename the ones for non-Windows platforms and use those througout.

This should remove all dependencies on Windows definitions from the music interface, what remains is some cleanup.
This commit is contained in:
Christoph Oelckers 2017-03-10 12:39:23 +01:00
parent 9d5f8ba250
commit 86d8f9ca83
12 changed files with 100 additions and 111 deletions

View file

@ -131,7 +131,7 @@ void OPLMIDIDevice::Close()
int OPLMIDIDevice::GetTechnology() const
{
return MOD_FMSYNTH;
return MIDIDEV_FMSYNTH;
}
//==========================================================================

View file

@ -47,41 +47,33 @@ struct MidiHeader
MidiHeader *lpNext;
};
#ifndef _WIN32
// These constants must match the corresponding values of the Windows headers
// to avoid readjustment in the native Windows device's playback functions
// and should not be changed.
enum
{
MOD_MIDIPORT = 1,
MOD_SYNTH,
MOD_SQSYNTH,
MOD_FMSYNTH,
MOD_MAPPER,
MOD_WAVETABLE,
MOD_SWSYNTH
MIDIDEV_MIDIPORT = 1,
MIDIDEV_SYNTH,
MIDIDEV_SQSYNTH,
MIDIDEV_FMSYNTH,
MIDIDEV_MAPPER,
MIDIDEV_WAVETABLE,
MIDIDEV_SWSYNTH
};
typedef uint8_t *LPSTR;
enum : uint8_t
{
MEVENT_TEMPO = 1,
MEVENT_NOP = 2,
MEVENT_LONGMSG = 128,
};
#define MEVT_TEMPO ((uint8_t)1)
#define MEVT_NOP ((uint8_t)2)
#define MEVT_LONGMSG ((uint8_t)128)
#define MEVT_EVENTTYPE(x) ((uint8_t)((x) >> 24))
#define MEVT_EVENTPARM(x) ((x) & 0xffffff)
#define MOM_DONE 969
#else
// w32api does not define these
#ifndef MOD_WAVETABLE
#define MOD_WAVETABLE 6
#define MOD_SWSYNTH 7
#endif
#endif
#define MEVENT_EVENTTYPE(x) ((uint8_t)((x) >> 24))
#define MEVENT_EVENTPARM(x) ((x) & 0xffffff)
class MIDIStreamer;
typedef void(*MidiCallback)(unsigned int, void *);
typedef void(*MidiCallback)(void *);
class MIDIDevice
{
public:
@ -148,7 +140,7 @@ protected:
int HeaderIndex;
bool VolumeWorks;
void (*Callback)(unsigned int, void *);
MidiCallback Callback;
void *CallbackData;
};
#endif
@ -182,7 +174,7 @@ private:
CFRunLoopTimerRef m_timer = nullptr;
MusicTimeStamp m_length = 0;
typedef void (*Callback)(unsigned int, void *, DWORD, DWORD);
MidiCallback Callback;
Callback m_callback = nullptr;
void* m_userData = nullptr;
@ -297,7 +289,7 @@ protected:
DWORD Position;
int SampleRate;
void (*Callback)(unsigned int, void *);
MidiCallback Callback;
void *CallbackData;
virtual void CalcTickRate();
@ -510,7 +502,7 @@ protected:
static EMidiDevice SelectMIDIDevice(EMidiDevice devtype);
MIDIDevice *CreateMIDIDevice(EMidiDevice devtype) const;
static void Callback(unsigned int uMsg, void *userdata);
static void Callback(void *userdata);
// Virtuals for subclasses to override
virtual void StartPlayback();

View file

@ -101,7 +101,7 @@ bool AudioToolboxMIDIDevice::IsOpen() const
int AudioToolboxMIDIDevice::GetTechnology() const
{
return MOD_SWSYNTH;
return MIDIDEV_SWSYNTH;
}
int AudioToolboxMIDIDevice::SetTempo(int tempo)
@ -180,7 +180,7 @@ int AudioToolboxMIDIDevice::PrepareHeader(MidiHeader* data)
DWORD* const event = reinterpret_cast<DWORD*>(events->lpData + position);
const DWORD message = event[2];
if (0 == MEVT_EVENTTYPE(message))
if (0 == MEVENT_EVENTTYPE(message))
{
static const DWORD VOLUME_CHANGE_EVENT = 7;
@ -197,7 +197,7 @@ int AudioToolboxMIDIDevice::PrepareHeader(MidiHeader* data)
// Advance to next event
position += 12 + ( (message < 0x80000000)
? 0
: ((MEVT_EVENTPARM(message) + 3) & ~3) );
: ((MEVENT_EVENTPARM(message) + 3) & ~3) );
// Did we use up this buffer?
if (position >= events->dwBytesRecorded)
@ -275,7 +275,7 @@ void AudioToolboxMIDIDevice::TimerCallback(CFRunLoopTimerRef timer, void* info)
if (nullptr != self->m_callback)
{
self->m_callback(MOM_DONE, self->m_userData, 0, 0);
self->m_callback(MIDI_DONE, self->m_userData);
}
MusicTimeStamp currentTime = 0;

View file

@ -382,11 +382,11 @@ void HMISong::SetupForHMP(int len)
void HMISong::CheckCaps(int tech)
{
// What's the equivalent HMI device for our technology?
if (tech == MOD_FMSYNTH)
if (tech == MIDIDEV_FMSYNTH)
{
tech = HMI_DEV_OPL3;
}
else if (tech == MOD_MIDIPORT)
else if (tech == MIDIDEV_MIDIPORT)
{
tech = HMI_DEV_MPU401;
}
@ -601,7 +601,7 @@ DWORD *HMISong::SendCommand (DWORD *events, TrackInfo *track, DWORD delay, ptrdi
// Otherwise, we do it at the end of the function.
events[0] = delay;
events[1] = 0;
events[2] = MEVT_NOP << 24;
events[2] = MEVENT_NOP << 24;
if (event != MIDI_SYSEX && event != MIDI_META && event != MIDI_SYSEXEND && event != 0xFe)
{
@ -672,12 +672,12 @@ DWORD *HMISong::SendCommand (DWORD *events, TrackInfo *track, DWORD delay, ptrdi
uint8_t *msg = (uint8_t *)&events[3];
if (event == MIDI_SYSEX)
{ // Need to add the SysEx marker to the message.
events[2] = (MEVT_LONGMSG << 24) | (len + 1);
events[2] = (MEVENT_LONGMSG << 24) | (len + 1);
*msg++ = MIDI_SYSEX;
}
else
{
events[2] = (MEVT_LONGMSG << 24) | len;
events[2] = (MEVENT_LONGMSG << 24) | len;
}
memcpy(msg, &track->TrackBegin[track->TrackP], len);
msg += len;
@ -712,7 +712,7 @@ DWORD *HMISong::SendCommand (DWORD *events, TrackInfo *track, DWORD delay, ptrdi
(track->TrackBegin[track->TrackP+2]);
events[0] = delay;
events[1] = 0;
events[2] = (MEVT_TEMPO << 24) | Tempo;
events[2] = (MEVENT_TEMPO << 24) | Tempo;
break;
}
track->TrackP += len;
@ -756,11 +756,11 @@ DWORD *HMISong::SendCommand (DWORD *events, TrackInfo *track, DWORD delay, ptrdi
track->Delay = ReadVarLen(track);
}
// Advance events pointer unless this is a non-delaying NOP.
if (events[0] != 0 || MEVT_EVENTTYPE(events[2]) != MEVT_NOP)
if (events[0] != 0 || MEVENT_EVENTTYPE(events[2]) != MEVENT_NOP)
{
if (MEVT_EVENTTYPE(events[2]) == MEVT_LONGMSG)
if (MEVENT_EVENTTYPE(events[2]) == MEVENT_LONGMSG)
{
events += 3 + ((MEVT_EVENTPARM(events[2]) + 3) >> 2);
events += 3 + ((MEVENT_EVENTPARM(events[2]) + 3) >> 2);
}
else
{

View file

@ -139,13 +139,13 @@ static void PrintMidiDevice (int id, const char *name, uint16_t tech, DWORD supp
Printf ("% 2d. %s : ", id, name);
switch (tech)
{
case MOD_MIDIPORT: Printf ("MIDIPORT"); break;
case MOD_SYNTH: Printf ("SYNTH"); break;
case MOD_SQSYNTH: Printf ("SQSYNTH"); break;
case MOD_FMSYNTH: Printf ("FMSYNTH"); break;
case MOD_MAPPER: Printf ("MAPPER"); break;
case MOD_WAVETABLE: Printf ("WAVETABLE"); break;
case MOD_SWSYNTH: Printf ("SWSYNTH"); break;
case MIDIDEV_MIDIPORT: Printf ("MIDIPORT"); break;
case MIDIDEV_SYNTH: Printf ("SYNTH"); break;
case MIDIDEV_SQSYNTH: Printf ("SQSYNTH"); break;
case MIDIDEV_FMSYNTH: Printf ("FMSYNTH"); break;
case MIDIDEV_MAPPER: Printf ("MAPPER"); break;
case MIDIDEV_WAVETABLE: Printf ("WAVETABLE"); break;
case MIDIDEV_SWSYNTH: Printf ("SWSYNTH"); break;
}
if (support & MIDICAPS_CACHE)
{
@ -172,13 +172,13 @@ CCMD (snd_listmididevices)
MIDIOUTCAPS caps;
MMRESULT res;
PrintMidiDevice (-6, "WildMidi", MOD_SWSYNTH, 0);
PrintMidiDevice (-6, "WildMidi", MIDIDEV_SWSYNTH, 0);
#ifdef HAVE_FLUIDSYNTH
PrintMidiDevice (-5, "FluidSynth", MOD_SWSYNTH, 0);
PrintMidiDevice (-5, "FluidSynth", MIDIDEV_SWSYNTH, 0);
#endif
PrintMidiDevice (-4, "Gravis Ultrasound Emulation", MOD_SWSYNTH, 0);
PrintMidiDevice (-3, "Emulated OPL FM Synth", MOD_FMSYNTH, 0);
PrintMidiDevice (-2, "TiMidity++", MOD_SWSYNTH, 0);
PrintMidiDevice (-4, "Gravis Ultrasound Emulation", MIDIDEV_SWSYNTH, 0);
PrintMidiDevice (-3, "Emulated OPL FM Synth", MIDIDEV_FMSYNTH, 0);
PrintMidiDevice (-2, "TiMidity++", MIDIDEV_SWSYNTH, 0);
PrintMidiDevice (-1, "Sound System", 0, 0);
if (nummididevices != 0)
{

View file

@ -693,7 +693,7 @@ int MIDIStreamer::VolumeControllerChange(int channel, int volume)
//
//==========================================================================
void MIDIStreamer::Callback(unsigned int uMsg, void *userdata)
void MIDIStreamer::Callback(void *userdata)
{
MIDIStreamer *self = (MIDIStreamer *)userdata;
@ -701,18 +701,15 @@ void MIDIStreamer::Callback(unsigned int uMsg, void *userdata)
{
return;
}
if (uMsg == MOM_DONE)
{
#ifdef _WIN32
if (self->PlayerThread != NULL)
{
SetEvent(self->BufferDoneEvent);
}
else
if (self->PlayerThread != NULL)
{
SetEvent(self->BufferDoneEvent);
}
else
#endif
{
self->ServiceEvent();
}
{
self->ServiceEvent();
}
}
@ -944,7 +941,7 @@ int MIDIStreamer::FillBuffer(int buffer_num, int max_events, DWORD max_time)
// Send the full master volume SysEx message.
events[0] = 0; // dwDeltaTime
events[1] = 0; // dwStreamID
events[2] = (MEVT_LONGMSG << 24) | 8; // dwEvent
events[2] = (MEVENT_LONGMSG << 24) | 8; // dwEvent
events[3] = MAKE_ID(0xf0,0x7f,0x7f,0x04); // dwParms[0]
events[4] = MAKE_ID(0x01,0x7f,0x7f,0xf7); // dwParms[1]
events += 5;
@ -972,7 +969,7 @@ int MIDIStreamer::FillBuffer(int buffer_num, int max_events, DWORD max_time)
// for a third of the maximum time.
events[0] = MAX<DWORD>(1, (max_time / 3) * Division / Tempo);
events[1] = 0;
events[2] = MEVT_NOP << 24;
events[2] = MEVENT_NOP << 24;
events += 3;
}
else
@ -983,7 +980,7 @@ int MIDIStreamer::FillBuffer(int buffer_num, int max_events, DWORD max_time)
// Reset the tempo to the inital value.
events[0] = 0; // dwDeltaTime
events[1] = 0; // dwStreamID
events[2] = (MEVT_TEMPO << 24) | InitialTempo; // dwEvent
events[2] = (MEVENT_TEMPO << 24) | InitialTempo; // dwEvent
events += 3;
// Stop all notes in case any were left hanging.
events = WriteStopNotes(events);
@ -1020,7 +1017,7 @@ int MIDIStreamer::FillStopBuffer(int buffer_num)
// wait some tics, just so that this buffer takes some time
events[0] = 500;
events[1] = 0;
events[2] = MEVT_NOP << 24;
events[2] = MEVENT_NOP << 24;
events += 3;
memset(&Buffer[buffer_num], 0, sizeof(MidiHeader));
@ -1086,7 +1083,7 @@ void MIDIStreamer::Precache()
DWORD *event_end = MakeEvents(Events[0], &Events[0][MAX_EVENTS*3], 1000000*600);
for (DWORD *event = Events[0]; event < event_end; )
{
if (MEVT_EVENTTYPE(event[2]) == 0)
if (MEVENT_EVENTTYPE(event[2]) == 0)
{
int command = (event[2] & 0x70);
int channel = (event[2] & 0x0f);
@ -1126,7 +1123,7 @@ void MIDIStreamer::Precache()
}
else
{ // long message
event += 3 + ((MEVT_EVENTPARM(event[2]) + 3) >> 2);
event += 3 + ((MEVENT_EVENTPARM(event[2]) + 3) >> 2);
}
}
}
@ -1175,7 +1172,7 @@ void MIDIStreamer::CreateSMF(TArray<uint8_t> &file, int looplimit)
uint8_t running_status = 255;
// Always create songs aimed at GM devices.
CheckCaps(MOD_MIDIPORT);
CheckCaps(MIDIDEV_MIDIPORT);
LoopLimit = looplimit <= 0 ? EXPORT_LOOP_LIMIT : looplimit;
DoRestart();
Tempo = InitialTempo;
@ -1194,11 +1191,11 @@ void MIDIStreamer::CreateSMF(TArray<uint8_t> &file, int looplimit)
for (DWORD *event = Events[0]; event < event_end; )
{
delay += event[0];
if (MEVT_EVENTTYPE(event[2]) == MEVT_TEMPO)
if (MEVENT_EVENTTYPE(event[2]) == MEVENT_TEMPO)
{
WriteVarLen(file, delay);
delay = 0;
DWORD tempo = MEVT_EVENTPARM(event[2]);
DWORD tempo = MEVENT_EVENTPARM(event[2]);
file.Push(MIDI_META);
file.Push(MIDI_META_TEMPO);
file.Push(3);
@ -1207,11 +1204,11 @@ void MIDIStreamer::CreateSMF(TArray<uint8_t> &file, int looplimit)
file.Push(uint8_t(tempo));
running_status = 255;
}
else if (MEVT_EVENTTYPE(event[2]) == MEVT_LONGMSG)
else if (MEVENT_EVENTTYPE(event[2]) == MEVENT_LONGMSG)
{
WriteVarLen(file, delay);
delay = 0;
DWORD len = MEVT_EVENTPARM(event[2]);
DWORD len = MEVENT_EVENTPARM(event[2]);
uint8_t *bytes = (uint8_t *)&event[3];
if (bytes[0] == MIDI_SYSEX)
{
@ -1228,7 +1225,7 @@ void MIDIStreamer::CreateSMF(TArray<uint8_t> &file, int looplimit)
}
running_status = 255;
}
else if (MEVT_EVENTTYPE(event[2]) == 0)
else if (MEVENT_EVENTTYPE(event[2]) == 0)
{
WriteVarLen(file, delay);
delay = 0;
@ -1251,7 +1248,7 @@ void MIDIStreamer::CreateSMF(TArray<uint8_t> &file, int looplimit)
}
else
{ // long message
event += 3 + ((MEVT_EVENTPARM(event[2]) + 3) >> 2);
event += 3 + ((MEVENT_EVENTPARM(event[2]) + 3) >> 2);
}
}
}
@ -1307,7 +1304,7 @@ static void WriteVarLen (TArray<uint8_t> &file, DWORD value)
// MIDIStreamer :: SetTempo
//
// Sets the tempo from a track's initial meta events. Later tempo changes
// create MEVT_TEMPO events instead.
// create MEVENT_TEMPO events instead.
//
//==========================================================================

View file

@ -370,7 +370,7 @@ end:
{
events[0] = time; // dwDeltaTime
events[1] = 0; // dwStreamID
events[2] = MEVT_NOP << 24; // dwEvent
events[2] = MEVENT_NOP << 24; // dwEvent
events += 3;
}
return events;

View file

@ -117,7 +117,7 @@ bool PseudoMIDIDevice::IsOpen() const
int PseudoMIDIDevice::GetTechnology() const
{
return MOD_MIDIPORT;
return MIDIDEV_MIDIPORT;
}
//==========================================================================

View file

@ -213,11 +213,11 @@ MIDISong2::~MIDISong2 ()
void MIDISong2::CheckCaps(int tech)
{
DesignationMask = 0xFF0F;
if (tech == MOD_FMSYNTH)
if (tech == MIDIDEV_FMSYNTH)
{
DesignationMask = 0x00F0;
}
else if (tech == MOD_MIDIPORT)
else if (tech == MIDIDEV_MIDIPORT)
{
DesignationMask = 0x0001;
}
@ -387,7 +387,7 @@ DWORD *MIDISong2::SendCommand (DWORD *events, TrackInfo *track, DWORD delay, ptr
// The actual event type will be filled in below.
events[0] = delay;
events[1] = 0;
events[2] = MEVT_NOP << 24;
events[2] = MEVENT_NOP << 24;
if (event != MIDI_SYSEX && event != MIDI_META && event != MIDI_SYSEXEND)
{
@ -613,12 +613,12 @@ DWORD *MIDISong2::SendCommand (DWORD *events, TrackInfo *track, DWORD delay, ptr
uint8_t *msg = (uint8_t *)&events[3];
if (event == MIDI_SYSEX)
{ // Need to add the SysEx marker to the message.
events[2] = (MEVT_LONGMSG << 24) | (len + 1);
events[2] = (MEVENT_LONGMSG << 24) | (len + 1);
*msg++ = MIDI_SYSEX;
}
else
{
events[2] = (MEVT_LONGMSG << 24) | len;
events[2] = (MEVENT_LONGMSG << 24) | len;
}
memcpy(msg, &track->TrackBegin[track->TrackP], len);
msg += len;
@ -653,7 +653,7 @@ DWORD *MIDISong2::SendCommand (DWORD *events, TrackInfo *track, DWORD delay, ptr
(track->TrackBegin[track->TrackP+2]);
events[0] = delay;
events[1] = 0;
events[2] = (MEVT_TEMPO << 24) | Tempo;
events[2] = (MEVENT_TEMPO << 24) | Tempo;
break;
}
track->TrackP += len;
@ -673,11 +673,11 @@ DWORD *MIDISong2::SendCommand (DWORD *events, TrackInfo *track, DWORD delay, ptr
track->Delay = track->ReadVarLen();
}
// Advance events pointer unless this is a non-delaying NOP.
if (events[0] != 0 || MEVT_EVENTTYPE(events[2]) != MEVT_NOP)
if (events[0] != 0 || MEVENT_EVENTTYPE(events[2]) != MEVENT_NOP)
{
if (MEVT_EVENTTYPE(events[2]) == MEVT_LONGMSG)
if (MEVENT_EVENTTYPE(events[2]) == MEVENT_LONGMSG)
{
events += 3 + ((MEVT_EVENTPARM(events[2]) + 3) >> 2);
events += 3 + ((MEVENT_EVENTPARM(events[2]) + 3) >> 2);
}
else
{

View file

@ -151,7 +151,7 @@ bool SoftSynthMIDIDevice::IsOpen() const
int SoftSynthMIDIDevice::GetTechnology() const
{
return MOD_SWSYNTH;
return MIDIDEV_SWSYNTH;
}
//==========================================================================
@ -307,15 +307,15 @@ int SoftSynthMIDIDevice::PlayTick()
while (delay == 0 && Events != NULL)
{
DWORD *event = (DWORD *)(Events->lpData + Position);
if (MEVT_EVENTTYPE(event[2]) == MEVT_TEMPO)
if (MEVENT_EVENTTYPE(event[2]) == MEVENT_TEMPO)
{
SetTempo(MEVT_EVENTPARM(event[2]));
SetTempo(MEVENT_EVENTPARM(event[2]));
}
else if (MEVT_EVENTTYPE(event[2]) == MEVT_LONGMSG)
else if (MEVENT_EVENTTYPE(event[2]) == MEVENT_LONGMSG)
{
HandleLongEvent((uint8_t *)&event[3], MEVT_EVENTPARM(event[2]));
HandleLongEvent((uint8_t *)&event[3], MEVENT_EVENTPARM(event[2]));
}
else if (MEVT_EVENTTYPE(event[2]) == 0)
else if (MEVENT_EVENTTYPE(event[2]) == 0)
{ // Short MIDI event
int status = event[2] & 0xff;
int parm1 = (event[2] >> 8) & 0x7f;
@ -352,7 +352,7 @@ int SoftSynthMIDIDevice::PlayTick()
}
else
{ // Long message
Position += 12 + ((MEVT_EVENTPARM(event[2]) + 3) & ~3);
Position += 12 + ((MEVENT_EVENTPARM(event[2]) + 3) & ~3);
}
// Did we use up this buffer?
@ -363,7 +363,7 @@ int SoftSynthMIDIDevice::PlayTick()
if (Callback != NULL)
{
Callback(MOM_DONE, CallbackData);
Callback(CallbackData);
}
}

View file

@ -424,9 +424,9 @@ bool WinMIDIDevice::NeedThreadedCallback()
void CALLBACK WinMIDIDevice::CallbackFunc(HMIDIOUT hOut, UINT uMsg, DWORD_PTR dwInstance, DWORD dwParam1, DWORD dwParam2)
{
WinMIDIDevice *self = (WinMIDIDevice *)dwInstance;
if (self->Callback != NULL)
if (self->Callback != NULL && uMsg == MOM_DONE)
{
self->Callback(uMsg, self->CallbackData);
self->Callback(self->CallbackData);
}
}
@ -462,9 +462,9 @@ static bool IgnoreMIDIVolume(UINT id)
if (MMSYSERR_NOERROR == midiOutGetDevCaps(id, &caps, sizeof(caps)))
{
// The Microsoft GS Wavetable Synth advertises itself as MOD_SWSYNTH with a VOLUME control.
// The Microsoft GS Wavetable Synth advertises itself as 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 == MOD_SWSYNTH && (caps.dwSupport & MIDICAPS_VOLUME))
if (caps.wTechnology == MIDIDEV_SWSYNTH && (caps.dwSupport & MIDICAPS_VOLUME))
{
if (strncmp(caps.szPname, "Microsoft GS", 12) == 0)
{

View file

@ -416,7 +416,7 @@ DWORD *XMISong::SendCommand (DWORD *events, EventSource due, DWORD delay, ptrdif
// Otherwise, we do it at the end of the function.
events[0] = delay;
events[1] = 0;
events[2] = MEVT_NOP << 24;
events[2] = MEVENT_NOP << 24;
if (event != MIDI_SYSEX && event != MIDI_META && event != MIDI_SYSEXEND)
{
@ -543,12 +543,12 @@ DWORD *XMISong::SendCommand (DWORD *events, EventSource due, DWORD delay, ptrdif
uint8_t *msg = (uint8_t *)&events[3];
if (event == MIDI_SYSEX)
{ // Need to add the SysEx marker to the message.
events[2] = (MEVT_LONGMSG << 24) | (len + 1);
events[2] = (MEVENT_LONGMSG << 24) | (len + 1);
*msg++ = MIDI_SYSEX;
}
else
{
events[2] = (MEVT_LONGMSG << 24) | len;
events[2] = (MEVENT_LONGMSG << 24) | len;
}
memcpy(msg, &track->EventChunk[track->EventP++], len);
msg += len;
@ -591,11 +591,11 @@ DWORD *XMISong::SendCommand (DWORD *events, EventSource due, DWORD delay, ptrdif
track->Delay = track->ReadDelay();
}
// Advance events pointer unless this is a non-delaying NOP.
if (events[0] != 0 || MEVT_EVENTTYPE(events[2]) != MEVT_NOP)
if (events[0] != 0 || MEVENT_EVENTTYPE(events[2]) != MEVENT_NOP)
{
if (MEVT_EVENTTYPE(events[2]) == MEVT_LONGMSG)
if (MEVENT_EVENTTYPE(events[2]) == MEVENT_LONGMSG)
{
events += 3 + ((MEVT_EVENTPARM(events[2]) + 3) >> 2);
events += 3 + ((MEVENT_EVENTPARM(events[2]) + 3) >> 2);
}
else
{