CSL  5.2
CSL_Types.h File Reference
#include <vector>
#include <string>
#include <map>

Go to the source code of this file.

Classes

struct  csl::testStruct

Namespaces

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

Macros

#define CSL_Types_H
 CSL_Types.h – the top-most include file for CSL 5.0 (September, 2009).
#define CSL_ENUMS
#define CSL_mFrameRate   44100
 default sample rate (tested up to 96000)
#define CSL_mBlockSize   2048
 normal hosts
#define CSL_mMaxBufferFrames   8192
 max block size (set large for zooming scopes)
#define CSL_mSndFileFrames   20480000
 default file cache size = 20 MFrames (~ 2 min)
#define CSL_mMaxSndFileFrames   64000000
 max file cache size = 64 MB (set to a large value)
#define DEFAULT_WTABLE_SIZE   CGestalt::maxBufferFrames()
 selected hardware interface at startup time
#define CSL_mVerbosity   3
 very verbose logging
#define CSL_mLoggingPeriod   10
 log CPU usage every N sec
#define CSL_LOG_PREFIX   "-- "
 prefix for log msgs (may be empty)
#define CSL_mOutPort   57123
 RFS output port.
#define CSL_mOSCPort   54321
 OSC input port.
#define CSL_WORD_LEN   32
 default short string length
#define CSL_DEF_LEN   128
 default medium string length
#define CSL_NAME_LEN   256
 default string length
#define CSL_LINE_LEN   512
 default line length
#define CSL_STR_LEN   1024
 default long string length
#define SAMPS_TO_WRITE   (44100 * 30)
 record 30 seconds by default
#define OUT_SFILE_NAME   "XX_csl.aiff"
 csl output file name temlpate
#define CSL_DATA_DIR   "~/Code/CSL/CSL_Data/"
 folder where the CSL data can be found
#define CSL_INIT_FILE   "~/.cslrc"
 where to store the CSL init file
#define USE_SNDFILEBUFFER
#define DEFAULT_MIDI_IN   0
#define DEFAULT_MIDI_OUT   0
#define USE_LOSC
#define Osc   WavetableOscillator
#define cx_r(val)   val[0]
#define cx_i(val)   val[1]
#define ComplexPtr   SampleBuffer
 shorthand
#define CSL_SCALE   1
#define CSL_OFFSET   2
#define CSL_INPUT   3
#define CSL_OPERAND   4
#define CSL_OPERAND2   5
#define CSL_FREQUENCY   6
#define CSL_POSITION   7
#define CSL_POSITIONX   7
#define CSL_POSITIONY   8
#define CSL_POSITIONZ   9
#define CSL_FILTER_FREQUENCY   10
#define CSL_FILTER_AMOUNT   11
#define CSL_RATE   12
#define csl_min(a, b)   (((a) < (b)) ? (a) : (b))
#define csl_max(a, b)   (((a) > (b)) ? (a) : (b))
#define csl_between(a, b, c)   (((a) >= (b)) && ((a) <= (c)))
#define csl_max_r(a)   (((a) > 1.0f) ? (a) : (1.0f/a))
#define csl_min_r(a)   (((a) < 1.0f) ? (a) : (1.0f/a))
#define csl_abs(a)   (((a) >= 0) ? (a) : (-a))
#define csl_max_d(a, b)   ((a > b) ? (a / b) : (b / a))
#define csl_min_d(a, b)   ((a < b) ? (a / b) : (b / a))
#define csl_ratio_rem(val1, val2, remainder)
#define TRUE   1
#define FALSE   0
#define CSL_PI   3.1415926535897933f
#define CSL_TWOPI   6.2831853071795865f
#define CSL_PIHALF   1.570796326795f
#define CSL_SQRT_TWO   1.414213562f
#define CSL_SPEED_OF_SOUND   330.0f
#define CSL_EXP_PER_DB   0.11512925464970228f
#define CSL_SAMPS_PER_METER   133.63636363636364f
#define CSL_DEGS_PER_RAD   57.295779513082321f

Typedefs

typedef float csl::sample
 < All of CSL takes place within the "csl" namespace
typedef float csl::Sample
 (could be changed to int)
typedef sample * csl::SampleBuffer
 1-channel buffer data type, vector of (sample)
typedef SampleBuffer * csl::SampleBufferVector
 Multi-channel buffer data type, vector of (SampleBuffer)
typedef SampleBuffer * csl::SampleBufferArray
 Multi-channel buffer data type.
typedef sample csl::SampleComplex [2]
 array-of-2 complex # type (like FFTW)
typedef SampleComplex * csl::SampleComplexVector
 complex vector
typedef SampleComplex * csl::SampleComplexPtr
 complex pointer
typedef std::vector< CPoint * > csl::PointVector
 Forward declaration.
typedef std::vector< unsigned > csl::UnsignedVector
 A vector of unsigneds.
typedef void * csl::VoidFcnPtr (void *arg)
 the generic void fcn pointer
typedef void csl::VoidFcnPtrN (void)
 the truly void fcn pointer
typedef unsigned csl::CSL_MAP_KEY
 Forward declaration.
typedef std::map< CSL_MAP_KEY,
Port * > 
csl::PortMap
typedef std::vector< Buffer * > csl::BufferVector
 Buffer/UGenVector: unit generator pointers (used for outputs)
typedef std::vector
< UnitGenerator * > 
csl::UGenVector
typedef std::map< std::string,
UnitGenerator * > 
csl::UGenMap
 UGenMap: a named map of unit generators (used for GUIs)
typedef std::map< unsigned,
UnitGenerator * > 
csl::UGenIMap
typedef std::map< unsigned, float > csl::FloatMap
typedef std::vector< float > csl::FloatVector
typedef std::vector< IODevice * > csl::IODeviceVector
 IOs hold onto device vectors.
typedef std::vector< Instrument * > csl::InstrumentVector
 Players hold onto Instrument vectors/maps.
typedef std::map< int,
InstrumentVector > 
csl::InstrumentLibrary
typedef std::map< std::string,
Instrument * > 
csl::InstrumentMap
typedef std::map< std::string,
std::string > 
csl::StringMap
typedef unsigned long csl::Timestamp
 Timestamp type: we assume that we can get the host's best guess at the IO word clock (normally passed into the audio IO callback function). call timeNow() to get the time We also support float-time in fTimeNow()

Macro Definition Documentation

#define CSL_Types_H

CSL_Types.h – the top-most include file for CSL 5.0 (September, 2009).

Central typedefs and platform-specific macros, also includes the model & observer classes. This is normally included via CSL_Core.h or CSL_Includes.h.

See the copyright notice and acknowledgment of authors in the file COPYRIGHT

CSL Coding Conventions Naming Class, member, and method names are written in "camelCase" as in "UnitGenerator." Class names are capitalized, but members and methods are written lower-camel-case. Data members (instance variables) are written with initial "m" then camelCase as in "mOffset." Enumeration constants are written with initial "k" followed by embedded caps as in "kDone." Compiler flags and #defines are generally written all-upperr-case as in "USE_CASND." Privacy In general data members are protected and have accessor functions where appropriate. The one exception is Buffer which is considered a record class and has public members.

Compile-time options (These are not set in this file so that different applications can share the source tree.)

   SoundFile type:
       USE_JSND - use the JUCE-based sound file class (requires only JUCE)
       USE_LSND - use libSndFile-based sound file class (supports many file types)
       USE_CASND - use the CoreAudio version (runs on iPhone)

   FFT implementation
       USE_FFTW - use FFTW 3 (faster but complicated to build)
       USE_FFTREAL - use FFTReal (smaller and simpler)
       USE_KISSFFT - use KISS FFT (smaller, untested)

   Thread implementation
       USE_JTHREADS - use the JUCE thread classes (otherwise use pthreads)

   MIDI API
       USE_JMIDI - use JUCE's MIDI I/O

   OSC API
       USE_LOSC - use LibLo for OSC (assumes liblio 0.26 is installed)
       USR_KOSC - use OSCKit for OSC (not implemented yet)

CORE CSL Types sample(float), Sample, SampleBuffer, SampleBufferVector, SampleComplex, SampleComplexVector PortMap, UGenVector, UGenMap, IODeviceVector, Timestamp, VoidFcnPtr

Constants CSL_PI, CSL_TWOPI, CSL_PIHALF, CSL_SQRT_TWO, CSL_SPEED_OF_SOUND, CSL_EXP_PER_DB, CSL_SAMPS_PER_METER, CSL_DEGS_PER_RAD

Many useful macros below

Definition at line 55 of file CSL_Types.h.

#define CSL_ENUMS

Definition at line 73 of file CSL_Types.h.

#define CSL_mFrameRate   44100

default sample rate (tested up to 96000)

Definition at line 82 of file CSL_Types.h.

#define CSL_mBlockSize   2048

normal hosts

I/O block size (set to 64-2048 in typical usage)

Definition at line 90 of file CSL_Types.h.

#define CSL_mMaxBufferFrames   8192

max block size (set large for zooming scopes)

Definition at line 91 of file CSL_Types.h.

#define CSL_mSndFileFrames   20480000

default file cache size = 20 MFrames (~ 2 min)

Definition at line 92 of file CSL_Types.h.

#define CSL_mMaxSndFileFrames   64000000

max file cache size = 64 MB (set to a large value)

Definition at line 93 of file CSL_Types.h.

#define DEFAULT_WTABLE_SIZE   CGestalt::maxBufferFrames()

selected hardware interface at startup time

size of wavetables, or use blockSize?

Definition at line 99 of file CSL_Types.h.

Referenced by csl::WavetableOscillator::fillSine().

#define CSL_mVerbosity   3

very verbose logging

Definition at line 101 of file CSL_Types.h.

#define CSL_mLoggingPeriod   10

log CPU usage every N sec

Definition at line 102 of file CSL_Types.h.

#define CSL_LOG_PREFIX   "-- "

prefix for log msgs (may be empty)

Definition at line 104 of file CSL_Types.h.

Referenced by csl::vlogMsg().

#define CSL_mOutPort   57123

RFS output port.

Definition at line 107 of file CSL_Types.h.

#define CSL_mOSCPort   54321

OSC input port.

Definition at line 108 of file CSL_Types.h.

#define CSL_WORD_LEN   32

default short string length

Definition at line 110 of file CSL_Types.h.

Referenced by csl::SoundFileMetadata::dump(), main(), and noteLoop().

#define CSL_DEF_LEN   128

default medium string length

Definition at line 111 of file CSL_Types.h.

#define CSL_LINE_LEN   512

default line length

Definition at line 113 of file CSL_Types.h.

Referenced by csl::MP3File::decodeMP3(), csl::CGestalt::initFileText(), and csl::HRTFDatabase::loadFromDB().

#define CSL_STR_LEN   1024

default long string length

Definition at line 114 of file CSL_Types.h.

Referenced by csl::CGestalt::storeToInitFile().

#define SAMPS_TO_WRITE   (44100 * 30)

record 30 seconds by default

Definition at line 116 of file CSL_Types.h.

#define OUT_SFILE_NAME   "XX_csl.aiff"

csl output file name temlpate

Definition at line 117 of file CSL_Types.h.

Referenced by csl::CGestalt::sndFileName().

#define CSL_DATA_DIR   "~/Code/CSL/CSL_Data/"

folder where the CSL data can be found

Definition at line 124 of file CSL_Types.h.

#define CSL_INIT_FILE   "~/.cslrc"

where to store the CSL init file

Definition at line 125 of file CSL_Types.h.

Referenced by initFileName().

#define USE_SNDFILEBUFFER

Definition at line 141 of file CSL_Types.h.

#define DEFAULT_MIDI_IN   0

Definition at line 147 of file CSL_Types.h.

#define DEFAULT_MIDI_OUT   0

Definition at line 148 of file CSL_Types.h.

#define USE_LOSC

Definition at line 153 of file CSL_Types.h.

#define cx_r (   val)    val[0]
#define cx_i (   val)    val[1]

Definition at line 189 of file CSL_Types.h.

Referenced by csl::IFFT::setBin(), csl::IFFT::setBins(), and csl::IFFT::setBinsMagPhase().

#define ComplexPtr   SampleBuffer

shorthand

Definition at line 190 of file CSL_Types.h.

Referenced by csl::BinauralPanner::nextBuffer().

#define CSL_SCALE   1
#define CSL_OFFSET   2
#define CSL_OPERAND   4
#define CSL_OPERAND2   5

Definition at line 260 of file CSL_Types.h.

#define CSL_FREQUENCY   6
#define CSL_POSITION   7
#define CSL_POSITIONX   7
#define CSL_POSITIONY   8
#define CSL_POSITIONZ   9

Definition at line 265 of file CSL_Types.h.

#define CSL_RATE   12

Definition at line 268 of file CSL_Types.h.

Referenced by csl::Abst_SoundFile::setRate().

#define csl_max (   a,
 
)    (((a) > (b)) ? (a) : (b))
#define csl_between (   a,
  b,
 
)    (((a) >= (b)) && ((a) <= (c)))

Definition at line 285 of file CSL_Types.h.

#define csl_max_r (   a)    (((a) > 1.0f) ? (a) : (1.0f/a))

Definition at line 289 of file CSL_Types.h.

#define csl_min_r (   a)    (((a) < 1.0f) ? (a) : (1.0f/a))

Definition at line 290 of file CSL_Types.h.

#define csl_abs (   a)    (((a) >= 0) ? (a) : (-a))

Definition at line 292 of file CSL_Types.h.

#define csl_max_d (   a,
 
)    ((a > b) ? (a / b) : (b / a))

Definition at line 296 of file CSL_Types.h.

#define csl_min_d (   a,
 
)    ((a < b) ? (a / b) : (b / a))

Definition at line 297 of file CSL_Types.h.

#define csl_ratio_rem (   val1,
  val2,
  remainder 
)
Value:
remainder = csl_max_d(val1, val2); \
remainder -= (int) remainder; \
if (remainder > 0.5f) { \
remainder = csl_max_r(rem); \
remainder -= 1.0f; \
}

Definition at line 301 of file CSL_Types.h.

#define FALSE   0

Definition at line 313 of file CSL_Types.h.

Referenced by csl::Instrument::isActive(), and csl::CPoint::operator==().

#define CSL_PIHALF   1.570796326795f

Definition at line 321 of file CSL_Types.h.

Referenced by test_Binaural_vertAxial().

#define CSL_SQRT_TWO   1.414213562f

Definition at line 322 of file CSL_Types.h.

Referenced by csl::Butter::setupCoeffs().

#define CSL_SPEED_OF_SOUND   330.0f

Definition at line 323 of file CSL_Types.h.

#define CSL_EXP_PER_DB   0.11512925464970228f

Definition at line 324 of file CSL_Types.h.

#define CSL_SAMPS_PER_METER   133.63636363636364f

Definition at line 325 of file CSL_Types.h.

#define CSL_DEGS_PER_RAD   57.295779513082321f