aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--nusmuk-utils/tab_derivate.c2
-rw-r--r--nusmuk-utils/tab_downsample.c5
-rw-r--r--nusmuk-utils/tab_downsample_average.c6
-rw-r--r--nusmuk-utils/tab_downsample_max.c4
-rw-r--r--nusmuk-utils/tab_downsample_min.c4
-rw-r--r--nusmuk-utils/tab_upsample-help.pd3
-rw-r--r--nusmuk-utils/tab_upsample.c4
-rw-r--r--nusmuk-utils/tab_upsample_copy.c4
8 files changed, 19 insertions, 13 deletions
diff --git a/nusmuk-utils/tab_derivate.c b/nusmuk-utils/tab_derivate.c
index f035b99..1aa0269 100644
--- a/nusmuk-utils/tab_derivate.c
+++ b/nusmuk-utils/tab_derivate.c
@@ -41,6 +41,8 @@ void tab_derivate_compute(t_tab_derivate *x, t_float nb) {
else
{
nb_derivate = MIN(npoints_src1, npoints_dst);
+ //nb_derivate = MAX(1, x->factor);
+
// post("nb_derivate = %d",nb_derivate);
if (nb > 0)
diff --git a/nusmuk-utils/tab_downsample.c b/nusmuk-utils/tab_downsample.c
index b94c458..f584426 100644
--- a/nusmuk-utils/tab_downsample.c
+++ b/nusmuk-utils/tab_downsample.c
@@ -20,6 +20,8 @@ void *tab_downsample_new(t_symbol *s_src,t_symbol *s_dst, t_float factor)
x->x_arrayname_src = s_src;
x->x_arrayname_dst = s_dst;
x->factor = factor;
+ x->factor = MAX(1, factor);
+
x->offset = 0;
x->b_out = outlet_new(&x->x_obj, &s_bang);
@@ -47,6 +49,7 @@ void tab_downsample_compute(t_tab_downsample *x)
else
{
nb_max = MIN((npoints_src - x->offset)/x->factor, npoints_dst);
+ //nb_max = MAX(nb_max, 1);
// post("nb_max = %d",nb_max);
index_src = x->offset;
@@ -80,7 +83,7 @@ void tab_downsample_dst(t_tab_downsample *x, t_symbol *s_dst) {
}
void tab_downsample_factor(t_tab_downsample *x, t_float factor) {
- x->factor = factor;
+ x->factor = MAX(1, factor);
}
void tab_downsample_setup(void) {
diff --git a/nusmuk-utils/tab_downsample_average.c b/nusmuk-utils/tab_downsample_average.c
index 610b6dd..c948ba2 100644
--- a/nusmuk-utils/tab_downsample_average.c
+++ b/nusmuk-utils/tab_downsample_average.c
@@ -19,7 +19,7 @@ void *tab_downsample_average_new(t_symbol *s_src,t_symbol *s_dst, t_float factor
x->x_arrayname_src = s_src;
x->x_arrayname_dst = s_dst;
- x->factor = factor;
+ x->factor = MAX(1, factor);
x->b_out = outlet_new(&x->x_obj, &s_bang);
@@ -47,7 +47,7 @@ void tab_downsample_average_bang(t_tab_downsample_average *x)
else
{
nb_max = MIN(npoints_src/x->factor, npoints_dst);
-
+
// post("nb_max = %d",nb_max);
index_src = 0;
for (i=0; i<nb_max;i++) {
@@ -75,7 +75,7 @@ void tab_downsample_average_dst(t_tab_downsample_average *x, t_symbol *s_dst) {
}
void tab_downsample_average_factor(t_tab_downsample_average *x, t_float factor) {
- x->factor = factor;
+ x->factor = MAX(1, factor);
}
void tab_downsample_average_setup(void) {
diff --git a/nusmuk-utils/tab_downsample_max.c b/nusmuk-utils/tab_downsample_max.c
index 63766b7..eb93a41 100644
--- a/nusmuk-utils/tab_downsample_max.c
+++ b/nusmuk-utils/tab_downsample_max.c
@@ -19,7 +19,7 @@ void *tab_downsample_max_new(t_symbol *s_src,t_symbol *s_dst, t_float factor)
x->x_arrayname_src = s_src;
x->x_arrayname_dst = s_dst;
- x->factor = factor;
+ x->factor = MAX(1, factor);
x->b_out = outlet_new(&x->x_obj, &s_bang);
@@ -77,7 +77,7 @@ void tab_downsample_max_dst(t_tab_downsample_max *x, t_symbol *s_dst) {
}
void tab_downsample_max_factor(t_tab_downsample_max *x, t_float factor) {
- x->factor = factor;
+ x->factor = MAX(1, factor);
}
void tab_downsample_max_setup(void) {
diff --git a/nusmuk-utils/tab_downsample_min.c b/nusmuk-utils/tab_downsample_min.c
index 36f2e7f..bde534f 100644
--- a/nusmuk-utils/tab_downsample_min.c
+++ b/nusmuk-utils/tab_downsample_min.c
@@ -19,7 +19,7 @@ void *tab_downsample_min_new(t_symbol *s_src,t_symbol *s_dst, t_float factor)
x->x_arrayname_src = s_src;
x->x_arrayname_dst = s_dst;
- x->factor = factor;
+ x->factor = MAX(1, factor);
x->b_out = outlet_new(&x->x_obj, &s_bang);
@@ -77,7 +77,7 @@ void tab_downsample_min_dst(t_tab_downsample_min *x, t_symbol *s_dst) {
}
void tab_downsample_min_factor(t_tab_downsample_min *x, t_float factor) {
- x->factor = factor;
+ x->factor = MAX(1, factor);
}
void tab_downsample_min_setup(void) {
diff --git a/nusmuk-utils/tab_upsample-help.pd b/nusmuk-utils/tab_upsample-help.pd
index 6e11040..2f1d5e7 100644
--- a/nusmuk-utils/tab_upsample-help.pd
+++ b/nusmuk-utils/tab_upsample-help.pd
@@ -1,4 +1,4 @@
-#N canvas 98 645 777 410 10;
+#N canvas 96 645 777 410 10;
#X obj 97 73 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1
-1;
#X obj 411 55 table src2 1000;
@@ -12,6 +12,7 @@
#X obj 87 205 tab_upsample src dst 3;
#X msg 182 177 factor 5;
#X msg 237 125 1;
+#X text 267 127 offset;
#X connect 0 0 8 0;
#X connect 2 0 8 0;
#X connect 3 0 8 0;
diff --git a/nusmuk-utils/tab_upsample.c b/nusmuk-utils/tab_upsample.c
index bb32d6e..f0b4e4e 100644
--- a/nusmuk-utils/tab_upsample.c
+++ b/nusmuk-utils/tab_upsample.c
@@ -19,7 +19,7 @@ void *tab_upsample_new(t_symbol *s_src,t_symbol *s_dst, t_float factor)
x->x_arrayname_src = s_src;
x->x_arrayname_dst = s_dst;
- x->factor = factor;
+ x->factor = MAX(1, factor);
x->offset = 0;
x->b_out = outlet_new(&x->x_obj, &s_bang);
@@ -82,7 +82,7 @@ void tab_upsample_dst(t_tab_upsample *x, t_symbol *s_dst) {
}
void tab_upsample_factor(t_tab_upsample *x, t_float factor) {
- x->factor = factor;
+ x->factor = MAX(1, factor);
}
void tab_upsample_setup(void) {
diff --git a/nusmuk-utils/tab_upsample_copy.c b/nusmuk-utils/tab_upsample_copy.c
index c123896..e6f1948 100644
--- a/nusmuk-utils/tab_upsample_copy.c
+++ b/nusmuk-utils/tab_upsample_copy.c
@@ -19,7 +19,7 @@ void *tab_upsample_copy_new(t_symbol *s_src,t_symbol *s_dst, t_float factor)
x->x_arrayname_src = s_src;
x->x_arrayname_dst = s_dst;
- x->factor = factor;
+ x->factor = MAX(1, factor);
x->offset = 0;
x->b_out = outlet_new(&x->x_obj, &s_bang);
@@ -78,7 +78,7 @@ void tab_upsample_copy_dst(t_tab_upsample_copy *x, t_symbol *s_dst) {
}
void tab_upsample_copy_factor(t_tab_upsample_copy *x, t_float factor) {
- x->factor = factor;
+ x->factor = MAX(1, factor);
}
void tab_upsample_copy_setup(void) {