aboutsummaryrefslogtreecommitdiff
path: root/src/maketable.cpp
diff options
context:
space:
mode:
authorRichard Knight <q@1bpm.net>2021-08-16 02:56:49 +0100
committerRichard Knight <q@1bpm.net>2021-08-16 02:56:49 +0100
commit2e854bcb40d535957b589ad02e3f280e00b47865 (patch)
tree8fe2abbc86130af2d2ff74bbce943a68f2ec4c6d /src/maketable.cpp
downloadcsound-datacore-2e854bcb40d535957b589ad02e3f280e00b47865.tar.gz
csound-datacore-2e854bcb40d535957b589ad02e3f280e00b47865.tar.bz2
csound-datacore-2e854bcb40d535957b589ad02e3f280e00b47865.zip
pre strip down
Diffstat (limited to 'src/maketable.cpp')
-rw-r--r--src/maketable.cpp40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/maketable.cpp b/src/maketable.cpp
new file mode 100644
index 0000000..511f838
--- /dev/null
+++ b/src/maketable.cpp
@@ -0,0 +1,40 @@
+#include <plugin.h>
+#include "maketable.hpp"
+
+int maketable(csnd::Csound* csound, int size, FUNC **tablep, int channels) {
+ EVTBLK* evt;
+ MYFLT* pf;
+
+ evt = (EVTBLK*) csound->malloc(sizeof(EVTBLK));
+ evt->opcod = 'f';
+ evt->strarg = NULL;
+ evt->pcnt = 5;
+ pf = &evt->p[0];
+ pf[0] = FL(0);
+ pf[1] = FL(0);
+ pf[2] = evt->p2orig = FL(0);
+ pf[3] = evt->p3orig = -size;
+ pf[4] = FL(2); // gen number
+ pf[5] = FL(0);
+ int n = csound->get_csound()->hfgens(csound->get_csound(), tablep, evt, 1);
+ csound->free(evt);
+ if (UNLIKELY(n != 0)) {
+ return NOTOK;
+ }
+
+ FUNC* table = *tablep;
+
+ table->soundend = size;
+ table->nchanls = channels;
+ table->flenfrms = size;
+ table->gen01args.sample_rate = csound->sr();
+ table->cpscvt = 0;
+ table->cvtbas = LOFACT; // * csound->sr() * csound->get_csound()->onedsr;
+ table->loopmode1 = 0;
+ table->loopmode2 = 0;
+ table->begin1 = 0;
+ table->end1 = size;
+ table->begin2 = 0;
+ table->end2 = size;
+ return OK;
+} \ No newline at end of file