This class represents a Midi short (data) message as for example received in a MIM_DATA message of a MIDIINPROC.
Inheritance Hierarchy
radio42.Multimedia.MidiMidiShortMessage
Namespace: radio42.Multimedia.Midi
Assembly: Bass.Net (in Bass.Net.dll) Version: 2.4.17.2
Syntax
The MidiShortMessage type exposes the following members.
Constructors
Name | Description | |
---|---|---|
![]() | MidiShortMessage |
Default constructor.
|
![]() | MidiShortMessage(IntPtr, IntPtr) |
Creates a new instance of the MidiShortMessage.
|
![]() | MidiShortMessage(Byte, Int32, Int64) |
Creates a new instance of the MidiShortMessage.
|
![]() | MidiShortMessage(IntPtr, IntPtr, MidiShortMessage) |
Creates a new instance of the MidiShortMessage and also evaluates a previous short message..
|
![]() | MidiShortMessage(MIDIStatus, Byte, Int32, Int64) |
Creates a new instance of the MidiShortMessage.
|
![]() | MidiShortMessage(Byte, Byte, Byte, Byte, Int64) |
Creates a new instance of the MidiShortMessage.
|
![]() | MidiShortMessage(MIDIStatus, Byte, Byte, Byte, Int64) |
Creates a new instance of the MidiShortMessage.
|
Properties
Name | Description | |
---|---|---|
![]() | Aftertouch |
Gets or Sets the polyphonic aftertouch (polyphonic key pressure) from/to the Data2 byte.
|
![]() | Channel |
Gets or Sets the channel number from/to the Status byte.
|
![]() | ChannelPressure |
Gets or Sets the channel pressure (channel aftertouch) from/to the Data1 byte.
|
![]() | Controller |
Gets or Sets the controller number from/to the Data1 byte.
|
![]() | ControllerType |
Gets or Sets the controller type (one of the MIDIControllerType values) from/to the Data1 byte.
|
![]() | ControllerValue |
Gets or Sets the controller value from/to the Data2 byte (and optionally from the PreviousShortMessage).
|
![]() | Data | |
![]() | Data1 |
Gets or Sets the MIDI data byte 1.
|
![]() | Data2 |
Gets or Sets the MIDI data byte 2.
|
![]() | Data3 |
Gets or Sets the MIDI data byte 3.
|
![]() | ID |
Gets a unique overall short message ID.
|
![]() | IsSetAsContinuousController |
Gets, if this message was manually set to be a continuous controller message.
|
![]() ![]() | Message |
Gets or Sets the constructed Midi message value.
|
![]() | MessageAsIntPtr |
Gets or Sets the constructed Midi message value (typically the param1 of a Midi message).
|
![]() | MessageType |
Gets or Sets the Midi message type (one of the MIDIMessageType values) from/to the Status byte.
|
![]() | Note |
Gets or Sets the Midi note number from/to the Data1 byte.
|
![]() | NoteString |
Gets the Midi note from the Data1 byte as a string representation.
|
![]() | PairedData2 |
Gets the paired Data2 value (from an optional PreviousShortMessage).
|
![]() | PitchBend | |
![]() | PreviousIsMSB |
Returns , if the PreviousShortMessage contains the MSB (coarse) ControllerValue and this message the LSB (fine) value - only in case the IsSetAsContinuousController value is set to .
|
![]() | PreviousShortMessage |
Gets or Sets the previous short message (preceding this short message) if set (or if not set).
|
![]() | Program |
Gets or Sets the changed program number from/to the Data1 byte.
|
![]() | Song |
Gets or Sets the song number from/to the Data1 byte.
|
![]() | SongPosition | |
![]() | Status |
Gets or Sets the MIDI status byte.
|
![]() | StatusType |
Gets or Sets the Midi status type (one of the MIDIStatus values) from/to the Status byte.
|
![]() | ThisIsMSB |
Returns , if this short-message contains the MSB (coarse) ControllerValue and the PreviousShortMessage the LSB (fine) value - only in case the IsSetAsContinuousController value is set to .
|
![]() | TimeCodeType |
Gets or Sets the Midi Time Code type (one of the MIDIMTCType values) from/to the Data1 byte.
|
![]() | TimeCodeValue |
Gets or Sets the Midi Time Code value (partial) from/to the Data1 byte.
|
![]() | Timespan |
Gets or Sets the time that the message was received by the input device driver. The time stamp is specified as milliseconds, beginning at zero when the MIDI_InStart(IntPtr) function was called.
|
![]() | Timestamp |
Gets or Sets the time that the message was received by the input device driver. The time stamp is specified in milliseconds, beginning at zero when the MIDI_InStart(IntPtr) function was called.
|
![]() | TimestampAsIntPtr |
Gets or Sets the time span value (typically the param2 of a Midi message).
|
![]() | Velocity |
Gets or Sets the velocity (key pressure speed) from/to the Data2 byte.
|
Methods
Name | Description | |
---|---|---|
![]() | BuildMessage(Int32, Int64) |
Constructs a new Midi data message.
|
![]() | BuildMessage(Int64, Int64) |
Constructs a new Midi data message.
|
![]() | BuildMessage(Byte, Int32, Int64) |
Constructs a new Midi data message.
|
![]() | BuildMessage(MIDIStatus, Byte, Int32, Int64) |
Constructs a new Midi data message.
|
![]() | BuildMessage(Byte, Byte, Byte, Byte, Int64) |
Constructs a new Midi data message.
|
![]() | BuildMessage(MIDIStatus, Byte, Byte, Byte, Int64) |
Constructs a new Midi data message.
|
![]() ![]() | GetPairedData |
Returns a combined paired value from a MSB and a LSB data byte.
|
![]() ![]() | GetPairedData1 |
Returns a combined paired Data1 value from a MSB and a LSB MidiShortMessage.
|
![]() ![]() | GetPairedData2 |
Returns a combined paired Data2 value from a MSB and a LSB MidiShortMessage.
|
![]() | SetContinuousController |
Defines that this message is related to a continuous controller.
|
![]() | ToString |
Returns the string representation of the Midi short message.
(Overrides ObjectToString.) |
![]() ![]() | ToString(String) |
Returns the string representation of the Midi short message.
|
![]() ![]() | ToString(String, IFormatProvider) |
Returns the string representation of the Midi short message.
|
Remarks
Use this class with the MIDI_OutShortMsg(IntPtr, Int32) method to send a message to an output device. Use the Message property in that case to get the constructed message value.
Use this class with the MIM_DATA message of a MIDIINPROC to decode the received message.
Examples
private MIDIINPROC _midiProc; private int _midiInHandle; ... // Open the Midi device #2 _midiProc = new MIDIINPROC(MyMidiProc); MIDIError ret = Midi.MIDI_InOpen(ref _midiInHandle, 2, _midiProc, IntPtr.Zero, MIDIFlags.MIDI_IO_STATUS); if (ret == MIDIError.MIDI_OK) { // supply the device with 2 buffers AddSysExBuffer(_midiInHandle, 1024); AddSysExBuffer(_midiInHandle, 1024); // Start the device ret = Midi.MIDI_InStart(_midiInHandle); } ... // when not needed anymore...stop the device Midi.MIDI_InReset(_midiInHandle); // and close the device Midi.MIDI_InClose(_midiInHandle); ... // prepare receiving system-exclusive messages private void AddSysExBuffer(IntPtr handle, int size) { // prepare a empty midi header MIDI_HEADER header = new MIDI_HEADER(size); header.Prepare(true, handle); // If the header was perpared successfully. if (header.HeaderPtr != IntPtr.Zero) { // Add the buffer to the InputDevice. Midi.MIDI_InAddBuffer(handle, header.HeaderPtr); } } ... private MidiShortMessage _shortMsg = null; private MidiSysExMessage _sysExMsg = null; public void MyMidiProc(IntPtr handle, MIDIMessage msg, IntPtr instance, IntPtr param1, IntPtr param2) { // handle all Midi messages here if(msg == MIDIMessage.MIM_OPEN) { // nothing to do } else if(msg == MIDIMessage.MIM_CLOSE) { // handle is from now on invalid } else if(msg == MIDIMessage.MIM_DATA) { // process the message... _shortMsg = new MidiShortMessage(param1, param2, _shortMsg); Console.WriteLine(_shortMsg.ToString()); } else if(msg == MIDIMessage.MIM_MOREDATA) { // we are not fast enough in this callback to keep up... // the input device is sending messages to fast ... } else if(msg == MIDIMessage.MIM_LONGDATA) { // process the message... // param1 will contain the pointer to the MIDI_HEADER _sysExMsg = new MidiSysExMessage(true, handle, param1, _sysExMsg); if (_sysExMsg.IsDone) { Console.WriteLine(_sysExMsg.ToString()); } // add a new buffer // since we must constantly provide new buffers until we finished recording AddSysExBuffer(handle, 1024); } else if(msg == MIDIMessage.MIM_ERROR) { // process the invalid message... ... } else if(msg == MIDIMessage.MIM_LONGERROR) { // process the invalid message... // param1 will contain the pointer to the MIDI_HEADER MIDI_HEADER header = new MIDI_HEADER(param1); header.Unprepare(true, handle); // add a new buffer // since we should constantly provide new buffers until we finished recording AddSysExBuffer(handle, 1024); } }
See Also