|
|
@@ -38,8 +38,7 @@ FFT::FFT(int nsamples_, bool no_inverse) |
|
|
|
window.data[i]=0.707f; |
|
|
|
window.type=W_RECTANGULAR; |
|
|
|
|
|
|
|
phases.resize(nsamples); |
|
|
|
data.resize(nsamples,true); |
|
|
|
data.resize(nsamples,true); |
|
|
|
bool allow_long_planning = false; // g_propsfile->getBoolValue("fftw_allow_long_planning", false); |
|
|
|
//double t0 = Time::getMillisecondCounterHiRes(); |
|
|
|
if (allow_long_planning) |
|
|
@@ -92,15 +91,9 @@ void FFT::smp2freq() |
|
|
|
void FFT::freq2smp() |
|
|
|
{ |
|
|
|
REALTYPE inv_2p15_2pi=1.0f/16384.0f*(float)c_PI; |
|
|
|
if (m_phaserefreshcounter % m_phaserefreshrate == 0) |
|
|
|
{ |
|
|
|
updatePhases(); |
|
|
|
//Logger::writeToLog("phases updated "+String(m_phaserefreshrate)); |
|
|
|
} |
|
|
|
++m_phaserefreshcounter; |
|
|
|
for (int i=1;i<nsamples/2;i++) |
|
|
|
{ |
|
|
|
unsigned int rand = phases[i]; // m_randdist(m_randgen); |
|
|
|
unsigned int rand = m_randdist(m_randgen); |
|
|
|
REALTYPE phase=rand*inv_2p15_2pi; |
|
|
|
data[i]=freq[i]*cos(phase); |
|
|
|
data[nsamples-i]=freq[i]*sin(phase); |
|
|
@@ -139,23 +132,6 @@ void FFT::applywindow(FFTWindow type) |
|
|
|
for (int i=0;i<nsamples;i++) smp[i]*=window.data[i]; |
|
|
|
} |
|
|
|
|
|
|
|
void FFT::setPhaseRefreshRate(int rate) |
|
|
|
{ |
|
|
|
m_phaserefreshrate = rate; |
|
|
|
} |
|
|
|
|
|
|
|
void FFT::updatePhases() |
|
|
|
{ |
|
|
|
for (int i = 1; i < nsamples / 2; i++) |
|
|
|
{ |
|
|
|
phases[i] = m_randdist(m_randgen); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/*******************************************/ |
|
|
|
|
|
|
|
|
|
|
|
Stretch::Stretch(REALTYPE rap_,int /*bufsize_*/,FFTWindow w,bool bypass_,REALTYPE samplerate_,int /*stereo_mode_*/) |
|
|
|
{ |
|
|
|
freezing=false; |
|
|
@@ -381,12 +357,6 @@ void Stretch::here_is_onset(REALTYPE onset){ |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
void Stretch::setPhaseRefreshRate(int rate) |
|
|
|
{ |
|
|
|
jassert(fft != nullptr); |
|
|
|
fft->setPhaseRefreshRate(rate); |
|
|
|
} |
|
|
|
|
|
|
|
int Stretch::get_nsamples(REALTYPE current_pos_percents){ |
|
|
|
if (bypass) return bufsize; |
|
|
|
if (freezing) return 0; |
|
|
|