diff --git a/Stretch.cpp b/Stretch.cpp index 3eb9fb3..2bbe68a 100644 --- a/Stretch.cpp +++ b/Stretch.cpp @@ -217,8 +217,6 @@ void Stretch::do_next_inbuf_smps(REALTYPE *smps){ void Stretch::process(REALTYPE *smps,int nsmps){ if (bypass){ for (int i=0;ifreq[i]=infft->freq[i]*remained_samples+old_freq[i]*(1.0-remained_samples); - }; - - +//#warning sa fac output spectrum ca la versiunea veche prin reanaliza a bufferului very_old_smps,old_smps,new_smps //move the buffers if (nsmps!=0){//new data arrived: update the frequency components do_next_inbuf_smps(smps); @@ -247,6 +239,21 @@ void Stretch::process(REALTYPE *smps,int nsmps){ do_next_inbuf_smps(smps+bufsize); }; }; + + //construct the input fft + int start_pos=(int)(floor(remained_samples*bufsize)); + if (start_pos>=bufsize) start_pos=bufsize-1; + for (int i=0;ismp[i]=very_old_smps[i+start_pos]; + for (int i=0;ismp[i+bufsize-start_pos]=old_smps[i]; + for (int i=0;ismp[i+2*bufsize-start_pos]=new_smps[i]; + //compute the output spectrum + fft->applywindow(window_type); + fft->smp2freq(); + for (int i=0;ifreq[i]=fft->freq[i]; + + // for (int i=0;ifreq[i]=infft->freq[i]*remained_samples+old_freq[i]*(1.0-remained_samples); + + process_spectrum(outfft->freq); outfft->freq2smp();