Initial work to allow having some spectral module order presets

This commit is contained in:
xenakios 2018-11-11 14:46:25 +02:00
parent 605852d853
commit 93cebcdcd2
2 changed files with 20 additions and 0 deletions

View File

@ -26,6 +26,12 @@ www.gnu.org/licenses
#undef max
#endif
std::vector<SpectrumProcessType> g_specorderpresets[3] = {
{SPT_Harmonics,SPT_PitchShift,SPT_FreqShift,SPT_Spread,SPT_TonalVsNoise,SPT_Filter,SPT_FreeFilter,SPT_RatioMix,SPT_Compressor},
{SPT_PitchShift,SPT_Harmonics,SPT_FreqShift,SPT_Spread,SPT_TonalVsNoise,SPT_Filter,SPT_FreeFilter,SPT_RatioMix,SPT_Compressor},
{SPT_RatioMix,SPT_PitchShift,SPT_Harmonics,SPT_FreqShift,SPT_Spread,SPT_TonalVsNoise,SPT_Filter,SPT_FreeFilter,SPT_Compressor}
};
StretchAudioSource::StretchAudioSource(int initialnumoutchans,
AudioFormatManager* afm,
std::array<AudioParameterBool*,9>& enab_pars) : m_afm(afm)
@ -259,6 +265,18 @@ double StretchAudioSource::getDryPlayrate() const
return m_dryplayrate;
}
void StretchAudioSource::setSpectralOrderPreset(int id)
{
if (id == m_current_spec_order_preset)
return;
if (m_cs.tryEnter())
{
m_current_spec_order_preset = id;
++m_param_change_count;
m_cs.exit();
}
}
void StretchAudioSource::getNextAudioBlock(const AudioSourceChannelInfo & bufferToFill)
{
ScopedLock locker(m_cs);

View File

@ -113,6 +113,7 @@ public:
CriticalSection* getMutex() { return &m_cs; }
int64_t getLastSourcePosition() const { return m_last_filepos; }
int m_prebuffersize = 0;
void setSpectralOrderPreset(int id);
private:
CircularBuffer<float> m_stretchoutringbuf{ 1024 * 1024 };
AudioBuffer<float> m_file_inbuf;
@ -173,4 +174,5 @@ private:
AudioBuffer<float> m_drypreviewbuf;
int64_t m_last_filepos = 0;
void playDrySound(const AudioSourceChannelInfo & bufferToFill);
int m_current_spec_order_preset = -1;
};