• 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
Re: .mid files through CoreMidi
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: .mid files through CoreMidi


  • Subject: Re: .mid files through CoreMidi
  • From: Kurt Revis <email@hidden>
  • Date: Thu, 24 Jul 2003 10:32:16 -0700

On Thursday, July 24, 2003, at 09:24 AM, Roy Lovejoy wrote:

if I call MusicSequenceSetMIDIEndpoint(), with a new endpoint, does the
sequence now own the endpoint? or do I still need to dispose of it?

does MusicSequenceSetMIDIEndpoint() dispose of it's own endpoints

In the absence of any other information, I wouldn't expect the MusicSequence to take over "ownership" of the endpoint. Here's what I'd do:
* Create the endpoint and dispose of it the same way you normally would
* Make sure that a MusicSequence never has a dangling reference to an endpoint that you've disposed of

do I need to MusicSequenceSetMIDIEndpoint() back the old ones grabbed from
MusicTrackGetDestMIDIEndpoint(), (like you had to do with SetPortPixMap())

New tracks should not have an endpoint associated with them by default, so you should feel free to just set the endpoint and forget about the old (NULL) value. There's no need to restore the old value after you're done.

Here's the way I think about it: CoreMIDI objects aren't reference-counted (at least not in any externally-visible way), unlike CoreFoundation objects. So if you create the object, you are the owner and you are responsible for disposing of it when appropriate. Other functions may take references to CoreMIDI objects that you've created, but they will never take ownership. It's up to you to make sure that you don't leave other code with dangling references to CoreMIDI objects that you've disposed of.

(That said, there might be exceptions to this guideline that I don't know about... if there are, please point them out!)

--
Kurt Revis
email@hidden
_______________________________________________
coreaudio-api mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/coreaudio-api
Do not post admin requests to the list. They will be ignored.

References: 
 >Re: .mid files through CoreMidi (From: Roy Lovejoy <email@hidden>)

  • Prev by Date: Re: LAP : AU music device needs Audio & MIDI
  • Next by Date: MusicPlayerIsPlaying() : is it done yet?
  • Previous by thread: Re: .mid files through CoreMidi
  • Next by thread: examples and doc for HAL plugins?
  • Index(es):
    • Date
    • Thread