aboutsummaryrefslogtreecommitdiff
path: root/cyclone
diff options
context:
space:
mode:
authorN.N. <electrickery@users.sourceforge.net>2015-06-09 14:08:22 +0000
committerN.N. <electrickery@users.sourceforge.net>2015-06-09 14:08:22 +0000
commitd20d460faa23f9fda7dd531d6af5b6a2e108b1fe (patch)
tree728b8d3f6f8c7e6788dbd815c7772e5a8598f6a3 /cyclone
parenta39669bb6a415e16b31d252ad7b4cf198cbe5c16 (diff)
cyclone (cycle~, funbuff): cleanup garray_getarrayfloats/t_float stuff
cyclone/cycle~: fixed offset as argument and in set message doc/help/cyclone/cycle~-help: improved patch svn path=/trunk/externals/miXed/; revision=17479
Diffstat (limited to 'cyclone')
-rw-r--r--cyclone/hammer/funbuff.c6
-rw-r--r--cyclone/sickle/cycle.c39
2 files changed, 29 insertions, 16 deletions
diff --git a/cyclone/hammer/funbuff.c b/cyclone/hammer/funbuff.c
index b5a8dbd..f192896 100644
--- a/cyclone/hammer/funbuff.c
+++ b/cyclone/hammer/funbuff.c
@@ -339,7 +339,7 @@ static void funbuff_dump(t_funbuff *x)
}
/* CHECKME if pointer is updated */
-static void funbuff_dointerp(t_funbuff *x, t_floatarg f, int vsz, t_float *vec)
+static void funbuff_dointerp(t_funbuff *x, t_floatarg f, int vsz, t_word *vec)
{
t_hammernode *np1;
int trunc = (int)f;
@@ -372,7 +372,7 @@ static void funbuff_dointerp(t_funbuff *x, t_floatarg f, int vsz, t_float *vec)
return;
}
vec += vndx;
- frac = *vec + (vec[1] - *vec) * vfrac;
+ frac = vec[0].w_float + (vec[1].w_float - vec[0].w_float) * vfrac;
}
value +=
(HAMMERNODE_GETFLOAT(np2) - HAMMERNODE_GETFLOAT(np1)) * frac;
@@ -392,7 +392,7 @@ static void funbuff_interp(t_funbuff *x, t_floatarg f)
static void funbuff_interptab(t_funbuff *x, t_symbol *s, t_floatarg f)
{
int vsz;
- t_float *vec;
+ t_word *vec;
if (vec = vefl_get(s, &vsz, 0, (t_pd *)x))
{
if (vsz > 2)
diff --git a/cyclone/sickle/cycle.c b/cyclone/sickle/cycle.c
index b88c13e..8acb364 100644
--- a/cyclone/sickle/cycle.c
+++ b/cyclone/sickle/cycle.c
@@ -31,24 +31,37 @@ static void cycle_gettable(t_cycle *x)
if (x->x_name)
{
int tabsize = 0;
- t_float *table = vefl_get(x->x_name, &tabsize, 1, (t_pd *)x);
+ t_word *table = vefl_get(x->x_name, &tabsize, 1, (t_pd *)x);
/* CHECKED buffer is copied */
if (table)
{
- int indx = x->x_offset + CYCLE_TABSIZE;
- t_float *ptr = x->x_usertable + CYCLE_TABSIZE;
- if (indx == tabsize)
+ int tablePtr;
+ int samplesFromTable = tabsize - x->x_offset;
+ int samplesToCopy = samplesFromTable < CYCLE_TABSIZE ?
+ samplesFromTable : CYCLE_TABSIZE;
+
+// post("samplesFromTable: %d, samplesToCopy: %d, tabsize: %d",
+// samplesFromTable, samplesToCopy, tabsize);
+ // copy the internal table from the external one as far as
+ // its size permits and fill the rest with zeroes.
+ for (tablePtr = 0; tablePtr < CYCLE_TABSIZE; tablePtr++)
{
- *ptr-- = *table;
- indx--;
- }
- if (indx < tabsize)
- {
- table += indx;
- indx -= x->x_offset;
- while (indx--) *ptr-- = *table--;
- x->x_table = x->x_usertable;
+ if (samplesToCopy > 0)
+ {
+ x->x_usertable[tablePtr] =
+ table[tablePtr + x->x_offset].w_float;
+ samplesToCopy--;
+ }
+ else
+ {
+ x->x_usertable[tablePtr] = 0;
+ }
}
+ // the 513th sample
+ x->x_usertable[tablePtr] = (samplesFromTable > 0) ?
+ table[x->x_offset + CYCLE_TABSIZE].w_float : 0;
+
+ x->x_table = x->x_usertable;
/* CHECKED else no complaint */
}
}