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

Skip to content

Commit 685b439

Browse files
committed
Backport Spacechild1's further improvements to the PortMidi backend.
See: pure-data/pure-data@9b9b2eb5 pure-data/pure-data@a68dbb97 pure-data/pure-data@bf323c88 pure-data/pure-data@7de61e64
1 parent 5f71476 commit 685b439

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

pd/src/s_midi_pm.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ void sys_do_open_midi(int nmidiin, int *midiinvec,
6464
if (devno == midiinvec[i])
6565
{
6666
err = Pm_OpenInput(&mac_midiindevlist[mac_nmidiindev],
67-
j, NULL, 100, NULL, NULL);
67+
j, NULL, 1024, NULL, NULL);
6868
if (err)
6969
post("could not open midi input %d (%s): %s",
7070
j, info->name, Pm_GetErrorText(err));
@@ -279,11 +279,10 @@ void sys_poll_midi(void)
279279
PmEvent buffer;
280280
for (i = 0; i < mac_nmidiindev; i++)
281281
{
282-
if(Pm_Poll(mac_midiindevlist[i]))
282+
while((nmess = Pm_Read(mac_midiindevlist[i], &buffer, 1)))
283283
{
284284
if (!throttle--)
285285
goto overload;
286-
nmess = Pm_Read(mac_midiindevlist[i], &buffer, 1);
287286
if (nmess > 0)
288287
{
289288
int status = Pm_MessageStatus(buffer.message);
@@ -332,8 +331,12 @@ void sys_poll_midi(void)
332331
break;
333332
}
334333
}
335-
else if (nmess != pmBufferOverflow)
336-
break;
334+
else
335+
{
336+
error("%s", Pm_GetErrorText(nmess));
337+
if (nmess != pmBufferOverflow)
338+
break;
339+
}
337340
}
338341
}
339342
overload: ;

0 commit comments

Comments
 (0)