39 #ifndef CSL_CORE_H // This is in case you try to include this twice
107 void setSize(
unsigned numChannels,
unsigned numFrames);
109 void setSizeOnly(
unsigned numChannels,
unsigned numFrames);
144 #ifdef CSL_DSP_BUFFER
145 float rms(
unsigned chan);
146 float avg(
unsigned chan);
147 float max(
unsigned chan);
148 float min(
unsigned chan);
149 unsigned int zeroX(
unsigned chan);
150 unsigned int indexOfPeak(
unsigned chan);
151 unsigned int indexOfPeak(
unsigned chan,
unsigned low,
unsigned hi);
152 unsigned int indexOfMin(
unsigned chan);
153 unsigned int indexOfMin(
unsigned chan,
unsigned low,
unsigned hi);
154 void autocorrelation(
unsigned chan,
SampleBuffer result);
170 BufferCMap(
unsigned numChannels,
unsigned numFrames);
171 BufferCMap(
unsigned numChannels,
unsigned realNumChannels,
unsigned numFrames);
379 Scalable(
float scale,
float offset);
400 #define DECLARE_SCALABLE_CONTROLS \
401 Port * scalePort = mInputs[CSL_SCALE]; \
402 Port * offsetPort = mInputs[CSL_OFFSET]; \
403 float scaleValue, offsetValue
407 #define LOAD_SCALABLE_CONTROLS \
408 Controllable::pullInput(scalePort, numFrames); \
409 scaleValue = scalePort->nextValue(); \
410 Controllable::pullInput(offsetPort, numFrames); \
411 offsetValue = offsetPort->nextValue()
415 #define UPDATE_SCALABLE_CONTROLS \
416 scaleValue = scalePort->nextValue(); \
417 offsetValue = offsetPort->nextValue()
419 #define CHECK_UPDATE_SCALABLE_CONTROLS \
421 scaleValue = scalePort->nextValue(); \
423 offsetValue = offsetPort->nextValue()
425 #define IS_UNSCALED \
426 (scalePort->isFixed()) && (offsetPort->isFixed()) && \
427 (scaleValue == 1.0) && (offsetValue == 0.0)
468 Phased(
float frequency,
float phase = 0);
488 #define DECLARE_PHASED_CONTROLS \
489 Port * freqPort = mInputs[CSL_FREQUENCY]; \
496 #define LOAD_PHASED_CONTROLS \
497 Controllable::pullInput(freqPort, numFrames); \
498 freqValue = freqPort->nextValue()
502 #define UPDATE_PHASED_CONTROLS \
503 freqValue = freqPort->nextValue()
505 #define CHECK_UPDATE_PHASED_CONTROLS \
507 freqValue = freqPort->nextValue()
534 #define kPositionStart 0
535 #define kPositionCurrent 1
536 #define kPositionEnd 2
566 Cacheable(
bool uC) : mUseCache(uC) { };
587 virtual void nextBuffer(
Buffer & outputBuffer,
unsigned outBufNum)
throw(
CException);
607 virtual void nextBuffer(
Buffer & outputBuffer,
unsigned outBufNum)
throw(
CException);
621 virtual void nextBuffer(
Buffer & outputBuffer,
unsigned outBufNum)
throw(
CException);
624 virtual void trigger();
644 void interleave(
Buffer & output,
short * samples,
unsigned numFrames,
649 void interleaveAndRemap(
Buffer & output,
SampleBuffer samples,
unsigned numFrames,
unsigned numChannels,
655 void deinterleave(
Buffer & output,
short * samples,
unsigned numFrames,
662 #ifndef CSL_WINDOWS // on "normal" platforms
664 #ifdef DO_TIMING // Here are the macros and globals for the timing code
665 #include <sys/time.h>
666 #define GET_TIME(val) if (gettimeofday(val, 0) != 0) logMsg(kLogError, "Output: Error reading current time");
667 #define SUB_TIMES(t1, t2) (((t1->tv_sec - t2->tv_sec) * 1000000) + (t1->tv_usec - t2->tv_usec))
670 #else // If on Windows
672 #ifdef DO_TIMING // Here are the macros and globals for the timing code
673 #include <Winsock2.h>
676 int getSysTime(timeval *val,
void * e);
677 #define GET_TIME(val) if (getSysTime(val, 0) != 0) logMsg(kLogError, "Output: Error reading current time");
678 #define SUB_TIMES(t1, t2) (((t1->tv_sec - t2->tv_sec) * 1000000) + (t1->tv_usec - t2->tv_usec))
719 int in_device = -1,
int out_device = -1,
720 unsigned in_chans = 2,
unsigned out_chans = 2);
734 virtual
Buffer & getInput() throw(CException);
735 virtual
Buffer & getInput(
unsigned numFrames,
unsigned numChannels) throw(CException);
736 unsigned getAndIncrementSequence();
743 unsigned * mChannelMap;
745 unsigned mNumFramesPlayed;
750 unsigned mNumRealInChannels;
751 unsigned mNumRealOutChannels;
755 #ifdef DO_TIMING // This is for the performance timing code
756 struct timeval mThen, mNow;
757 long mTimeVals, mThisSec, mTimeSum;
760 void printTimeStatistics(
struct timeval * tthen,
struct timeval * tnow,
long * tsecond,
761 long * ttimeSum,
long * ttimeVals);
765 virtual void initialize(
unsigned sr,
unsigned bs,
int is,
int os,
unsigned ic,
unsigned oc) { };
776 IODevice(
char * name,
unsigned index,
unsigned maxIn,
unsigned maxOut,
bool isIn,
bool isOut);
777 IODevice(
string name,
unsigned index,
unsigned maxIn,
unsigned maxOut,
bool isIn,
bool isOut);