aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormusil <tmusil@users.sourceforge.net>2009-02-01 05:25:21 +0000
committermusil <tmusil@users.sourceforge.net>2009-02-01 05:25:21 +0000
commitbb04075ca94cfbb8391e3bbb0e693d2ebd079e95 (patch)
tree32f4367b8587b533724b2b04c2060d815415efa1 /src
parent0c2bbab79dd04ed75310ae10358b613c20179fc5 (diff)
changed for 64 bit array access
svn path=/trunk/externals/iem/iem_tab/; revision=10706
Diffstat (limited to 'src')
-rw-r--r--src/iem_tab.c10
-rw-r--r--src/iem_tab.h4
-rw-r--r--src/iemlib.h16
-rw-r--r--src/makefile_d_fat1
-rw-r--r--src/makefile_d_ppc1
-rw-r--r--src/makefile_darwin1
-rw-r--r--src/makefile_linux1
-rw-r--r--src/makefile_win1
-rw-r--r--src/tab_abs.c16
-rw-r--r--src/tab_add.c18
-rw-r--r--src/tab_add_scalar.c15
-rw-r--r--src/tab_carth2polar.c35
-rw-r--r--src/tab_complex_inv.c37
-rw-r--r--src/tab_complex_mul.c49
-rw-r--r--src/tab_const.c21
-rw-r--r--src/tab_conv.c34
-rw-r--r--src/tab_copy.c15
-rw-r--r--src/tab_counter.c33
-rw-r--r--src/tab_cross_corr.c52
-rw-r--r--src/tab_div.c26
-rw-r--r--src/tab_eq.c29
-rw-r--r--src/tab_eq_scalar.c27
-rw-r--r--src/tab_fft.c81
-rw-r--r--src/tab_find_exact_peaks.c29
-rw-r--r--src/tab_find_peaks.c29
-rw-r--r--src/tab_ge.c27
-rw-r--r--src/tab_ge_scalar.c27
-rw-r--r--src/tab_gt.c29
-rw-r--r--src/tab_gt_scalar.c27
-rw-r--r--src/tab_ifft.c89
-rw-r--r--src/tab_le.c29
-rw-r--r--src/tab_le_scalar.c27
-rw-r--r--src/tab_lt.c29
-rw-r--r--src/tab_lt_scalar.c27
-rw-r--r--src/tab_max_index.c16
-rw-r--r--src/tab_min_index.c16
-rw-r--r--src/tab_min_max.c24
-rw-r--r--src/tab_mls.c15
-rw-r--r--src/tab_mul.c18
-rw-r--r--src/tab_mul_scalar.c12
-rw-r--r--src/tab_ne.c29
-rw-r--r--src/tab_ne_scalar.c27
-rw-r--r--src/tab_reverse.c34
-rw-r--r--src/tab_rfft.c93
-rw-r--r--src/tab_rifft.c106
-rw-r--r--src/tab_sqrt.c61
-rw-r--r--src/tab_sub.c18
-rw-r--r--src/tab_sum.c19
48 files changed, 754 insertions, 626 deletions
diff --git a/src/iem_tab.c b/src/iem_tab.c
index 08b0ca9..9ea084b 100644
--- a/src/iem_tab.c
+++ b/src/iem_tab.c
@@ -1,12 +1,12 @@
/* For information on usage and redistribution, and for a DISCLAIMER OF ALL
* WARRANTIES, see the file, "LICENSE.txt," in this distribution.
-iem_tab written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2006 */
+iem_tab written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2009 */
#include "m_pd.h"
#include "iemlib.h"
-int iem_tab_check_arrays(t_symbol *obj_name, t_symbol *array_name, t_float **beg_mem, int *array_size, int max_index)
+int iem_tab_check_arrays(t_symbol *obj_name, t_symbol *array_name, iemarray_t **beg_mem, int *array_size, int max_index)
{
int ok=1;
t_garray *a;
@@ -16,7 +16,7 @@ int iem_tab_check_arrays(t_symbol *obj_name, t_symbol *array_name, t_float **beg
error("%s: no such array", array_name->s_name);
ok = 0;
}
- else if(!garray_getfloatarray(a, array_size, beg_mem))
+ else if(!iemarray_getarray(a, array_size, beg_mem))
{
error("%s: bad template for %s", array_name->s_name, obj_name->s_name);
ok = 0;
@@ -64,6 +64,7 @@ void tab_find_exact_peaks_setup(void);
void tab_find_peaks_setup(void);
void tab_ge_setup(void);
void tab_ge_scalar_setup(void);
+void tab_get_size_setup(void);
void tab_gt_setup(void);
void tab_gt_scalar_setup(void);
void tab_ifft_setup(void);
@@ -114,6 +115,7 @@ void iem_tab_setup(void)
tab_ge_scalar_setup();
tab_gt_setup();
tab_gt_scalar_setup();
+ tab_get_size_setup();
tab_ifft_setup();
tab_le_setup();
tab_le_scalar_setup();
@@ -134,7 +136,7 @@ void iem_tab_setup(void)
tab_sub_setup();
tab_sum_setup();
- post("iem_tab (R-1.17) library loaded! (c) Thomas Musil 11.2006");
+ post("iem_tab (R-1.18) library loaded! (c) Thomas Musil 01.2009");
post(" musil%ciem.at iem KUG Graz Austria", '@');
}
diff --git a/src/iem_tab.h b/src/iem_tab.h
index 76027ef..2b38f05 100644
--- a/src/iem_tab.h
+++ b/src/iem_tab.h
@@ -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_tab written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2006 */
+iem_tab written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2009 */
#ifndef __IEMTAB_H__
#define __IEMTAB_H__
@@ -13,6 +13,6 @@ typedef struct
}
TAB_COMPLEX;
-int iem_tab_check_arrays(t_symbol *obj_name, t_symbol *array_name, t_float **beg_mem, int *array_size, int max_index);
+int iem_tab_check_arrays(t_symbol *obj_name, t_symbol *array_name, iemarray_t **beg_mem, int *array_size, int max_index);
#endif
diff --git a/src/iemlib.h b/src/iemlib.h
index 973bfeb..97b088b 100644
--- a/src/iemlib.h
+++ b/src/iemlib.h
@@ -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,4 +99,18 @@ union tabfudge_f
#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
diff --git a/src/makefile_d_fat b/src/makefile_d_fat
index 31266aa..9b51221 100644
--- a/src/makefile_d_fat
+++ b/src/makefile_d_fat
@@ -34,6 +34,7 @@ SRC = tab_abs.c \
tab_ge_scalar.c \
tab_gt.c \
tab_gt_scalar.c \
+ tab_get_size.c \
tab_ifft.c \
tab_le.c \
tab_le_scalar.c \
diff --git a/src/makefile_d_ppc b/src/makefile_d_ppc
index 51a228b..22ef78b 100644
--- a/src/makefile_d_ppc
+++ b/src/makefile_d_ppc
@@ -34,6 +34,7 @@ SRC = tab_abs.c \
tab_ge_scalar.c \
tab_gt.c \
tab_gt_scalar.c \
+ tab_get_size.c \
tab_ifft.c \
tab_le.c \
tab_le_scalar.c \
diff --git a/src/makefile_darwin b/src/makefile_darwin
index daf1039..8ab9beb 100644
--- a/src/makefile_darwin
+++ b/src/makefile_darwin
@@ -39,6 +39,7 @@ SRC = tab_abs.c \
tab_ge_scalar.c \
tab_gt.c \
tab_gt_scalar.c \
+ tab_get_size.c \
tab_ifft.c \
tab_le.c \
tab_le_scalar.c \
diff --git a/src/makefile_linux b/src/makefile_linux
index 0291159..373e9b7 100644
--- a/src/makefile_linux
+++ b/src/makefile_linux
@@ -38,6 +38,7 @@ SRC = tab_abs.c \
tab_ge_scalar.c \
tab_gt.c \
tab_gt_scalar.c \
+ tab_get_size.c \
tab_ifft.c \
tab_le.c \
tab_le_scalar.c \
diff --git a/src/makefile_win b/src/makefile_win
index 0585aa8..8af5af9 100644
--- a/src/makefile_win
+++ b/src/makefile_win
@@ -41,6 +41,7 @@ SRC = tab_abs.c \
tab_ge_scalar.c \
tab_gt.c \
tab_gt_scalar.c \
+ tab_get_size.c \
tab_ifft.c \
tab_le.c \
tab_le_scalar.c \
diff --git a/src/tab_abs.c b/src/tab_abs.c
index 42fc453..8e4043c 100644
--- a/src/tab_abs.c
+++ b/src/tab_abs.c
@@ -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_tab written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2006 */
+iem_tab written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2009 */
#include "m_pd.h"
@@ -11,6 +11,7 @@ iem_tab written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2006
/* -------------------------- tab_abs ------------------------------ */
+/* x_beg_mem_dst[i] = abs(x_beg_mem_src1[i]) */
typedef struct _tab_abs
{
@@ -19,8 +20,8 @@ typedef struct _tab_abs
int x_size_dst;
int x_offset_src1;
int x_offset_dst;
- t_float *x_beg_mem_src1;
- t_float *x_beg_mem_dst;
+ iemarray_t *x_beg_mem_src1;
+ iemarray_t *x_beg_mem_dst;
t_symbol *x_sym_scr1;
t_symbol *x_sym_dst;
} t_tab_abs;
@@ -41,7 +42,7 @@ static void tab_abs_bang(t_tab_abs *x)
{
int i, n;
int ok_src, ok_dst;
- t_float *vec_src, *vec_dst;
+ iemarray_t *vec_src, *vec_dst;
ok_src = iem_tab_check_arrays(gensym("tab_abs"), x->x_sym_scr1, &x->x_beg_mem_src1, &x->x_size_src1, 0);
ok_dst = iem_tab_check_arrays(gensym("tab_abs"), x->x_sym_dst, &x->x_beg_mem_dst, &x->x_size_dst, 0);
@@ -59,7 +60,8 @@ static void tab_abs_bang(t_tab_abs *x)
t_garray *a;
for(i=0; i<n; i++)
- vec_dst[i] = fabs(vec_src[i]);
+ iemarray_setfloat(vec_dst, i, fabs(iemarray_getfloat(vec_src, i)));
+
outlet_bang(x->x_obj.ob_outlet);
a = (t_garray *)pd_findbyclass(x->x_sym_dst, garray_class);
garray_redraw(a);
@@ -72,7 +74,7 @@ static void tab_abs_list(t_tab_abs *x, t_symbol *s, int argc, t_atom *argv)
int beg_src, beg_dst;
int i, n;
int ok_src, ok_dst;
- t_float *vec_src, *vec_dst;
+ iemarray_t *vec_src, *vec_dst;
if((argc >= 3) &&
IS_A_FLOAT(argv,0) &&
@@ -101,7 +103,7 @@ static void tab_abs_list(t_tab_abs *x, t_symbol *s, int argc, t_atom *argv)
t_garray *a;
for(i=0; i<n; i++)
- vec_dst[i] = fabs(vec_src[i]);
+ iemarray_setfloat(vec_dst, i, fabs(iemarray_getfloat(vec_src, i)));
outlet_bang(x->x_obj.ob_outlet);
a = (t_garray *)pd_findbyclass(x->x_sym_dst, garray_class);
garray_redraw(a);
diff --git a/src/tab_add.c b/src/tab_add.c
index c2e2945..4f3fa88 100644
--- a/src/tab_add.c
+++ b/src/tab_add.c
@@ -1,13 +1,14 @@
/* For information on usage and redistribution, and for a DISCLAIMER OF ALL
* WARRANTIES, see the file, "LICENSE.txt," in this distribution.
-iem_tab written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2006 */
+iem_tab written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2009 */
#include "m_pd.h"
#include "iemlib.h"
#include "iem_tab.h"
/* -------------------------- tab_add ------------------------------ */
+/* x_beg_mem_dst[i] = x_beg_mem_src1[i] + x_beg_mem_src2[i] */
typedef struct _tab_add
{
@@ -18,9 +19,9 @@ typedef struct _tab_add
int x_offset_src1;
int x_offset_src2;
int x_offset_dst;
- t_float *x_beg_mem_src1;
- t_float *x_beg_mem_src2;
- t_float *x_beg_mem_dst;
+ iemarray_t *x_beg_mem_src1;
+ iemarray_t *x_beg_mem_src2;
+ iemarray_t *x_beg_mem_dst;
t_symbol *x_sym_scr1;
t_symbol *x_sym_scr2;
t_symbol *x_sym_dst;
@@ -47,7 +48,7 @@ static void tab_add_bang(t_tab_add *x)
{
int i, n;
int ok_src1, ok_src2, ok_dst;
- t_float *vec_src1, *vec_src2, *vec_dst;
+ iemarray_t *vec_src1, *vec_src2, *vec_dst;
ok_src1 = iem_tab_check_arrays(gensym("tab_add"), x->x_sym_scr1, &x->x_beg_mem_src1, &x->x_size_src1, 0);
ok_src2 = iem_tab_check_arrays(gensym("tab_add"), x->x_sym_scr2, &x->x_beg_mem_src2, &x->x_size_src2, 0);
@@ -70,7 +71,7 @@ static void tab_add_bang(t_tab_add *x)
t_garray *a;
for(i=0; i<n; i++)
- vec_dst[i] = vec_src1[i] + vec_src2[i];
+ iemarray_setfloat(vec_dst, i, iemarray_getfloat(vec_src1, i) + iemarray_getfloat(vec_src2, i));
outlet_bang(x->x_obj.ob_outlet);
a = (t_garray *)pd_findbyclass(x->x_sym_dst, garray_class);
garray_redraw(a);
@@ -83,7 +84,7 @@ static void tab_add_list(t_tab_add *x, t_symbol *s, int argc, t_atom *argv)
int beg_src1, beg_src2, beg_dst;
int i, n;
int ok_src1, ok_src2, ok_dst;
- t_float *vec_src1, *vec_src2, *vec_dst;
+ iemarray_t *vec_src1, *vec_src2, *vec_dst;
if((argc >= 4) &&
IS_A_FLOAT(argv,0) &&
@@ -118,7 +119,7 @@ static void tab_add_list(t_tab_add *x, t_symbol *s, int argc, t_atom *argv)
t_garray *a;
for(i=0; i<n; i++)
- vec_dst[i] = vec_src1[i] + vec_src2[i];
+ iemarray_setfloat(vec_dst, i, iemarray_getfloat(vec_src1, i) + iemarray_getfloat(vec_src2, i));
outlet_bang(x->x_obj.ob_outlet);
a = (t_garray *)pd_findbyclass(x->x_sym_dst, garray_class);
garray_redraw(a);
@@ -140,7 +141,6 @@ static void *tab_add_new(t_symbol *s, int argc, t_atom *argv)
{
t_tab_add *x = (t_tab_add *)pd_new(tab_add_class);
t_symbol *src1, *src2, *dst;
- t_float time;
if((argc >= 3) &&
IS_A_SYMBOL(argv,0) &&
diff --git a/src/tab_add_scalar.c b/src/tab_add_scalar.c
index 508d370..3f9fbba 100644
--- a/src/tab_add_scalar.c
+++ b/src/tab_add_scalar.c
@@ -1,13 +1,14 @@
/* For information on usage and redistribution, and for a DISCLAIMER OF ALL
* WARRANTIES, see the file, "LICENSE.txt," in this distribution.
-iem_tab written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2006 */
+iem_tab written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2009 */
#include "m_pd.h"
#include "iemlib.h"
#include "iem_tab.h"
/* -------------------------- tab_add_scalar ------------------------------ */
+/* x_beg_mem_dst[i] = x_beg_mem_src1[i] + add */
typedef struct _tab_add_scalar
{
@@ -16,8 +17,8 @@ typedef struct _tab_add_scalar
int x_size_dst;
int x_offset_src1;
int x_offset_dst;
- t_float *x_beg_mem_src1;
- t_float *x_beg_mem_dst;
+ iemarray_t *x_beg_mem_src1;
+ iemarray_t *x_beg_mem_dst;
t_symbol *x_sym_scr1;
t_symbol *x_sym_dst;
} t_tab_add_scalar;
@@ -33,7 +34,7 @@ static void tab_add_scalar_float(t_tab_add_scalar *x, t_floatarg add)
{
int i, n;
int ok_src1, ok_dst;
- t_float *vec_src1, *vec_dst;
+ iemarray_t *vec_src1, *vec_dst;
ok_src1 = iem_tab_check_arrays(gensym("tab_add_scalar"), x->x_sym_scr1, &x->x_beg_mem_src1, &x->x_size_src1, 0);
ok_dst = iem_tab_check_arrays(gensym("tab_add_scalar"), x->x_sym_dst, &x->x_beg_mem_dst, &x->x_size_dst, 0);
@@ -52,7 +53,7 @@ static void tab_add_scalar_float(t_tab_add_scalar *x, t_floatarg add)
t_garray *a;
for(i=0; i<n; i++)
- vec_dst[i] = vec_src1[i] + add;
+ iemarray_setfloat(vec_dst, i, iemarray_getfloat(vec_src1, i) + add);
outlet_bang(x->x_obj.ob_outlet);
a = (t_garray *)pd_findbyclass(x->x_sym_dst, garray_class);
garray_redraw(a);
@@ -70,7 +71,7 @@ static void tab_add_scalar_list(t_tab_add_scalar *x, t_symbol *s, int argc, t_at
int beg_src1, beg_dst;
int i, n;
int ok_src1, ok_dst;
- t_float *vec_src1, *vec_dst, add;
+ iemarray_t *vec_src1, *vec_dst, add;
if((argc >= 4) &&
IS_A_FLOAT(argv,0) &&
@@ -101,7 +102,7 @@ static void tab_add_scalar_list(t_tab_add_scalar *x, t_symbol *s, int argc, t_at
t_garray *a;
for(i=0; i<n; i++)
- vec_dst[i] = vec_src1[i] + add;
+ iemarray_setfloat(vec_dst, i, iemarray_getfloat(vec_src1, i) + add);
outlet_bang(x->x_obj.ob_outlet);
a = (t_garray *)pd_findbyclass(x->x_sym_dst, garray_class);
garray_redraw(a);
diff --git a/src/tab_carth2polar.c b/src/tab_carth2polar.c
index 7f76088..e70d2b8 100644
--- a/src/tab_carth2polar.c
+++ b/src/tab_carth2polar.c
@@ -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_tab written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2006 */
+iem_tab written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2009 */
#include "m_pd.h"
#include "iemlib.h"
@@ -9,6 +9,8 @@ iem_tab written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2006
#include <math.h>
/* -------------------------- tab_carth2polar ------------------------------ */
+/* x_beg_mem_dst_mag[i] = sqrt(x_beg_mem_src_re[i]*x_beg_mem_src_re[i] + x_beg_mem_src_im[i]*x_beg_mem_src_im[i]) */
+/* x_beg_mem_dst_arg[i] = atan2(x_beg_mem_src_im[i], x_beg_mem_src_re[i]) */
typedef struct _tab_carth2polar
{
@@ -21,10 +23,10 @@ typedef struct _tab_carth2polar
int x_offset_dst_mag;
int x_offset_src_im;
int x_offset_dst_arg;
- t_float *x_beg_mem_src_re;
- t_float *x_beg_mem_dst_mag;
- t_float *x_beg_mem_src_im;
- t_float *x_beg_mem_dst_arg;
+ iemarray_t *x_beg_mem_src_re;
+ iemarray_t *x_beg_mem_dst_mag;
+ iemarray_t *x_beg_mem_src_im;
+ iemarray_t *x_beg_mem_dst_arg;
t_symbol *x_sym_src_re;
t_symbol *x_sym_dst_mag;
t_symbol *x_sym_src_im;
@@ -58,8 +60,8 @@ static void tab_carth2polar_bang(t_tab_carth2polar *x)
int i, n;
int ok_src_re, ok_dst_mag;
int ok_src_im, ok_dst_arg;
- t_float *vec_src_re, *vec_dst_mag;
- t_float *vec_src_im, *vec_dst_arg;
+ iemarray_t *vec_src_re, *vec_dst_mag;
+ iemarray_t *vec_src_im, *vec_dst_arg;
ok_src_re = iem_tab_check_arrays(gensym("tab_carth2polar"), x->x_sym_src_re, &x->x_beg_mem_src_re, &x->x_size_src_re, 0);
ok_dst_mag = iem_tab_check_arrays(gensym("tab_carth2polar"), x->x_sym_dst_mag, &x->x_beg_mem_dst_mag, &x->x_size_dst_mag, 0);
@@ -90,12 +92,14 @@ static void tab_carth2polar_bang(t_tab_carth2polar *x)
{
t_float re, im, mag, arg;
- re = vec_src_re[i];
- im = vec_src_im[i];
+ re = iemarray_getfloat(vec_src_re, i);
+ im = iemarray_getfloat(vec_src_im, i);
mag = sqrt(re*re + im*im);
arg = atan2(im, re) * rcp_two_pi;
vec_dst_mag[i] = mag;
vec_dst_arg[i] = arg;
+ iemarray_setfloat(vec_dst_mag, i, mag);
+ iemarray_setfloat(vec_dst_arg, i, arg);
}
outlet_bang(x->x_obj.ob_outlet);
a = (t_garray *)pd_findbyclass(x->x_sym_dst_mag, garray_class);
@@ -113,8 +117,8 @@ static void tab_carth2polar_list(t_tab_carth2polar *x, t_symbol *s, int argc, t_
int beg_src_im, beg_dst_arg;
int ok_src_re, ok_dst_mag;
int ok_src_im, ok_dst_arg;
- t_float *vec_src_re, *vec_dst_mag;
- t_float *vec_src_im, *vec_dst_arg;
+ iemarray_t *vec_src_re, *vec_dst_mag;
+ iemarray_t *vec_src_im, *vec_dst_arg;
if((argc >= 5) &&
IS_A_FLOAT(argv,0) &&
@@ -160,12 +164,12 @@ static void tab_carth2polar_list(t_tab_carth2polar *x, t_symbol *s, int argc, t_
{
t_float re, im, mag, arg;
- re = vec_src_re[i];
- im = vec_src_im[i];
+ re = iemarray_getfloat(vec_src_re, i);
+ im = iemarray_getfloat(vec_src_im, i);
mag = sqrt(re*re + im*im);
arg = atan2(im, re) * rcp_two_pi;
- vec_dst_mag[i] = mag;
- vec_dst_arg[i] = arg;
+ iemarray_setfloat(vec_dst_mag, i, mag);
+ iemarray_setfloat(vec_dst_arg, i, arg);
}
outlet_bang(x->x_obj.ob_outlet);
a = (t_garray *)pd_findbyclass(x->x_sym_dst_mag, garray_class);
@@ -190,7 +194,6 @@ static void *tab_carth2polar_new(t_symbol *s, int argc, t_atom *argv)
{
t_tab_carth2polar *x = (t_tab_carth2polar *)pd_new(tab_carth2polar_class);
t_symbol *src_re, *dst_mag, *src_im, *dst_arg;
- t_float time;
if((argc >= 4) &&
IS_A_SYMBOL(argv,0) &&
diff --git a/src/tab_complex_inv.c b/src/tab_complex_inv.c
index 4abd447..3b14af6 100644
--- a/src/tab_complex_inv.c
+++ b/src/tab_complex_inv.c
@@ -1,13 +1,15 @@
/* For information on usage and redistribution, and for a DISCLAIMER OF ALL
* WARRANTIES, see the file, "LICENSE.txt," in this distribution.
-iem_tab written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2006 */
+iem_tab written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2009 */
#include "m_pd.h"
#include "iemlib.h"
#include "iem_tab.h"
/* -------------------------- tab_complex_inv ------------------------------ */
+/* x_beg_mem_dst_re[i] = x_beg_mem_src1_re[i] / (x_beg_mem_src1_re[i]*x_beg_mem_src1_re[i] + x_beg_mem_src1_im[i]*x_beg_mem_src1_im[i]) */
+/* x_beg_mem_dst_im[i] = -x_beg_mem_src1_im[i] / (x_beg_mem_src1_re[i]*x_beg_mem_src1_re[i] + x_beg_mem_src1_im[i]*x_beg_mem_src1_im[i]) */
typedef struct _tab_complex_inv
{
@@ -20,10 +22,10 @@ typedef struct _tab_complex_inv
int x_offset_dst_re;
int x_offset_src1_im;
int x_offset_dst_im;
- t_float *x_beg_mem_src1_re;
- t_float *x_beg_mem_dst_re;
- t_float *x_beg_mem_src1_im;
- t_float *x_beg_mem_dst_im;
+ iemarray_t *x_beg_mem_src1_re;
+ iemarray_t *x_beg_mem_dst_re;
+ iemarray_t *x_beg_mem_src1_im;
+ iemarray_t *x_beg_mem_dst_im;
t_symbol *x_sym_scr1_re;
t_symbol *x_sym_dst_re;
t_symbol *x_sym_scr1_im;
@@ -57,8 +59,8 @@ static void tab_complex_inv_bang(t_tab_complex_inv *x)
int i, n;
int ok_src1_re, ok_dst_re;
int ok_src1_im, ok_dst_im;
- t_float *vec_src1_re, *vec_dst_re;
- t_float *vec_src1_im, *vec_dst_im;
+ iemarray_t *vec_src1_re, *vec_dst_re;
+ iemarray_t *vec_src1_im, *vec_dst_im;
ok_src1_re = iem_tab_check_arrays(gensym("tab_complex_inv"), x->x_sym_scr1_re, &x->x_beg_mem_src1_re, &x->x_size_src1_re, 0);
ok_dst_re = iem_tab_check_arrays(gensym("tab_complex_inv"), x->x_sym_dst_re, &x->x_beg_mem_dst_re, &x->x_size_dst_re, 0);
@@ -88,11 +90,11 @@ static void tab_complex_inv_bang(t_tab_complex_inv *x)
{
t_float re, im, abs;
- re = vec_src1_re[i];
- im = vec_src1_im[i];
+ re = iemarray_getfloat(vec_src1_re, i);
+ im = iemarray_getfloat(vec_src1_im, i);
abs = 1.0f / (re*re + im*im);
- vec_dst_re[i] = re*abs;
- vec_dst_im[i] = -im*abs;
+ iemarray_setfloat(vec_dst_re, i, re*abs);
+ iemarray_setfloat(vec_dst_im, i, -im*abs);
}
outlet_bang(x->x_obj.ob_outlet);
a = (t_garray *)pd_findbyclass(x->x_sym_dst_re, garray_class);
@@ -110,8 +112,8 @@ static void tab_complex_inv_list(t_tab_complex_inv *x, t_symbol *s, int argc, t_
int beg_src1_im, beg_dst_im;
int ok_src1_re, ok_dst_re;
int ok_src1_im, ok_dst_im;
- t_float *vec_src1_re, *vec_dst_re;
- t_float *vec_src1_im, *vec_dst_im;
+ iemarray_t *vec_src1_re, *vec_dst_re;
+ iemarray_t *vec_src1_im, *vec_dst_im;
if((argc >= 5) &&
IS_A_FLOAT(argv,0) &&
@@ -156,11 +158,11 @@ static void tab_complex_inv_list(t_tab_complex_inv *x, t_symbol *s, int argc, t_
{
t_float re, im, abs;
- re = vec_src1_re[i];
- im = vec_src1_im[i];
+ re = iemarray_getfloat(vec_src1_re, i);
+ im = iemarray_getfloat(vec_src1_im, i);
abs = 1.0f / (re*re + im*im);
- vec_dst_re[i] = re*abs;
- vec_dst_im[i] = -im*abs;
+ iemarray_setfloat(vec_dst_re, i, re*abs);
+ iemarray_setfloat(vec_dst_im, i, -im*abs);
}
outlet_bang(x->x_obj.ob_outlet);
a = (t_garray *)pd_findbyclass(x->x_sym_dst_re, garray_class);
@@ -185,7 +187,6 @@ static void *tab_complex_inv_new(t_symbol *s, int argc, t_atom *argv)
{
t_tab_complex_inv *x = (t_tab_complex_inv *)pd_new(tab_complex_inv_class);
t_symbol *src1_re, *src2_re, *dst_re, *src1_im, *src2_im, *dst_im;
- t_float time;
if((argc >= 4) &&
IS_A_SYMBOL(argv,0) &&
diff --git a/src/tab_complex_mul.c b/src/tab_complex_mul.c
index 7bf7b0e..da6e256 100644
--- a/src/tab_complex_mul.c
+++ b/src/tab_complex_mul.c
@@ -1,13 +1,15 @@
/* For information on usage and redistribution, and for a DISCLAIMER OF ALL
* WARRANTIES, see the file, "LICENSE.txt," in this distribution.
-iem_tab written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2006 */
+iem_tab written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2009 */
#include "m_pd.h"
#include "iemlib.h"
#include "iem_tab.h"
/* -------------------------- tab_complex_mul ------------------------------ */
+/* x_beg_mem_dst_re[i] = x_beg_mem_src1_re[i]*x_beg_mem_src2_re[i] - x_beg_mem_src1_im[i]*x_beg_mem_src2_im[i] */
+/* x_beg_mem_dst_im[i] = x_beg_mem_src1_re[i]*x_beg_mem_src2_im[i] + x_beg_mem_src1_im[i]*x_beg_mem_src2_re[i] */
typedef struct _tab_complex_mul
{
@@ -24,12 +26,12 @@ typedef struct _tab_complex_mul
int x_offset_src1_im;
int x_offset_src2_im;
int x_offset_dst_im;
- t_float *x_beg_mem_src1_re;
- t_float *x_beg_mem_src2_re;
- t_float *x_beg_mem_dst_re;
- t_float *x_beg_mem_src1_im;
- t_float *x_beg_mem_src2_im;
- t_float *x_beg_mem_dst_im;
+ iemarray_t *x_beg_mem_src1_re;
+ iemarray_t *x_beg_mem_src2_re;
+ iemarray_t *x_beg_mem_dst_re;
+ iemarray_t *x_beg_mem_src1_im;
+ iemarray_t *x_beg_mem_src2_im;
+ iemarray_t *x_beg_mem_dst_im;
t_symbol *x_sym_scr1_re;
t_symbol *x_sym_scr2_re;
t_symbol *x_sym_dst_re;
@@ -75,8 +77,8 @@ static void tab_complex_mul_bang(t_tab_complex_mul *x)
int i, n;
int ok_src1_re, ok_src2_re, ok_dst_re;
int ok_src1_im, ok_src2_im, ok_dst_im;
- t_float *vec_src1_re, *vec_src2_re, *vec_dst_re;
- t_float *vec_src1_im, *vec_src2_im, *vec_dst_im;
+ iemarray_t *vec_src1_re, *vec_src2_re, *vec_dst_re;
+ iemarray_t *vec_src1_im, *vec_src2_im, *vec_dst_im;
ok_src1_re = iem_tab_check_arrays(gensym("tab_complex_mul"), x->x_sym_scr1_re, &x->x_beg_mem_src1_re, &x->x_size_src1_re, 0);
ok_src2_re = iem_tab_check_arrays(gensym("tab_complex_mul"), x->x_sym_scr2_re, &x->x_beg_mem_src2_re, &x->x_size_src2_re, 0);
@@ -114,12 +116,12 @@ static void tab_complex_mul_bang(t_tab_complex_mul *x)
{
t_float re1, re2, im1, im2;
- re1 = vec_src1_re[i];
- re2 = vec_src2_re[i];
- im1 = vec_src1_im[i];
- im2 = vec_src2_im[i];
- vec_dst_re[i] = re1*re2 - im1*im2;
- vec_dst_im[i] = re1*im2 + im1*re2;
+ re1 = iemarray_getfloat(vec_src1_re, i);
+ re2 = iemarray_getfloat(vec_src2_re, i);
+ im1 = iemarray_getfloat(vec_src1_im, i);
+ im2 = iemarray_getfloat(vec_src2_im, i);
+ iemarray_setfloat(vec_dst_re, i, re1*re2 - im1*im2);
+ iemarray_setfloat(vec_dst_im, i, re1*im2 + im1*re2);
}
outlet_bang(x->x_obj.ob_outlet);
a = (t_garray *)pd_findbyclass(x->x_sym_dst_re, garray_class);
@@ -137,8 +139,8 @@ static void tab_complex_mul_list(t_tab_complex_mul *x, t_symbol *s, int argc, t_
int beg_src1_im, beg_src2_im, beg_dst_im;
int ok_src1_re, ok_src2_re, ok_dst_re;
int ok_src1_im, ok_src2_im, ok_dst_im;
- t_float *vec_src1_re, *vec_src2_re, *vec_dst_re;
- t_float *vec_src1_im, *vec_src2_im, *vec_dst_im;
+ iemarray_t *vec_src1_re, *vec_src2_re, *vec_dst_re;
+ iemarray_t *vec_src1_im, *vec_src2_im, *vec_dst_im;
if((argc >= 7) &&
IS_A_FLOAT(argv,0) &&
@@ -195,12 +197,12 @@ static void tab_complex_mul_list(t_tab_complex_mul *x, t_symbol *s, int argc, t_
{
t_float re1, re2, im1, im2;
- re1 = vec_src1_re[i];
- re2 = vec_src2_re[i];
- im1 = vec_src1_im[i];
- im2 = vec_src2_im[i];
- vec_dst_re[i] = re1*re2 - im1*im2;
- vec_dst_im[i] = re1*im2 + im1*re2;
+ re1 = iemarray_getfloat(vec_src1_re, i);
+ re2 = iemarray_getfloat(vec_src2_re, i);
+ im1 = iemarray_getfloat(vec_src1_im, i);
+ im2 = iemarray_getfloat(vec_src2_im, i);
+ iemarray_setfloat(vec_dst_re, i, re1*re2 - im1*im2);
+ iemarray_setfloat(vec_dst_im, i, re1*im2 + im1*re2);
}
outlet_bang(x->x_obj.ob_outlet);
a = (t_garray *)pd_findbyclass(x->x_sym_dst_re, garray_class);
@@ -225,7 +227,6 @@ static void *tab_complex_mul_new(t_symbol *s, int argc, t_atom *argv)
{
t_tab_complex_mul *x = (t_tab_complex_mul *)pd_new(tab_complex_mul_class);
t_symbol *src1_re, *src2_re, *dst_re, *src1_im, *src2_im, *dst_im;
- t_float time;
if((argc >= 6) &&
IS_A_SYMBOL(argv,0) &&
diff --git a/src/tab_const.c b/src/tab_const.c
index 2ab8fe3..461f950 100644
--- a/src/tab_const.c
+++ b/src/tab_const.c
@@ -1,21 +1,22 @@
/* For information on usage and redistribution, and for a DISCLAIMER OF ALL
* WARRANTIES, see the file, "LICENSE.txt," in this distribution.
-iem_tab written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2006 */
+iem_tab written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2009 */
#include "m_pd.h"
#include "iemlib.h"
#include "iem_tab.h"
/* -------------------------- tab_const ------------------------------ */
+/* x_beg_mem_dst[i] = c */
typedef struct _tab_const
{
t_object x_obj;
int x_size_dst;
int x_offset_dst;
- t_float x_const;
- t_float *x_beg_mem_dst;
+ t_float x_const;
+ iemarray_t *x_beg_mem_dst;
t_symbol *x_sym_dst;
} t_tab_const;
@@ -30,7 +31,7 @@ static void tab_const_bang(t_tab_const *x)
{
int i, n;
int ok_dst;
- t_float *vec_dst;
+ iemarray_t *vec_dst;
ok_dst = iem_tab_check_arrays(gensym("tab_const"), x->x_sym_dst, &x->x_beg_mem_dst, &x->x_size_dst, 0);
@@ -43,7 +44,7 @@ static void tab_const_bang(t_tab_const *x)
t_garray *a;
for(i=0; i<n; i++)
- vec_dst[i] = 0.0f;
+ iemarray_setfloat(vec_dst, i, 0.0f);
outlet_bang(x->x_obj.ob_outlet);
a = (t_garray *)pd_findbyclass(x->x_sym_dst, garray_class);
garray_redraw(a);
@@ -55,7 +56,7 @@ static void tab_const_float(t_tab_const *x, t_floatarg c)
{
int i, n;
int ok_dst;
- t_float *vec_dst;
+ iemarray_t *vec_dst;
ok_dst = iem_tab_check_arrays(gensym("tab_const"), x->x_sym_dst, &x->x_beg_mem_dst, &x->x_size_dst, 0);
@@ -68,7 +69,7 @@ static void tab_const_float(t_tab_const *x, t_floatarg c)
t_garray *a;
for(i=0; i<n; i++)
- vec_dst[i] = c;
+ iemarray_setfloat(vec_dst, i, c);
outlet_bang(x->x_obj.ob_outlet);
a = (t_garray *)pd_findbyclass(x->x_sym_dst, garray_class);
garray_redraw(a);
@@ -81,7 +82,8 @@ static void tab_const_list(t_tab_const *x, t_symbol *s, int argc, t_atom *argv)
int beg_dst;
int i, n;
int ok_dst;
- t_float *vec_dst, c;
+ iemarray_t *vec_dst;
+ t_float c;
if((argc >= 3) &&
IS_A_FLOAT(argv,0) &&
@@ -106,7 +108,7 @@ static void tab_const_list(t_tab_const *x, t_symbol *s, int argc, t_atom *argv)
t_garray *a;
for(i=0; i<n; i++)
- vec_dst[i] = c;
+ iemarray_setfloat(vec_dst, i, c);
outlet_bang(x->x_obj.ob_outlet);
a = (t_garray *)pd_findbyclass(x->x_sym_dst, garray_class);
garray_redraw(a);
@@ -128,7 +130,6 @@ static void *tab_const_new(t_symbol *s, int argc, t_atom *argv)
{
t_tab_const *x = (t_tab_const *)pd_new(tab_const_class);
t_symbol *dst;
- t_float time;
if((argc >= 1) &&
IS_A_SYMBOL(argv,0))
diff --git a/src/tab_conv.c b/src/tab_conv.c
index 14865fe..d115f72 100644
--- a/src/tab_conv.c
+++ b/src/tab_conv.c
@@ -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_tab written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2006 */
+iem_tab written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2009 */
#include "m_pd.h"
@@ -9,7 +9,14 @@ iem_tab written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2006
#include "iem_tab.h"
-/* -------------------------- tab_conv ------------------------------ */
+/* ---------------------------- tab_conv ------------------------------- */
+/* for(i=0; i<x_size_src1; i++) */
+/* { */
+/* sum = 0.0f; */
+/* for(j=0; j<x_size_src2; j++) */
+/* sum += x_beg_mem_src1[i+j-x_size_src2/2] * x_beg_mem_src2[j]; */
+/* x_beg_mem_dst[i] = sum; */
+/* } */
typedef struct _tab_conv
{
@@ -20,9 +27,9 @@ typedef struct _tab_conv
int x_offset_src1;
int x_offset_src2;
int x_offset_dst;
- t_float *x_beg_mem_src1;
- t_float *x_beg_mem_src2;
- t_float *x_beg_mem_dst;
+ iemarray_t *x_beg_mem_src1;
+ iemarray_t *x_beg_mem_src2;
+ iemarray_t *x_beg_mem_dst;
t_symbol *x_sym_scr1;
t_symbol *x_sym_scr2;
t_symbol *x_sym_dst;
@@ -30,6 +37,10 @@ typedef struct _tab_conv
static t_class *tab_conv_class;
+static void tab_conv_tick(t_tab_conv *x)
+{
+}
+
static void tab_conv_src1(t_tab_conv *x, t_symbol *s)
{
x->x_sym_scr1 = s;
@@ -49,7 +60,7 @@ static void tab_conv_bang(t_tab_conv *x)
{
int i, j, k, l, min_s2, plu_s2, n;
int ok_src1, ok_src2, ok_dst;
- t_float *vec_src1, *vec_src2, *vec_dst;
+ iemarray_t *vec_src1, *vec_src2, *vec_dst;
t_float sum=0.0f;
ok_src1 = iem_tab_check_arrays(gensym("tab_conv"), x->x_sym_scr1, &x->x_beg_mem_src1, &x->x_size_src1, 0);
@@ -80,9 +91,9 @@ static void tab_conv_bang(t_tab_conv *x)
{
k = j + i;
if((k >= 0) && (k < n))
- sum += vec_src1[k] * vec_src2[l];
+ sum += iemarray_getfloat(vec_src1, k) * iemarray_getfloat(vec_src2, l);
}
- vec_dst[i] = sum;
+ iemarray_setfloat(vec_dst, i, sum);
}
outlet_bang(x->x_obj.ob_outlet);
a = (t_garray *)pd_findbyclass(x->x_sym_dst, garray_class);
@@ -98,7 +109,7 @@ static void tab_conv_list(t_tab_conv *x, t_symbol *s, int argc, t_atom *argv)
int n_src1, n_src2;
int i, j, k, l, min_s2, plu_s2;
int ok_src1, ok_src2, ok_dst;
- t_float *vec_src1, *vec_src2, *vec_dst;
+ iemarray_t *vec_src1, *vec_src2, *vec_dst;
t_float sum=0.0f;
if((argc >= 5) &&
@@ -148,9 +159,9 @@ static void tab_conv_list(t_tab_conv *x, t_symbol *s, int argc, t_atom *argv)
{
k = j + i;
if((k >= 0) && (k < n_src1))
- sum += vec_src1[k] * vec_src2[l];
+ sum += iemarray_getfloat(vec_src1, k) * iemarray_getfloat(vec_src2, l);
}
- vec_dst[i] = sum;
+ iemarray_setfloat(vec_dst, i, sum);
}
outlet_bang(x->x_obj.ob_outlet);
a = (t_garray *)pd_findbyclass(x->x_sym_dst, garray_class);
@@ -174,7 +185,6 @@ static void *tab_conv_new(t_symbol *s, int argc, t_atom *argv)
{
t_tab_conv *x = (t_tab_conv *)pd_new(tab_conv_class);
t_symbol *src1, *src2, *dst;
- t_float time;
if((argc >= 3) &&
IS_A_SYMBOL(argv,0) &&
diff --git a/src/tab_copy.c b/src/tab_copy.c
index 8893afe..ce3c123 100644
--- a/src/tab_copy.c
+++ b/src/tab_copy.c
@@ -1,7 +1,8 @@
/* For information on usage and redistribution, and for a DISCLAIMER OF ALL
* WARRANTIES, see the file, "LICENSE.txt," in this distribution.
-iem_tab written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2006 */
+iem_tab written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2009 */
+/* x_beg_mem_dst[i] = x_beg_mem_src1[i] */
#include "m_pd.h"
#include "iemlib.h"
@@ -16,8 +17,8 @@ typedef struct _tab_copy
int x_size_dst;
int x_offset_src1;
int x_offset_dst;
- t_float *x_beg_mem_src1;
- t_float *x_beg_mem_dst;
+ iemarray_t *x_beg_mem_src1;
+ iemarray_t *x_beg_mem_dst;
t_symbol *x_sym_scr1;
t_symbol *x_sym_dst;
} t_tab_copy;
@@ -38,7 +39,7 @@ static void tab_copy_bang(t_tab_copy *x)
{
int i, n;
int ok_src, ok_dst;
- t_float *vec_src, *vec_dst;
+ iemarray_t *vec_src, *vec_dst;
ok_src = iem_tab_check_arrays(gensym("tab_copy"), x->x_sym_scr1, &x->x_beg_mem_src1, &x->x_size_src1, 0);
ok_dst = iem_tab_check_arrays(gensym("tab_copy"), x->x_sym_dst, &x->x_beg_mem_dst, &x->x_size_dst, 0);
@@ -56,7 +57,7 @@ static void tab_copy_bang(t_tab_copy *x)
t_garray *a;
for(i=0; i<n; i++)
- vec_dst[i] = vec_src[i];
+ iemarray_setfloat(vec_dst, i, iemarray_getfloat(vec_src, i));
outlet_bang(x->x_obj.ob_outlet);
a = (t_garray *)pd_findbyclass(x->x_sym_dst, garray_class);
garray_redraw(a);
@@ -69,7 +70,7 @@ static void tab_copy_list(t_tab_copy *x, t_symbol *s, int argc, t_atom *argv)
int beg_src, beg_dst;
int i, n;
int ok_src, ok_dst;
- t_float *vec_src, *vec_dst;
+ iemarray_t *vec_src, *vec_dst;
if((argc >= 3) &&
IS_A_FLOAT(argv,0) &&
@@ -98,7 +99,7 @@ static void tab_copy_list(t_tab_copy *x, t_symbol *s, int argc, t_atom *argv)
t_garray *a;
for(i=0; i<n; i++)
- vec_dst[i] = vec_src[i];
+ iemarray_setfloat(vec_dst, i, iemarray_getfloat(vec_src, i));
outlet_bang(x->x_obj.ob_outlet);
a = (t_garray *)pd_findbyclass(x->x_sym_dst, garray_class);
garray_redraw(a);
diff --git a/src/tab_counter.c b/src/tab_counter.c
index 87b97cc..e1b9553 100644
--- a/src/tab_counter.c
+++ b/src/tab_counter.c
@@ -1,13 +1,20 @@
/* For information on usage and redistribution, and for a DISCLAIMER OF ALL
* WARRANTIES, see the file, "LICENSE.txt," in this distribution.
-iem_tab written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2006 */
+iem_tab written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2009 */
#include "m_pd.h"
#include "iemlib.h"
#include "iem_tab.h"
/* -------------------------- tab_counter ------------------------------ */
+/* for(i=0; i<x_size_src1; i++) */
+/* { */
+/* if(x_beg_mem_src1[i] == 0.0f) */
+/* x_beg_mem_dst[i] = 0.0f; */
+/* else */
+/* x_beg_mem_dst[i] += 1.0f; */
+/* } */
typedef struct _tab_counter
{
@@ -16,8 +23,8 @@ typedef struct _tab_counter
int x_size_dst;
int x_offset_src1;
int x_offset_dst;
- t_float *x_beg_mem_src1;
- t_float *x_beg_mem_dst;
+ iemarray_t *x_beg_mem_src1;
+ iemarray_t *x_beg_mem_dst;
t_symbol *x_sym_scr1;
t_symbol *x_sym_dst;
} t_tab_counter;
@@ -33,7 +40,7 @@ static void tab_counter_bang(t_tab_counter *x)
{
int i, n;
int ok_src1, ok_dst;
- t_float *vec_src1, *vec_dst;
+ iemarray_t *vec_src1, *vec_dst;
ok_src1 = iem_tab_check_arrays(gensym("tab_counter"), x->x_sym_scr1, &x->x_beg_mem_src1, &x->x_size_src1, 0);
ok_dst = iem_tab_check_arrays(gensym("tab_counter"), x->x_sym_dst, &x->x_beg_mem_dst, &x->x_size_dst, 0);
@@ -53,10 +60,10 @@ static void tab_counter_bang(t_tab_counter *x)
for(i=0; i<n; i++)
{
- if(vec_src1[i] == 0.0f)
- vec_dst[i] = 0.0f;
+ if(iemarray_getfloat(vec_src1, i) == 0.0f)
+ iemarray_setfloat(vec_dst, i, 0.0f);
else
- vec_dst[i] += 1.0f;
+ iemarray_setfloat(vec_dst, i, iemarray_getfloat(vec_dst, i)+1.0f);
}
outlet_bang(x->x_obj.ob_outlet);
a = (t_garray *)pd_findbyclass(x->x_sym_dst, garray_class);
@@ -75,7 +82,7 @@ static void tab_counter_list(t_tab_counter *x, t_symbol *s, int argc, t_atom *ar
int beg_src1, beg_dst;
int i, n;
int ok_src1, ok_dst;
- t_float *vec_src1, *vec_dst;
+ iemarray_t *vec_src1, *vec_dst;
if((argc >= 3) &&
IS_A_FLOAT(argv,0) &&
@@ -105,10 +112,10 @@ static void tab_counter_list(t_tab_counter *x, t_symbol *s, int argc, t_atom *ar
for(i=0; i<n; i++)
{
- if(vec_src1[i] == 0.0f)
- vec_dst[i] = 0.0f;
+ if(iemarray_getfloat(vec_src1, i) == 0.0f)
+ iemarray_setfloat(vec_dst, i, 0.0f);
else
- vec_dst[i] += 1.0f;
+ iemarray_setfloat(vec_dst, i, iemarray_getfloat(vec_dst, i)+1.0f);
}
outlet_bang(x->x_obj.ob_outlet);
a = (t_garray *)pd_findbyclass(x->x_sym_dst, garray_class);
@@ -128,7 +135,7 @@ static void tab_counter_reset(t_tab_counter *x)
int beg_dst;
int i, n;
int ok_dst;
- t_float *vec_dst;
+ iemarray_t *vec_dst;
ok_dst = iem_tab_check_arrays(gensym("tab_counter"), x->x_sym_dst, &x->x_beg_mem_dst, &x->x_size_dst, 0);
@@ -141,7 +148,7 @@ static void tab_counter_reset(t_tab_counter *x)
t_garray *a;
for(i=0; i<n; i++)
- vec_dst[i] = 0.0f;
+ iemarray_setfloat(vec_dst, i, 0.0f);
outlet_bang(x->x_obj.ob_outlet);
a = (t_garray *)pd_findbyclass(x->x_sym_dst, garray_class);
garray_redraw(a);
diff --git a/src/tab_cross_corr.c b/src/tab_cross_corr.c
index f4b1b7c..270bd58 100644
--- a/src/tab_cross_corr.c
+++ b/src/tab_cross_corr.c
@@ -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_tab written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2006 */
+iem_tab written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2009 */
#include "m_pd.h"
#include "iemlib.h"
@@ -17,9 +17,9 @@ typedef struct _tab_cross_corr
int x_size_src2;
int x_size_dst;
int x_n;
- t_float *x_beg_mem_src1;
- t_float *x_beg_mem_src2;
- t_float *x_beg_mem_dst;
+ iemarray_t *x_beg_mem_src1;
+ iemarray_t *x_beg_mem_src2;
+ iemarray_t *x_beg_mem_dst;
t_float x_factor;
t_symbol *x_sym_scr1;
t_symbol *x_sym_scr2;
@@ -36,7 +36,8 @@ static void tab_cross_corr_tick(t_tab_cross_corr *x)
x->x_counter++;
if(x->x_counter < x->x_n)
{
- t_float *vec_src1, *vec_src2, *vec_dst, sum;
+ iemarray_t *vec_src1, *vec_src2, *vec_dst;
+ t_float sum;
int j, m;
vec_src1 = x->x_beg_mem_src1 + x->x_counter;
@@ -46,9 +47,9 @@ static void tab_cross_corr_tick(t_tab_cross_corr *x)
sum = 0.0f;
for(j=0; j<m; j++)
{
- sum += vec_src1[j]*vec_src2[j];
+ sum += iemarray_getfloat(vec_src1, j)*iemarray_getfloat(vec_src2, j);
}
- vec_dst[0] = sum*x->x_factor;
+ iemarray_setfloat(vec_dst, 0, sum*x->x_factor);
clock_delay(x->x_clock, x->x_delay);
}
else
@@ -62,12 +63,12 @@ static void tab_cross_corr_tick(t_tab_cross_corr *x)
}
}
-static void tab_cross_corr_time(t_tab_cross_corr *x, t_floatarg time)
+static void tab_cross_corr_time(t_tab_cross_corr *x, t_floatarg dtime)
{
- if(time < 0.0f)
- time = 0.0f;
+ if(dtime < 0.0f)
+ dtime = 0.0f;
- x->x_delay = time;
+ x->x_delay = dtime;
}
static void tab_cross_corr_factor(t_tab_cross_corr *x, t_floatarg factor)
@@ -94,7 +95,7 @@ static void tab_cross_corr_bang(t_tab_cross_corr *x)
{
int i, j, m, n;
int ok_src1, ok_src2, ok_dst;
- t_float *vec_src1, *vec_src2, *vec_dst;
+ iemarray_t *vec_src1, *vec_src2, *vec_dst;
t_float sum, f;
ok_src1 = iem_tab_check_arrays(gensym("tab_cross_corr"), x->x_sym_scr1, &x->x_beg_mem_src1, &x->x_size_src1, 0);
@@ -127,9 +128,9 @@ static void tab_cross_corr_bang(t_tab_cross_corr *x)
sum = 0.0f;
for(j=0; j<m; j++)
{
- sum += vec_src1[i+j]*vec_src2[j];
+ sum += iemarray_getfloat(vec_src1, i+j)*iemarray_getfloat(vec_src2, j);
}
- vec_dst[i] = sum*f;
+ iemarray_setfloat(vec_dst, i, sum*f);
}
outlet_bang(x->x_obj.ob_outlet);
a = (t_garray *)pd_findbyclass(x->x_sym_dst, garray_class);
@@ -145,10 +146,9 @@ static void tab_cross_corr_bang(t_tab_cross_corr *x)
sum = 0.0f;
for(j=0; j<m; j++)
{
- sum += vec_src1[j]*vec_src2[j];
+ sum += iemarray_getfloat(vec_src1, j)*iemarray_getfloat(vec_src2, j);
}
- vec_dst[0] = sum*f;
-
+ iemarray_setfloat(vec_dst, 0, sum*f);
clock_delay(x->x_clock, x->x_delay);
}
}
@@ -164,20 +164,20 @@ static void *tab_cross_corr_new(t_symbol *s, int argc, t_atom *argv)
{
t_tab_cross_corr *x = (t_tab_cross_corr *)pd_new(tab_cross_corr_class);
t_symbol *src1, *src2, *dst;
- t_float time, factor;
+ t_float dtime=0.0f, factor=1.0f;
+ if((argc >= 5) && IS_A_FLOAT(argv,4))
+ dtime = (t_float)atom_getfloatarg(4, argc, argv);
+ if((argc >= 4) && IS_A_FLOAT(argv,3))
+ factor = (t_float)atom_getfloatarg(3, argc, argv);
if((argc >= 3) &&
IS_A_SYMBOL(argv,0) &&
IS_A_SYMBOL(argv,1) &&
- IS_A_SYMBOL(argv,2) &&
- IS_A_FLOAT(argv,3) &&
- IS_A_FLOAT(argv,4))
+ IS_A_SYMBOL(argv,2))
{
src1 = (t_symbol *)atom_getsymbolarg(0, argc, argv);
src2 = (t_symbol *)atom_getsymbolarg(1, argc, argv);
dst = (t_symbol *)atom_getsymbolarg(2, argc, argv);
- factor = (t_float)atom_getfloatarg(3, argc, argv);
- time = (t_float)atom_getfloatarg(4, argc, argv);
}
else
{
@@ -186,10 +186,10 @@ static void *tab_cross_corr_new(t_symbol *s, int argc, t_atom *argv)
return(0);
}
- if(time < 0.0f)
- time = 0.0f;
+ if(dtime < 0.0f)
+ dtime = 0.0f;
- x->x_delay = time;
+ x->x_delay = dtime;
x->x_factor = factor;
x->x_sym_scr1 = src1;
x->x_sym_scr2 = src2;
diff --git a/src/tab_div.c b/src/tab_div.c
index 6624dbf..c5bfd89 100644
--- a/src/tab_div.c
+++ b/src/tab_div.c
@@ -1,13 +1,14 @@
/* For information on usage and redistribution, and for a DISCLAIMER OF ALL
* WARRANTIES, see the file, "LICENSE.txt," in this distribution.
-iem_tab written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2006 */
+iem_tab written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2009 */
#include "m_pd.h"
#include "iemlib.h"
#include "iem_tab.h"
/* -------------------------- tab_div ------------------------------ */
+/* x_beg_mem_dst[i] = x_beg_mem_src1[i]/x_offset_src2[i] */
typedef struct _tab_div
{
@@ -18,9 +19,9 @@ typedef struct _tab_div
int x_offset_src1;
int x_offset_src2;
int x_offset_dst;
- t_float *x_beg_mem_src1;
- t_float *x_beg_mem_src2;
- t_float *x_beg_mem_dst;
+ iemarray_t *x_beg_mem_src1;
+ iemarray_t *x_beg_mem_src2;
+ iemarray_t *x_beg_mem_dst;
t_symbol *x_sym_scr1;
t_symbol *x_sym_scr2;
t_symbol *x_sym_dst;
@@ -47,7 +48,7 @@ static void tab_div_bang(t_tab_div *x)
{
int i, n;
int ok_src1, ok_src2, ok_dst;
- t_float *vec_src1, *vec_src2, *vec_dst;
+ iemarray_t *vec_src1, *vec_src2, *vec_dst;
ok_src1 = iem_tab_check_arrays(gensym("tab_div"), x->x_sym_scr1, &x->x_beg_mem_src1, &x->x_size_src1, 0);
ok_src2 = iem_tab_check_arrays(gensym("tab_div"), x->x_sym_scr2, &x->x_beg_mem_src2, &x->x_size_src2, 0);
@@ -71,10 +72,10 @@ static void tab_div_bang(t_tab_div *x)
for(i=0; i<n; i++)
{
- if(vec_src2[i] == 0.0f)
- vec_dst[i] = 0.0f;
+ if(iemarray_getfloat(vec_src2, i) == 0.0f)
+ iemarray_setfloat(vec_dst, i, 0.0f);
else
- vec_dst[i] = vec_src1[i] / vec_src2[i];
+ iemarray_setfloat(vec_dst, i, iemarray_getfloat(vec_src1, i) / iemarray_getfloat(vec_src2, i));
}
outlet_bang(x->x_obj.ob_outlet);
a = (t_garray *)pd_findbyclass(x->x_sym_dst, garray_class);
@@ -88,7 +89,7 @@ static void tab_div_list(t_tab_div *x, t_symbol *s, int argc, t_atom *argv)
int beg_src1, beg_src2, beg_dst;
int i, n;
int ok_src1, ok_src2, ok_dst;
- t_float *vec_src1, *vec_src2, *vec_dst;
+ iemarray_t *vec_src1, *vec_src2, *vec_dst;
if((argc >= 4) &&
IS_A_FLOAT(argv,0) &&
@@ -124,10 +125,10 @@ static void tab_div_list(t_tab_div *x, t_symbol *s, int argc, t_atom *argv)
for(i=0; i<n; i++)
{
- if(vec_src2[i] == 0.0f)
- vec_dst[i] = 0.0f;
+ if(iemarray_getfloat(vec_src2, i) == 0.0f)
+ iemarray_setfloat(vec_dst, i, 0.0f);
else
- vec_dst[i] = vec_src1[i] / vec_src2[i];
+ iemarray_setfloat(vec_dst, i, iemarray_getfloat(vec_src1, i) / iemarray_getfloat(vec_src2, i));
}
outlet_bang(x->x_obj.ob_outlet);
a = (t_garray *)pd_findbyclass(x->x_sym_dst, garray_class);
@@ -150,7 +151,6 @@ static void *tab_div_new(t_symbol *s, int argc, t_atom *argv)
{
t_tab_div *x = (t_tab_div *)pd_new(tab_div_class);
t_symbol *src1, *src2, *dst;
- t_float time;
if((argc >= 3) &&
IS_A_SYMBOL(argv,0) &&
diff --git a/src/tab_eq.c b/src/tab_eq.c
index af30e04..7ce5eaa 100644
--- a/src/tab_eq.c
+++ b/src/tab_eq.c
@@ -1,13 +1,17 @@
/* For information on usage and redistribution, and for a DISCLAIMER OF ALL
* WARRANTIES, see the file, "LICENSE.txt," in this distribution.
-iem_tab written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2006 */
+iem_tab written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2009 */
#include "m_pd.h"
#include "iemlib.h"
#include "iem_tab.h"
/* -------------------------- tab_eq ------------------------------ */
+/* if(x_beg_mem_src1[i] == x_beg_mem_src2[i]) */
+/* x_beg_mem_dst[i] = 1.0f; */
+/* else */
+/* x_beg_mem_dst[i] = 0.0f; */
typedef struct _tab_eq
{
@@ -18,9 +22,9 @@ typedef struct _tab_eq
int x_offset_src1;
int x_offset_src2;
int x_offset_dst;
- t_float *x_beg_mem_src1;
- t_float *x_beg_mem_src2;
- t_float *x_beg_mem_dst;
+ iemarray_t *x_beg_mem_src1;
+ iemarray_t *x_beg_mem_src2;
+ iemarray_t *x_beg_mem_dst;
t_symbol *x_sym_scr1;
t_symbol *x_sym_scr2;
t_symbol *x_sym_dst;
@@ -47,7 +51,7 @@ static void tab_eq_bang(t_tab_eq *x)
{
int i, n;
int ok_src1, ok_src2, ok_dst;
- t_float *vec_src1, *vec_src2, *vec_dst;
+ iemarray_t *vec_src1, *vec_src2, *vec_dst;
ok_src1 = iem_tab_check_arrays(gensym("tab_eq"), x->x_sym_scr1, &x->x_beg_mem_src1, &x->x_size_src1, 0);
ok_src2 = iem_tab_check_arrays(gensym("tab_eq"), x->x_sym_scr2, &x->x_beg_mem_src2, &x->x_size_src2, 0);
@@ -71,10 +75,10 @@ static void tab_eq_bang(t_tab_eq *x)
for(i=0; i<n; i++)
{
- if(vec_src1[i] == vec_src2[i])
- vec_dst[i] = 1.0f;
+ if(iemarray_getfloat(vec_src1, i) == iemarray_getfloat(vec_src2, i))
+ iemarray_setfloat(vec_dst, i, 1.0f);
else
- vec_dst[i] = 0.0f;
+ iemarray_setfloat(vec_dst, i, 0.0f);
}
outlet_bang(x->x_obj.ob_outlet);
a = (t_garray *)pd_findbyclass(x->x_sym_dst, garray_class);
@@ -88,7 +92,7 @@ static void tab_eq_list(t_tab_eq *x, t_symbol *s, int argc, t_atom *argv)
int beg_src1, beg_src2, beg_dst;
int i, n;
int ok_src1, ok_src2, ok_dst;
- t_float *vec_src1, *vec_src2, *vec_dst;
+ iemarray_t *vec_src1, *vec_src2, *vec_dst;
if((argc >= 4) &&
IS_A_FLOAT(argv,0) &&
@@ -124,10 +128,10 @@ static void tab_eq_list(t_tab_eq *x, t_symbol *s, int argc, t_atom *argv)
for(i=0; i<n; i++)
{
- if(vec_src1[i] == vec_src2[i])
- vec_dst[i] = 1.0f;
+ if(iemarray_getfloat(vec_src1, i) == iemarray_getfloat(vec_src2, i))
+ iemarray_setfloat(vec_dst, i, 1.0f);
else
- vec_dst[i] = 0.0f;
+ iemarray_setfloat(vec_dst, i, 0.0f);
}
outlet_bang(x->x_obj.ob_outlet);
a = (t_garray *)pd_findbyclass(x->x_sym_dst, garray_class);
@@ -150,7 +154,6 @@ static void *tab_eq_new(t_symbol *s, int argc, t_atom *argv)
{
t_tab_eq *x = (t_tab_eq *)pd_new(tab_eq_class);
t_symbol *src1, *src2, *dst;
- t_float time;
if((argc >= 3) &&
IS_A_SYMBOL(argv,0) &&
diff --git a/src/tab_eq_scalar.c b/src/tab_eq_scalar.c
index a322a45..32f4137 100644
--- a/src/tab_eq_scalar.c
+++ b/src/tab_eq_scalar.c
@@ -1,13 +1,17 @@
/* For information on usage and redistribution, and for a DISCLAIMER OF ALL
* WARRANTIES, see the file, "LICENSE.txt," in this distribution.
-iem_tab written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2006 */
+iem_tab written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2009 */
#include "m_pd.h"
#include "iemlib.h"
#include "iem_tab.h"
/* -------------------------- tab_eq_scalar ------------------------------ */
+/* if(x_beg_mem_src1[i] == compare) */
+/* x_beg_mem_dst[i] = 1.0f; */
+/* else */
+/* x_beg_mem_dst[i] += 0.0f; */
typedef struct _tab_eq_scalar
{
@@ -16,8 +20,8 @@ typedef struct _tab_eq_scalar
int x_size_dst;
int x_offset_src1;
int x_offset_dst;
- t_float *x_beg_mem_src1;
- t_float *x_beg_mem_dst;
+ iemarray_t *x_beg_mem_src1;
+ iemarray_t *x_beg_mem_dst;
t_symbol *x_sym_scr1;
t_symbol *x_sym_dst;
} t_tab_eq_scalar;
@@ -33,7 +37,7 @@ static void tab_eq_scalar_float(t_tab_eq_scalar *x, t_floatarg compare)
{
int i, n;
int ok_src1, ok_dst;
- t_float *vec_src1, *vec_dst;
+ iemarray_t *vec_src1, *vec_dst;
ok_src1 = iem_tab_check_arrays(gensym("tab_eq_scalar"), x->x_sym_scr1, &x->x_beg_mem_src1, &x->x_size_src1, 0);
ok_dst = iem_tab_check_arrays(gensym("tab_eq_scalar"), x->x_sym_dst, &x->x_beg_mem_dst, &x->x_size_dst, 0);
@@ -53,10 +57,10 @@ static void tab_eq_scalar_float(t_tab_eq_scalar *x, t_floatarg compare)
for(i=0; i<n; i++)
{
- if(vec_src1[i] == compare)
- vec_dst[i] = 1.0f;
+ if(iemarray_getfloat(vec_src1, i) == compare)
+ iemarray_setfloat(vec_dst, i, 1.0f);
else
- vec_dst[i] = 0.0f;
+ iemarray_setfloat(vec_dst, i, 0.0f);
}
outlet_bang(x->x_obj.ob_outlet);
a = (t_garray *)pd_findbyclass(x->x_sym_dst, garray_class);
@@ -75,7 +79,8 @@ static void tab_eq_scalar_list(t_tab_eq_scalar *x, t_symbol *s, int argc, t_atom
int beg_src1, beg_dst;
int i, n;
int ok_src1, ok_dst;
- t_float *vec_src1, *vec_dst, compare;
+ iemarray_t *vec_src1, *vec_dst;
+ t_float compare;
if((argc >= 4) &&
IS_A_FLOAT(argv,0) &&
@@ -107,10 +112,10 @@ static void tab_eq_scalar_list(t_tab_eq_scalar *x, t_symbol *s, int argc, t_atom
for(i=0; i<n; i++)
{
- if(vec_src1[i] == compare)
- vec_dst[i] = 1.0f;
+ if(iemarray_getfloat(vec_src1, i) == compare)
+ iemarray_setfloat(vec_dst, i, 1.0f);
else
- vec_dst[i] = 0.0f;
+ iemarray_setfloat(vec_dst, i, 0.0f);
}
outlet_bang(x->x_obj.ob_outlet);
a = (t_garray *)pd_findbyclass(x->x_sym_dst, garray_class);
diff --git a/src/tab_fft.c b/src/tab_fft.c
index 372e68c..a8107d4 100644
--- a/src/tab_fft.c
+++ b/src/tab_fft.c
@@ -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_tab written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2006 */
+iem_tab written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2009 */
#include "m_pd.h"
#include "iemlib.h"
@@ -9,6 +9,7 @@ iem_tab written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2006
#include <math.h>
/* -------------------------- tab_fft ------------------------------ */
+/* complex FFT */
typedef struct _tab_fft
{
@@ -22,10 +23,10 @@ typedef struct _tab_fft
int x_offset_dst_re;
int x_offset_dst_im;
int x_fftsize;
- t_float *x_beg_mem_src_re;
- t_float *x_beg_mem_src_im;
- t_float *x_beg_mem_dst_re;
- t_float *x_beg_mem_dst_im;
+ iemarray_t *x_beg_mem_src_re;
+ iemarray_t *x_beg_mem_src_im;
+ iemarray_t *x_beg_mem_dst_re;
+ iemarray_t *x_beg_mem_dst_im;
TAB_COMPLEX *x_sin_cos;
t_symbol *x_sym_src_re;
t_symbol *x_sym_src_im;
@@ -100,7 +101,7 @@ static void tab_fft_bang(t_tab_fft *x)
int fs2 = fftsize / 2;
TAB_COMPLEX w;
TAB_COMPLEX *sincos = x->x_sin_cos;
- t_float *vec_src_re, *vec_src_im, *vec_dst_re, *vec_dst_im;
+ iemarray_t *vec_src_re, *vec_src_im, *vec_dst_re, *vec_dst_im;
t_float old1_re, old1_im, old2_re, old2_im;
ok_src_re = iem_tab_check_arrays(gensym("tab_fft"), x->x_sym_src_re, &x->x_beg_mem_src_re, &x->x_size_src_re, fftsize);
@@ -118,8 +119,8 @@ static void tab_fft_bang(t_tab_fft *x)
for(k=0; k<fftsize; k++)
{
- vec_dst_re[k] = vec_src_re[k];
- vec_dst_im[k] = vec_src_im[k];
+ iemarray_setfloat(vec_dst_re, k, iemarray_getfloat(vec_src_re, k));
+ iemarray_setfloat(vec_dst_im, k, iemarray_getfloat(vec_src_im, k));
}
i_inc = fs2;
@@ -132,15 +133,16 @@ static void tab_fft_bang(t_tab_fft *x)
w_index = 0;
for(k=0; k<i_inc; k++)
{
- old1_re = vec_dst_re[v_index];
- old1_im = vec_dst_im[v_index];
- old2_re = vec_dst_re[v_index+i_inc];
- old2_im = vec_dst_im[v_index+i_inc];
+ old1_re = iemarray_getfloat(vec_dst_re, v_index);
+ old1_im = iemarray_getfloat(vec_dst_im, v_index);
+ old2_re = iemarray_getfloat(vec_dst_re, v_index+i_inc);
+ old2_im = iemarray_getfloat(vec_dst_im, v_index+i_inc);
+
w = sincos[w_index];
- vec_dst_re[v_index+i_inc] = (old1_re - old2_re)*w.real - (old1_im - old2_im)*w.imag;
- vec_dst_im[v_index+i_inc] = (old1_im - old2_im)*w.real + (old1_re - old2_re)*w.imag;
- vec_dst_re[v_index] = old1_re + old2_re;
- vec_dst_im[v_index] = old1_im + old2_im;
+ iemarray_setfloat(vec_dst_re, v_index+i_inc, (old1_re - old2_re)*w.real - (old1_im - old2_im)*w.imag);
+ iemarray_setfloat(vec_dst_im, v_index+i_inc, (old1_im - old2_im)*w.real + (old1_re - old2_re)*w.imag);
+ iemarray_setfloat(vec_dst_re, v_index, old1_re + old2_re);
+ iemarray_setfloat(vec_dst_im, v_index, old1_im + old2_im);
w_index += w_inc;
v_index++;
}
@@ -162,12 +164,12 @@ static void tab_fft_bang(t_tab_fft *x)
j = j + k;
if(i < j)
{
- old1_re = vec_dst_re[j];
- old1_im = vec_dst_im[j];
- vec_dst_re[j] = vec_dst_re[i];
- vec_dst_im[j] = vec_dst_im[i];
- vec_dst_re[i] = old1_re;
- vec_dst_im[i] = old1_im;
+ old1_re = iemarray_getfloat(vec_dst_re, j);
+ old1_im = iemarray_getfloat(vec_dst_im, j);
+ iemarray_setfloat(vec_dst_re, j, iemarray_getfloat(vec_dst_re, i));
+ iemarray_setfloat(vec_dst_im, j, iemarray_getfloat(vec_dst_im, i));
+ iemarray_setfloat(vec_dst_re, i, old1_re);
+ iemarray_setfloat(vec_dst_im, i, old1_im);
}
}
@@ -204,7 +206,7 @@ static void tab_fft_list(t_tab_fft *x, t_symbol *s, int argc, t_atom *argv)
int fs2 = fftsize / 2;
TAB_COMPLEX w;
TAB_COMPLEX *sincos = x->x_sin_cos;
- t_float *vec_src_re, *vec_src_im, *vec_dst_re, *vec_dst_im;
+ iemarray_t *vec_src_re, *vec_src_im, *vec_dst_re, *vec_dst_im;
t_float old1_re, old1_im, old2_re, old2_im;
if((argc >= 4) &&
@@ -242,8 +244,8 @@ static void tab_fft_list(t_tab_fft *x, t_symbol *s, int argc, t_atom *argv)
for(k=0; k<fftsize; k++)
{
- vec_dst_re[k] = vec_src_re[k];
- vec_dst_im[k] = vec_src_im[k];
+ iemarray_setfloat(vec_dst_re, k, iemarray_getfloat(vec_src_re, k));
+ iemarray_setfloat(vec_dst_im, k, iemarray_getfloat(vec_src_im, k));
}
i_inc = fs2;
@@ -256,15 +258,16 @@ static void tab_fft_list(t_tab_fft *x, t_symbol *s, int argc, t_atom *argv)
w_index = 0;
for(k=0; k<i_inc; k++)
{
- old1_re = vec_dst_re[v_index];
- old1_im = vec_dst_im[v_index];
- old2_re = vec_dst_re[v_index+i_inc];
- old2_im = vec_dst_im[v_index+i_inc];
+ old1_re = iemarray_getfloat(vec_dst_re, v_index);
+ old1_im = iemarray_getfloat(vec_dst_im, v_index);
+ old2_re = iemarray_getfloat(vec_dst_re, v_index+i_inc);
+ old2_im = iemarray_getfloat(vec_dst_im, v_index+i_inc);
+
w = sincos[w_index];
- vec_dst_re[v_index+i_inc] = (old1_re - old2_re)*w.real - (old1_im - old2_im)*w.imag;
- vec_dst_im[v_index+i_inc] = (old1_im - old2_im)*w.real + (old1_re - old2_re)*w.imag;
- vec_dst_re[v_index] = old1_re + old2_re;
- vec_dst_im[v_index] = old1_im + old2_im;
+ iemarray_setfloat(vec_dst_re, v_index+i_inc, (old1_re - old2_re)*w.real - (old1_im - old2_im)*w.imag);
+ iemarray_setfloat(vec_dst_im, v_index+i_inc, (old1_im - old2_im)*w.real + (old1_re - old2_re)*w.imag);
+ iemarray_setfloat(vec_dst_re, v_index, old1_re + old2_re);
+ iemarray_setfloat(vec_dst_im, v_index, old1_im + old2_im);
w_index += w_inc;
v_index++;
}
@@ -286,12 +289,12 @@ static void tab_fft_list(t_tab_fft *x, t_symbol *s, int argc, t_atom *argv)
j = j + k;
if(i < j)
{
- old1_re = vec_dst_re[j];
- old1_im = vec_dst_im[j];
- vec_dst_re[j] = vec_dst_re[i];
- vec_dst_im[j] = vec_dst_im[i];
- vec_dst_re[i] = old1_re;
- vec_dst_im[i] = old1_im;
+ old1_re = iemarray_getfloat(vec_dst_re, j);
+ old1_im = iemarray_getfloat(vec_dst_im, j);
+ iemarray_setfloat(vec_dst_re, j, iemarray_getfloat(vec_dst_re, i));
+ iemarray_setfloat(vec_dst_im, j, iemarray_getfloat(vec_dst_im, i));
+ iemarray_setfloat(vec_dst_re, i, old1_re);
+ iemarray_setfloat(vec_dst_im, i, old1_im);
}
}
diff --git a/src/tab_find_exact_peaks.c b/src/tab_find_exact_peaks.c
index d8cadbf..e57cef2 100644
--- a/src/tab_find_exact_peaks.c
+++ b/src/tab_find_exact_peaks.c
@@ -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_tab written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2006 */
+iem_tab written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2009 */
#include "m_pd.h"
#include "iemlib.h"
@@ -17,7 +17,7 @@ typedef struct _tab_find_exact_peaks
t_object x_obj;
int x_size_src1;
int x_offset_src1;
- t_float *x_beg_mem_src1;
+ iemarray_t *x_beg_mem_src1;
int x_work_alloc;
int *x_beg_mem_work1;
t_float *x_beg_mem_work2;
@@ -94,8 +94,9 @@ static void tab_find_exact_peaks_src(t_tab_find_exact_peaks *x, t_symbol *s)
static void tab_find_exact_peaks_bang(t_tab_find_exact_peaks *x)
{
int i, n, w, ww;
- int ok_src, peak_index=0, sort_index=0;
- t_float *vec_src, *vec_work2;
+ int ok_src, peak_index=0;
+ t_float *vec_work2;
+ iemarray_t *vec_src;
int *vec_work1;
t_float max=-1.0e37;
int max_peaks=x->x_n_peaks;
@@ -145,10 +146,10 @@ static void tab_find_exact_peaks_bang(t_tab_find_exact_peaks *x)
for(i=beg; i<end; i++)
{
- diff_low = vec_src[i-low_bord] - abs_min_height_diff;
- diff_high = vec_src[i+high_bord] - abs_min_height_diff;
- if((vec_src[i-low_bord-1] < diff_low) && !vec_work1[i-low_bord] &&
- (vec_src[i+high_bord+1] < diff_high) && !vec_work1[i+high_bord])
+ diff_low = iemarray_getfloat(vec_src, i-low_bord) - abs_min_height_diff;
+ diff_high = iemarray_getfloat(vec_src, i+high_bord) - abs_min_height_diff;
+ if((iemarray_getfloat(vec_src, i-low_bord-1) < diff_low) && !vec_work1[i-low_bord] &&
+ (iemarray_getfloat(vec_src, i+high_bord+1) < diff_high) && !vec_work1[i+high_bord])
{
for(j=i-low_bord; j<=i+high_bord; j++)
vec_work1[j] = 1;
@@ -174,7 +175,7 @@ static void tab_find_exact_peaks_bang(t_tab_find_exact_peaks *x)
peak_index = (i + j) / 2;
if(sort_index <= max_peaks)
{
- outlet_float(x->x_peak_value_out, vec_src[i]);
+ outlet_float(x->x_peak_value_out, iemarray_getfloat(vec_src, i));
outlet_float(x->x_peak_index_out, (t_float)peak_index);
outlet_float(x->x_sort_index_out, sort_index);
sort_index++;
@@ -207,15 +208,15 @@ static void tab_find_exact_peaks_bang(t_tab_find_exact_peaks *x)
for(i=beg; i<end; i++)
{
- diff_low = vec_src[i-low_bord] - abs_min_height_diff;
- diff_high = vec_src[i+high_bord] - abs_min_height_diff;
- if((vec_src[i-low_bord-1] < diff_low) && !vec_work1[i-low_bord] &&
- (vec_src[i+high_bord+1] < diff_high) && !vec_work1[i+high_bord])
+ diff_low = iemarray_getfloat(vec_src, i-low_bord) - abs_min_height_diff;
+ diff_high = iemarray_getfloat(vec_src, i+high_bord) - abs_min_height_diff;
+ if((iemarray_getfloat(vec_src, i-low_bord-1) < diff_low) && !vec_work1[i-low_bord] &&
+ (iemarray_getfloat(vec_src, i+high_bord+1) < diff_high) && !vec_work1[i+high_bord])
{
for(j=i-low_bord; j<=i+high_bord; j++)
{
vec_work1[j] = 1;
- vec_work2[j] = vec_src[j];
+ vec_work2[j] = iemarray_getfloat(vec_src, j);
}
//post("a[%d]=%g, a[%d]=%g",i-low_bord,vec_src[i-low_bord],i+high_bord,vec_src[i+high_bord]);
}
diff --git a/src/tab_find_peaks.c b/src/tab_find_peaks.c
index ad4e014..8fd1341 100644
--- a/src/tab_find_peaks.c
+++ b/src/tab_find_peaks.c
@@ -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_tab written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2006 */
+iem_tab written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2009 */
#include "m_pd.h"
#include "iemlib.h"
@@ -17,7 +17,7 @@ typedef struct _tab_find_peaks
t_object x_obj;
int x_size_src1;
int x_offset_src1;
- t_float *x_beg_mem_src1;
+ iemarray_t *x_beg_mem_src1;
int x_work_alloc;
int *x_beg_mem_work1;
t_float *x_beg_mem_work2;
@@ -94,8 +94,9 @@ static void tab_find_peaks_src(t_tab_find_peaks *x, t_symbol *s)
static void tab_find_peaks_bang(t_tab_find_peaks *x)
{
int i, n, w, ww;
- int ok_src, peak_index=0, sort_index=0;
- t_float *vec_src, *vec_work2;
+ int ok_src, peak_index=0;
+ iemarray_t *vec_src;
+ t_float *vec_work2;
int *vec_work1;
t_float max=-1.0e37;
int max_peaks=x->x_n_peaks;
@@ -145,10 +146,10 @@ static void tab_find_peaks_bang(t_tab_find_peaks *x)
for(i=beg; i<end; i++)
{
- diff_low = vec_src[i-low_bord] - abs_min_height_diff;
- diff_high = vec_src[i+high_bord] - abs_min_height_diff;
- if((vec_src[i-low_bord-1] < diff_low) && !vec_work1[i-low_bord] &&
- (vec_src[i+high_bord+1] < diff_high) && !vec_work1[i+high_bord])
+ diff_low = iemarray_getfloat(vec_src, i-low_bord) - abs_min_height_diff;
+ diff_high = iemarray_getfloat(vec_src, i+high_bord) - abs_min_height_diff;
+ if((iemarray_getfloat(vec_src, i-low_bord-1) < diff_low) && !vec_work1[i-low_bord] &&
+ (iemarray_getfloat(vec_src, i+high_bord+1) < diff_high) && !vec_work1[i+high_bord])
{
for(j=i-low_bord; j<=i+high_bord; j++)
vec_work1[j] = 1;
@@ -174,7 +175,7 @@ static void tab_find_peaks_bang(t_tab_find_peaks *x)
peak_index = (i + j) / 2;
if(sort_index <= max_peaks)
{
- outlet_float(x->x_peak_value_out, vec_src[i]);
+ outlet_float(x->x_peak_value_out, iemarray_getfloat(vec_src, i));
outlet_float(x->x_peak_index_out, (t_float)peak_index);
outlet_float(x->x_sort_index_out, sort_index);
sort_index++;
@@ -207,15 +208,15 @@ static void tab_find_peaks_bang(t_tab_find_peaks *x)
for(i=beg; i<end; i++)
{
- diff_low = vec_src[i-low_bord] - abs_min_height_diff;
- diff_high = vec_src[i+high_bord] - abs_min_height_diff;
- if((vec_src[i-low_bord-1] < diff_low) && !vec_work1[i-low_bord] &&
- (vec_src[i+high_bord+1] < diff_high) && !vec_work1[i+high_bord])
+ diff_low = iemarray_getfloat(vec_src, i-low_bord) - abs_min_height_diff;
+ diff_high = iemarray_getfloat(vec_src, i+high_bord) - abs_min_height_diff;
+ if((iemarray_getfloat(vec_src, i-low_bord-1) < diff_low) && !vec_work1[i-low_bord] &&
+ (iemarray_getfloat(vec_src, i+high_bord+1) < diff_high) && !vec_work1[i+high_bord])
{
for(j=i-low_bord; j<=i+high_bord; j++)
{
vec_work1[j] = 1;
- vec_work2[j] = vec_src[j];
+ vec_work2[j] = iemarray_getfloat(vec_src, j);
}
//post("a[%d]=%g, a[%d]=%g",i-low_bord,vec_src[i-low_bord],i+high_bord,vec_src[i+high_bord]);
}
diff --git a/src/tab_ge.c b/src/tab_ge.c
index cb22836..c066928 100644
--- a/src/tab_ge.c
+++ b/src/tab_ge.c
@@ -8,6 +8,10 @@ iem_tab written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2006
#include "iem_tab.h"
/* -------------------------- tab_ge ------------------------------ */
+/* if(x_beg_mem_src1[i] >= x_beg_mem_src2[i]) */
+/* x_beg_mem_dst[i] = 1.0f; */
+/* else */
+/* x_beg_mem_dst[i] = 0.0f; */
typedef struct _tab_ge
{
@@ -18,9 +22,9 @@ typedef struct _tab_ge
int x_offset_src1;
int x_offset_src2;
int x_offset_dst;
- t_float *x_beg_mem_src1;
- t_float *x_beg_mem_src2;
- t_float *x_beg_mem_dst;
+ iemarray_t *x_beg_mem_src1;
+ iemarray_t *x_beg_mem_src2;
+ iemarray_t *x_beg_mem_dst;
t_symbol *x_sym_scr1;
t_symbol *x_sym_scr2;
t_symbol *x_sym_dst;
@@ -47,7 +51,7 @@ static void tab_ge_bang(t_tab_ge *x)
{
int i, n;
int ok_src1, ok_src2, ok_dst;
- t_float *vec_src1, *vec_src2, *vec_dst;
+ iemarray_t *vec_src1, *vec_src2, *vec_dst;
ok_src1 = iem_tab_check_arrays(gensym("tab_ge"), x->x_sym_scr1, &x->x_beg_mem_src1, &x->x_size_src1, 0);
ok_src2 = iem_tab_check_arrays(gensym("tab_ge"), x->x_sym_scr2, &x->x_beg_mem_src2, &x->x_size_src2, 0);
@@ -71,10 +75,10 @@ static void tab_ge_bang(t_tab_ge *x)
for(i=0; i<n; i++)
{
- if(vec_src1[i] >= vec_src2[i])
- vec_dst[i] = 1.0f;
+ if(iemarray_getfloat(vec_src1, i) >= iemarray_getfloat(vec_src2, i))
+ iemarray_setfloat(vec_dst, i, 1.0f);
else
- vec_dst[i] = 0.0f;
+ iemarray_setfloat(vec_dst, i, 0.0f);
}
outlet_bang(x->x_obj.ob_outlet);
a = (t_garray *)pd_findbyclass(x->x_sym_dst, garray_class);
@@ -88,7 +92,7 @@ static void tab_ge_list(t_tab_ge *x, t_symbol *s, int argc, t_atom *argv)
int beg_src1, beg_src2, beg_dst;
int i, n;
int ok_src1, ok_src2, ok_dst;
- t_float *vec_src1, *vec_src2, *vec_dst;
+ iemarray_t *vec_src1, *vec_src2, *vec_dst;
if((argc >= 4) &&
IS_A_FLOAT(argv,0) &&
@@ -124,10 +128,10 @@ static void tab_ge_list(t_tab_ge *x, t_symbol *s, int argc, t_atom *argv)
for(i=0; i<n; i++)
{
- if(vec_src1[i] >= vec_src2[i])
- vec_dst[i] = 1.0f;
+ if(iemarray_getfloat(vec_src1, i) >= iemarray_getfloat(vec_src2, i))
+ iemarray_setfloat(vec_dst, i, 1.0f);
else
- vec_dst[i] = 0.0f;
+ iemarray_setfloat(vec_dst, i, 0.0f);
}
outlet_bang(x->x_obj.ob_outlet);
a = (t_garray *)pd_findbyclass(x->x_sym_dst, garray_class);
@@ -150,7 +154,6 @@ static void *tab_ge_new(t_symbol *s, int argc, t_atom *argv)
{
t_tab_ge *x = (t_tab_ge *)pd_new(tab_ge_class);
t_symbol *src1, *src2, *dst;
- t_float time;
if((argc >= 3) &&
IS_A_SYMBOL(argv,0) &&
diff --git a/src/tab_ge_scalar.c b/src/tab_ge_scalar.c
index 837dd6a..53a88c7 100644
--- a/src/tab_ge_scalar.c
+++ b/src/tab_ge_scalar.c
@@ -1,13 +1,17 @@
/* For information on usage and redistribution, and for a DISCLAIMER OF ALL
* WARRANTIES, see the file, "LICENSE.txt," in this distribution.
-iem_tab written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2006 */
+iem_tab written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2009 */
#include "m_pd.h"
#include "iemlib.h"
#include "iem_tab.h"
/* -------------------------- tab_ge_scalar ------------------------------ */
+/* if(x_beg_mem_src1[i] >= compare) */
+/* x_beg_mem_dst[i] = 1.0f; */
+/* else */
+/* x_beg_mem_dst[i] += 0.0f; */
typedef struct _tab_ge_scalar
{
@@ -16,8 +20,8 @@ typedef struct _tab_ge_scalar
int x_size_dst;
int x_offset_src1;
int x_offset_dst;
- t_float *x_beg_mem_src1;
- t_float *x_beg_mem_dst;
+ iemarray_t *x_beg_mem_src1;
+ iemarray_t *x_beg_mem_dst;
t_symbol *x_sym_scr1;
t_symbol *x_sym_dst;
} t_tab_ge_scalar;
@@ -33,7 +37,7 @@ static void tab_ge_scalar_float(t_tab_ge_scalar *x, t_floatarg compare)
{
int i, n;
int ok_src1, ok_dst;
- t_float *vec_src1, *vec_dst;
+ iemarray_t *vec_src1, *vec_dst;
ok_src1 = iem_tab_check_arrays(gensym("tab_ge_scalar"), x->x_sym_scr1, &x->x_beg_mem_src1, &x->x_size_src1, 0);
ok_dst = iem_tab_check_arrays(gensym("tab_ge_scalar"), x->x_sym_dst, &x->x_beg_mem_dst, &x->x_size_dst, 0);
@@ -53,10 +57,10 @@ static void tab_ge_scalar_float(t_tab_ge_scalar *x, t_floatarg compare)
for(i=0; i<n; i++)
{
- if(vec_src1[i] >= compare)
- vec_dst[i] = 1.0f;
+ if(iemarray_getfloat(vec_src1, i) >= compare)
+ iemarray_setfloat(vec_dst, i, 1.0f);
else
- vec_dst[i] = 0.0f;
+ iemarray_setfloat(vec_dst, i, 0.0f);
}
outlet_bang(x->x_obj.ob_outlet);
a = (t_garray *)pd_findbyclass(x->x_sym_dst, garray_class);
@@ -75,7 +79,8 @@ static void tab_ge_scalar_list(t_tab_ge_scalar *x, t_symbol *s, int argc, t_atom
int beg_src1, beg_dst;
int i, n;
int ok_src1, ok_dst;
- t_float *vec_src1, *vec_dst, compare;
+ t_float compare;
+ iemarray_t *vec_src1, *vec_dst;
if((argc >= 4) &&
IS_A_FLOAT(argv,0) &&
@@ -107,10 +112,10 @@ static void tab_ge_scalar_list(t_tab_ge_scalar *x, t_symbol *s, int argc, t_atom
for(i=0; i<n; i++)
{
- if(vec_src1[i] >= compare)
- vec_dst[i] = 1.0f;
+ if(iemarray_getfloat(vec_src1, i) >= compare)
+ iemarray_setfloat(vec_dst, i, 1.0f);
else
- vec_dst[i] = 0.0f;
+ iemarray_setfloat(vec_dst, i, 0.0f);
}
outlet_bang(x->x_obj.ob_outlet);
a = (t_garray *)pd_findbyclass(x->x_sym_dst, garray_class);
diff --git a/src/tab_gt.c b/src/tab_gt.c
index a130818..2bd0315 100644
--- a/src/tab_gt.c
+++ b/src/tab_gt.c
@@ -1,13 +1,17 @@
/* For information on usage and redistribution, and for a DISCLAIMER OF ALL
* WARRANTIES, see the file, "LICENSE.txt," in this distribution.
-iem_tab written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2006 */
+iem_tab written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2009 */
#include "m_pd.h"
#include "iemlib.h"
#include "iem_tab.h"
/* -------------------------- tab_gt ------------------------------ */
+/* if(x_beg_mem_src1[i] > x_beg_mem_src2[i]) */
+/* x_beg_mem_dst[i] = 1.0f; */
+/* else */
+/* x_beg_mem_dst[i] = 0.0f; */
typedef struct _tab_gt
{
@@ -18,9 +22,9 @@ typedef struct _tab_gt
int x_offset_src1;
int x_offset_src2;
int x_offset_dst;
- t_float *x_beg_mem_src1;
- t_float *x_beg_mem_src2;
- t_float *x_beg_mem_dst;
+ iemarray_t *x_beg_mem_src1;
+ iemarray_t *x_beg_mem_src2;
+ iemarray_t *x_beg_mem_dst;
t_symbol *x_sym_scr1;
t_symbol *x_sym_scr2;
t_symbol *x_sym_dst;
@@ -47,7 +51,7 @@ static void tab_gt_bang(t_tab_gt *x)
{
int i, n;
int ok_src1, ok_src2, ok_dst;
- t_float *vec_src1, *vec_src2, *vec_dst;
+ iemarray_t *vec_src1, *vec_src2, *vec_dst;
ok_src1 = iem_tab_check_arrays(gensym("tab_gt"), x->x_sym_scr1, &x->x_beg_mem_src1, &x->x_size_src1, 0);
ok_src2 = iem_tab_check_arrays(gensym("tab_gt"), x->x_sym_scr2, &x->x_beg_mem_src2, &x->x_size_src2, 0);
@@ -71,10 +75,10 @@ static void tab_gt_bang(t_tab_gt *x)
for(i=0; i<n; i++)
{
- if(vec_src1[i] > vec_src2[i])
- vec_dst[i] = 1.0f;
+ if(iemarray_getfloat(vec_src1, i) > iemarray_getfloat(vec_src2, i))
+ iemarray_setfloat(vec_dst, i, 1.0f);
else
- vec_dst[i] = 0.0f;
+ iemarray_setfloat(vec_dst, i, 0.0f);
}
outlet_bang(x->x_obj.ob_outlet);
a = (t_garray *)pd_findbyclass(x->x_sym_dst, garray_class);
@@ -88,7 +92,7 @@ static void tab_gt_list(t_tab_gt *x, t_symbol *s, int argc, t_atom *argv)
int beg_src1, beg_src2, beg_dst;
int i, n;
int ok_src1, ok_src2, ok_dst;
- t_float *vec_src1, *vec_src2, *vec_dst;
+ iemarray_t *vec_src1, *vec_src2, *vec_dst;
if((argc >= 4) &&
IS_A_FLOAT(argv,0) &&
@@ -124,10 +128,10 @@ static void tab_gt_list(t_tab_gt *x, t_symbol *s, int argc, t_atom *argv)
for(i=0; i<n; i++)
{
- if(vec_src1[i] > vec_src2[i])
- vec_dst[i] = 1.0f;
+ if(iemarray_getfloat(vec_src1, i) > iemarray_getfloat(vec_src2, i))
+ iemarray_setfloat(vec_dst, i, 1.0f);
else
- vec_dst[i] = 0.0f;
+ iemarray_setfloat(vec_dst, i, 0.0f);
}
outlet_bang(x->x_obj.ob_outlet);
a = (t_garray *)pd_findbyclass(x->x_sym_dst, garray_class);
@@ -150,7 +154,6 @@ static void *tab_gt_new(t_symbol *s, int argc, t_atom *argv)
{
t_tab_gt *x = (t_tab_gt *)pd_new(tab_gt_class);
t_symbol *src1, *src2, *dst;
- t_float time;
if((argc >= 3) &&
IS_A_SYMBOL(argv,0) &&
diff --git a/src/tab_gt_scalar.c b/src/tab_gt_scalar.c
index 366cd63..9c4f410 100644
--- a/src/tab_gt_scalar.c
+++ b/src/tab_gt_scalar.c
@@ -1,13 +1,17 @@
/* For information on usage and redistribution, and for a DISCLAIMER OF ALL
* WARRANTIES, see the file, "LICENSE.txt," in this distribution.
-iem_tab written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2006 */
+iem_tab written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2009 */
#include "m_pd.h"
#include "iemlib.h"
#include "iem_tab.h"
/* -------------------------- tab_gt_scalar ------------------------------ */
+/* if(x_beg_mem_src1[i] > compare) */
+/* x_beg_mem_dst[i] = 1.0f; */
+/* else */
+/* x_beg_mem_dst[i] += 0.0f; */
typedef struct _tab_gt_scalar
{
@@ -16,8 +20,8 @@ typedef struct _tab_gt_scalar
int x_size_dst;
int x_offset_src1;
int x_offset_dst;
- t_float *x_beg_mem_src1;
- t_float *x_beg_mem_dst;
+ iemarray_t *x_beg_mem_src1;
+ iemarray_t *x_beg_mem_dst;
t_symbol *x_sym_scr1;
t_symbol *x_sym_dst;
} t_tab_gt_scalar;
@@ -33,7 +37,7 @@ static void tab_gt_scalar_float(t_tab_gt_scalar *x, t_floatarg compare)
{
int i, n;
int ok_src1, ok_dst;
- t_float *vec_src1, *vec_dst;
+ iemarray_t *vec_src1, *vec_dst;
ok_src1 = iem_tab_check_arrays(gensym("tab_gt_scalar"), x->x_sym_scr1, &x->x_beg_mem_src1, &x->x_size_src1, 0);
ok_dst = iem_tab_check_arrays(gensym("tab_gt_scalar"), x->x_sym_dst, &x->x_beg_mem_dst, &x->x_size_dst, 0);
@@ -53,10 +57,10 @@ static void tab_gt_scalar_float(t_tab_gt_scalar *x, t_floatarg compare)
for(i=0; i<n; i++)
{
- if(vec_src1[i] > compare)
- vec_dst[i] = 1.0f;
+ if(iemarray_getfloat(vec_src1, i) > compare)
+ iemarray_setfloat(vec_dst, i, 1.0f);
else
- vec_dst[i] = 0.0f;
+ iemarray_setfloat(vec_dst, i, 0.0f);
}
outlet_bang(x->x_obj.ob_outlet);
a = (t_garray *)pd_findbyclass(x->x_sym_dst, garray_class);
@@ -75,7 +79,8 @@ static void tab_gt_scalar_list(t_tab_gt_scalar *x, t_symbol *s, int argc, t_atom
int beg_src1, beg_dst;
int i, n;
int ok_src1, ok_dst;
- t_float *vec_src1, *vec_dst, compare;
+ t_float compare;
+ iemarray_t *vec_src1, *vec_dst;
if((argc >= 4) &&
IS_A_FLOAT(argv,0) &&
@@ -107,10 +112,10 @@ static void tab_gt_scalar_list(t_tab_gt_scalar *x, t_symbol *s, int argc, t_atom
for(i=0; i<n; i++)
{
- if(vec_src1[i] > compare)
- vec_dst[i] = 1.0f;
+ if(iemarray_getfloat(vec_src1, i) > compare)
+ iemarray_setfloat(vec_dst, i, 1.0f);
else
- vec_dst[i] = 0.0f;
+ iemarray_setfloat(vec_dst, i, 0.0f);
}
outlet_bang(x->x_obj.ob_outlet);
a = (t_garray *)pd_findbyclass(x->x_sym_dst, garray_class);
diff --git a/src/tab_ifft.c b/src/tab_ifft.c
index b3b95b0..730db29 100644
--- a/src/tab_ifft.c
+++ b/src/tab_ifft.c
@@ -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_tab written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2006 */
+iem_tab written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2009 */
#include "m_pd.h"
#include "iemlib.h"
@@ -9,6 +9,7 @@ iem_tab written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2006
#include <math.h>
/* -------------------------- tab_ifft ------------------------------ */
+/* complex inverse FFT */
typedef struct _tab_ifft
{
@@ -22,10 +23,10 @@ typedef struct _tab_ifft
int x_offset_dst_re;
int x_offset_dst_im;
int x_fftsize;
- t_float *x_beg_mem_src_re;
- t_float *x_beg_mem_src_im;
- t_float *x_beg_mem_dst_re;
- t_float *x_beg_mem_dst_im;
+ iemarray_t *x_beg_mem_src_re;
+ iemarray_t *x_beg_mem_src_im;
+ iemarray_t *x_beg_mem_dst_re;
+ iemarray_t *x_beg_mem_dst_im;
TAB_COMPLEX *x_sin_cos;
t_symbol *x_sym_src_re;
t_symbol *x_sym_src_im;
@@ -100,7 +101,7 @@ static void tab_ifft_bang(t_tab_ifft *x)
int fs2 = fftsize / 2;
TAB_COMPLEX w;
TAB_COMPLEX *sincos = x->x_sin_cos;
- t_float *vec_src_re, *vec_src_im, *vec_dst_re, *vec_dst_im;
+ iemarray_t *vec_src_re, *vec_src_im, *vec_dst_re, *vec_dst_im;
t_float old1_re, old1_im, old2_re, old2_im, g;
ok_src_re = iem_tab_check_arrays(gensym("tab_ifft"), x->x_sym_src_re, &x->x_beg_mem_src_re, &x->x_size_src_re, fftsize);
@@ -119,8 +120,8 @@ static void tab_ifft_bang(t_tab_ifft *x)
for(j=0; j<fftsize; j++)
{
- vec_dst_re[j] = vec_src_re[j];
- vec_dst_im[j] = vec_src_im[j];
+ iemarray_setfloat(vec_dst_re, j, iemarray_getfloat(vec_src_re, j));
+ iemarray_setfloat(vec_dst_im, j, iemarray_getfloat(vec_src_im, j));
}
i_inc = fs2;
@@ -133,15 +134,16 @@ static void tab_ifft_bang(t_tab_ifft *x)
w_index = 0;
for(k=0; k<i_inc; k++)
{
- old1_re = vec_dst_re[v_index];
- old1_im = vec_dst_im[v_index];
- old2_re = vec_dst_re[v_index+i_inc];
- old2_im = vec_dst_im[v_index+i_inc];
+ old1_re = iemarray_getfloat(vec_dst_re, v_index);
+ old1_im = iemarray_getfloat(vec_dst_im, v_index);
+ old2_re = iemarray_getfloat(vec_dst_re, v_index+i_inc);
+ old2_im = iemarray_getfloat(vec_dst_im, v_index+i_inc);
+
w = sincos[w_index];
- vec_dst_re[v_index+i_inc] = (old1_re - old2_re)*w.real - (old1_im - old2_im)*w.imag;
- vec_dst_im[v_index+i_inc] = (old1_im - old2_im)*w.real + (old1_re - old2_re)*w.imag;
- vec_dst_re[v_index] = old1_re + old2_re;
- vec_dst_im[v_index] = old1_im + old2_im;
+ iemarray_setfloat(vec_dst_re, v_index+i_inc, (old1_re - old2_re)*w.real - (old1_im - old2_im)*w.imag);
+ iemarray_setfloat(vec_dst_im, v_index+i_inc, (old1_im - old2_im)*w.real + (old1_re - old2_re)*w.imag);
+ iemarray_setfloat(vec_dst_re, v_index, old1_re + old2_re);
+ iemarray_setfloat(vec_dst_im, v_index, old1_im + old2_im);
w_index += w_inc;
v_index++;
}
@@ -163,12 +165,12 @@ static void tab_ifft_bang(t_tab_ifft *x)
j = j + k;
if(i < j)
{
- old1_re = vec_dst_re[j];
- old1_im = vec_dst_im[j];
- vec_dst_re[j] = vec_dst_re[i];
- vec_dst_im[j] = vec_dst_im[i];
- vec_dst_re[i] = old1_re;
- vec_dst_im[i] = old1_im;
+ old1_re = iemarray_getfloat(vec_dst_re, j);
+ old1_im = iemarray_getfloat(vec_dst_im, j);
+ iemarray_setfloat(vec_dst_re, j, iemarray_getfloat(vec_dst_re, i));
+ iemarray_setfloat(vec_dst_im, j, iemarray_getfloat(vec_dst_im, i));
+ iemarray_setfloat(vec_dst_re, i, old1_re);
+ iemarray_setfloat(vec_dst_im, i, old1_im);
}
}
@@ -188,8 +190,8 @@ static void tab_ifft_bang(t_tab_ifft *x)
g = 1.0f / (t_float)fftsize;
for(i = 0; i < fftsize; i++)
{
- vec_dst_re[i] *= g;
- vec_dst_im[i] *= g;
+ iemarray_setfloat(vec_dst_re, i, iemarray_getfloat(vec_dst_re, i)*g);
+ iemarray_setfloat(vec_dst_im, i, iemarray_getfloat(vec_dst_im, i)*g);
}
outlet_bang(x->x_obj.ob_outlet);
@@ -211,7 +213,7 @@ static void tab_ifft_list(t_tab_ifft *x, t_symbol *s, int argc, t_atom *argv)
int fs2 = fftsize / 2;
TAB_COMPLEX w;
TAB_COMPLEX *sincos = x->x_sin_cos;
- t_float *vec_src_re, *vec_src_im, *vec_dst_re, *vec_dst_im;
+ iemarray_t *vec_src_re, *vec_src_im, *vec_dst_re, *vec_dst_im;
t_float old1_re, old1_im, old2_re, old2_im, g;
if((argc >= 4) &&
@@ -249,8 +251,8 @@ static void tab_ifft_list(t_tab_ifft *x, t_symbol *s, int argc, t_atom *argv)
for(j=0; j<fftsize; j++)
{
- vec_dst_re[j] = vec_src_re[j];
- vec_dst_im[j] = vec_src_im[j];
+ iemarray_setfloat(vec_dst_re, j, iemarray_getfloat(vec_src_re, j));
+ iemarray_setfloat(vec_dst_im, j, iemarray_getfloat(vec_src_im, j));
}
i_inc = fs2;
@@ -263,15 +265,16 @@ static void tab_ifft_list(t_tab_ifft *x, t_symbol *s, int argc, t_atom *argv)
w_index = 0;
for(k=0; k<i_inc; k++)
{
- old1_re = vec_dst_re[v_index];
- old1_im = vec_dst_im[v_index];
- old2_re = vec_dst_re[v_index+i_inc];
- old2_im = vec_dst_im[v_index+i_inc];
+ old1_re = iemarray_getfloat(vec_dst_re, v_index);
+ old1_im = iemarray_getfloat(vec_dst_im, v_index);
+ old2_re = iemarray_getfloat(vec_dst_re, v_index+i_inc);
+ old2_im = iemarray_getfloat(vec_dst_im, v_index+i_inc);
+
w = sincos[w_index];
- vec_dst_re[v_index+i_inc] = (old1_re - old2_re)*w.real - (old1_im - old2_im)*w.imag;
- vec_dst_im[v_index+i_inc] = (old1_im - old2_im)*w.real + (old1_re - old2_re)*w.imag;
- vec_dst_re[v_index] = old1_re + old2_re;
- vec_dst_im[v_index] = old1_im + old2_im;
+ iemarray_setfloat(vec_dst_re, v_index+i_inc, (old1_re - old2_re)*w.real - (old1_im - old2_im)*w.imag);
+ iemarray_setfloat(vec_dst_im, v_index+i_inc, (old1_im - old2_im)*w.real + (old1_re - old2_re)*w.imag);
+ iemarray_setfloat(vec_dst_re, v_index, old1_re + old2_re);
+ iemarray_setfloat(vec_dst_im, v_index, old1_im + old2_im);
w_index += w_inc;
v_index++;
}
@@ -293,12 +296,12 @@ static void tab_ifft_list(t_tab_ifft *x, t_symbol *s, int argc, t_atom *argv)
j = j + k;
if(i < j)
{
- old1_re = vec_dst_re[j];
- old1_im = vec_dst_im[j];
- vec_dst_re[j] = vec_dst_re[i];
- vec_dst_im[j] = vec_dst_im[i];
- vec_dst_re[i] = old1_re;
- vec_dst_im[i] = old1_im;
+ old1_re = iemarray_getfloat(vec_dst_re, j);
+ old1_im = iemarray_getfloat(vec_dst_im, j);
+ iemarray_setfloat(vec_dst_re, j, iemarray_getfloat(vec_dst_re, i));
+ iemarray_setfloat(vec_dst_im, j, iemarray_getfloat(vec_dst_im, i));
+ iemarray_setfloat(vec_dst_re, i, old1_re);
+ iemarray_setfloat(vec_dst_im, i, old1_im);
}
}
@@ -318,8 +321,8 @@ static void tab_ifft_list(t_tab_ifft *x, t_symbol *s, int argc, t_atom *argv)
g = 1.0f / (t_float)fftsize;
for(i = 0; i < fftsize; i++)
{
- vec_dst_re[i] *= g;
- vec_dst_im[i] *= g;
+ iemarray_setfloat(vec_dst_re, i, iemarray_getfloat(vec_dst_re, i)*g);
+ iemarray_setfloat(vec_dst_im, i, iemarray_getfloat(vec_dst_im, i)*g);
}
outlet_bang(x->x_obj.ob_outlet);
diff --git a/src/tab_le.c b/src/tab_le.c
index b1a1214..3c4f0b3 100644
--- a/src/tab_le.c
+++ b/src/tab_le.c
@@ -1,13 +1,17 @@
/* For information on usage and redistribution, and for a DISCLAIMER OF ALL
* WARRANTIES, see the file, "LICENSE.txt," in this distribution.
-iem_tab written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2006 */
+iem_tab written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2009 */
#include "m_pd.h"
#include "iemlib.h"
#include "iem_tab.h"
/* -------------------------- tab_le ------------------------------ */
+/* if(x_beg_mem_src1[i] <= x_beg_mem_src2[i]) */
+/* x_beg_mem_dst[i] = 1.0f; */
+/* else */
+/* x_beg_mem_dst[i] = 0.0f; */
typedef struct _tab_le
{
@@ -18,9 +22,9 @@ typedef struct _tab_le
int x_offset_src1;
int x_offset_src2;
int x_offset_dst;
- t_float *x_beg_mem_src1;
- t_float *x_beg_mem_src2;
- t_float *x_beg_mem_dst;
+ iemarray_t *x_beg_mem_src1;
+ iemarray_t *x_beg_mem_src2;
+ iemarray_t *x_beg_mem_dst;
t_symbol *x_sym_scr1;
t_symbol *x_sym_scr2;
t_symbol *x_sym_dst;
@@ -47,7 +51,7 @@ static void tab_le_bang(t_tab_le *x)
{
int i, n;
int ok_src1, ok_src2, ok_dst;
- t_float *vec_src1, *vec_src2, *vec_dst;
+ iemarray_t *vec_src1, *vec_src2, *vec_dst;
ok_src1 = iem_tab_check_arrays(gensym("tab_le"), x->x_sym_scr1, &x->x_beg_mem_src1, &x->x_size_src1, 0);
ok_src2 = iem_tab_check_arrays(gensym("tab_le"), x->x_sym_scr2, &x->x_beg_mem_src2, &x->x_size_src2, 0);
@@ -71,10 +75,10 @@ static void tab_le_bang(t_tab_le *x)
for(i=0; i<n; i++)
{
- if(vec_src1[i] <= vec_src2[i])
- vec_dst[i] = 1.0f;
+ if(iemarray_getfloat(vec_src1, i) <= iemarray_getfloat(vec_src2, i))
+ iemarray_setfloat(vec_dst, i, 1.0f);
else
- vec_dst[i] = 0.0f;
+ iemarray_setfloat(vec_dst, i, 0.0f);
}
outlet_bang(x->x_obj.ob_outlet);
a = (t_garray *)pd_findbyclass(x->x_sym_dst, garray_class);
@@ -88,7 +92,7 @@ static void tab_le_list(t_tab_le *x, t_symbol *s, int argc, t_atom *argv)
int beg_src1, beg_src2, beg_dst;
int i, n;
int ok_src1, ok_src2, ok_dst;
- t_float *vec_src1, *vec_src2, *vec_dst;
+ iemarray_t *vec_src1, *vec_src2, *vec_dst;
if((argc >= 4) &&
IS_A_FLOAT(argv,0) &&
@@ -124,10 +128,10 @@ static void tab_le_list(t_tab_le *x, t_symbol *s, int argc, t_atom *argv)
for(i=0; i<n; i++)
{
- if(vec_src1[i] <= vec_src2[i])
- vec_dst[i] = 1.0f;
+ if(iemarray_getfloat(vec_src1, i) <= iemarray_getfloat(vec_src2, i))
+ iemarray_setfloat(vec_dst, i, 1.0f);
else
- vec_dst[i] = 0.0f;
+ iemarray_setfloat(vec_dst, i, 0.0f);
}
outlet_bang(x->x_obj.ob_outlet);
a = (t_garray *)pd_findbyclass(x->x_sym_dst, garray_class);
@@ -150,7 +154,6 @@ static void *tab_le_new(t_symbol *s, int argc, t_atom *argv)
{
t_tab_le *x = (t_tab_le *)pd_new(tab_le_class);
t_symbol *src1, *src2, *dst;
- t_float time;
if((argc >= 3) &&
IS_A_SYMBOL(argv,0) &&
diff --git a/src/tab_le_scalar.c b/src/tab_le_scalar.c
index e221fcb..a88d8af 100644
--- a/src/tab_le_scalar.c
+++ b/src/tab_le_scalar.c
@@ -1,13 +1,17 @@
/* For information on usage and redistribution, and for a DISCLAIMER OF ALL
* WARRANTIES, see the file, "LICENSE.txt," in this distribution.
-iem_tab written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2006 */
+iem_tab written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2009 */
#include "m_pd.h"
#include "iemlib.h"
#include "iem_tab.h"
/* -------------------------- tab_le_scalar ------------------------------ */
+/* if(x_beg_mem_src1[i] <= compare) */
+/* x_beg_mem_dst[i] = 1.0f; */
+/* else */
+/* x_beg_mem_dst[i] += 0.0f; */
typedef struct _tab_le_scalar
{
@@ -16,8 +20,8 @@ typedef struct _tab_le_scalar
int x_size_dst;
int x_offset_src1;
int x_offset_dst;
- t_float *x_beg_mem_src1;
- t_float *x_beg_mem_dst;
+ iemarray_t *x_beg_mem_src1;
+ iemarray_t *x_beg_mem_dst;
t_symbol *x_sym_scr1;
t_symbol *x_sym_dst;
} t_tab_le_scalar;
@@ -33,7 +37,7 @@ static void tab_le_scalar_float(t_tab_le_scalar *x, t_floatarg compare)
{
int i, n;
int ok_src1, ok_dst;
- t_float *vec_src1, *vec_dst;
+ iemarray_t *vec_src1, *vec_dst;
ok_src1 = iem_tab_check_arrays(gensym("tab_le_scalar"), x->x_sym_scr1, &x->x_beg_mem_src1, &x->x_size_src1, 0);
ok_dst = iem_tab_check_arrays(gensym("tab_le_scalar"), x->x_sym_dst, &x->x_beg_mem_dst, &x->x_size_dst, 0);
@@ -53,10 +57,10 @@ static void tab_le_scalar_float(t_tab_le_scalar *x, t_floatarg compare)
for(i=0; i<n; i++)
{
- if(vec_src1[i] <= compare)
- vec_dst[i] = 1.0f;
+ if(iemarray_getfloat(vec_src1, i) <= compare)
+ iemarray_setfloat(vec_dst, i, 1.0f);
else
- vec_dst[i] = 0.0f;
+ iemarray_setfloat(vec_dst, i, 0.0f);
}
outlet_bang(x->x_obj.ob_outlet);
a = (t_garray *)pd_findbyclass(x->x_sym_dst, garray_class);
@@ -75,7 +79,8 @@ static void tab_le_scalar_list(t_tab_le_scalar *x, t_symbol *s, int argc, t_atom
int beg_src1, beg_dst;
int i, n;
int ok_src1, ok_dst;
- t_float *vec_src1, *vec_dst, compare;
+ t_float compare;
+ iemarray_t *vec_src1, *vec_dst;
if((argc >= 4) &&
IS_A_FLOAT(argv,0) &&
@@ -107,10 +112,10 @@ static void tab_le_scalar_list(t_tab_le_scalar *x, t_symbol *s, int argc, t_atom
for(i=0; i<n; i++)
{
- if(vec_src1[i] <= compare)
- vec_dst[i] = 1.0f;
+ if(iemarray_getfloat(vec_src1, i) <= compare)
+ iemarray_setfloat(vec_dst, i, 1.0f);
else
- vec_dst[i] = 0.0f;
+ iemarray_setfloat(vec_dst, i, 0.0f);
}
outlet_bang(x->x_obj.ob_outlet);
a = (t_garray *)pd_findbyclass(x->x_sym_dst, garray_class);
diff --git a/src/tab_lt.c b/src/tab_lt.c
index 34f1a49..81f3e68 100644
--- a/src/tab_lt.c
+++ b/src/tab_lt.c
@@ -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_tab written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2006 */
+iem_tab written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2009 */
#include "m_pd.h"
@@ -9,6 +9,10 @@ iem_tab written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2006
#include "iem_tab.h"
/* -------------------------- tab_lt ------------------------------ */
+/* if(x_beg_mem_src1[i] < x_beg_mem_src2[i]) */
+/* x_beg_mem_dst[i] = 1.0f; */
+/* else */
+/* x_beg_mem_dst[i] = 0.0f; */
typedef struct _tab_lt
{
@@ -19,9 +23,9 @@ typedef struct _tab_lt
int x_offset_src1;
int x_offset_src2;
int x_offset_dst;
- t_float *x_beg_mem_src1;
- t_float *x_beg_mem_src2;
- t_float *x_beg_mem_dst;
+ iemarray_t *x_beg_mem_src1;
+ iemarray_t *x_beg_mem_src2;
+ iemarray_t *x_beg_mem_dst;
t_symbol *x_sym_scr1;
t_symbol *x_sym_scr2;
t_symbol *x_sym_dst;
@@ -48,7 +52,7 @@ static void tab_lt_bang(t_tab_lt *x)
{
int i, n;
int ok_src1, ok_src2, ok_dst;
- t_float *vec_src1, *vec_src2, *vec_dst;
+ iemarray_t *vec_src1, *vec_src2, *vec_dst;
ok_src1 = iem_tab_check_arrays(gensym("tab_lt"), x->x_sym_scr1, &x->x_beg_mem_src1, &x->x_size_src1, 0);
ok_src2 = iem_tab_check_arrays(gensym("tab_lt"), x->x_sym_scr2, &x->x_beg_mem_src2, &x->x_size_src2, 0);
@@ -72,10 +76,10 @@ static void tab_lt_bang(t_tab_lt *x)
for(i=0; i<n; i++)
{
- if(vec_src1[i] < vec_src2[i])
- vec_dst[i] = 1.0f;
+ if(iemarray_getfloat(vec_src1, i) < iemarray_getfloat(vec_src2, i))
+ iemarray_setfloat(vec_dst, i, 1.0f);
else
- vec_dst[i] = 0.0f;
+ iemarray_setfloat(vec_dst, i, 0.0f);
}
outlet_bang(x->x_obj.ob_outlet);
a = (t_garray *)pd_findbyclass(x->x_sym_dst, garray_class);
@@ -89,7 +93,7 @@ static void tab_lt_list(t_tab_lt *x, t_symbol *s, int argc, t_atom *argv)
int beg_src1, beg_src2, beg_dst;
int i, n;
int ok_src1, ok_src2, ok_dst;
- t_float *vec_src1, *vec_src2, *vec_dst;
+ iemarray_t *vec_src1, *vec_src2, *vec_dst;
if((argc >= 4) &&
IS_A_FLOAT(argv,0) &&
@@ -125,10 +129,10 @@ static void tab_lt_list(t_tab_lt *x, t_symbol *s, int argc, t_atom *argv)
for(i=0; i<n; i++)
{
- if(vec_src1[i] < vec_src2[i])
- vec_dst[i] = 1.0f;
+ if(iemarray_getfloat(vec_src1, i) < iemarray_getfloat(vec_src2, i))
+ iemarray_setfloat(vec_dst, i, 1.0f);
else
- vec_dst[i] = 0.0f;
+ iemarray_setfloat(vec_dst, i, 0.0f);
}
outlet_bang(x->x_obj.ob_outlet);
a = (t_garray *)pd_findbyclass(x->x_sym_dst, garray_class);
@@ -151,7 +155,6 @@ static void *tab_lt_new(t_symbol *s, int argc, t_atom *argv)
{
t_tab_lt *x = (t_tab_lt *)pd_new(tab_lt_class);
t_symbol *src1, *src2, *dst;
- t_float time;
if((argc >= 3) &&
IS_A_SYMBOL(argv,0) &&
diff --git a/src/tab_lt_scalar.c b/src/tab_lt_scalar.c
index c335565..1605366 100644
--- a/src/tab_lt_scalar.c
+++ b/src/tab_lt_scalar.c
@@ -1,13 +1,17 @@
/* For information on usage and redistribution, and for a DISCLAIMER OF ALL
* WARRANTIES, see the file, "LICENSE.txt," in this distribution.
-iem_tab written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2006 */
+iem_tab written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2009 */
#include "m_pd.h"
#include "iemlib.h"
#include "iem_tab.h"
/* -------------------------- tab_lt_scalar ------------------------------ */
+/* if(x_beg_mem_src1[i] < compare) */
+/* x_beg_mem_dst[i] = 1.0f; */
+/* else */
+/* x_beg_mem_dst[i] += 0.0f; */
typedef struct _tab_lt_scalar
{
@@ -16,8 +20,8 @@ typedef struct _tab_lt_scalar
int x_size_dst;
int x_offset_src1;
int x_offset_dst;
- t_float *x_beg_mem_src1;
- t_float *x_beg_mem_dst;
+ iemarray_t *x_beg_mem_src1;
+ iemarray_t *x_beg_mem_dst;
t_symbol *x_sym_scr1;
t_symbol *x_sym_dst;
} t_tab_lt_scalar;
@@ -33,7 +37,7 @@ static void tab_lt_scalar_float(t_tab_lt_scalar *x, t_floatarg compare)
{
int i, n;
int ok_src1, ok_dst;
- t_float *vec_src1, *vec_dst;
+ iemarray_t *vec_src1, *vec_dst;
ok_src1 = iem_tab_check_arrays(gensym("tab_lt_scalar"), x->x_sym_scr1, &x->x_beg_mem_src1, &x->x_size_src1, 0);
ok_dst = iem_tab_check_arrays(gensym("tab_lt_scalar"), x->x_sym_dst, &x->x_beg_mem_dst, &x->x_size_dst, 0);
@@ -53,10 +57,10 @@ static void tab_lt_scalar_float(t_tab_lt_scalar *x, t_floatarg compare)
for(i=0; i<n; i++)
{
- if(vec_src1[i] < compare)
- vec_dst[i] = 1.0f;
+ if(iemarray_getfloat(vec_src1, i) < compare)
+ iemarray_setfloat(vec_dst, i, 1.0f);
else
- vec_dst[i] = 0.0f;
+ iemarray_setfloat(vec_dst, i, 0.0f);
}
outlet_bang(x->x_obj.ob_outlet);
a = (t_garray *)pd_findbyclass(x->x_sym_dst, garray_class);
@@ -75,7 +79,8 @@ static void tab_lt_scalar_list(t_tab_lt_scalar *x, t_symbol *s, int argc, t_atom
int beg_src1, beg_dst;
int i, n;
int ok_src1, ok_dst;
- t_float *vec_src1, *vec_dst, compare;
+ t_float compare;
+ iemarray_t *vec_src1, *vec_dst;
if((argc >= 4) &&
IS_A_FLOAT(argv,0) &&
@@ -107,10 +112,10 @@ static void tab_lt_scalar_list(t_tab_lt_scalar *x, t_symbol *s, int argc, t_atom
for(i=0; i<n; i++)
{
- if(vec_src1[i] < compare)
- vec_dst[i] = 1.0f;
+ if(iemarray_getfloat(vec_src1, i) < compare)
+ iemarray_setfloat(vec_dst, i, 1.0f);
else
- vec_dst[i] = 0.0f;
+ iemarray_setfloat(vec_dst, i, 0.0f);
}
outlet_bang(x->x_obj.ob_outlet);
a = (t_garray *)pd_findbyclass(x->x_sym_dst, garray_class);
diff --git a/src/tab_max_index.c b/src/tab_max_index.c
index 8da656b..c249ee1 100644
--- a/src/tab_max_index.c
+++ b/src/tab_max_index.c
@@ -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_tab written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2006 */
+iem_tab written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2009 */
#include "m_pd.h"
#include "iemlib.h"
@@ -14,7 +14,7 @@ typedef struct _tab_max_index
t_object x_obj;
int x_size_src1;
int x_offset_src1;
- t_float *x_beg_mem_src1;
+ iemarray_t *x_beg_mem_src1;
t_symbol *x_sym_scr1;
void *x_bang_out;
void *x_max_out;
@@ -32,7 +32,7 @@ static void tab_max_index_bang(t_tab_max_index *x)
{
int i, n;
int ok_src, max_index=0;
- t_float *vec_src;
+ iemarray_t *vec_src;
t_float max=-1.0e37;
ok_src = iem_tab_check_arrays(gensym("tab_max_index"), x->x_sym_scr1, &x->x_beg_mem_src1, &x->x_size_src1, 0);
@@ -45,9 +45,9 @@ static void tab_max_index_bang(t_tab_max_index *x)
{
for(i=0; i<n; i++)
{
- if(vec_src[i] > max)
+ if(iemarray_getfloat(vec_src, i) > max)
{
- max = vec_src[i];
+ max = iemarray_getfloat(vec_src, i);
max_index = i;
}
}
@@ -63,7 +63,7 @@ static void tab_max_index_list(t_tab_max_index *x, t_symbol *s, int argc, t_atom
int beg_src;
int i, n;
int ok_src, max_index=0;
- t_float *vec_src;
+ iemarray_t *vec_src;
t_float max=-1.0e37;
if((argc >= 2) &&
@@ -86,9 +86,9 @@ static void tab_max_index_list(t_tab_max_index *x, t_symbol *s, int argc, t_atom
{
for(i=0; i<n; i++)
{
- if(vec_src[i] > max)
+ if(iemarray_getfloat(vec_src, i) > max)
{
- max = vec_src[i];
+ max = iemarray_getfloat(vec_src, i);
max_index = i + beg_src;
}
}
diff --git a/src/tab_min_index.c b/src/tab_min_index.c
index 3a5c340..ad6c34e 100644
--- a/src/tab_min_index.c
+++ b/src/tab_min_index.c
@@ -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_tab written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2006 */
+iem_tab written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2009 */
#include "m_pd.h"
@@ -15,7 +15,7 @@ typedef struct _tab_min_index
t_object x_obj;
int x_size_src1;
int x_offset_src1;
- t_float *x_beg_mem_src1;
+ iemarray_t *x_beg_mem_src1;
t_symbol *x_sym_scr1;
void *x_bang_out;
void *x_min_out;
@@ -33,7 +33,7 @@ static void tab_min_index_bang(t_tab_min_index *x)
{
int i, n;
int ok_src, min_index=0;
- t_float *vec_src;
+ iemarray_t *vec_src;
t_float min=1.0e37;
ok_src = iem_tab_check_arrays(gensym("tab_min_index"), x->x_sym_scr1, &x->x_beg_mem_src1, &x->x_size_src1, 0);
@@ -46,9 +46,9 @@ static void tab_min_index_bang(t_tab_min_index *x)
{
for(i=0; i<n; i++)
{
- if(vec_src[i] < min)
+ if(iemarray_getfloat(vec_src, i) < min)
{
- min = vec_src[i];
+ min = iemarray_getfloat(vec_src, i);
min_index = i;
}
}
@@ -64,7 +64,7 @@ static void tab_min_index_list(t_tab_min_index *x, t_symbol *s, int argc, t_atom
int beg_src;
int i, n;
int ok_src, min_index=0;
- t_float *vec_src;
+ iemarray_t *vec_src;
t_float min=1.0e37;
if((argc >= 2) &&
@@ -87,9 +87,9 @@ static void tab_min_index_list(t_tab_min_index *x, t_symbol *s, int argc, t_atom
{
for(i=0; i<n; i++)
{
- if(vec_src[i] < min)
+ if(iemarray_getfloat(vec_src, i) < min)
{
- min = vec_src[i];
+ min = iemarray_getfloat(vec_src, i);
min_index = i + beg_src;
}
}
diff --git a/src/tab_min_max.c b/src/tab_min_max.c
index 2a9a402..c79e068 100644
--- a/src/tab_min_max.c
+++ b/src/tab_min_max.c
@@ -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_tab written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2006 */
+iem_tab written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2009 */
#include "m_pd.h"
@@ -16,7 +16,7 @@ typedef struct _tab_min_max
t_object x_obj;
int x_size_src1;
int x_offset_src1;
- t_float *x_beg_mem_src1;
+ iemarray_t *x_beg_mem_src1;
t_symbol *x_sym_scr1;
void *x_bang_out;
void *x_min_out;
@@ -34,7 +34,7 @@ static void tab_min_max_bang(t_tab_min_max *x)
{
int i, n;
int ok_src;
- t_float *vec_src;
+ iemarray_t *vec_src;
t_float min=1.0e37, max=-1.0e37;
ok_src = iem_tab_check_arrays(gensym("tab_min_max"), x->x_sym_scr1, &x->x_beg_mem_src1, &x->x_size_src1, 0);
@@ -47,10 +47,10 @@ static void tab_min_max_bang(t_tab_min_max *x)
{
for(i=0; i<n; i++)
{
- if(vec_src[i] > max)
- max = vec_src[i];
- if(vec_src[i] < min)
- min = vec_src[i];
+ if(iemarray_getfloat(vec_src, i) > max)
+ max = iemarray_getfloat(vec_src, i);
+ if(iemarray_getfloat(vec_src, i) < min)
+ min = iemarray_getfloat(vec_src, i);
}
outlet_float(x->x_max_out, max);
outlet_float(x->x_min_out, min);
@@ -64,7 +64,7 @@ static void tab_min_max_list(t_tab_min_max *x, t_symbol *s, int argc, t_atom *ar
int beg_src;
int i, n;
int ok_src;
- t_float *vec_src;
+ iemarray_t *vec_src;
t_float min=1.0e37, max=-1.0e37;
if((argc >= 2) &&
@@ -87,10 +87,10 @@ static void tab_min_max_list(t_tab_min_max *x, t_symbol *s, int argc, t_atom *ar
{
for(i=0; i<n; i++)
{
- if(vec_src[i] > max)
- max = vec_src[i];
- if(vec_src[i] < min)
- min = vec_src[i];
+ if(iemarray_getfloat(vec_src, i) > max)
+ max = iemarray_getfloat(vec_src, i);
+ if(iemarray_getfloat(vec_src, i) < min)
+ min = iemarray_getfloat(vec_src, i);
}
outlet_float(x->x_max_out, max);
outlet_float(x->x_min_out, min);
diff --git a/src/tab_mls.c b/src/tab_mls.c
index e78dc1e..449f3d3 100644
--- a/src/tab_mls.c
+++ b/src/tab_mls.c
@@ -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_tab written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2006 */
+iem_tab written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2009 */
#include "m_pd.h"
#include "iemlib.h"
@@ -15,7 +15,7 @@ typedef struct _tab_mls
t_object x_obj;
int x_size_dst;
int x_offset_dst;
- t_float *x_beg_mem_dst;
+ iemarray_t *x_beg_mem_dst;
t_symbol *x_sym_dst;
} t_tab_mls;
@@ -30,7 +30,7 @@ static int tab_mls_exp2(int mls_order)
return(j);
}
-static void tab_mls_calc(t_float *vec, int mls_order)
+static void tab_mls_calc(iemarray_t *vec, int mls_order)
{
int i, j;
int work1=1, work2, exor;
@@ -126,12 +126,12 @@ static void tab_mls_calc(t_float *vec, int mls_order)
}
if(exor & 1)
{
- vec[i] = 1.0f;
+ iemarray_setfloat(vec, i, 1.0f);
work1 = work2 | source;
}
else
{
- vec[i] = -1.0f;
+ iemarray_setfloat(vec, i, -1.0f);
work1 = work2;
}
}
@@ -170,7 +170,8 @@ static void tab_mls_list(t_tab_mls *x, t_symbol *s, int argc, t_atom *argv)
int beg_dst;
int i, n;
int ok_dst;
- t_float *vec_dst, c;
+ t_float c;
+ iemarray_t *vec_dst;
if((argc >= 3) &&
IS_A_FLOAT(argv,0) &&
@@ -195,7 +196,7 @@ static void tab_mls_list(t_tab_mls *x, t_symbol *s, int argc, t_atom *argv)
t_garray *a;
for(i=0; i<n; i++)
- vec_dst[i] = c;
+ iemarray_setfloat(vec_dst, i, c);
outlet_bang(x->x_obj.ob_outlet);
a = (t_garray *)pd_findbyclass(x->x_sym_dst, garray_class);
garray_redraw(a);
diff --git a/src/tab_mul.c b/src/tab_mul.c
index 38b401a..d684de0 100644
--- a/src/tab_mul.c
+++ b/src/tab_mul.c
@@ -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_tab written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2006 */
+iem_tab written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2009 */
#include "m_pd.h"
#include "iemlib.h"
@@ -9,6 +9,7 @@ iem_tab written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2006
/* -------------------------- tab_mul ------------------------------ */
+/* x_beg_mem_dst[i] = x_beg_mem_src1[i]*x_offset_src2[i] */
typedef struct _tab_mul
{
@@ -19,9 +20,9 @@ typedef struct _tab_mul
int x_offset_src1;
int x_offset_src2;
int x_offset_dst;
- t_float *x_beg_mem_src1;
- t_float *x_beg_mem_src2;
- t_float *x_beg_mem_dst;
+ iemarray_t *x_beg_mem_src1;
+ iemarray_t *x_beg_mem_src2;
+ iemarray_t *x_beg_mem_dst;
t_symbol *x_sym_scr1;
t_symbol *x_sym_scr2;
t_symbol *x_sym_dst;
@@ -48,7 +49,7 @@ static void tab_mul_bang(t_tab_mul *x)
{
int i, n;
int ok_src1, ok_src2, ok_dst;
- t_float *vec_src1, *vec_src2, *vec_dst;
+ iemarray_t *vec_src1, *vec_src2, *vec_dst;
ok_src1 = iem_tab_check_arrays(gensym("tab_mul"), x->x_sym_scr1, &x->x_beg_mem_src1, &x->x_size_src1, 0);
ok_src2 = iem_tab_check_arrays(gensym("tab_mul"), x->x_sym_scr2, &x->x_beg_mem_src2, &x->x_size_src2, 0);
@@ -71,7 +72,7 @@ static void tab_mul_bang(t_tab_mul *x)
t_garray *a;
for(i=0; i<n; i++)
- vec_dst[i] = vec_src1[i]*vec_src2[i];
+ iemarray_setfloat(vec_dst, i, iemarray_getfloat(vec_src1, i)*iemarray_getfloat(vec_src2, i));
outlet_bang(x->x_obj.ob_outlet);
a = (t_garray *)pd_findbyclass(x->x_sym_dst, garray_class);
garray_redraw(a);
@@ -84,7 +85,7 @@ static void tab_mul_list(t_tab_mul *x, t_symbol *s, int argc, t_atom *argv)
int beg_src1, beg_src2, beg_dst;
int i, n;
int ok_src1, ok_src2, ok_dst;
- t_float *vec_src1, *vec_src2, *vec_dst;
+ iemarray_t *vec_src1, *vec_src2, *vec_dst;
if((argc >= 4) &&
IS_A_FLOAT(argv,0) &&
@@ -119,7 +120,7 @@ static void tab_mul_list(t_tab_mul *x, t_symbol *s, int argc, t_atom *argv)
t_garray *a;
for(i=0; i<n; i++)
- vec_dst[i] = vec_src1[i]*vec_src2[i];
+ iemarray_setfloat(vec_dst, i, iemarray_getfloat(vec_src1, i)*iemarray_getfloat(vec_src2, i));
outlet_bang(x->x_obj.ob_outlet);
a = (t_garray *)pd_findbyclass(x->x_sym_dst, garray_class);
garray_redraw(a);
@@ -141,7 +142,6 @@ static void *tab_mul_new(t_symbol *s, int argc, t_atom *argv)
{
t_tab_mul *x = (t_tab_mul *)pd_new(tab_mul_class);
t_symbol *src1, *src2, *dst;
- t_float time;
if((argc >= 3) &&
IS_A_SYMBOL(argv,0) &&
diff --git a/src/tab_mul_scalar.c b/src/tab_mul_scalar.c
index 7bb1855..c642237 100644
--- a/src/tab_mul_scalar.c
+++ b/src/tab_mul_scalar.c
@@ -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_tab written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2006 */
+iem_tab written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2009 */
#include "m_pd.h"
#include "iemlib.h"
@@ -9,6 +9,7 @@ iem_tab written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2006
/* -------------------------- tab_mul_scalar ------------------------------ */
+/* x_beg_mem_dst[i] = x_beg_mem_src1[i]*m */
typedef struct _tab_mul_scalar
{
@@ -17,8 +18,8 @@ typedef struct _tab_mul_scalar
int x_size_dst;
int x_offset_src1;
int x_offset_dst;
- t_float *x_beg_mem_src1;
- t_float *x_beg_mem_dst;
+ iemarray_t *x_beg_mem_src1;
+ iemarray_t *x_beg_mem_dst;
t_symbol *x_sym_scr1;
t_symbol *x_sym_dst;
} t_tab_mul_scalar;
@@ -34,7 +35,7 @@ static void tab_mul_scalar_float(t_tab_mul_scalar *x, t_floatarg m)
{
int i, n;
int ok_src1, ok_dst;
- t_float *vec_src1, *vec_dst;
+ iemarray_t *vec_src1, *vec_dst;
ok_src1 = iem_tab_check_arrays(gensym("tab_mul_scalar"), x->x_sym_scr1, &x->x_beg_mem_src1, &x->x_size_src1, 0);
ok_dst = iem_tab_check_arrays(gensym("tab_mul_scalar"), x->x_sym_dst, &x->x_beg_mem_dst, &x->x_size_dst, 0);
@@ -71,7 +72,8 @@ static void tab_mul_scalar_list(t_tab_mul_scalar *x, t_symbol *s, int argc, t_at
int beg_src1, beg_dst;
int i, n;
int ok_src1, ok_dst;
- t_float *vec_src1, *vec_dst, m;
+ t_float m;
+ iemarray_t *vec_src1, *vec_dst;
if((argc >= 4) &&
IS_A_FLOAT(argv,0) &&
diff --git a/src/tab_ne.c b/src/tab_ne.c
index bd4f6de..4239d8a 100644
--- a/src/tab_ne.c
+++ b/src/tab_ne.c
@@ -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_tab written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2006 */
+iem_tab written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2009 */
#include "m_pd.h"
@@ -9,6 +9,10 @@ iem_tab written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2006
#include "iem_tab.h"
/* -------------------------- tab_ne ------------------------------ */
+/* if(x_beg_mem_src1[i] != x_beg_mem_src2[i]) */
+/* x_beg_mem_dst[i] = 1.0f; */
+/* else */
+/* x_beg_mem_dst[i] = 0.0f; */
typedef struct _tab_ne
{
@@ -19,9 +23,9 @@ typedef struct _tab_ne
int x_offset_src1;
int x_offset_src2;
int x_offset_dst;
- t_float *x_beg_mem_src1;
- t_float *x_beg_mem_src2;
- t_float *x_beg_mem_dst;
+ iemarray_t *x_beg_mem_src1;
+ iemarray_t *x_beg_mem_src2;
+ iemarray_t *x_beg_mem_dst;
t_symbol *x_sym_scr1;
t_symbol *x_sym_scr2;
t_symbol *x_sym_dst;
@@ -48,7 +52,7 @@ static void tab_ne_bang(t_tab_ne *x)
{
int i, n;
int ok_src1, ok_src2, ok_dst;
- t_float *vec_src1, *vec_src2, *vec_dst;
+ iemarray_t *vec_src1, *vec_src2, *vec_dst;
ok_src1 = iem_tab_check_arrays(gensym("tab_ne"), x->x_sym_scr1, &x->x_beg_mem_src1, &x->x_size_src1, 0);
ok_src2 = iem_tab_check_arrays(gensym("tab_ne"), x->x_sym_scr2, &x->x_beg_mem_src2, &x->x_size_src2, 0);
@@ -72,10 +76,10 @@ static void tab_ne_bang(t_tab_ne *x)
for(i=0; i<n; i++)
{
- if(vec_src1[i] != vec_src2[i])
- vec_dst[i] = 1.0f;
+ if(iemarray_getfloat(vec_src1, i) != iemarray_getfloat(vec_src2, i))
+ iemarray_setfloat(vec_dst, i, 1.0f);
else
- vec_dst[i] = 0.0f;
+ iemarray_setfloat(vec_dst, i, 0.0f);
}
outlet_bang(x->x_obj.ob_outlet);
a = (t_garray *)pd_findbyclass(x->x_sym_dst, garray_class);
@@ -89,7 +93,7 @@ static void tab_ne_list(t_tab_ne *x, t_symbol *s, int argc, t_atom *argv)
int beg_src1, beg_src2, beg_dst;
int i, n;
int ok_src1, ok_src2, ok_dst;
- t_float *vec_src1, *vec_src2, *vec_dst;
+ iemarray_t *vec_src1, *vec_src2, *vec_dst;
if((argc >= 4) &&
IS_A_FLOAT(argv,0) &&
@@ -125,10 +129,10 @@ static void tab_ne_list(t_tab_ne *x, t_symbol *s, int argc, t_atom *argv)
for(i=0; i<n; i++)
{
- if(vec_src1[i] != vec_src2[i])
- vec_dst[i] = 1.0f;
+ if(iemarray_getfloat(vec_src1, i) != iemarray_getfloat(vec_src2, i))
+ iemarray_setfloat(vec_dst, i, 1.0f);
else
- vec_dst[i] = 0.0f;
+ iemarray_setfloat(vec_dst, i, 0.0f);
}
outlet_bang(x->x_obj.ob_outlet);
a = (t_garray *)pd_findbyclass(x->x_sym_dst, garray_class);
@@ -151,7 +155,6 @@ static void *tab_ne_new(t_symbol *s, int argc, t_atom *argv)
{
t_tab_ne *x = (t_tab_ne *)pd_new(tab_ne_class);
t_symbol *src1, *src2, *dst;
- t_float time;
if((argc >= 3) &&
IS_A_SYMBOL(argv,0) &&
diff --git a/src/tab_ne_scalar.c b/src/tab_ne_scalar.c
index a7597c3..c0eec06 100644
--- a/src/tab_ne_scalar.c
+++ b/src/tab_ne_scalar.c
@@ -1,13 +1,17 @@
/* For information on usage and redistribution, and for a DISCLAIMER OF ALL
* WARRANTIES, see the file, "LICENSE.txt," in this distribution.
-iem_tab written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2006 */
+iem_tab written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2009 */
#include "m_pd.h"
#include "iemlib.h"
#include "iem_tab.h"
/* -------------------------- tab_ne_scalar ------------------------------ */
+/* if(x_beg_mem_src1[i] != compare) */
+/* x_beg_mem_dst[i] = 1.0f; */
+/* else */
+/* x_beg_mem_dst[i] += 0.0f; */
typedef struct _tab_ne_scalar
{
@@ -16,8 +20,8 @@ typedef struct _tab_ne_scalar
int x_size_dst;
int x_offset_src1;
int x_offset_dst;
- t_float *x_beg_mem_src1;
- t_float *x_beg_mem_dst;
+ iemarray_t *x_beg_mem_src1;
+ iemarray_t *x_beg_mem_dst;
t_symbol *x_sym_scr1;
t_symbol *x_sym_dst;
} t_tab_ne_scalar;
@@ -33,7 +37,7 @@ static void tab_ne_scalar_float(t_tab_ne_scalar *x, t_floatarg compare)
{
int i, n;
int ok_src1, ok_dst;
- t_float *vec_src1, *vec_dst;
+ iemarray_t *vec_src1, *vec_dst;
ok_src1 = iem_tab_check_arrays(gensym("tab_ne_scalar"), x->x_sym_scr1, &x->x_beg_mem_src1, &x->x_size_src1, 0);
ok_dst = iem_tab_check_arrays(gensym("tab_ne_scalar"), x->x_sym_dst, &x->x_beg_mem_dst, &x->x_size_dst, 0);
@@ -53,10 +57,10 @@ static void tab_ne_scalar_float(t_tab_ne_scalar *x, t_floatarg compare)
for(i=0; i<n; i++)
{
- if(vec_src1[i] != compare)
- vec_dst[i] = 1.0f;
+ if(iemarray_getfloat(vec_src1, i) != compare)
+ iemarray_setfloat(vec_dst, i, 1.0f);
else
- vec_dst[i] = 0.0f;
+ iemarray_setfloat(vec_dst, i, 0.0f);
}
outlet_bang(x->x_obj.ob_outlet);
a = (t_garray *)pd_findbyclass(x->x_sym_dst, garray_class);
@@ -75,7 +79,8 @@ static void tab_ne_scalar_list(t_tab_ne_scalar *x, t_symbol *s, int argc, t_atom
int beg_src1, beg_dst;
int i, n;
int ok_src1, ok_dst;
- t_float *vec_src1, *vec_dst, compare;
+ t_float compare;
+ iemarray_t *vec_src1, *vec_dst;
if((argc >= 4) &&
IS_A_FLOAT(argv,0) &&
@@ -107,10 +112,10 @@ static void tab_ne_scalar_list(t_tab_ne_scalar *x, t_symbol *s, int argc, t_atom
for(i=0; i<n; i++)
{
- if(vec_src1[i] != compare)
- vec_dst[i] = 1.0f;
+ if(iemarray_getfloat(vec_src1, i) != compare)
+ iemarray_setfloat(vec_dst, i, 1.0f);
else
- vec_dst[i] = 0.0f;
+ iemarray_setfloat(vec_dst, i, 0.0f);
}
outlet_bang(x->x_obj.ob_outlet);
a = (t_garray *)pd_findbyclass(x->x_sym_dst, garray_class);
diff --git a/src/tab_reverse.c b/src/tab_reverse.c
index af42c94..fb7fdf2 100644
--- a/src/tab_reverse.c
+++ b/src/tab_reverse.c
@@ -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_tab written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2006 */
+iem_tab written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2009 */
#include "m_pd.h"
@@ -18,8 +18,8 @@ typedef struct _tab_reverse
int x_size_dst;
int x_offset_src1;
int x_offset_dst;
- t_float *x_beg_mem_src1;
- t_float *x_beg_mem_dst;
+ iemarray_t *x_beg_mem_src1;
+ iemarray_t *x_beg_mem_dst;
t_symbol *x_sym_scr1;
t_symbol *x_sym_dst;
} t_tab_reverse;
@@ -38,9 +38,10 @@ static void tab_reverse_dst(t_tab_reverse *x, t_symbol *s)
static void tab_reverse_bang(t_tab_reverse *x)
{
- int i, j, n;
+ int i, j, n, n2;
int ok_src, ok_dst;
- t_float *vec_src, *vec_dst;
+ iemarray_t *vec_src, *vec_dst;
+ t_float f;
ok_src = iem_tab_check_arrays(gensym("tab_reverse"), x->x_sym_scr1, &x->x_beg_mem_src1, &x->x_size_src1, 0);
ok_dst = iem_tab_check_arrays(gensym("tab_reverse"), x->x_sym_dst, &x->x_beg_mem_dst, &x->x_size_dst, 0);
@@ -53,12 +54,17 @@ static void tab_reverse_bang(t_tab_reverse *x)
n = x->x_size_dst;
vec_src = x->x_beg_mem_src1;
vec_dst = x->x_beg_mem_dst;
+ n2 = n/2;
if(n)
{
t_garray *a;
- for(i=0, j=n-1; i<n; i++, j--)
- vec_dst[i] = vec_src[j];
+ for(i=0, j=n-1; i<n2; i++, j--)
+ {
+ f = iemarray_getfloat(vec_src, i);
+ iemarray_setfloat(vec_dst, i, iemarray_getfloat(vec_src, j));
+ iemarray_setfloat(vec_dst, j, f);
+ }
outlet_bang(x->x_obj.ob_outlet);
a = (t_garray *)pd_findbyclass(x->x_sym_dst, garray_class);
garray_redraw(a);
@@ -69,9 +75,10 @@ static void tab_reverse_bang(t_tab_reverse *x)
static void tab_reverse_list(t_tab_reverse *x, t_symbol *s, int argc, t_atom *argv)
{
int beg_src, beg_dst;
- int i, j, n;
+ int i, j, n, n2;
int ok_src, ok_dst;
- t_float *vec_src, *vec_dst;
+ iemarray_t *vec_src, *vec_dst;
+ t_float f;
if((argc >= 3) &&
IS_A_FLOAT(argv,0) &&
@@ -95,12 +102,17 @@ static void tab_reverse_list(t_tab_reverse *x, t_symbol *s, int argc, t_atom *ar
{
vec_src = x->x_beg_mem_src1 + beg_src;
vec_dst = x->x_beg_mem_dst + beg_dst;
+ n2 = n/2;
if(n)
{
t_garray *a;
- for(i=0, j=n-1; i<n; i++, j--)
- vec_dst[i] = vec_src[j];
+ for(i=0, j=n-1; i<n2; i++, j--)
+ {
+ f = iemarray_getfloat(vec_src, i);
+ iemarray_setfloat(vec_dst, i, iemarray_getfloat(vec_src, j));
+ iemarray_setfloat(vec_dst, j, f);
+ }
outlet_bang(x->x_obj.ob_outlet);
a = (t_garray *)pd_findbyclass(x->x_sym_dst, garray_class);
garray_redraw(a);
diff --git a/src/tab_rfft.c b/src/tab_rfft.c
index 353b047..1a3608f 100644
--- a/src/tab_rfft.c
+++ b/src/tab_rfft.c
@@ -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_tab written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2006 */
+iem_tab written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2009 */
#include "m_pd.h"
#include "iemlib.h"
@@ -10,6 +10,7 @@ iem_tab written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2006
/* -------------------------- tab_rfft ------------------------------ */
+/* real time domain FFT to complex spectral domain */
typedef struct _tab_rfft
{
@@ -21,9 +22,9 @@ typedef struct _tab_rfft
int x_offset_dst_re;
int x_offset_dst_im;
int x_fftsize;
- t_float *x_beg_mem_src1;
- t_float *x_beg_mem_dst_re;
- t_float *x_beg_mem_dst_im;
+ iemarray_t *x_beg_mem_src1;
+ iemarray_t *x_beg_mem_dst_re;
+ iemarray_t *x_beg_mem_dst_im;
TAB_COMPLEX *x_sin_cos;
t_symbol *x_sym_src1;
t_symbol *x_sym_dst_re;
@@ -92,7 +93,7 @@ static void tab_rfft_bang(t_tab_rfft *x)
int fs2 = fftsize / 2;
TAB_COMPLEX w;
TAB_COMPLEX *sincos = x->x_sin_cos;
- t_float *vec_src, *vec_dst_re, *vec_dst_im;
+ iemarray_t *vec_src, *vec_dst_re, *vec_dst_im;
t_float old1_re, old1_im, old2_re, old2_im;
ok_src = iem_tab_check_arrays(gensym("tab_rfft"), x->x_sym_src1, &x->x_beg_mem_src1, &x->x_size_src1, fftsize);
@@ -108,8 +109,8 @@ static void tab_rfft_bang(t_tab_rfft *x)
for(k=0; k<fftsize; k++)
{
- vec_dst_re[k] = vec_src[k];
- vec_dst_im[k] = 0.0f;
+ iemarray_setfloat(vec_dst_re, k, iemarray_getfloat(vec_src, k));
+ iemarray_setfloat(vec_dst_im, k, 0.0f);
}
i_inc = fs2;
@@ -122,15 +123,16 @@ static void tab_rfft_bang(t_tab_rfft *x)
w_index = 0;
for(k=0; k<i_inc; k++)
{
- old1_re = vec_dst_re[v_index];
- old1_im = vec_dst_im[v_index];
- old2_re = vec_dst_re[v_index+i_inc];
- old2_im = vec_dst_im[v_index+i_inc];
+ old1_re = iemarray_getfloat(vec_dst_re, v_index);
+ old1_im = iemarray_getfloat(vec_dst_im, v_index);
+ old2_re = iemarray_getfloat(vec_dst_re, v_index+i_inc);
+ old2_im = iemarray_getfloat(vec_dst_im, v_index+i_inc);
+
w = sincos[w_index];
- vec_dst_re[v_index+i_inc] = (old1_re - old2_re)*w.real - (old1_im - old2_im)*w.imag;
- vec_dst_im[v_index+i_inc] = (old1_im - old2_im)*w.real + (old1_re - old2_re)*w.imag;
- vec_dst_re[v_index] = old1_re + old2_re;
- vec_dst_im[v_index] = old1_im + old2_im;
+ iemarray_setfloat(vec_dst_re, v_index+i_inc, (old1_re - old2_re)*w.real - (old1_im - old2_im)*w.imag);
+ iemarray_setfloat(vec_dst_im, v_index+i_inc, (old1_im - old2_im)*w.real + (old1_re - old2_re)*w.imag);
+ iemarray_setfloat(vec_dst_re, v_index, old1_re + old2_re);
+ iemarray_setfloat(vec_dst_im, v_index, old1_im + old2_im);
w_index += w_inc;
v_index++;
}
@@ -152,12 +154,12 @@ static void tab_rfft_bang(t_tab_rfft *x)
j = j + k;
if(i < j)
{
- old1_re = vec_dst_re[j];
- old1_im = vec_dst_im[j];
- vec_dst_re[j] = vec_dst_re[i];
- vec_dst_im[j] = vec_dst_im[i];
- vec_dst_re[i] = old1_re;
- vec_dst_im[i] = old1_im;
+ old1_re = iemarray_getfloat(vec_dst_re, j);
+ old1_im = iemarray_getfloat(vec_dst_im, j);
+ iemarray_setfloat(vec_dst_re, j, iemarray_getfloat(vec_dst_re, i));
+ iemarray_setfloat(vec_dst_im, j, iemarray_getfloat(vec_dst_im, i));
+ iemarray_setfloat(vec_dst_re, i, old1_re);
+ iemarray_setfloat(vec_dst_im, i, old1_im);
}
}
@@ -174,11 +176,12 @@ static void tab_rfft_bang(t_tab_rfft *x)
}
*/
- vec_dst_im[fs2] = 0.0f;
+ iemarray_setfloat(vec_dst_im, 0, 0.0f);
+ iemarray_setfloat(vec_dst_im, fs2, 0.0f);
for(i = fs2+1; i < fftsize; i++)
{
- vec_dst_re[i] = 0.0f;
- vec_dst_im[i] = 0.0f;
+ iemarray_setfloat(vec_dst_re, i, 0.0f);
+ iemarray_setfloat(vec_dst_im, i, 0.0f);
}
outlet_bang(x->x_obj.ob_outlet);
@@ -200,7 +203,7 @@ static void tab_rfft_list(t_tab_rfft *x, t_symbol *s, int argc, t_atom *argv)
int fs2 = fftsize / 2;
TAB_COMPLEX w;
TAB_COMPLEX *sincos = x->x_sin_cos;
- t_float *vec_src, *vec_dst_re, *vec_dst_im;
+ iemarray_t *vec_src, *vec_dst_re, *vec_dst_im;
t_float old1_re, old1_im, old2_re, old2_im;
if((argc >= 3) &&
@@ -232,8 +235,8 @@ static void tab_rfft_list(t_tab_rfft *x, t_symbol *s, int argc, t_atom *argv)
for(k=0; k<fftsize; k++)
{
- vec_dst_re[k] = vec_src[k];
- vec_dst_im[k] = 0.0f;
+ iemarray_setfloat(vec_dst_re, k, iemarray_getfloat(vec_src, k));
+ iemarray_setfloat(vec_dst_im, k, 0.0f);
}
i_inc = fs2;
@@ -246,15 +249,16 @@ static void tab_rfft_list(t_tab_rfft *x, t_symbol *s, int argc, t_atom *argv)
w_index = 0;
for(k=0; k<i_inc; k++)
{
- old1_re = vec_dst_re[v_index];
- old1_im = vec_dst_im[v_index];
- old2_re = vec_dst_re[v_index+i_inc];
- old2_im = vec_dst_im[v_index+i_inc];
+ old1_re = iemarray_getfloat(vec_dst_re, v_index);
+ old1_im = iemarray_getfloat(vec_dst_im, v_index);
+ old2_re = iemarray_getfloat(vec_dst_re, v_index+i_inc);
+ old2_im = iemarray_getfloat(vec_dst_im, v_index+i_inc);
+
w = sincos[w_index];
- vec_dst_re[v_index+i_inc] = (old1_re - old2_re)*w.real - (old1_im - old2_im)*w.imag;
- vec_dst_im[v_index+i_inc] = (old1_im - old2_im)*w.real + (old1_re - old2_re)*w.imag;
- vec_dst_re[v_index] = old1_re + old2_re;
- vec_dst_im[v_index] = old1_im + old2_im;
+ iemarray_setfloat(vec_dst_re, v_index+i_inc, (old1_re - old2_re)*w.real - (old1_im - old2_im)*w.imag);
+ iemarray_setfloat(vec_dst_im, v_index+i_inc, (old1_im - old2_im)*w.real + (old1_re - old2_re)*w.imag);
+ iemarray_setfloat(vec_dst_re, v_index, old1_re + old2_re);
+ iemarray_setfloat(vec_dst_im, v_index, old1_im + old2_im);
w_index += w_inc;
v_index++;
}
@@ -276,12 +280,12 @@ static void tab_rfft_list(t_tab_rfft *x, t_symbol *s, int argc, t_atom *argv)
j = j + k;
if(i < j)
{
- old1_re = vec_dst_re[j];
- old1_im = vec_dst_im[j];
- vec_dst_re[j] = vec_dst_re[i];
- vec_dst_im[j] = vec_dst_im[i];
- vec_dst_re[i] = old1_re;
- vec_dst_im[i] = old1_im;
+ old1_re = iemarray_getfloat(vec_dst_re, j);
+ old1_im = iemarray_getfloat(vec_dst_im, j);
+ iemarray_setfloat(vec_dst_re, j, iemarray_getfloat(vec_dst_re, i));
+ iemarray_setfloat(vec_dst_im, j, iemarray_getfloat(vec_dst_im, i));
+ iemarray_setfloat(vec_dst_re, i, old1_re);
+ iemarray_setfloat(vec_dst_im, i, old1_im);
}
}
@@ -298,11 +302,12 @@ static void tab_rfft_list(t_tab_rfft *x, t_symbol *s, int argc, t_atom *argv)
}
*/
- vec_dst_im[fs2] = 0.0f;
+ iemarray_setfloat(vec_dst_im, 0, 0.0f);
+ iemarray_setfloat(vec_dst_im, fs2, 0.0f);
for(i = fs2+1; i < fftsize; i++)
{
- vec_dst_re[i] = 0.0f;
- vec_dst_im[i] = 0.0f;
+ iemarray_setfloat(vec_dst_re, i, 0.0f);
+ iemarray_setfloat(vec_dst_im, i, 0.0f);
}
outlet_bang(x->x_obj.ob_outlet);
diff --git a/src/tab_rifft.c b/src/tab_rifft.c
index 9b717a1..0730ef1 100644
--- a/src/tab_rifft.c
+++ b/src/tab_rifft.c
@@ -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_tab written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2006 */
+iem_tab written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2009 */
#include "m_pd.h"
#include "iemlib.h"
@@ -10,6 +10,7 @@ iem_tab written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2006
/* -------------------------- tab_rifft ------------------------------ */
+/* complex spectral domain inverse FFT to real time domain */
typedef struct _tab_rifft
{
@@ -21,10 +22,10 @@ typedef struct _tab_rifft
int x_offset_src_im;
int x_offset_dst;
int x_fftsize;
- t_float *x_beg_mem_src_re;
- t_float *x_beg_mem_src_im;
- t_float *x_beg_mem_dst_re;
- t_float *x_beg_mem_dst_im;
+ iemarray_t *x_beg_mem_src_re;
+ iemarray_t *x_beg_mem_src_im;
+ iemarray_t *x_beg_mem_dst_re;
+ iemarray_t *x_beg_mem_dst_im;
TAB_COMPLEX *x_sin_cos;
t_symbol *x_sym_src_re;
t_symbol *x_sym_src_im;
@@ -94,7 +95,7 @@ static void tab_rifft_bang(t_tab_rifft *x)
int fs2 = fftsize / 2;
TAB_COMPLEX w;
TAB_COMPLEX *sincos = x->x_sin_cos;
- t_float *vec_src_re, *vec_src_im, *vec_dst_re, *vec_dst_im;
+ iemarray_t *vec_src_re, *vec_src_im, *vec_dst_re, *vec_dst_im;
t_float old1_re, old1_im, old2_re, old2_im, g;
ok_src_re = iem_tab_check_arrays(gensym("tab_rifft"), x->x_sym_src_re, &x->x_beg_mem_src_re, &x->x_size_src_re, fftsize);
@@ -110,17 +111,20 @@ static void tab_rifft_bang(t_tab_rifft *x)
vec_dst_re=x->x_beg_mem_dst_re;
vec_dst_im=x->x_beg_mem_dst_im;
- for(j=0; j<fs2; j++)
+ iemarray_setfloat(vec_dst_re, 0, iemarray_getfloat(vec_src_re, 0));
+ iemarray_setfloat(vec_dst_im, 0, 0.0f);
+ for(j=1; j<fs2; j++)
{
- vec_dst_re[j] = vec_src_re[j];
- vec_dst_im[j] = vec_src_im[j];
+ iemarray_setfloat(vec_dst_re, j, iemarray_getfloat(vec_src_re, j));
+ iemarray_setfloat(vec_dst_im, j, iemarray_getfloat(vec_src_im, j));
}
- vec_dst_re[fs2] = vec_src_re[fs2];
- vec_dst_im[fs2] = 0.0f;
+ iemarray_setfloat(vec_dst_re, fs2, iemarray_getfloat(vec_src_re, fs2));
+ iemarray_setfloat(vec_dst_im, fs2, 0.0f);
+
for(k=1, j=fftsize-1; k<fs2; k++, j--)
{
- vec_dst_re[j] = vec_src_re[k];
- vec_dst_im[j] = -vec_src_im[k];
+ iemarray_setfloat(vec_dst_re, j, iemarray_getfloat(vec_dst_re, k));
+ iemarray_setfloat(vec_dst_im, j, -iemarray_getfloat(vec_dst_im, k));
}
i_inc = fs2;
@@ -133,15 +137,16 @@ static void tab_rifft_bang(t_tab_rifft *x)
w_index = 0;
for(k=0; k<i_inc; k++)
{
- old1_re = vec_dst_re[v_index];
- old1_im = vec_dst_im[v_index];
- old2_re = vec_dst_re[v_index+i_inc];
- old2_im = vec_dst_im[v_index+i_inc];
+ old1_re = iemarray_getfloat(vec_dst_re, v_index);
+ old1_im = iemarray_getfloat(vec_dst_im, v_index);
+ old2_re = iemarray_getfloat(vec_dst_re, v_index+i_inc);
+ old2_im = iemarray_getfloat(vec_dst_im, v_index+i_inc);
+
w = sincos[w_index];
- vec_dst_re[v_index+i_inc] = (old1_re - old2_re)*w.real - (old1_im - old2_im)*w.imag;
- vec_dst_im[v_index+i_inc] = (old1_im - old2_im)*w.real + (old1_re - old2_re)*w.imag;
- vec_dst_re[v_index] = old1_re + old2_re;
- vec_dst_im[v_index] = old1_im + old2_im;
+ iemarray_setfloat(vec_dst_re, v_index+i_inc, (old1_re - old2_re)*w.real - (old1_im - old2_im)*w.imag);
+ iemarray_setfloat(vec_dst_im, v_index+i_inc, (old1_im - old2_im)*w.real + (old1_re - old2_re)*w.imag);
+ iemarray_setfloat(vec_dst_re, v_index, old1_re + old2_re);
+ iemarray_setfloat(vec_dst_im, v_index, old1_im + old2_im);
w_index += w_inc;
v_index++;
}
@@ -163,12 +168,12 @@ static void tab_rifft_bang(t_tab_rifft *x)
j = j + k;
if(i < j)
{
- old1_re = vec_dst_re[j];
- old1_im = vec_dst_im[j];
- vec_dst_re[j] = vec_dst_re[i];
- vec_dst_im[j] = vec_dst_im[i];
- vec_dst_re[i] = old1_re;
- vec_dst_im[i] = old1_im;
+ old1_re = iemarray_getfloat(vec_dst_re, j);
+ old1_im = iemarray_getfloat(vec_dst_im, j);
+ iemarray_setfloat(vec_dst_re, j, iemarray_getfloat(vec_dst_re, i));
+ iemarray_setfloat(vec_dst_im, j, iemarray_getfloat(vec_dst_im, i));
+ iemarray_setfloat(vec_dst_re, i, old1_re);
+ iemarray_setfloat(vec_dst_im, i, old1_im);
}
}
@@ -188,7 +193,7 @@ static void tab_rifft_bang(t_tab_rifft *x)
g = 1.0f / (t_float)fftsize;
for(i = 0; i < fftsize; i++)
{
- vec_dst_re[i] *= g;
+ iemarray_setfloat(vec_dst_re, i, iemarray_getfloat(vec_dst_re, i)*g);
}
outlet_bang(x->x_obj.ob_outlet);
@@ -208,7 +213,7 @@ static void tab_rifft_list(t_tab_rifft *x, t_symbol *s, int argc, t_atom *argv)
int fs2 = fftsize / 2;
TAB_COMPLEX w;
TAB_COMPLEX *sincos = x->x_sin_cos;
- t_float *vec_src_re, *vec_src_im, *vec_dst_re, *vec_dst_im;
+ iemarray_t *vec_src_re, *vec_src_im, *vec_dst_re, *vec_dst_im;
t_float old1_re, old1_im, old2_re, old2_im, g;
if((argc >= 3) &&
@@ -241,15 +246,15 @@ static void tab_rifft_list(t_tab_rifft *x, t_symbol *s, int argc, t_atom *argv)
for(j=0; j<fs2; j++)
{
- vec_dst_re[j] = vec_src_re[j];
- vec_dst_im[j] = vec_src_im[j];
+ iemarray_setfloat(vec_dst_re, j, iemarray_getfloat(vec_src_re, j));
+ iemarray_setfloat(vec_dst_im, j, iemarray_getfloat(vec_src_im, j));
}
- vec_dst_re[fs2] = vec_src_re[fs2];
- vec_dst_im[fs2] = 0.0f;
+ iemarray_setfloat(vec_dst_re, fs2, iemarray_getfloat(vec_src_re, fs2));
+ iemarray_setfloat(vec_dst_im, fs2, 0.0f);
for(k=1, j=fftsize-1; k<fs2; k++, j--)
{
- vec_dst_re[j] = vec_src_re[k];
- vec_dst_im[j] = -vec_src_im[k];
+ iemarray_setfloat(vec_dst_re, j, iemarray_getfloat(vec_src_re, k));
+ iemarray_setfloat(vec_dst_im, j, -iemarray_getfloat(vec_src_im, k));
}
i_inc = fs2;
@@ -262,15 +267,16 @@ static void tab_rifft_list(t_tab_rifft *x, t_symbol *s, int argc, t_atom *argv)
w_index = 0;
for(k=0; k<i_inc; k++)
{
- old1_re = vec_dst_re[v_index];
- old1_im = vec_dst_im[v_index];
- old2_re = vec_dst_re[v_index+i_inc];
- old2_im = vec_dst_im[v_index+i_inc];
+ old1_re = iemarray_getfloat(vec_dst_re, v_index);
+ old1_im = iemarray_getfloat(vec_dst_im, v_index);
+ old2_re = iemarray_getfloat(vec_dst_re, v_index+i_inc);
+ old2_im = iemarray_getfloat(vec_dst_im, v_index+i_inc);
+
w = sincos[w_index];
- vec_dst_re[v_index+i_inc] = (old1_re - old2_re)*w.real - (old1_im - old2_im)*w.imag;
- vec_dst_im[v_index+i_inc] = (old1_im - old2_im)*w.real + (old1_re - old2_re)*w.imag;
- vec_dst_re[v_index] = old1_re + old2_re;
- vec_dst_im[v_index] = old1_im + old2_im;
+ iemarray_setfloat(vec_dst_re, v_index+i_inc, (old1_re - old2_re)*w.real - (old1_im - old2_im)*w.imag);
+ iemarray_setfloat(vec_dst_im, v_index+i_inc, (old1_im - old2_im)*w.real + (old1_re - old2_re)*w.imag);
+ iemarray_setfloat(vec_dst_re, v_index, old1_re + old2_re);
+ iemarray_setfloat(vec_dst_im, v_index, old1_im + old2_im);
w_index += w_inc;
v_index++;
}
@@ -292,12 +298,12 @@ static void tab_rifft_list(t_tab_rifft *x, t_symbol *s, int argc, t_atom *argv)
j = j + k;
if(i < j)
{
- old1_re = vec_dst_re[j];
- old1_im = vec_dst_im[j];
- vec_dst_re[j] = vec_dst_re[i];
- vec_dst_im[j] = vec_dst_im[i];
- vec_dst_re[i] = old1_re;
- vec_dst_im[i] = old1_im;
+ old1_re = iemarray_getfloat(vec_dst_re, j);
+ old1_im = iemarray_getfloat(vec_dst_im, j);
+ iemarray_setfloat(vec_dst_re, j, iemarray_getfloat(vec_dst_re, i));
+ iemarray_setfloat(vec_dst_im, j, iemarray_getfloat(vec_dst_im, i));
+ iemarray_setfloat(vec_dst_re, i, old1_re);
+ iemarray_setfloat(vec_dst_im, i, old1_im);
}
}
@@ -317,7 +323,7 @@ static void tab_rifft_list(t_tab_rifft *x, t_symbol *s, int argc, t_atom *argv)
g = 1.0f / (t_float)fftsize;
for(i = 0; i < fftsize; i++)
{
- vec_dst_re[i] *= g;
+ iemarray_setfloat(vec_dst_re, i, iemarray_getfloat(vec_dst_re, i)*g);
}
outlet_bang(x->x_obj.ob_outlet);
diff --git a/src/tab_sqrt.c b/src/tab_sqrt.c
index fbf4ef5..29f8889 100644
--- a/src/tab_sqrt.c
+++ b/src/tab_sqrt.c
@@ -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_tab written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2006 */
+iem_tab written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2009 */
#include "m_pd.h"
#include "iemlib.h"
@@ -11,6 +11,23 @@ iem_tab written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2006
#define TABDUMTAB1SIZE 256
#define TABDUMTAB2SIZE 1024
+/* -------------------------- tab_sqrt ------------------------------ */
+/* x_beg_mem_dst[i] = sqrt(x_beg_mem_src1[i]) */
+
+typedef struct _tab_sqrt
+{
+ t_object x_obj;
+ int x_size_src1;
+ int x_size_dst;
+ int x_offset_src1;
+ int x_offset_dst;
+ iemarray_t *x_beg_mem_src1;
+ iemarray_t *x_beg_mem_dst;
+ t_symbol *x_sym_scr1;
+ t_symbol *x_sym_dst;
+} t_tab_sqrt;
+
+static t_class *tab_sqrt_class;
static t_float tab_rsqrt_exptab[TABDUMTAB1SIZE], tab_rsqrt_mantissatab[TABDUMTAB2SIZE];
static void init_tab_rsqrt(void)
@@ -34,24 +51,6 @@ static void init_tab_rsqrt(void)
}
}
-
-/* -------------------------- tab_sqrt ------------------------------ */
-
-typedef struct _tab_sqrt
-{
- t_object x_obj;
- int x_size_src1;
- int x_size_dst;
- int x_offset_src1;
- int x_offset_dst;
- t_float *x_beg_mem_src1;
- t_float *x_beg_mem_dst;
- t_symbol *x_sym_scr1;
- t_symbol *x_sym_dst;
-} t_tab_sqrt;
-
-static t_class *tab_sqrt_class;
-
static void tab_sqrt_src(t_tab_sqrt *x, t_symbol *s)
{
x->x_sym_scr1 = s;
@@ -66,7 +65,7 @@ static void tab_sqrt_bang(t_tab_sqrt *x)
{
int i, n;
int ok_src, ok_dst;
- t_float *vec_src, *vec_dst;
+ iemarray_t *vec_src, *vec_dst;
ok_src = iem_tab_check_arrays(gensym("tab_sqrt"), x->x_sym_scr1, &x->x_beg_mem_src1, &x->x_size_src1, 0);
ok_dst = iem_tab_check_arrays(gensym("tab_sqrt"), x->x_sym_dst, &x->x_beg_mem_dst, &x->x_size_dst, 0);
@@ -83,18 +82,18 @@ static void tab_sqrt_bang(t_tab_sqrt *x)
{
t_garray *a;
- while(n--)
+ for(i=0; i<n; i++)
{
- t_float f = *vec_src;
- long l = *(long *)(vec_src++);
+ t_float f = iemarray_getfloat(vec_src, i);
+ long l = *(long *)(&f);
if(f < 0.0f)
- *vec_dst++ = 0.0f;
+ iemarray_setfloat(vec_dst, i, 0.0f);
else
{
t_float g = tab_rsqrt_exptab[(l >> 23) & 0xff] * tab_rsqrt_mantissatab[(l >> 13) & 0x3ff];
- *vec_dst++ = f*g*(1.5f - 0.5f * g * g * f);
+ iemarray_setfloat(vec_dst, i, f*g*(1.5f - 0.5f * g * g * f));
}
}
outlet_bang(x->x_obj.ob_outlet);
@@ -109,7 +108,7 @@ static void tab_sqrt_list(t_tab_sqrt *x, t_symbol *s, int argc, t_atom *argv)
int beg_src, beg_dst;
int i, n;
int ok_src, ok_dst;
- t_float *vec_src, *vec_dst;
+ iemarray_t *vec_src, *vec_dst;
if((argc >= 3) &&
IS_A_FLOAT(argv,0) &&
@@ -137,18 +136,18 @@ static void tab_sqrt_list(t_tab_sqrt *x, t_symbol *s, int argc, t_atom *argv)
{
t_garray *a;
- while(n--)
+ for(i=0; i<n; i++)
{
- t_float f = *vec_src;
- long l = *(long *)(vec_src++);
+ t_float f = iemarray_getfloat(vec_src, i);
+ long l = *(long *)(&f);
if(f < 0.0f)
- *vec_dst++ = 0.0f;
+ iemarray_setfloat(vec_dst, i, 0.0f);
else
{
t_float g = tab_rsqrt_exptab[(l >> 23) & 0xff] * tab_rsqrt_mantissatab[(l >> 13) & 0x3ff];
- *vec_dst++ = f*g*(1.5f - 0.5f * g * g * f);
+ iemarray_setfloat(vec_dst, i, f*g*(1.5f - 0.5f * g * g * f));
}
}
outlet_bang(x->x_obj.ob_outlet);
diff --git a/src/tab_sub.c b/src/tab_sub.c
index 8d978f7..f1efd9c 100644
--- a/src/tab_sub.c
+++ b/src/tab_sub.c
@@ -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_tab written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2006 */
+iem_tab written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2009 */
#include "m_pd.h"
#include "iemlib.h"
@@ -9,6 +9,7 @@ iem_tab written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2006
/* -------------------------- tab_sub ------------------------------ */
+/* x_beg_mem_dst[i] = x_beg_mem_src1[i] - x_offset_src2[i] */
typedef struct _tab_sub
{
@@ -19,9 +20,9 @@ typedef struct _tab_sub
int x_offset_src1;
int x_offset_src2;
int x_offset_dst;
- t_float *x_beg_mem_src1;
- t_float *x_beg_mem_src2;
- t_float *x_beg_mem_dst;
+ iemarray_t *x_beg_mem_src1;
+ iemarray_t *x_beg_mem_src2;
+ iemarray_t *x_beg_mem_dst;
t_symbol *x_sym_scr1;
t_symbol *x_sym_scr2;
t_symbol *x_sym_dst;
@@ -48,7 +49,7 @@ static void tab_sub_bang(t_tab_sub *x)
{
int i, n;
int ok_src1, ok_src2, ok_dst;
- t_float *vec_src1, *vec_src2, *vec_dst;
+ iemarray_t *vec_src1, *vec_src2, *vec_dst;
ok_src1 = iem_tab_check_arrays(gensym("tab_sub"), x->x_sym_scr1, &x->x_beg_mem_src1, &x->x_size_src1, 0);
ok_src2 = iem_tab_check_arrays(gensym("tab_sub"), x->x_sym_scr2, &x->x_beg_mem_src2, &x->x_size_src2, 0);
@@ -71,7 +72,7 @@ static void tab_sub_bang(t_tab_sub *x)
t_garray *a;
for(i=0; i<n; i++)
- vec_dst[i] = vec_src1[i] - vec_src2[i];
+ iemarray_setfloat(vec_dst, i, iemarray_getfloat(vec_src1, i) - iemarray_getfloat(vec_src2, i));
outlet_bang(x->x_obj.ob_outlet);
a = (t_garray *)pd_findbyclass(x->x_sym_dst, garray_class);
garray_redraw(a);
@@ -84,7 +85,7 @@ static void tab_sub_list(t_tab_sub *x, t_symbol *s, int argc, t_atom *argv)
int beg_src1, beg_src2, beg_dst;
int i, n;
int ok_src1, ok_src2, ok_dst;
- t_float *vec_src1, *vec_src2, *vec_dst;
+ iemarray_t *vec_src1, *vec_src2, *vec_dst;
if((argc >= 4) &&
IS_A_FLOAT(argv,0) &&
@@ -119,7 +120,7 @@ static void tab_sub_list(t_tab_sub *x, t_symbol *s, int argc, t_atom *argv)
t_garray *a;
for(i=0; i<n; i++)
- vec_dst[i] = vec_src1[i] - vec_src2[i];
+ iemarray_setfloat(vec_dst, i, iemarray_getfloat(vec_src1, i) - iemarray_getfloat(vec_src2, i));
outlet_bang(x->x_obj.ob_outlet);
a = (t_garray *)pd_findbyclass(x->x_sym_dst, garray_class);
garray_redraw(a);
@@ -141,7 +142,6 @@ static void *tab_sub_new(t_symbol *s, int argc, t_atom *argv)
{
t_tab_sub *x = (t_tab_sub *)pd_new(tab_sub_class);
t_symbol *src1, *src2, *dst;
- t_float time;
if((argc >= 3) &&
IS_A_SYMBOL(argv,0) &&
diff --git a/src/tab_sum.c b/src/tab_sum.c
index 9f41733..8054803 100644
--- a/src/tab_sum.c
+++ b/src/tab_sum.c
@@ -1,20 +1,23 @@
/* For information on usage and redistribution, and for a DISCLAIMER OF ALL
* WARRANTIES, see the file, "LICENSE.txt," in this distribution.
-iem_tab written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2006 */
+iem_tab written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2009 */
#include "m_pd.h"
#include "iemlib.h"
#include "iem_tab.h"
/* -------------------------- tab_sum ------------------------------ */
+/* sum = 0.0f; */
+/* for(i=0; i<x_size_src1; i++) */
+/* sum += x_beg_mem_src1[i]; */
typedef struct _tab_sum
{
t_object x_obj;
int x_size_src1;
int x_offset_src1;
- t_float *x_beg_mem_src1;
+ iemarray_t *x_beg_mem_src1;
t_symbol *x_sym_scr1;
void *x_bang_out;
void *x_sum_out;
@@ -31,7 +34,7 @@ static void tab_sum_bang(t_tab_sum *x)
{
int i, n;
int ok_src;
- t_float *vec_src;
+ iemarray_t *vec_src;
t_float sum=0.0f;
ok_src = iem_tab_check_arrays(gensym("tab_sum"), x->x_sym_scr1, &x->x_beg_mem_src1, &x->x_size_src1, 0);
@@ -43,9 +46,7 @@ static void tab_sum_bang(t_tab_sum *x)
if(n)
{
for(i=0; i<n; i++)
- {
- sum += vec_src[i];
- }
+ sum += iemarray_getfloat(vec_src, i);
outlet_float(x->x_sum_out, sum);
outlet_bang(x->x_bang_out);
}
@@ -57,7 +58,7 @@ static void tab_sum_list(t_tab_sum *x, t_symbol *s, int argc, t_atom *argv)
int beg_src;
int i, n;
int ok_src;
- t_float *vec_src;
+ iemarray_t *vec_src;
t_float sum=0.0f;
if((argc >= 2) &&
@@ -79,9 +80,7 @@ static void tab_sum_list(t_tab_sum *x, t_symbol *s, int argc, t_atom *argv)
if(n)
{
for(i=0; i<n; i++)
- {
- sum += vec_src[i];
- }
+ sum += iemarray_getfloat(vec_src, i);
outlet_float(x->x_sum_out, sum);
outlet_bang(x->x_bang_out);
}