Home   Information   Classes   Download   Usage   Mail List   Requirements   Links   FAQ   Tutorial


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 "OnePole.h"
8
9namespace stk {
10
11/***************************************************/
20/***************************************************/
21
22class Sampler : public Instrmnt
23{
24 public:
26 Sampler( void );
27
29 virtual ~Sampler( void );
30
32 virtual void setFrequency( StkFloat frequency ) = 0;
33
35 void keyOn( void );
36
38 void keyOff( void );
39
41 virtual void noteOff( StkFloat amplitude );
42
44 virtual void controlChange( int number, StkFloat value ) = 0;
45
47 virtual StkFloat tick( unsigned int channel = 0 ) = 0;
48
50
57 virtual StkFrames& tick( StkFrames& frames, unsigned int channel = 0 ) = 0;
58
59 protected:
60
61 ADSR adsr_;
62 std::vector<FileWvIn *> attacks_;
63 std::vector<FileLoop *> loops_;
64 OnePole filter_;
65 StkFloat baseFrequency_;
66 std::vector<StkFloat> attackRatios_;
67 std::vector<StkFloat> loopRatios_;
68 StkFloat attackGain_;
69 StkFloat loopGain_;
70
71};
72
73} // stk namespace
74
75#endif
STK ADSR envelope class.
Definition ADSR.h:25
STK instrument abstract base class.
Definition Instrmnt.h:20
STK one-pole filter class.
Definition OnePole.h:21
STK sampling synthesis abstract base class.
Definition Sampler.h:23
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:279
The STK namespace.
Definition ADSR.h:6

The Synthesis ToolKit in C++ (STK)
©1995--2023 Perry R. Cook and Gary P. Scavone. All Rights Reserved.