-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathOscillatorNote.h
59 lines (48 loc) · 1.4 KB
/
OscillatorNote.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
#pragma once
/*
MINI VIRTUAL ANALOG SYNTHESIZER
Copyright 2014 Kenneth D. Miller III
Note Oscillator
*/
#include "Oscillator.h"
#include "SubOscillator.h"
#include "Wave.h"
// oscillators per voice
#define NUM_OSCILLATORS 2
// note oscillator configuration
class NoteOscillatorConfig : public OscillatorConfig
{
public:
// base parameters
float waveparam_base;
float frequency_base; // logarithmic offset
float amplitude_base;
// LFO modulation parameters
float waveparam_lfo;
float frequency_lfo;
float amplitude_lfo;
// sub oscillator
SubOscillatorMode sub_osc_mode;
float sub_osc_amplitude;
// key follow
float key_follow;
explicit NoteOscillatorConfig(bool const enable = false, Wave const wavetype = WAVE_SAWTOOTH, float const waveparam = 0.5f, float const frequency = 1.0f, float const amplitude = 1.0f)
: OscillatorConfig(enable, wavetype, waveparam, frequency, amplitude)
, waveparam_base(waveparam)
, frequency_base(0.0f)
, amplitude_base(amplitude)
, waveparam_lfo(0.0f)
, frequency_lfo(0.0f)
, amplitude_lfo(0.0f)
, key_follow(1.0f)
, sub_osc_mode(SUBOSC_NONE)
, sub_osc_amplitude(0.0f)
{
}
void Modulate(float lfo);
};
extern NoteOscillatorConfig osc_config[NUM_OSCILLATORS];
// TO DO: keyboard follow dial?
// TO DO: oscillator mixer
// note oscillator state
extern OscillatorState osc_state[][NUM_OSCILLATORS];