Re: some sort of dispose
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.