Rename capture enabled parameter constant. Implemented incredibly nasty hack to prevent hosts like Reaper from enabling the capture when recalling undo states. Even this doesn't fully work, additional undo history states are still added, but at least it looks like the capture enabled state won't be recalled...

This commit is contained in:
xenakios 2018-11-08 21:48:51 +02:00
parent 1e9ec7ffd3
commit bcc3290582
4 changed files with 31 additions and 11 deletions

View File

@ -112,6 +112,8 @@ PaulstretchpluginAudioProcessorEditor::PaulstretchpluginAudioProcessorEditor(Pau
{
m_parcomps.emplace_back(std::make_unique<ParameterComponent>(pars[i], notifyonlyonrelease));
m_parcomps.back()->m_group_id = group_id;
if (i == cpi_capture_trigger)
m_parcomps.back()->m_nonparamstate = &processor.m_is_recording;
if (group_id >= -1)
addAndMakeVisible(m_parcomps.back().get());
}
@ -288,7 +290,7 @@ void PaulstretchpluginAudioProcessorEditor::resized()
//std::vector<std::vector<int>> layout;
//layout.emplace_back(cpi_capture_enabled, cpi_passthrough, cpi_pause_enabled, cpi_freeze);
//layout.emplace_back(cpi_main_volume, cpi_num_inchans, cpi_num_outchans);
m_parcomps[cpi_capture_enabled]->setBounds(xoffs, yoffs, div-1, 24);
m_parcomps[cpi_capture_trigger]->setBounds(xoffs, yoffs, div-1, 24);
//xoffs += div;
//m_parcomps[cpi_max_capture_len]->setBounds(xoffs, yoffs, div - 1, 24);
xoffs += div;
@ -1250,9 +1252,17 @@ void ParameterComponent::sliderDragEnded(Slider * slid)
void ParameterComponent::buttonClicked(Button * but)
{
AudioParameterBool* boolpar = dynamic_cast<AudioParameterBool*>(m_par);
if (m_togglebut != nullptr && m_togglebut->getToggleState() != *boolpar)
if (m_togglebut != nullptr) // && m_togglebut->getToggleState() != *boolpar)
{
*boolpar = m_togglebut->getToggleState();
if (m_nonparamstate == nullptr)
{
if (m_togglebut->getToggleState()!=*boolpar)
*boolpar = m_togglebut->getToggleState();
}
else
{
*boolpar = true;
}
}
}
@ -1269,9 +1279,18 @@ void ParameterComponent::updateComponent()
m_slider->setValue(*intpar, dontSendNotification);
}
AudioParameterBool* boolpar = dynamic_cast<AudioParameterBool*>(m_par);
if (m_togglebut != nullptr && m_togglebut->getToggleState() != *boolpar)
if (m_togglebut != nullptr) // && m_togglebut->getToggleState() != *boolpar)
{
m_togglebut->setToggleState(*boolpar, dontSendNotification);
if (m_nonparamstate == nullptr)
{
if (m_togglebut->getToggleState() != *boolpar)
m_togglebut->setToggleState(*boolpar, dontSendNotification);
}
else
{
if (m_togglebut->getToggleState()!=*m_nonparamstate)
m_togglebut->setToggleState(*m_nonparamstate, dontSendNotification);
}
}
}

View File

@ -91,6 +91,7 @@ public:
void setHighLighted(bool b);
int m_group_id = -1;
Slider* getSlider() { return m_slider.get(); }
bool* m_nonparamstate = nullptr;
private:
Label m_label;
AudioProcessorParameter* m_par = nullptr;

View File

@ -903,7 +903,7 @@ void PaulstretchpluginAudioProcessor::timerCallback(int id)
{
if (id == 1)
{
bool capture = *getBoolParameter(cpi_capture_enabled);
bool capture = *getBoolParameter(cpi_capture_trigger);
if (capture == false && m_max_reclen != *getFloatParameter(cpi_max_capture_len))
{
m_max_reclen = *getFloatParameter(cpi_max_capture_len);
@ -912,11 +912,13 @@ void PaulstretchpluginAudioProcessor::timerCallback(int id)
if (capture == true && m_is_recording == false)
{
setRecordingEnabled(true);
*getBoolParameter(cpi_capture_trigger)=false;
return;
}
if (capture == false && m_is_recording == true)
if (capture == true && m_is_recording == true)
{
setRecordingEnabled(false);
*getBoolParameter(cpi_capture_trigger) = false;
return;
}
if (m_cur_num_out_chans != *m_outchansparam)

View File

@ -51,7 +51,7 @@ const int cpi_tonalvsnoisepreserve = 22;
const int cpi_filter_low = 23;
const int cpi_filter_high = 24;
const int cpi_onsetdetection = 25;
const int cpi_capture_enabled = 26;
const int cpi_capture_trigger = 26;
const int cpi_num_outchans = 27;
const int cpi_pause_enabled = 28;
const int cpi_max_capture_len = 29;
@ -217,13 +217,11 @@ public:
void* ptr,
float opt) override;
int m_cur_tab_index = 0;
bool m_is_recording = false;
private:
bool m_prebuffering_inited = false;
AudioBuffer<float> m_recbuffer;
double m_max_reclen = 10.0;
bool m_is_recording = false;
int m_rec_pos = 0;
int m_rec_count = 0;
Range<int> m_recorded_range;