1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-24 01:54:22 +00:00

Deallocate all nodes in the graph before calling JUCEApplication::quit in the audio demo host

Some NI plug-ins really don't like it if you call [NSApp stop] while they are still loaded.

Fixes #89
This commit is contained in:
hogliux 2016-08-10 17:40:47 +01:00
parent 8994f37dd0
commit 59cc979cfe
4 changed files with 54 additions and 33 deletions

View file

@ -1091,14 +1091,14 @@ private:
//==============================================================================
GraphDocumentComponent::GraphDocumentComponent (AudioPluginFormatManager& formatManager,
AudioDeviceManager* deviceManager_)
: graph (formatManager), deviceManager (deviceManager_),
: graph (new FilterGraph (formatManager)), deviceManager (deviceManager_),
graphPlayer (getAppProperties().getUserSettings()->getBoolValue ("doublePrecisionProcessing", false))
{
addAndMakeVisible (graphPanel = new GraphEditorPanel (graph));
addAndMakeVisible (graphPanel = new GraphEditorPanel (*graph));
deviceManager->addChangeListener (graphPanel);
graphPlayer.setProcessor (&graph.getGraph());
graphPlayer.setProcessor (&graph->getGraph());
keyState.addListener (&graphPlayer.getMidiMessageCollector());
@ -1115,16 +1115,9 @@ GraphDocumentComponent::GraphDocumentComponent (AudioPluginFormatManager& format
GraphDocumentComponent::~GraphDocumentComponent()
{
deviceManager->removeAudioCallback (&graphPlayer);
deviceManager->removeMidiInputCallback (String::empty, &graphPlayer.getMidiMessageCollector());
deviceManager->removeChangeListener (graphPanel);
releaseGraph();
deleteAllChildren();
graphPlayer.setProcessor (nullptr);
keyState.removeListener (&graphPlayer.getMidiMessageCollector());
graph.clear();
}
void GraphDocumentComponent::resized()
@ -1146,3 +1139,15 @@ void GraphDocumentComponent::unfocusKeyboardComponent()
{
keyboardComp->unfocusAllComponents();
}
void GraphDocumentComponent::releaseGraph()
{
deviceManager->removeAudioCallback (&graphPlayer);
deviceManager->removeMidiInputCallback (String::empty, &graphPlayer.getMidiMessageCollector());
deviceManager->removeChangeListener (graphPanel);
deleteAllChildren();
graphPlayer.setProcessor (nullptr);
graph = nullptr;
}