3 |
* LinuxSampler - modular, streaming capable sampler * |
* LinuxSampler - modular, streaming capable sampler * |
4 |
* * |
* * |
5 |
* Copyright (C) 2003, 2004 by Benno Senoner and Christian Schoenebeck * |
* Copyright (C) 2003, 2004 by Benno Senoner and Christian Schoenebeck * |
6 |
* Copyright (C) 2005 - 2008 Christian Schoenebeck * |
* Copyright (C) 2005 - 2009 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 * |
28 |
#define __LS_GLOBAL_PRIVATE_H__ |
#define __LS_GLOBAL_PRIVATE_H__ |
29 |
|
|
30 |
#include "global.h" |
#include "global.h" |
31 |
|
#include "Exception.h" |
32 |
#include <sstream> |
#include <sstream> |
33 |
|
|
34 |
#if HAVE_CONFIG_H |
#if HAVE_CONFIG_H |
46 |
/// defines globally the bit depth of used samples |
/// defines globally the bit depth of used samples |
47 |
typedef int16_t sample_t; |
typedef int16_t sample_t; |
48 |
|
|
49 |
|
// macro to check for a certain version (or newer) of GCC |
50 |
|
#define GNUC_VERSION_PREREQ(major,minor) (__GNUC__ > (major) || (__GNUC__ == (major) && __GNUC_MINOR__ >= (minor))) |
51 |
|
|
52 |
|
// macro which checks if GCC vector extensions are avialable |
53 |
|
#define HAVE_GCC_VECTOR_EXTENSIONS ( GNUC_VERSION_PREREQ(3,3) && ( defined(__i386__) || defined(__x86_64__) || defined(_ARCH_PPC) ) ) |
54 |
|
|
55 |
|
#if HAVE_GCC_VECTOR_EXTENSIONS |
56 |
|
// v4sf is used by some routines that make use of GCC vector extensions (ie AudioChannel.cpp) |
57 |
|
typedef float v4sf __attribute__ ((vector_size(16))); |
58 |
|
#endif |
59 |
|
|
60 |
/** |
/** |
61 |
* Whether 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 |
62 |
* error occured. |
* error occured. |
83 |
return ss.str(); |
return ss.str(); |
84 |
} |
} |
85 |
|
|
86 |
|
inline int ToInt(const std::string& s) throw(LinuxSampler::Exception) { |
87 |
|
int i; |
88 |
|
std::istringstream iss(s); |
89 |
|
if(!(iss >> i)) throw LinuxSampler::Exception("Not an integer"); |
90 |
|
return i; |
91 |
|
} |
92 |
|
|
93 |
|
inline float ToFloat(const std::string& s) throw(LinuxSampler::Exception) { |
94 |
|
float i; |
95 |
|
std::istringstream iss(s); |
96 |
|
if(!(iss >> i)) throw LinuxSampler::Exception("Not a floating-point number"); |
97 |
|
return i; |
98 |
|
} |
99 |
|
|
100 |
class Runnable { |
class Runnable { |
101 |
public: |
public: |
102 |
virtual ~Runnable() { } |
virtual ~Runnable() { } |