示例#1
0
 /// <summary>
 /// Sends a Note On message to this MIDI output device.
 /// </summary>
 /// <param name="channel">The channel.</param>
 /// <param name="pitch">The pitch.</param>
 /// <param name="velocity">The velocity 0..127.</param>
 /// <exception cref="ArgumentOutOfRangeException">channel, pitch, or velocity is
 /// out-of-range.</exception>
 /// <exception cref="InvalidOperationException">The device is not open.</exception>
 /// <exception cref="DeviceException">The message cannot be sent.</exception>
 public void SendNoteOn(Channel channel, Pitch pitch, int velocity)
 {
     lock (this)
     {
         CheckOpen();
         CheckReturnCode(Win32API.midiOutShortMsg(handle, ShortMsg.EncodeNoteOn(channel,
                                                                                pitch, velocity)));
     }
 }
示例#2
0
 /// <summary>
 /// Sends a Note On message to Channel10 of this MIDI output device.
 /// </summary>
 /// <param name="percussion">The percussion.</param>
 /// <param name="velocity">The velocity 0..127.</param>
 /// <remarks>This is simply shorthand for a Note On message on Channel10 with a
 /// percussion-specific note, so there is no corresponding message to receive from an input
 /// device.</remarks>
 /// <exception cref="ArgumentOutOfRangeException">percussion or velocity is out-of-range.
 /// </exception>
 /// <exception cref="InvalidOperationException">The device is not open.</exception>
 /// <exception cref="DeviceException">The message cannot be sent.</exception>
 public void SendPercussion(Percussion percussion, int velocity)
 {
     lock (this)
     {
         CheckOpen();
         CheckReturnCode(Win32API.midiOutShortMsg(handle, ShortMsg.EncodeNoteOn(
                                                      Channel.Channel10, (Pitch)percussion,
                                                      velocity)));
     }
 }