Reverted Capture parameter to a normal parameter to again allow host MIDI learn etc. It is now instead ignored when saving the state tree. This may not fix the parameter being recalled when undoing in all hosts but this is the best that can be done with the plugin format limitations at this point.
This commit is contained in:
@ -19,9 +19,10 @@
|
||||
|
||||
#include <vector>
|
||||
#include <memory>
|
||||
#include <set>
|
||||
#include "../JuceLibraryCode/JuceHeader.h"
|
||||
|
||||
const String g_plugintitle{ "PaulXStretch 1.3.0" };
|
||||
const String g_plugintitle{ "PaulXStretch 1.2.4" };
|
||||
|
||||
using REALTYPE = float;
|
||||
|
||||
@ -115,10 +116,13 @@ inline void storeToTreeProperties(ValueTree dest, UndoManager* uman, AudioParame
|
||||
if (par) dest.setProperty(par->paramID,(int)*par,uman);
|
||||
}
|
||||
|
||||
inline void storeToTreeProperties(ValueTree dest, UndoManager* uman, const OwnedArray<AudioProcessorParameter>& pars)
|
||||
inline void storeToTreeProperties(ValueTree dest, UndoManager* uman, const OwnedArray<AudioProcessorParameter>& pars,
|
||||
const std::set<AudioProcessorParameter*>& ignorepars = {})
|
||||
{
|
||||
for (auto& e : pars)
|
||||
{
|
||||
if (ignorepars.count(e))
|
||||
continue;
|
||||
auto parf = dynamic_cast<AudioParameterFloat*>(e);
|
||||
if (parf != nullptr)
|
||||
storeToTreeProperties(dest, nullptr, parf);
|
||||
|
@ -124,8 +124,6 @@ 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());
|
||||
}
|
||||
@ -1255,20 +1253,10 @@ 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)
|
||||
{
|
||||
if (m_nonparamstate == nullptr)
|
||||
{
|
||||
if (m_togglebut->getToggleState()!=*boolpar)
|
||||
*boolpar = m_togglebut->getToggleState();
|
||||
}
|
||||
else
|
||||
{
|
||||
// If we have the non-parameter state pointer, just set the target parameter to true.
|
||||
// Logic in the AudioProcessor determines what should be done and it sets the parameter immediately back
|
||||
// to false when it sees the parameter is true.
|
||||
*boolpar = true;
|
||||
}
|
||||
if (m_togglebut->getToggleState()!=*boolpar)
|
||||
*boolpar = m_togglebut->getToggleState();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1285,19 +1273,10 @@ void ParameterComponent::updateComponent()
|
||||
m_slider->setValue(*intpar, dontSendNotification);
|
||||
}
|
||||
AudioParameterBool* boolpar = dynamic_cast<AudioParameterBool*>(m_par);
|
||||
if (m_togglebut != nullptr)
|
||||
if (boolpar!=nullptr && m_togglebut != nullptr)
|
||||
{
|
||||
if (m_nonparamstate == nullptr)
|
||||
{
|
||||
if (m_togglebut->getToggleState() != *boolpar)
|
||||
m_togglebut->setToggleState(*boolpar, dontSendNotification);
|
||||
}
|
||||
else
|
||||
{
|
||||
// If we have the non-parameter state pointer, get the button toggle state from that
|
||||
if (m_togglebut->getToggleState()!=*m_nonparamstate)
|
||||
m_togglebut->setToggleState(*m_nonparamstate, dontSendNotification);
|
||||
}
|
||||
if (m_togglebut->getToggleState() != *boolpar)
|
||||
m_togglebut->setToggleState(*boolpar, dontSendNotification);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -91,7 +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;
|
||||
|
@ -259,7 +259,7 @@ int PaulstretchpluginAudioProcessor::getPreBufferAmount()
|
||||
ValueTree PaulstretchpluginAudioProcessor::getStateTree(bool ignoreoptions, bool ignorefile)
|
||||
{
|
||||
ValueTree paramtree("paulstretch3pluginstate");
|
||||
storeToTreeProperties(paramtree, nullptr, getParameters());
|
||||
storeToTreeProperties(paramtree, nullptr, getParameters(), { getBoolParameter(cpi_capture_trigger) });
|
||||
if (m_current_file != File() && ignorefile == false)
|
||||
{
|
||||
paramtree.setProperty("importedfile", m_current_file.getFullPathName(), nullptr);
|
||||
@ -1014,13 +1014,11 @@ void PaulstretchpluginAudioProcessor::timerCallback(int id)
|
||||
if (capture == true && m_is_recording == false)
|
||||
{
|
||||
setRecordingEnabled(true);
|
||||
*getBoolParameter(cpi_capture_trigger)=false;
|
||||
return;
|
||||
}
|
||||
if (capture == true && m_is_recording == true)
|
||||
if (capture == false && m_is_recording == true)
|
||||
{
|
||||
setRecordingEnabled(false);
|
||||
*getBoolParameter(cpi_capture_trigger) = false;
|
||||
return;
|
||||
}
|
||||
if (m_cur_num_out_chans != *m_outchansparam)
|
||||
|
@ -237,7 +237,7 @@ public:
|
||||
void* ptr,
|
||||
float opt) override;
|
||||
int m_cur_tab_index = 0;
|
||||
bool m_is_recording = false;
|
||||
|
||||
bool m_save_captured_audio = true;
|
||||
String m_capture_location;
|
||||
bool m_midinote_control = false;
|
||||
@ -255,7 +255,7 @@ private:
|
||||
CriticalSection m_cs;
|
||||
File m_current_file;
|
||||
Time m_current_file_date;
|
||||
|
||||
bool m_is_recording = false;
|
||||
TimeSliceThread m_bufferingthread;
|
||||
std::unique_ptr<StretchAudioSource> m_stretch_source;
|
||||
std::unique_ptr<MyBufferingAudioSource> m_buffering_source;
|
||||
|
Reference in New Issue
Block a user