1 |
/*************************************************************************** |
2 |
* * |
3 |
* LinuxSampler - modular, streaming capable sampler * |
4 |
* * |
5 |
* Copyright (C) 2003, 2004 by Benno Senoner and Christian Schoenebeck * |
6 |
* Copyright (C) 2005 - 2007 Christian Schoenebeck * |
7 |
* * |
8 |
* This program is free software; you can redistribute it and/or modify * |
9 |
* it under the terms of the GNU General Public License as published by * |
10 |
* the Free Software Foundation; either version 2 of the License, or * |
11 |
* (at your option) any later version. * |
12 |
* * |
13 |
* This program is distributed in the hope that it will be useful, * |
14 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of * |
15 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
16 |
* GNU General Public License for more details. * |
17 |
* * |
18 |
* You should have received a copy of the GNU General Public License * |
19 |
* along with this program; if not, write to the Free Software * |
20 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, * |
21 |
* MA 02111-1307 USA * |
22 |
***************************************************************************/ |
23 |
|
24 |
// Allow to avoid inclusion of config.h |
25 |
// (we used it for the _old_ xcode project file to avoid inclusion of |
26 |
// config.h here and rather used our manually maintained version.h) |
27 |
#ifndef OVERRIDE_CONFIG_H |
28 |
# include <config.h> |
29 |
#endif |
30 |
|
31 |
// Make sure all mandatory configuration macros are defined. |
32 |
// We don't care about optional configuration macros though. |
33 |
#ifndef CONFIG_GLOBAL_ATTENUATION_DEFAULT |
34 |
# error "Configuration macro CONFIG_GLOBAL_ATTENUATION_DEFAULT not defined!" |
35 |
#endif // CONFIG_GLOBAL_ATTENUATION_DEFAULT |
36 |
#ifndef CONFIG_MAX_PITCH |
37 |
# error "Configuration macro CONFIG_MAX_PITCH not defined!" |
38 |
#endif // CONFIG_MAX_PITCH |
39 |
#ifndef CONFIG_MAX_EVENTS_PER_FRAGMENT |
40 |
# error "Configuration macro CONFIG_MAX_EVENTS_PER_FRAGMENT not defined!" |
41 |
#endif // CONFIG_MAX_EVENTS_PER_FRAGMENT |
42 |
#ifndef CONFIG_EG_BOTTOM |
43 |
# error "Configuration macro CONFIG_EG_BOTTOM not defined!" |
44 |
#endif // CONFIG_EG_BOTTOM |
45 |
#ifndef CONFIG_EG_MIN_RELEASE_TIME |
46 |
# error "Configuration macro CONFIG_EG_MIN_RELEASE_TIME not defined!" |
47 |
#endif // CONFIG_EG_MIN_RELEASE_TIME |
48 |
#ifndef CONFIG_REFILL_STREAMS_PER_RUN |
49 |
# error "Configuration macro CONFIG_REFILL_STREAMS_PER_RUN not defined!" |
50 |
#endif // CONFIG_REFILL_STREAMS_PER_RUN |
51 |
#ifndef CONFIG_STREAM_MIN_REFILL_SIZE |
52 |
# error "Configuration macro CONFIG_STREAM_MIN_REFILL_SIZE not defined!" |
53 |
#endif // CONFIG_STREAM_MIN_REFILL_SIZE |
54 |
#ifndef CONFIG_STREAM_MAX_REFILL_SIZE |
55 |
# error "Configuration macro CONFIG_STREAM_MAX_REFILL_SIZE not defined!" |
56 |
#endif // CONFIG_STREAM_MAX_REFILL_SIZE |
57 |
#ifndef CONFIG_STREAM_BUFFER_SIZE |
58 |
# error "Configuration macro CONFIG_STREAM_BUFFER_SIZE not defined!" |
59 |
#endif // CONFIG_STREAM_BUFFER_SIZE |
60 |
#ifndef CONFIG_MAX_STREAMS |
61 |
# error "Configuration macro CONFIG_MAX_STREAMS not defined!" |
62 |
#endif // CONFIG_MAX_STREAMS |
63 |
#ifndef CONFIG_MAX_VOICES |
64 |
# error "Configuration macro CONFIG_MAX_VOICES not defined!" |
65 |
#endif // CONFIG_MAX_VOICES |
66 |
#ifndef CONFIG_DEFAULT_SUBFRAGMENT_SIZE |
67 |
# error "Configuration macro CONFIG_DEFAULT_SUBFRAGMENT_SIZE not defined!" |
68 |
#endif // CONFIG_DEFAULT_SUBFRAGMENT_SIZE |
69 |
#ifndef CONFIG_VOICE_STEAL_ALGO |
70 |
# error "Configuration macro CONFIG_VOICE_STEAL_ALGO not defined!" |
71 |
#endif // CONFIG_VOICE_STEAL_ALGO |
72 |
#ifndef CONFIG_SYSEX_BUFFER_SIZE |
73 |
# error "Configuration macro CONFIG_SYSEX_BUFFER_SIZE not defined!" |
74 |
#endif // CONFIG_SYSEX_BUFFER_SIZE |
75 |
#ifndef CONFIG_FILTER_CUTOFF_MIN |
76 |
# error "Configuration macro CONFIG_FILTER_CUTOFF_MIN not defined!" |
77 |
#endif // CONFIG_FILTER_CUTOFF_MIN |
78 |
#ifndef CONFIG_FILTER_CUTOFF_MAX |
79 |
# error "Configuration macro CONFIG_FILTER_CUTOFF_MAX not defined!" |
80 |
#endif // CONFIG_FILTER_CUTOFF_MAX |
81 |
#ifndef CONFIG_PORTAMENTO_TIME_MIN |
82 |
# error "Configuration macro CONFIG_PORTAMENTO_TIME_MIN not defined!" |
83 |
#endif // CONFIG_PORTAMENTO_TIME_MIN |
84 |
#ifndef CONFIG_PORTAMENTO_TIME_MAX |
85 |
# error "Configuration macro CONFIG_PORTAMENTO_TIME_MAX not defined!" |
86 |
#endif // CONFIG_PORTAMENTO_TIME_MAX |
87 |
#ifndef CONFIG_PORTAMENTO_TIME_DEFAULT |
88 |
# error "Configuration macro CONFIG_PORTAMENTO_TIME_DEFAULT not defined!" |
89 |
#endif // CONFIG_PORTAMENTO_TIME_DEFAULT |
90 |
|
91 |
// this is the sampler global volume coefficient that should be obeyed by all |
92 |
// sampler engine implementations |
93 |
double GLOBAL_VOLUME = CONFIG_GLOBAL_ATTENUATION_DEFAULT; |
94 |
|
95 |
int hexToNumber(char hex_digit) { |
96 |
switch (hex_digit) { |
97 |
case '0': return 0; |
98 |
case '1': return 1; |
99 |
case '2': return 2; |
100 |
case '3': return 3; |
101 |
case '4': return 4; |
102 |
case '5': return 5; |
103 |
case '6': return 6; |
104 |
case '7': return 7; |
105 |
case '8': return 8; |
106 |
case '9': return 9; |
107 |
|
108 |
case 'a': return 10; |
109 |
case 'b': return 11; |
110 |
case 'c': return 12; |
111 |
case 'd': return 13; |
112 |
case 'e': return 14; |
113 |
case 'f': return 15; |
114 |
|
115 |
case 'A': return 10; |
116 |
case 'B': return 11; |
117 |
case 'C': return 12; |
118 |
case 'D': return 13; |
119 |
case 'E': return 14; |
120 |
case 'F': return 15; |
121 |
|
122 |
default: return 0; //TODO: we might want to throw an exception here |
123 |
} |
124 |
} |
125 |
|
126 |
int hexsToNumber(char hex_digit0, char hex_digit1) { |
127 |
return hexToNumber(hex_digit1)*16 + hexToNumber(hex_digit0); |
128 |
} |