User Forum    :: Powered by YaBB
  « MIDI-OX User Forum - MidiInput event & GetMidiInputRaw() »
Welcome, Guest. Please Login or Register.
May 9th, 2025, 9:09am


Home Home Help Help Search Search Members Members Login Login Register Register


   MIDI-OX User Forum
   MIDI-OX
   Scripting Questions
(Moderator: Jamie OConnell)
   MidiInput event & GetMidiInputRaw()
« Previous topic | Next topic »
Pages: 1  Reply Reply Notify of replies Notify of replies Send Topic Send Topic Print Print
   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 Quote Modify 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
*****






   
WWW Email

Gender: male
Posts: 2027
Re: MidiInput event & GetMidiInputRaw()
« Reply #1 on: Mar 25th, 2003, 11:14am »
Quote Quote Modify 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.

Pages: 1  Reply Reply Notify of replies Notify of replies Send Topic Send Topic Print Print

« Previous topic | Next topic »


MIDI-OX User Forum » Powered by YaBB 1 Gold - SP 1.3.1!
YaBB © 2000-2003. All Rights Reserved.