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); } } } }
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); }
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); }
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); } } }