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
|
/*
modal4.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
*/
/*******************************************/
/* 4 Resonance Modal Synthesis Instrument */
/* by Perry R. Cook, 1995-96 */
/* This instrument contains an excitation */
/* wavetable, an envelope, and four reso- */
/* nances (Non-Sweeping BiQuad Filters). */
/*******************************************/
#if !defined(__Modal4_h)
#define __Modal4_h
#include "physutil.h"
typedef struct Modal4 {
Envelope envelope;
FUNC *wave;
/* int32_t w_looping; */
int32_t w_myData;
int32_t w_allDone;
MYFLT w_rate;
MYFLT w_time;
MYFLT w_phaseOffset;
MYFLT w_lastOutput;
BiQuad filters[4];
OnePole onepole;
FUNC *vibr;
MYFLT v_rate; /* Parameters for vibrato */
MYFLT v_time;
MYFLT v_phaseOffset;
MYFLT v_lastOutput;
MYFLT vibrGain;
MYFLT masterGain;
MYFLT directGain;
MYFLT baseFreq;
MYFLT ratios[4];
MYFLT resons[4];
} Modal4;
void Modal4_clear(Modal4 *);
void Modal4_setFreq(CSOUND*, Modal4 *m, MYFLT frequency);
void Modal4_setRatioAndReson(CSOUND*,Modal4 *m, int32_t
whichOne,
MYFLT ratio, MYFLT reson);
#define Modal4_setMasterGain(m,Gain) (m->masterGain = aGain)
#define Modal4_setDirectGain(m,aGain) (m->directGain = aGain)
#define Modal4_setFiltGain(m,whichOne,gain) \
(BiQuad_setGain(m->filters[whichOne], gain))
static void Modal4_strike(CSOUND *, Modal4 *m, MYFLT amplitude);
static void Modal4_damp(CSOUND *, Modal4 *m, MYFLT amplitude);
static MYFLT Modal4_tick(Modal4 *);
#endif
|