The spectral module enabled parameters still not doing so great...
This commit is contained in:
@ -104,23 +104,23 @@ void ProcessedStretch::process_spectrum(REALTYPE *freq)
|
||||
for (auto& e : m_spectrum_processes)
|
||||
{
|
||||
spectrum_copy(nfreq, freq, m_infreq.data());
|
||||
if (e.m_index == 0 && e.m_enabled == true)
|
||||
if (e.m_index == 0 && *e.m_enabled == true)
|
||||
spectrum_do_harmonics(pars, m_tmpfreq1, nfreq, samplerate, m_infreq.data(), freq);
|
||||
if (e.m_index == 1 && e.m_enabled == true)
|
||||
if (e.m_index == 1 && *e.m_enabled == true)
|
||||
spectrum_do_tonal_vs_noise(pars,nfreq,samplerate,m_tmpfreq1, m_infreq.data(), freq);
|
||||
if (e.m_index == 2 && e.m_enabled == true)
|
||||
if (e.m_index == 2 && *e.m_enabled == true)
|
||||
spectrum_do_freq_shift(pars,nfreq,samplerate,m_infreq.data(), freq);
|
||||
if (e.m_index == 3 && e.m_enabled == true)
|
||||
if (e.m_index == 3 && *e.m_enabled == true)
|
||||
spectrum_do_pitch_shift(pars,nfreq,m_infreq.data(), freq, pow(2.0f, pars.pitch_shift.cents / 1200.0f));
|
||||
if (e.m_index == 4 && e.m_enabled == true)
|
||||
if (e.m_index == 4 && *e.m_enabled == true)
|
||||
spectrum_do_octave(pars,nfreq,samplerate, m_sumfreq, m_tmpfreq1, m_infreq.data(), freq);
|
||||
if (e.m_index == 5 && e.m_enabled == true)
|
||||
if (e.m_index == 5 && *e.m_enabled == true)
|
||||
spectrum_spread(nfreq,samplerate,m_tmpfreq1,m_infreq.data(), freq, pars.spread.bandwidth);
|
||||
if (e.m_index == 6 && e.m_enabled == true)
|
||||
if (e.m_index == 6 && *e.m_enabled == true)
|
||||
spectrum_do_filter(pars,nfreq,samplerate,m_infreq.data(), freq);
|
||||
if (e.m_index == 7 && e.m_enabled == true)
|
||||
if (e.m_index == 7 && *e.m_enabled == true)
|
||||
spectrum_do_compressor(pars,nfreq, m_infreq.data(), freq);
|
||||
if (e.m_index == 8 && e.m_enabled == true)
|
||||
if (e.m_index == 8 && *e.m_enabled == true)
|
||||
spectrum_do_free_filter(m_free_filter_envelope, nfreq, samplerate, m_infreq.data(), freq);
|
||||
}
|
||||
};
|
||||
|
@ -438,9 +438,9 @@ class SpectrumProcess
|
||||
{
|
||||
public:
|
||||
SpectrumProcess() {}
|
||||
SpectrumProcess(int index, bool enabled) : m_index(index), m_enabled(enabled) {}
|
||||
SpectrumProcess(int index, AudioParameterBool* enabled) : m_index(index), m_enabled(enabled) {}
|
||||
int m_index = -1;
|
||||
bool m_enabled = true;
|
||||
AudioParameterBool* m_enabled = nullptr;
|
||||
};
|
||||
|
||||
class ProcessedStretch final : public Stretch
|
||||
|
@ -1,4 +1,5 @@
|
||||
#include "StretchSource.h"
|
||||
#include <set>
|
||||
|
||||
#ifdef WIN32
|
||||
#include <ppl.h>
|
||||
@ -7,12 +8,16 @@
|
||||
#undef max
|
||||
#endif
|
||||
|
||||
StretchAudioSource::StretchAudioSource(int initialnumoutchans, AudioFormatManager* afm) : m_afm(afm)
|
||||
StretchAudioSource::StretchAudioSource(int initialnumoutchans,
|
||||
AudioFormatManager* afm,
|
||||
std::array<AudioParameterBool*,9>& enab_pars) : m_afm(afm)
|
||||
{
|
||||
m_resampler = std::make_unique<WDL_Resampler>();
|
||||
m_resampler_outbuf.resize(1024*1024);
|
||||
m_inputfile = std::make_unique<AInputS>(m_afm);
|
||||
m_specproc_order = { {0,false} , { 1, false} ,{2,true},{3,true},{4,true},{5,false},{6,true},{7,true},{8,false} };
|
||||
for (int i = 0; i < enab_pars.size(); ++i)
|
||||
m_specproc_order.emplace_back(i, enab_pars[i]);
|
||||
//m_specproc_order = { {0,false} , { 1, false} ,{2,true},{3,true},{4,true},{5,false},{6,true},{7,true},{8,false} };
|
||||
setNumOutChannels(initialnumoutchans);
|
||||
m_xfadetask.buffer.setSize(8, 65536);
|
||||
m_xfadetask.buffer.clear();
|
||||
@ -162,10 +167,14 @@ void StretchAudioSource::setMainVolume(double decibels)
|
||||
void StretchAudioSource::setSpectralModulesEnabled(const std::array<AudioParameterBool*, 9>& params)
|
||||
{
|
||||
jassert(params.size() == m_specproc_order.size());
|
||||
std::set<AudioParameterBool*> foo;
|
||||
for (auto& e : params)
|
||||
foo.insert(e);
|
||||
jassert(foo.size() == params.size());
|
||||
bool changed = false;
|
||||
for (int i = 0; i < m_specproc_order.size(); ++i)
|
||||
{
|
||||
if (*params[i] != m_specproc_order[i].m_enabled)
|
||||
if (*params[i] != *m_specproc_order[i].m_enabled)
|
||||
{
|
||||
changed = true;
|
||||
break;
|
||||
@ -177,7 +186,7 @@ void StretchAudioSource::setSpectralModulesEnabled(const std::array<AudioParamet
|
||||
{
|
||||
for (int i = 0; i < m_specproc_order.size(); ++i)
|
||||
{
|
||||
m_specproc_order[i].m_enabled = *params[i];
|
||||
*m_specproc_order[i].m_enabled = (bool)(*params[i]);
|
||||
}
|
||||
for (int i = 0; i < m_stretchers.size(); ++i)
|
||||
{
|
||||
|
@ -31,7 +31,7 @@ class StretchAudioSource final : public PositionableAudioSource
|
||||
{
|
||||
public:
|
||||
StretchAudioSource() {}
|
||||
StretchAudioSource(int initialnumoutchans, AudioFormatManager* afm);
|
||||
StretchAudioSource(int initialnumoutchans, AudioFormatManager* afm, std::array<AudioParameterBool*, 9>& enab_pars);
|
||||
~StretchAudioSource();
|
||||
// Inherited via PositionableAudioSource
|
||||
void prepareToPlay(int samplesPerBlockExpected, double sampleRate) override;
|
||||
|
Reference in New Issue
Block a user