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 - 2010 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 * |
21 |
* MA 02111-1307 USA * |
* MA 02111-1307 USA * |
22 |
***************************************************************************/ |
***************************************************************************/ |
23 |
|
|
24 |
// All application global declarations are defined here. |
// All application global declarations that HAVE to be exposed to the C++ |
25 |
|
// API are defined here. |
26 |
|
|
27 |
#ifndef __GLOBAL_H__ |
#ifndef __LS_GLOBAL_H__ |
28 |
#define __GLOBAL_H__ |
#define __LS_GLOBAL_H__ |
|
|
|
|
//#define DEBUG_HEADERS 1 |
|
|
|
|
|
#if DEBUG_HEADERS |
|
|
# warning global.h included |
|
|
#endif // DEBUG_HEADERS |
|
29 |
|
|
30 |
#include <stdlib.h> |
#include <stdlib.h> |
31 |
#include <stdint.h> |
#include <stdint.h> |
33 |
|
|
34 |
#include <string> |
#include <string> |
35 |
|
|
36 |
#ifdef HAVE_CONFIG_H |
typedef std::string String; |
|
# include <config.h> |
|
|
#endif |
|
|
|
|
|
#define LS_DEBUG_LEVEL 2 ///< the higher this value the higher verbosity, 0 means no debug messages at all |
|
|
|
|
|
#if LS_DEBUG_LEVEL > 0 |
|
|
# define dmsg(debuglevel,x) if (LS_DEBUG_LEVEL >= debuglevel) {printf x; fflush(stdout);} |
|
|
#else |
|
|
# define dmsg(debuglevel,x) |
|
|
#endif // LS_DEBUG |
|
|
|
|
|
/// Defines the max. pitch value used in the application (in octaves) |
|
|
#define MAX_PITCH 4 |
|
37 |
|
|
38 |
/// Defines how many event objects the modulation system allocates |
#if defined(WIN32) |
39 |
#define MAX_EVENTS_PER_FRAGMENT 1024 |
#include <windows.h> |
40 |
|
|
41 |
/// defines globally the bit depth of used samples |
// modern MinGW has usleep |
42 |
typedef int16_t sample_t; |
#if (__MINGW32_MAJOR_VERSION < 3 || \ |
43 |
|
(__MINGW32_MAJOR_VERSION == 3 && __MINGW32_MINOR_VERSION < 15)) && \ |
44 |
|
!defined(__MINGW64) && !defined(__MINGW64_VERSION_MAJOR) |
45 |
|
#define usleep(a) Sleep(a/1000) |
46 |
|
#endif |
47 |
|
|
48 |
typedef std::string String; |
#define sleep(a) Sleep(a*1000) |
49 |
|
typedef unsigned int uint; |
50 |
|
// FIXME: define proper functions which do proper alignement under Win32 |
51 |
|
#define alignedMalloc(a,b) malloc(b) |
52 |
|
#define alignedFree(a) free(a) |
53 |
|
#else |
54 |
|
// needed for usleep under POSIX |
55 |
|
#include <stdio.h> |
56 |
|
// for uint |
57 |
|
#include <sys/types.h> |
58 |
|
#endif |
59 |
|
|
60 |
/** |
#ifdef __GNUC__ |
61 |
* Wether a function / method call was successful, or if warnings or even an |
#define DEPRECATED_API __attribute__ ((deprecated)) |
62 |
* error occured. |
#else |
63 |
*/ |
#define DEPRECATED_API |
64 |
enum result_type_t { |
#endif |
|
result_type_success, |
|
|
result_type_warning, |
|
|
result_type_error |
|
|
}; |
|
|
|
|
|
/** |
|
|
* Used whenever a detailed description of the result of a function / method |
|
|
* call is needed. |
|
|
*/ |
|
|
struct result_t { |
|
|
result_type_t type; ///< success, warning or error |
|
|
int code; ///< warning or error code |
|
|
String message; ///< detailed warning or error message |
|
|
}; |
|
65 |
|
|
66 |
#endif // __GLOBAL_H__ |
#endif // __LS_GLOBAL_H__ |