• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
MIDIGetDestination and unplugging physical devices
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

MIDIGetDestination and unplugging physical devices


  • Subject: MIDIGetDestination and unplugging physical devices
  • From: Andrew James <email@hidden>
  • Date: Mon, 21 Dec 2009 16:12:54 -0800 (PST)

I want to make sure I understand the behavior of what happens when a physical MIDI device is unplugged between a call to MIDIGetNumberOfDestinations() and MIDIGetDestination().
 
My assumption has been that that MIDIGetDestination is range checked and that a NULL value will be returned for an index that is now out of range.
 
ItemCount ndest = MIDIGetNumberOfDestinations();
MIDIEndpointRef endpoint = NULL;
CFStringRef stringProp = NULL;
 
for( ItemCount i = 0; ItemCount < ndest; ++i ) {
 
    // before we got here for one of out valid i's
    // the MIDI device was unplugged
    endpoint = MIDIGetDestination( i );
 
    // Get NULL for index out of range
    if( endpoint != NULL ) {
        stringProp == NULL
        MIDIObjectGetStringProperty( endpoint, kMIDIPropertyDisplayName, &stringProp );
 
        // disconnect occurred between getting destination and property
        if( stringProp != NULL ) {
            CFShow( stringProp );
           CFRelease( stringProp );
        }
    }
}
 
That being said... what if the removal is processed between MIDIGetDestination and MIDIObjectGetStringProperty?  Since as far as I can tell, MIDIEndpointRef instances are not reference counted.. how can I be sure this call will work?  or what CoreMIDI facility gaurantees that a physical enpoint being removed will

 _______________________________________________
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

  • Prev by Date: Re: Concept Question
  • Next by Date: IOHIDManagerRegisterDeviceMatchingCallback called twice when device pluggedin
  • Previous by thread: Re: Difference in behavior between 10.5 and 10.6 in Logic
  • Next by thread: IOHIDManagerRegisterDeviceMatchingCallback called twice when device pluggedin
  • Index(es):
    • Date
    • Thread