Add more parameters including input capture enabled. A slightly nasty timer hack had to be implemented for that but can't be helped since the Juce provided bool parameter doesn't do callbacks...Small tweaks and fixes.

This commit is contained in:
xenakios
2017-12-13 18:30:09 +02:00
parent 3dc95b6f1d
commit bd1eabf3bf
5 changed files with 66 additions and 19 deletions

View File

@ -345,6 +345,12 @@ REALTYPE Stretch::process(REALTYPE *smps,int nsmps)
return onset;
};
void Stretch::set_onset_detection_sensitivity(REALTYPE detection_sensitivity)
{
onset_detection_sensitivity = detection_sensitivity;
if (detection_sensitivity<1e-3) extra_onset_time_credit = 0.0;
}
void Stretch::here_is_onset(REALTYPE onset){
if (freezing) return;
if (onset>0.5){

View File

@ -129,7 +129,7 @@ class FFT
void applywindow(FFTWindow type);
std::vector<REALTYPE> smp;//size of samples/2
std::vector<REALTYPE> freq;//size of samples
int nsamples;
int nsamples=0;
private:
fftwf_plan planfftw,planifftw;
@ -179,10 +179,7 @@ class Stretch
void set_rap(REALTYPE newrap);//set the current stretch value
void set_onset_detection_sensitivity(REALTYPE detection_sensitivity){
onset_detection_sensitivity=detection_sensitivity;
if (detection_sensitivity<1e-3) extra_onset_time_credit=0.0;
};
void set_onset_detection_sensitivity(REALTYPE detection_sensitivity);;
void here_is_onset(REALTYPE onset);
virtual void setSampleRate(REALTYPE sr) { samplerate = jlimit(1000.0f, 38400.0f, sr); }
REALTYPE getSampleRate() { return samplerate; }

View File

@ -498,12 +498,16 @@ void StretchAudioSource::setFFTWindowingType(int windowtype)
{
if (windowtype==m_fft_window_type)
return;
ScopedLock locker(m_cs);
m_fft_window_type = windowtype;
for (int i = 0; i < m_stretchers.size(); ++i)
{
m_stretchers[i]->window_type = (FFTWindow)windowtype;
}
if (m_cs.tryEnter())
{
m_fft_window_type = windowtype;
for (int i = 0; i < m_stretchers.size(); ++i)
{
m_stretchers[i]->window_type = (FFTWindow)windowtype;
}
++m_param_change_count;
m_cs.exit();
}
}
void StretchAudioSource::setFFTSize(int size)
@ -552,13 +556,18 @@ double StretchAudioSource::getOutputDurationSecondsForRange(Range<double> range,
void StretchAudioSource::setOnsetDetection(double x)
{
ScopedLock locker(m_cs);
m_onsetdetection = x;
for (int i = 0; i < m_stretchers.size(); ++i)
if (x == m_onsetdetection)
return;
if (m_cs.tryEnter())
{
m_stretchers[i]->set_onset_detection_sensitivity((float)x);
m_onsetdetection = x;
for (int i = 0; i < m_stretchers.size(); ++i)
{
m_stretchers[i]->set_onset_detection_sensitivity((float)x);
}
++m_param_change_count;
m_cs.exit();
}
++m_param_change_count;
}
void StretchAudioSource::setPlayRange(Range<double> playrange, bool isloop)