Use convenience method to create components

This commit is contained in:
xenakios 2018-05-31 13:21:35 +03:00
parent be0cd89869
commit 1f8f57666d
2 changed files with 6 additions and 6 deletions

View File

@ -1163,23 +1163,21 @@ ParameterComponent::ParameterComponent(AudioProcessorParameter * par, bool notif
AudioParameterFloat* floatpar = dynamic_cast<AudioParameterFloat*>(par);
if (floatpar)
{
m_slider = std::make_unique<MySlider>(&floatpar->range);
m_slider = makeAddAndMakeVisible<MySlider>(&floatpar->range);
m_notify_only_on_release = notifyOnlyOnRelease;
m_slider->setRange(floatpar->range.start, floatpar->range.end, floatpar->range.interval);
m_slider->setValue(*floatpar, dontSendNotification);
m_slider->addListener(this);
m_slider->setDoubleClickReturnValue(true, floatpar->range.convertFrom0to1(par->getDefaultValue()));
addAndMakeVisible(m_slider.get());
}
AudioParameterInt* intpar = dynamic_cast<AudioParameterInt*>(par);
if (intpar)
{
m_slider = std::make_unique<MySlider>();
m_slider = makeAddAndMakeVisible<MySlider>();
m_notify_only_on_release = notifyOnlyOnRelease;
m_slider->setRange(intpar->getRange().getStart(), intpar->getRange().getEnd(), 1.0);
m_slider->setValue(*intpar, dontSendNotification);
m_slider->addListener(this);
addAndMakeVisible(m_slider.get());
}
AudioParameterChoice* choicepar = dynamic_cast<AudioParameterChoice*>(par);
if (choicepar)

View File

@ -629,7 +629,10 @@ void PaulstretchpluginAudioProcessor::processBlock (AudioBuffer<double>& buffer,
void PaulstretchpluginAudioProcessor::processBlock (AudioSampleBuffer& buffer, MidiBuffer& midiMessages)
{
ScopedLock locker(m_cs);
const int totalNumInputChannels = getTotalNumInputChannels();
const int totalNumOutputChannels = getTotalNumOutputChannels();
AudioPlayHead* phead = getPlayHead();
if (phead != nullptr)
{
@ -643,8 +646,7 @@ void PaulstretchpluginAudioProcessor::processBlock (AudioSampleBuffer& buffer, M
m_cur_sr = srtemp;
m_prebufsmoother.setSlope(0.9, srtemp / buffer.getNumSamples());
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)
m_input_buffer.copyFrom(i, 0, buffer, i, 0, buffer.getNumSamples());
for (int i = totalNumInputChannels; i < totalNumOutputChannels; ++i)