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

PluginHost: Fixed a bug where the PluginHost would always ask to save the file even if it wasn't changed

This commit is contained in:
hogliux 2018-05-17 11:43:16 +01:00
parent aec8c367fe
commit 5b9a07ec2e

View file

@ -40,11 +40,7 @@ FilterGraph::FilterGraph (AudioPluginFormatManager& fm)
formatManager (fm) formatManager (fm)
{ {
newDocument(); newDocument();
graph.addListener (this); graph.addListener (this);
graph.addChangeListener (this);
setChangedFlag (false);
} }
FilterGraph::~FilterGraph() FilterGraph::~FilterGraph()
@ -200,13 +196,18 @@ void FilterGraph::newDocument()
clear(); clear();
setFile ({}); setFile ({});
graph.removeChangeListener (this);
InternalPluginFormat internalFormat; InternalPluginFormat internalFormat;
addPlugin (internalFormat.audioInDesc, { 0.5, 0.1 }); addPlugin (internalFormat.audioInDesc, { 0.5, 0.1 });
addPlugin (internalFormat.midiInDesc, { 0.25, 0.1 }); addPlugin (internalFormat.midiInDesc, { 0.25, 0.1 });
addPlugin (internalFormat.audioOutDesc, { 0.5, 0.9 }); addPlugin (internalFormat.audioOutDesc, { 0.5, 0.9 });
setChangedFlag (false); MessageManager::callAsync ([this] () {
setChangedFlag (false);
graph.addChangeListener (this);
} );
} }
Result FilterGraph::loadDocument (const File& file) Result FilterGraph::loadDocument (const File& file)
@ -217,7 +218,14 @@ Result FilterGraph::loadDocument (const File& file)
if (xml == nullptr || ! xml->hasTagName ("FILTERGRAPH")) if (xml == nullptr || ! xml->hasTagName ("FILTERGRAPH"))
return Result::fail ("Not a valid filter graph file"); return Result::fail ("Not a valid filter graph file");
graph.removeChangeListener (this);
restoreFromXml (*xml); restoreFromXml (*xml);
MessageManager::callAsync ([this] () {
setChangedFlag (false);
graph.addChangeListener (this);
} );
return Result::ok(); return Result::ok();
} }