示例#1
0
        public void SendProgramChange(Channel channel, Instrument instrument)
        {
            var cmd = (int)ShortMsg.EncodeProgramChange(channel, instrument);

            Debug.LogFormat("EncodeNoteOff:{0},{1}={2}", channel, instrument, cmd);

            m_jc.CallStatic("SendMsg", cmd);
        }
 /// <summary>
 /// Sends a Program Change message.
 /// </summary>
 /// <param name="channel">MIDI channel.</param>
 /// <param name="instrument">The instrument.</param>
 /// <exception cref="ArgumentOutOfRangeException">channel or instrument is out-of-range.</exception>
 /// <exception cref="InvalidOperationException">The device is not open.</exception>
 /// <exception cref="DeviceException">The message cannot be sent.</exception>
 /// <remarks>
 /// A Program Change message is used to switch among instrument settings, generally
 /// instrument voices.  An instrument conforming to General Midi 1 will have the
 /// instruments described in the <see cref="Instrument"/> enum; other instruments
 /// may have different instrument sets.
 /// </remarks>
 public void SendProgramChange(Channel channel, Instrument instrument)
 {
     lock (_lockObj)
     {
         CheckOpen();
         CheckReturnCode(Win32API.midiOutShortMsg(_handle, ShortMsg.EncodeProgramChange(
                                                      channel, instrument)));
     }
 }