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

Diff of /linuxsampler/trunk/src/common/global.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1399 by schoenebeck, Thu Oct 11 18:53:29 2007 UTC revision 1792 by persson, Sun Nov 16 19:19:26 2008 UTC
# Line 21  Line 21 
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 __LS_GLOBAL_H__  #ifndef __LS_GLOBAL_H__
28  #define __LS_GLOBAL_H__  #define __LS_GLOBAL_H__
# Line 31  Line 32 
32  #include <stdio.h>  #include <stdio.h>
33    
34  #include <string>  #include <string>
 #include <sstream>  
35    
36  #if HAVE_CONFIG_H  typedef std::string String;
 # include <config.h>  
 #endif  
37    
38  #if CONFIG_DEBUG_LEVEL > 0  #if defined(WIN32)
39  #  define dmsg(debuglevel,x)    if (CONFIG_DEBUG_LEVEL >= debuglevel) {printf x; fflush(stdout);}  #include <windows.h>
40    #define usleep(a) Sleep(a/1000)
41    #define sleep(a) Sleep(a*1000)
42    typedef unsigned int uint;
43    // FIXME: define proper functions which do proper alignement under Win32
44    #define alignedMalloc(a,b) malloc(b)
45    #define alignedFree(a) free(a)
46  #else  #else
47  #  define dmsg(debuglevel,x)  // needed for usleep under POSIX
48  #endif // CONFIG_DEBUG_LEVEL > 0  #include <stdio.h>
49    // for uint
50  #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")  #include <sys/types.h>
51    #endif
 /// defines globally the bit depth of used samples  
 typedef int16_t sample_t;  
   
 typedef std::string String;  
52    
 /**  
  * Whether a function / method call was successful, or if warnings or even an  
  * error occured.  
  */  
 enum result_type_t {  
     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  
 };  
   
 template<class T> inline String ToString(T o) {  
         std::stringstream ss;  
         ss << o;  
         return ss.str();  
 }  
   
 class Runnable {  
     public:  
         virtual ~Runnable() { }  
         virtual void Run() = 0;  
 };  
   
 extern double GLOBAL_VOLUME;  
   
 // I read with some Linux kernel versions (between 2.4.18 and 2.4.21)  
 // sscanf() might be buggy regarding parsing of hex characters, so ...  
 int hexToNumber(char hex_digit);  
 int hexsToNumber(char hex_digit0, char hex_digit1 = '0');  
53    
54  #endif // __LS_GLOBAL_H__  #endif // __LS_GLOBAL_H__

Legend:
Removed from v.1399  
changed lines
  Added in v.1792

  ViewVC Help
Powered by ViewVC