Arduino STK 4.6.2
Sampler.h
1#ifndef STK_SAMPLER_H
2#define STK_SAMPLER_H
3
4#include "Instrmnt.h"
5#include "ADSR.h"
6#include "FileLoop.h"
7#include "MemoryWvIn.h"
8#include "MemoryLoop.h"
9#include "OnePole.h"
10
11namespace stk {
12
13/***************************************************/
22/***************************************************/
23
24class Sampler : public Instrmnt
25{
26 public:
28 Sampler( void );
29
31 virtual ~Sampler( void );
32
34 virtual void setFrequency( StkFloat frequency ) = 0;
35
37 void keyOn( void );
38
40 void keyOff( void );
41
43 virtual void noteOff( StkFloat amplitude );
44
46 virtual void controlChange( int number, StkFloat value ) = 0;
47
49 virtual StkFloat tick( unsigned int channel = 0 ) = 0;
50
52
59 virtual StkFrames& tick( StkFrames& frames, unsigned int channel = 0 ) = 0;
60
61 protected:
62
63 ADSR adsr_;
64 std::vector<FileWvIn *> attacks_;
65 std::vector<FileLoop *> loops_;
66 OnePole filter_;
67 StkFloat baseFrequency_;
68 std::vector<StkFloat> attackRatios_;
69 std::vector<StkFloat> loopRatios_;
70 StkFloat attackGain_;
71 StkFloat loopGain_;
72
73};
74
75} // stk namespace
76
77#endif
STK ADSR envelope class.
Definition ADSR.h:27
Instrmnt(void)
Class constructor.
Definition Instrmnt.h:23
STK one-pole filter class.
Definition OnePole.h:21
virtual StkFloat tick(unsigned int channel=0)=0
Compute and return one output sample.
virtual void noteOff(StkFloat amplitude)
Stop a note with the given amplitude (speed of decay).
virtual void setFrequency(StkFloat frequency)=0
Set instrument parameters for a particular frequency.
void keyOff(void)
Signal a key-off event to the envelopes.
virtual ~Sampler(void)
Class destructor.
Sampler(void)
Default constructor.
virtual StkFrames & tick(StkFrames &frames, unsigned int channel=0)=0
Fill a channel of the StkFrames object with computed outputs.
void keyOn(void)
Initiate the envelopes with a key-on event and reset the attack waves.
virtual void controlChange(int number, StkFloat value)=0
Perform the control change specified by number and value (0.0 - 128.0).
An STK class to handle vectorized audio data.
Definition Stk.h:287
The STK namespace.
Definition ADSR.h:8