Skip to content

Commit

Permalink
Don't count polyphony errors on a percussion channel
Browse files Browse the repository at this point in the history
  • Loading branch information
jangler committed Mar 31, 2024
1 parent d5fc084 commit 96afd77
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion faunatone/playback.go
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ func (p *player) playEvent(te *trackEvent) {
t2.midiChannel = byteNil
}
}
if stolen {
if stolen && !vcs.isPercussionChannel() {
p.polyErrCount++
}
out.writer.SetChannel(t.midiChannel)
Expand Down Expand Up @@ -595,6 +595,10 @@ func newChannelState(midiMode, index int, virtual bool) *channelState {
return cs
}

func (cs *channelState) isPercussionChannel() bool {
return cs.midiMin == percussionChannelIndex && cs.midiMax == percussionChannelIndex
}

// return the index of the channel which has had no active notes for the
// longest time, aside from the percussion channel; return true if voice was
// stolen
Expand Down

0 comments on commit 96afd77

Please sign in to comment.