summaryrefslogtreecommitdiff
path: root/synth/defines.h
blob: 3345b15d96763eab3af8e6a18aac4f1e399d3bd7 (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
/*
    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 __DEFINES_H__
#define __DEFINES_H__

#define WATCHFILES //undef if you don't want support for it


#define XRUN_TIME 2.0
#define XRUN_N 8

#define CLEANUP_INTERVAL_SEC 1.0

#define MAX_PORTAMENTO_TIME 2.0

#define FILTER_UPDATE_FREQ_HZ 250
#define LFO_UPDATE_FREQ_HZ 500
#define ENVELOPE_UPDATE_FREQ_HZ 500 //>=10000 for high-quality

//when changing this, also change code marked with FINDLFO!
#define N_LFOS 3
#define N_LFO_LEVELS 1024
#define LFO_MAX 1
extern float LFO_FREQ_HZ[];
#define __LFO_FREQ_HZ {7.0, 5.0, 1.0}

#if N_LFO_LEVELS <= 1
	#error "N_LFO_LEVELS must be greater than one!"
#endif

#define SNH_FREQ_HZ 10
#define SNH_LFO N_LFOS


//init the oscillator phases to wave_res * PHASE_INIT
//negative values are not allowed, zero will cause the program
//to segfault if phase modulation is done, higher values will make
//the probability for a segfault smaller (i.e., zero)
//only decrease if you know what you're doing!
#define PHASE_INIT 100


#define MIDI_IN_NAME "midi_in"
#define OUT_NAME "output"

#define N_CHANNELS 16


//#define STEREO
#define FRAMESKIP

#define VOL_FACTOR (1/20.0)



#define PI 3.141592654





#define WAVE_RES 44100


// saw_start must be >= n_normal
// pulse_start must be > saw_end
// holes are allowed

// 0..6 different stuff
// 10..19 saw
// 20..29 square is allowed, for example

//SAW_N and PULSE_N should be odd numbers, otherwise you won't
//get equal ratios for falling/rising or high/low
//in english: you won't get a "normal" triangle wave or a "normal"
//            square wave then
#define N_NORMAL_WAVEFORMS 6
#define WAVE_SAW_START 100
#define WAVE_SAW_N 201
#define WAVE_PULSE_START 400
#define WAVE_PULSE_N 201

#if ( (WAVE_SAW_START < N_NORMAL_WAVEFORMS) || \
      (WAVE_PULSE_START < WAVE_SAW_START+WAVE_SAW_N) )
	#error NORMAL WAVEFORMS, SAW- AND PULSE-WAVES MAY NOT OVERLAP!
#endif

#define N_WAVEFORMS (WAVE_PULSE_START+WAVE_PULSE_N)



#define NO_CONT 128

#endif