From bdba9107bb99ce39928c37b5296170a47c303e98 Mon Sep 17 00:00:00 2001 From: ceski <56656010+ceski-1@users.noreply.github.com> Date: Tue, 13 Jun 2023 14:14:52 -0700 Subject: [PATCH] PortMidi Updates (#576) * PortMidi: Increase event buffer size Fixes sound hitching when songs loop due to some songs using more than 100 events during initialization. * PortMidi: Clean up "reset all controllers" --- prboom2/src/MUSIC/portmidiplayer.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/prboom2/src/MUSIC/portmidiplayer.c b/prboom2/src/MUSIC/portmidiplayer.c index 6e44081cf..e5a9c29ba 100644 --- a/prboom2/src/MUSIC/portmidiplayer.c +++ b/prboom2/src/MUSIC/portmidiplayer.c @@ -102,7 +102,7 @@ static int sysexbufflen; // so the messages appear in the future. ~46-47ms is the nominal length if i_sound.c gets its way #define DRIVER_LATENCY 80 // ms // driver event buffer needs to be big enough to hold however many events occur in latency time -#define DRIVER_BUFFER 100 // events +#define DRIVER_BUFFER 1024 // events static const char *pm_name (void) { @@ -638,7 +638,6 @@ static void pm_render (void *vdest, unsigned bufflen) { writeevent (when, 0xB0, i, 0x7B, 0x00); // all notes off writeevent (when, 0xB0, i, 0x79, 0x00); // reset all controllers - write_volume (when, i, channel_volume[i]); // reapply volume } continue; } @@ -654,9 +653,8 @@ static void pm_render (void *vdest, unsigned bufflen) } else if (currevent->data.channel.param1 == 0x79) { - int i = currevent->data.channel.channel; - writeevent (when, 0xB0, i, 0x79, 0x00); // reset all controllers - write_volume (when, i, channel_volume[i]); // reapply volume + // ms gs synth resets volume if "reset all controllers" value isn't zero + writeevent (when, 0xB0, currevent->data.channel.channel, 0x79, 0x00); break; } // fall through