Пример #1
0
        public void timerUpdate(IYse.IMidiOut output, int elapsed)
        {
            lock (messageLock)
            {
                for (int i = messageQueue.Count - 1; i >= 0; i--)
                {
                    TimedMessage message = messageQueue[i];
                    message.Offset -= elapsed;
                    if (message.Offset <= 0)
                    {
                        switch (message.Type)
                        {
                        case MessageType.ControlChange:
                            output.ControlChange(message.Channel, message.Value1, message.Value2);
                            break;

                        case MessageType.NoteOn:
                            output.NoteOn(message.Channel, message.Value1, message.Value2);
                            break;

                        case MessageType.ProgramChange:
                            output.ProgramChange(message.Channel, message.Value1);
                            break;
                        }
                        messageQueue.RemoveAt(i);
                    }
                }
            }
        }
Пример #2
0
 public int SendInt(IYse.IMidiOut output, IYse.M_CHANNEL channel, int value)
 {
     lock (messageLock)
     {
         messageQueue.Clear();
         AllMessages.ForEach(message =>
         {
             messageQueue.Add(message.GetCopy());
         });
     }
     return(1);
 }
Пример #3
0
        public int SendInt(IYse.IMidiOut output, IYse.M_CHANNEL channel, int value)
        {
            byte adjusted = (byte)adjustValue(value);

            output.NoteOn(channel, adjusted, (byte)Velocity);
            if (Duration > 0)
            {
                noteOffs.Add(new NoteOff {
                    note = adjusted, period = Duration, channel = channel
                });
            }
            return(adjusted);
        }
Пример #4
0
 public void timerUpdate(IYse.IMidiOut output, int elapsed)
 {
     for (int i = noteOffs.Count - 1; i >= 0; i--)
     {
         NoteOff current = noteOffs[i];
         current.period -= elapsed;
         if (current.period <= 0)
         {
             output.NoteOn(current.channel, current.note, 0);
             noteOffs.RemoveAt(i);
         }
     }
 }