Skip to content

Commit

Permalink
skip drum channel 10 for non-drum parts
Browse files Browse the repository at this point in the history
  • Loading branch information
reznet committed Apr 7, 2024
1 parent 2d08117 commit 354295b
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions S3mToMidi/OutputChannel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ internal class OutputChannel
public OutputChannel()
{
ChannelNumber = nextChannelNumber++;
if (ChannelNumber == 09) // 10 in zero-based counter is 09
{
// avoid General Midi channel 10 because players interpret it as a drum channel
Console.WriteLine("Skipping output drum channel 10");
ChannelNumber = nextChannelNumber++;
}
Console.WriteLine("Creating output channel {0}", ChannelNumber);
Debug.Assert(ChannelNumber <= 16, "output channel number out of range.");
}
Expand All @@ -27,6 +33,7 @@ public void AddEvent(Event noteEvent)

public void AddEvent(NoteEvent noteEvent)
{
Debug.Assert(noteEvent.Channel == ChannelNumber, "trying to add a note event to the wrong output channel");
AddEvent((Event)noteEvent);
if (noteEvent.Type == NoteEvent.EventType.NoteOn)
{
Expand Down

0 comments on commit 354295b

Please sign in to comment.