CSL  5.2
CGestalt.h File Reference
#include "CSL_Types.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

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

Macros

#define SAFE_MALLOC(ptr, type, len)
 Useful Macros.
#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)
#define SAFE_STRUCTMALLOC(ptr, mtype, num, type)
 Structure allocate SAFE_STRUCTMALLOC(mRealSpectrum, FloatArray, mNumFrames, float);.
#define SAFE_FREE(ptr)
#define SAFE_MATFREE(ptr, num)
#define C_TIME   juce::Time::getMillisecondCounter()
 Which kind of accurate timer to use?

Typedefs

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

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

Macro Definition Documentation

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

Useful Macros.

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

Definition at line 93 of file CGestalt.h.

Referenced by csl::Buffer::allocateBuffers(), csl::BinauralPanner::BinauralPanner(), csl::BinauralSourceCache::BinauralSourceCache(), csl::GrainCloud::GrainCloud(), csl::HRTF::HRTF(), csl::IFFT::IFFT(), 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"); \
}

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

Definition at line 102 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 115 of file CGestalt.h.

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

Definition at line 131 of file CGestalt.h.

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

Which kind of accurate timer to use?

Definition at line 191 of file CGestalt.h.

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