Added convenience functions to deal with storing and getting audio parameters and use them

This commit is contained in:
xenakios
2018-02-22 01:09:36 +02:00
parent 73c58f6067
commit 1a8bddeb9b
2 changed files with 27 additions and 11 deletions

View File

@ -210,10 +210,10 @@ ValueTree PaulstretchpluginAudioProcessor::getStateTree(bool ignoreoptions, bool
paramtree.setProperty(par->paramID, (double)*par, nullptr);
}
}
paramtree.setProperty(m_outchansparam->paramID, (int)*m_outchansparam, nullptr);
paramtree.setProperty(m_inchansparam->paramID, (int)*m_inchansparam, nullptr);
paramtree.setProperty(getBoolParameter(cpi_bypass_stretch)->paramID, (bool)*getBoolParameter(cpi_bypass_stretch), nullptr);
if (m_current_file != File() && ignorefile == false)
storeToTreeProperties(paramtree, nullptr, m_outchansparam);
storeToTreeProperties(paramtree, nullptr, m_inchansparam);
storeToTreeProperties(paramtree, nullptr, getBoolParameter(cpi_bypass_stretch));
if (m_current_file != File() && ignorefile == false)
{
paramtree.setProperty("importedfile", m_current_file.getFullPathName(), nullptr);
}
@ -264,13 +264,10 @@ void PaulstretchpluginAudioProcessor::setStateFromTree(ValueTree tree)
*par = parval;
}
}
if (tree.hasProperty(m_outchansparam->paramID))
*m_outchansparam = tree.getProperty(m_outchansparam->paramID, 2);
if (tree.hasProperty(m_inchansparam->paramID))
*m_inchansparam = tree.getProperty(m_inchansparam->paramID, 2);
if (tree.hasProperty(getBoolParameter(cpi_bypass_stretch)->paramID))
*getBoolParameter(cpi_bypass_stretch) = tree.getProperty(getBoolParameter(cpi_bypass_stretch)->paramID, false);
}
getFromTreeProperties(tree, m_outchansparam);
getFromTreeProperties(tree, m_inchansparam);
getFromTreeProperties(tree, getBoolParameter(cpi_bypass_stretch));
}
int prebufamt = tree.getProperty("prebufamount", 2);
if (prebufamt == -1)
m_use_backgroundbuffering = false;