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 |
3707 |
* Copyright (C) 2005 - 2020 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 |
schoenebeck |
1424 |
// All application global declarations that HAVE to be exposed to the C++ |
25 |
|
|
// API are defined here. |
26 |
schoenebeck |
53 |
|
27 |
schoenebeck |
881 |
#ifndef __LS_GLOBAL_H__ |
28 |
|
|
#define __LS_GLOBAL_H__ |
29 |
schoenebeck |
53 |
|
30 |
schoenebeck |
3713 |
// workaround for a bug with older versions of mingw, which would prevent |
31 |
|
|
// portable format specifiers like PRId64 from being defined |
32 |
|
|
#ifdef __MINGW32__ |
33 |
|
|
# define __STDC_FORMAT_MACROS 1 |
34 |
|
|
#endif |
35 |
|
|
|
36 |
|
|
// C++ header <string> before any C headers intentionally here, due to |
37 |
|
|
// format specifiers bug occurring with older versions of mingw (see above) |
38 |
|
|
#include <string> |
39 |
schoenebeck |
53 |
#include <stdlib.h> |
40 |
|
|
#include <stdint.h> |
41 |
|
|
#include <stdio.h> |
42 |
schoenebeck |
3707 |
#include <inttypes.h> |
43 |
schoenebeck |
53 |
|
44 |
|
|
typedef std::string String; |
45 |
|
|
|
46 |
senoner |
1531 |
#if defined(WIN32) |
47 |
|
|
#include <windows.h> |
48 |
persson |
1808 |
|
49 |
|
|
// modern MinGW has usleep |
50 |
persson |
1931 |
#if (__MINGW32_MAJOR_VERSION < 3 || \ |
51 |
|
|
(__MINGW32_MAJOR_VERSION == 3 && __MINGW32_MINOR_VERSION < 15)) && \ |
52 |
persson |
2086 |
!defined(__MINGW64) && !defined(__MINGW64_VERSION_MAJOR) |
53 |
senoner |
1531 |
#define usleep(a) Sleep(a/1000) |
54 |
persson |
1808 |
#endif |
55 |
|
|
|
56 |
senoner |
1531 |
#define sleep(a) Sleep(a*1000) |
57 |
|
|
typedef unsigned int uint; |
58 |
|
|
// FIXME: define proper functions which do proper alignement under Win32 |
59 |
|
|
#define alignedMalloc(a,b) malloc(b) |
60 |
|
|
#define alignedFree(a) free(a) |
61 |
|
|
#else |
62 |
|
|
// needed for usleep under POSIX |
63 |
|
|
#include <stdio.h> |
64 |
persson |
1792 |
// for uint |
65 |
|
|
#include <sys/types.h> |
66 |
senoner |
1531 |
#endif |
67 |
|
|
|
68 |
schoenebeck |
2137 |
#ifdef __GNUC__ |
69 |
|
|
#define DEPRECATED_API __attribute__ ((deprecated)) |
70 |
|
|
#else |
71 |
|
|
#define DEPRECATED_API |
72 |
|
|
#endif |
73 |
senoner |
1531 |
|
74 |
schoenebeck |
2434 |
// whether compiler is C++11 standard compliant |
75 |
|
|
#if defined(__cplusplus) && __cplusplus >= 201103L |
76 |
persson |
2460 |
# define IS_CPP11 1 |
77 |
schoenebeck |
2434 |
#endif |
78 |
|
|
|
79 |
|
|
// C++ "override" keyword introduced with C++11 standard |
80 |
|
|
#if IS_CPP11 |
81 |
|
|
# define OVERRIDE override |
82 |
schoenebeck |
3574 |
# define FINAL final |
83 |
schoenebeck |
2434 |
#else |
84 |
|
|
# define OVERRIDE |
85 |
schoenebeck |
3574 |
# define FINAL |
86 |
schoenebeck |
2434 |
#endif |
87 |
|
|
|
88 |
schoenebeck |
881 |
#endif // __LS_GLOBAL_H__ |