1 #ifndef CYDDEFS_H
2 #define CYDDEFS_H
3 
4 /*
5 Copyright (c) 2009-2010 Tero Lindeman (kometbomb)
6 
7 Permission is hereby granted, free of charge, to any person
8 obtaining a copy of this software and associated documentation
9 files (the "Software"), to deal in the Software without
10 restriction, including without limitation the rights to use,
11 copy, modify, merge, publish, distribute, sublicense, and/or sell
12 copies of the Software, and to permit persons to whom the
13 Software is furnished to do so, subject to the following
14 conditions:
15 
16 The above copyright notice and this permission notice shall be
17 included in all copies or substantial portions of the Software.
18 
19 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
20 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
21 OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
22 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
23 HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
24 WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
25 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
26 OTHER DEALINGS IN THE SOFTWARE.
27 */
28 
29 #define RANDOM_SEED 0xf31782ce
30 #define CLOCK 985250
31 #define PRE_GAIN 1
32 #define PRE_GAIN_DIVISOR 4
33 #define OUTPUT_BITS 16
34 #define MAX_OVERSAMPLE 2
35 #define ACC_BITS (23 + MAX_OVERSAMPLE)
36 #define ENVELOPE_SCALE 2
37 
38 #ifdef LOWRESWAVETABLE
39 #define WAVETABLE_RESOLUTION 2048
40 #else
41 #define WAVETABLE_RESOLUTION 65536
42 #endif
43 
44 #define ACC_LENGTH (1 << (ACC_BITS - 1)) // Osc counter length
45 #define YM_LENGTH (ACC_LENGTH) // YM envelope counter length
46 #define MAX_VOLUME 128
47 #define CYD_WAVE_MAX_ENTRIES 128
48 
49 #define CYD_BASE_FREQ 22050
50 #define CYD_MAX_CHANNELS 32
51 #define CYD_MAX_FX_CHANNELS 8
52 #define CYD_SUB_OSCS 3
53 
54 #define CYD_PAN_CENTER 64
55 #define CYD_PAN_LEFT 0
56 #define CYD_PAN_RIGHT 128
57 #define CYD_STEREO_GAIN 2048
58 
59 #define CYD_CUTOFF_MAX 2048
60 
61 #define CYD_CHORUS_OVERSAMPLE 1
62 
63 #define WAVE_AMP (1 << OUTPUT_BITS)
64 #define BUFFER_GRANULARITY 150 // mutex is locked and audio generated in 150 sample blocks
65 
66 #endif
67