/[svn]/linuxsampler/trunk/src/common/global_private.cpp
ViewVC logotype

Contents of /linuxsampler/trunk/src/common/global_private.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2473 - (show annotations) (download)
Sun Sep 15 17:55:56 2013 UTC (10 years, 7 months ago) by schoenebeck
File size: 6371 byte(s)
* Mac OS X: added temporary hack allowing to spawn gigedit as callback
  on the process's main thread.
* Bumped version to 1.0.0.svn23.

1 /***************************************************************************
2 * *
3 * LinuxSampler - modular, streaming capable sampler *
4 * *
5 * Copyright (C) 2003, 2004 by Benno Senoner and Christian Schoenebeck *
6 * Copyright (C) 2005 - 2013 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_DEFAULT_MAX_STREAMS
61 # error "Configuration macro CONFIG_DEFAULT_MAX_STREAMS not defined!"
62 #endif // CONFIG_DEFAULT_MAX_STREAMS
63 #ifndef CONFIG_DEFAULT_MAX_VOICES
64 # error "Configuration macro CONFIG_DEFAULT_MAX_VOICES not defined!"
65 #endif // CONFIG_DEFAULT_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 // this is the sampler global setting for maximum voices
96 int GLOBAL_MAX_VOICES = CONFIG_DEFAULT_MAX_VOICES;
97
98 // this is the sampler global setting for maximum disk streams
99 int GLOBAL_MAX_STREAMS = CONFIG_DEFAULT_MAX_STREAMS;
100
101 //TODO: (hopefully) just a temporary nasty hack for launching gigedit on the main thread on Mac (see comments in gigedit.cpp for details)
102 #if defined(__APPLE__)
103 bool g_mainThreadCallbackSupported = false;
104 void (*g_mainThreadCallback)(void* info) = 0;
105 void* g_mainThreadCallbackInfo = 0;
106 bool g_fireMainThreadCallback = false;
107 #endif
108
109 int hexToNumber(char hex_digit) {
110 switch (hex_digit) {
111 case '0': return 0;
112 case '1': return 1;
113 case '2': return 2;
114 case '3': return 3;
115 case '4': return 4;
116 case '5': return 5;
117 case '6': return 6;
118 case '7': return 7;
119 case '8': return 8;
120 case '9': return 9;
121
122 case 'a': return 10;
123 case 'b': return 11;
124 case 'c': return 12;
125 case 'd': return 13;
126 case 'e': return 14;
127 case 'f': return 15;
128
129 case 'A': return 10;
130 case 'B': return 11;
131 case 'C': return 12;
132 case 'D': return 13;
133 case 'E': return 14;
134 case 'F': return 15;
135
136 default: return 0; //TODO: we might want to throw an exception here
137 }
138 }
139
140 int hexsToNumber(char hex_digit0, char hex_digit1) {
141 return hexToNumber(hex_digit1)*16 + hexToNumber(hex_digit0);
142 }

  ViewVC Help
Powered by ViewVC