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

Go to the source code of this file.

Classes

struct  csl::testStruct
 struct used for the JUCE pop-up menu of tests (see the test files) More...
 

Namespaces

 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). Updated for CSL 6.0 April, 2020. More...
 
#define CSL_ENUMS
 
#define CSL_mFrameRate   44100
 default sample rate (tested up to 96000) More...
 
#define CSL_mBlockSize   512
 normal hosts More...
 
#define CSL_mMaxBufferFrames   8192
 max block size (set large for zooming scopes) More...
 
#define CSL_mSndFileFrames   20480000
 default file cache size = 20 MFrames (~ 2 min) More...
 
#define CSL_mMaxSndFileFrames   64000000
 max file cache size = 64 MB (set to a large value) More...
 
#define DEFAULT_WTABLE_SIZE   CGestalt::maxBufferFrames()
 selected hardware interface at startup time More...
 
#define CSL_mVerbosity   3
 very verbose logging More...
 
#define CSL_mLoggingPeriod   10
 log CPU usage every N sec More...
 
#define CSL_LOG_PREFIX   "-- "
 prefix for log msgs (may be empty) More...
 
#define CSL_mOutPort   57123
 RFS output port. More...
 
#define CSL_mOSCPort   54321
 OSC input port. More...
 
#define CSL_WORD_LEN   32
 default short string length More...
 
#define CSL_DEF_LEN   128
 default medium string length More...
 
#define CSL_NAME_LEN   256
 default string length More...
 
#define CSL_LINE_LEN   512
 default line length More...
 
#define CSL_STR_LEN   1024
 default long string length More...
 
#define SAMPS_TO_WRITE   (44100 * 30)
 record 30 seconds by default More...
 
#define OUT_SFILE_NAME   "XX_csl.aiff"
 csl output file name temlpate More...
 
#define CSL_DATA_DIR   "~/Code/CSL6/Data/"
 folder where the CSL data can be found More...
 
#define CSL_INIT_FILE   "~/.cslrc"
 where to store the CSL init file More...
 
#define DO_TIMING
 Gather performance timing (not on Windows) More...
 
#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]
 complex # accesor macros More...
 
#define cx_i(val)   val[1]
 
#define ComplexPtr   SampleBuffer
 shorthand More...
 
#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::FloatArray
 < All of CSL takes place within the "csl" namespace More...
 
typedef FloatArray * csl::FloatArrayPtr
 float pointer pointer type More...
 
typedef float csl::sample
 (could be changed to int, or double) More...
 
typedef float csl::Sample
 the same, written upper-case More...
 
typedef sample * csl::SampleBuffer
 1-channel buffer data type, vector of (sample) More...
 
typedef SampleBuffer * csl::SampleBufferVector
 Multi-channel buffer data type, vector of (SampleBuffer) More...
 
typedef SampleBuffer * csl::SampleBufferArray
 Multi-channel buffer data type. More...
 
typedef sample csl::SampleComplex [2]
 array-of-2 complex # type (like FFTW) More...
 
typedef SampleComplex * csl::SampleComplexVector
 complex vector More...
 
typedef SampleComplex * csl::SampleComplexPtr
 complex pointer More...
 
typedef SampleComplexPtr * csl::SampleComplexMatrix
 complex 2D matrix More...
 
typedef std::vector< CPoint * > csl::PointVector
 Forward declaration. More...
 
typedef std::vector< unsigned > csl::UnsignedVector
 A vector of unsigneds. More...
 
typedef std::vector< float > csl::FloatVector
 A vector of floats. More...
 
typedef void * csl::VoidFcnPtr (void *arg)
 the generic void fcn pointer More...
 
typedef void csl::VoidFcnPtrN (void)
 the truly void fcn pointer More...
 
typedef unsigned csl::uint
 
typedef unsigned csl::CSL_MAP_KEY
 Forward declaration. More...
 
typedef std::map< CSL_MAP_KEY,
Port * > 
csl::PortMap
 
typedef std::vector< Buffer * > csl::BufferVector
 Buffer/UGenVector: unit generator pointers (used for outputs) More...
 
typedef std::vector
< UnitGenerator * > 
csl::UGenVector
 
typedef std::map< std::string,
UnitGenerator * > 
csl::UGenMap
 UGenMap: a named map of unit generators (used for GUIs) More...
 
typedef std::map< unsigned,
UnitGenerator * > 
csl::UGenIMap
 
typedef std::map< unsigned, float > csl::FloatMap
 
typedef std::vector< IODevice * > csl::IODeviceVector
 IOs hold onto device vectors. More...
 
typedef std::vector< Instrument * > csl::InstrumentVector
 Players hold onto Instrument vectors/maps. More...
 
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() More...
 

Macro Definition Documentation

#define CSL_Types_H

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

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 or greater 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 56 of file CSL_Types.h.

#define CSL_ENUMS

Definition at line 82 of file CSL_Types.h.

#define CSL_mFrameRate   44100

default sample rate (tested up to 96000)

Definition at line 91 of file CSL_Types.h.

#define CSL_mBlockSize   512

normal hosts

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

Definition at line 99 of file CSL_Types.h.

#define CSL_mMaxBufferFrames   8192

max block size (set large for zooming scopes)

Definition at line 100 of file CSL_Types.h.

Referenced by AudioWaveformDisplay::AudioWaveformDisplay(), and AudioWaveformDisplay::initialise().

#define CSL_mSndFileFrames   20480000

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

Definition at line 101 of file CSL_Types.h.

#define CSL_mMaxSndFileFrames   64000000

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

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

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

#define CSL_mVerbosity   3

very verbose logging

Definition at line 110 of file CSL_Types.h.

#define CSL_mLoggingPeriod   10

log CPU usage every N sec

Definition at line 111 of file CSL_Types.h.

#define CSL_LOG_PREFIX   "-- "

prefix for log msgs (may be empty)

Definition at line 113 of file CSL_Types.h.

#define CSL_mOutPort   57123

RFS output port.

Definition at line 116 of file CSL_Types.h.

#define CSL_mOSCPort   54321

OSC input port.

Definition at line 117 of file CSL_Types.h.

#define CSL_WORD_LEN   32

default short string length

Definition at line 119 of file CSL_Types.h.

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

#define CSL_DEF_LEN   128

default medium string length

Definition at line 120 of file CSL_Types.h.

#define CSL_LINE_LEN   512

default line length

Definition at line 122 of file CSL_Types.h.

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

#define CSL_STR_LEN   1024

default long string length

Definition at line 123 of file CSL_Types.h.

Referenced by CSLMIDIComponent::CSLMIDIComponent(), and csl::CGestalt::storeToInitFile().

#define OUT_SFILE_NAME   "XX_csl.aiff"

csl output file name temlpate

Definition at line 126 of file CSL_Types.h.

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

#define CSL_DATA_DIR   "~/Code/CSL6/Data/"

folder where the CSL data can be found

Definition at line 135 of file CSL_Types.h.

#define CSL_INIT_FILE   "~/.cslrc"

where to store the CSL init file

Definition at line 136 of file CSL_Types.h.

Referenced by initFileName().

#define DO_TIMING

Gather performance timing (not on Windows)

Definition at line 137 of file CSL_Types.h.

#define USE_SNDFILEBUFFER

Definition at line 152 of file CSL_Types.h.

#define DEFAULT_MIDI_IN   0

Definition at line 158 of file CSL_Types.h.

Referenced by CSLMIDIComponent::CSLMIDIComponent().

#define DEFAULT_MIDI_OUT   0

Definition at line 159 of file CSL_Types.h.

#define USE_LOSC

Definition at line 164 of file CSL_Types.h.

#define cx_r (   val)    val[0]

complex # accesor macros

Definition at line 199 of file CSL_Types.h.

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

#define cx_i (   val)    val[1]

Definition at line 200 of file CSL_Types.h.

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

#define ComplexPtr   SampleBuffer

shorthand

Definition at line 201 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 277 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 282 of file CSL_Types.h.

#define CSL_RATE   12

Definition at line 285 of file CSL_Types.h.

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

#define csl_min (   a,
 
)    (((a) < (b)) ? (a) : (b))

Definition at line 292 of file CSL_Types.h.

#define csl_max (   a,
 
)    (((a) > (b)) ? (a) : (b))

Definition at line 296 of file CSL_Types.h.

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

Definition at line 301 of file CSL_Types.h.

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

Definition at line 305 of file CSL_Types.h.

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

Definition at line 306 of file CSL_Types.h.

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

Definition at line 308 of file CSL_Types.h.

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

Definition at line 312 of file CSL_Types.h.

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

Definition at line 313 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; \
}
#define csl_max_r(a)
Definition: CSL_Types.h:305
#define csl_max_d(a, b)
Definition: CSL_Types.h:312

Definition at line 317 of file CSL_Types.h.

#define TRUE   1
#define FALSE   0

Definition at line 329 of file CSL_Types.h.

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

#define CSL_PIHALF   1.570796326795f

Definition at line 337 of file CSL_Types.h.

Referenced by test_Binaural_vertAxial().

#define CSL_SQRT_TWO   1.414213562f

Definition at line 338 of file CSL_Types.h.

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

#define CSL_SPEED_OF_SOUND   330.0f

Definition at line 339 of file CSL_Types.h.

#define CSL_EXP_PER_DB   0.11512925464970228f

Definition at line 340 of file CSL_Types.h.

#define CSL_SAMPS_PER_METER   133.63636363636364f

Definition at line 341 of file CSL_Types.h.

#define CSL_DEGS_PER_RAD   57.295779513082321f