From: Paul Brossier Date: Sat, 3 Nov 2007 15:59:04 +0000 (+0100) Subject: src/phasevoc.c: remove tabs, reindent X-Git-Tag: bzr2git~484 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=685412ed619e8952dc4501fb94a1b33b1272c194;p=aubio.git src/phasevoc.c: remove tabs, reindent --- diff --git a/src/phasevoc.c b/src/phasevoc.c index c4cfc2ea..60d58e87 100644 --- a/src/phasevoc.c +++ b/src/phasevoc.c @@ -25,140 +25,125 @@ /** phasevocoder internal object */ struct _aubio_pvoc_t { - /** grain length */ - uint_t win_s; - /** overlap step */ - uint_t hop_s; - /** number of channels */ - uint_t channels; - /** spectral data */ - aubio_mfft_t * fft; - /**cur output grain [win_s] */ - fvec_t * synth; - /**last input frame [win_s-hop_s] */ - fvec_t * synthold; - /**current input grain [win_s] */ - fvec_t * data; - /**last input frame [win_s-hop_s] */ - fvec_t * dataold; - /** grain window [win_s] */ - float * w; + uint_t win_s; /** grain length */ + uint_t hop_s; /** overlap step */ + uint_t channels; /** number of channels */ + aubio_mfft_t * fft; /** spectral data */ + fvec_t * synth; /**cur output grain [win_s] */ + fvec_t * synthold; /**last input frame [win_s-hop_s] */ + fvec_t * data; /**current input grain [win_s] */ + fvec_t * dataold; /**last input frame [win_s-hop_s] */ + float * w; /** grain window [win_s] */ }; /** returns data and dataold slided by hop_s */ -static void aubio_pvoc_swapbuffers( - smpl_t * data, - smpl_t * dataold, - const smpl_t * datanew, - uint_t win_s, uint_t hop_s); -/** do additive synthesis from 'old' and 'cur' */ -static void aubio_pvoc_addsynth( - const smpl_t * synth, - smpl_t * synthold, - smpl_t * synthnew, - uint_t win_s, uint_t hop_s); +static void aubio_pvoc_swapbuffers(smpl_t * data, smpl_t * dataold, const + smpl_t * datanew, uint_t win_s, uint_t hop_s); +/** do additive synthesis from 'old' and 'cur' */ +static void aubio_pvoc_addsynth(const smpl_t * synth, smpl_t * synthold, + smpl_t * synthnew, uint_t win_s, uint_t hop_s); void aubio_pvoc_do(aubio_pvoc_t *pv, fvec_t * datanew, cvec_t *fftgrain) { - uint_t i,j; - for (i=0; ichannels; i++) { - /* slide */ - aubio_pvoc_swapbuffers(pv->data->data[i],pv->dataold->data[i], - datanew->data[i],pv->win_s,pv->hop_s); - /* windowing */ - for (j=0; jwin_s; j++) pv->data->data[i][j] *= pv->w[j]; - } - /* shift */ - vec_shift(pv->data); - /* calculate fft */ - aubio_mfft_do (pv->fft,pv->data,fftgrain); + uint_t i,j; + for (i=0; ichannels; i++) { + /* slide */ + aubio_pvoc_swapbuffers(pv->data->data[i],pv->dataold->data[i], + datanew->data[i],pv->win_s,pv->hop_s); + /* windowing */ + for (j=0; jwin_s; j++) pv->data->data[i][j] *= pv->w[j]; + } + /* shift */ + vec_shift(pv->data); + /* calculate fft */ + aubio_mfft_do (pv->fft,pv->data,fftgrain); } void aubio_pvoc_rdo(aubio_pvoc_t *pv,cvec_t * fftgrain, fvec_t * synthnew) { - uint_t i; - /* calculate rfft */ - aubio_mfft_rdo(pv->fft,fftgrain,pv->synth); - /* unshift */ - vec_shift(pv->synth); - for (i=0; ichannels; i++) { - aubio_pvoc_addsynth(pv->synth->data[i],pv->synthold->data[i], - synthnew->data[i],pv->win_s,pv->hop_s); - } + uint_t i; + /* calculate rfft */ + aubio_mfft_rdo(pv->fft,fftgrain,pv->synth); + /* unshift */ + vec_shift(pv->synth); + for (i=0; ichannels; i++) { + aubio_pvoc_addsynth(pv->synth->data[i],pv->synthold->data[i], + synthnew->data[i],pv->win_s,pv->hop_s); + } } aubio_pvoc_t * new_aubio_pvoc (uint_t win_s, uint_t hop_s, uint_t channels) { - aubio_pvoc_t * pv = AUBIO_NEW(aubio_pvoc_t); - - if (win_s < 2*hop_s) { - AUBIO_ERR("Hop size bigger than half the window size!\n"); - AUBIO_ERR("Resetting hop size to half the window size.\n"); - hop_s = win_s / 2; - } - - if (hop_s < 1) { - AUBIO_ERR("Hop size is smaller than 1!\n"); - AUBIO_ERR("Resetting hop size to half the window size.\n"); - hop_s = win_s / 2; - } - - pv->fft = new_aubio_mfft(win_s,channels); - - /* remember old */ - pv->data = new_fvec (win_s, channels); - pv->synth = new_fvec (win_s, channels); - - /* new input output */ - pv->dataold = new_fvec (win_s-hop_s, channels); - pv->synthold = new_fvec (win_s-hop_s, channels); - pv->w = AUBIO_ARRAY(smpl_t,win_s); - aubio_window(pv->w,win_s,aubio_win_hanningz); - - pv->channels = channels; - pv->hop_s = hop_s; - pv->win_s = win_s; - - return pv; + aubio_pvoc_t * pv = AUBIO_NEW(aubio_pvoc_t); + + if (win_s < 2*hop_s) { + AUBIO_ERR("Hop size bigger than half the window size!\n"); + AUBIO_ERR("Resetting hop size to half the window size.\n"); + hop_s = win_s / 2; + } + + if (hop_s < 1) { + AUBIO_ERR("Hop size is smaller than 1!\n"); + AUBIO_ERR("Resetting hop size to half the window size.\n"); + hop_s = win_s / 2; + } + + pv->fft = new_aubio_mfft(win_s,channels); + + /* remember old */ + pv->data = new_fvec (win_s, channels); + pv->synth = new_fvec (win_s, channels); + + /* new input output */ + pv->dataold = new_fvec (win_s-hop_s, channels); + pv->synthold = new_fvec (win_s-hop_s, channels); + pv->w = AUBIO_ARRAY(smpl_t,win_s); + aubio_window(pv->w,win_s,aubio_win_hanningz); + + pv->channels = channels; + pv->hop_s = hop_s; + pv->win_s = win_s; + + return pv; } void del_aubio_pvoc(aubio_pvoc_t *pv) { - del_fvec(pv->data); - del_fvec(pv->synth); - del_fvec(pv->dataold); - del_fvec(pv->synthold); - del_aubio_mfft(pv->fft); - AUBIO_FREE(pv->w); - AUBIO_FREE(pv); + del_fvec(pv->data); + del_fvec(pv->synth); + del_fvec(pv->dataold); + del_fvec(pv->synthold); + del_aubio_mfft(pv->fft); + AUBIO_FREE(pv->w); + AUBIO_FREE(pv); } static void aubio_pvoc_swapbuffers(smpl_t * data, smpl_t * dataold, - const smpl_t * datanew, uint_t win_s, uint_t hop_s) + const smpl_t * datanew, uint_t win_s, uint_t hop_s) { - uint_t i; - for (i=0;i