示例#1
0
        void AddGuitarNotes(MidiPlayer.MidiChannel c, int frame, IEnumerable<byte> notes)
        {
            int isThreeNotes = notes.First() == 0xFF ? 1 : 0;

            foreach (var note in notes.Skip(isThreeNotes))
            {
                if (note < 128)
                {
                    c.ReleaseChord(frame);
                    var i = note / 4;
                    int remapped = 0;
                    if (note > 0) c.AddChord(frame, new GuitarChord(remapped), FAKE_VOLUME);
                }
                frame += 3 + isThreeNotes;
            }
        }
示例#2
0
 // Opens a MIDI output device for playback
 public MidiPlayer()
 {
     Instance = this;
     midiOutOpen(out MidiOut, 0, IntPtr.Zero, IntPtr.Zero, 0);
     for (int i = 0; i < MAX_CHANNELS; i++)
     {
         midiData.Channels[i].InstrumentName = $"Instrument {i}";
     }
 }