@@ 179,6 179,9 @@ programming system.
#include <string.h>
#include <unistd.h>
#include <math.h>
+#include "sndkit/graforge/graforge.h"
+#include "sndkit/core.h"
+
#include "uxn/uxn.h"
#define GESTVM_PRIV
#include "gestvm.h"
@@ 1629,6 1632,9 @@ static gestvm_behavior find_behavior(int id)
case 11:
b = b_gliss_parametric;
break;
+ case 12:
+ b = b_tabread;
+ break;
default:
break;
}
@@ 1974,3 1980,66 @@ int interp;
#+BEGIN_SRC c
gvm->interp = 1;
#+END_SRC
+* Gesture LFO
+#+NAME: gestvm
+#+BEGIN_SRC c
+sk_table **tablist;
+int ntables;
+#+END_SRC
+
+#+NAME: init
+#+BEGIN_SRC c
+gvm->tablist = NULL;
+gvm->ntables = 0;
+#+END_SRC
+
+#+NAME: funcdefs
+#+BEGIN_SRC c
+void gestvm_tablist(gestvm *gvm, sk_table **tablist, int ntables);
+#+END_SRC
+
+#+NAME: funcs
+#+BEGIN_SRC c
+void gestvm_tablist(gestvm *gvm, sk_table **tablist, int ntables)
+{
+ gvm->tablist = tablist;
+ gvm->ntables = ntables;
+}
+#+END_SRC
+
+#+NAME: static_funcdefs
+#+BEGIN_SRC c
+static SKFLT b_tabread(gestvm *gvm, SKFLT a);
+#+END_SRC
+
+#+NAME: funcs
+#+BEGIN_SRC c
+static SKFLT b_tabread(gestvm *gvm, SKFLT a)
+{
+ SKFLT *data;
+ int sz;
+ sk_table *tab;
+ int ipos;
+ SKFLT fpos;
+
+ if (gvm->params[0] < 0 || gvm->params[0] >= gvm->ntables) {
+ return 0;
+ }
+
+ tab = gvm->tablist[gvm->params[0]];
+
+ data = sk_table_data(tab);
+ sz = sk_table_size(tab);
+
+ if (a < 0) a = 0;
+ if (a > 1) a = 1;
+
+ fpos = a * (sz - 2);
+ ipos = (int)fpos;
+ fpos -= ipos;
+
+ a = (1.0 - fpos)*data[ipos] + fpos*data[ipos + 1];
+
+ return a;
+}
+#+END_SRC