wineoss: Simplify the midi in dispatcher.
The continue statement looks a bit awkward at the moment, but a future patch will introduce more code into the for loop. Signed-off-by: Huw Davies <huw@codeweavers.com> Signed-off-by: Andrew Eikum <aeikum@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
1d0dd6d778
commit
9a7924a687
|
@ -320,12 +320,23 @@ static void midReceiveChar(WORD wDevID, unsigned char value, DWORD dwTime)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void handle_midi_data(unsigned char *buffer, unsigned int len)
|
||||||
|
{
|
||||||
|
unsigned int time = GetTickCount(), i;
|
||||||
|
|
||||||
|
for (i = 0; i < len; i += (buffer[i] & 0x80) ? 8 : 4)
|
||||||
|
{
|
||||||
|
if (buffer[i] != SEQ_MIDIPUTC) continue;
|
||||||
|
|
||||||
|
midReceiveChar(buffer[i + 2], buffer[i + 1], time);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static DWORD WINAPI midRecThread(void *arg)
|
static DWORD WINAPI midRecThread(void *arg)
|
||||||
{
|
{
|
||||||
int fd = (int)(INT_PTR)arg;
|
int fd = (int)(INT_PTR)arg;
|
||||||
unsigned char buffer[256];
|
unsigned char buffer[256];
|
||||||
int len, idx;
|
int len;
|
||||||
DWORD dwTime;
|
|
||||||
struct pollfd pfd;
|
struct pollfd pfd;
|
||||||
|
|
||||||
TRACE("Thread startup\n");
|
TRACE("Thread startup\n");
|
||||||
|
@ -349,32 +360,7 @@ static DWORD WINAPI midRecThread(void *arg)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
dwTime = GetTickCount();
|
handle_midi_data(buffer, len);
|
||||||
|
|
||||||
for (idx = 0; idx < len; ) {
|
|
||||||
if (buffer[idx] & 0x80) {
|
|
||||||
TRACE(
|
|
||||||
"Reading<8> %02x %02x %02x %02x %02x %02x %02x %02x\n",
|
|
||||||
buffer[idx + 0], buffer[idx + 1],
|
|
||||||
buffer[idx + 2], buffer[idx + 3],
|
|
||||||
buffer[idx + 4], buffer[idx + 5],
|
|
||||||
buffer[idx + 6], buffer[idx + 7]);
|
|
||||||
idx += 8;
|
|
||||||
} else {
|
|
||||||
switch (buffer[idx + 0]) {
|
|
||||||
case SEQ_WAIT:
|
|
||||||
case SEQ_ECHO:
|
|
||||||
break;
|
|
||||||
case SEQ_MIDIPUTC:
|
|
||||||
midReceiveChar(buffer[idx + 2], buffer[idx + 1], dwTime);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
TRACE("Unsupported event %d\n", buffer[idx + 0]);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
idx += 4;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue