Finally support changing FFT size. This however doesn't now use the double stretch source thing, so glitches will probably happen... Parameter component was changed to support changing the parameter value only on mouse releasee etc
This commit is contained in:
parent
3cdc6eabd6
commit
6aa514f52b
@ -437,10 +437,11 @@ void StretchAudioSource::setFFTWindowingType(int windowtype)
|
|||||||
void StretchAudioSource::setFFTSize(int size)
|
void StretchAudioSource::setFFTSize(int size)
|
||||||
{
|
{
|
||||||
jassert(size>0);
|
jassert(size>0);
|
||||||
if (size != m_process_fftsize)
|
if (m_process_fftsize == 0 || size != m_process_fftsize)
|
||||||
{
|
{
|
||||||
m_process_fftsize = size;
|
m_process_fftsize = size;
|
||||||
|
initObjects();
|
||||||
|
++m_param_change_count;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,9 +28,17 @@ PaulstretchpluginAudioProcessorEditor::PaulstretchpluginAudioProcessorEditor (Pa
|
|||||||
const auto& pars = processor.getParameters();
|
const auto& pars = processor.getParameters();
|
||||||
for (int i=0;i<pars.size();++i)
|
for (int i=0;i<pars.size();++i)
|
||||||
{
|
{
|
||||||
m_parcomps.push_back(std::make_shared<ParameterComponent>(pars[i]));
|
AudioProcessorParameterWithID* parid = dynamic_cast<AudioProcessorParameterWithID*>(pars[i]);
|
||||||
|
jassert(parid);
|
||||||
|
if (parid)
|
||||||
|
{
|
||||||
|
bool notifyonlyonrelease = false;
|
||||||
|
if (parid->paramID.startsWith("fftsize"))
|
||||||
|
notifyonlyonrelease = true;
|
||||||
|
m_parcomps.push_back(std::make_shared<ParameterComponent>(pars[i],notifyonlyonrelease));
|
||||||
addAndMakeVisible(m_parcomps.back().get());
|
addAndMakeVisible(m_parcomps.back().get());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
addAndMakeVisible(&m_rec_enable);
|
addAndMakeVisible(&m_rec_enable);
|
||||||
m_rec_enable.setButtonText("Capture");
|
m_rec_enable.setButtonText("Capture");
|
||||||
attachCallback(m_rec_enable, [this]() { processor.setRecordingEnabled(m_rec_enable.getToggleState()); });
|
attachCallback(m_rec_enable, [this]() { processor.setRecordingEnabled(m_rec_enable.getToggleState()); });
|
||||||
@ -90,9 +98,8 @@ void PaulstretchpluginAudioProcessorEditor::timerCallback(int id)
|
|||||||
m_wavecomponent.setRecordingPosition(processor.getRecordingPositionPercent());
|
m_wavecomponent.setRecordingPosition(processor.getRecordingPositionPercent());
|
||||||
} else
|
} else
|
||||||
m_wavecomponent.setRecordingPosition(-1.0);
|
m_wavecomponent.setRecordingPosition(-1.0);
|
||||||
//m_info_label.setText(String(processor.m_control->getStretchAudioSource()->m_param_change_count), dontSendNotification);
|
String infotext = String(processor.m_control->getPreBufferingPercent(), 1) + " " + String(processor.m_control->getStretchAudioSource()->m_param_change_count);
|
||||||
double prebufavail=processor.m_control->getPreBufferingPercent();
|
m_info_label.setText(infotext, dontSendNotification);
|
||||||
m_info_label.setText(String(prebufavail,1), dontSendNotification);
|
|
||||||
}
|
}
|
||||||
if (id == 2)
|
if (id == 2)
|
||||||
{
|
{
|
||||||
|
@ -47,7 +47,7 @@ class ParameterComponent : public Component,
|
|||||||
public Slider::Listener, public Button::Listener
|
public Slider::Listener, public Button::Listener
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ParameterComponent(AudioProcessorParameter* par) : m_par(par)
|
ParameterComponent(AudioProcessorParameter* par, bool notifyOnlyOnRelease) : m_par(par)
|
||||||
{
|
{
|
||||||
addAndMakeVisible(&m_label);
|
addAndMakeVisible(&m_label);
|
||||||
m_label.setText(par->getName(50),dontSendNotification);
|
m_label.setText(par->getName(50),dontSendNotification);
|
||||||
@ -55,6 +55,7 @@ public:
|
|||||||
if (floatpar)
|
if (floatpar)
|
||||||
{
|
{
|
||||||
m_slider = std::make_unique<Slider>();
|
m_slider = std::make_unique<Slider>();
|
||||||
|
m_notify_only_on_release = notifyOnlyOnRelease;
|
||||||
m_slider->setRange(floatpar->range.start, floatpar->range.end, floatpar->range.interval);
|
m_slider->setRange(floatpar->range.start, floatpar->range.end, floatpar->range.interval);
|
||||||
m_slider->setValue(*floatpar, dontSendNotification);
|
m_slider->setValue(*floatpar, dontSendNotification);
|
||||||
m_slider->addListener(this);
|
m_slider->addListener(this);
|
||||||
@ -84,6 +85,20 @@ public:
|
|||||||
}
|
}
|
||||||
void sliderValueChanged(Slider* slid) override
|
void sliderValueChanged(Slider* slid) override
|
||||||
{
|
{
|
||||||
|
if (m_notify_only_on_release == true)
|
||||||
|
return;
|
||||||
|
AudioParameterFloat* floatpar = dynamic_cast<AudioParameterFloat*>(m_par);
|
||||||
|
*floatpar = slid->getValue();
|
||||||
|
}
|
||||||
|
void sliderDragStarted(Slider* slid) override
|
||||||
|
{
|
||||||
|
m_dragging = true;
|
||||||
|
}
|
||||||
|
void sliderDragEnded(Slider* slid) override
|
||||||
|
{
|
||||||
|
m_dragging = false;
|
||||||
|
if (m_notify_only_on_release == false)
|
||||||
|
return;
|
||||||
AudioParameterFloat* floatpar = dynamic_cast<AudioParameterFloat*>(m_par);
|
AudioParameterFloat* floatpar = dynamic_cast<AudioParameterFloat*>(m_par);
|
||||||
*floatpar = slid->getValue();
|
*floatpar = slid->getValue();
|
||||||
}
|
}
|
||||||
@ -98,7 +113,7 @@ public:
|
|||||||
void updateComponent()
|
void updateComponent()
|
||||||
{
|
{
|
||||||
AudioParameterFloat* floatpar = dynamic_cast<AudioParameterFloat*>(m_par);
|
AudioParameterFloat* floatpar = dynamic_cast<AudioParameterFloat*>(m_par);
|
||||||
if (m_slider != nullptr && (float)m_slider->getValue() != *floatpar)
|
if (m_slider != nullptr && m_dragging == false && (float)m_slider->getValue() != *floatpar)
|
||||||
{
|
{
|
||||||
m_slider->setValue(*floatpar, dontSendNotification);
|
m_slider->setValue(*floatpar, dontSendNotification);
|
||||||
}
|
}
|
||||||
@ -114,6 +129,8 @@ private:
|
|||||||
std::unique_ptr<Slider> m_slider;
|
std::unique_ptr<Slider> m_slider;
|
||||||
std::unique_ptr<ComboBox> m_combobox;
|
std::unique_ptr<ComboBox> m_combobox;
|
||||||
std::unique_ptr<ToggleButton> m_togglebut;
|
std::unique_ptr<ToggleButton> m_togglebut;
|
||||||
|
bool m_notify_only_on_release = false;
|
||||||
|
bool m_dragging = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
class WaveformComponent : public Component, public ChangeListener, public Timer
|
class WaveformComponent : public Component, public ChangeListener, public Timer
|
||||||
|
@ -235,7 +235,7 @@ void PaulstretchpluginAudioProcessor::processBlock (AudioSampleBuffer& buffer, M
|
|||||||
m_control->getStretchAudioSource()->val_MainVolume = (float)*getFloatParameter(0);
|
m_control->getStretchAudioSource()->val_MainVolume = (float)*getFloatParameter(0);
|
||||||
m_control->getStretchAudioSource()->setRate(*getFloatParameter(1));
|
m_control->getStretchAudioSource()->setRate(*getFloatParameter(1));
|
||||||
m_control->getStretchAudioSource()->val_XFadeLen = 0.1;
|
m_control->getStretchAudioSource()->val_XFadeLen = 0.1;
|
||||||
//m_control->setFFTSize(*getFloatParameter(2));
|
m_control->setFFTSize(*getFloatParameter(2));
|
||||||
m_control->ppar.pitch_shift.cents = *getFloatParameter(3) * 100.0;
|
m_control->ppar.pitch_shift.cents = *getFloatParameter(3) * 100.0;
|
||||||
m_control->ppar.freq_shift.Hz = *getFloatParameter(4);
|
m_control->ppar.freq_shift.Hz = *getFloatParameter(4);
|
||||||
double t0 = *getFloatParameter(5);
|
double t0 = *getFloatParameter(5);
|
||||||
|
Loading…
Reference in New Issue
Block a user