Remove the spectral module selection and move parameters. Initial attempt to implement the module enabled parameters. Might need to redesign this a bit...

This commit is contained in:
xenakios 2018-03-06 13:44:36 +02:00
parent 4f148a322d
commit 7fe4ea982e
5 changed files with 49 additions and 8 deletions

View File

@ -159,6 +159,35 @@ void StretchAudioSource::setMainVolume(double decibels)
} }
} }
void StretchAudioSource::setSpectralModulesEnabled(const std::array<AudioParameterBool*, 9>& params)
{
jassert(params.size() == m_specproc_order.size());
bool changed = false;
for (int i = 0; i < m_specproc_order.size(); ++i)
{
if (*params[i] != m_specproc_order[i].m_enabled)
{
changed = true;
break;
}
}
if (changed == false)
return;
if (m_cs.tryEnter())
{
for (int i = 0; i < m_specproc_order.size(); ++i)
{
m_specproc_order[i].m_enabled = *params[i];
}
for (int i = 0; i < m_stretchers.size(); ++i)
{
m_stretchers[i]->m_spectrum_processes = m_specproc_order;
}
++m_param_change_count;
m_cs.exit();
}
}
void StretchAudioSource::setLoopXFadeLength(double lenseconds) void StretchAudioSource::setLoopXFadeLength(double lenseconds)
{ {
if (lenseconds == m_loopxfadelen) if (lenseconds == m_loopxfadelen)

View File

@ -24,6 +24,7 @@ Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#include "Input/AInputS.h" #include "Input/AInputS.h"
#include "ProcessedStretch.h" #include "ProcessedStretch.h"
#include <mutex> #include <mutex>
#include <array>
#include "../WDL/resample.h" #include "../WDL/resample.h"
class StretchAudioSource final : public PositionableAudioSource class StretchAudioSource final : public PositionableAudioSource
@ -98,6 +99,7 @@ public:
void setAudioBufferAsInputSource(AudioBuffer<float>* buf, int sr, int len); void setAudioBufferAsInputSource(AudioBuffer<float>* buf, int sr, int len);
void setMainVolume(double decibels); void setMainVolume(double decibels);
double getMainVolume() const { return m_main_volume; } double getMainVolume() const { return m_main_volume; }
void setSpectralModulesEnabled(const std::array<AudioParameterBool*, 9>& params);
void setLoopXFadeLength(double lenseconds); void setLoopXFadeLength(double lenseconds);
double getLoopXFadeLengtj() const { return m_loopxfadelen; } double getLoopXFadeLengtj() const { return m_loopxfadelen; }
void setPreviewDry(bool b); void setPreviewDry(bool b);

View File

@ -354,9 +354,6 @@ void PaulstretchpluginAudioProcessorEditor::timerCallback(int id)
} }
if (id == 3) if (id == 3)
{ {
m_spec_order_ed.setModuleSelected(*processor.getIntParameter(cpi_select_spec_module));
m_spec_order_ed.moveModule(*processor.getIntParameter(cpi_select_spec_module), *
processor.getIntParameter(cpi_move_spec_module));
processor.m_free_filter_envelope->updateMinMaxValues(); processor.m_free_filter_envelope->updateMinMaxValues();
m_free_filter_component.repaint(); m_free_filter_component.repaint();
} }

View File

@ -157,8 +157,11 @@ PaulstretchpluginAudioProcessor::PaulstretchpluginAudioProcessor()
addParameter(new AudioParameterInt("freefilter_randomybands0", "Random bands", 2, 128, 16)); // 38 addParameter(new AudioParameterInt("freefilter_randomybands0", "Random bands", 2, 128, 16)); // 38
addParameter(new AudioParameterInt("freefilter_randomyrate0", "Random rate", 1, 32, 2)); // 39 addParameter(new AudioParameterInt("freefilter_randomyrate0", "Random rate", 1, 32, 2)); // 39
addParameter(new AudioParameterFloat("freefilter_randomyamount0", "Random amount", 0.0, 1.0, 0.0)); // 40 addParameter(new AudioParameterFloat("freefilter_randomyamount0", "Random amount", 0.0, 1.0, 0.0)); // 40
addParameter(new AudioParameterInt("select_specmodule0", "Select module", 0, 8, 1)); // 41 for (int i = 0; i < 9; ++i) // 41-49
addParameter(new AudioParameterInt("move_specmodule0", "Move module", 0, 8, 1)); // 42 {
m_sm_enab_pars[i] = new AudioParameterBool("enab_specmodule"+String(i), "Enable spectral module "+String(i+1), false);
addParameter(m_sm_enab_pars[i]);
}
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());
@ -647,6 +650,8 @@ void PaulstretchpluginAudioProcessor::processBlock (AudioSampleBuffer& buffer, M
m_free_filter_envelope->m_transform_y_random_rate = *getIntParameter(cpi_freefilter_randomy_rate); m_free_filter_envelope->m_transform_y_random_rate = *getIntParameter(cpi_freefilter_randomy_rate);
m_free_filter_envelope->m_transform_y_random_amount = *getFloatParameter(cpi_freefilter_randomy_amount); m_free_filter_envelope->m_transform_y_random_amount = *getFloatParameter(cpi_freefilter_randomy_amount);
m_stretch_source->setSpectralModulesEnabled(m_sm_enab_pars);
m_stretch_source->setMainVolume(*getFloatParameter(cpi_main_volume)); m_stretch_source->setMainVolume(*getFloatParameter(cpi_main_volume));
m_stretch_source->setRate(*getFloatParameter(cpi_stretchamount)); m_stretch_source->setRate(*getFloatParameter(cpi_stretchamount));
m_stretch_source->setPreviewDry(*getBoolParameter(cpi_bypass_stretch)); m_stretch_source->setPreviewDry(*getBoolParameter(cpi_bypass_stretch));

View File

@ -23,6 +23,7 @@ Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#include "../JuceLibraryCode/JuceHeader.h" #include "../JuceLibraryCode/JuceHeader.h"
#include "PS_Source/PaulStretchControl.h" #include "PS_Source/PaulStretchControl.h"
#include "jcdp_envelope.h" #include "jcdp_envelope.h"
#include <array>
class MyThumbCache; class MyThumbCache;
@ -67,8 +68,15 @@ const int cpi_freefilter_tilty = 37;
const int cpi_freefilter_randomy_numbands = 38; const int cpi_freefilter_randomy_numbands = 38;
const int cpi_freefilter_randomy_rate = 39; const int cpi_freefilter_randomy_rate = 39;
const int cpi_freefilter_randomy_amount = 40; const int cpi_freefilter_randomy_amount = 40;
const int cpi_select_spec_module = 41; const int cpi_enable_spec_module0 = 41;
const int cpi_move_spec_module = 42; const int cpi_enable_spec_module1 = 42;
const int cpi_enable_spec_module2 = 43;
const int cpi_enable_spec_module3 = 44;
const int cpi_enable_spec_module4 = 45;
const int cpi_enable_spec_module5 = 46;
const int cpi_enable_spec_module6 = 47;
const int cpi_enable_spec_module7 = 48;
const int cpi_enable_spec_module8 = 49;
class MyPropertiesFile class MyPropertiesFile
{ {
@ -222,7 +230,7 @@ private:
void setParameters(const std::vector<double>& pars); void setParameters(const std::vector<double>& pars);
float m_cur_playrangeoffset = 0.0; float m_cur_playrangeoffset = 0.0;
void updateStretchParametersFromPluginParameters(ProcessParameters& pars); void updateStretchParametersFromPluginParameters(ProcessParameters& pars);
std::array<AudioParameterBool*, 9> m_sm_enab_pars;
//============================================================================== //==============================================================================
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (PaulstretchpluginAudioProcessor) JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (PaulstretchpluginAudioProcessor)
}; };