pure-data/src/d_osc.c

/* Copyright (c) 1997-1999 Miller Puckette.
* For information on usage and redistribution, and for a DISCLAIMER OF ALL
* WARRANTIES, see the file, "LICENSE.txt," in this distribution.  */

/* sinusoidal oscillator and table lookup; see also tabosc4~ in d_array.c.
*/

#include "m_pd.h"
#include "math.h"

#ifndef M_PI
#define M_PI
#endif

#define BIGFLOAT
#define UNITBIT32

#include "m_private_utils.h"

#if BYTE_ORDER == LITTLE_ENDIAN
#define HIOFFSET
#define LOWOFFSET
#else
#define HIOFFSET
#define LOWOFFSET
#endif


tabfudge;

/* the table size before 0.55 was hard-coded to 512 points.  Now we let it
default to 2048, but we can compile with COSTABSIZE defined to choose another
table size.  For the Pd application we also include a 512-point version for
back compatibility.  Since the code (on Intel arch at least) runs 10% faster
with COSTABSIE hard-coded, we have to make the choices at compile time.  If
the compatiblity version is needed, we end up compiling two version of the
same code.  This is done by including d_osc.h, twice if two table sizes must
be defined, to define the performance routines for cos~, osc~, and vcf~.  The
inclusions are done at the end of the file (after the instance structs are
defined) but are declared here. */

struct _cos;
struct _osc;
struct _vcfctl;

#ifndef COSTABLESIZE
#define COSTABLESIZE
#define OLDTABSIZE
static t_int *cos_perform_old(t_int *w);
static t_int *osc_perform_old(t_int *w);
static t_int *sigvcf_perform_old(t_int *w);
#endif
static t_int *cos_perform(t_int *w);
static t_int *osc_perform(t_int *w);
static t_int *sigvcf_perform(t_int *w);
#define COSTABLENAME


/* -------------------------- phasor~ ------------------------------ */
static t_class *phasor_class;

#if 1   /* in the style of R. Hoeldrich (ICMC 1995 Banff) */

t_phasor;

static void *phasor_new(t_floatarg f)
{}

static t_int *phasor_perform(t_int *w)
{}

static void phasor_dsp(t_phasor *x, t_signal **sp)
{}

static void phasor_ft1(t_phasor *x, t_float f)
{}

static void phasor_setup(void)
{}

#endif  /* Hoeldrich version */

/* ------------------------ cos~ ----------------------------- */

float *cos_table;
static float *cos_newtable;

static t_class *cos_class;

t_cos;

static void *cos_new(t_floatarg f)
{}

static void cos_dsp(t_cos *x, t_signal **sp)
{}

static void cos_maketable(void)
{}

static void cos_cleanup(t_class *c)
{}

static void cos_setup(void)
{}

/* ------------------------ osc~ ----------------------------- */

static t_class *osc_class, *scalarosc_class;

t_osc;

static void *osc_new(t_floatarg f)
{}

static void osc_dsp(t_osc *x, t_signal **sp)
{}

static void osc_ft1(t_osc *x, t_float f)
{}

static void osc_setup(void)
{}

/* ---- vcf~ - resonant filter with audio-rate center frequency input ----- */

t_vcfctl;

t_sigvcf;

t_class *sigvcf_class;

static void *sigvcf_new(t_floatarg q)
{}

static void sigvcf_ft1(t_sigvcf *x, t_float f)
{}

static void sigvcf_dsp(t_sigvcf *x, t_signal **sp)
{}

static void sigvcf_clear(t_sigvcf *x)
{}

static
void sigvcf_setup(void)
{}

/* -------------------------- noise~ ------------------------------ */
static t_class *noise_class;

t_noise;

static void *noise_new(void)
{}

static t_int *noise_perform(t_int *w)
{}

static void noise_dsp(t_noise *x, t_signal **sp)
{}

static void noise_float(t_noise *x, t_float f)
{}

static void noise_setup(void)
{}


/******************** tabosc4~ ***********************/

static t_class *tabosc4_tilde_class;

t_tabosc4_tilde;

static void *tabosc4_tilde_new(t_symbol *s)
{}

static t_int *tabosc4_tilde_perform(t_int *w)
{}

static void tabosc4_tilde_set(t_tabosc4_tilde *x, t_symbol *s)
{}

static void tabosc4_tilde_ft1(t_tabosc4_tilde *x, t_float f)
{}

static void tabosc4_tilde_dsp(t_tabosc4_tilde *x, t_signal **sp)
{}

static void tabosc4_tilde_setup(void)
{}

#define TABSIZE
#define COSPERF
#define OSCPERF
#define SIGVCFPERF

#include "d_osc.h"    /* include normal perf routines */

#ifdef OLDTABSIZE
#undef COSTABLESIZE
#define COSTABLESIZE
#undef COSTABLENAME
#define COSTABLENAME
#undef COSPERF
#define COSPERF
#undef OSCPERF
#define OSCPERF
#undef SIGVCFPERF
#define SIGVCFPERF
#include "d_osc.h"    /* include 512-point compatibility perf routines */
#endif

/* ----------------------- global setup routine ---------------- */
void d_osc_setup(void)
{}