mirror of
https://github.com/thestk/stk
synced 2026-01-11 20:11:52 +00:00
Version 4.0
This commit is contained in:
committed by
Stephen Sinclair
parent
3f126af4e5
commit
81475b04c5
@@ -1,44 +1,74 @@
|
||||
/*******************************************/
|
||||
/* Master Class for Simple Instrument */
|
||||
/* by Perry R. Cook, 1995-96 */
|
||||
/* This instrument contains 1 looped */
|
||||
/* wave, 1 noise source, 1 biquad filter */
|
||||
/* 1 one-pole filter, and 1 ADSR envelope */
|
||||
/*******************************************/
|
||||
/***************************************************/
|
||||
/*! \class Simple
|
||||
\brief STK wavetable/noise instrument.
|
||||
|
||||
#if !defined(__Simple_h)
|
||||
#define __Simple_h
|
||||
This class combines a looped wave, a
|
||||
noise source, a biquad resonance filter,
|
||||
a one-pole filter, and an ADSR envelope
|
||||
to create some interesting sounds.
|
||||
|
||||
Control Change Numbers:
|
||||
- Filter Pole Position = 2
|
||||
- Noise/Pitched Cross-Fade = 4
|
||||
- Envelope Rate = 11
|
||||
- Gain = 128
|
||||
|
||||
by Perry R. Cook and Gary P. Scavone, 1995 - 2002.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
#if !defined(__SIMPLE_H)
|
||||
#define __SIMPLE_H
|
||||
|
||||
#include "Instrmnt.h"
|
||||
#include "ADSR.h"
|
||||
#include "RawWvIn.h"
|
||||
#include "WaveLoop.h"
|
||||
#include "OnePole.h"
|
||||
#include "TwoPole.h"
|
||||
#include "TwoZero.h"
|
||||
#include "BiQuad.h"
|
||||
#include "Noise.h"
|
||||
|
||||
class Simple : public Instrmnt
|
||||
{
|
||||
public:
|
||||
//! Class constructor.
|
||||
Simple();
|
||||
|
||||
//! Class destructor.
|
||||
virtual ~Simple();
|
||||
|
||||
//! Clear internal states.
|
||||
void clear();
|
||||
|
||||
//! Set instrument parameters for a particular frequency.
|
||||
virtual void setFrequency(MY_FLOAT frequency);
|
||||
|
||||
//! Start envelope toward "on" target.
|
||||
void keyOn();
|
||||
|
||||
//! Start envelope toward "off" target.
|
||||
void keyOff();
|
||||
|
||||
//! Start a note with the given frequency and amplitude.
|
||||
virtual void noteOn(MY_FLOAT frequency, MY_FLOAT amplitude);
|
||||
|
||||
//! Stop a note with the given amplitude (speed of decay).
|
||||
virtual void noteOff(MY_FLOAT amplitude);
|
||||
|
||||
//! Compute one output sample.
|
||||
virtual MY_FLOAT tick();
|
||||
|
||||
//! Perform the control change specified by \e number and \e value (0.0 - 128.0).
|
||||
virtual void controlChange(int number, MY_FLOAT value);
|
||||
|
||||
protected:
|
||||
ADSR *adsr;
|
||||
RawWvIn *loop;
|
||||
WaveLoop *loop;
|
||||
OnePole *filter;
|
||||
TwoPole *bqpoles;
|
||||
TwoZero *bqzeroes;
|
||||
BiQuad *biquad;
|
||||
Noise *noise;
|
||||
MY_FLOAT baseFreq;
|
||||
MY_FLOAT baseFrequency;
|
||||
MY_FLOAT loopGain;
|
||||
public:
|
||||
Simple();
|
||||
virtual ~Simple();
|
||||
void clear();
|
||||
virtual void setFreq(MY_FLOAT frequency);
|
||||
void keyOn();
|
||||
void keyOff();
|
||||
virtual void noteOn(MY_FLOAT freq, MY_FLOAT amp);
|
||||
virtual void noteOff(MY_FLOAT amplitude);
|
||||
virtual MY_FLOAT tick();
|
||||
virtual void controlChange(int number, MY_FLOAT value);
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user