Use convenience method to create components
This commit is contained in:
parent
be0cd89869
commit
1f8f57666d
@ -1163,23 +1163,21 @@ ParameterComponent::ParameterComponent(AudioProcessorParameter * par, bool notif
|
|||||||
AudioParameterFloat* floatpar = dynamic_cast<AudioParameterFloat*>(par);
|
AudioParameterFloat* floatpar = dynamic_cast<AudioParameterFloat*>(par);
|
||||||
if (floatpar)
|
if (floatpar)
|
||||||
{
|
{
|
||||||
m_slider = std::make_unique<MySlider>(&floatpar->range);
|
m_slider = makeAddAndMakeVisible<MySlider>(&floatpar->range);
|
||||||
m_notify_only_on_release = notifyOnlyOnRelease;
|
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);
|
||||||
m_slider->setDoubleClickReturnValue(true, floatpar->range.convertFrom0to1(par->getDefaultValue()));
|
m_slider->setDoubleClickReturnValue(true, floatpar->range.convertFrom0to1(par->getDefaultValue()));
|
||||||
addAndMakeVisible(m_slider.get());
|
|
||||||
}
|
}
|
||||||
AudioParameterInt* intpar = dynamic_cast<AudioParameterInt*>(par);
|
AudioParameterInt* intpar = dynamic_cast<AudioParameterInt*>(par);
|
||||||
if (intpar)
|
if (intpar)
|
||||||
{
|
{
|
||||||
m_slider = std::make_unique<MySlider>();
|
m_slider = makeAddAndMakeVisible<MySlider>();
|
||||||
m_notify_only_on_release = notifyOnlyOnRelease;
|
m_notify_only_on_release = notifyOnlyOnRelease;
|
||||||
m_slider->setRange(intpar->getRange().getStart(), intpar->getRange().getEnd(), 1.0);
|
m_slider->setRange(intpar->getRange().getStart(), intpar->getRange().getEnd(), 1.0);
|
||||||
m_slider->setValue(*intpar, dontSendNotification);
|
m_slider->setValue(*intpar, dontSendNotification);
|
||||||
m_slider->addListener(this);
|
m_slider->addListener(this);
|
||||||
addAndMakeVisible(m_slider.get());
|
|
||||||
}
|
}
|
||||||
AudioParameterChoice* choicepar = dynamic_cast<AudioParameterChoice*>(par);
|
AudioParameterChoice* choicepar = dynamic_cast<AudioParameterChoice*>(par);
|
||||||
if (choicepar)
|
if (choicepar)
|
||||||
|
@ -629,7 +629,10 @@ void PaulstretchpluginAudioProcessor::processBlock (AudioBuffer<double>& buffer,
|
|||||||
|
|
||||||
void PaulstretchpluginAudioProcessor::processBlock (AudioSampleBuffer& buffer, MidiBuffer& midiMessages)
|
void PaulstretchpluginAudioProcessor::processBlock (AudioSampleBuffer& buffer, MidiBuffer& midiMessages)
|
||||||
{
|
{
|
||||||
|
|
||||||
ScopedLock locker(m_cs);
|
ScopedLock locker(m_cs);
|
||||||
|
const int totalNumInputChannels = getTotalNumInputChannels();
|
||||||
|
const int totalNumOutputChannels = getTotalNumOutputChannels();
|
||||||
AudioPlayHead* phead = getPlayHead();
|
AudioPlayHead* phead = getPlayHead();
|
||||||
if (phead != nullptr)
|
if (phead != nullptr)
|
||||||
{
|
{
|
||||||
@ -643,8 +646,7 @@ void PaulstretchpluginAudioProcessor::processBlock (AudioSampleBuffer& buffer, M
|
|||||||
m_cur_sr = srtemp;
|
m_cur_sr = srtemp;
|
||||||
m_prebufsmoother.setSlope(0.9, srtemp / buffer.getNumSamples());
|
m_prebufsmoother.setSlope(0.9, srtemp / buffer.getNumSamples());
|
||||||
m_smoothed_prebuffer_ready = m_prebufsmoother.process(m_buffering_source->getPercentReady());
|
m_smoothed_prebuffer_ready = m_prebufsmoother.process(m_buffering_source->getPercentReady());
|
||||||
const int totalNumInputChannels = getTotalNumInputChannels();
|
|
||||||
const int totalNumOutputChannels = getTotalNumOutputChannels();
|
|
||||||
for (int i = 0; i < totalNumInputChannels; ++i)
|
for (int i = 0; i < totalNumInputChannels; ++i)
|
||||||
m_input_buffer.copyFrom(i, 0, buffer, i, 0, buffer.getNumSamples());
|
m_input_buffer.copyFrom(i, 0, buffer, i, 0, buffer.getNumSamples());
|
||||||
for (int i = totalNumInputChannels; i < totalNumOutputChannels; ++i)
|
for (int i = totalNumInputChannels; i < totalNumOutputChannels; ++i)
|
||||||
|
Loading…
Reference in New Issue
Block a user