From 2e854bcb40d535957b589ad02e3f280e00b47865 Mon Sep 17 00:00:00 2001 From: Richard Knight Date: Mon, 16 Aug 2021 02:56:49 +0100 Subject: pre strip down --- src/maketable.cpp | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 src/maketable.cpp (limited to 'src/maketable.cpp') 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 +#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 -- cgit v1.2.3