MIDI를 사용하면 컨트롤 변경을 나타내는 MIDI 메시지를 잡아내어 MIDI 풋 컨트롤러의 상태를 읽을 수 있습니다. 그러나 사용자가 컨트롤을 아직 터치하지 않았거나 변경하지 않았다면 어떻게 될까요? 상태/값을 읽을 수 있습니까? 그 일을하는 방법은 무엇입니까?MIDI 풋 컨트롤러의 초기 상태를 읽는 방법은 무엇입니까?
이 당신이 그것을 할 때까지 프로그램이 모르는, 컨트롤의 상태를 장치를 재설정하지 않았고, 컨트롤을 변경하지 않은 경우 OSX CoreMIDI
void initMidi()
{
MIDIClientRef midiClient;
MIDIPortRef inputPort;
OSStatus status;
MIDIEndpointRef src;
status = MIDIClientCreate(CFSTR("testing"), NULL, NULL, &midiClient);
if (status != noErr)
NSLog(@"Error creating MIDI client: %d", status);
status = MIDIInputPortCreate(midiClient, CFSTR("Input"), midiInputCallback, NULL, &inputPort);
if (status != noErr)
NSLog(@"Error creating MIDI input port: %d", status);
ItemCount numOfDevices = MIDIGetNumberOfDevices();
// just try to connect to every device
for (ItemCount i = 0; i < numOfDevices; i++) {
src = MIDIGetSource(i);
status = MIDIPortConnectSource(inputPort, src, NULL);
}
}
void midiInputCallback(const MIDIPacketList *list,
void *procRef,
void *srcRef)
{
for (UInt32 i = 0; i < list->numPackets; i++) {
const MIDIPacket *packet = &list->packet[i];
for (UInt16 j = 0, size = 0; j < packet->length; j += size) {
UInt8 status = packet->data[j];
if (status < 0xC0) size = 3;
else if (status < 0xE0) size = 2;
else if (status < 0xF0) size = 3;
else if (status < 0xF3) size = 3;
else if (status == 0xF3) size = 2;
else size = 1;
switch (status & 0xF0) {
case 0xb0:
NSLog(@"MIDI Control Changed: %d %d", packet->data[j + 1], packet->data[j + 2]);
break;
}
}
}
}
어떤 컨트롤러를 타겟팅하고 있습니까? – obiwanjacobi
기타 이펙트 컨트롤러 인 PODxt의 노브와 컨트롤을 목표로합니다. 고맙게도 Line6은 공급 업체별 SysEx 메시지에 대한 사양을 제공합니다 : [PDF 링크] (http://line6.com/data/6/0a060b316ac34f0593ef290ff/application/pdf/POD%20Pro%20Sysex%20-%20English%20. pdf) – Jay
덤프를 요청하면 모두 설정됩니다. – obiwanjacobi