c++ - How to read the initial state of a MIDI Foot Controller? -


I understand that MIDI allows me to read the status of a MIDI Foot Controller, in which a MIDI message control control Indicates But what if the user has not changed control yet? Am I still able to read the state / value? What will be the way to do this?

This is my code that is used to capture midi messages using OSX's Coremidi

  zero Init MIDI (MIDIlientRef midiClient; MIDIPORRef ​​inputport; Ossetatus status; MIDIEndpointRef src; Status = MIDICLientCreate (CFRert ("test"), faucet, zero, and media client); If (status! = NoErr) NSLog (@ "Error creating MIDI client:% d", position); Position = MIDIInputPortCreate (media client, CFRT ("input"), MIDI input callback, faucet, and input port); If (Status! = NoErr) NSLog (@ "Error creating MIDI input port:% d", position); MotherCount numOfDevices = MIDIGetNumberOfDevices (); // Simply try connecting to each device (Madcount i = 0; i  numpackets; i ++) {const MIDIPacket * packet = & amp; List-> Packet [i]; For (UInt16 j = 0, size = 0; j & lt; packet-> length; j + = size) {UInt8 position = packet-> data [J]; If (position <0xC0) size = 3; And if (position & lt; 0xE0) size = 2; And if (position & lt; 0xF0) size = 3; And if (position & lt; 0xF3) size = 3; And if (position == 0xF3) size = 2; Other size = 1; Switch (position and 0xF0) {case 0xb0: NSLog (@ "MIDI control changed:% d% d", packet-> data [J + 1], packet-> data [J + 2]); break; }}}}}  

If you have not reset the device, and then control Until your program does not know the status of any control until you receive a message.

In some devices, vendor-specific commands may be used to read the current state of control or to dump the entire state.


Comments

Popular posts from this blog

apache - 504 Gateway Time-out The server didn't respond in time. How to fix it? -

c# - .net WebSocket: CloseOutputAsync vs CloseAsync -

c++ - How to properly scale qgroupbox title with stylesheet for high resolution display? -