CSL
6.0
|
IO – the abstract I/O scheduling class; subclasses interface to specific I/O APIs. More...
#include <CSL_Core.h>
Public Member Functions | |
IO (unsigned s_rate=44100, unsigned b_size=CSL_mBlockSize, int in_device=-1, int out_device=-1, unsigned in_chans=2, unsigned out_chans=2) | |
superclass = Model More... | |
virtual | ~IO () |
default is stereo input & output More... | |
virtual void | open () throw (CException) |
virtual void | close () throw (CException) |
open/close start/stop methods More... | |
virtual void | start () throw (CException) |
virtual void | stop () throw (CException) |
virtual void | test () throw (CException) |
virtual void | capture_on (float dur) |
test the IO's graph More... | |
virtual void | capture_off () |
end output capture More... | |
virtual Buffer * | get_capture () |
answer the capture buffer More... | |
void | setRoot (UnitGenerator &root) |
set/clear my graph root generator More... | |
void | clearRoot () |
void | pullInput (Buffer &outBuffer, SampleBuffer out=0) throw (CException) |
get a buffer from the CSL graph More... | |
virtual Buffer & | getInput () throw (CException) |
Get the current input from the sound card. More... | |
virtual Buffer & | getInput (unsigned numFrames, unsigned numChannels) throw (CException) |
unsigned | getAndIncrementSequence () |
increment and answer my seq # More... | |
void | printTimeStatistics (struct timeval *tthen, struct timeval *tnow, long *tsecond, long *ttimeSum, long *ttimeVals) |
void | attachObserver (Observer *) |
(possibly notify obersvers on my death) More... | |
void | detachObserver (Observer *) |
void | changed (void *argument) |
this is what I send to myself to notify my observers; It's not overridden in general. It results in the observers receiving update() calls < override evaluate to filter updates to the observer map More... | |
virtual int | evaluate (void *argument) |
Public Attributes | |
UnitGenerator * | mGraph |
the root of my client DSP graph, often a mixer or panner More... | |
Buffer | mInputBuffer |
the most recent input buffer (if it's turned on) More... | |
Buffer | mOutputBuffer |
the output buffer I use (passed to nextBuffer calls) More... | |
Buffer | mCaptureBuffer |
the output buffer I use for capturing output (for testing) More... | |
SampleBuffer | mInputPointer |
the buffer for holding the sound card input (if open) More... | |
unsigned * | mChannelMap |
the output channel remapping array More... | |
unsigned | mNumFramesPlayed |
counter of frames I've played More... | |
unsigned | mSequence |
sequence counter More... | |
unsigned | mLoggingPeriod |
logging period in seconds More... | |
unsigned | mNumInChannels |
inputsMore... | |
unsigned | mNumOutChannels |
outputsMore... | |
unsigned | mNumRealInChannels |
physical inputsMore... | |
unsigned | mNumRealOutChannels |
physical outputsMore... | |
IO_Status | mStatus |
status flag More... | |
bool | mInterleaved |
flag if IO is interleaved More... | |
unsigned | mOffset |
used for capture offset More... | |
struct timeval mThen | mNow |
used for getting the real time More... | |
long | mTimeVals |
long | mThisSec |
long | mTimeSum |
for printing run-time statistics More... | |
float | mUsage |
cpu usage % print the CPU usage message More... | |
Protected Member Functions | |
virtual void | initialize (unsigned sr, unsigned bs, int is, int os, unsigned ic, unsigned oc) |
initialize overridden in subclasses More... | |
Protected Attributes | |
float | maxSampEver |
IO – the abstract I/O scheduling class; subclasses interface to specific I/O APIs.
An IO object has a graph (a ptr to a UGen), and it registers itself with some call-back API (like PortAudio, CoreAudio, Jack, VST, JUCE), setting up a callback function that in turn calls the nextBuffer() method of its graph root.
One creates an IO with the desired rate, block size (optional) I/O device keys, and the number of in and out channels; you then set its root to be your DSP graph and send it start/stop messages.
All this is public because it's used by static call-back functions.
Definition at line 752 of file CSL_Core.h.
IO::IO | ( | unsigned | s_rate = 44100 , |
unsigned | b_size = CSL_mBlockSize , |
||
int | in_device = -1 , |
||
int | out_device = -1 , |
||
unsigned | in_chans = 2 , |
||
unsigned | out_chans = 2 |
||
) |
|
inlinevirtual |
default is stereo input & output
Definition at line 757 of file CSL_Core.h.
|
inlinevirtual |
Reimplemented in csl::iPhoneIO, csl::RemoteIO, csl::CAIO, csl::AUIO, csl::JackIO, csl::PAIO, csl::VSTIO, csl::FileIO, csl::AUIO, and csl::JUCEIO.
Definition at line 759 of file CSL_Core.h.
References csl::kIOOpen, and mStatus.
Referenced by oscServer(), and playSineMixer().
|
inlinevirtual |
open/close start/stop methods
Reimplemented in csl::iPhoneIO, csl::RemoteIO, csl::CAIO, csl::FileIO, csl::PAIO, csl::AUIO, csl::JackIO, csl::VSTIO, csl::AUIO, and csl::JUCEIO.
Definition at line 760 of file CSL_Core.h.
References csl::kIOClosed, and mStatus.
Referenced by playSineMixer(), and quit_handler().
|
inlinevirtual |
Reimplemented in csl::iPhoneIO, csl::StdIO, csl::RemoteIO, csl::CAIO, csl::AUIO, csl::JackIO, csl::NullIO, csl::VSTIO, csl::PAIO, csl::AUIO, and csl::JUCEIO.
Definition at line 761 of file CSL_Core.h.
References csl::kIORunning, and mStatus.
Referenced by CSLAbstComponent::CSLAbstComponent(), CSLComponent::CSLComponent(), oscServer(), and playSineMixer().
|
inlinevirtual |
Reimplemented in csl::iPhoneIO, csl::StdIO, csl::RemoteIO, csl::CAIO, csl::FileIO, csl::AUIO, csl::JackIO, csl::NullIO, csl::VSTIO, csl::PAIO, csl::AUIO, and csl::JUCEIO.
Definition at line 762 of file CSL_Core.h.
References csl::kIOOpen, and mStatus.
Referenced by playSineMixer(), and quit_handler().
|
inlinevirtual |
Reimplemented in csl::FileIO, and csl::PAIO.
Definition at line 763 of file CSL_Core.h.
|
virtual |
test the IO's graph
begin output capture
Definition at line 1536 of file CSL_Core.cpp.
References csl::Buffer::allocateBuffers(), csl::CGestalt::frameRateF(), mCaptureBuffer, mNumOutChannels, mOffset, and csl::Buffer::setSize().
Referenced by test_convolution_file().
|
virtual |
end output capture
Definition at line 1544 of file CSL_Core.cpp.
References mCaptureBuffer, and csl::Buffer::setSize().
Referenced by test_convolution_file().
|
virtual |
answer the capture buffer
Definition at line 1550 of file CSL_Core.cpp.
References mCaptureBuffer.
Referenced by test_convolution_file().
void IO::setRoot | ( | UnitGenerator & | root | ) |
set/clear my graph root generator
Definition at line 1405 of file CSL_Core.cpp.
References csl::UnitGenerator::addOutput(), and mGraph.
Referenced by main(), oscServer(), playSineMixer(), test_Ambi_horiz(), test_Binaural_horiz(), test_Binaural_vertAxial(), test_Binaural_vertMedian(), test_convolution(), test_convolution_file(), test_SimpleP(), test_VBAP_horiz(), testMultiTap(), testReverb(), testSndFileBank(), testSoundFileTranspose(), testStereoverb(), testStringChorus(), and csl::VSTIO::VSTIO().
void IO::clearRoot | ( | ) |
Definition at line 1410 of file CSL_Core.cpp.
References mGraph, and csl::UnitGenerator::removeOutput().
Referenced by CSLServerComponent::buttonClicked(), playSineMixer(), CSLMIDIComponent::startStop(), CSLAbstComponent::startStop(), CSLComponent::startStop(), test_Ambi_horiz(), test_Binaural_horiz(), test_Binaural_vertAxial(), test_Binaural_vertMedian(), test_convolution(), test_convolution_file(), test_SimpleP(), test_VBAP_horiz(), testMultiTap(), testReverb(), testSoundFileTranspose(), and testStereoverb().
void IO::pullInput | ( | Buffer & | outBuffer, |
SampleBuffer | out = 0 |
||
) | |||
throw | ( | CException | |
) |
get a buffer from the CSL graph
Definition at line 1425 of file CSL_Core.cpp.
References GET_TIME, csl::kLogError, csl::logMsg(), and csl::CException::mMessage.
Referenced by csl::JUCEIO::audioDeviceIOCallback(), CSLServerComponent::audioDeviceIOCallback(), CSLMIDIComponent::audioDeviceIOCallback(), CSLAbstComponent::audioDeviceIOCallback(), CSLComponent::audioDeviceIOCallback(), csl::NullIO::FeederFunction(), csl::StdIO::FeederFunction(), JackCallback(), pa_callback(), csl::VSTIO::processReplacing(), and RenderCallback().
|
virtual |
Get the current input from the sound card.
Reimplemented in csl::FileIO, csl::AUIO, csl::AUIO, and csl::NullIO.
Definition at line 1517 of file CSL_Core.cpp.
References mInputBuffer, csl::Buffer::mNumChannels, and csl::Buffer::mNumFrames.
|
virtual |
Reimplemented in csl::FileIO, csl::AUIO, csl::AUIO, and csl::NullIO.
Definition at line 1523 of file CSL_Core.cpp.
References csl::Interleaver::deinterleave(), and mNumInChannels.
unsigned IO::getAndIncrementSequence | ( | ) |
void IO::printTimeStatistics | ( | struct timeval * | tthen, |
struct timeval * | tnow, | ||
long * | tsecond, | ||
long * | ttimeSum, | ||
long * | ttimeVals | ||
) |
Definition at line 1486 of file CSL_Core.cpp.
References csl::CGestalt::blockSize(), csl::CGestalt::frameRateF(), csl::logMsg(), maxSampEver, mLoggingPeriod, mUsage, and SUB_TIMES.
Referenced by csl::FileIO::threadFunction().
|
inlineprotectedvirtual |
initialize overridden in subclasses
Reimplemented in csl::PAIO.
Definition at line 805 of file CSL_Core.h.
|
inherited |
(possibly notify obersvers on my death)
register/remove observers
Definition at line 502 of file CGestalt.cpp.
References csl::logMsg(), csl::Observer::mKey, and csl::Observer::mPeriod.
Referenced by CSLMIDIComponent::CSLMIDIComponent(), and csl::SpatialPanner::setSpeakerLayout().
|
inherited |
Definition at line 518 of file CGestalt.cpp.
References csl::logMsg().
Referenced by csl::SpatialPanner::setSpeakerLayout(), and csl::SpatialPanner::~SpatialPanner().
|
inherited |
this is what I send to myself to notify my observers; It's not overridden in general. It results in the observers receiving update() calls < override evaluate to filter updates to the observer map
Definition at line 540 of file CGestalt.cpp.
References csl::logMsg().
Referenced by csl::SpeakerLayout::addSpeaker(), csl::MIDIIn::handleIncomingMidiMessage(), and csl::SpeakerLayout::setDefaultSpeakerLayout().
|
inlinevirtualinherited |
Reimplemented in csl::MIDIIn.
Definition at line 270 of file CGestalt.h.
UnitGenerator* csl::IO::mGraph |
the root of my client DSP graph, often a mixer or panner
Definition at line 777 of file CSL_Core.h.
Referenced by csl::JUCEIO::audioDeviceIOCallback(), CSLServerComponent::audioDeviceIOCallback(), CSLMIDIComponent::audioDeviceIOCallback(), CSLAbstComponent::audioDeviceIOCallback(), CSLComponent::audioDeviceIOCallback(), CSLSignalComponent::audioDeviceIOCallback(), clearRoot(), pa_callback(), csl::VSTIO::processReplacing(), RenderCallback(), csl::VSTIO::setProgramName(), setRoot(), csl::PAIO::test(), and csl::FileIO::writeNextBuffer().
Buffer csl::IO::mInputBuffer |
the most recent input buffer (if it's turned on)
Definition at line 778 of file CSL_Core.h.
Referenced by csl::JUCEIO::audioDeviceIOCallback(), CSLAbstComponent::audioDeviceIOCallback(), csl::PAIO::close(), csl::AUIO::getInput(), csl::NullIO::getInput(), getInput(), csl::PAIO::initialize(), csl::PAIO::open(), pa_callback(), and csl::VSTIO::processReplacing().
Buffer csl::IO::mOutputBuffer |
the output buffer I use (passed to nextBuffer calls)
Definition at line 779 of file CSL_Core.h.
Referenced by csl::JUCEIO::audioDeviceIOCallback(), csl::PAIO::close(), csl::NullIO::FeederFunction(), csl::StdIO::FeederFunction(), csl::PAIO::initialize(), JackCallback(), csl::PAIO::open(), pa_callback(), csl::VSTIO::processReplacing(), and RenderCallback().
Buffer csl::IO::mCaptureBuffer |
the output buffer I use for capturing output (for testing)
Definition at line 780 of file CSL_Core.h.
Referenced by capture_off(), capture_on(), and get_capture().
SampleBuffer csl::IO::mInputPointer |
the buffer for holding the sound card input (if open)
Definition at line 781 of file CSL_Core.h.
Referenced by pa_callback().
unsigned* csl::IO::mChannelMap |
the output channel remapping array
Definition at line 782 of file CSL_Core.h.
Referenced by csl::PAIO::initialize().
unsigned csl::IO::mNumFramesPlayed |
counter of frames I've played
Definition at line 784 of file CSL_Core.h.
Referenced by csl::JUCEIO::audioDeviceIOCallback(), pa_callback(), RenderCallback(), csl::AUIO::start(), and csl::FileIO::writeNextBuffer().
unsigned csl::IO::mSequence |
sequence counter
Definition at line 785 of file CSL_Core.h.
Referenced by getAndIncrementSequence().
unsigned csl::IO::mLoggingPeriod |
logging period in seconds
Definition at line 786 of file CSL_Core.h.
Referenced by printTimeStatistics().
unsigned csl::IO::mNumInChannels |
Definition at line 787 of file CSL_Core.h.
Referenced by csl::JUCEIO::audioDeviceIOCallback(), csl::PAIO::initialize(), and pa_callback().
unsigned csl::IO::mNumOutChannels |
Definition at line 788 of file CSL_Core.h.
Referenced by csl::JUCEIO::audioDeviceIOCallback(), capture_on(), csl::PAIO::initialize(), and csl::VSTIO::processReplacing().
unsigned csl::IO::mNumRealInChannels |
unsigned csl::IO::mNumRealOutChannels |
IO_Status csl::IO::mStatus |
status flag
Definition at line 791 of file CSL_Core.h.
Referenced by csl::JUCEIO::audioDeviceIOCallback(), csl::PAIO::close(), close(), csl::PAIO::initialize(), JackCallback(), csl::PAIO::open(), open(), pa_callback(), csl::PAIO::PAIO(), csl::PAIO::start(), start(), csl::PAIO::stop(), stop(), and csl::PAIO::~PAIO().
bool csl::IO::mInterleaved |
flag if IO is interleaved
Definition at line 792 of file CSL_Core.h.
Referenced by csl::InOut::InOut(), and csl::VSTIO::VSTIO().
unsigned csl::IO::mOffset |
used for capture offset
Definition at line 793 of file CSL_Core.h.
Referenced by capture_on(), and test_convolution_file().
struct timeval mThen csl::IO::mNow |
used for getting the real time
Definition at line 796 of file CSL_Core.h.
Referenced by csl::FileIO::threadFunction().
long csl::IO::mTimeVals |
Definition at line 797 of file CSL_Core.h.
Referenced by csl::AUIO::open(), csl::FileIO::open(), csl::PAIO::open(), and csl::FileIO::threadFunction().
long csl::IO::mThisSec |
Definition at line 797 of file CSL_Core.h.
Referenced by csl::AUIO::open(), csl::FileIO::open(), csl::PAIO::open(), and csl::FileIO::threadFunction().
long csl::IO::mTimeSum |
for printing run-time statistics
Definition at line 797 of file CSL_Core.h.
Referenced by csl::AUIO::open(), csl::FileIO::open(), csl::PAIO::open(), and csl::FileIO::threadFunction().
float csl::IO::mUsage |
cpu usage % print the CPU usage message
Definition at line 798 of file CSL_Core.h.
Referenced by printTimeStatistics().
|
protected |
Definition at line 805 of file CSL_Core.h.
Referenced by printTimeStatistics().