-
Notifications
You must be signed in to change notification settings - Fork 1
/
piano.h
59 lines (46 loc) · 1.36 KB
/
piano.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// STK
#include <Instrmnt.h>
#include <OnePole.h>
#include <OneZero.h>
using namespace stk;
#include "piano_coupled_strings.h"
#include "piano_soundboard.h"
class Piano : public Instrmnt
{
public:
Piano();
virtual void noteOn (StkFloat frequency, StkFloat amplitude);
virtual void noteOn (int keynum, StkFloat amplitude);
virtual void noteOff (StkFloat amplitude);
virtual void controlChange (int number, StkFloat value);
virtual void setFrequency (StkFloat frequency);
virtual StkFloat computeSample();
// These are all ratios between [0, 1]
void setStiffnessFactor(StkFloat factor);
void setDetuningFactor(StkFloat factor);
void setOverallGain(StkFloat factor);
void setPedalPresenceFactor(StkFloat factor);
void setBrightnessFactor(StkFloat factor);
int getNoteNumber() { return noteNumber; }
bool isActive();
virtual StkFrames& tick( StkFrames& frames, unsigned int channel = 0 );
virtual StkFloat tick( unsigned int channel = 0 );
protected:
void calcHammer(StkFloat velocity);
void calcHighTuning(int noteNumber, StkFloat freq);
Soundboard sb;
CoupledStrings cs;
OnePole hammerfilt[4];
PoleZero dcBlock1;
OneZero dcBlock2a;
OnePole dcBlock2b;
BiQuad eq;
OneZero hipass;
// High notes
BiQuad high_bq[4];
int noteNumber;
StkFloat overallGain;
StkFloat brightnessFactor;
int sample_counter;
int zero_count;
};