-
Notifications
You must be signed in to change notification settings - Fork 0
/
Pandura.h
66 lines (51 loc) · 1.04 KB
/
Pandura.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
60
61
62
63
64
65
66
#pragma once
#include "IPlug_include_in_plug_hdr.h"
#include "../src/POscillator.h"
#include "../src/MidiMap.h"
#include "../src/Filter.h"
#define PITCH 440.
#define TABLE_SIZE 512
#ifndef M_PI
#define M_PI 3.14159265
#endif
const int kNumPrograms = 1;
float midiToFreq(int midi)
{
return 440. * pow(2., (midi - 69.) / 12.);
}
enum EParams
{
kGain = 0,
kFrequency = 1,
kCutoff,
kAttack,
kDecay,
kSustain,
kRelease,
kResonance,
kNumParams
};
class Pandura : public IPlug
{
public:
Pandura(IPlugInstanceInfo instanceInfo);
void ProcessBlock(sample** inputs, sample** outputs, int nFrames) override;
void ProcessMidiMsg(const IMidiMsg& msg) override;
void OnParamChange(int paramIdx) override;
private:
POscillator _osc;
double _sampleRate;
MidiMap _midiMap;
Filter _filter;
int _midiNote;
double _frequency;
bool on;
double _gain;
int _attack;
int _decay;
double _sustain;
int _release;
float _cutoff;
float _resonance;
int _state;
};