Implement more ratiomixer parameters etc

This commit is contained in:
xenakios 2018-04-03 18:32:53 +03:00
parent 941ebf31a5
commit 08398392ca
4 changed files with 47 additions and 5 deletions

View File

@ -29,7 +29,7 @@ struct ProcessParameters
{ {
pitch_shift.cents=0; pitch_shift.cents=0;
ratiomix.ratios = { 0.25,0.5,1.0,2.0,3.0,4.0,0.0,0.0 }; ratiomix.ratios = { 0.25,0.5,1.0,2.0,3.0,4.0,1.5,1.0/1.5 };
octave.om2=octave.om1=octave.o1=octave.o15=octave.o2=0.0f; octave.om2=octave.om1=octave.o1=octave.o15=octave.o2=0.0f;
octave.o0=1.0f; octave.o0=1.0f;

View File

@ -159,7 +159,7 @@ PaulstretchpluginAudioProcessorEditor::PaulstretchpluginAudioProcessorEditor(Pau
m_ratiomixeditor.GetParameterValue = [this](int which, int index) m_ratiomixeditor.GetParameterValue = [this](int which, int index)
{ {
if (which == 0) if (which == 0)
return processor.getStretchSource()->getProcessParameters().ratiomix.ratios[index]; return (double)*processor.getFloatParameter((int)cpi_octaves_ratio0 + index);
if (which == 1) if (which == 1)
{ {
if (index == 0) if (index == 0)
@ -174,6 +174,10 @@ PaulstretchpluginAudioProcessorEditor::PaulstretchpluginAudioProcessorEditor(Pau
return (double)*processor.getFloatParameter(cpi_octaves15); return (double)*processor.getFloatParameter(cpi_octaves15);
if (index == 5) if (index == 5)
return (double)*processor.getFloatParameter(cpi_octaves2); return (double)*processor.getFloatParameter(cpi_octaves2);
if (index == 6)
return (double)*processor.getFloatParameter(cpi_octaves_extra1);
if (index == 7)
return (double)*processor.getFloatParameter(cpi_octaves_extra2);
} }
return 0.0; return 0.0;
@ -192,6 +196,14 @@ PaulstretchpluginAudioProcessorEditor::PaulstretchpluginAudioProcessorEditor(Pau
*processor.getFloatParameter(cpi_octaves15) = val; *processor.getFloatParameter(cpi_octaves15) = val;
if (index == 5) if (index == 5)
*processor.getFloatParameter(cpi_octaves2) = val; *processor.getFloatParameter(cpi_octaves2) = val;
if (index == 6)
*processor.getFloatParameter(cpi_octaves_extra1) = val;
if (index == 7)
*processor.getFloatParameter(cpi_octaves_extra2) = val;
};
m_ratiomixeditor.OnRatioChanged = [this](int index, double val)
{
*processor.getFloatParameter((int)cpi_octaves_ratio0 + index) = val;
}; };
m_wave_container->addAndMakeVisible(&m_wavecomponent); m_wave_container->addAndMakeVisible(&m_wavecomponent);
m_wavefilter_tab.addTab("Waveform", Colours::white, m_wave_container, true); m_wavefilter_tab.addTab("Waveform", Colours::white, m_wave_container, true);
@ -1380,7 +1392,7 @@ RatioMixerEditor::RatioMixerEditor(int numratios)
{ {
auto ratslid = std::make_unique<Slider>(Slider::LinearHorizontal,Slider::TextBoxBelow); auto ratslid = std::make_unique<Slider>(Slider::LinearHorizontal,Slider::TextBoxBelow);
ratslid->setRange(0.125, 8.0); ratslid->setRange(0.125, 8.0);
ratslid->onValueChange = [this]() {}; ratslid->onValueChange = [this,i]() {OnRatioChanged(i, m_ratio_sliders[i]->getValue()); };
addAndMakeVisible(ratslid.get()); addAndMakeVisible(ratslid.get());
m_ratio_sliders.emplace_back(std::move(ratslid)); m_ratio_sliders.emplace_back(std::move(ratslid));
@ -1412,7 +1424,11 @@ void RatioMixerEditor::timerCallback()
{ {
for (int i = 0; i < m_ratio_level_sliders.size(); ++i) for (int i = 0; i < m_ratio_level_sliders.size(); ++i)
{ {
m_ratio_sliders[i]->setValue(GetParameterValue(0, i), dontSendNotification); double v = GetParameterValue(0, i);
m_ratio_level_sliders[i]->setValue(GetParameterValue(1, i), dontSendNotification); if (v!=m_ratio_sliders[i]->getValue())
m_ratio_sliders[i]->setValue(v, dontSendNotification);
v = GetParameterValue(1, i);
if (v!=m_ratio_level_sliders[i]->getValue())
m_ratio_level_sliders[i]->setValue(v, dontSendNotification);
} }
} }

View File

@ -158,6 +158,16 @@ PaulstretchpluginAudioProcessor::PaulstretchpluginAudioProcessor()
{ {
addParameter(m_sm_enab_pars[i]); addParameter(m_sm_enab_pars[i]);
} }
addParameter(make_floatpar("octavemix_extra0_0", "Ratio mix 7 level", 0.0f, 1.0f, 0.0f, 0.001, 1.0)); // 50
addParameter(make_floatpar("octavemix_extra1_0", "Ratio mix 8 level", 0.0f, 1.0f, 0.0f, 0.001, 1.0)); // 51
// 52-59
for (int i = 0; i < 8; ++i)
{
addParameter(make_floatpar("ratiomix_ratio_"+String(i)+"_0", "Ratio mix ratio "+String(i+1), 0.125f, 8.0f, 1.0f, 0.001, 1.0));
}
auto& pars = getParameters(); auto& pars = getParameters();
for (const auto& p : pars) for (const auto& p : pars)
m_reset_pars.push_back(p->getValue()); m_reset_pars.push_back(p->getValue());
@ -418,6 +428,11 @@ void PaulstretchpluginAudioProcessor::updateStretchParametersFromPluginParameter
pars.ratiomix.ratiolevels[3] = *getFloatParameter(cpi_octaves1); pars.ratiomix.ratiolevels[3] = *getFloatParameter(cpi_octaves1);
pars.ratiomix.ratiolevels[4] = *getFloatParameter(cpi_octaves15); pars.ratiomix.ratiolevels[4] = *getFloatParameter(cpi_octaves15);
pars.ratiomix.ratiolevels[5] = *getFloatParameter(cpi_octaves2); pars.ratiomix.ratiolevels[5] = *getFloatParameter(cpi_octaves2);
pars.ratiomix.ratiolevels[6] = *getFloatParameter(cpi_octaves_extra1);
pars.ratiomix.ratiolevels[7] = *getFloatParameter(cpi_octaves_extra2);
for (int i = 0; i < 8; ++i)
pars.ratiomix.ratios[i] = *getFloatParameter((int)cpi_octaves_ratio0 + i);
pars.filter.low = *getFloatParameter(cpi_filter_low); pars.filter.low = *getFloatParameter(cpi_filter_low);
pars.filter.high = *getFloatParameter(cpi_filter_high); pars.filter.high = *getFloatParameter(cpi_filter_high);

View File

@ -77,6 +77,17 @@ const int cpi_enable_spec_module5 = 46;
const int cpi_enable_spec_module6 = 47; const int cpi_enable_spec_module6 = 47;
const int cpi_enable_spec_module7 = 48; const int cpi_enable_spec_module7 = 48;
const int cpi_enable_spec_module8 = 49; const int cpi_enable_spec_module8 = 49;
const int cpi_octaves_extra1 = 50;
const int cpi_octaves_extra2 = 51;
const int cpi_octaves_ratio0 = 52;
const int cpi_octaves_ratio1 = 53;
const int cpi_octaves_ratio2 = 54;
const int cpi_octaves_ratio3 = 55;
const int cpi_octaves_ratio4 = 56;
const int cpi_octaves_ratio5 = 57;
const int cpi_octaves_ratio6 = 58;
const int cpi_octaves_ratio7 = 59;
class MyPropertiesFile class MyPropertiesFile
{ {