Add menu action to reset parameters to initial values, except for main volume and input pass through

This commit is contained in:
xenakios
2017-12-26 18:12:22 +02:00
parent 34002da183
commit 29e46bd008
3 changed files with 24 additions and 4 deletions

View File

@ -160,6 +160,9 @@ PaulstretchpluginAudioProcessor::PaulstretchpluginAudioProcessor()
addParameter(new AudioParameterBool("pause_enabled0", "Pause", false)); // 28
addParameter(new AudioParameterFloat("maxcapturelen_0", "Max capture length", 1.0f, 120.0f, 10.0f)); // 29
addParameter(new AudioParameterBool("passthrough0", "Pass input through", false)); // 30
auto& pars = getParameters();
for (const auto& p : pars)
m_reset_pars.push_back(p->getValue());
setPreBufferAmount(2);
startTimer(1, 50);
}
@ -170,6 +173,16 @@ PaulstretchpluginAudioProcessor::~PaulstretchpluginAudioProcessor()
m_bufferingthread.stopThread(1000);
}
void PaulstretchpluginAudioProcessor::resetParameters()
{
ScopedLock locker(m_cs);
for (int i = 0; i < m_reset_pars.size(); ++i)
{
if (i!=cpi_main_volume && i!=cpi_passthrough)
setParameter(i, m_reset_pars[i]);
}
}
void PaulstretchpluginAudioProcessor::setPreBufferAmount(int x)
{
int temp = jlimit(0, 5, x);