예제 #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;
 }
예제 #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;
 }
예제 #3
0
 /// <summary>
 /// Protected constructor.
 /// </summary>
 protected DeviceMessage(DeviceBase device, float time)
     : base(time)
 {
     if (device == null)
     {
         throw new ArgumentNullException("device");
     }
     this.device = device;
 }
예제 #4
0
 /// <summary>
 /// Protected constructor.
 /// </summary>
 protected DeviceMessage(DeviceBase device, float time)
     : base(time)
 {
     if (device == null)
     {
         throw new ArgumentNullException("device");
     }
     this.device = device;                    
 }
예제 #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;
 }
예제 #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;
 }
예제 #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;
 }
예제 #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;
 }
예제 #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;
 }
예제 #10
0
파일: Messages.cs 프로젝트: yugsh/PianoGame
 /// <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)
 {
 }
예제 #11
0
파일: Messages.cs 프로젝트: yugsh/PianoGame
 /// <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;
 }
예제 #12
0
파일: Messages.cs 프로젝트: yugsh/PianoGame
 /// <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;
 }
예제 #13
0
파일: Messages.cs 프로젝트: yugsh/PianoGame
 /// <summary>
 /// Protected constructor.
 /// </summary>
 protected ChannelMessage(DeviceBase device, Channel channel, float time)
     : base(device, time)
 {
     channel.Validate();
     this.channel = channel;
 }
예제 #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;
 }
예제 #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)
 {
 }
예제 #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;
 }
예제 #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) { }
예제 #18
0
파일: Messages.cs 프로젝트: yugsh/PianoGame
 /// <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;
 }
예제 #19
0
 /// <summary>
 /// Protected constructor.
 /// </summary>
 public SysExMessage(DeviceBase device, Byte[] data, float time)
     : base(device, time)
 {
     this.data = data;
 }
예제 #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)
 {
 }
예제 #21
0
파일: Messages.cs 프로젝트: yugsh/PianoGame
 /// <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;
 }
예제 #22
0
 /// <summary>
 /// Protected constructor.
 /// </summary>
 public SysExMessage(DeviceBase device, Byte[] data, float time)
     : base(device, time)
 {
     this.data = data;
 }
예제 #23
0
파일: Messages.cs 프로젝트: yugsh/PianoGame
 /// <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;
 }
예제 #24
0
 /// <summary>
 /// Protected constructor.
 /// </summary>
 protected ChannelMessage(DeviceBase device, Channel channel, float time)
     : base(device, time)
 {
     channel.Validate();
     this.channel = channel;
 }
예제 #25
0
파일: Messages.cs 프로젝트: yugsh/PianoGame
 /// <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;
 }
예제 #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;
 }