Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit bf323c8

Browse files
committed
portmidi: directly use Pm_Read in the while loop
the call to Pm_Poll before Pm_Read is redundant and caused problems because it doesn't report overflow errors! (so once an overflow occured sys_poll_midi would stop reading)
1 parent a68dbb9 commit bf323c8

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/s_midi_pm.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -273,11 +273,10 @@ void sys_poll_midi(void)
273273
PmEvent buffer;
274274
for (i = 0; i < mac_nmidiindev; i++)
275275
{
276-
while(Pm_Poll(mac_midiindevlist[i]))
276+
while((nmess = Pm_Read(mac_midiindevlist[i], &buffer, 1)))
277277
{
278278
if (!throttle--)
279279
goto overload;
280-
nmess = Pm_Read(mac_midiindevlist[i], &buffer, 1);
281280
if (nmess > 0)
282281
{
283282
int status = Pm_MessageStatus(buffer.message);
@@ -328,7 +327,7 @@ void sys_poll_midi(void)
328327
}
329328
else
330329
{
331-
error("portmidi: %s", Pm_GetErrorText(nmess));
330+
error("%s", Pm_GetErrorText(nmess));
332331
if (nmess != pmBufferOverflow)
333332
break;
334333
}

0 commit comments

Comments
 (0)