Exemplo n.º 1
0
 /// <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;
 }
Exemplo n.º 2
0
 /// <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;
 }
Exemplo n.º 3
0
 /// <summary>
 /// Protected constructor.
 /// </summary>
 protected DeviceMessage(DeviceBase device, float time)
     : base(time)
 {
     if (device == null)
     {
         throw new ArgumentNullException("device");
     }
     this.device = device;
 }
Exemplo n.º 4
0
 /// <summary>
 /// Protected constructor.
 /// </summary>
 protected DeviceMessage(DeviceBase device, float time)
     : base(time)
 {
     if (device == null)
     {
         throw new ArgumentNullException("device");
     }
     this.device = device;                    
 }
Exemplo n.º 5
0
 /// <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;
 }
Exemplo n.º 6
0
 /// <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;
 }
Exemplo n.º 7
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(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;
 }
Exemplo n.º 8
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(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;
 }
Exemplo n.º 9
0
 /// <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;
 }
Exemplo n.º 10
0
 /// <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)
 {
 }
Exemplo n.º 11
0
 /// <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;
 }
Exemplo n.º 12
0
 /// <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;
 }
Exemplo n.º 13
0
 /// <summary>
 /// Protected constructor.
 /// </summary>
 protected ChannelMessage(DeviceBase device, Channel channel, float time)
     : base(device, time)
 {
     channel.Validate();
     this.channel = channel;
 }
Exemplo n.º 14
0
 /// <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;
 }
Exemplo n.º 15
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="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)
 {
 }
Exemplo n.º 16
0
 /// <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;
 }
Exemplo n.º 17
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="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) { }
Exemplo n.º 18
0
 /// <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;
 }
Exemplo n.º 19
0
 /// <summary>
 /// Protected constructor.
 /// </summary>
 public SysExMessage(DeviceBase device, Byte[] data, float time)
     : base(device, time)
 {
     this.data = data;
 }
Exemplo n.º 20
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(DeviceBase device, Channel channel, Pitch pitch, int velocity,
                       float time)
     : base(device, channel, pitch, velocity, time)
 {
 }
Exemplo n.º 21
0
 /// <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;
 }
Exemplo n.º 22
0
 /// <summary>
 /// Protected constructor.
 /// </summary>
 public SysExMessage(DeviceBase device, Byte[] data, float time)
     : base(device, time)
 {
     this.data = data;
 }
Exemplo n.º 23
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(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;
 }
Exemplo n.º 24
0
 /// <summary>
 /// Protected constructor.
 /// </summary>
 protected ChannelMessage(DeviceBase device, Channel channel, float time)
     : base(device, time)
 {
     channel.Validate();
     this.channel = channel;
 }
Exemplo n.º 25
0
 /// <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;
 }
Exemplo n.º 26
0
 /// <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;
 }