From 9c0f4e6683fca1c971d2cc047ffec09d8ac46bcd Mon Sep 17 00:00:00 2001 From: "R. Belmont" Date: Tue, 15 Jan 2013 14:45:36 +0000 Subject: MIDI: Fixed several bugs and bumped the input buffer sizes [R. Belmont] --- src/osd/portmedia/pmmidi.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/osd') diff --git a/src/osd/portmedia/pmmidi.c b/src/osd/portmedia/pmmidi.c index 390b113c99b..fc40b9b8af7 100644 --- a/src/osd/portmedia/pmmidi.c +++ b/src/osd/portmedia/pmmidi.c @@ -10,11 +10,13 @@ #include "portmidi/portmidi.h" #include "osdcore.h" +static const int RX_EVENT_BUF_SIZE = 512; + struct osd_midi_device { #ifndef DISABLE_MIDI PortMidiStream *pmStream; - PmEvent rx_evBuf[20]; // up to 20 events + PmEvent rx_evBuf[RX_EVENT_BUF_SIZE]; #endif UINT8 xmit_in[4]; // Pm_Messages mean we can at most have 3 residue bytes int xmit_cnt; @@ -85,7 +87,7 @@ osd_midi_device *osd_open_midi_input(const char *devname) if (found_dev >= 0) { - if (Pm_OpenInput(&stm, found_dev, NULL, 20, NULL, NULL) == pmNoError) + if (Pm_OpenInput(&stm, found_dev, NULL, RX_EVENT_BUF_SIZE, NULL, NULL) == pmNoError) { ret = (osd_midi_device *)osd_malloc(sizeof(osd_midi_device)); memset(ret, 0, sizeof(osd_midi_device)); @@ -132,7 +134,7 @@ osd_midi_device *osd_open_midi_output(const char *devname) if (found_dev >= 0) { - if (Pm_OpenOutput(&stm, found_dev, NULL, 20, NULL, NULL, 0) == pmNoError) + if (Pm_OpenOutput(&stm, found_dev, NULL, 100, NULL, NULL, 0) == pmNoError) { ret = (osd_midi_device *)osd_malloc(sizeof(osd_midi_device)); memset(ret, 0, sizeof(osd_midi_device)); @@ -175,7 +177,7 @@ bool osd_poll_midi_channel(osd_midi_device *dev) int osd_read_midi_channel(osd_midi_device *dev, UINT8 *pOut) { #ifndef DISABLE_MIDI - int msgsRead = Pm_Read(dev->pmStream, dev->rx_evBuf, 20); + int msgsRead = Pm_Read(dev->pmStream, dev->rx_evBuf, RX_EVENT_BUF_SIZE); int bytesOut = 0; if (msgsRead <= 0) -- cgit v1.2.3