/// <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(IDeviceBase device, Channel channel, Pitch pitch,
                         int velocity, float time, Clock clock, float duration)
     : base(device, channel, pitch, velocity, time)
 {
     Clock    = clock;
     Duration = duration;
 }
 /// <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(IDeviceBase device, Channel channel, Instrument instrument,
                             float time)
     : base(device, channel, time)
 {
     instrument.Validate();
     Instrument = instrument;
 }
Пример #3
0
 /// <summary>
 ///     Protected constructor.
 /// </summary>
 protected DeviceMessage(IDeviceBase device, float time)
     : base(time)
 {
     if (device == null)
     {
         throw new ArgumentNullException(nameof(device));
     }
     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(IDeviceBase device, Channel channel, int value, float time)
     : base(device, channel, time)
 {
     if (value < 0 || value > 16383)
     {
         throw new ArgumentOutOfRangeException(nameof(value));
     }
     Value = value;
 }
Пример #5
0
 /// <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(IDeviceBase device, Percussion percussion, int velocity,
                          float time)
     : base(device, time)
 {
     percussion.Validate();
     if (velocity < 0 || velocity > 127)
     {
         throw new ArgumentOutOfRangeException(nameof(velocity));
     }
     Percussion = percussion;
     Velocity   = velocity;
 }
Пример #6
0
 /// <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(IDeviceBase device, Channel channel, Control control, int value,
                             float time)
     : base(device, channel, time)
 {
     control.Validate();
     if (value < 0 || value > 127)
     {
         throw new ArgumentOutOfRangeException(nameof(control));
     }
     Control = control;
     Value   = value;
 }
Пример #7
0
        /// <summary>
        ///     Constructs a Non-Registered Parameter Number 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="parameter">Parameter number, 0..16383</param>
        /// <param name="value">Value, 0..16383</param>
        /// <param name="time">The timestamp for this message</param>
        public NrpnMessage(IDeviceBase device, Channel channel, int parameter, int value, float time) : base(device, channel, time)
        {
            if (parameter < 0 || parameter > 16383)
            {
                throw new ArgumentOutOfRangeException(nameof(parameter));
            }

            if (value < 0 || value > 16383)
            {
                throw new ArgumentOutOfRangeException(nameof(value));
            }

            Parameter = parameter;
            Value     = value;
        }
Пример #8
0
 /// <summary>
 ///     Protected constructor.
 /// </summary>
 protected NoteMessage(IDeviceBase device, Channel channel, Pitch pitch, int velocity,
                       float time)
     : base(device, channel, time)
 {
     if (!pitch.IsInMidiRange())
     {
         throw new ArgumentOutOfRangeException(nameof(pitch));
     }
     if (velocity < 0 || velocity > 127)
     {
         throw new ArgumentOutOfRangeException(nameof(velocity));
     }
     Pitch    = pitch;
     Velocity = velocity;
 }
Пример #9
0
 /// <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(IDeviceBase device, Channel channel, Pitch pitch, int velocity,
                       float time)
     : base(device, channel, pitch, velocity, time)
 {
 }
Пример #10
0
 /// <summary>
 ///     Protected constructor.
 /// </summary>
 public SysExMessage(IDeviceBase device, byte[] data, float time)
     : base(device, time)
 {
     Data = data;
 }
Пример #11
0
 /// <summary>
 ///     Protected constructor.
 /// </summary>
 protected ChannelMessage(IDeviceBase device, Channel channel, float time)
     : base(device, time)
 {
     channel.Validate();
     Channel = channel;
 }