-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsynthesizer_config.h
86 lines (70 loc) · 2.31 KB
/
synthesizer_config.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#ifndef APPLICATION_AUDIO_SYNTHESIZER_SYNTHESIZER_CONFIG_H_
#define APPLICATION_AUDIO_SYNTHESIZER_SYNTHESIZER_CONFIG_H_
#include <array>
#include <string>
#include <vector>
class SynthesizerConfig {
public:
enum WaveGeneratorType {
SINE,
TRIANGLE,
SAWTOOTH,
SQUARE,
TANGENT,
WHISTLE,
BREAKER,
WHITE_NOISE,
PINK_NOISE,
BROWN_NOISE
};
static constexpr std::array<const char*, 10> waveGeneratorNames = {
"sine", "triangle", "sawtooth", "square", "tangent",
"whistle", "breaker", "whitenoise", "pinknoise", "brownnoise"};
static std::vector<std::pair<const char*, int>> const& FieldsOffsets();
static WaveGeneratorType WaveGeneratorTypeFromString(std::string const& str);
// Returns the duration of the sound in seconds.
float Duration();
// |time| in seconds.
float AmplitudeAt(float time);
float FrequencyAt(float time);
// In seconds.
float attack_ = 0.0;
float sustain_ = 0.0;
float decay_ = 0.0;
// Amount of times per second that the frequency is reset to its base value,
// and starts its sweep cycle anew.
float repeat_frequency_ = 0.0;
// In miliseconds.
float flanger_offset_ = 0.0;
float flanger_offset_sweep_ = 0.0;
// In hertz.
float tremolo_frequency_ = 0.0;
float frequency_ = 0.0;
float frequency_sweep_ = 0.0;
float frequency_delta_sweep_ = 0.0;
float vibrato_frequency_ = 0.0;
// Surprisingly, this is also in Hz.
float vibrato_depth_ = 0.0;
// Percentage (between 0 and 100).
float frequency_jump1_onset_ = 0.0;
float frequency_jump1_amount_ = 0.0;
float frequency_jump2_onset_ = 0.0;
float frequency_jump2_amount_ = 0.0;
float tremolo_depth_ = 0.0;
float sustain_punch_ = 0.0;
// Percentage (between 0 and 1).
float frequency_jump1_onset_normalized_ = 0.0;
float frequency_jump1_amount_normalized_ = 0.0;
float frequency_jump2_onset_normalized_ = 0.0;
float frequency_jump2_amount_normalized_ = 0.0;
float tremolo_depth_normalized_ = 0.0;
float sustain_punch_normalized_ = 0.0;
bool normalization_ = false;
float amplification_ = 1.0;
bool interpolate_noise_ = false;
int samples_per_second_ = 11025 * 2;
float harmonics_ = 0.0;
float harmonics_falloff_ = 0.0;
WaveGeneratorType wave_generator_type_ = SINE;
};
#endif // APPLICATION_AUDIO_SYNTHESIZER_SYNTHESIZER_CONFIG_H_