AUHosting doesn't clean up AU graph on quit
AUHosting doesn't clean up AU graph on quit
- Subject: AUHosting doesn't clean up AU graph on quit
- From: Jim Wintermyre <email@hidden>
- Date: Thu, 30 Oct 2003 01:48:22 -0800
Like the subject says, AUHosting doesn't clean up AU graph when you
quit (it cleans up the graph when selecting a different plugin in the
list, but not on quit). This may not seem like a big deal, but it is
if your AU's are allocating resources, say, on a DSP card, and you
need to be told when the AU is being deallocated. In my quick and
dirty fix I changed AudioUnitHosting::DoCommand() to have a case for
'quit', and in that case it basically does what SetTargetUnit() does
up to the AUGraphNewNode() call (modified slightly) to clean up the
graph. i.e.:
case 'quit':
{
//printf ("Got quit command");
// Clean up the graph
if (mGraph)
{
// remove midi mapping
if (mMIDIController)
RequireNoErr (AUMIDIControllerMapChannelToAU(mMIDIController, -1,
NULL, -1, false));
// we stop this now (its normally running) so we don't respond to
"live" MIDI events in
// the case of a MusicDevice
#if !HOST_EFFECT_UNIT
RequireNoErr(AUGraphStop (mGraph));
#endif
StopPlayer();
TargetUnitDisengage();
if (mTargetNode) {
RequireNoErr (AUGraphRemoveNode (mGraph, mTargetNode));
// lets just update the state of the graph to remove the node
AUGraphUpdate (mGraph, NULL);
}
RequireNoErr(AUGraphUninitialize (mGraph));
}
// Let the app finish quitting
return XApp::DoCommand(command);
}
break;
Jim
_______________________________________________
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.