我用 coreMIDI 和 Xcode 对“MIDIThruConnectionCreate”进行了尝试,但它不起作用。MIDI In 和 MIDI Out 工作正常,但 MIDI Thru 不工作。感谢您的帮助。
- (void) midiThru
{
MIDIThruConnectionParams params;
CFDataRef dataRef;
#if __LP64__
typedef MIDIObjectRef MIDIThruConnectionRef;
#else
typedef struct OpaqueMIDIThruConnection * MIDIThruConnectionRef;
#endif
MIDIThruConnectionRef thru;
MIDIThruConnectionParamsInitialize(¶ms);
params.numSources = 1;
params.sources[0].endpointRef = sourceMIDI;
params.numDestinations = 1;
params.destinations[0].endpointRef = destMIDI;
dataRef = CFDataCreate(NULL, (unsigned char*) ¶ms,
sizeof(MIDIThruConnectionParams));
s = MIDIThruConnectionCreate(NULL, dataRef, &thru);
CFRelease(dataRef);
}