• 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: some sort of dispose
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: some sort of dispose


  • Subject: Re: some sort of dispose
  • From: Doug Wyatt <email@hidden>
  • Date: Thu, 24 Jul 2003 10:16:46 -0700

Ugh. The only way to delete a device is to call MIDISetupAddDevice and then MIDISetupRemoveDevice, which does dispose it.

We could add an API but then it would only exist on Panther and wouldn't help you on earlier systems.

You might preflight to see if you're going to be able to finish creating the device successfully before creating it? IOW, gather all the information you're going to need to create the device before actually doing it.

Leaking is bad, but a MIDIDevice is pretty lightweight (no more than a few hundred bytes), so if it's pretty unlikely that you'd fail, it wouldn't be horrible if you failed to dispose it -- nothing in CoreMIDI retains a reference to it until you call MIDISetupAddDevice.

Doug

On Wednesday, 23 July, 2003, at 18:57, Pete Gontier wrote:
Am I missing something obvious? (see comments below)

MIDIDeviceRef InterfaceStarter::CreateMIDIDevice
(ConstDeviceDescriptorPtr ourDeviceDescriptor)
{
MIDIDeviceRef midiDeviceRef;

ThrowIfError (MIDIDeviceCreate ( MIDIDriverRef (fInterface),
ourDeviceDescriptor->modelName,
ourDeviceDescriptor->manufacturerName,
ourDeviceDescriptor->modelName,
&midiDeviceRef ));
Assert (midiDeviceRef != nil);

try
{
// all kindsa stuff which might throw an exception
}
catch (...)
{
// Ordinarily, I would pass midiDeviceRef to some sort of dispose
// function, but there does not seem to be any such function.

throw;
}

return midiDeviceRef;
}
_______________________________________________
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.

  • Follow-Ups:
    • Re: some sort of dispose
      • From: Pete Gontier <email@hidden>
  • Prev by Date: LAP : AU music device needs Audio & MIDI
  • Next by Date: Re: LAP : AU music device needs Audio & MIDI
  • Previous by thread: Re: LAP : AU music device needs Audio & MIDI
  • Next by thread: Re: some sort of dispose
  • Index(es):
    • Date
    • Thread