aboutsummaryrefslogtreecommitdiff
path: root/externals/extra/pique
diff options
context:
space:
mode:
authorKatja <katjav@users.sourceforge.net>2011-11-16 23:02:45 +0000
committerKatja <katjav@users.sourceforge.net>2011-11-16 23:02:45 +0000
commita7b3adb88be72fed88bb89a495482691da58d496 (patch)
tree641944fc14ee9993c7bd105a8efddb9731b822d5 /externals/extra/pique
parent96e0cea2e3cf39a0ed3d92aa0b69e5acebb93c22 (diff)
'float' to 't_float' changes in externals/extra/
svn path=/trunk/; revision=15777
Diffstat (limited to 'externals/extra/pique')
-rw-r--r--externals/extra/pique/pique.c72
1 files changed, 36 insertions, 36 deletions
diff --git a/externals/extra/pique/pique.c b/externals/extra/pique/pique.c
index 19cee2ae..7c8b899b 100644
--- a/externals/extra/pique/pique.c
+++ b/externals/extra/pique/pique.c
@@ -19,11 +19,11 @@ typedef struct _pique
{
t_object x_obj;
int x_n;
- float x_errthresh;
- float *x_freq;
- float *x_amp;
- float *x_ampre;
- float *x_ampim;
+ t_float x_errthresh;
+ t_float *x_freq;
+ t_float *x_amp;
+ t_float *x_ampre;
+ t_float *x_ampim;
} t_pique;
static void *pique_new(t_floatarg f)
@@ -41,9 +41,9 @@ static void *pique_new(t_floatarg f)
return (x);
}
-static float hanning(float pidetune, float sinpidetune)
+static t_float hanning(t_float pidetune, t_float sinpidetune)
{
- float pi = 3.14159;
+ t_float pi = 3.141592653589793;
if (pidetune < 0.01 && pidetune > -0.01) return (1);
else if (pidetune > 3.14 && pidetune < 3.143) return (0.5);
else if (pidetune < -3.14 && pidetune > -3.143) return (0.5);
@@ -51,21 +51,21 @@ static float hanning(float pidetune, float sinpidetune)
(sinpidetune/(pidetune+pi) + sinpidetune/(pidetune-pi)));
}
-static float peakerror(t_word *fpreal, t_word *fpimag, float pidetune,
- float norm, float peakreal, float peakimag)
+static t_float peakerror(t_word *fpreal, t_word *fpimag, t_float pidetune,
+ t_float norm, t_float peakreal, t_float peakimag)
{
- float sinpidetune = sin(pidetune);
- float cospidetune = cos(pidetune);
- float windowshould = hanning(pidetune, sinpidetune);
- float realshould = windowshould * (
+ t_float sinpidetune = sin(pidetune);
+ t_float cospidetune = cos(pidetune);
+ t_float windowshould = hanning(pidetune, sinpidetune);
+ t_float realshould = windowshould * (
peakreal * cospidetune + peakimag * sinpidetune);
- float imagshould = windowshould * (
+ t_float imagshould = windowshould * (
peakimag * cospidetune - peakreal * sinpidetune);
- float realgot = norm * (fpreal[0].w_float -
+ t_float realgot = norm * (fpreal[0].w_float -
0.5 * (fpreal[1].w_float + fpreal[-1].w_float));
- float imaggot = norm * (fpimag[0].w_float -
+ t_float imaggot = norm * (fpimag[0].w_float -
0.5 * (fpimag[1].w_float + fpimag[-1].w_float));
- float realdev = realshould - realgot, imagdev = imagshould - imaggot;
+ t_float realdev = realshould - realgot, imagdev = imagshould - imaggot;
/* post("real %f->%f; imag %f->%f", realshould, realgot,
imagshould, imaggot); */
@@ -74,16 +74,16 @@ static float peakerror(t_word *fpreal, t_word *fpimag, float pidetune,
static void pique_doit(int npts, t_word *fpreal, t_word *fpimag,
int npeak, int *nfound, t_float *fpfreq, t_float *fpamp,
- t_float *fpampre, t_float *fpampim, float errthresh)
+ t_float *fpampre, t_float *fpampim, t_float errthresh)
{
- float srate = sys_getsr(); /* not sure how to get this correctly */
- float oneovern = 1.0/ (float)npts;
- float fperbin = srate * oneovern;
- float pow1, pow2 = 0, pow3 = 0, pow4 = 0, pow5 = 0;
- float re1, re2 = 0, re3 = fpreal->w_float;
- float im1, im2 = 0, im3 = 0, powthresh, relativeerror;
+ t_float srate = sys_getsr(); /* not sure how to get this correctly */
+ t_float oneovern = 1.0/ (t_float)npts;
+ t_float fperbin = srate * oneovern;
+ t_float pow1, pow2 = 0, pow3 = 0, pow4 = 0, pow5 = 0;
+ t_float re1, re2 = 0, re3 = fpreal->w_float;
+ t_float im1, im2 = 0, im3 = 0, powthresh, relativeerror;
int count, peakcount = 0, n2 = (npts >> 1);
- float *fp1, *fp2;
+ t_float *fp1, *fp2;
t_word *wp1, *wp2;
for (count = n2, wp1 = fpreal, wp2 = fpimag, powthresh = 0;
count--; wp1++, wp2++)
@@ -92,12 +92,12 @@ static void pique_doit(int npts, t_word *fpreal, t_word *fpimag,
powthresh *= 0.00001;
for (count = 1; count < n2; count++)
{
- float windreal, windimag, pi = 3.14159;
- float detune, pidetune, sinpidetune, cospidetune,
+ t_float windreal, windimag, pi = 3.141592653589793;
+ t_float detune, pidetune, sinpidetune, cospidetune,
ampcorrect, freqout, ampout, ampoutreal, ampoutimag;
- float rpeak, rpeaknext, rpeakprev;
- float ipeak, ipeaknext, ipeakprev;
- float errleft, errright;
+ t_float rpeak, rpeaknext, rpeakprev;
+ t_float ipeak, ipeaknext, ipeakprev;
+ t_float errleft, errright;
fpreal++;
fpimag++;
re1 = re2;
@@ -140,7 +140,7 @@ static void pique_doit(int npts, t_word *fpreal, t_word *fpimag,
/* if (count < 30) post("detune %f", detune); */
if (detune > 0.7 || detune < -0.7) continue;
/* the frequency is the sum of the bin frequency and detuning */
- freqout = fperbin * ((float)(count-3) + detune);
+ freqout = fperbin * ((t_float)(count-3) + detune);
pidetune = pi * detune;
sinpidetune = sin(pidetune);
cospidetune = cos(pidetune);
@@ -198,16 +198,16 @@ static void pique_list(t_pique *x, t_symbol *s, int argc, t_atom *argv)
else
{
int nfound, i;
- float *fpfreq = x->x_freq;
- float *fpamp = x->x_amp;
- float *fpampre = x->x_ampre;
- float *fpampim = x->x_ampim;
+ t_float *fpfreq = x->x_freq;
+ t_float *fpamp = x->x_amp;
+ t_float *fpampre = x->x_ampre;
+ t_float *fpampim = x->x_ampim;
pique_doit(npts, fpreal, fpimag, npeak,
&nfound, fpfreq, fpamp, fpampre, fpampim, x->x_errthresh);
for (i = 0; i < nfound; i++, fpamp++, fpfreq++, fpampre++, fpampim++)
{
t_atom at[5];
- SETFLOAT(at, (float)i);
+ SETFLOAT(at, (t_float)i);
SETFLOAT(at+1, *fpfreq);
SETFLOAT(at+2, *fpamp);
SETFLOAT(at+3, *fpampre);