Add menu action to reset parameters to initial values, except for main volume and input pass through
This commit is contained in:
parent
34002da183
commit
29e46bd008
@ -279,10 +279,11 @@ void PaulstretchpluginAudioProcessorEditor::chooseFile()
|
||||
void PaulstretchpluginAudioProcessorEditor::showSettingsMenu()
|
||||
{
|
||||
PopupMenu menu;
|
||||
menu.addItem(4, "Reset parameters", true, false);
|
||||
menu.addItem(1, "Play when host transport running", true, processor.m_play_when_host_plays);
|
||||
menu.addItem(2, "Capture when host transport running", true, processor.m_capture_when_host_plays);
|
||||
|
||||
//menu.addItem(3, "Prebuffering", true, processor.m_use_backgroundbuffering);
|
||||
|
||||
PopupMenu bufferingmenu;
|
||||
int curbufamount = processor.getPreBufferAmount();
|
||||
bufferingmenu.addItem(100,"None",true,curbufamount == -1);
|
||||
@ -302,6 +303,10 @@ void PaulstretchpluginAudioProcessorEditor::showSettingsMenu()
|
||||
{
|
||||
processor.m_capture_when_host_plays = !processor.m_capture_when_host_plays;
|
||||
}
|
||||
if (r == 4)
|
||||
{
|
||||
processor.resetParameters();
|
||||
}
|
||||
if (r == 3)
|
||||
{
|
||||
String fftlib = fftwf_version;
|
||||
|
@ -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);
|
||||
|
@ -80,10 +80,11 @@ public:
|
||||
std::unique_ptr<PropertiesFile> m_props_file;
|
||||
};
|
||||
|
||||
class PaulstretchpluginAudioProcessor : public AudioProcessor, public MultiTimer
|
||||
class PaulstretchpluginAudioProcessor : public AudioProcessor,
|
||||
public MultiTimer
|
||||
{
|
||||
public:
|
||||
//==============================================================================
|
||||
|
||||
PaulstretchpluginAudioProcessor();
|
||||
~PaulstretchpluginAudioProcessor();
|
||||
|
||||
@ -140,7 +141,7 @@ public:
|
||||
bool m_play_when_host_plays = false;
|
||||
bool m_capture_when_host_plays = false;
|
||||
bool m_use_backgroundbuffering = true;
|
||||
|
||||
void resetParameters();
|
||||
void setPreBufferAmount(int x);
|
||||
int getPreBufferAmount();
|
||||
private:
|
||||
@ -178,6 +179,7 @@ private:
|
||||
double m_cur_sr = 0.0;
|
||||
bool m_last_host_playing = false;
|
||||
AudioBuffer<float> m_input_buffer;
|
||||
std::vector<float> m_reset_pars;
|
||||
//==============================================================================
|
||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (PaulstretchpluginAudioProcessor)
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user