23 #include "../JuceLibraryCode/JuceHeader.h"
39 static unsigned frameRate();
40 static void setFrameRate(
unsigned frameRate);
41 static sample framePeriod();
43 static unsigned numInChannels();
44 static void setNumInChannels(
unsigned numChannels);
46 static unsigned numOutChannels();
47 static void setNumOutChannels(
unsigned numChannels);
49 static unsigned blockSize();
50 static void setBlockSize(
unsigned blockSize);
52 static unsigned maxBufferFrames();
53 static void setMaxBufferFrames(
unsigned numFrames);
55 static unsigned maxSndFileFrames();
56 static void setMaxSndFileFrames(
unsigned numFrames);
58 static unsigned sndFileFrames();
59 static void setSndFileFrames(
unsigned numFrames);
61 static unsigned verbosity();
62 static void setVerbosity(
unsigned verbosity);
65 static unsigned loggingPeriod();
66 static void setLoggingPeriod(
unsigned loggingPeriod);
68 static unsigned outPort();
69 static void setOutPort(
unsigned outPort);
71 static std::string dataFolder();
72 static void setDataFolder(std::string dFolder);
74 static bool stopNow();
75 static void setStopNow();
76 static void clearStopNow();
78 static std::string initFileText(
char key);
79 static void storeToInitFile(
char key, std::string
data);
81 static std::string sndFileName();
93 #define SAFE_MALLOC(ptr, type, len) \
94 ptr = new type[len]; \
95 if ((char *) ptr == NULL) \
96 throw MemoryError("can't allocate buffer")
102 #define SAFE_MATMALLOC(ptr, mtype, num, type, len) \
103 ptr = new mtype[num]; \
104 if ((char *) ptr == NULL) \
105 throw MemoryError("can't allocate buffer"); \
106 for (unsigned i = 0; i < num; i++) { \
107 ptr[i] = new type[len]; \
108 if ((char *) ptr[i] == NULL) \
109 throw MemoryError("can't allocate buffer"); \
115 #define SAFE_STRUCTMALLOC(ptr, mtype, num, type) \
116 ptr = new mtype[num]; \
117 if ((char *) ptr == NULL) \
118 throw MemoryError("can't allocate buffer"); \
119 for (unsigned i = 0; i < num; i++) { \
121 if ((char *) ptr[i] == NULL) \
122 throw MemoryError("can't allocate buffer"); \
127 #define SAFE_FREE(ptr) \
131 #define SAFE_MATFREE(ptr, num) \
132 for (unsigned i = 0; i < num; i++) { \
152 #define kLogWarning 1
162 void logMsg(
const char * format, ...);
170 void vlogMsg(
const char * format, va_list args);
191 #define C_TIME juce::Time::getMillisecondCounter()
201 float fRandM(
float minV,
float maxV);
202 float fRandR(
float base,
float range);
203 float fRandB(
float base,
float range);
208 int iRandM(
int minV,
int maxV);
209 int iRandB(
int base,
int range);
214 bool coin(
float bias);
249 Model() : mHasObservers(
false), mHasObserverMap(
false), mUpdateTime(0), mPeriod(0) { };
255 void changed(
void * argument);
259 virtual int evaluate(
void * argument) {
return 0; };
291 virtual void update(
void * arg) = 0;