From 28f14ddf7ae8fe8298b54ec812501de284445932 Mon Sep 17 00:00:00 2001 From: xenakios Date: Wed, 9 May 2018 12:33:06 +0300 Subject: [PATCH] Add looping enabled parameter --- Source/PS_Source/StretchSource.cpp | 2 ++ Source/PluginEditor.cpp | 8 +++++--- Source/PluginProcessor.cpp | 5 +++++ Source/PluginProcessor.h | 2 +- 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/Source/PS_Source/StretchSource.cpp b/Source/PS_Source/StretchSource.cpp index 841aca6..e34c1dc 100644 --- a/Source/PS_Source/StretchSource.cpp +++ b/Source/PS_Source/StretchSource.cpp @@ -142,6 +142,8 @@ void StretchAudioSource::setLoopingEnabled(bool b) ScopedLock locker(m_cs); if (m_inputfile != nullptr) { + if (m_inputfile->isLooping() == false && b == true) + seekPercent(m_inputfile->getActiveRange().getStart()); m_inputfile->setLoopEnabled(b); } } diff --git a/Source/PluginEditor.cpp b/Source/PluginEditor.cpp index 1d7bed6..e0db0e4 100644 --- a/Source/PluginEditor.cpp +++ b/Source/PluginEditor.cpp @@ -83,9 +83,9 @@ PaulstretchpluginAudioProcessorEditor::PaulstretchpluginAudioProcessorEditor(Pau if (i == cpi_octavesm2 || i == cpi_octavesm1 || i == cpi_octaves0 || i == cpi_octaves1 || i == cpi_octaves15 || i == cpi_octaves2 || i==cpi_octaves_extra1 || i==cpi_octaves_extra2) group_id = -2; // -2 for not included in the main parameters page - if (i >= (int)cpi_octaves_ratio0 && i <= (int)cpi_octaves_ratio7) + if (i >= cpi_octaves_ratio0 && i <= cpi_octaves_ratio7) group_id = -2; - if (i >= (int)cpi_enable_spec_module0 && i <= (int)cpi_enable_spec_module8) + if ((i >= cpi_enable_spec_module0 && i <= cpi_enable_spec_module8)) group_id = -2; if (i == cpi_tonalvsnoisebw || i == cpi_tonalvsnoisepreserve) group_id = 1; @@ -276,7 +276,7 @@ void PaulstretchpluginAudioProcessorEditor::resized() int w = getWidth(); int xoffs = 1; yoffs = 30; - int div = w / 5; + int div = w / 6; //std::vector> layout; //layout.emplace_back(cpi_capture_enabled, cpi_passthrough, cpi_pause_enabled, cpi_freeze); //layout.emplace_back(cpi_main_volume, cpi_num_inchans, cpi_num_outchans); @@ -291,6 +291,8 @@ void PaulstretchpluginAudioProcessorEditor::resized() m_parcomps[cpi_freeze]->setBounds(xoffs, yoffs, div - 1, 24); xoffs += div; m_parcomps[cpi_bypass_stretch]->setBounds(xoffs, yoffs, div - 1, 24); + xoffs += div; + m_parcomps[cpi_looping_enabled]->setBounds(xoffs, yoffs, div - 1, 24); xoffs = 1; yoffs += 25; div = w / 3; diff --git a/Source/PluginProcessor.cpp b/Source/PluginProcessor.cpp index fab6764..61334d8 100644 --- a/Source/PluginProcessor.cpp +++ b/Source/PluginProcessor.cpp @@ -174,6 +174,8 @@ PaulstretchpluginAudioProcessor::PaulstretchpluginAudioProcessor() 1.0)); } + addParameter(new AudioParameterBool("loop_enabled0", "Loop", true)); // 60 + auto& pars = getParameters(); for (const auto& p : pars) m_reset_pars.push_back(p->getValue()); @@ -682,6 +684,9 @@ void PaulstretchpluginAudioProcessor::processBlock (AudioSampleBuffer& buffer, M //m_stretch_source->setSpectralModulesEnabled(m_sm_enab_pars); + if (m_stretch_source->isLoopEnabled() != *getBoolParameter(cpi_looping_enabled)) + m_stretch_source->setLoopingEnabled(*getBoolParameter(cpi_looping_enabled)); + m_stretch_source->setMainVolume(*getFloatParameter(cpi_main_volume)); m_stretch_source->setRate(*getFloatParameter(cpi_stretchamount)); m_stretch_source->setPreviewDry(*getBoolParameter(cpi_bypass_stretch)); diff --git a/Source/PluginProcessor.h b/Source/PluginProcessor.h index eec9874..e08e6d9 100644 --- a/Source/PluginProcessor.h +++ b/Source/PluginProcessor.h @@ -87,7 +87,7 @@ const int cpi_octaves_ratio4 = 56; const int cpi_octaves_ratio5 = 57; const int cpi_octaves_ratio6 = 58; const int cpi_octaves_ratio7 = 59; - +const int cpi_looping_enabled = 60; class MyPropertiesFile {