mirror of
https://github.com/thestk/stk
synced 2026-01-11 20:11:52 +00:00
Version 4.2.0
This commit is contained in:
committed by
Stephen Sinclair
parent
cf06b7598b
commit
a6381b9d38
@@ -2,15 +2,15 @@
|
||||
/*! \class Sampler
|
||||
\brief STK sampling synthesis abstract base class.
|
||||
|
||||
This instrument contains up to 5 attack waves,
|
||||
5 looped waves, and an ADSR envelope.
|
||||
This instrument provides an ADSR envelope, a one-pole filter, and
|
||||
structures for an arbitrary number of attack and loop waves.
|
||||
|
||||
by Perry R. Cook and Gary P. Scavone, 1995 - 2002.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995 - 2004.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
#if !defined(__SAMPLER_H)
|
||||
#define __SAMPLER_H
|
||||
#ifndef STK_SAMPLER_H
|
||||
#define STK_SAMPLER_H
|
||||
|
||||
#include "Instrmnt.h"
|
||||
#include "ADSR.h"
|
||||
@@ -31,7 +31,7 @@ class Sampler : public Instrmnt
|
||||
void clear();
|
||||
|
||||
//! Set instrument parameters for a particular frequency.
|
||||
virtual void setFrequency(MY_FLOAT frequency) = 0;
|
||||
virtual void setFrequency(StkFloat frequency) = 0;
|
||||
|
||||
//! Initiate the envelopes with a key-on event and reset the attack waves.
|
||||
void keyOn();
|
||||
@@ -40,25 +40,36 @@ class Sampler : public Instrmnt
|
||||
void keyOff();
|
||||
|
||||
//! Stop a note with the given amplitude (speed of decay).
|
||||
virtual void noteOff(MY_FLOAT amplitude);
|
||||
virtual void noteOff(StkFloat amplitude);
|
||||
|
||||
//! Compute one output sample.
|
||||
virtual MY_FLOAT tick();
|
||||
virtual StkFloat tick() = 0;
|
||||
|
||||
//! Computer \e vectorSize outputs and return them in \e vector.
|
||||
virtual StkFloat *tick(StkFloat *vector, unsigned int vectorSize) = 0;
|
||||
|
||||
//! Fill a channel of the StkFrames object with computed outputs.
|
||||
/*!
|
||||
The \c channel argument should be one or greater (the first
|
||||
channel is specified by 1). An StkError will be thrown if the \c
|
||||
channel argument is zero or it is greater than the number of
|
||||
channels in the StkFrames object.
|
||||
*/
|
||||
virtual StkFrames& tick( StkFrames& frames, unsigned int channel = 1 ) = 0;
|
||||
|
||||
//! Perform the control change specified by \e number and \e value (0.0 - 128.0).
|
||||
virtual void controlChange(int number, MY_FLOAT value) = 0;
|
||||
virtual void controlChange(int number, StkFloat value) = 0;
|
||||
|
||||
protected:
|
||||
ADSR *adsr;
|
||||
WvIn *attacks[5];
|
||||
WaveLoop *loops[5];
|
||||
OnePole *filter;
|
||||
MY_FLOAT baseFrequency;
|
||||
MY_FLOAT attackRatios[5];
|
||||
MY_FLOAT loopRatios[5];
|
||||
MY_FLOAT attackGain;
|
||||
MY_FLOAT loopGain;
|
||||
int whichOne;
|
||||
ADSR adsr_;
|
||||
std::vector<WvIn *> attacks_;
|
||||
std::vector<WaveLoop *> loops_;
|
||||
OnePole filter_;
|
||||
StkFloat baseFrequency_;
|
||||
std::vector<StkFloat> attackRatios_;
|
||||
std::vector<StkFloat> loopRatios_;
|
||||
StkFloat attackGain_;
|
||||
StkFloat loopGain_;
|
||||
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user