@@ -78,6 +78,10 @@ void StretchAudioSource::setSpectrumProcessOrder(std::vector<SpectrumProcess> or | |||||
for (int i = 0; i < order.size(); ++i) | for (int i = 0; i < order.size(); ++i) | ||||
m_specprocmap[i] = order[i].m_index; | m_specprocmap[i] = order[i].m_index; | ||||
m_specproc_order = order; | m_specproc_order = order; | ||||
Logger::writeToLog("<**"); | |||||
for (auto& e : m_specproc_order) | |||||
Logger::writeToLog(e.m_enabled->name + " " + String(e.m_index)); | |||||
Logger::writeToLog("**>"); | |||||
for (int i = 0; i < m_stretchers.size(); ++i) | for (int i = 0; i < m_stretchers.size(); ++i) | ||||
{ | { | ||||
m_stretchers[i]->m_spectrum_processes = order; | m_stretchers[i]->m_spectrum_processes = order; | ||||
@@ -170,6 +174,7 @@ void StretchAudioSource::setMainVolume(double decibels) | |||||
} | } | ||||
} | } | ||||
#ifdef OLDMODULE_ENAB | |||||
void StretchAudioSource::setSpectralModulesEnabled(const std::array<AudioParameterBool*, 9>& params) | void StretchAudioSource::setSpectralModulesEnabled(const std::array<AudioParameterBool*, 9>& params) | ||||
{ | { | ||||
jassert(m_specprocmap.size() > 0); | jassert(m_specprocmap.size() > 0); | ||||
@@ -202,7 +207,17 @@ void StretchAudioSource::setSpectralModulesEnabled(const std::array<AudioParamet | |||||
m_cs.exit(); | m_cs.exit(); | ||||
} | } | ||||
} | } | ||||
#endif | |||||
void StretchAudioSource::setSpectralModuleEnabled(int index, bool b) | |||||
{ | |||||
Logger::writeToLog(String(index)); | |||||
ScopedLock locker(m_cs); | |||||
for (int i = 0; i < m_stretchers.size(); ++i) | |||||
{ | |||||
m_stretchers[i]->m_spectrum_processes = m_specproc_order; | |||||
} | |||||
++m_param_change_count; | |||||
} | |||||
void StretchAudioSource::setLoopXFadeLength(double lenseconds) | void StretchAudioSource::setLoopXFadeLength(double lenseconds) | ||||
{ | { | ||||
if (lenseconds == m_loopxfadelen) | if (lenseconds == m_loopxfadelen) | ||||
@@ -99,7 +99,8 @@ 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 setSpectralModulesEnabled(const std::array<AudioParameterBool*, 9>& params); | |||||
void setSpectralModuleEnabled(int index, bool b); | |||||
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); | ||||
@@ -995,7 +995,17 @@ void SpectralChainEditor::mouseDown(const MouseEvent & ev) | |||||
juce::Rectangle<int> r(box_w*m_cur_index, 1, 12, 12); | juce::Rectangle<int> r(box_w*m_cur_index, 1, 12, 12); | ||||
if (r.contains(ev.x, ev.y)) | if (r.contains(ev.x, ev.y)) | ||||
{ | { | ||||
for (int i = 0; i < m_order.size(); ++i) | |||||
{ | |||||
if (m_order[i].m_index == m_cur_index) | |||||
{ | |||||
//Logger::writeToLog("SpectralChainEditor::mouseDown "+m_order[i].m_enabled->name); | |||||
//return; | |||||
} | |||||
} | |||||
toggleBool(m_order[m_cur_index].m_enabled); | toggleBool(m_order[m_cur_index].m_enabled); | ||||
Logger::writeToLog("SpectralChainEditor::mouseDown " + m_order[m_cur_index].m_enabled->name); | |||||
//m_src->setSpectrumProcessOrder(m_order); | //m_src->setSpectrumProcessOrder(m_order); | ||||
//if (ModuleOrderOrEnabledChangedCallback) | //if (ModuleOrderOrEnabledChangedCallback) | ||||
// ModuleOrderOrEnabledChangedCallback(); | // ModuleOrderOrEnabledChangedCallback(); | ||||
@@ -89,6 +89,7 @@ PaulstretchpluginAudioProcessor::PaulstretchpluginAudioProcessor() | |||||
m_sm_enab_pars[6] = new AudioParameterBool("enab_specmodule6", "Enable filter", true); | m_sm_enab_pars[6] = new AudioParameterBool("enab_specmodule6", "Enable filter", true); | ||||
m_sm_enab_pars[7] = new AudioParameterBool("enab_specmodule7", "Enable free filter", true); | m_sm_enab_pars[7] = new AudioParameterBool("enab_specmodule7", "Enable free filter", true); | ||||
m_sm_enab_pars[8] = new AudioParameterBool("enab_specmodule8", "Enable compressor", false); | m_sm_enab_pars[8] = new AudioParameterBool("enab_specmodule8", "Enable compressor", false); | ||||
m_stretch_source = std::make_unique<StretchAudioSource>(2, m_afm,m_sm_enab_pars); | m_stretch_source = std::make_unique<StretchAudioSource>(2, m_afm,m_sm_enab_pars); | ||||
@@ -157,6 +158,7 @@ PaulstretchpluginAudioProcessor::PaulstretchpluginAudioProcessor() | |||||
for (int i = 0; i < 9; ++i) // 41-49 | for (int i = 0; i < 9; ++i) // 41-49 | ||||
{ | { | ||||
addParameter(m_sm_enab_pars[i]); | addParameter(m_sm_enab_pars[i]); | ||||
m_sm_enab_pars[i]->addListener(this); | |||||
} | } | ||||
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_extra0_0", "Ratio mix 7 level", 0.0f, 1.0f, 0.0f, 0.001, 1.0)); // 50 | ||||
@@ -362,6 +364,18 @@ void PaulstretchpluginAudioProcessor::changeProgramName (int index, const String | |||||
{ | { | ||||
} | } | ||||
void PaulstretchpluginAudioProcessor::parameterValueChanged(int parameterIndex, float newValue) | |||||
{ | |||||
if (parameterIndex >= cpi_enable_spec_module0 && parameterIndex <= cpi_enable_spec_module8) | |||||
{ | |||||
m_stretch_source->setSpectralModuleEnabled(parameterIndex - cpi_enable_spec_module0, newValue >= 0.5); | |||||
} | |||||
} | |||||
void PaulstretchpluginAudioProcessor::parameterGestureChanged(int parameterIndex, bool gestureIsStarting) | |||||
{ | |||||
} | |||||
void PaulstretchpluginAudioProcessor::setFFTSize(double size) | void PaulstretchpluginAudioProcessor::setFFTSize(double size) | ||||
{ | { | ||||
if (m_prebuffer_amount == 5) | if (m_prebuffer_amount == 5) | ||||
@@ -663,7 +677,7 @@ 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->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)); | ||||
@@ -115,7 +115,7 @@ public: | |||||
class PaulstretchpluginAudioProcessorEditor; | class PaulstretchpluginAudioProcessorEditor; | ||||
class PaulstretchpluginAudioProcessor : public AudioProcessor, | class PaulstretchpluginAudioProcessor : public AudioProcessor, | ||||
public MultiTimer, public VSTCallbackHandler | |||||
public MultiTimer, public VSTCallbackHandler, public AudioProcessorParameter::Listener | |||||
{ | { | ||||
public: | public: | ||||
using EditorType = PaulstretchpluginAudioProcessorEditor; | using EditorType = PaulstretchpluginAudioProcessorEditor; | ||||
@@ -152,6 +152,9 @@ public: | |||||
const String getProgramName (int index) override; | const String getProgramName (int index) override; | ||||
void changeProgramName (int index, const String& newName) override; | void changeProgramName (int index, const String& newName) override; | ||||
void parameterValueChanged(int parameterIndex, float newValue) override; | |||||
void parameterGestureChanged(int parameterIndex, bool gestureIsStarting) override; | |||||
//============================================================================== | //============================================================================== | ||||
void getStateInformation (MemoryBlock& destData) override; | void getStateInformation (MemoryBlock& destData) override; | ||||
void setStateInformation (const void* data, int sizeInBytes) override; | void setStateInformation (const void* data, int sizeInBytes) override; | ||||