CGestalt.cpp File Reference

#include "CGestalt.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <sys/time.h>
#include <unistd.h>

Defines

#define cheapPrintf(val)
#define UNDEFINED_IN_CRAM
#define SWALLOW_CR()
#define TIMER_INTERVAL   0.25f

Functions

string initFileName ()
void csl::vlogMsg (char *format, va_list args)
void csl::logMsg (char *format,...)
void csl::vlogMsg (LogLevel level, char *format, va_list args)
void csl::logMsg (LogLevel level, char *format,...)
 Log the file & line #.
void csl::logLine ()
 Log the file & line #.
void csl::logURL ()
 log file/line as a URL
bool csl::sleepUsec (float dur_in_usec)
 sleep for dur usec, msec or sec
bool csl::sleepMsec (float dur_in_msec)
bool csl::sleepSec (float dur_in_sec)
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 0 - 1 (name: zero).
float csl::fRand1 (void)
 -1 - 1 (one)
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)
float csl::fRandV (float val)
 0 - v (val)
int csl::iRandV (int val)
 Integer rands 0 - v (val).
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)
 keyToFreq -- converts from MIDI key numbers (1 - 127) to frequency in Hz.
unsigned csl::freqToKey (float frequency)
 freqToKey -- converts from frequency in Hz to MIDI key #

Variables

static unsigned mNumInChannels = 0
 no inputs by default
static unsigned mNumOutChannels = 2
 stereo outputs
static unsigned mFrameRate = CSL_mFrameRate
 default sample rate (tested up to 96000)
static csl::sample mFramePeriod = 1.0f / (float) CSL_mFrameRate
 1 / default sample rate
static unsigned mBlockSize = CSL_mBlockSize
 typical block size (can be as small as 128 in real usage)
static unsigned mMaxBufferFrames = CSL_mMaxBufferFrames
 max block size (set large for zooming scopes)
static unsigned mMaxSndFileFrames = CSL_mMaxSndFileFrames
 max block size (set large for zooming scopes)
static unsigned mVerbosity = CSL_mVerbosity
 very verbose
static unsigned mLoggingPeriod = CSL_mLoggingPeriod
 log CPU every 15 sec
static unsigned mOutPort = CSL_mOutPort
 RFS output port.
static std::string mDataFolder = CSL_DATA_DIR
 User's CSL data folder ().
static bool mStopNow
 flag to stop threads and timers


Define Documentation

#define cheapPrintf val   ) 
 

Value:

if (val < 10)                       \
        *xpos = '0';                    \
    else                                \
        *xpos = '0' + (val / 10);       \
    *(xpos+1) = '0' + (val % 10)

#define UNDEFINED_IN_CRAM
 

 
#define SWALLOW_CR  ) 
 

Logging code: if verbosity

#define TIMER_INTERVAL   0.25f
 

Global Sleep functions that work for windows and mac/unix. Note the use of the global flag gStopNow, which interrupts timers.


Function Documentation

string initFileName  ) 
 

read/write the init file (typ. ~/.cslrc) The reader takes a char key, as in string initMsg(CGestalt::initFileText('T')); which looks for a line starting with "T " in the file and returns the part after the "T " The write function takes a key and a string to store.


Variable Documentation

unsigned mNumInChannels = 0 [static]
 

no inputs by default

These are the system default values //////

The actual start-up values are defined in CSL_Types.h

unsigned mNumOutChannels = 2 [static]
 

stereo outputs

unsigned mFrameRate = CSL_mFrameRate [static]
 

default sample rate (tested up to 96000)

csl::sample mFramePeriod = 1.0f / (float) CSL_mFrameRate [static]
 

1 / default sample rate

unsigned mBlockSize = CSL_mBlockSize [static]
 

typical block size (can be as small as 128 in real usage)

unsigned mMaxBufferFrames = CSL_mMaxBufferFrames [static]
 

max block size (set large for zooming scopes)

unsigned mMaxSndFileFrames = CSL_mMaxSndFileFrames [static]
 

max block size (set large for zooming scopes)

unsigned mVerbosity = CSL_mVerbosity [static]
 

very verbose

unsigned mLoggingPeriod = CSL_mLoggingPeriod [static]
 

log CPU every 15 sec

unsigned mOutPort = CSL_mOutPort [static]
 

RFS output port.

std::string mDataFolder = CSL_DATA_DIR [static]
 

User's CSL data folder ().

bool mStopNow [static]
 

flag to stop threads and timers


Generated on Sat Oct 17 14:12:33 2009 for CSL by  doxygen 1.4.5-20051010