00001
00002
00003
00004
00005
00006 #ifndef CSL_Gestalt_H
00007 #define CSL_Gestalt_H
00008
00009 #include "CSL_Types.h"
00010
00011 #include <stdarg.h>
00012
00013 namespace csl {
00014
00018 class CGestalt {
00019
00020 public:
00021 static unsigned frameRate();
00022 static void setFrameRate(unsigned frameRate);
00023
00024 static unsigned numInChannels();
00025 static void setNumInChannels(unsigned numChannels);
00026
00027 static unsigned numOutChannels();
00028 static void setNumOutChannels(unsigned numChannels);
00029
00030 static unsigned maxBufferFrames();
00031 static void setMaxBufferFrames(unsigned numFrames);
00032
00033 static unsigned blockSize();
00034 static void setBlockSize(unsigned blockSize);
00035
00036 static unsigned verbosity();
00037 static void setVerbosity(unsigned verbosity);
00038
00039 static unsigned loggingPeriod();
00040 static void setLoggingPeriod(unsigned loggingPeriod);
00041
00042 static unsigned outPort();
00043 static void setOutPort(unsigned outPort);
00044
00045 };
00046
00050
00051 #define SAFE_MALLOC(ptr, type, len) \
00052 (type *) ptr = (type *) malloc(len); \
00053 if ((char *) ptr == NULL) \
00054 throw MemoryError("can't allocate buffer");
00055
00056
00060
00061 #ifdef CSL_ENUMS
00062 typedef enum {
00063 kLogInfo,
00064 kLogWarning,
00065 kLogError,
00066 kLogFatal
00067 } LogLevel;
00068 #else
00069 #define kLogInfo 0
00070 #define kLogWarning 1
00071 #define kLogError 2
00072 #define kLogFatal 3
00073 typedef int LogLevel;
00074 #endif
00075
00079
00080 void logMsg(char * format, ...);
00081 void logMsg(LogLevel level, char* format, ...);
00082
00083
00084
00085 void vlogMsg(char * format, va_list args);
00086 void vlogMsg(LogLevel level, char * format, va_list args);
00087
00091
00092 void sleepUsec(float dur);
00093 void sleepMsec(float dur);
00094 void sleepSec(float dur);
00095
00096 float fRand(void);
00097
00098 }
00099
00100 #endif