/// <summary> /// Constructs a Program Change message. /// </summary> /// <param name="device">The device associated with this message.</param> /// <param name="channel">Channel.</param> /// <param name="instrument">Instrument.</param> /// <param name="time">The timestamp for this message.</param> public ProgramChangeMessage(DeviceBase device, Channel channel, Instrument instrument, float time) : base(device, channel, time) { instrument.Validate(); this.instrument = instrument; }
/// <summary> /// Constructs a Note On/Off message. /// </summary> /// <param name="device">The device associated with this message.</param> /// <param name="channel">Channel, 0..15, 10 reserved for percussion.</param> /// <param name="pitch">The pitch for this note message.</param> /// <param name="velocity">Velocity, 0..127.</param> /// <param name="time">The timestamp for this message.</param> /// <param name="clock">The clock that should schedule the off message.</param> /// <param name="duration">Time delay between on message and off messasge.</param> public NoteOnOffMessage(DeviceBase device, Channel channel, Pitch pitch, int velocity, float time, Clock clock, float duration) : base(device, channel, pitch, velocity, time) { this.clock = clock; this.duration = duration; }
/// <summary> /// Protected constructor. /// </summary> protected DeviceMessage(DeviceBase device, float time) : base(time) { if (device == null) { throw new ArgumentNullException("device"); } this.device = device; }
/// <summary> /// Constructs a Pitch Bend message. /// </summary> /// <param name="device">The device associated with this message.</param> /// <param name="channel">Channel, 0..15, 10 reserved for percussion.</param> /// <param name="value">Pitch bend value, 0..16383, 8192 is centered.</param> /// <param name="time">The timestamp for this message.</param> public PitchBendMessage(DeviceBase device, Channel channel, int value, float time) : base(device, channel, time) { if (value < 0 || value > 16383) { throw new ArgumentOutOfRangeException("value"); } this.value = value; }
/// <summary> /// Protected constructor. /// </summary> protected NoteMessage(DeviceBase device, Channel channel, Note note, int velocity, float beatTime) : base(device, channel, beatTime) { note.Validate(); if (velocity < 0 || velocity > 127) { throw new ArgumentOutOfRangeException("velocity"); } this.note = note; this.velocity = velocity; }
/// <summary> /// Construts a Control Change message. /// </summary> /// <param name="device">The device associated with this message.</param> /// <param name="channel">Channel, 0..15, 10 reserved for percussion.</param> /// <param name="control">Control, 0..119</param> /// <param name="value">Value, 0..127.</param> /// <param name="time">The timestamp for this message.</param> public ControlChangeMessage(DeviceBase device, Channel channel, Control control, int value, float time) : base(device, channel, time) { control.Validate(); if (value < 0 || value > 127) { throw new ArgumentOutOfRangeException("control"); } this.control = control; this.value = value; }
/// <summary> /// Constructs a Percussion message. /// </summary> /// <param name="device">The device associated with this message.</param> /// <param name="percussion">Percussion.</param> /// <param name="velocity">Velocity, 0..127.</param> /// <param name="time">The timestamp for this message.</param> public PercussionMessage(DeviceBase device, Percussion percussion, int velocity, float time) : base(device, time) { percussion.Validate(); if (velocity < 0 || velocity > 127) { throw new ArgumentOutOfRangeException("velocity"); } this.percussion = percussion; this.velocity = velocity; }
/// <summary> /// Protected constructor. /// </summary> protected NoteMessage(DeviceBase device, Channel channel, Pitch pitch, int velocity, float time) : base(device, channel, time) { if (!pitch.IsInMidiRange()) { throw new ArgumentOutOfRangeException("pitch is out of MIDI range."); } if (velocity < 0 || velocity > 127) { throw new ArgumentOutOfRangeException("velocity"); } this.pitch = pitch; this.velocity = velocity; }
/// <summary> /// Constructs a Note On message. /// </summary> /// <param name="device">The device associated with this message.</param> /// <param name="channel">Channel, 0..15, 10 reserved for percussion.</param> /// <param name="pitch">The pitch for this note message.</param> /// <param name="velocity">Velocity, 0..127.</param> /// <param name="time">The timestamp for this message.</param> public NoteOnMessage(DeviceBase device, Channel channel, Pitch pitch, int velocity, float time) : base(device, channel, pitch, velocity, time) { }
/// <summary> /// Construts a MidiControl Change message. /// </summary> /// <param name="device">The device associated with this message.</param> /// <param name="channel">Channel, 0..15, 10 reserved for percussion.</param> /// <param name="control">MidiControl, 0..119</param> /// <param name="value">Value, 0..127.</param> /// <param name="time">The timestamp for this message.</param> public ControlChangeMessage(DeviceBase device, Channel channel, MidiControl control, int value, float time) : base(device, channel, time) { control.Validate(); if (value < 0 || value > 127) { throw new ArgumentOutOfRangeException("control"); } this.control = control; this.value = value; }
/// <summary> /// Protected constructor. /// </summary> protected ChannelMessage(DeviceBase device, Channel channel, float time) : base(device, time) { channel.Validate(); this.channel = channel; }
/// <summary> /// Constructs a Note On/Off message. /// </summary> /// <param name="device">The device associated with this message.</param> /// <param name="channel">Channel, 0..15, 10 reserved for percussion.</param> /// <param name="note">Note, 0..127, middle C is 60.</param> /// <param name="velocity">Velocity, 0..127.</param> /// <param name="beatTime">Milliseconds since the music started.</param> /// <param name="duration">Milliseconds of duration.</param> public NoteOnOffMessage(DeviceBase device, Channel channel, Note note, int velocity, float beatTime, float duration) : base(device, channel, note, velocity, beatTime) { this.duration = duration; }
/// <summary> /// Constructs a Note Off message. /// </summary> /// <param name="device">The device associated with this message.</param> /// <param name="channel">Channel, 0..15, 10 reserved for percussion.</param> /// <param name="note">Note, 0..127, middle C is 60.</param> /// <param name="velocity">Velocity, 0..127.</param> /// <param name="beatTime">Milliseconds since the music started.</param> public NoteOffMessage(DeviceBase device, Channel channel, Note note, int velocity, float beatTime) : base(device, channel, note, velocity, beatTime) { }
/// <summary> /// Protected constructor. /// </summary> public SysExMessage(DeviceBase device, Byte[] data, float time) : base(device, time) { this.data = data; }
/// <summary> /// Constructs a Note Off message. /// </summary> /// <param name="device">The device associated with this message.</param> /// <param name="channel">Channel, 0..15, 10 reserved for percussion.</param> /// <param name="pitch">The pitch for this note message.</param> /// <param name="velocity">Velocity, 0..127.</param> /// <param name="time">The timestamp for this message.</param> public NoteOffMessage(DeviceBase device, Channel channel, Pitch pitch, int velocity, float time) : base(device, channel, pitch, velocity, time) { }