12 #define BASE_FREQ 110.0
22 mAEnv(0.25, 0.05, 0.05, 0.5, 0.14),
23 mIEnv(0.25, 0.1, 0.0, 1.0, 0.1),
69 mPanner(in.mPanner) { }
79 float d = * (
float *) argv[0];
81 d = (float) (* (
int *) argv[0]);
96 mMod.setFrequency(d);
break;
118 logMsg(
kLogError,
"Unknown selector in FMInstrument set_parameter selector: %d\n", selector);
121 logMsg(
kLogError,
"Unknown multi-arg (%d) setter in FMInstrument: %s\n", argc, types);
131 float ** fargs = (
float **) argv;
133 if (strcmp(types,
"ffff") == 0) {
135 printf(
"\tFM: d %5.2f a %5.2f f %7.1f p %5.2f\n",
136 *fargs[0], *fargs[1], *fargs[2], *fargs[3]);
137 }
else if (strcmp(types,
"ffffff") == 0) {
139 printf(
"\tFM: d %g a %g c %g m %g i %g p %g\n",
140 *fargs[0], *fargs[1], *fargs[2], *fargs[3], *fargs[4], *fargs[5]);
141 }
else if (strcmp(types,
"ffffffffffffff") == 0)
144 logMsg(
kLogError,
"Invalid type string in OSC message, expected \"ff...ff\" got \"%s\"\n", types);
150 mMod.setOffset(*fargs[2]);
151 mMod.setFrequency(*fargs[2]);
162 printf(
"\t\ta %g d %g s %g r %g\t\ta %g d %g s %g r %g\n",
163 *fargs[6], *fargs[7], *fargs[8], *fargs[9], *fargs[10], *fargs[11], *fargs[12], *fargs[13]);
185 float att,
float dec,
float sus,
float rel,
186 float i_att,
float i_dec,
float i_sus,
float i_rel) {
190 mMod.setOffset(c_fr);
191 mMod.setFrequency(m_fr);
229 mVibEnv(
kExpon, 3, 0.0, 0.1, 2, 1.0, 3, 0.1),
230 mChiffEnv(3, 0.01, 0.01, 0.0, 2),
262 float d = * (
float *) argv[0];
264 d = (float) (* (
int *) argv[0]);
282 logMsg(
kLogError,
"Unknown multi-arg (%d) setter in FMInstrument: %s\n", argc, types);
286 float ** fargs = (
float **) argv;
290 mMod.setOffset(*fargs[2]);
void logMsg(const char *format,...)
These are the public logging messages.
AdditiveInstrument.h – Sum-of-sines synthesis instrument class.
virtual void setDuration(float d)
set/scale durations
void setParameter(unsigned selector, int argc, void **argv, const char *types)
Plug functions.
virtual void setParameter(unsigned selector, int argc, void **argv, const char *types)
Plug functions.
void setAttack(float attack)
void setRelease(float release)
UnitGenerator * mGraph
Caches.
FancyFMInstrument()
Constructor.
void parseArgs(int argc, void **argv, const char *types)
Play functions.
float keyToFreq(unsigned midiKey)
MIDI Conversions.
AccessorVector mAccessors
the accessor vector
Butter mChFilter
chiff filter
virtual void playOSC(int argc, void **argv, const char *types)
WhiteNoise mChiff
chiff noise
Osc mVibrato
sine oscillator for vibrato
#define set_duration_f
Instrument.h – The CSL pluggable instrument class. See the copyright notice and acknowledgment of au...
ADSR mIEnv
amplitude & modulation index envelopes
unsigned mNumChannels
my "expected" number of output channels
void setPosition(UnitGenerator &pan)
Operations.
Instrument class (abstract)
void setDuration(float d)
Special accessors.
float fRandZ(void)
A variety of useful random-number functions.
void playMIDI(float dur, int chan, int key, int vel)
These are the additional UGens of the DSP graph (i.e., the FM instrument)
Osc mMod
2 sine oscillators, carrier and modulator
void playNote(float dur=1, float ampl=1, float c_fr=110, float m_fr=110, float ind=1, float pos=0, float att=0.1, float dec=0.1, float sus=0.5, float rel=0.1, float i_att=0.1, float i_dec=0.1, float i_sus=0.5, float i_rel=0.1)
FMInstrument()
Constructor.
virtual void scaleValues(float s)
scale values so the max is s
void setSustain(float sustain)
The Accessor class has public data members.
void setDecay(float decay)
Panner mPanner
stereo panner
UGenVector mEnvelopes
the vector of envelopes to query or trigger
void playMIDI(float dur, int chan, int key, int vel)
These are the UGens of the DSP graph (i.e., the FM instrument)
void setScale(UnitGenerator &scale)
set the receiver's scale member to a UGen or a float
Envelope mVibEnv
vibrato envelope
ADSR mChiffEnv
attack-chiff envelope
void playOSC(int argc, void **argv, const char *types)
UGenMap mUGens
the map of ugens in the graph by name