CSL 5.2

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | Public Attributes | Protected Member Functions
csl::IO Class Reference

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. More...

`#include <CSL_Core.h>`

Inheritance diagram for csl::IO:

List of all members.

## 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
virtual | ~IO ()
| default is stereo input & output
virtual void | open () throw (CException)
virtual void | close () throw (CException)
| open/close start/stop methods
virtual void | start () throw (CException)
virtual void | stop () throw (CException)
virtual void | test () throw (CException)
void | setRoot (UnitGenerator &root)
| test the IO's graph
void | clearRoot ()
| set/clear my graph root generator
void | pullInput (Buffer &outBuffer, SampleBuffer out=0) throw (CException)
| get a buffer from the CSL graph
virtual Buffer & | getInput () throw (CException)
| Get the current input from the sound card.
virtual Buffer & | getInput (unsigned numFrames, unsigned numChannels) throw (CException)
unsigned | getAndIncrementSequence ()
| increment and answer my seq #
void | attachObserver (Observer *)
| (possibly notify obersvers on my death)
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
virtual int | evaluate (void *argument)

## Public Attributes
UnitGenerator * | mGraph
| the root of my client DSP graph, often a mixer or panner
Buffer | mInputBuffer
| the most recent input buffer (if it's turned on)
Buffer | mOutputBuffer
| the output buffer I use (passed to nextBuffer calls)
SampleBuffer | mInputPointer
| the buffer for holding the sound card input (if open)
unsigned * | mChannelMap
| the output channel remapping array
unsigned | mNumFramesPlayed
| counter of frames I've played
unsigned | mSequence
| sequence counter
unsigned | mLoggingPeriod
| logging period in seconds
unsigned | mNumInChannels
| # inputs
unsigned | mNumOutChannels
| # outputs
unsigned | mNumRealInChannels
| # physical inputs
unsigned | mNumRealOutChannels
| # physical outputs
IO_Status | mStatus
| status flag
bool | mInterleaved
| flag if IO is interleaved

## Protected Member Functions
virtual void | initialize (unsigned sr, unsigned bs, int is, int os, unsigned ic, unsigned oc)
| initialize overridden in subclasses

## Detailed Description

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 716 of file CSL_Core.h.

## Constructor & Destructor Documentation

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`
| ) |  |

superclass = Model

Definition at line 1237 of file CSL_Core.cpp.

References csl::logMsg().

virtual csl::IO::~IO | ( |  | ) |
| inline virtual

default is stereo input & output

Definition at line 721 of file CSL_Core.h.

## Member Function Documentation

virtual void csl::IO::open | ( |  | ) | throw (CException)
| inline virtual

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 723 of file CSL_Core.h.

References csl::kIOOpen.

Referenced by main().

virtual void csl::IO::close | ( |  | ) | throw (CException)
| inline virtual

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 724 of file CSL_Core.h.

References csl::kIOClosed.

Referenced by csl::CSLService::stop().

virtual void csl::IO::start | ( | void |  | ) | throw (CException)
| inline virtual

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 725 of file CSL_Core.h.

References csl::kIORunning.

Referenced by fm_bells(), mixer(), phonemes(), csl::CSLService::resume(), and swept_noise().

virtual void csl::IO::stop | ( | void |  | ) | throw (CException)
| inline virtual

Reimplemented in csl::iPhoneIO, csl::StdIO, csl::RemoteIO, csl::CAIO, csl::FileIO, csl::AUIO, csl::JackIO, csl::NullIO, csl::VSTIO, csl::JUCEIO, csl::PAIO, and csl::AUIO.

Definition at line 726 of file CSL_Core.h.

References csl::kIOOpen.

Referenced by csl::CSLService::stop(), and csl::CSLService::suspend().

virtual void csl::IO::test | ( |  | ) | throw (CException)
| inline virtual

Reimplemented in csl::FileIO, and csl::PAIO.

Definition at line 727 of file CSL_Core.h.

void IO::setRoot | ( | UnitGenerator & | root | ) |

test the IO's graph

Definition at line 1249 of file CSL_Core.cpp.

References csl::UnitGenerator::addOutput(), and mGraph.

Referenced by main(), and csl::VSTIO::VSTIO().

void IO::clearRoot | ( |  | ) |

set/clear my graph root generator

Definition at line 1254 of file CSL_Core.cpp.

References mGraph, and csl::UnitGenerator::removeOutput().

void IO::pullInput | ( | Buffer & | outBuffer,
|  | SampleBuffer | out = `0`
| ) |  | throw (CException)

get a buffer from the CSL graph

Definition at line 1269 of file CSL_Core.cpp.

References GET_TIME, csl::kLogError, csl::logMsg(), and csl::CException::mMessage.

Referenced by csl::JUCEIO::audioDeviceIOCallback(), csl::NullIO::FeederFunction(), csl::StdIO::FeederFunction(), JackCallback(), pa_callback(), csl::VSTIO::processReplacing(), and RenderCallback().

Buffer & IO::getInput | ( |  | ) | throw (CException)
| virtual

Get the current input from the sound card.

Reimplemented in csl::FileIO, csl::AUIO, csl::AUIO, and csl::NullIO.

Definition at line 1358 of file CSL_Core.cpp.

References mInputBuffer, csl::Buffer::mNumChannels, and csl::Buffer::mNumFrames.

Buffer & IO::getInput | ( | unsigned | numFrames,
|  | unsigned | numChannels
| ) |  | throw (CException)
| virtual

Reimplemented in csl::FileIO, csl::AUIO, csl::AUIO, and csl::NullIO.

Definition at line 1364 of file CSL_Core.cpp.

References csl::Interleaver::deinterleave(), and mNumInChannels.

unsigned IO::getAndIncrementSequence | ( |  | ) |

increment and answer my seq #

Definition at line 1262 of file CSL_Core.cpp.

References mSequence.

virtual void csl::IO::initialize | ( | unsigned | sr,
|  | unsigned | bs,
|  | int | is,
|  | int | os,
|  | unsigned | ic,
|  | unsigned | oc
| ) |  |
| inline protected virtual

initialize overridden in subclasses

Reimplemented in csl::PAIO.

Definition at line 765 of file CSL_Core.h.

void Model::attachObserver | ( | Observer * | o | ) |
| inherited

(possibly notify obersvers on my death)

register/remove observers

Definition at line 491 of file CGestalt.cpp.

References csl::logMsg(), csl::Observer::mKey, and csl::Observer::mPeriod.

Referenced by csl::SpatialPanner::setSpeakerLayout().

void Model::detachObserver | ( | Observer * | o | ) |
| inherited

Definition at line 507 of file CGestalt.cpp.

References csl::logMsg().

Referenced by csl::SpatialPanner::setSpeakerLayout(), and csl::SpatialPanner::~SpatialPanner().

void Model::changed | ( | void * | argument | ) |
| 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 529 of file CGestalt.cpp.

References csl::logMsg().

Referenced by csl::SpeakerLayout::addSpeaker(), csl::MIDIIn::handleIncomingMidiMessage(), and csl::SpeakerLayout::setDefaultSpeakerLayout().

virtual int csl::Model::evaluate | ( | void * | argument | ) |
| inline virtual inherited

Reimplemented in csl::MIDIIn.

Definition at line 259 of file CGestalt.h.

## Member Data Documentation

UnitGenerator* csl::IO::mGraph

the root of my client DSP graph, often a mixer or panner

Definition at line 739 of file CSL_Core.h.

Referenced by csl::JUCEIO::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 740 of file CSL_Core.h.

Referenced by csl::JUCEIO::audioDeviceIOCallback(), csl::PAIO::close(), csl::NullIO::getInput(), csl::AUIO::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 741 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().

SampleBuffer csl::IO::mInputPointer

the buffer for holding the sound card input (if open)

Definition at line 742 of file CSL_Core.h.

Referenced by pa_callback().

unsigned* csl::IO::mChannelMap

the output channel remapping array

Definition at line 743 of file CSL_Core.h.

Referenced by csl::PAIO::initialize().

unsigned csl::IO::mNumFramesPlayed

counter of frames I've played

Definition at line 745 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 746 of file CSL_Core.h.

Referenced by getAndIncrementSequence().

unsigned csl::IO::mLoggingPeriod

logging period in seconds

Definition at line 747 of file CSL_Core.h.

unsigned csl::IO::mNumInChannels

# inputs

Definition at line 748 of file CSL_Core.h.

Referenced by csl::JUCEIO::audioDeviceIOCallback(), csl::PAIO::initialize(), and pa_callback().

unsigned csl::IO::mNumOutChannels

# outputs

Definition at line 749 of file CSL_Core.h.

Referenced by csl::JUCEIO::audioDeviceIOCallback(), csl::PAIO::initialize(), and csl::VSTIO::processReplacing().

unsigned csl::IO::mNumRealInChannels

# physical inputs

Definition at line 750 of file CSL_Core.h.

Referenced by csl::PAIO::initialize().

unsigned csl::IO::mNumRealOutChannels

# physical outputs

Definition at line 751 of file CSL_Core.h.

Referenced by csl::PAIO::initialize().

IO_Status csl::IO::mStatus

status flag

Definition at line 752 of file CSL_Core.h.

Referenced by csl::JUCEIO::audioDeviceIOCallback(), csl::PAIO::close(), csl::PAIO::initialize(), JackCallback(), csl::PAIO::open(), pa_callback(), csl::PAIO::PAIO(), csl::PAIO::start(), csl::PAIO::stop(), and csl::PAIO::~PAIO().

bool csl::IO::mInterleaved

flag if IO is interleaved

Definition at line 753 of file CSL_Core.h.

Referenced by csl::InOut::InOut(), and csl::VSTIO::VSTIO().

The documentation for this class was generated from the following files:

- CSL/Kernel/CSL_Core.h
- CSL/Kernel/CSL_Core.cpp