2 |
* * |
* * |
3 |
* LinuxSampler - modular, streaming capable sampler * |
* LinuxSampler - modular, streaming capable sampler * |
4 |
* * |
* * |
5 |
* Copyright (C) 2003 by Benno Senoner and Christian Schoenebeck * |
* Copyright (C) 2003, 2004 by Benno Senoner and Christian Schoenebeck * |
6 |
|
* Copyright (C) 2005, 2006 Christian Schoenebeck * |
7 |
* * |
* * |
8 |
* This program is free software; you can redistribute it and/or modify * |
* 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 * |
* it under the terms of the GNU General Public License as published by * |
23 |
|
|
24 |
// All application global declarations are defined here. |
// All application global declarations are defined here. |
25 |
|
|
26 |
#ifndef __GLOBAL_H__ |
#ifndef __LS_GLOBAL_H__ |
27 |
#define __GLOBAL_H__ |
#define __LS_GLOBAL_H__ |
|
|
|
|
//#define DEBUG_HEADERS 1 |
|
|
|
|
|
#if DEBUG_HEADERS |
|
|
# warning global.h included |
|
|
#endif // DEBUG_HEADERS |
|
28 |
|
|
29 |
#include <stdlib.h> |
#include <stdlib.h> |
30 |
#include <stdint.h> |
#include <stdint.h> |
31 |
#include <stdio.h> |
#include <stdio.h> |
32 |
|
|
33 |
#include <string> |
#include <string> |
34 |
|
#include <sstream> |
35 |
|
|
36 |
#ifdef HAVE_CONFIG_H |
// i.e. OSX people using the xcode project file will avoid inclusion of |
37 |
# include <config.h> |
// config.h here and rather use their manually maintained version.h |
38 |
|
#ifndef OVERRIDE_CONFIG_H |
39 |
|
# include <config.h> |
40 |
#endif |
#endif |
41 |
|
|
42 |
#define LS_DEBUG_LEVEL 2 ///< the higher this value the higher verbosity, 0 means no debug messages at all |
// Make sure all mandatory configuration macros are defined. |
43 |
|
// We don't care about optional configuration macros though. |
44 |
|
#ifndef CONFIG_MAX_PITCH |
45 |
|
# error "Configuration macro CONFIG_MAX_PITCH not defined!" |
46 |
|
#endif // CONFIG_MAX_PITCH |
47 |
|
#ifndef CONFIG_MAX_EVENTS_PER_FRAGMENT |
48 |
|
# error "Configuration macro CONFIG_MAX_EVENTS_PER_FRAGMENT not defined!" |
49 |
|
#endif // CONFIG_MAX_EVENTS_PER_FRAGMENT |
50 |
|
#ifndef CONFIG_EG_BOTTOM |
51 |
|
# error "Configuration macro CONFIG_EG_BOTTOM not defined!" |
52 |
|
#endif // CONFIG_EG_BOTTOM |
53 |
|
#ifndef CONFIG_EG_MIN_RELEASE_TIME |
54 |
|
# error "Configuration macro CONFIG_EG_MIN_RELEASE_TIME not defined!" |
55 |
|
#endif // CONFIG_EG_MIN_RELEASE_TIME |
56 |
|
#ifndef CONFIG_REFILL_STREAMS_PER_RUN |
57 |
|
# error "Configuration macro CONFIG_REFILL_STREAMS_PER_RUN not defined!" |
58 |
|
#endif // CONFIG_REFILL_STREAMS_PER_RUN |
59 |
|
#ifndef CONFIG_STREAM_MIN_REFILL_SIZE |
60 |
|
# error "Configuration macro CONFIG_STREAM_MIN_REFILL_SIZE not defined!" |
61 |
|
#endif // CONFIG_STREAM_MIN_REFILL_SIZE |
62 |
|
#ifndef CONFIG_STREAM_MAX_REFILL_SIZE |
63 |
|
# error "Configuration macro CONFIG_STREAM_MAX_REFILL_SIZE not defined!" |
64 |
|
#endif // CONFIG_STREAM_MAX_REFILL_SIZE |
65 |
|
#ifndef CONFIG_STREAM_BUFFER_SIZE |
66 |
|
# error "Configuration macro CONFIG_STREAM_BUFFER_SIZE not defined!" |
67 |
|
#endif // CONFIG_STREAM_BUFFER_SIZE |
68 |
|
#ifndef CONFIG_MAX_STREAMS |
69 |
|
# error "Configuration macro CONFIG_MAX_STREAMS not defined!" |
70 |
|
#endif // CONFIG_MAX_STREAMS |
71 |
|
#ifndef CONFIG_MAX_VOICES |
72 |
|
# error "Configuration macro CONFIG_MAX_VOICES not defined!" |
73 |
|
#endif // CONFIG_MAX_VOICES |
74 |
|
#ifndef CONFIG_DEFAULT_SUBFRAGMENT_SIZE |
75 |
|
# error "Configuration macro CONFIG_DEFAULT_SUBFRAGMENT_SIZE not defined!" |
76 |
|
#endif // CONFIG_DEFAULT_SUBFRAGMENT_SIZE |
77 |
|
#ifndef CONFIG_VOICE_STEAL_ALGO |
78 |
|
# error "Configuration macro CONFIG_VOICE_STEAL_ALGO not defined!" |
79 |
|
#endif // CONFIG_VOICE_STEAL_ALGO |
80 |
|
#ifndef CONFIG_SYSEX_BUFFER_SIZE |
81 |
|
# error "Configuration macro CONFIG_SYSEX_BUFFER_SIZE not defined!" |
82 |
|
#endif // CONFIG_SYSEX_BUFFER_SIZE |
83 |
|
#ifndef CONFIG_FILTER_CUTOFF_MIN |
84 |
|
# error "Configuration macro CONFIG_FILTER_CUTOFF_MIN not defined!" |
85 |
|
#endif // CONFIG_FILTER_CUTOFF_MIN |
86 |
|
#ifndef CONFIG_FILTER_CUTOFF_MAX |
87 |
|
# error "Configuration macro CONFIG_FILTER_CUTOFF_MAX not defined!" |
88 |
|
#endif // CONFIG_FILTER_CUTOFF_MAX |
89 |
|
#ifndef CONFIG_PORTAMENTO_TIME_MIN |
90 |
|
# error "Configuration macro CONFIG_PORTAMENTO_TIME_MIN not defined!" |
91 |
|
#endif // CONFIG_PORTAMENTO_TIME_MIN |
92 |
|
#ifndef CONFIG_PORTAMENTO_TIME_MAX |
93 |
|
# error "Configuration macro CONFIG_PORTAMENTO_TIME_MAX not defined!" |
94 |
|
#endif // CONFIG_PORTAMENTO_TIME_MAX |
95 |
|
#ifndef CONFIG_PORTAMENTO_TIME_DEFAULT |
96 |
|
# error "Configuration macro CONFIG_PORTAMENTO_TIME_DEFAULT not defined!" |
97 |
|
#endif // CONFIG_PORTAMENTO_TIME_DEFAULT |
98 |
|
|
99 |
#if LS_DEBUG_LEVEL > 0 |
#if CONFIG_DEBUG_LEVEL > 0 |
100 |
# define dmsg(debuglevel,x) if (LS_DEBUG_LEVEL >= debuglevel) {printf x; fflush(stdout);} |
# define dmsg(debuglevel,x) if (CONFIG_DEBUG_LEVEL >= debuglevel) {printf x; fflush(stdout);} |
101 |
#else |
#else |
102 |
# define dmsg(debuglevel,x) |
# define dmsg(debuglevel,x) |
103 |
#endif // LS_DEBUG |
#endif // CONFIG_DEBUG_LEVEL > 0 |
|
|
|
|
/// Defines the max. pitch value used in the application (in octaves) |
|
|
#define MAX_PITCH 4 |
|
104 |
|
|
105 |
/// Defines how many event objects the modulation system allocates |
#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") |
|
#define MAX_EVENTS_PER_FRAGMENT 1024 |
|
106 |
|
|
107 |
/// defines globally the bit depth of used samples |
/// defines globally the bit depth of used samples |
108 |
typedef int16_t sample_t; |
typedef int16_t sample_t; |
110 |
typedef std::string String; |
typedef std::string String; |
111 |
|
|
112 |
/** |
/** |
113 |
* Wether a function / method call was successful, or if warnings or even an |
* Whether a function / method call was successful, or if warnings or even an |
114 |
* error occured. |
* error occured. |
115 |
*/ |
*/ |
116 |
enum result_type_t { |
enum result_type_t { |
129 |
String message; ///< detailed warning or error message |
String message; ///< detailed warning or error message |
130 |
}; |
}; |
131 |
|
|
132 |
#endif // __GLOBAL_H__ |
template<class T> inline String ToString(T o) { |
133 |
|
std::stringstream ss; |
134 |
|
ss << o; |
135 |
|
return ss.str(); |
136 |
|
} |
137 |
|
|
138 |
|
class Runnable { |
139 |
|
public: |
140 |
|
virtual ~Runnable() { } |
141 |
|
virtual void Run() = 0; |
142 |
|
}; |
143 |
|
|
144 |
|
extern double GLOBAL_VOLUME; |
145 |
|
|
146 |
|
#endif // __LS_GLOBAL_H__ |