CSL  6.0
CGestalt.h File Reference
#include "CSL_Types.h"
#include "CSL_Exceptions.h"
#include <stdarg.h>
#include <string>
#include <sys/time.h>

Go to the source code of this file.

Classes

class  csl::CGestalt
 The CSL system defaults class. More...
 
class  csl::Model
 The Model/Observable/Subject class; instances of its subclasses should send themselves, this->changed(some_data); on "relevant" state changes; the code they inherit (from Model) manages updating the list of observer/dependent objects in that they each receive update(some_data); and can access the model-passed data (the model might pass "this"). More...
 
class  csl::Observer
 CSL Observer/Dependent/Monitor class – instances receive update() messages from "models" and handle some argument, which may be the model's "this" pointer, or any other data. More...
 

Namespaces

 csl
 AdditiveInstrument.h – Sum-of-sines synthesis instrument class.
 

Macros

#define SAFE_MALLOC(ptr, type, len)
 Useful Macros. More...
 
#define SAFE_MATMALLOC(ptr, mtype, num, type, len)
 Matrix allocate SAFE_MATMALLOC(mRealSpectrum, FloatArray, mNumFrames, float, mWinSize); SAFE_MATMALLOC(mSpectBands, FloatArray, mNumFrames, float, NUM_BANDS) More...
 
#define SAFE_STRUCTMALLOC(ptr, mtype, num, type)
 Structure allocate SAFE_STRUCTMALLOC(mRealSpectrum, FloatArray, mNumFrames, float);. More...
 
#define SAFE_FREE(ptr)
 
#define SAFE_MATFREE(ptr, num)
 
#define C_TIME   juce::Time::getMillisecondCounter()
 Which kind of accurate timer to use? More...
 

Typedefs

typedef std::vector< Observer * > csl::ObserverVector
 Forward declaration. More...
 

Enumerations

enum  csl::LogLevel { csl::kLogInfo, csl::kLogWarning, csl::kLogError, csl::kLogFatal }
 Logging functions are standard C functions. More...
 

Functions

void csl::logMsg (const char *format,...)
 These are the public logging messages. More...
 
void csl::logMsg (LogLevel level, const char *format,...)
 
void csl::logMsgNN (const char *format,...)
 no-newline versions More...
 
void csl::logMsgNN (LogLevel level, const char *format,...)
 Log the file & line #. More...
 
void csl::logLine ()
 Log the file & line #. More...
 
void csl::logURL ()
 log file/line as a URL More...
 
void csl::vlogMsg (bool cz, LogLevel level, const char *format, va_list args)
 
bool csl::sleepUsec (float dur)
 Misc. global functions in the csl namespace. More...
 
bool csl::sleepMsec (float dur)
 
bool csl::sleepSec (float dur)
 
Timestamp csl::timeNow ()
 high-accuracy system or IO time in ticks More...
 
float csl::fTimeNow ()
 system or IO time in seconds More...
 
float csl::fRandZ (void)
 A variety of useful random-number functions. More...
 
float csl::fRand1 (void)
 -1 - 1 (one) More...
 
float csl::fRandV (float val)
 0 - v (val) More...
 
float csl::fRandM (float minV, float maxV)
 min - max (min/max) More...
 
float csl::fRandR (float base, float range)
 b +- (r * b) (range) More...
 
float csl::fRandB (float base, float range)
 b +- r (base) More...
 
int csl::iRandV (int val)
 Integer rands. More...
 
int csl::iRandM (int minV, int maxV)
 min - max (min/max) More...
 
int csl::iRandB (int base, int range)
 b +- r (base) More...
 
bool csl::coin ()
 Answer true or false. More...
 
bool csl::coin (float bias)
 Answer with a bias (1 –> always true) More...
 
float csl::keyToFreq (unsigned midiKey)
 MIDI Conversions. More...
 
unsigned csl::freqToKey (float frequency)
 freqToKey – converts from frequency in Hz to MIDI key # More...
 

Macro Definition Documentation

#define SAFE_MALLOC (   ptr,
  type,
  len 
)
Value:
ptr = new type[len]; \
if ((char *) ptr == NULL) \
throw MemoryError("can't allocate buffer")
static unsigned len
Definition: fft_N.c:39

Useful Macros.

SAFE_MALLOC = safe malloc using new operator used like: SAFE_MALLOC(mSampleBuffer, sample, mWindowSize);

Definition at line 103 of file CGestalt.h.

Referenced by csl::Buffer::allocateBuffers(), csl::BinauralPanner::BinauralPanner(), csl::BinauralSourceCache::BinauralSourceCache(), csl::Convolver2::checkBuffers(), csl::Convolver::checkBuffers(), csl::GrainCloud::GrainCloud(), csl::HRTF::HRTF(), csl::IFFT::IFFT(), load_filter_data(), and csl::LSoundFile::readBufferFromFile().

#define SAFE_MATMALLOC (   ptr,
  mtype,
  num,
  type,
  len 
)
Value:
ptr = new mtype[num]; \
if ((char *) ptr == NULL) \
throw MemoryError("can't allocate buffer"); \
for (unsigned i = 0; i < num; i++) { \
ptr[i] = new type[len]; \
if ((char *) ptr[i] == NULL) \
throw MemoryError("can't allocate buffer"); \
}
static unsigned len
Definition: fft_N.c:39

Matrix allocate SAFE_MATMALLOC(mRealSpectrum, FloatArray, mNumFrames, float, mWinSize); SAFE_MATMALLOC(mSpectBands, FloatArray, mNumFrames, float, NUM_BANDS)

Definition at line 112 of file CGestalt.h.

#define SAFE_STRUCTMALLOC (   ptr,
  mtype,
  num,
  type 
)
Value:
ptr = new mtype[num]; \
if ((char *) ptr == NULL) \
throw MemoryError("can't allocate buffer"); \
for (unsigned i = 0; i < num; i++) { \
ptr[i] = new type; \
if ((char *) ptr[i] == NULL) \
throw MemoryError("can't allocate buffer"); \
}

Structure allocate SAFE_STRUCTMALLOC(mRealSpectrum, FloatArray, mNumFrames, float);.

Definition at line 125 of file CGestalt.h.

#define SAFE_MATFREE (   ptr,
  num 
)
Value:
for (unsigned i = 0; i < num; i++) { \
if (ptr[i]) \
delete[] ptr[i]; \
} \
delete[] ptr

Definition at line 141 of file CGestalt.h.

#define C_TIME   juce::Time::getMillisecondCounter()

Which kind of accurate timer to use?

Definition at line 202 of file CGestalt.h.

Referenced by createGrains(), csl::GrainPlayer::nextBuffer(), and csl::GrainCloud::startThreads().