1 |
schoenebeck |
53 |
/*************************************************************************** |
2 |
|
|
* * |
3 |
|
|
* LinuxSampler - modular, streaming capable sampler * |
4 |
|
|
* * |
5 |
schoenebeck |
56 |
* Copyright (C) 2003, 2004 by Benno Senoner and Christian Schoenebeck * |
6 |
schoenebeck |
1212 |
* Copyright (C) 2005 - 2007 Christian Schoenebeck * |
7 |
schoenebeck |
53 |
* * |
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 |
|
|
// All application global declarations are defined here. |
25 |
|
|
|
26 |
schoenebeck |
881 |
#ifndef __LS_GLOBAL_H__ |
27 |
|
|
#define __LS_GLOBAL_H__ |
28 |
schoenebeck |
53 |
|
29 |
|
|
#include <stdlib.h> |
30 |
|
|
#include <stdint.h> |
31 |
|
|
#include <stdio.h> |
32 |
|
|
|
33 |
|
|
#include <string> |
34 |
senkov |
170 |
#include <sstream> |
35 |
schoenebeck |
53 |
|
36 |
schoenebeck |
1212 |
#if HAVE_CONFIG_H |
37 |
schoenebeck |
554 |
# include <config.h> |
38 |
schoenebeck |
53 |
#endif |
39 |
|
|
|
40 |
schoenebeck |
554 |
#if CONFIG_DEBUG_LEVEL > 0 |
41 |
|
|
# define dmsg(debuglevel,x) if (CONFIG_DEBUG_LEVEL >= debuglevel) {printf x; fflush(stdout);} |
42 |
schoenebeck |
53 |
#else |
43 |
|
|
# define dmsg(debuglevel,x) |
44 |
schoenebeck |
554 |
#endif // CONFIG_DEBUG_LEVEL > 0 |
45 |
schoenebeck |
53 |
|
46 |
schoenebeck |
319 |
#define EMMS __asm__ __volatile__ ("emms" ::: "st", "st(1)", "st(2)", "st(3)", "st(4)", "st(5)", "st(6)", "st(7)", "mm0", "mm1", "mm2", "mm3", "mm4", "mm5", "mm6", "mm7") |
47 |
|
|
|
48 |
schoenebeck |
53 |
/// defines globally the bit depth of used samples |
49 |
|
|
typedef int16_t sample_t; |
50 |
|
|
|
51 |
|
|
typedef std::string String; |
52 |
|
|
|
53 |
|
|
/** |
54 |
iliev |
724 |
* Whether a function / method call was successful, or if warnings or even an |
55 |
schoenebeck |
53 |
* error occured. |
56 |
|
|
*/ |
57 |
|
|
enum result_type_t { |
58 |
|
|
result_type_success, |
59 |
|
|
result_type_warning, |
60 |
|
|
result_type_error |
61 |
|
|
}; |
62 |
|
|
|
63 |
|
|
/** |
64 |
|
|
* Used whenever a detailed description of the result of a function / method |
65 |
|
|
* call is needed. |
66 |
|
|
*/ |
67 |
|
|
struct result_t { |
68 |
|
|
result_type_t type; ///< success, warning or error |
69 |
|
|
int code; ///< warning or error code |
70 |
|
|
String message; ///< detailed warning or error message |
71 |
|
|
}; |
72 |
|
|
|
73 |
senkov |
170 |
template<class T> inline String ToString(T o) { |
74 |
|
|
std::stringstream ss; |
75 |
|
|
ss << o; |
76 |
|
|
return ss.str(); |
77 |
|
|
} |
78 |
|
|
|
79 |
iliev |
1200 |
class Runnable { |
80 |
|
|
public: |
81 |
|
|
virtual ~Runnable() { } |
82 |
|
|
virtual void Run() = 0; |
83 |
|
|
}; |
84 |
|
|
|
85 |
schoenebeck |
1005 |
extern double GLOBAL_VOLUME; |
86 |
|
|
|
87 |
schoenebeck |
1399 |
// I read with some Linux kernel versions (between 2.4.18 and 2.4.21) |
88 |
|
|
// sscanf() might be buggy regarding parsing of hex characters, so ... |
89 |
|
|
int hexToNumber(char hex_digit); |
90 |
|
|
int hexsToNumber(char hex_digit0, char hex_digit1 = '0'); |
91 |
|
|
|
92 |
schoenebeck |
881 |
#endif // __LS_GLOBAL_H__ |