summaryrefslogtreecommitdiff
path: root/note_compiler/programs.h
blob: b3116966e034d4a98f725bd104a5c41ae3ab23ca (plain)
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
#ifndef __PROGRAMS_H__
#define __PROGRAMS_H__


#include "../synth/fixed.h"

enum parameter_enum
{
	MODULATION=0,
	OUTPUT,
	WAVEFORM,
	FACTOR,
	TREMOLO,
	TREM_LFO,
	VIBRATO,
	VIB_LFO,
	ATTACK,
	DECAY,
	SUSTAIN,
	RELEASE,
	HOLD,
	KSR,
	KSL,
	SYNC,
	FILTER_ENABLED,
	FILTER_ENV_AMOUNT,
	FILTER_ATTACK,
	FILTER_DECAY,
	FILTER_SUSTAIN,
	FILTER_RELEASE,
	FILTER_HOLD,
	FILTER_OFFSET,
	FILTER_RESONANCE,
	FILTER_TREMOLO,
	FILTER_TREM_LFO,
	SYNC_FACTOR,

	FREQ_ATTACK,
	FREQ_DECAY,
	FREQ_SUSTAIN,
	FREQ_RELEASE,
	FREQ_HOLD,
	FREQ_ENV_AMOUNT,

	PARAMETER_N_ENTRIES,
	UNKNOWN=-1
};

struct env_settings_t
{
	bool enabled;
	float attack;
	bool attack_const;
	float decay;
	bool decay_const;
	float sustain;
	bool sustain_const;
	float release;
	bool release_const;
	bool hold;
	bool hold_const;
};

struct oscillator_t
{
	fixed_t *fm_strength;
	bool *fm_strength_const;
	fixed_t output;      
	bool output_const;      
	int waveform;
	bool waveform_const;
	fixed_t factor;
	bool factor_const;

	float freq_env_amount;
	bool freq_env_amount_const;
	env_settings_t freq_env;
	
	
	fixed_t tremolo_depth;
	bool tremolo_depth_const;
	int tremolo_lfo;
	bool tremolo_lfo_const;
	fixed_t vibrato_depth;
	bool vibrato_depth_const;
	int vibrato_lfo;
	bool vibrato_lfo_const;
	
	bool have_custom_wave;
	
	int n_osc;
	
	float ksl;
	bool ksl_const;
	float ksr;
	bool ksr_const;
	
	bool sync;
	bool sync_const;
};

struct filter_params_t
{
	bool enabled;
	bool enabled_const;
	float resonance;
	bool resonance_const;
	float freqfactor_offset;
	bool freqfactor_offset_const;
	float env_amount;	
	bool env_amount_const;	
	int trem_strength;
	bool trem_strength_const;
	int trem_lfo;
	bool trem_lfo_const;
	env_settings_t env_settings;
};

struct program_t
{
	int n_osc;
	oscillator_t *osc;
	env_settings_t *env;
	filter_params_t filter;
	
	fixed_t sync_factor;
	bool sync_factor_const;
};

#endif