1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113
|
/*
moog1.h:
Copyright (C) 1996, 1997 Perry Cook, John ffitch
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.
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
*/
/******************************************/
/* Moog1 Subclass of */
/* Sampling Synthesizer Class */
/* by Perry R. Cook, 1995-96 */
/* */
/* Controls: CONTROL1 = filterQ */
/* CONTROL2 = filterRate */
/* CONTROL3 = vibFreq */
/* MOD_WHEEL= vibAmt */
/******************************************/
#if !defined(__Moog1_h)
#define __Moog1_h
#include "fm4op.h"
/*******************************************/
/* Sweepable Formant (2-pole) */
/* Filter Class, by Perry R. Cook, 1995-96*/
/* See books on filters to understand */
/* more about how this works. Nothing */
/* out of the ordinary in this version. */
/*******************************************/
typedef struct FormSwep {
MYFLT gain;
MYFLT outputs[2];
MYFLT poleCoeffs[2];
MYFLT freq;
MYFLT reson;
int32_t
dirty;
MYFLT targetFreq;
MYFLT targetReson;
MYFLT targetGain;
MYFLT currentFreq;
MYFLT currentReson;
MYFLT currentGain;
MYFLT deltaFreq;
MYFLT deltaReson;
MYFLT deltaGain;
MYFLT sweepState;
MYFLT sweepRate;
} FormSwep;
#define FormSwep_setSweepRate(p,aRate) (p.sweepRate = aRate)
#define FormSwep_clear(p) (p.outputs[0]=p.outputs[1]=FL(0.0))
void FormSwep_setTargets(FormSwep *, MYFLT, MYFLT, MYFLT);
MYFLT FormSwep_tick(CSOUND *, FormSwep *, MYFLT);
typedef struct Wave {
FUNC *wave;
MYFLT rate;
MYFLT time;
MYFLT phase;
} Wave;
/*******************************************/
/* Master Class for Sampling Synthesizer */
/* by Perry R. Cook, 1995-96 */
/* This instrument contains up to 5 */
/* attack waves, 5 looped waves, and */
/* an ADSR envelope. */
/*******************************************/
typedef struct MOOG1 {
OPDS h;
MYFLT *ar; /* Output */
MYFLT *amp, *frequency;
MYFLT *filterQ, *filterRate, *vibf, *vibAmt;
MYFLT *iatt, *ifn, *ivfn;
ADSR adsr;
Wave attk; /* Not looped */
Wave loop; /* Looped */
Wave vibr; /* Looped */
OnePole filter;
MYFLT baseFreq;
MYFLT attackRatio;
MYFLT loopRatio;
MYFLT attackGain;
MYFLT loopGain;
MYFLT oldfilterQ;
MYFLT oldfilterRate;
FormSwep filters[2];
TwoZero twozeroes[2];
} MOOG1;
#endif
|