Esempio n. 1
0
 public void HandleTimeOuts(TimeSpan elapsed)
 {
     for (int i = timeOuts.Count - 1; i >= 0; i--)
     {
         var timeOut = timeOuts[i];
         if (elapsed >= timeOut.End)
         {
             outputDevice.SendNoteOff(timeOut.Channel, timeOut.Pitch, timeOut.Velocity);
             timeOuts.RemoveAt(i);
         }
     }
 }
Esempio n. 2
0
        private void PlayChordRun(IOutputDevice outputDevice, Chord chord, int millisecondsBetween)
        {
            var previousNote = (Pitch)(-1);

            for (var pitch = Pitch.A0; pitch < Pitch.C8; ++pitch)
            {
                if (chord.Contains(pitch))
                {
                    if (previousNote != (Pitch)(-1))
                    {
                        outputDevice.SendNoteOff(Channel.Channel1, previousNote, 80);
                    }
                    outputDevice.SendNoteOn(Channel.Channel1, pitch, 80);
                    Thread.Sleep(millisecondsBetween);
                    previousNote = pitch;
                }
            }
            if (previousNote != (Pitch)(-1))
            {
                outputDevice.SendNoteOff(Channel.Channel1, previousNote, 80);
            }
        }