Beispiel #1
0
        /// <summary>
        /// Processes the provided <see cref="ShortMessage"/> and raises associated events.
        /// </summary>
        /// <param name="message">A <see cref="ShortMessage"/> to process and raise events for.</param>
        private void ProcessShortMessage(ShortMessage message)
        {
            if ((message.Status & 0xF0) >= (int)ChannelMessageTypes.Min && (message.Status & 0xF0) <= (int)ChannelMessageTypes.Max)
            {
                switch ((ChannelMessageTypes)message.Status)
                {
                case ChannelMessageTypes.NoteOn:
                    NoteOnReceived?.Invoke(this, new NoteOnMessageEventArgs(new NoteOnMessage(message)));
                    break;

                case ChannelMessageTypes.NoteOff:
                    NoteOffReceived?.Invoke(this, new NoteOffMessageEventArgs(new NoteOffMessage(message)));
                    break;

                case ChannelMessageTypes.ControlChange:
                    ControlChangeReceived?.Invoke(this, new ControlChangeMessageEventArgs(new ControlChangeMessage(message)));
                    break;

                case ChannelMessageTypes.ProgramChange:
                    ProgramChangeReceived?.Invoke(this, new ProgramChangeMessageEventArgs(new ProgramChangeMessage(message)));
                    break;

                case ChannelMessageTypes.PitchBend:
                    PitchBendReceived?.Invoke(this, new PitchBendMessageEventArgs(new PitchBendMessage(message)));
                    break;

                case ChannelMessageTypes.KeyAfterTouch:
                    KeyAfterTouchReceived?.Invoke(this, new KeyAfterTouchMessageEventArgs(new KeyAfterTouchMessage(message)));
                    break;

                case ChannelMessageTypes.ChannelAfterTouch:
                    ChannelAfterTouchReceived?.Invoke(this, new ChannelAfterTouchMessageEventArgs(new ChannelAfterTouchMessage(message)));
                    break;
                }
            }
        }
Beispiel #2
0
 /// <summary>
 /// Sends a short MIDI message.
 /// </summary>
 /// <param name="message">The short MIDI message to send.</param>
 /// <exception cref="MidiOutputDeviceException">Raises <see cref="API.Result.MULTIMEDIA_SYSTEM_ERROR_INVALID_HANDLE"/>.</exception>
 /// <exception cref="MidiOutputDeviceException">Raises <see cref="API.Result.MIDI_ERROR_NOT_READY"/>.</exception>
 /// <exception cref="MidiOutputDeviceException">Raises <see cref="API.Result.MIDI_ERROR_BAD_OPEN_MODE"/>.</exception>
 public void Send(ShortMessage message)
 {
     InvalidateResult(API.SendShortMessage(_Handle, message.Data));
 }
Beispiel #3
0
 /// <summary>
 /// Creates and initializes a <see cref="ChannelAfterTouchMessage"/> from the specified <see cref="ShortMessage"/>.
 /// </summary>
 /// <param name="message">The <see cref="ShortMessage"/> to initialize the <see cref="ChannelAfterTouchMessage"/> from.</param>
 internal ChannelAfterTouchMessage(ShortMessage message) : base(message)
 {
 }
Beispiel #4
0
 /// <summary>
 /// Creates and initializes a <see cref="KeyAfterTouchMessage"/> from the specified <see cref="ShortMessage"/>.
 /// </summary>
 /// <param name="message">The <see cref="ShortMessage"/> to initialize the <see cref="KeyAfterTouchMessage"/> from.</param>
 internal KeyAfterTouchMessage(ShortMessage message) : base(message)
 {
 }
Beispiel #5
0
 /// <summary>
 /// Creates and initializes a <see cref="PitchBendMessage"/> from the specified <see cref="ShortMessage"/>.
 /// </summary>
 /// <param name="message">The <see cref="ShortMessage"/> to initialize the <see cref="PitchBendMessage"/> from.</param>
 internal PitchBendMessage(ShortMessage message) : base(message)
 {
 }
Beispiel #6
0
 /// <summary>
 /// Creates and initializes a <see cref="ControlChangeMessage"/> from the specified <see cref="ShortMessage"/>.
 /// </summary>
 /// <param name="message">The <see cref="ShortMessage"/> to initialize the <see cref="ControlChangeMessage"/> from.</param>
 internal ProgramChangeMessage(ShortMessage message) : base(message)
 {
 }
Beispiel #7
0
 /// <summary>
 /// Creates and initializes a <see cref="ControlChangeMessage"/> from the specified <see cref="ShortMessage"/>.
 /// </summary>
 /// <param name="message">The <see cref="ShortMessage"/> to initialize the <see cref="ControlChangeMessage"/> from.</param>
 internal ControlChangeMessage(ShortMessage message) : base(message)
 {
 }
Beispiel #8
0
 /// <summary>
 /// Creates and initializes a <see cref="NoteOffMessage"/> from the specified <see cref="ShortMessage"/>.
 /// </summary>
 /// <param name="message">A <see cref="ShortMessage"/> to initialize the <see cref="NoteOffMessage"/> from.</param>
 internal NoteOffMessage(ShortMessage message) : base(message)
 {
 }
Beispiel #9
0
 /// <summary>
 /// Creates and initializes a <see cref="SystemRealtimeMessage"/> from the specified <see cref="ShortMessage"/>.
 /// </summary>
 /// <param name="message">A <see cref="ShortMessage"/> to initialize the <see cref="SystemRealtimeMessage"/> from.</param>
 internal protected SystemRealtimeMessage(ShortMessage message) : this(message.ParameterA, message.ParameterB)
 {
 }
Beispiel #10
0
 /// <summary>
 /// Creates and initializes a <see cref="SystemCommonMessage"/> from the specified <see cref="ShortMessage"/>.
 /// </summary>
 /// <param name="message">A <see cref="ShortMessage"/> to initialize the <see cref="SystemCommonMessage"/> from.</param>
 internal protected SystemCommonMessage(ShortMessage message) : this(message.ParameterA, message.ParameterB)
 {
 }
Beispiel #11
0
 /// <summary>
 /// Creates and initializes a <see cref="ChannelMessage"/> from the specified <see cref="ShortMessage"/>.
 /// </summary>
 /// <param name="message">A <see cref="ShortMessage"/> to initialize the <see cref="ChannelMessage"/> from.</param>
 internal ChannelMessage(ShortMessage message) : this(message.ParameterA, message.ParameterB)
 {
 }