summaryrefslogtreecommitdiff
path: root/note_compiler/programs.h
blob: 1849211f67d56de8fc6577f46cee910ac23c8e41 (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
131
132
133
134
135
136
137
138
139
140
/*
    Copyright (C) 2010-2012 Florian Jung
     
    This file is part of flo's FM synth.

    flo's FM synth is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    flo's FM synth is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with flo's FM synth.  If not, see <http://www.gnu.org/licenses/>.
*/


#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,


	PARAMETER_N_ENTRIES,
	UNKNOWN=-1
};


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;
	
	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 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 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