aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormusil <tmusil@users.sourceforge.net>2009-03-04 14:31:46 +0000
committermusil <tmusil@users.sourceforge.net>2009-03-04 14:31:46 +0000
commita7d2dd2df337a2c7bb1fc84a33d7497e6aacf9fc (patch)
tree2497319e7216e0a38cfdfd6b556cfc6d8da6392b
parented197c65f7f9325f68811b3ba61f6865218057af (diff)
compatible to new array struct
svn path=/trunk/externals/iem/iem_spec2/; revision=10834
-rw-r--r--src/iem_spec2.c4
-rw-r--r--src/iem_spec2.h2
-rw-r--r--src/iemlib.h4
-rw-r--r--src/spec2_tab_conv~.c12
-rw-r--r--src/spec2_tabreceive_enable~.c24
-rw-r--r--src/spec2_tabreceive~.c25
6 files changed, 35 insertions, 36 deletions
diff --git a/src/iem_spec2.c b/src/iem_spec2.c
index c1e0747..239bff4 100644
--- a/src/iem_spec2.c
+++ b/src/iem_spec2.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_spec2 written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2006 */
+iem_spec2 written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2009 */
#include "m_pd.h"
@@ -71,6 +71,6 @@ void iem_spec2_setup(void)
spec2_tabreceive_enable_tilde_setup();
spec2_tabreceive_tilde_setup();
- post("iem_spec2 (R-1.17) library loaded! (c) Thomas Musil 11.2006");
+ post("iem_spec2 (R-1.18) library loaded! (c) Thomas Musil 01.2009");
post(" musil%ciem.at iem KUG Graz Austria", '@');
}
diff --git a/src/iem_spec2.h b/src/iem_spec2.h
index 440dbdf..4de6c04 100644
--- a/src/iem_spec2.h
+++ b/src/iem_spec2.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_spec2 written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2006 */
+iem_spec2 written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2009 */
#ifndef __IEMSPEC2_H__
#define __IEMSPEC2_H__
diff --git a/src/iemlib.h b/src/iemlib.h
index 4c229e3..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__
@@ -104,10 +104,12 @@ union tabfudge_f
# 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
diff --git a/src/spec2_tab_conv~.c b/src/spec2_tab_conv~.c
index 9b596ce..d9ac5cd 100644
--- a/src/spec2_tab_conv~.c
+++ b/src/spec2_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_spec2 written by Thomas Musil (c) IEM KUG Graz Austria 2000 - 2006 */
+iem_spec2 written by Thomas Musil (c) IEM KUG Graz Austria 2000 - 2009 */
#include "m_pd.h"
#include "iemlib.h"
@@ -24,11 +24,10 @@ t_class *spec2_tab_conv_tilde_class;
static void spec2_tab_conv_tilde_set(t_spec2_tab_conv_tilde *x, t_symbol *s, int argc, t_atom *argv)
{
- if(argc >= 2)
+ if((argc >= 2) && IS_A_SYMBOL(argv, 0) && IS_A_FLOAT(argv, 1))
{
x->x_sym_array = (t_symbol *)(atom_getsymbol(argv));
- argv++;
- x->x_winsize = (int)(atom_getint(argv));
+ x->x_winsize = (int)(atom_getint(argv+1));
x->x_has_changed = 1;
}
}
@@ -120,11 +119,10 @@ static void *spec2_tab_conv_tilde_new(t_symbol *s, int argc, t_atom *argv)
{
t_spec2_tab_conv_tilde *x = (t_spec2_tab_conv_tilde *)pd_new(spec2_tab_conv_tilde_class);
- if(argc >= 2)
+ if((argc >= 2) && IS_A_SYMBOL(argv,0) && IS_A_FLOAT(argv,1))
{
x->x_sym_array = (t_symbol *)(atom_getsymbol(argv));
- argv++;
- x->x_winsize = (int)(atom_getint(argv));
+ x->x_winsize = (int)(atom_getint(argv+1));
x->x_spec = (t_float *)0;
x->x_beg_array = (iemarray_t *)0;
x->x_blocksize = 0;
diff --git a/src/spec2_tabreceive_enable~.c b/src/spec2_tabreceive_enable~.c
index 96377db..e9f0eb0 100644
--- a/src/spec2_tabreceive_enable~.c
+++ b/src/spec2_tabreceive_enable~.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_spec2 written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2006 */
+iem_spec2 written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2009 */
#include "m_pd.h"
#include "iemlib.h"
-/* ------------------------ spec2_tabreceive_enable_tilde~ ------------------------- */
+/* ------------------------ spec2_tabreceive_enable~ ------------------------- */
static t_class *spec2_tabreceive_enable_tilde_class;
@@ -37,18 +37,20 @@ static t_int *spec2_tabreceive_enable_tilde_perform(t_int *w)
{
t_spec2_tabreceive_enable_tilde *x = (t_spec2_tabreceive_enable_tilde *)(w[1]);
t_float *out = (t_float *)(w[2]);
- int n = w[3]+1;
+ int n = w[3]+1, i;
iemarray_t *vec = x->x_vec;
if(vec && x->x_enable)
- while(n--) {
- *out++ = iemarray_getfloat(vec, 0);
- vec++;
- }
- else
- while(n--)
- *out++ = 0.0f;
- return(w+4);
+ {
+ for(i=0; i<n; i++)
+ out[i] = iemarray_getfloat(vec, i);
+ }
+ else
+ {
+ while(n--)
+ *out++ = 0.0f;
+ }
+ return(w+4);
}
static t_int *spec2_tabreceive_enable_tilde_perf16(t_int *w)
diff --git a/src/spec2_tabreceive~.c b/src/spec2_tabreceive~.c
index 69029d2..ac30b5c 100644
--- a/src/spec2_tabreceive~.c
+++ b/src/spec2_tabreceive~.c
@@ -1,19 +1,19 @@
/* For information on usage and redistribution, and for a DISCLAIMER OF ALL
* WARRANTIES, see the file, "LICENSE.txt," in this distribution.
-iem_spec2 written by Thomas Musil (c) IEM KUG Graz Austria 2000 - 2006 */
+iem_spec2 written by Thomas Musil (c) IEM KUG Graz Austria 2000 - 2009 */
#include "m_pd.h"
#include "iemlib.h"
-/* ------------------------ spec2_tabreceive_tilde~ ------------------------- */
+/* ------------------------ spec2_tabreceive~ ------------------------- */
static t_class *spec2_tabreceive_tilde_class;
typedef struct _spec2_tabreceive_tilde
{
t_object x_obj;
- iemarray_t*x_vec;
+ iemarray_t *x_vec;
t_symbol *x_arrayname;
} t_spec2_tabreceive_tilde;
@@ -26,22 +26,20 @@ static t_int *spec2_tabreceive_tilde_perform(t_int *w)
{
t_spec2_tabreceive_tilde *x = (t_spec2_tabreceive_tilde *)(w[1]);
t_float *out = (t_float *)(w[2]);
- int n = w[3]+1;
+ int n = w[3]+1, i;
iemarray_t *vec = x->x_vec;
+
if(vec)
- while(n--) {
-#ifdef __x86_64__
- t_word wp=*vec++;
- *out++=wp.w_float;
-#else
- *out++ = *vec++;
-#endif
- }
+ {
+ for(i=0; i<n; i++)
+ out[i] = iemarray_getfloat(vec, i);
+ }
else
+ {
while(n--)
*out++ = 0.0f;
+ }
return(w+4);
-
}
static t_int *spec2_tabreceive_tilde_perf16(t_int *w)
@@ -104,7 +102,6 @@ static t_int *spec2_tabreceive_tilde_perf16(t_int *w)
}
out[0] = 0.0f;
}
-
return(w+4);
}