/[svn]/linuxsampler/trunk/src/common/global_private.h
ViewVC logotype

Annotation of /linuxsampler/trunk/src/common/global_private.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2600 - (hide annotations) (download) (as text)
Sat Jun 7 00:16:03 2014 UTC (9 years, 10 months ago) by schoenebeck
File MIME type: text/x-c++hdr
File size: 5228 byte(s)
* Implemented built-in instrument script function "set_controller()".
* Fixed built-in script functions "ignore_event()" and
  "ignore_controller()".
* Added extended instrument script VM for the Gigasampler/GigaStudio format
  sampler engine, which extends the general instrument script VM with Giga
  format specific variables and functions.
* Giga format instrument scripts: added built-in script int constant
  variables $GIG_DIM_CHANNEL, $GIG_DIM_LAYER, $GIG_DIM_VELOCITY,
  $GIG_DIM_AFTERTOUCH, $GIG_DIM_RELEASE, $GIG_DIM_KEYBOARD,
  $GIG_DIM_ROUNDROBIN, $GIG_DIM_RANDOM, $GIG_DIM_SMARTMIDI,
  $GIG_DIM_ROUNDROBINKEY, $GIG_DIM_MODWHEEL, $GIG_DIM_BREATH,
  $GIG_DIM_FOOT, $GIG_DIM_PORTAMENTOTIME, $GIG_DIM_EFFECT1,
  $GIG_DIM_EFFECT2, $GIG_DIM_GENPURPOSE1, $GIG_DIM_GENPURPOSE2,
  $GIG_DIM_GENPURPOSE3, $GIG_DIM_GENPURPOSE4, $GIG_DIM_SUSTAIN,
  $GIG_DIM_PORTAMENTO, $GIG_DIM_SOSTENUTO, $GIG_DIM_SOFT,
  $GIG_DIM_GENPURPOSE5, $GIG_DIM_GENPURPOSE6, $GIG_DIM_GENPURPOSE7,
  $GIG_DIM_GENPURPOSE8, $GIG_DIM_EFFECT1DEPTH, $GIG_DIM_EFFECT2DEPTH,
  $GIG_DIM_EFFECT3DEPTH, $GIG_DIM_EFFECT4DEPTH, $GIG_DIM_EFFECT5DEPTH.
* Giga format instrument scripts: Implemented built-in script function
  "gig_set_dim_zone(event_id, dimension, zone)", which allows to override
  dimension zone(s) for new voices.
* Bumped version (1.0.0.svn45).

1 schoenebeck 1424 /***************************************************************************
2     * *
3     * LinuxSampler - modular, streaming capable sampler *
4     * *
5     * Copyright (C) 2003, 2004 by Benno Senoner and Christian Schoenebeck *
6 schoenebeck 2473 * Copyright (C) 2005 - 2013 Christian Schoenebeck *
7 schoenebeck 1424 * *
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, that are not going to be exposed to
25     // the C++ API are defined here.
26    
27     #ifndef __LS_GLOBAL_PRIVATE_H__
28     #define __LS_GLOBAL_PRIVATE_H__
29    
30     #include "global.h"
31 iliev 1832 #include "Exception.h"
32 schoenebeck 1424 #include <sstream>
33    
34     #if HAVE_CONFIG_H
35     # include <config.h>
36     #endif
37    
38     #if CONFIG_DEBUG_LEVEL > 0
39     # define dmsg(debuglevel,x) if (CONFIG_DEBUG_LEVEL >= debuglevel) {printf x; fflush(stdout);}
40     #else
41     # define dmsg(debuglevel,x)
42     #endif // CONFIG_DEBUG_LEVEL > 0
43    
44     #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")
45    
46     /// defines globally the bit depth of used samples
47     typedef int16_t sample_t;
48    
49 senoner 1913 // 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 schoenebeck 1930
52 senoner 1913 // 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 schoenebeck 1930
55     #if HAVE_GCC_VECTOR_EXTENSIONS
56 senoner 1913 // 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 schoenebeck 1930 #endif
59 senoner 1913
60 schoenebeck 2600 // circumvents a bug in GCC 4.x which causes a sizeof() expression applied
61     // on a class member to throw a compiler error, i.e. with GCC 4.4:
62     // "object missing in reference to 'LinuxSampler::AbstractEngineChannel::ControllerTable'")
63     // or with GCC 4.0:
64     // "invalid use of non-static data member 'LinuxSampler::AbstractEngineChannel::ControllerTable'"
65     #define _MEMBER_SIZEOF(T_Class, Member) sizeof(((T_Class*)NULL)->Member)
66    
67 schoenebeck 1424 /**
68     * Whether a function / method call was successful, or if warnings or even an
69     * error occured.
70     */
71     enum result_type_t {
72     result_type_success,
73     result_type_warning,
74     result_type_error
75     };
76    
77     /**
78     * Used whenever a detailed description of the result of a function / method
79     * call is needed.
80     */
81     struct result_t {
82     result_type_t type; ///< success, warning or error
83     int code; ///< warning or error code
84     String message; ///< detailed warning or error message
85     };
86    
87     template<class T> inline String ToString(T o) {
88     std::stringstream ss;
89     ss << o;
90     return ss.str();
91     }
92    
93 iliev 1832 inline int ToInt(const std::string& s) throw(LinuxSampler::Exception) {
94     int i;
95     std::istringstream iss(s);
96     if(!(iss >> i)) throw LinuxSampler::Exception("Not an integer");
97     return i;
98     }
99    
100 iliev 2012 inline float ToFloat(const std::string& s) throw(LinuxSampler::Exception) {
101     float i;
102     std::istringstream iss(s);
103     if(!(iss >> i)) throw LinuxSampler::Exception("Not a floating-point number");
104     return i;
105     }
106    
107 schoenebeck 1424 class Runnable {
108     public:
109     virtual ~Runnable() { }
110     virtual void Run() = 0;
111     };
112    
113     extern double GLOBAL_VOLUME;
114 schoenebeck 1800 extern int GLOBAL_MAX_VOICES;
115     extern int GLOBAL_MAX_STREAMS;
116 schoenebeck 1424
117 schoenebeck 2473 //TODO: (hopefully) just a temporary nasty hack for launching gigedit on the main thread on Mac (see comments in gigedit.cpp for details)
118     #if defined(__APPLE__)
119     extern bool g_mainThreadCallbackSupported;
120     extern void (*g_mainThreadCallback)(void* info);
121     extern void* g_mainThreadCallbackInfo;
122     extern bool g_fireMainThreadCallback;
123     #endif
124    
125 schoenebeck 1424 // I read with some Linux kernel versions (between 2.4.18 and 2.4.21)
126     // sscanf() might be buggy regarding parsing of hex characters, so ...
127     int hexToNumber(char hex_digit);
128     int hexsToNumber(char hex_digit0, char hex_digit1 = '0');
129    
130     #endif // __LS_GLOBAL_PRIVATE_H__

  ViewVC Help
Powered by ViewVC