Re: MIDIPacketList and MIDIClientDispose questions
Re: MIDIPacketList and MIDIClientDispose questions
- Subject: Re: MIDIPacketList and MIDIClientDispose questions
- From: Volker Schumacher <email@hidden>
- Date: Mon, 14 Apr 2014 20:54:26 +0200
Hey Luke,
1) yes, it’s likely for certain devices. For example when receiving MIDI in your midiInputCallback handler, you can check for the SysEx end byte and continue next time, something like this:
bool continueSysEx;
void midiInputCallback(const MIDIPacketList* list, void *procRef, void *srcRef)
{
const MIDIPacket *packet = &list->packet[0];
for (unsigned int i = 0; i < list->numPackets; i++)
{
if (continueSysEx)
{
continueSysEx = (packet->data[packet->length - 1] != 0xF7);
...
}
else
{
...
}
packet = MIDIPacketNext(packet);
}
}
2) I’m not exactly sure, but i guess if you disconnect your connections and clean up your ports etc (MIDIPortDisconnectSource, MIDIPortDispose) no further callbacks should be called. In addition, you can get better control of how the threads execute by having your own runloop, and then call CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0, true) inside that loop to get the MIDI ports firing.
Hope that helps!
Volker
On 14 Apr 2014, at 19:48, Luke Matkins <email@hidden> wrote:
> Hello all,
>
> I have a couple of CoreMIDI questions:
>
> 1) Is it possible for a sysex message to be spread across multiple MIDIPacketLists?
>
> 2) I'm trying to determine when it's safe to free resources referred to by refCon parameters. Does a successful call to MIDIClientDispose guarantee that both
> a) no further callbacks will execute
> b) a callback is not currently executing?
>
>
> Best,
> Luke
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Coreaudio-api mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden