Skip to content
This repository has been archived by the owner on Jun 23, 2023. It is now read-only.

Commit

Permalink
PortMidi Updates (#576)
Browse files Browse the repository at this point in the history
* 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"
  • Loading branch information
ceski-1 authored Jun 13, 2023
1 parent 8be14f4 commit bdba910
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions prboom2/src/MUSIC/portmidiplayer.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down Expand Up @@ -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;
}
Expand All @@ -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
Expand Down

0 comments on commit bdba910

Please sign in to comment.