Skip to content

Commit

Permalink
Merge pull request #1848 from csound/feature/oscils
Browse files Browse the repository at this point in the history
Removed pow of two table size dependency across all opcodes
  • Loading branch information
kunstmusik committed Apr 30, 2024
2 parents cecdd59 + 58a160c commit 1f4408e
Show file tree
Hide file tree
Showing 37 changed files with 12,858 additions and 12,375 deletions.
18 changes: 17 additions & 1 deletion Engine/entry1.c
Expand Up @@ -3,7 +3,7 @@
Copyright (C) 1991 Barry Vercoe, John ffitch
This file is part of Csound.
This file is part of Csound
The Csound Library is free software; you can redistribute it
and/or modify it under the terms of the GNU Lesser General Public
Expand Down Expand Up @@ -466,6 +466,22 @@ OENTRY opcodlst_1[] = {
{ "oscil3.kaA",S(OSC),0, 3, "a", "kai[]o", oscsetA, oscka3 },
{ "oscil3.akA",S(OSC),0, 3, "a", "aki[]o", oscsetA, oscak3 },
{ "oscil3.aaA",S(OSC),0, 3, "a", "aai[]o", oscsetA, oscaa3 },
{ "poscil.a", S(OSC), TR,3, "a", "kkjo", (SUBR)posc_set,(SUBR)posckk },
{ "poscil.kk", S(OSC), TR,3, "k", "kkjo", (SUBR)posc_set,(SUBR)kposc,NULL },
{ "poscil.ka", S(OSC), TR,3, "a", "kajo", (SUBR)posc_set, (SUBR)poscka },
{ "poscil.ak", S(OSC), TR,3, "a", "akjo", (SUBR)posc_set, (SUBR)poscak },
{ "poscil.aa", S(OSC), TR,3, "a", "aajo", (SUBR)posc_set, (SUBR)poscaa },
{ "lposcil", S(LPOSC), TR, 3, "a", "kkkkjo", (SUBR)lposc_set, (SUBR)lposc},
{ "poscil3.a",S(OSC), TR,3, "a", "kkjo",
(SUBR)posc_set,(SUBR)posc3kk },
{ "poscil3.kk",S(OSC), TR,3, "k", "kkjo",
(SUBR)posc_set,(SUBR)kposc3,NULL},
{ "poscil3.ak", S(OSC), TR,3, "a", "akjo", (SUBR)posc_set, (SUBR)posc3ak },
{ "poscil3.ka", S(OSC), TR,3, "a", "kajo", (SUBR)posc_set, (SUBR)posc3ka },
{ "poscil3.aa", S(OSC), TR,3, "a", "aajo", (SUBR)posc_set, (SUBR)posc3aa },
{ "lposcil3", S(LPOSC), TR, 3, "a", "kkkkjo", (SUBR)lposc_set,(SUBR)lposc3},
{ "lposcila", S(LPOSC), TR, 3, "a", "akkkio",
(SUBR)lposc_set, (SUBR)lposca},
/* end change */
{ "foscil", S(FOSC),TR, 3, "a", "xkxxkjo",foscset, foscil },
{ "foscili",S(FOSC),TR, 3, "a", "xkxxkjo",foscset, foscili },
Expand Down
2 changes: 1 addition & 1 deletion Engine/fgens.c
Expand Up @@ -3322,7 +3322,7 @@ int resize_table(CSOUND *csound, RESIZE *p)
printf("WARNING: EXPERIMENTAL CODE\n");
warned = 1;
}
if (UNLIKELY((ftp = csound->FTFind(csound, p->fn)) == NULL))
if (UNLIKELY((ftp = csound->FTnp2Find(csound, p->fn)) == NULL))
return NOTOK;
if (ftp->flen<fsize)
ftp->ftable = (MYFLT *) csound->ReAlloc(csound, ftp->ftable,
Expand Down
16 changes: 16 additions & 0 deletions H/entry1.h
Expand Up @@ -510,5 +510,21 @@ int32_t coef2parm(CSOUND *csound, void *p);
int32_t resonbnk_init(CSOUND *csound, void *p);
int32_t resonbnk(CSOUND *csound, void *p);
int32_t schedule_array(CSOUND *csound, void *p);
int32_t posc_set(CSOUND *csound, void *p);
int32_t posckk(CSOUND *csound, void *p);
int32_t poscaa(CSOUND *csound, void *p);
int32_t poscka(CSOUND *csound, void *p);
int32_t poscak(CSOUND *csound,void *p);
int32_t kposc(CSOUND *csound, void *p);
int32_t posc3kk(CSOUND *csound, void *p);
int32_t posc3ak(CSOUND *csound, void *p);
int32_t posc3ka(CSOUND *csound, void *p);
int32_t posc3aa(CSOUND *csound, void *p);
int32_t kposc3(CSOUND *csound, void *p);
int32_t lposc_set(CSOUND *csound, void *p);
int32_t lposc(CSOUND *csound, void *p);
int32_t lposc3(CSOUND *csound, void *p);
int32_t lposca(CSOUND *csound, LPOSC *p);
int32_t oversampleset(CSOUND *csound, void *p);
int32_t undersampleset(CSOUND *csound, void *p);

165 changes: 84 additions & 81 deletions H/ugens1.h
@@ -1,131 +1,134 @@
/*
ugens1.h:
ugens1.h:
Copyright (C) 1991 Barry Vercoe, John ffitch
Copyright (C) 1991 Barry Vercoe, John ffitch
This file is part of Csound.
This file is part of Csound.
The Csound Library is free software; you can redistribute it
and/or modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The Csound Library is free software; you can redistribute it
and/or modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
Csound is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
Csound is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with Csound; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
02110-1301 USA
You should have received a copy of the GNU Lesser General Public
License along with Csound; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
02110-1301 USA
*/

/* UGENS1.H */

#pragma once

typedef struct {
OPDS h;
MYFLT *xr, *ia, *idur, *ib;
double val, incr, kincr;
OPDS h;
MYFLT *xr, *ia, *idur, *ib;
double val, incr, kincr;
} LINE;

typedef struct {
OPDS h;
MYFLT *xr, *ia, *idur, *ib;
double val, mlt, kmlt;
OPDS h;
MYFLT *xr, *ia, *idur, *ib;
double val, mlt, kmlt;
} EXPON;

typedef struct {
int32 cnt, acnt;
MYFLT val, mlt, amlt;
int32 cnt, acnt;
MYFLT val, mlt, amlt;
} XSEG;

typedef struct {
int32 cnt, acnt;
double nxtpt;
int32 cnt, acnt;
double nxtpt;
} SEG;

typedef struct {
OPDS h;
MYFLT *rslt, *argums[VARGMAX];
SEG *cursegp;
int32 nsegs;
int32 segsrem, curcnt;
double curval, curinc, curainc;
AUXCH auxch;
int32 xtra;
OPDS h;
MYFLT *rslt, *argums[VARGMAX];
SEG *cursegp;
int32 nsegs;
int32 segsrem, curcnt;
double curval, curinc, curainc;
AUXCH auxch;
int32 xtra;
} LINSEG;

typedef struct {
OPDS h;
MYFLT *rslt, *argums[VARGMAX];
SEG *cursegp;
int32 nsegs;
int32 segsrem, curcnt;
double y1, y2, x, inc, val;
AUXCH auxch;
int32 xtra;
OPDS h;
MYFLT *rslt, *argums[VARGMAX];
SEG *cursegp;
int32 nsegs;
int32 segsrem, curcnt;
double y1, y2, x, inc, val;
AUXCH auxch;
int32 xtra;
} COSSEG;

typedef struct {
OPDS h;
MYFLT *rslt, *argums[VARGMAX];
SEG *cursegp;
int32 segsrem, curcnt;
double curval, curmlt, curamlt;
int32 nsegs;
AUXCH auxch;
int32 xtra;
OPDS h;
MYFLT *rslt, *argums[VARGMAX];
SEG *cursegp;
int32 segsrem, curcnt;
double curval, curmlt, curamlt;
int32 nsegs;
AUXCH auxch;
int32 xtra;
} EXPSEG;

typedef struct {
OPDS h;
MYFLT *rslt, *argums[VARGMAX];
XSEG *cursegp;
int32 segsrem, curcnt;
double curval, curmlt, curamlt;
int32 nsegs;
AUXCH auxch;
OPDS h;
MYFLT *rslt, *argums[VARGMAX];
XSEG *cursegp;
int32 segsrem, curcnt;
double curval, curmlt, curamlt;
int32 nsegs;
AUXCH auxch;
} EXXPSEG;

typedef struct {
OPDS h;
MYFLT *rslt, *sig, *iris, *idur, *idec;
double lin1, inc1, lin2, inc2;
int64_t cnt1, cnt2;
OPDS h;
MYFLT *rslt, *sig, *iris, *idur, *idec;
double lin1, inc1, lin2, inc2;
int64_t cnt1, cnt2;
} LINEN;

typedef struct {
OPDS h;
MYFLT *rslt, *sig, *iris, *idec, *iatdec;
double lin1, inc1, val, val2, mlt2;
int64_t cnt1;
OPDS h;
MYFLT *rslt, *sig, *iris, *idec, *iatdec;
double lin1, inc1, val, val2, mlt2;
int64_t cnt1;
} LINENR;

typedef struct {
OPDS h;
MYFLT *rslt, *xamp, *irise, *idur, *idec, *ifn, *iatss;
MYFLT *iatdec, *ixmod;
int32 phs, ki, cnt1;
double val, mlt1, mlt2, asym;
FUNC *ftp;
OPDS h;
MYFLT *rslt, *xamp, *irise, *idur, *idec, *ifn, *iatss;
MYFLT *iatdec, *ixmod;
int32 phs, ki, cnt1;
double val, mlt1, mlt2, asym, phsf, kif;
FUNC *ftp;
int32 floatph;
} ENVLPX;

typedef struct {
OPDS h;
MYFLT *rslt, *xamp, *irise, *idec, *ifn, *iatss, *iatdec;
MYFLT *ixmod, *irind;
int32 phs, ki, rlsing, rlscnt, rindep;
double val, mlt1, mlt2, asym, atdec;
FUNC *ftp;
OPDS h;
MYFLT *rslt, *xamp, *irise, *idec, *ifn, *iatss, *iatdec;
MYFLT *ixmod, *irind;
int32 phs, ki, rlsing, rlscnt, rindep;
double val, mlt1, mlt2, asym, atdec, kif, phsf;
FUNC *ftp;
int32 floatph;
} ENVLPR;

typedef struct {
OPDS h;
MYFLT *rslt, *argums[VARGMAX];
XSEG *cursegp;
int32 nsegs;
AUXCH auxch;
OPDS h;
MYFLT *rslt, *argums[VARGMAX];
XSEG *cursegp;
int32 nsegs;
AUXCH auxch;
} EXPSEG2; /*gab-A1*/

14 changes: 14 additions & 0 deletions H/ugens2.h
Expand Up @@ -52,6 +52,7 @@ typedef struct {
OPDS h;
MYFLT *rslt, *idel, *kamp, *idur, *ifn;
int32 kinc, phs;
double fphs, inc;
int32 dcnt;
FUNC *ftp;
} OSCIL1;
Expand All @@ -68,6 +69,19 @@ typedef struct {
OPDS h;
MYFLT *sr, *xamp, *xcps, *ifn, *iphs;
int32 lphs;
double phs;
FUNC *ftp;
int32 tablen;
double tablenUPsr;
FUNC FF;
} OSC;

typedef struct {
OPDS h;
MYFLT *out, *amp, *freq, *kloop, *kend, *ift, *iphs;
FUNC *ftp;
int32 tablen;
MYFLT fsr;
double phs, looplength;
} LPOSC;

0 comments on commit 1f4408e

Please sign in to comment.