Author |
Topic: MidiInput event & GetMidiInputRaw() (Read 1829 times) |
|
Linus
New Member

 MIDI-OX Rules!
Posts: 1
|
 |
MidiInput event & GetMidiInputRaw()
« on: Mar 24th, 2003, 5:58pm » |
Quote Modify
|
Hello, I'm trying to write a routine in C#, which maps patches to specified ports. My problem: I need to know the channel on which a patch is changed, to correctly map all other events on this channel to the specified out port. But the MidiInput event, does not send the channel. So, I tried to use the GetMidiInputRaw() method, when the event is fired. But when I call the method, no further MidiInput events are fired. Is this by design? My second problem: To circumgo the first problem, I tried simply to call GetMidiInputRaw() in a loop, but it seems that the status is always 192 after & 0x000000F0 (according documentation) to raw input value, although the channel and data values are changing
|
|
IP Logged |
|
|
|
Jamie OConnell
Administrator
    


Gender: 
Posts: 2027
|
 |
Re: MidiInput event & GetMidiInputRaw()
« Reply #1 on: Mar 25th, 2003, 11:14am » |
Quote Modify
|
Quote:I need to know the channel on which a patch is changed, to correctly map all other events on this channel to the specified out port. But the MidiInput event, does not send the channel. |
| In MIDI messages, the channel information is always supplied, but it is encoded as part of the status byte. The low 4 bits of the status represent the channel (0 - 15, or 00 - 0F Hex). You need to add one to this value to get the common human representation of channel (1 - 16). To obtain the channel in scripting, you would And the status with 0F: channel = (status & 0x0F) + 1 If you need to use the channel in another status message, do not add one: low-level MIDI numbers channels 0 -15.
|
|
IP Logged |
--Jamie Music is its own reward.
|
|
|
|