Revision: 10708 http://pure-data.svn.sourceforge.net/pure-data/?rev=10708&view=rev Author: tmusil Date: 2009-02-01 07:30:18 +0000 (Sun, 01 Feb 2009)
Log Message: ----------- changed for 64 bit array access
Modified Paths: -------------- trunk/externals/iem/iem_bin_ambi/src/bin_ambi_calc_HRTF.c trunk/externals/iem/iem_bin_ambi/src/bin_ambi_reduced_decode.c trunk/externals/iem/iem_bin_ambi/src/bin_ambi_reduced_decode2.c trunk/externals/iem/iem_bin_ambi/src/bin_ambi_reduced_decode_fft.c trunk/externals/iem/iem_bin_ambi/src/bin_ambi_reduced_decode_fft2.c trunk/externals/iem/iem_bin_ambi/src/bin_ambi_reduced_decode_fir.c trunk/externals/iem/iem_bin_ambi/src/bin_ambi_reduced_decode_fir2.c trunk/externals/iem/iem_bin_ambi/src/iem_bin_ambi.c trunk/externals/iem/iem_bin_ambi/src/iem_bin_ambi.h trunk/externals/iem/iem_bin_ambi/src/iemlib.h
Modified: trunk/externals/iem/iem_bin_ambi/src/bin_ambi_calc_HRTF.c =================================================================== --- trunk/externals/iem/iem_bin_ambi/src/bin_ambi_calc_HRTF.c 2009-02-01 07:29:03 UTC (rev 10707) +++ trunk/externals/iem/iem_bin_ambi/src/bin_ambi_calc_HRTF.c 2009-02-01 07:30:18 UTC (rev 10708) @@ -1,7 +1,7 @@ /* For information on usage and redistribution, and for a DISCLAIMER OF ALL * WARRANTIES, see the file, "LICENSE.txt," in this distribution.
-iem_bin_ambi written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2006 */ +iem_bin_ambi written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2009 */
#include "m_pd.h" #include "iemlib.h" @@ -38,7 +38,7 @@ BIN_AMBI_COMPLEX *x_spec; BIN_AMBI_COMPLEX *x_sin_cos; iemarray_t *x_beg_fade_out_hrir; - float *x_beg_hrir; + t_float *x_beg_hrir; iemarray_t **x_beg_hrtf_re; iemarray_t **x_beg_hrtf_im; t_symbol **x_hrir_filename; @@ -54,13 +54,13 @@ static void bin_ambi_calc_HRTF_init_cos(t_bin_ambi_calc_HRTF *x) { int i, fftsize = x->x_fftsize; - float f, g; + t_float f, g; BIN_AMBI_COMPLEX *sincos = x->x_sin_cos;
- g = 2.0f * 3.1415926538f / (float)fftsize; + g = 2.0f * 3.1415926538f / (t_float)fftsize; for(i=0; i<fftsize; i++) { - f = g * (float)i; + f = g * (t_float)i; (*sincos).real = cos(f); (*sincos).imag = -sin(f);/*FFT*/ sincos++; @@ -248,7 +248,7 @@ n_ambi rows; */
-static void bin_ambi_calc_HRTF_load_HRIR(t_bin_ambi_calc_HRTF *x, float findex) +static void bin_ambi_calc_HRTF_load_HRIR(t_bin_ambi_calc_HRTF *x, t_float findex) { int index=(int)findex - 1; int p; @@ -277,7 +277,7 @@ outlet_list(x->x_obj.ob_outlet, &s_list, 2, x->x_at); }
-static void bin_ambi_calc_HRTF_check_arrays(t_bin_ambi_calc_HRTF *x, float findex) +static void bin_ambi_calc_HRTF_check_arrays(t_bin_ambi_calc_HRTF *x, t_float findex) { int index=(int)findex - 1; int j, k, n; @@ -289,7 +289,7 @@ iemarray_t *vec_fade_out_hrir; iemarray_t *vec_hrir, *vec_hrtf_re, *vec_hrtf_im; t_symbol *hrir, *hrtf_re, *hrtf_im; - float decr, sum; + t_float decr, sum;
if(index < 0) index = 0; @@ -342,7 +342,7 @@ for(j=0; j<n; j++) vec[j] = iemarray_getfloat(vec_hrir,j); sum = 1.0f; - decr = 4.0f / (float)fs2; + decr = 4.0f / (t_float)fs2; for(j=n, k=0; j<fs2; j++, k++) { sum -= decr; @@ -352,7 +352,7 @@ } }
-static void bin_ambi_calc_HRTF_calc_fft(t_bin_ambi_calc_HRTF *x, float findex) +static void bin_ambi_calc_HRTF_calc_fft(t_bin_ambi_calc_HRTF *x, t_float findex) { int index=(int)findex - 1; int i, j, k, w_index, w_inc, i_inc, v_index, fs1, fs2; @@ -425,16 +425,14 @@ val[i] = old1; } } - - iemarray_getfloat(vec_hrtf_re,0) = val[0].real; - iemarray_getfloat(vec_hrtf_im,0) = 0.0f; - for( i = 1; i < fs2; i++ ) - { - iemarray_getfloat(vec_hrtf_re,i) = 2.0f*val[i].real; - iemarray_getfloat(vec_hrtf_im,i) = 2.0f*val[i].imag; - } - iemarray_getfloat(vec_hrtf_re,fs2) = 0.0f; - iemarray_getfloat(vec_hrtf_im,fs2) = 0.0f; + iemarray_setfloat(vec_hrtf_re, 0, val[0].real); + for(i = 1; i<fs2; i++) + { + iemarray_setfloat(vec_hrtf_re, i, 2.0f*val[i].real); + iemarray_setfloat(vec_hrtf_im, i, 2.0f*val[i].imag); + } + iemarray_setfloat(vec_hrtf_re, fs2, val[fs2].real); + iemarray_setfloat(vec_hrtf_im, fs2, 0.0f); }
static void bin_ambi_calc_HRTF_free(t_bin_ambi_calc_HRTF *x) @@ -450,9 +448,9 @@ freebytes(x->x_spec, x->x_fftsize * sizeof(BIN_AMBI_COMPLEX)); freebytes(x->x_sin_cos, x->x_fftsize * sizeof(BIN_AMBI_COMPLEX));
- freebytes(x->x_beg_hrir, x->x_fftsize * x->x_n_ls * sizeof(float)); - freebytes(x->x_beg_hrtf_re, x->x_n_ls * sizeof(float *)); - freebytes(x->x_beg_hrtf_im, x->x_n_ls * sizeof(float *)); + freebytes(x->x_beg_hrir, x->x_fftsize * x->x_n_ls * sizeof(t_float)); + freebytes(x->x_beg_hrtf_re, x->x_n_ls * sizeof(t_float *)); + freebytes(x->x_beg_hrtf_im, x->x_n_ls * sizeof(t_float *)); }
/* @@ -540,7 +538,7 @@ x->x_sin_cos = (BIN_AMBI_COMPLEX *)getbytes(x->x_fftsize * sizeof(BIN_AMBI_COMPLEX));
x->x_beg_fade_out_hrir = 0; - x->x_beg_hrir = (float *)getbytes(x->x_fftsize * x->x_n_ls * sizeof(float)); + x->x_beg_hrir = (t_float *)getbytes(x->x_fftsize * x->x_n_ls * sizeof(t_float)); x->x_beg_hrtf_re = (iemarray_t **)getbytes(x->x_n_ls * sizeof(iemarray_t *)); x->x_beg_hrtf_im = (iemarray_t **)getbytes(x->x_n_ls * sizeof(iemarray_t *));
Modified: trunk/externals/iem/iem_bin_ambi/src/bin_ambi_reduced_decode.c =================================================================== --- trunk/externals/iem/iem_bin_ambi/src/bin_ambi_reduced_decode.c 2009-02-01 07:29:03 UTC (rev 10707) +++ trunk/externals/iem/iem_bin_ambi/src/bin_ambi_reduced_decode.c 2009-02-01 07:30:18 UTC (rev 10708) @@ -1,7 +1,7 @@ /* For information on usage and redistribution, and for a DISCLAIMER OF ALL * WARRANTIES, see the file, "LICENSE.txt," in this distribution.
-iem_bin_ambi written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2006 */ +iem_bin_ambi written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2009 */
#include "m_pd.h" #include "iemlib.h" @@ -46,7 +46,7 @@ BIN_AMBI_COMPLEX *x_spec; BIN_AMBI_COMPLEX *x_sin_cos; iemarray_t *x_beg_fade_out_hrir; - float *x_beg_hrir; + t_float *x_beg_hrir; iemarray_t **x_beg_hrtf_re; iemarray_t **x_beg_hrtf_im; t_symbol **x_hrir_filename; @@ -74,20 +74,20 @@ static void bin_ambi_reduced_decode_init_cos(t_bin_ambi_reduced_decode *x) { int i, fftsize = x->x_fftsize; - float f, g; + t_float f, g; BIN_AMBI_COMPLEX *sincos = x->x_sin_cos;
- g = 2.0f * 3.1415926538f / (float)fftsize; + g = 2.0f * 3.1415926538f / (t_float)fftsize; for(i=0; i<fftsize; i++) { - f = g * (float)i; + f = g * (t_float)i; (*sincos).real = cos(f); (*sincos).imag = -sin(f);/*FFT*/ sincos++; } }
-static void bin_ambi_reduced_decode_quant(t_bin_ambi_reduced_decode *x, double *delta_deg2rad, double *phi_deg2rad, int index) +static void bin_ambi_reduced_decode_quant(t_bin_ambi_reduced_decode *x, double *delta_deg2rad, double *phi_deg2rad, int xindex) { double q = 1.0; double d = *delta_deg2rad; @@ -183,8 +183,8 @@ p = (double)i; *phi_deg2rad = p;
- x->x_delta[index] = (int)(*delta_deg2rad); - x->x_phi[index] = i; + x->x_delta[xindex] = (int)(*delta_deg2rad); + x->x_phi[xindex] = i;
*delta_deg2rad *= x->x_pi_over_180; *phi_deg2rad *= x->x_pi_over_180; @@ -194,7 +194,7 @@ { double delta=0.0, phi; double *dw = x->x_inv_work1; - int index; + int xindex; int order=x->x_n_order; int n_ambi = x->x_n_ambi;
@@ -203,17 +203,17 @@ post("bin_ambi_reduced_decode ERROR: ls-input needs 1 index and 1 angle: ls_index + phi [degree]"); return; } - index = (int)atom_getint(argv++) - 1; + xindex = (int)atom_getint(argv++) - 1; phi = (double)atom_getfloat(argv);
- if(index < 0) - index = 0; - if(index >= n_ambi) - index = n_ambi - 1; + if(xindex < 0) + xindex = 0; + if(xindex >= n_ambi) + xindex = n_ambi - 1;
- bin_ambi_reduced_decode_quant(x, &delta, &phi, index); + bin_ambi_reduced_decode_quant(x, &delta, &phi, xindex);
- dw += index; + dw += xindex;
*dw = 1.0; dw += n_ambi; @@ -315,7 +315,7 @@ double delta, phi; double cd, sd, cd2, cd3, sd2, csd, cp, sp, cp2, sp2, cp3, sp3, cp4, sp4; double *dw = x->x_inv_work1; - int index; + int xindex; int order=x->x_n_order; int n_ambi=x->x_n_ambi;
@@ -324,18 +324,18 @@ post("bin_ambi_reduced_decode ERROR: ls-input needs 1 index and 2 angles: ls index + delta [degree] + phi [degree]"); return; } - index = (int)atom_getint(argv++) - 1; + xindex = (int)atom_getint(argv++) - 1; delta = atom_getfloat(argv++); phi = atom_getfloat(argv);
- if(index < 0) - index = 0; - if(index >= n_ambi) - index = n_ambi - 1; + if(xindex < 0) + xindex = 0; + if(xindex >= n_ambi) + xindex = n_ambi - 1; - bin_ambi_reduced_decode_quant(x, &delta, &phi, index); + bin_ambi_reduced_decode_quant(x, &delta, &phi, xindex);
- dw += index; + dw += xindex;
cd = cos(delta); sd = sin(delta); @@ -594,7 +594,7 @@ nz = bin_ambi_reduced_decode_eval_which_element_of_col_not_zero(x, i, i); if(nz < 0) { - post("bin_ambi_reduced_decode ERROR: matrix not regular !!!!"); + post("bin_ambi_reduced_decode ERROR: matrix singular !!!!"); return; } else @@ -661,38 +661,38 @@ n_ambi rows; */
-static void bin_ambi_reduced_decode_load_HRIR(t_bin_ambi_reduced_decode *x, float findex) +static void bin_ambi_reduced_decode_load_HRIR(t_bin_ambi_reduced_decode *x, t_float findex) { - int index=(int)findex - 1; + int xindex=(int)findex - 1; int p; char buf[60];
- if(index < 0) - index = 0; - if(index >= x->x_n_ambi) - index = x->x_n_ambi - 1; + if(xindex < 0) + xindex = 0; + if(xindex >= x->x_n_ambi) + xindex = x->x_n_ambi - 1;
- p = x->x_phi[index]; + p = x->x_phi[xindex];
if(p)/*change*/ p = 360 - p;
if(p < 10) - sprintf(buf, "L%de00%da.wav", x->x_delta[index], p); + sprintf(buf, "L%de00%da.wav", x->x_delta[xindex], p); else if(p < 100) - sprintf(buf, "L%de0%da.wav", x->x_delta[index], p); + sprintf(buf, "L%de0%da.wav", x->x_delta[xindex], p); else - sprintf(buf, "L%de%da.wav", x->x_delta[index], p); - x->x_hrir_filename[index] = gensym(buf); + sprintf(buf, "L%de%da.wav", x->x_delta[xindex], p); + x->x_hrir_filename[xindex] = gensym(buf);
- SETSYMBOL(x->x_at, x->x_hrir_filename[index]); - SETSYMBOL(x->x_at+1, x->x_s_hrir[index]); + SETSYMBOL(x->x_at, x->x_hrir_filename[xindex]); + SETSYMBOL(x->x_at+1, x->x_s_hrir[xindex]); outlet_list(x->x_obj.ob_outlet, &s_list, 2, x->x_at); }
-static void bin_ambi_reduced_decode_check_arrays(t_bin_ambi_reduced_decode *x, float findex) +static void bin_ambi_reduced_decode_check_arrays(t_bin_ambi_reduced_decode *x, t_float findex) { - int index=(int)findex - 1; + int xindex=(int)findex - 1; int j, k, n; int fftsize = x->x_fftsize; int fs2=fftsize/2; @@ -703,16 +703,16 @@ iemarray_t *vec_fade_out_hrir; iemarray_t *vec_hrtf_re, *vec_hrtf_im; t_symbol *hrir, *hrtf_re, *hrtf_im; - float decr, sum; + t_float decr, sum;
- if(index < 0) - index = 0; - if(index >= x->x_n_ambi) - index = x->x_n_ambi - 1; + if(xindex < 0) + xindex = 0; + if(xindex >= x->x_n_ambi) + xindex = x->x_n_ambi - 1;
- hrir = x->x_s_hrir[index]; - hrtf_re = x->x_s_hrtf_re[index]; - hrtf_im = x->x_s_hrtf_im[index]; + hrir = x->x_s_hrir[xindex]; + hrtf_re = x->x_s_hrtf_re[xindex]; + hrtf_im = x->x_s_hrtf_im[xindex];
if (!(a = (t_garray *)pd_findbyclass(hrtf_re, garray_class))) error("%s: no such array", hrtf_re->s_name); @@ -732,15 +732,15 @@ error("%s: bad template for bin_ambi_reduced_decode", hrir->s_name); else { - x->x_beg_hrtf_re[index] = vec_hrtf_re; - x->x_beg_hrtf_im[index] = vec_hrtf_im; + x->x_beg_hrtf_re[xindex] = vec_hrtf_re; + x->x_beg_hrtf_im[xindex] = vec_hrtf_im;
if(npoints < fftsize) { post("bin_ambi_reduced_decode-WARNING: %s-array-size: %d < FFT-size: %d", hrir->s_name, npoints, fftsize); } vec = x->x_beg_hrir; - vec += index * fftsize; + vec += xindex * fftsize; if(x->x_beg_fade_out_hrir) { @@ -756,7 +756,7 @@ for(j=0; j<n; j++) vec[j] = iemarray_getfloat(vec_hrir,j); sum = 1.0f; - decr = 4.0f / (float)fs2; + decr = 4.0f / (t_float)fs2; for(j=n, k=0; j<fs2; j++, k++) { sum -= decr; @@ -766,9 +766,9 @@ } }
-static void bin_ambi_reduced_decode_calc_reduced(t_bin_ambi_reduced_decode *x, float findex) +static void bin_ambi_reduced_decode_calc_reduced(t_bin_ambi_reduced_decode *x, t_float findex) { - int index=(int)findex - 1; + int xindex=(int)findex - 1; int i, j, k, w_index, w_inc, i_inc, v_index, fs1, fs2; int fftsize = x->x_fftsize; BIN_AMBI_COMPLEX old1, old2, w; @@ -779,18 +779,18 @@ double *dv, *db=x->x_inv_work2; int n_ambi = x->x_n_ambi; int n_ambi2 = 2*n_ambi; - float mul; + t_float mul;
- if(index < 0) - index = 0; - if(index >= n_ambi) - index = n_ambi - 1; + if(xindex < 0) + xindex = 0; + if(xindex >= n_ambi) + xindex = n_ambi - 1;
- vec_hrtf_re = x->x_beg_hrtf_re[index]; - vec_hrtf_im = x->x_beg_hrtf_im[index]; + vec_hrtf_re = x->x_beg_hrtf_re[xindex]; + vec_hrtf_im = x->x_beg_hrtf_im[xindex];
- dv = db + index + n_ambi; - mul = (float)(*dv); + dv = db + xindex + n_ambi; + mul = (t_float)(*dv); vec_hrir = x->x_beg_hrir; for(k=0; k<fftsize; k++) { @@ -801,7 +801,7 @@ for(j=1; j<n_ambi; j++) { dv += n_ambi2; - mul = (float)(*dv); + mul = (t_float)(*dv); vec_hrir = x->x_beg_hrir; vec_hrir += j * fftsize; for(k=0; k<fftsize; k++) @@ -855,18 +855,19 @@ val[i] = old1; } } - for(i = 0; i<fs2; i++) - { - iemarray_getfloat(vec_hrtf_re,i) = val[i].real; - iemarray_getfloat(vec_hrtf_im,i) = val[i].imag; - } - iemarray_getfloat(vec_hrtf_re,fs2) = val[fs2].real; - iemarray_getfloat(vec_hrtf_im,fs2) = 0.0f; - for(i = fs2+1; i < fftsize; i++) - { - iemarray_getfloat(vec_hrtf_re,i) = 0.0f; - iemarray_getfloat(vec_hrtf_im,i) = 0.0f; - } + iemarray_setfloat(vec_hrtf_re, 0, val[0].real); + for(i = 1; i<fs2; i++) + { + iemarray_setfloat(vec_hrtf_re, i, val[i].real); + iemarray_setfloat(vec_hrtf_im, i, val[i].imag); + } + iemarray_setfloat(vec_hrtf_re, fs2, val[fs2].real); + iemarray_setfloat(vec_hrtf_im, fs2, 0.0f); + for(i = fs2+1; i < fftsize; i++) + { + iemarray_setfloat(vec_hrtf_re, i, 0.0f); + iemarray_setfloat(vec_hrtf_im, i, 0.0f); + } }
static void bin_ambi_reduced_decode_decoding(t_bin_ambi_reduced_decode *x) @@ -987,7 +988,7 @@ SETFLOAT(x->x_at, 1.0f); else if(plus_minus[i] == '-') SETFLOAT(x->x_at, 2.0f); - SETFLOAT(x->x_at+1, (float)(i+1)); + SETFLOAT(x->x_at+1, (t_float)(i+1)); outlet_list(x->x_out_sign_sum, &s_list, 2, x->x_at); } } @@ -1060,9 +1061,9 @@ freebytes(x->x_spec, x->x_fftsize * sizeof(BIN_AMBI_COMPLEX)); freebytes(x->x_sin_cos, x->x_fftsize * sizeof(BIN_AMBI_COMPLEX));
- freebytes(x->x_beg_hrir, x->x_fftsize * x->x_n_ambi * sizeof(float)); - freebytes(x->x_beg_hrtf_re, x->x_n_ambi * sizeof(float *)); - freebytes(x->x_beg_hrtf_im, x->x_n_ambi * sizeof(float *)); + freebytes(x->x_beg_hrir, x->x_fftsize * x->x_n_ambi * sizeof(t_float)); + freebytes(x->x_beg_hrtf_re, x->x_n_ambi * sizeof(iemarray_t *)); + freebytes(x->x_beg_hrtf_im, x->x_n_ambi * sizeof(iemarray_t *)); }
/* @@ -1211,7 +1212,7 @@ x->x_sin_cos = (BIN_AMBI_COMPLEX *)getbytes(x->x_fftsize * sizeof(BIN_AMBI_COMPLEX));
x->x_beg_fade_out_hrir = 0; - x->x_beg_hrir = (float *)getbytes(x->x_fftsize * x->x_n_ambi * sizeof(float)); + x->x_beg_hrir = (t_float *)getbytes(x->x_fftsize * x->x_n_ambi * sizeof(t_float)); x->x_beg_hrtf_re = (iemarray_t **)getbytes(x->x_n_ambi * sizeof(iemarray_t *)); x->x_beg_hrtf_im = (iemarray_t **)getbytes(x->x_n_ambi * sizeof(iemarray_t *));
Modified: trunk/externals/iem/iem_bin_ambi/src/bin_ambi_reduced_decode2.c =================================================================== --- trunk/externals/iem/iem_bin_ambi/src/bin_ambi_reduced_decode2.c 2009-02-01 07:29:03 UTC (rev 10707) +++ trunk/externals/iem/iem_bin_ambi/src/bin_ambi_reduced_decode2.c 2009-02-01 07:30:18 UTC (rev 10708) @@ -1,7 +1,7 @@ /* For information on usage and redistribution, and for a DISCLAIMER OF ALL * WARRANTIES, see the file, "LICENSE.txt," in this distribution.
-iem_bin_ambi written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2006 */ +iem_bin_ambi written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2009 */
#include "m_pd.h" #include "iemlib.h" @@ -51,7 +51,7 @@ BIN_AMBI_COMPLEX *x_spec; BIN_AMBI_COMPLEX *x_sin_cos; iemarray_t *x_beg_fade_out_hrir; - float *x_beg_hrir; + t_float *x_beg_hrir; iemarray_t **x_beg_hrtf_re; iemarray_t **x_beg_hrtf_im; t_symbol **x_hrir_filename; @@ -79,20 +79,20 @@ static void bin_ambi_reduced_decode2_init_cos(t_bin_ambi_reduced_decode2 *x) {/* initialize a whole sine and cosine wave over a fftsize array */ int i, fftsize = x->x_fftsize; - float f, g; + t_float f, g; BIN_AMBI_COMPLEX *sincos = x->x_sin_cos;
- g = 2.0f * 3.1415926538f / (float)fftsize; + g = 2.0f * 3.1415926538f / (t_float)fftsize; for(i=0; i<fftsize; i++) { - f = g * (float)i; + f = g * (t_float)i; (*sincos).real = cos(f); (*sincos).imag = -sin(f); /*FFT*/ sincos++; } }
-static void bin_ambi_reduced_decode2_quant(t_bin_ambi_reduced_decode2 *x, double *delta_deg2rad, double *phi_deg2rad, int index) +static void bin_ambi_reduced_decode2_quant(t_bin_ambi_reduced_decode2 *x, double *delta_deg2rad, double *phi_deg2rad, int xindex) { double q = 1.0; double d = *delta_deg2rad; @@ -188,8 +188,8 @@ p = (double)i; *phi_deg2rad = p;
- x->x_delta[index] = (int)(*delta_deg2rad); - x->x_phi[index] = i; + x->x_delta[xindex] = (int)(*delta_deg2rad); + x->x_phi[xindex] = i;
*delta_deg2rad *= x->x_pi_over_180; *phi_deg2rad *= x->x_pi_over_180; @@ -199,7 +199,7 @@ { double delta=0.0, phi; double *dw = x->x_transp; - int index; + int xindex; int order=x->x_n_order; int n_ls = x->x_n_ls;
@@ -208,17 +208,17 @@ post("bin_ambi_reduced_decode2 ERROR: ls-input needs 1 index and 1 angle: ls_index + phi [degree]"); return; } - index = (int)atom_getint(argv++) - 1; + xindex = (int)atom_getint(argv++) - 1; phi = (double)atom_getfloat(argv);
- if(index < 0) - index = 0; - if(index >= n_ls) - index = n_ls - 1; + if(xindex < 0) + xindex = 0; + if(xindex >= n_ls) + xindex = n_ls - 1;
- bin_ambi_reduced_decode2_quant(x, &delta, &phi, index); + bin_ambi_reduced_decode2_quant(x, &delta, &phi, xindex);
- dw += index * x->x_n_ambi; + dw += xindex * x->x_n_ambi;
*dw++ = 1.0; *dw++ = cos(phi); @@ -295,7 +295,7 @@ double delta, phi; double cd, sd, cd2, cd3, sd2, csd, cp, sp, cp2, sp2, cp3, sp3, cp4, sp4; double *dw = x->x_transp; - int index; + int xindex; int n_ls=x->x_n_ls; int order=x->x_n_order;
@@ -304,23 +304,23 @@ post("bin_ambi_reduced_decode2 ERROR: ls-input needs 1 index and 2 angles: ls index + delta [degree] + phi [degree]"); return; } - index = (int)atom_getint(argv++) - 1; + xindex = (int)atom_getint(argv++) - 1; delta = atom_getfloat(argv++); phi = atom_getfloat(argv);
- if(index < 0) - index = 0; - if(index >= n_ls) - index = n_ls - 1; + if(xindex < 0) + xindex = 0; + if(xindex >= n_ls) + xindex = n_ls - 1; - bin_ambi_reduced_decode2_quant(x, &delta, &phi, index); + bin_ambi_reduced_decode2_quant(x, &delta, &phi, xindex);
cd = cos(delta); sd = sin(delta); cp = cos(phi); sp = sin(phi); - dw += index * x->x_n_ambi; + dw += xindex * x->x_n_ambi;
*dw++ = 1.0;
@@ -622,7 +622,7 @@ nz = bin_ambi_reduced_decode2_eval_which_element_of_col_not_zero(x, i, i); if(nz < 0) { - post("bin_ambi_reduced_decode2 ERROR: matrix not regular !!!!"); + post("bin_ambi_reduced_decode2 ERROR: matrix singular !!!!"); x->x_seq_ok = 0; return; } @@ -690,38 +690,38 @@ n_ambi rows; */
-static void bin_ambi_reduced_decode2_load_HRIR(t_bin_ambi_reduced_decode2 *x, float findex) +static void bin_ambi_reduced_decode2_load_HRIR(t_bin_ambi_reduced_decode2 *x, t_float findex) { - int index=(int)findex - 1; + int xindex=(int)findex - 1; int p; char buf[60];
- if(index < 0) - index = 0; - if(index >= x->x_n_ls) - index = x->x_n_ls - 1; + if(xindex < 0) + xindex = 0; + if(xindex >= x->x_n_ls) + xindex = x->x_n_ls - 1;
- p = x->x_phi[index]; + p = x->x_phi[xindex];
if(p)/*change*/ p = 360 - p;
if(p < 10) - sprintf(buf, "L%de00%da.wav", x->x_delta[index], p); + sprintf(buf, "L%de00%da.wav", x->x_delta[xindex], p); else if(p < 100) - sprintf(buf, "L%de0%da.wav", x->x_delta[index], p); + sprintf(buf, "L%de0%da.wav", x->x_delta[xindex], p); else - sprintf(buf, "L%de%da.wav", x->x_delta[index], p); - x->x_hrir_filename[index] = gensym(buf); + sprintf(buf, "L%de%da.wav", x->x_delta[xindex], p); + x->x_hrir_filename[xindex] = gensym(buf);
- SETSYMBOL(x->x_at, x->x_hrir_filename[index]); - SETSYMBOL(x->x_at+1, x->x_s_hrir[index]); + SETSYMBOL(x->x_at, x->x_hrir_filename[xindex]); + SETSYMBOL(x->x_at+1, x->x_s_hrir[xindex]); outlet_list(x->x_obj.ob_outlet, &s_list, 2, x->x_at); }
-static void bin_ambi_reduced_decode2_check_HRIR_arrays(t_bin_ambi_reduced_decode2 *x, float findex) +static void bin_ambi_reduced_decode2_check_HRIR_arrays(t_bin_ambi_reduced_decode2 *x, t_float findex) { - int index=(int)findex - 1; + int xindex=(int)findex - 1; int j, k, n; int fftsize = x->x_fftsize; int fs2=fftsize/2; @@ -730,14 +730,14 @@ t_symbol *hrir; iemarray_t *vec_hrir, *vec_fade_out_hrir; t_float *vec; - float decr, sum; + t_float decr, sum;
- if(index < 0) - index = 0; - if(index >= x->x_n_ls) - index = x->x_n_ls - 1; + if(xindex < 0) + xindex = 0; + if(xindex >= x->x_n_ls) + xindex = x->x_n_ls - 1;
- hrir = x->x_s_hrir[index]; + hrir = x->x_s_hrir[xindex]; if (!(a = (t_garray *)pd_findbyclass(hrir, garray_class))) error("%s: no such array", hrir->s_name); else if (!iemarray_getarray(a, &npoints, &vec_hrir)) @@ -749,7 +749,7 @@ post("bin_ambi_reduced_decode2-WARNING: %s-array-size: %d < FFT-size: %d", hrir->s_name, npoints, fftsize); } vec = x->x_beg_hrir; - vec += index * fftsize; + vec += xindex * fftsize; if(x->x_beg_fade_out_hrir) { @@ -765,7 +765,7 @@ for(j=0; j<n; j++) vec[j] = iemarray_getfloat(vec_hrir,j); sum = 1.0f; - decr = 4.0f / (float)fs2; + decr = 4.0f / (t_float)fs2; for(j=n, k=0; j<fs2; j++, k++) { sum -= decr; @@ -775,22 +775,22 @@ } }
-static void bin_ambi_reduced_decode2_check_HRTF_arrays(t_bin_ambi_reduced_decode2 *x, float findex) +static void bin_ambi_reduced_decode2_check_HRTF_arrays(t_bin_ambi_reduced_decode2 *x, t_float findex) { - int index=(int)findex - 1; + int xindex=(int)findex - 1; t_garray *a; int npoints; int fftsize = x->x_fftsize; iemarray_t *vec_hrtf_re, *vec_hrtf_im; t_symbol *hrtf_re, *hrtf_im;
- if(index < 0) - index = 0; - if(index >= x->x_n_ambi) - index = x->x_n_ambi - 1; + if(xindex < 0) + xindex = 0; + if(xindex >= x->x_n_ambi) + xindex = x->x_n_ambi - 1;
- hrtf_re = x->x_s_hrtf_re[index]; - hrtf_im = x->x_s_hrtf_im[index]; + hrtf_re = x->x_s_hrtf_re[xindex]; + hrtf_im = x->x_s_hrtf_im[xindex];
if (!(a = (t_garray *)pd_findbyclass(hrtf_re, garray_class))) error("%s: no such array", hrtf_re->s_name); @@ -806,14 +806,14 @@ error("%s: bad array-size: %d", hrtf_im->s_name, npoints); else { - x->x_beg_hrtf_re[index] = vec_hrtf_re; - x->x_beg_hrtf_im[index] = vec_hrtf_im; + x->x_beg_hrtf_re[xindex] = vec_hrtf_re; + x->x_beg_hrtf_im[xindex] = vec_hrtf_im; } }
-static void bin_ambi_reduced_decode2_calc_reduced(t_bin_ambi_reduced_decode2 *x, float findex) +static void bin_ambi_reduced_decode2_calc_reduced(t_bin_ambi_reduced_decode2 *x, t_float findex) { - int index=(int)findex - 1; + int xindex=(int)findex - 1; int i, j, k, w_index, w_inc, i_inc, v_index, fs1, fs2; int fftsize = x->x_fftsize; BIN_AMBI_COMPLEX old1, old2, w; @@ -824,20 +824,20 @@ double *dv, *db=x->x_prod; int n_ambi = x->x_n_ambi; int n_ls = x->x_n_ls; - float mul; + t_float mul;
if(x->x_seq_ok) { - if(index < 0) - index = 0; - if(index >= n_ambi) - index = n_ambi - 1; + if(xindex < 0) + xindex = 0; + if(xindex >= n_ambi) + xindex = n_ambi - 1;
- vec_hrtf_re = x->x_beg_hrtf_re[index]; - vec_hrtf_im = x->x_beg_hrtf_im[index]; + vec_hrtf_re = x->x_beg_hrtf_re[xindex]; + vec_hrtf_im = x->x_beg_hrtf_im[xindex];
- dv = db + index; - mul = (float)(*dv); + dv = db + xindex; + mul = (t_float)(*dv); vec_hrir = x->x_beg_hrir; for(k=0; k<fftsize; k++)/*first step of acumulating the HRIRs*/ { @@ -848,7 +848,7 @@ for(j=1; j<n_ls; j++) { dv += n_ambi; - mul = (float)(*dv); + mul = (t_float)(*dv); vec_hrir = x->x_beg_hrir; vec_hrir += j * fftsize; for(k=0; k<fftsize; k++) @@ -902,18 +902,19 @@ val[i] = old1; } } - for(i = 0; i<fs2; i++) - { - iemarray_getfloat(vec_hrtf_re,i) = val[i].real; - iemarray_getfloat(vec_hrtf_im,i) = val[i].imag; - } - iemarray_getfloat(vec_hrtf_re,fs2) = val[fs2].real; - iemarray_getfloat(vec_hrtf_im,fs2) = 0.0f; - for(i = fs2+1; i < fftsize; i++) - { - iemarray_getfloat(vec_hrtf_re,i) = 0.0f; - iemarray_getfloat(vec_hrtf_im,i) = 0.0f; - } + iemarray_setfloat(vec_hrtf_re, 0, val[0].real); + for(i = 1; i<fs2; i++) + { + iemarray_setfloat(vec_hrtf_re, i, val[i].real); + iemarray_setfloat(vec_hrtf_im, i, val[i].imag); + } + iemarray_setfloat(vec_hrtf_re, fs2, val[fs2].real); + iemarray_setfloat(vec_hrtf_im, fs2, 0.0f); + for(i = fs2+1; i < fftsize; i++) + { + iemarray_setfloat(vec_hrtf_re, i, 0.0f); + iemarray_setfloat(vec_hrtf_im, i, 0.0f); + } } }
@@ -1038,7 +1039,7 @@ SETFLOAT(x->x_at, 1.0f); else if(plus_minus[i] == '-') SETFLOAT(x->x_at, 2.0f); - SETFLOAT(x->x_at+1, (float)(i+1)); + SETFLOAT(x->x_at+1, (t_float)(i+1)); outlet_list(x->x_out_sign_sum, &s_list, 2, x->x_at); } } @@ -1115,9 +1116,9 @@ freebytes(x->x_spec, x->x_fftsize * sizeof(BIN_AMBI_COMPLEX)); freebytes(x->x_sin_cos, x->x_fftsize * sizeof(BIN_AMBI_COMPLEX));
- freebytes(x->x_beg_hrir, x->x_fftsize * x->x_n_ls * sizeof(float)); - freebytes(x->x_beg_hrtf_re, x->x_n_ambi * sizeof(float *)); - freebytes(x->x_beg_hrtf_im, x->x_n_ambi * sizeof(float *)); + freebytes(x->x_beg_hrir, x->x_fftsize * x->x_n_ls * sizeof(t_float)); + freebytes(x->x_beg_hrtf_re, x->x_n_ambi * sizeof(iemarray_t *)); + freebytes(x->x_beg_hrtf_im, x->x_n_ambi * sizeof(iemarray_t *)); }
/* @@ -1287,7 +1288,7 @@ x->x_sin_cos = (BIN_AMBI_COMPLEX *)getbytes(x->x_fftsize * sizeof(BIN_AMBI_COMPLEX));
x->x_beg_fade_out_hrir = 0; - x->x_beg_hrir = (float *)getbytes(x->x_fftsize * x->x_n_ls * sizeof(float)); + x->x_beg_hrir = (t_float *)getbytes(x->x_fftsize * x->x_n_ls * sizeof(t_float)); x->x_beg_hrtf_re = (iemarray_t **)getbytes(x->x_n_ambi * sizeof(iemarray_t *)); x->x_beg_hrtf_im = (iemarray_t **)getbytes(x->x_n_ambi * sizeof(iemarray_t *));
Modified: trunk/externals/iem/iem_bin_ambi/src/bin_ambi_reduced_decode_fft.c =================================================================== --- trunk/externals/iem/iem_bin_ambi/src/bin_ambi_reduced_decode_fft.c 2009-02-01 07:29:03 UTC (rev 10707) +++ trunk/externals/iem/iem_bin_ambi/src/bin_ambi_reduced_decode_fft.c 2009-02-01 07:30:18 UTC (rev 10708) @@ -1,7 +1,7 @@ /* For information on usage and redistribution, and for a DISCLAIMER OF ALL * WARRANTIES, see the file, "LICENSE.txt," in this distribution.
-iem_bin_ambi written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2006 */ +iem_bin_ambi written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2009 */
#include "m_pd.h" #include "iemlib.h" @@ -55,7 +55,7 @@ BIN_AMBI_COMPLEX *x_spec; BIN_AMBI_COMPLEX *x_sin_cos; iemarray_t *x_beg_fade_out_hrir; - float *x_beg_hrir; + t_float *x_beg_hrir; iemarray_t **x_beg_hrtf_re; iemarray_t **x_beg_hrtf_im; t_symbol **x_hrir_filename; @@ -83,20 +83,20 @@ static void bin_ambi_reduced_decode_fft_init_cos(t_bin_ambi_reduced_decode_fft *x) {/* initialize a whole sine and cosine wave over a fftsize array */ int i, fftsize = x->x_fftsize; - float f, g; + t_float f, g; BIN_AMBI_COMPLEX *sincos = x->x_sin_cos;
- g = 2.0f * 3.1415926538f / (float)fftsize; + g = 2.0f * 3.1415926538f / (t_float)fftsize; for(i=0; i<fftsize; i++) { - f = g * (float)i; + f = g * (t_float)i; (*sincos).real = cos(f); (*sincos).imag = -sin(f); /*FFT*/ sincos++; } }
-static void bin_ambi_reduced_decode_fft_quant(t_bin_ambi_reduced_decode_fft *x, double *delta_deg2rad, double *phi_deg2rad, int index) +static void bin_ambi_reduced_decode_fft_quant(t_bin_ambi_reduced_decode_fft *x, double *delta_deg2rad, double *phi_deg2rad, int xindex) { double q = 1.0; double d = *delta_deg2rad; @@ -192,8 +192,8 @@ p = (double)i; *phi_deg2rad = p;
- x->x_delta[index] = (int)(*delta_deg2rad); - x->x_phi[index] = i; + x->x_delta[xindex] = (int)(*delta_deg2rad); + x->x_phi[xindex] = i;
*delta_deg2rad *= x->x_pi_over_180; *phi_deg2rad *= x->x_pi_over_180; @@ -203,7 +203,7 @@ { double delta=0.0, phi; double *dw = x->x_transp; - int index; + int xindex; int order=x->x_n_order;
if(argc < 2) @@ -211,23 +211,23 @@ post("bin_ambi_reduced_decode_fft ERROR: ls-input needs 1 index and 1 angle: ls_index + phi [degree]"); return; } - index = (int)atom_getint(argv++) - 1; + xindex = (int)atom_getint(argv++) - 1; phi = (double)atom_getfloat(argv);
- if(index < 0) - index = 0; + if(xindex < 0) + xindex = 0; if(mode == BIN_AMBI_LS_IND) { - if(index >= x->x_n_ind_ls) - index = x->x_n_ind_ls - 1; + if(xindex >= x->x_n_ind_ls) + xindex = x->x_n_ind_ls - 1; } else if(mode == BIN_AMBI_LS_MRG) { if(x->x_n_mrg_mir_ls) { - if(index >= x->x_n_mrg_mir_ls) - index = x->x_n_mrg_mir_ls - 1; - index += x->x_n_ind_ls; + if(xindex >= x->x_n_mrg_mir_ls) + xindex = x->x_n_mrg_mir_ls - 1; + xindex += x->x_n_ind_ls; } else return; @@ -236,10 +236,10 @@ { if(x->x_n_mrg_mir_ls) { - if(index >= x->x_n_mrg_mir_ls) - index = x->x_n_mrg_mir_ls - 1; - index += x->x_n_ind_ls; - index += x->x_n_mrg_mir_ls; + if(xindex >= x->x_n_mrg_mir_ls) + xindex = x->x_n_mrg_mir_ls - 1; + xindex += x->x_n_ind_ls; + xindex += x->x_n_mrg_mir_ls; } else return; @@ -248,10 +248,10 @@ { if(x->x_n_ph_ls) { - if(index >= x->x_n_ph_ls) - index = x->x_n_ph_ls - 1; - index += x->x_n_ind_ls; - index += 2*x->x_n_mrg_mir_ls; + if(xindex >= x->x_n_ph_ls) + xindex = x->x_n_ph_ls - 1; + xindex += x->x_n_ind_ls; + xindex += 2*x->x_n_mrg_mir_ls; } else return; @@ -259,9 +259,9 @@ else return;
- bin_ambi_reduced_decode_fft_quant(x, &delta, &phi, index); + bin_ambi_reduced_decode_fft_quant(x, &delta, &phi, xindex);
- dw += index * x->x_n_ambi; + dw += xindex * x->x_n_ambi;
*dw++ = 1.0; *dw++ = cos(phi); @@ -338,7 +338,7 @@ double delta, phi; double cd, sd, cd2, cd3, sd2, csd, cp, sp, cp2, sp2, cp3, sp3, cp4, sp4; double *dw = x->x_transp; - int index; + int xindex; int order=x->x_n_order;
if(argc < 3) @@ -346,24 +346,24 @@ post("bin_ambi_reduced_decode_fft ERROR: ls-input needs 1 index and 2 angles: ls index + delta [degree] + phi [degree]"); return; } - index = (int)atom_getint(argv++) - 1; + xindex = (int)atom_getint(argv++) - 1; delta = atom_getfloat(argv++); phi = atom_getfloat(argv);
- if(index < 0) - index = 0; + if(xindex < 0) + xindex = 0; if(mode == BIN_AMBI_LS_IND) { - if(index >= x->x_n_ind_ls) - index = x->x_n_ind_ls - 1; + if(xindex >= x->x_n_ind_ls) + xindex = x->x_n_ind_ls - 1; } else if(mode == BIN_AMBI_LS_MRG) { if(x->x_n_mrg_mir_ls) { - if(index >= x->x_n_mrg_mir_ls) - index = x->x_n_mrg_mir_ls - 1; - index += x->x_n_ind_ls; + if(xindex >= x->x_n_mrg_mir_ls) + xindex = x->x_n_mrg_mir_ls - 1; + xindex += x->x_n_ind_ls; } else return; @@ -372,10 +372,10 @@ { if(x->x_n_mrg_mir_ls) { - if(index >= x->x_n_mrg_mir_ls) - index = x->x_n_mrg_mir_ls - 1; - index += x->x_n_ind_ls; - index += x->x_n_mrg_mir_ls; + if(xindex >= x->x_n_mrg_mir_ls) + xindex = x->x_n_mrg_mir_ls - 1; + xindex += x->x_n_ind_ls; + xindex += x->x_n_mrg_mir_ls; } else return; @@ -384,10 +384,10 @@ { if(x->x_n_ph_ls) { - if(index >= x->x_n_ph_ls) - index = x->x_n_ph_ls - 1; - index += x->x_n_ind_ls; - index += 2*x->x_n_mrg_mir_ls; + if(xindex >= x->x_n_ph_ls) + xindex = x->x_n_ph_ls - 1; + xindex += x->x_n_ind_ls; + xindex += 2*x->x_n_mrg_mir_ls; } else return; @@ -395,14 +395,14 @@ else return; - bin_ambi_reduced_decode_fft_quant(x, &delta, &phi, index); + bin_ambi_reduced_decode_fft_quant(x, &delta, &phi, xindex);
cd = cos(delta); sd = sin(delta); cp = cos(phi); sp = sin(phi); - dw += index * x->x_n_ambi; + dw += xindex * x->x_n_ambi;
*dw++ = 1.0;
@@ -746,7 +746,7 @@ nz = bin_ambi_reduced_decode_fft_eval_which_element_of_col_not_zero(x, i, i); if(nz < 0) { - post("bin_ambi_reduced_decode_fft ERROR: matrix not regular !!!!"); + post("bin_ambi_reduced_decode_fft ERROR: matrix singular !!!!"); x->x_seq_ok = 0; return; } @@ -815,38 +815,38 @@ n_ambi rows; */
-static void bin_ambi_reduced_decode_fft_load_HRIR(t_bin_ambi_reduced_decode_fft *x, float findex) +static void bin_ambi_reduced_decode_fft_load_HRIR(t_bin_ambi_reduced_decode_fft *x, t_float findex) { - int index=(int)findex - 1; + int xindex=(int)findex - 1; int p; char buf[60];
- if(index < 0) - index = 0; - if(index >= (x->x_n_ind_ls + x->x_n_mrg_mir_ls)) - index = x->x_n_ind_ls + x->x_n_mrg_mir_ls - 1; + if(xindex < 0) + xindex = 0; + if(xindex >= (x->x_n_ind_ls + x->x_n_mrg_mir_ls)) + xindex = x->x_n_ind_ls + x->x_n_mrg_mir_ls - 1;
- p = x->x_phi[index]; + p = x->x_phi[xindex];
if(p)/*change*/ p = 360 - p;
if(p < 10) - sprintf(buf, "L%de00%da.wav", x->x_delta[index], p); + sprintf(buf, "L%de00%da.wav", x->x_delta[xindex], p); else if(p < 100) - sprintf(buf, "L%de0%da.wav", x->x_delta[index], p); + sprintf(buf, "L%de0%da.wav", x->x_delta[xindex], p); else - sprintf(buf, "L%de%da.wav", x->x_delta[index], p); - x->x_hrir_filename[index] = gensym(buf); + sprintf(buf, "L%de%da.wav", x->x_delta[xindex], p); + x->x_hrir_filename[xindex] = gensym(buf);
- SETSYMBOL(x->x_at, x->x_hrir_filename[index]); - SETSYMBOL(x->x_at+1, x->x_s_hrir[index]); + SETSYMBOL(x->x_at, x->x_hrir_filename[xindex]); + SETSYMBOL(x->x_at+1, x->x_s_hrir[xindex]); outlet_list(x->x_obj.ob_outlet, &s_list, 2, x->x_at); }
-static void bin_ambi_reduced_decode_fft_check_HRIR_arrays(t_bin_ambi_reduced_decode_fft *x, float findex) +static void bin_ambi_reduced_decode_fft_check_HRIR_arrays(t_bin_ambi_reduced_decode_fft *x, t_float findex) { - int index=(int)findex - 1; + int xindex=(int)findex - 1; int j, k, n; int fftsize = x->x_fftsize; int fs2=fftsize/2; @@ -855,14 +855,14 @@ t_symbol *hrir; t_float *vec; iemarray_t *vec_hrir, *vec_fade_out_hrir; - float decr, sum; + t_float decr, sum;
- if(index < 0) - index = 0; - if(index >= (x->x_n_ind_ls + x->x_n_mrg_mir_ls)) - index = x->x_n_ind_ls + x->x_n_mrg_mir_ls - 1; + if(xindex < 0) + xindex = 0; + if(xindex >= (x->x_n_ind_ls + x->x_n_mrg_mir_ls)) + xindex = x->x_n_ind_ls + x->x_n_mrg_mir_ls - 1;
- hrir = x->x_s_hrir[index]; + hrir = x->x_s_hrir[xindex]; if (!(a = (t_garray *)pd_findbyclass(hrir, garray_class))) error("%s: no such array", hrir->s_name); else if (!iemarray_getarray(a, &npoints, &vec_hrir)) @@ -874,7 +874,7 @@ post("bin_ambi_reduced_decode_fft-WARNING: %s-array-size: %d < FFT-size: %d", hrir->s_name, npoints, fftsize); } vec = x->x_beg_hrir; - vec += index * fftsize; + vec += xindex * fftsize; if(x->x_beg_fade_out_hrir) { @@ -890,7 +890,7 @@ for(j=0; j<n; j++) vec[j] = iemarray_getfloat(vec_hrir,j); sum = 1.0f; - decr = 4.0f / (float)fs2; + decr = 4.0f / (t_float)fs2; for(j=n, k=0; j<fs2; j++, k++) { sum -= decr; @@ -900,22 +900,22 @@ } }
-static void bin_ambi_reduced_decode_fft_check_HRTF_arrays(t_bin_ambi_reduced_decode_fft *x, float findex) +static void bin_ambi_reduced_decode_fft_check_HRTF_arrays(t_bin_ambi_reduced_decode_fft *x, t_float findex) { - int index=(int)findex - 1; + int xindex=(int)findex - 1; t_garray *a; int npoints; int fftsize = x->x_fftsize; iemarray_t *vec_hrtf_re, *vec_hrtf_im; t_symbol *hrtf_re, *hrtf_im;
- if(index < 0) - index = 0; - if(index >= x->x_n_ambi) - index = x->x_n_ambi - 1; + if(xindex < 0) + xindex = 0; + if(xindex >= x->x_n_ambi) + xindex = x->x_n_ambi - 1;
- hrtf_re = x->x_s_hrtf_re[index]; - hrtf_im = x->x_s_hrtf_im[index]; + hrtf_re = x->x_s_hrtf_re[xindex]; + hrtf_im = x->x_s_hrtf_im[xindex];
if (!(a = (t_garray *)pd_findbyclass(hrtf_re, garray_class))) error("%s: no such array", hrtf_re->s_name); @@ -931,14 +931,14 @@ error("%s: bad array-size: %d", hrtf_im->s_name, npoints); else { - x->x_beg_hrtf_re[index] = vec_hrtf_re; - x->x_beg_hrtf_im[index] = vec_hrtf_im; + x->x_beg_hrtf_re[xindex] = vec_hrtf_re; + x->x_beg_hrtf_im[xindex] = vec_hrtf_im; } }
-static void bin_ambi_reduced_decode_fft_calc_reduced(t_bin_ambi_reduced_decode_fft *x, float findex) +static void bin_ambi_reduced_decode_fft_calc_reduced(t_bin_ambi_reduced_decode_fft *x, t_float findex) { - int index=(int)findex - 1; + int xindex=(int)findex - 1; int i, j, k, w_index, w_inc, i_inc, v_index, fs1, fs2; int fftsize = x->x_fftsize; BIN_AMBI_COMPLEX old1, old2, w; @@ -949,20 +949,20 @@ double *dv, *db=x->x_prod3; int n_ambi = x->x_n_ambi; int n_ls = x->x_n_ind_ls + x->x_n_mrg_mir_ls; - float mul; + t_float mul;
if(x->x_seq_ok) { - if(index < 0) - index = 0; - if(index >= n_ambi) - index = n_ambi - 1; + if(xindex < 0) + xindex = 0; + if(xindex >= n_ambi) + xindex = n_ambi - 1;
- vec_hrtf_re = x->x_beg_hrtf_re[index]; - vec_hrtf_im = x->x_beg_hrtf_im[index]; + vec_hrtf_re = x->x_beg_hrtf_re[xindex]; + vec_hrtf_im = x->x_beg_hrtf_im[xindex];
- dv = db + index; - mul = (float)(*dv); + dv = db + xindex; + mul = (t_float)(*dv); vec_hrir = x->x_beg_hrir; for(k=0; k<fftsize; k++)/*first step of acumulating the HRIRs*/ { @@ -973,7 +973,7 @@ for(j=1; j<n_ls; j++) { dv += n_ambi; - mul = (float)(*dv); + mul = (t_float)(*dv); vec_hrir = x->x_beg_hrir; vec_hrir += j * fftsize; for(k=0; k<fftsize; k++) @@ -1027,18 +1027,19 @@ val[i] = old1; } } - for(i = 0; i<fs2; i++) - { - iemarray_getfloat(vec_hrtf_re, i) = val[i].real; - iemarray_getfloat(vec_hrtf_im, i) = val[i].imag; - } - iemarray_getfloat(vec_hrtf_re, fs2) = val[fs2].real; - iemarray_getfloat(vec_hrtf_im, fs2) = 0.0f; - for(i = fs2+1; i < fftsize; i++) - { - iemarray_getfloat(vec_hrtf_re, i) = 0.0f; - iemarray_getfloat(vec_hrtf_im, i) = 0.0f; - } + iemarray_setfloat(vec_hrtf_re, 0, val[0].real); + for(i = 1; i<fs2; i++) + { + iemarray_setfloat(vec_hrtf_re, i, val[i].real); + iemarray_setfloat(vec_hrtf_im, i, val[i].imag); + } + iemarray_setfloat(vec_hrtf_re, fs2, val[fs2].real); + iemarray_setfloat(vec_hrtf_im, fs2, 0.0f); + for(i = fs2+1; i < fftsize; i++) + { + iemarray_setfloat(vec_hrtf_re, i, 0.0f); + iemarray_setfloat(vec_hrtf_im, i, 0.0f); + } } }
@@ -1163,7 +1164,7 @@ SETFLOAT(x->x_at, 1.0f); else if(plus_minus[i] == '-') SETFLOAT(x->x_at, 2.0f); - SETFLOAT(x->x_at+1, (float)(i+1)); + SETFLOAT(x->x_at+1, (t_float)(i+1)); outlet_list(x->x_out_sign_sum, &s_list, 2, x->x_at); } } @@ -1246,9 +1247,9 @@ freebytes(x->x_spec, x->x_fftsize * sizeof(BIN_AMBI_COMPLEX)); freebytes(x->x_sin_cos, x->x_fftsize * sizeof(BIN_AMBI_COMPLEX));
- freebytes(x->x_beg_hrir, x->x_fftsize * (x->x_n_ind_ls+x->x_n_mrg_mir_ls) * sizeof(float)); - freebytes(x->x_beg_hrtf_re, x->x_n_ambi * sizeof(float *)); - freebytes(x->x_beg_hrtf_im, x->x_n_ambi * sizeof(float *)); + freebytes(x->x_beg_hrir, x->x_fftsize * (x->x_n_ind_ls+x->x_n_mrg_mir_ls) * sizeof(t_float)); + freebytes(x->x_beg_hrtf_re, x->x_n_ambi * sizeof(iemarray_t *)); + freebytes(x->x_beg_hrtf_im, x->x_n_ambi * sizeof(iemarray_t *)); }
/* @@ -1433,7 +1434,7 @@ x->x_sin_cos = (BIN_AMBI_COMPLEX *)getbytes(x->x_fftsize * sizeof(BIN_AMBI_COMPLEX));
x->x_beg_fade_out_hrir = 0; - x->x_beg_hrir = (float *)getbytes(x->x_fftsize * (x->x_n_ind_ls+x->x_n_mrg_mir_ls) * sizeof(float)); + x->x_beg_hrir = (t_float *)getbytes(x->x_fftsize * (x->x_n_ind_ls+x->x_n_mrg_mir_ls) * sizeof(t_float)); x->x_beg_hrtf_re = (iemarray_t **)getbytes(x->x_n_ambi * sizeof(iemarray_t *)); x->x_beg_hrtf_im = (iemarray_t **)getbytes(x->x_n_ambi * sizeof(iemarray_t *));
Modified: trunk/externals/iem/iem_bin_ambi/src/bin_ambi_reduced_decode_fft2.c =================================================================== --- trunk/externals/iem/iem_bin_ambi/src/bin_ambi_reduced_decode_fft2.c 2009-02-01 07:29:03 UTC (rev 10707) +++ trunk/externals/iem/iem_bin_ambi/src/bin_ambi_reduced_decode_fft2.c 2009-02-01 07:30:18 UTC (rev 10708) @@ -1,7 +1,7 @@ /* For information on usage and redistribution, and for a DISCLAIMER OF ALL * WARRANTIES, see the file, "LICENSE.txt," in this distribution.
-iem_bin_ambi written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2006 */ +iem_bin_ambi written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2009 */
#include "m_pd.h" @@ -95,7 +95,7 @@ } }
-static void bin_ambi_reduced_decode_fft2_convert(t_bin_ambi_reduced_decode_fft2 *x, double *delta_deg2rad, double *phi_deg2rad, int index) +static void bin_ambi_reduced_decode_fft2_convert(t_bin_ambi_reduced_decode_fft2 *x, double *delta_deg2rad, double *phi_deg2rad, int xindex) { double q = 1.0; double d = *delta_deg2rad; @@ -111,8 +111,8 @@ while(p >= 360.0) p -= 360.0;
- x->x_delta[index] = (int)(d); - x->x_phi[index] = (int)(p); + x->x_delta[xindex] = (int)(d); + x->x_phi[xindex] = (int)(p);
*delta_deg2rad = d*x->x_pi_over_180; *phi_deg2rad = p*x->x_pi_over_180; @@ -122,7 +122,7 @@ { double delta=0.0, phi; double *dw = x->x_transp; - int index; + int xindex; int order=x->x_n_order;
if(argc < 2) @@ -130,23 +130,23 @@ post("bin_ambi_reduced_decode_fft2 ERROR: ls-input needs 1 index and 1 angle: ls_index + phi [degree]"); return; } - index = (int)atom_getint(argv++) - 1; + xindex = (int)atom_getint(argv++) - 1; phi = (double)atom_getfloat(argv);
- if(index < 0) - index = 0; + if(xindex < 0) + xindex = 0; if(mode == BIN_AMBI_LS_REAL) { - if(index >= x->x_n_real_ls) - index = x->x_n_real_ls - 1; + if(xindex >= x->x_n_real_ls) + xindex = x->x_n_real_ls - 1; } else if(mode == BIN_AMBI_LS_PHT) { if(x->x_n_pht_ls) { - if(index >= x->x_n_pht_ls) - index = x->x_n_pht_ls - 1; - index += x->x_n_real_ls; + if(xindex >= x->x_n_pht_ls) + xindex = x->x_n_pht_ls - 1; + xindex += x->x_n_real_ls; } else return; @@ -154,9 +154,9 @@ else return;
- bin_ambi_reduced_decode_fft2_convert(x, &delta, &phi, index); + bin_ambi_reduced_decode_fft2_convert(x, &delta, &phi, xindex);
- dw += index * x->x_n_ambi; + dw += xindex * x->x_n_ambi;
*dw++ = 1.0; *dw++ = cos(phi); @@ -233,7 +233,7 @@ double delta, phi; double cd, sd, cd2, cd3, sd2, csd, cp, sp, cp2, sp2, cp3, sp3, cp4, sp4; double *dw = x->x_transp; - int index; + int xindex; int order=x->x_n_order;
if(argc < 3) @@ -241,24 +241,24 @@ post("bin_ambi_reduced_decode_fft2 ERROR: ls-input needs 1 index and 2 angles: ls index + delta [degree] + phi [degree]"); return; } - index = (int)atom_getint(argv++) - 1; + xindex = (int)atom_getint(argv++) - 1; delta = atom_getfloat(argv++); phi = atom_getfloat(argv);
- if(index < 0) - index = 0; + if(xindex < 0) + xindex = 0; if(mode == BIN_AMBI_LS_REAL) { - if(index >= x->x_n_real_ls) - index = x->x_n_real_ls - 1; + if(xindex >= x->x_n_real_ls) + xindex = x->x_n_real_ls - 1; } else if(mode == BIN_AMBI_LS_PHT) { if(x->x_n_pht_ls) { - if(index >= x->x_n_pht_ls) - index = x->x_n_pht_ls - 1; - index += x->x_n_real_ls; + if(xindex >= x->x_n_pht_ls) + xindex = x->x_n_pht_ls - 1; + xindex += x->x_n_real_ls; } else return; @@ -266,14 +266,14 @@ else return;
- bin_ambi_reduced_decode_fft2_convert(x, &delta, &phi, index); + bin_ambi_reduced_decode_fft2_convert(x, &delta, &phi, xindex);
cd = cos(delta); sd = sin(delta); cp = cos(phi); sp = sin(phi);
- dw += index * x->x_n_ambi; + dw += xindex * x->x_n_ambi;
*dw++ = 1.0;
@@ -637,7 +637,7 @@ } }
- post("matrix_inverse nonsingular"); + post("matrix_inverse regular"); x->x_seq_ok = 1; }
@@ -715,7 +715,7 @@
static void bin_ambi_reduced_decode_fft2_load_HRIR(t_bin_ambi_reduced_decode_fft2 *x, t_symbol *s, int argc, t_atom *argv) { - int index; + int xindex; t_symbol *hrirname;
if(argc < 2) @@ -723,38 +723,38 @@ post("bin_ambi_reduced_decode_fft2 ERROR: load_HRIR needs 1 index and 1 HRIR-wav"); return; } - index = (int)atom_getint(argv++) - 1; + xindex = (int)atom_getint(argv++) - 1; hrirname = atom_getsymbol(argv); - if(index < 0) - index = 0; - if(index >= x->x_n_real_ls) - index = x->x_n_real_ls - 1; - x->x_hrir_filename[index] = hrirname; + if(xindex < 0) + xindex = 0; + if(xindex >= x->x_n_real_ls) + xindex = x->x_n_real_ls - 1; + x->x_hrir_filename[xindex] = hrirname;
- SETSYMBOL(x->x_at, x->x_hrir_filename[index]); - SETSYMBOL(x->x_at+1, x->x_s_hrir[index]); + SETSYMBOL(x->x_at, x->x_hrir_filename[xindex]); + SETSYMBOL(x->x_at+1, x->x_s_hrir[xindex]); outlet_list(x->x_obj.ob_outlet, &s_list, 2, x->x_at); }
static void bin_ambi_reduced_decode_fft2_check_HRIR_arrays(t_bin_ambi_reduced_decode_fft2 *x, t_floatarg findex) { - int index=(int)findex - 1; + int xindex=(int)findex - 1; int j, k, n; int fftsize = x->x_fftsize; int fs2=fftsize/2; t_garray *a; int npoints; t_symbol *hrir; - t_float*vec; + t_float *vec; iemarray_t *vec_hrir, *vec_fade_out_hrir; t_float decr, sum;
- if(index < 0) - index = 0; - if(index >= x->x_n_real_ls) - index = x->x_n_real_ls - 1; + if(xindex < 0) + xindex = 0; + if(xindex >= x->x_n_real_ls) + xindex = x->x_n_real_ls - 1;
- hrir = x->x_s_hrir[index]; + hrir = x->x_s_hrir[xindex]; if (!(a = (t_garray *)pd_findbyclass(hrir, garray_class))) error("%s: no such array", hrir->s_name); else if (!iemarray_getarray(a, &npoints, &vec_hrir)) @@ -766,7 +766,7 @@ post("bin_ambi_reduced_decode_fft2-WARNING: %s-array-size: %d < FFT-size: %d", hrir->s_name, npoints, fftsize); } vec = x->x_beg_hrir; - vec += index * fftsize; + vec += xindex * fftsize;
if(x->x_beg_fade_out_hrir) { @@ -794,20 +794,20 @@
static void bin_ambi_reduced_decode_fft2_check_HRTF_arrays(t_bin_ambi_reduced_decode_fft2 *x, t_floatarg findex) { - int index=(int)findex - 1; + int xindex=(int)findex - 1; t_garray *a; int npoints; int fftsize = x->x_fftsize; iemarray_t *vec_hrtf_re, *vec_hrtf_im; t_symbol *hrtf_re, *hrtf_im;
- if(index < 0) - index = 0; - if(index >= x->x_n_ambi) - index = x->x_n_ambi - 1; + if(xindex < 0) + xindex = 0; + if(xindex >= x->x_n_ambi) + xindex = x->x_n_ambi - 1;
- hrtf_re = x->x_s_hrtf_re[index]; - hrtf_im = x->x_s_hrtf_im[index]; + hrtf_re = x->x_s_hrtf_re[xindex]; + hrtf_im = x->x_s_hrtf_im[xindex];
if (!(a = (t_garray *)pd_findbyclass(hrtf_re, garray_class))) error("%s: no such array", hrtf_re->s_name); @@ -823,14 +823,14 @@ error("%s: bad array-size: %d", hrtf_im->s_name, npoints); else { - x->x_beg_hrtf_re[index] = vec_hrtf_re; - x->x_beg_hrtf_im[index] = vec_hrtf_im; + x->x_beg_hrtf_re[xindex] = vec_hrtf_re; + x->x_beg_hrtf_im[xindex] = vec_hrtf_im; } }
static void bin_ambi_reduced_decode_fft2_calc_reduced(t_bin_ambi_reduced_decode_fft2 *x, t_floatarg findex) { - int index=(int)findex - 1; + int xindex=(int)findex - 1; int i, j, k, w_index, w_inc, i_inc, v_index, fs1, fs2; int fftsize = x->x_fftsize; BIN_AMBI_COMPLEX old1, old2, w; @@ -845,15 +845,15 @@
if(x->x_seq_ok) { - if(index < 0) - index = 0; - if(index >= n_ambi) - index = n_ambi - 1; + if(xindex < 0) + xindex = 0; + if(xindex >= n_ambi) + xindex = n_ambi - 1;
- vec_hrtf_re = x->x_beg_hrtf_re[index]; - vec_hrtf_im = x->x_beg_hrtf_im[index]; + vec_hrtf_re = x->x_beg_hrtf_re[xindex]; + vec_hrtf_im = x->x_beg_hrtf_im[xindex];
- dv = db + index; + dv = db + xindex; mul = (t_float)(*dv); vec_hrir = x->x_beg_hrir; for(k=0; k<fftsize; k++)/*first step of acumulating the HRIRs*/ @@ -919,17 +919,18 @@ val[i] = old1; } } - for(i = 0; i<fs2; i++) + iemarray_setfloat(vec_hrtf_re, 0, val[0].real); + for(i = 1; i<fs2; i++) { - iemarray_getfloat(vec_hrtf_re, i) = val[i].real; - iemarray_getfloat(vec_hrtf_im, i) = val[i].imag; + iemarray_setfloat(vec_hrtf_re, i, val[i].real); + iemarray_setfloat(vec_hrtf_im, i, val[i].imag); } - iemarray_getfloat(vec_hrtf_re, fs2) = val[fs2].real; - iemarray_getfloat(vec_hrtf_im, fs2) = 0.0f; + iemarray_setfloat(vec_hrtf_re, fs2, val[fs2].real); + iemarray_setfloat(vec_hrtf_im, fs2, 0.0f); for(i = fs2+1; i < fftsize; i++) { - iemarray_getfloat(vec_hrtf_re, i) = 0.0f; - iemarray_getfloat(vec_hrtf_im, i) = 0.0f; + iemarray_setfloat(vec_hrtf_re, i, 0.0f); + iemarray_setfloat(vec_hrtf_im, i, 0.0f); } } } @@ -1134,8 +1135,8 @@ freebytes(x->x_sin_cos, x->x_fftsize * sizeof(BIN_AMBI_COMPLEX));
freebytes(x->x_beg_hrir, x->x_fftsize * x->x_n_real_ls * sizeof(t_float)); - freebytes(x->x_beg_hrtf_re, x->x_n_ambi * sizeof(t_float *)); - freebytes(x->x_beg_hrtf_im, x->x_n_ambi * sizeof(t_float *)); + freebytes(x->x_beg_hrtf_re, x->x_n_ambi * sizeof(iemarray_t *)); + freebytes(x->x_beg_hrtf_im, x->x_n_ambi * sizeof(iemarray_t *)); }
/*
Modified: trunk/externals/iem/iem_bin_ambi/src/bin_ambi_reduced_decode_fir.c =================================================================== --- trunk/externals/iem/iem_bin_ambi/src/bin_ambi_reduced_decode_fir.c 2009-02-01 07:29:03 UTC (rev 10707) +++ trunk/externals/iem/iem_bin_ambi/src/bin_ambi_reduced_decode_fir.c 2009-02-01 07:30:18 UTC (rev 10708) @@ -1,7 +1,7 @@ /* For information on usage and redistribution, and for a DISCLAIMER OF ALL * WARRANTIES, see the file, "LICENSE.txt," in this distribution.
-iem_bin_ambi written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2006 */ +iem_bin_ambi written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2009 */
#include "m_pd.h" #include "iemlib.h" @@ -53,7 +53,7 @@ int *x_phi_sym; int *x_sym_flag; iemarray_t *x_beg_fade_out_hrir; - float *x_beg_hrir; + t_float *x_beg_hrir; iemarray_t **x_beg_hrir_red; t_symbol **x_hrir_filename; t_symbol **x_s_hrir; @@ -76,7 +76,7 @@
static t_class *bin_ambi_reduced_decode_fir_class;
-static void bin_ambi_reduced_decode_fir_quant(t_bin_ambi_reduced_decode_fir *x, double *delta_deg2rad, double *phi_deg2rad, int index) +static void bin_ambi_reduced_decode_fir_quant(t_bin_ambi_reduced_decode_fir *x, double *delta_deg2rad, double *phi_deg2rad, int xindex) { double q = 1.0; double d = *delta_deg2rad; @@ -172,8 +172,8 @@ p = (double)i; *phi_deg2rad = p;
- x->x_delta[index] = (int)(*delta_deg2rad); - x->x_phi[index] = i; + x->x_delta[xindex] = (int)(*delta_deg2rad); + x->x_phi[xindex] = i;
*delta_deg2rad *= x->x_pi_over_180; *phi_deg2rad *= x->x_pi_over_180; @@ -183,7 +183,7 @@ { double delta=0.0, phi; double *dw = x->x_transp; - int index; + int xindex; int order=x->x_n_order;
if(argc < 2) @@ -191,23 +191,23 @@ post("bin_ambi_reduced_decode_fir ERROR: ls-input needs 1 index and 1 angle: ls_index + phi [degree]"); return; } - index = (int)atom_getint(argv++) - 1; + xindex = (int)atom_getint(argv++) - 1; phi = (double)atom_getfloat(argv);
- if(index < 0) - index = 0; + if(xindex < 0) + xindex = 0; if(mode == BIN_AMBI_LS_IND) { - if(index >= x->x_n_ind_ls) - index = x->x_n_ind_ls - 1; + if(xindex >= x->x_n_ind_ls) + xindex = x->x_n_ind_ls - 1; } else if(mode == BIN_AMBI_LS_MRG) { if(x->x_n_mrg_mir_ls) { - if(index >= x->x_n_mrg_mir_ls) - index = x->x_n_mrg_mir_ls - 1; - index += x->x_n_ind_ls; + if(xindex >= x->x_n_mrg_mir_ls) + xindex = x->x_n_mrg_mir_ls - 1; + xindex += x->x_n_ind_ls; } else return; @@ -216,10 +216,10 @@ { if(x->x_n_mrg_mir_ls) { - if(index >= x->x_n_mrg_mir_ls) - index = x->x_n_mrg_mir_ls - 1; - index += x->x_n_ind_ls; - index += x->x_n_mrg_mir_ls; + if(xindex >= x->x_n_mrg_mir_ls) + xindex = x->x_n_mrg_mir_ls - 1; + xindex += x->x_n_ind_ls; + xindex += x->x_n_mrg_mir_ls; } else return; @@ -228,10 +228,10 @@ { if(x->x_n_ph_ls) { - if(index >= x->x_n_ph_ls) - index = x->x_n_ph_ls - 1; - index += x->x_n_ind_ls; - index += 2*x->x_n_mrg_mir_ls; + if(xindex >= x->x_n_ph_ls) + xindex = x->x_n_ph_ls - 1; + xindex += x->x_n_ind_ls; + xindex += 2*x->x_n_mrg_mir_ls; } else return; @@ -239,9 +239,9 @@ else return;
- bin_ambi_reduced_decode_fir_quant(x, &delta, &phi, index); + bin_ambi_reduced_decode_fir_quant(x, &delta, &phi, xindex);
- dw += index * x->x_n_ambi; + dw += xindex * x->x_n_ambi;
*dw++ = 1.0; *dw++ = cos(phi); @@ -318,7 +318,7 @@ double delta, phi; double cd, sd, cd2, cd3, sd2, csd, cp, sp, cp2, sp2, cp3, sp3, cp4, sp4; double *dw = x->x_transp; - int index; + int xindex; int order=x->x_n_order;
if(argc < 3) @@ -326,24 +326,24 @@ post("bin_ambi_reduced_decode_fir ERROR: ls-input needs 1 index and 2 angles: ls index + delta [degree] + phi [degree]"); return; } - index = (int)atom_getint(argv++) - 1; + xindex = (int)atom_getint(argv++) - 1; delta = atom_getfloat(argv++); phi = atom_getfloat(argv);
- if(index < 0) - index = 0; + if(xindex < 0) + xindex = 0; if(mode == BIN_AMBI_LS_IND) { - if(index >= x->x_n_ind_ls) - index = x->x_n_ind_ls - 1; + if(xindex >= x->x_n_ind_ls) + xindex = x->x_n_ind_ls - 1; } else if(mode == BIN_AMBI_LS_MRG) { if(x->x_n_mrg_mir_ls) { - if(index >= x->x_n_mrg_mir_ls) - index = x->x_n_mrg_mir_ls - 1; - index += x->x_n_ind_ls; + if(xindex >= x->x_n_mrg_mir_ls) + xindex = x->x_n_mrg_mir_ls - 1; + xindex += x->x_n_ind_ls; } else return; @@ -352,10 +352,10 @@ { if(x->x_n_mrg_mir_ls) { - if(index >= x->x_n_mrg_mir_ls) - index = x->x_n_mrg_mir_ls - 1; - index += x->x_n_ind_ls; - index += x->x_n_mrg_mir_ls; + if(xindex >= x->x_n_mrg_mir_ls) + xindex = x->x_n_mrg_mir_ls - 1; + xindex += x->x_n_ind_ls; + xindex += x->x_n_mrg_mir_ls; } else return; @@ -364,10 +364,10 @@ { if(x->x_n_ph_ls) { - if(index >= x->x_n_ph_ls) - index = x->x_n_ph_ls - 1; - index += x->x_n_ind_ls; - index += 2*x->x_n_mrg_mir_ls; + if(xindex >= x->x_n_ph_ls) + xindex = x->x_n_ph_ls - 1; + xindex += x->x_n_ind_ls; + xindex += 2*x->x_n_mrg_mir_ls; } else return; @@ -375,14 +375,14 @@ else return; - bin_ambi_reduced_decode_fir_quant(x, &delta, &phi, index); + bin_ambi_reduced_decode_fir_quant(x, &delta, &phi, xindex);
cd = cos(delta); sd = sin(delta); cp = cos(phi); sp = sin(phi); - dw += index * x->x_n_ambi; + dw += xindex * x->x_n_ambi;
*dw++ = 1.0;
@@ -726,7 +726,7 @@ nz = bin_ambi_reduced_decode_fir_eval_which_element_of_col_not_zero(x, i, i); if(nz < 0) { - post("bin_ambi_reduced_decode_fir ERROR: matrix not regular !!!!"); + post("bin_ambi_reduced_decode_fir ERROR: matrix singular !!!!"); x->x_seq_ok = 0; return; } @@ -795,38 +795,38 @@ n_ambi rows; */
-static void bin_ambi_reduced_decode_fir_load_HRIR(t_bin_ambi_reduced_decode_fir *x, float findex) +static void bin_ambi_reduced_decode_fir_load_HRIR(t_bin_ambi_reduced_decode_fir *x, t_float findex) { - int index=(int)findex - 1; + int xindex=(int)findex - 1; int p; char buf[60];
- if(index < 0) - index = 0; - if(index >= (x->x_n_ind_ls + x->x_n_mrg_mir_ls)) - index = x->x_n_ind_ls + x->x_n_mrg_mir_ls - 1; + if(xindex < 0) + xindex = 0; + if(xindex >= (x->x_n_ind_ls + x->x_n_mrg_mir_ls)) + xindex = x->x_n_ind_ls + x->x_n_mrg_mir_ls - 1;
- p = x->x_phi[index]; + p = x->x_phi[xindex];
if(p)/*change*/ p = 360 - p;
if(p < 10) - sprintf(buf, "L%de00%da.wav", x->x_delta[index], p); + sprintf(buf, "L%de00%da.wav", x->x_delta[xindex], p); else if(p < 100) - sprintf(buf, "L%de0%da.wav", x->x_delta[index], p); + sprintf(buf, "L%de0%da.wav", x->x_delta[xindex], p); else - sprintf(buf, "L%de%da.wav", x->x_delta[index], p); - x->x_hrir_filename[index] = gensym(buf); + sprintf(buf, "L%de%da.wav", x->x_delta[xindex], p); + x->x_hrir_filename[xindex] = gensym(buf);
- SETSYMBOL(x->x_at, x->x_hrir_filename[index]); - SETSYMBOL(x->x_at+1, x->x_s_hrir[index]); + SETSYMBOL(x->x_at, x->x_hrir_filename[xindex]); + SETSYMBOL(x->x_at+1, x->x_s_hrir[xindex]); outlet_list(x->x_obj.ob_outlet, &s_list, 2, x->x_at); }
-static void bin_ambi_reduced_decode_fir_check_HRIR_LS_arrays(t_bin_ambi_reduced_decode_fir *x, float findex) +static void bin_ambi_reduced_decode_fir_check_HRIR_LS_arrays(t_bin_ambi_reduced_decode_fir *x, t_float findex) { - int index=(int)findex - 1; + int xindex=(int)findex - 1; int j, k, n; int firsize = x->x_firsize; int fs2=firsize/2; @@ -836,14 +836,14 @@ iemarray_t *vec_hrir; t_float *vec; iemarray_t *vec_fade_out_hrir; - float decr, sum; + t_float decr, sum;
- if(index < 0) - index = 0; - if(index >= (x->x_n_ind_ls + x->x_n_mrg_mir_ls)) - index = x->x_n_ind_ls + x->x_n_mrg_mir_ls - 1; + if(xindex < 0) + xindex = 0; + if(xindex >= (x->x_n_ind_ls + x->x_n_mrg_mir_ls)) + xindex = x->x_n_ind_ls + x->x_n_mrg_mir_ls - 1;
- hrir = x->x_s_hrir[index]; + hrir = x->x_s_hrir[xindex]; if (!(a = (t_garray *)pd_findbyclass(hrir, garray_class))) error("%s: no such array", hrir->s_name); else if (!iemarray_getarray(a, &npoints, &vec_hrir)) @@ -855,7 +855,7 @@ post("bin_ambi_reduced_decode_fir-WARNING: %s-array-size: %d < FFT-size: %d", hrir->s_name, npoints, firsize); } vec = x->x_beg_hrir; - vec += index * firsize; + vec += xindex * firsize; if(x->x_beg_fade_out_hrir) { @@ -871,7 +871,7 @@ for(j=0; j<n; j++) vec[j] = iemarray_getfloat(vec_hrir,j); sum = 1.0f; - decr = 4.0f / (float)fs2; + decr = 4.0f / (t_float)fs2; for(j=n, k=0; j<fs2; j++, k++) { sum -= decr; @@ -881,21 +881,21 @@ } }
-static void bin_ambi_reduced_decode_fir_check_HRIR_RED_arrays(t_bin_ambi_reduced_decode_fir *x, float findex) +static void bin_ambi_reduced_decode_fir_check_HRIR_RED_arrays(t_bin_ambi_reduced_decode_fir *x, t_float findex) { - int index=(int)findex - 1; + int xindex=(int)findex - 1; t_garray *a; int npoints; int firsize = x->x_firsize; iemarray_t *vec_hrir_red; t_symbol *hrir_red;
- if(index < 0) - index = 0; - if(index >= x->x_n_ambi) - index = x->x_n_ambi - 1; + if(xindex < 0) + xindex = 0; + if(xindex >= x->x_n_ambi) + xindex = x->x_n_ambi - 1;
- hrir_red = x->x_s_hrir_red[index]; + hrir_red = x->x_s_hrir_red[xindex];
if (!(a = (t_garray *)pd_findbyclass(hrir_red, garray_class))) error("%s: no such array", hrir_red->s_name); @@ -905,48 +905,46 @@ error("%s: bad array-size: %d", hrir_red->s_name, npoints); else { - x->x_beg_hrir_red[index] = vec_hrir_red; + x->x_beg_hrir_red[xindex] = vec_hrir_red; } }
-static void bin_ambi_reduced_decode_fir_calc_reduced(t_bin_ambi_reduced_decode_fir *x, float findex) +static void bin_ambi_reduced_decode_fir_calc_reduced(t_bin_ambi_reduced_decode_fir *x, t_float findex) { - int index=(int)findex - 1; + int xindex=(int)findex - 1; int i, j; int firsize = x->x_firsize; t_float *vec_hrir; - iemarray_t*vec_hrir_red; + iemarray_t *vec_hrir_red; double *dv; int n_ambi = x->x_n_ambi; int n_ls = x->x_n_ind_ls + x->x_n_mrg_mir_ls; - float mul; + t_float mul;
if(x->x_seq_ok) { - if(index < 0) - index = 0; - if(index >= n_ambi) - index = n_ambi - 1; + if(xindex < 0) + xindex = 0; + if(xindex >= n_ambi) + xindex = n_ambi - 1;
- vec_hrir_red = x->x_beg_hrir_red[index]; + vec_hrir_red = x->x_beg_hrir_red[xindex];
- dv = x->x_prod3 + index; - mul = (float)(*dv); + dv = x->x_prod3 + xindex; + mul = (t_float)(*dv); vec_hrir = x->x_beg_hrir; for(i=0; i<firsize; i++)/*first step of acumulating the HRIRs*/ - { - iemarray_getfloat(vec_hrir_red,i) = mul * vec_hrir[i]; - } + iemarray_setfloat(vec_hrir_red, i, mul*vec_hrir[i]);
for(j=1; j<n_ls; j++) { dv += n_ambi; - mul = (float)(*dv); + mul = (t_float)(*dv); vec_hrir = x->x_beg_hrir; vec_hrir += j * firsize; for(i=0; i<firsize; i++) { - iemarray_getfloat(vec_hrir_red,i) += mul * vec_hrir[i]; + iemarray_setfloat(vec_hrir_red, i, iemarray_getfloat(vec_hrir_red, i)+mul*vec_hrir[i]); } } } @@ -1073,7 +1071,7 @@ SETFLOAT(x->x_at, 1.0f); else if(plus_minus[i] == '-') SETFLOAT(x->x_at, 2.0f); - SETFLOAT(x->x_at+1, (float)(i+1)); + SETFLOAT(x->x_at+1, (t_float)(i+1)); outlet_list(x->x_out_sign_sum, &s_list, 2, x->x_at); } } @@ -1152,8 +1150,8 @@ freebytes(x->x_phi_sym, (x->x_n_ind_ls+x->x_n_mrg_mir_ls) * sizeof(int)); freebytes(x->x_sym_flag, (x->x_n_ind_ls+x->x_n_mrg_mir_ls) * sizeof(int));
- freebytes(x->x_beg_hrir, x->x_firsize * (x->x_n_ind_ls+x->x_n_mrg_mir_ls) * sizeof(float)); - freebytes(x->x_beg_hrir_red, x->x_n_ambi * sizeof(float *)); + freebytes(x->x_beg_hrir, x->x_firsize * (x->x_n_ind_ls+x->x_n_mrg_mir_ls) * sizeof(t_float)); + freebytes(x->x_beg_hrir_red, x->x_n_ambi * sizeof(iemarray_t *)); }
/* @@ -1310,7 +1308,7 @@ x->x_sym_flag = (int *)getbytes((x->x_n_ind_ls+x->x_n_mrg_mir_ls) * sizeof(int));
x->x_beg_fade_out_hrir = 0; - x->x_beg_hrir = (float *)getbytes(x->x_firsize * (x->x_n_ind_ls+x->x_n_mrg_mir_ls) * sizeof(float)); + x->x_beg_hrir = (t_float *)getbytes(x->x_firsize * (x->x_n_ind_ls+x->x_n_mrg_mir_ls) * sizeof(t_float)); x->x_beg_hrir_red = (iemarray_t **)getbytes(x->x_n_ambi * sizeof(iemarray_t *)); x->x_sqrt3 = sqrt(3.0);
Modified: trunk/externals/iem/iem_bin_ambi/src/bin_ambi_reduced_decode_fir2.c =================================================================== --- trunk/externals/iem/iem_bin_ambi/src/bin_ambi_reduced_decode_fir2.c 2009-02-01 07:29:03 UTC (rev 10707) +++ trunk/externals/iem/iem_bin_ambi/src/bin_ambi_reduced_decode_fir2.c 2009-02-01 07:30:18 UTC (rev 10708) @@ -1,7 +1,7 @@ /* For information on usage and redistribution, and for a DISCLAIMER OF ALL * WARRANTIES, see the file, "LICENSE.txt," in this distribution.
-iem_bin_ambi written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2006 */ +iem_bin_ambi written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2009 */
#include "m_pd.h" #include "iemlib.h" @@ -75,7 +75,7 @@
static t_class *bin_ambi_reduced_decode_fir2_class;
-static void bin_ambi_reduced_decode_fir2_convert(t_bin_ambi_reduced_decode_fir2 *x, double *delta_deg2rad, double *phi_deg2rad, int index) +static void bin_ambi_reduced_decode_fir2_convert(t_bin_ambi_reduced_decode_fir2 *x, double *delta_deg2rad, double *phi_deg2rad, int xindex) { double q = 1.0; double d = *delta_deg2rad; @@ -91,8 +91,8 @@ while(p >= 360.0) p -= 360.0;
- x->x_delta[index] = (int)(d); - x->x_phi[index] = (int)(p); + x->x_delta[xindex] = (int)(d); + x->x_phi[xindex] = (int)(p);
*delta_deg2rad = d*x->x_pi_over_180; *phi_deg2rad = p*x->x_pi_over_180; @@ -102,7 +102,7 @@ { double delta=0.0, phi; double *dw = x->x_transp; - int index; + int xindex; int order=x->x_n_order;
if(argc < 2) @@ -110,23 +110,23 @@ post("bin_ambi_reduced_decode_fir2 ERROR: ls-input needs 1 index and 1 angle: ls_index + phi [degree]"); return; } - index = (int)atom_getint(argv++) - 1; + xindex = (int)atom_getint(argv++) - 1; phi = (double)atom_getfloat(argv);
- if(index < 0) - index = 0; + if(xindex < 0) + xindex = 0; if(mode == BIN_AMBI_LS_REAL) { - if(index >= x->x_n_real_ls) - index = x->x_n_real_ls - 1; + if(xindex >= x->x_n_real_ls) + xindex = x->x_n_real_ls - 1; } else if(mode == BIN_AMBI_LS_PHT) { if(x->x_n_pht_ls) { - if(index >= x->x_n_pht_ls) - index = x->x_n_pht_ls - 1; - index += x->x_n_real_ls; + if(xindex >= x->x_n_pht_ls) + xindex = x->x_n_pht_ls - 1; + xindex += x->x_n_real_ls; } else return; @@ -134,9 +134,9 @@ else return;
- bin_ambi_reduced_decode_fir2_convert(x, &delta, &phi, index); + bin_ambi_reduced_decode_fir2_convert(x, &delta, &phi, xindex);
- dw += index * x->x_n_ambi; + dw += xindex * x->x_n_ambi;
*dw++ = 1.0; *dw++ = cos(phi); @@ -213,7 +213,7 @@ double delta, phi; double cd, sd, cd2, cd3, sd2, csd, cp, sp, cp2, sp2, cp3, sp3, cp4, sp4; double *dw = x->x_transp; - int index; + int xindex; int order=x->x_n_order;
if(argc < 3) @@ -221,24 +221,24 @@ post("bin_ambi_reduced_decode_fir2 ERROR: ls-input needs 1 index and 2 angles: ls index + delta [degree] + phi [degree]"); return; } - index = (int)atom_getint(argv++) - 1; + xindex = (int)atom_getint(argv++) - 1; delta = atom_getfloat(argv++); phi = atom_getfloat(argv);
- if(index < 0) - index = 0; + if(xindex < 0) + xindex = 0; if(mode == BIN_AMBI_LS_REAL) { - if(index >= x->x_n_real_ls) - index = x->x_n_real_ls - 1; + if(xindex >= x->x_n_real_ls) + xindex = x->x_n_real_ls - 1; } else if(mode == BIN_AMBI_LS_PHT) { if(x->x_n_pht_ls) { - if(index >= x->x_n_pht_ls) - index = x->x_n_pht_ls - 1; - index += x->x_n_real_ls; + if(xindex >= x->x_n_pht_ls) + xindex = x->x_n_pht_ls - 1; + xindex += x->x_n_real_ls; } else return; @@ -246,14 +246,14 @@ else return; - bin_ambi_reduced_decode_fir2_convert(x, &delta, &phi, index); + bin_ambi_reduced_decode_fir2_convert(x, &delta, &phi, xindex);
cd = cos(delta); sd = sin(delta); cp = cos(phi); sp = sin(phi); - dw += index * x->x_n_ambi; + dw += xindex * x->x_n_ambi;
*dw++ = 1.0;
@@ -616,7 +616,7 @@ } }
- post("matrix_inverse nonsingular"); + post("matrix_inverse regular"); x->x_seq_ok = 1; }
@@ -694,7 +694,7 @@
static void bin_ambi_reduced_decode_fir2_load_HRIR(t_bin_ambi_reduced_decode_fir2 *x, t_symbol *s, int argc, t_atom *argv) { - int index; + int xindex; t_symbol *hrirname;
if(argc < 2) @@ -702,22 +702,22 @@ post("bin_ambi_reduced_decode_fir2 ERROR: load_HRIR needs 1 index and 1 HRIR-wav"); return; } - index = (int)atom_getint(argv++) - 1; + xindex = (int)atom_getint(argv++) - 1; hrirname = atom_getsymbol(argv); - if(index < 0) - index = 0; - if(index >= x->x_n_real_ls) - index = x->x_n_real_ls - 1; - x->x_hrir_filename[index] = hrirname; + if(xindex < 0) + xindex = 0; + if(xindex >= x->x_n_real_ls) + xindex = x->x_n_real_ls - 1; + x->x_hrir_filename[xindex] = hrirname;
- SETSYMBOL(x->x_at, x->x_hrir_filename[index]); - SETSYMBOL(x->x_at+1, x->x_s_hrir[index]); + SETSYMBOL(x->x_at, x->x_hrir_filename[xindex]); + SETSYMBOL(x->x_at+1, x->x_s_hrir[xindex]); outlet_list(x->x_obj.ob_outlet, &s_list, 2, x->x_at); }
static void bin_ambi_reduced_decode_fir2_check_HRIR_arrays(t_bin_ambi_reduced_decode_fir2 *x, t_floatarg findex) { - int index=(int)findex - 1; + int xindex=(int)findex - 1; int j, k, n; int firsize = x->x_firsize; t_garray *a; @@ -727,12 +727,12 @@ iemarray_t *vec_hrir, *vec_fade_out_hrir; t_float decr, sum;
- if(index < 0) - index = 0; - if(index >= x->x_n_real_ls) - index = x->x_n_real_ls - 1; + if(xindex < 0) + xindex = 0; + if(xindex >= x->x_n_real_ls) + xindex = x->x_n_real_ls - 1;
- hrir = x->x_s_hrir[index]; + hrir = x->x_s_hrir[xindex]; if (!(a = (t_garray *)pd_findbyclass(hrir, garray_class))) error("%s: no such array", hrir->s_name); else if (!iemarray_getarray(a, &npoints, &vec_hrir)) @@ -744,7 +744,7 @@ post("bin_ambi_reduced_decode_fir2-WARNING: %s-array-size: %d < FIR-size: %d", hrir->s_name, npoints, firsize); } vec = x->x_beg_hrir; - vec += index * firsize; + vec += xindex * firsize; if(x->x_beg_fade_out_hrir) { @@ -772,19 +772,19 @@
static void bin_ambi_reduced_decode_fir2_check_HRIR_RED_arrays(t_bin_ambi_reduced_decode_fir2 *x, t_floatarg findex) { - int index=(int)findex - 1; + int xindex=(int)findex - 1; t_garray *a; int npoints; int firsize = x->x_firsize; iemarray_t *vec_hrir_red; t_symbol *hrir_red;
- if(index < 0) - index = 0; - if(index >= x->x_n_ambi) - index = x->x_n_ambi - 1; + if(xindex < 0) + xindex = 0; + if(xindex >= x->x_n_ambi) + xindex = x->x_n_ambi - 1;
- hrir_red = x->x_s_hrir_red[index]; + hrir_red = x->x_s_hrir_red[xindex];
if (!(a = (t_garray *)pd_findbyclass(hrir_red, garray_class))) error("%s: no such array", hrir_red->s_name); @@ -794,17 +794,17 @@ error("%s: bad array-size: %d", hrir_red->s_name, npoints); else { - x->x_beg_hrir_red[index] = vec_hrir_red; + x->x_beg_hrir_red[xindex] = vec_hrir_red; } }
static void bin_ambi_reduced_decode_fir2_calc_reduced(t_bin_ambi_reduced_decode_fir2 *x, t_floatarg findex) { - int index=(int)findex - 1; + int xindex=(int)findex - 1; int i, j; int firsize = x->x_firsize; t_float *vec_hrir; - iemarray_t*vec_hrir_red; + iemarray_t *vec_hrir_red; double *dv; int n_ambi = x->x_n_ambi; int n_ls = x->x_n_real_ls; @@ -812,20 +812,18 @@
if(x->x_seq_ok) { - if(index < 0) - index = 0; - if(index >= n_ambi) - index = n_ambi - 1; + if(xindex < 0) + xindex = 0; + if(xindex >= n_ambi) + xindex = n_ambi - 1;
- vec_hrir_red = x->x_beg_hrir_red[index]; + vec_hrir_red = x->x_beg_hrir_red[xindex];
- dv = x->x_prod3 + index; + dv = x->x_prod3 + xindex; mul = (t_float)(*dv); vec_hrir = x->x_beg_hrir; for(i=0; i<firsize; i++)/*first step of acumulating the HRIRs*/ - { - iemarray_getfloat(vec_hrir_red,i) = mul * vec_hrir[i]; - } + iemarray_setfloat(vec_hrir_red, i, mul*vec_hrir[i]);
for(j=1; j<n_ls; j++) { @@ -835,9 +833,7 @@ vec_hrir += j * firsize;
for(i=0; i<firsize; i++) - { - iemarray_getfloat(vec_hrir_red,i) += mul * vec_hrir[i]; - } + iemarray_setfloat(vec_hrir_red, i, iemarray_getfloat(vec_hrir_red, i)+mul*vec_hrir[i]); } } } @@ -1038,7 +1034,7 @@ freebytes(x->x_sym_flag, x->x_n_real_ls * sizeof(int));
freebytes(x->x_beg_hrir, x->x_firsize * x->x_n_real_ls * sizeof(t_float)); - freebytes(x->x_beg_hrir_red, x->x_n_ambi * sizeof(t_float *)); + freebytes(x->x_beg_hrir_red, x->x_n_ambi * sizeof(iemarray_t *)); }
/*
Modified: trunk/externals/iem/iem_bin_ambi/src/iem_bin_ambi.c =================================================================== --- trunk/externals/iem/iem_bin_ambi/src/iem_bin_ambi.c 2009-02-01 07:29:03 UTC (rev 10707) +++ trunk/externals/iem/iem_bin_ambi/src/iem_bin_ambi.c 2009-02-01 07:30:18 UTC (rev 10708) @@ -1,7 +1,7 @@ /* For information on usage and redistribution, and for a DISCLAIMER OF ALL * WARRANTIES, see the file, "LICENSE.txt," in this distribution.
-iem_bin_ambi written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2006 */ +iem_bin_ambi written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2009 */
#include "m_pd.h" @@ -36,6 +36,6 @@ bin_ambi_reduced_decode_fft2_setup(); bin_ambi_reduced_decode_fir2_setup();
- post("iem_bin_ambi (R-1.17) library loaded! (c) Thomas Musil 11.2006"); + post("iem_bin_ambi (R-1.18) library loaded! (c) Thomas Musil 01.2009"); post(" musil%ciem.at iem KUG Graz Austria", '@'); }
Modified: trunk/externals/iem/iem_bin_ambi/src/iem_bin_ambi.h =================================================================== --- trunk/externals/iem/iem_bin_ambi/src/iem_bin_ambi.h 2009-02-01 07:29:03 UTC (rev 10707) +++ trunk/externals/iem/iem_bin_ambi/src/iem_bin_ambi.h 2009-02-01 07:30:18 UTC (rev 10708) @@ -1,7 +1,7 @@ /* For information on usage and redistribution, and for a DISCLAIMER OF ALL * WARRANTIES, see the file, "LICENSE.txt," in this distribution.
-iem_bin_ambi written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2006 */ +iem_bin_ambi written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2009 */
#ifndef __IEMBINAMBI_H__ #define __IEMBINAMBI_H__
Modified: trunk/externals/iem/iem_bin_ambi/src/iemlib.h =================================================================== --- trunk/externals/iem/iem_bin_ambi/src/iemlib.h 2009-02-01 07:29:03 UTC (rev 10707) +++ trunk/externals/iem/iem_bin_ambi/src/iemlib.h 2009-02-01 07:30:18 UTC (rev 10708) @@ -1,7 +1,7 @@ /* For information on usage and redistribution, and for a DISCLAIMER OF ALL * WARRANTIES, see the file, "LICENSE.txt," in this distribution.
-iemlib written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2007 */ +iemlib written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2009 */
#ifndef __IEMLIB_H__ #define __IEMLIB_H__ @@ -99,16 +99,18 @@
#endif
- /* on 64bit systems we cannot use garray_getfloatarray... */ #if (defined __x86_64__) # define iemarray_t t_word # define iemarray_getarray garray_getfloatwords # define iemarray_getfloat(pointer, index) (pointer[index].w_float) +# define iemarray_setfloat(pointer, index, fvalue) (pointer[index].w_float = fvalue) #else # define iemarray_t t_float # define iemarray_getarray garray_getfloatarray # define iemarray_getfloat(pointer, index) (pointer[index]) +# define iemarray_setfloat(pointer, index, fvalue) (pointer[index] = fvalue) #endif
+ #endif
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.