00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef CSL_Types_H
00021 #define CSL_Types_H
00022
00023 #include <vector>
00024 #include <map>
00025 #include <string>
00026
00027
00028
00029
00030
00031 using namespace std;
00032
00033 namespace csl {
00034
00038 typedef float sample;
00039
00041 typedef vector<sample *> SampleBufferVector;
00042
00043 class Point;
00044
00045 typedef vector<Point> PointVector;
00046
00048 typedef void * VOIDFCNPTR(void* arg) ;
00049
00053 class UnitGenerator;
00054 class Port;
00055
00056 typedef unsigned CSL_MAP_KEY;
00057
00059 typedef map<CSL_MAP_KEY, Port *> PortMap;
00061 typedef vector<UnitGenerator *> UGenVector;
00063 typedef map<string, UnitGenerator *> UGenMap;
00064
00068 #define CSL_SCALE 1
00069 #define CSL_OFFSET 2
00070 #define CSL_INPUT 3
00071 #define CSL_OPERAND 4
00072
00073 #define CSL_FREQUENCY 6
00074 #define CSL_POSITION 7
00075
00081
00082 typedef unsigned long Timestamp;
00083
00087
00088 #define CSL_mFrameRate 44100
00089 #define CSL_mMaxBufferFrames 8192
00090 #define CSL_mBlockSize 1024
00091 #define CSL_mVerbosity 3
00092 #define CSL_mLoggingPeriod 15
00093 #define CSL_mOutPort 57123
00094
00098
00099 #ifdef Linux // Linux
00100 #define CSL_LINUX
00101 #endif
00102
00103 #ifdef WIN32 // M$_Windows
00104 #define CSL_WINDOWS
00105 #endif
00106
00107 #if defined (__APPLE__) && (__GNUC__) // Mac OSX
00108 #define CSL_MACOSX
00109 #endif
00110
00115
00116 class Observer;
00117
00123
00124 class Model {
00125 public:
00126 Model() : mHasObservers(false) { };
00127 ~Model() { };
00128
00129 void attachObserver(Observer *);
00130 void detachObserver(Observer *);
00131
00132 void changed(void * argument);
00133
00134 private:
00135 vector <Observer *> mObservers;
00136 bool mHasObservers;
00137 };
00138
00145
00146 class Observer {
00147 public:
00148 Observer() { };
00149 virtual ~Observer() { };
00150
00151 virtual void update(void * arg) = 0;
00152 };
00153
00157
00158 #ifndef csl_min // csl_min(a, b)
00159 #define csl_min(a,b) (((a) < (b)) ? (a) : (b))
00160 #endif
00161
00162 #ifndef csl_max // csl_max(a, b)
00163 #define csl_max(a,b) (((a) > (b)) ? (a) : (b))
00164 #endif
00165
00166 #ifndef TRUE // TRUE/FALSE
00167 #define TRUE 1
00168 #define FALSE 0
00169 #endif
00170
00174
00175 #define CSL_PI ((float) 3.1415926535897932)
00176 #define CSL_TWOPI ((float) 6.2831853071795865)
00177 #define CSL_PIHALF ((float) 1.570796326795)
00178 #define CSL_SQRT_TWO ((float) 1.414213562)
00179 #define CSL_SPEED_OF_SOUND 330.0
00180 #define CSL_EXP_PER_DB 0.11512925464970228
00181 #define CSL_SAMPS_PER_METER 133.63636363636364
00182 #define CSL_DEGS_PER_RAD 57.295779513082321
00183
00184 #define CSL_NAME_LEN 64 // default string length
00185
00189
00190 #ifdef CSL_WINDOWS // Microsoft is explicit
00191
00192 typedef signed __int64 INT64;
00193 typedef unsigned __int64 UINT64;
00194
00195 #else
00196
00197 typedef signed long long INT64;
00198 typedef unsigned long long UINT64;
00199
00200 #endif
00201
00202 #ifdef MSVS6 // ignore pragmas not understood by Microsoft Visual C++
00203 #pragma warning(once:4068 4244 4305 4355)
00204 #pragma warning(once:4290)
00205 #endif
00206
00207 }
00208
00209 #endif // _CSLTypes_H