diff options
author | R. Belmont <rb6502@users.noreply.github.com> | 2013-01-15 14:45:36 +0000 |
---|---|---|
committer | R. Belmont <rb6502@users.noreply.github.com> | 2013-01-15 14:45:36 +0000 |
commit | 9c0f4e6683fca1c971d2cc047ffec09d8ac46bcd (patch) | |
tree | 93c4d1afaccf63176bfd08b303d062389ca7289c /src/osd/portmedia | |
parent | 4efc1f7b053ca2503da6ba3b27f91ee0d68d6c3e (diff) |
MIDI: Fixed several bugs and bumped the input buffer sizes [R. Belmont]
Diffstat (limited to 'src/osd/portmedia')
-rw-r--r-- | src/osd/portmedia/pmmidi.c | 10 |
1 files changed, 6 insertions, 4 deletions
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) |