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 | Protected Attributes
csl::PAIO Class Reference

The PortAudio IO class. More...

`#include <PAIO.h>`

Inheritance diagram for csl::PAIO:

List of all members.

## Public Member Functions
| PAIO (unsigned s_rate=CSL_mFrameRate, unsigned b_size=CSL_mBlockSize, int in_device=-1, int out_device=-1, unsigned in_chans=0, unsigned out_chans=2)
| ~PAIO ()
| Destructor.
void | open () throw (CException)
| open the IO
void | start () throw (CException)
| start the callbacks
void | stop () throw (CException)
| stop the callbacks
void | close () throw (CException)
| close the IO
void | test () throw (CException)
| test the IO's graph
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
PaStream * | mStream
| the PortAudio stream we play out/get data from
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
void | handleError (PaError result) throw (CException)
| print the error message
void | initialize (unsigned sr, unsigned bs, int is, int os, unsigned ic, unsigned oc)
| Actually initialize PortAudio driver.

## Protected Attributes
PaStreamParameters * | mInputParameters
| PA IO stream parameters.
PaStreamParameters * | mOutputParameters
PaDeviceIndex | mInDev
PaDeviceIndex | mOutDev
| IO device numbers.
IODeviceVector | mDevices

## Detailed Description

The PortAudio IO class.

Definition at line 21 of file PAIO.h.

## Constructor & Destructor Documentation

PAIO::PAIO | ( | unsigned | s_rate = `CSL_mFrameRate`,
|  | unsigned | b_size = `CSL_mBlockSize`,
|  | int | in_device = `-1`,
|  | int | out_device = `-1`,
|  | unsigned | in_chans = `0`,
|  | unsigned | out_chans = `2`
| ) |  |

Definition at line 18 of file PAIO.cpp.

References initialize(), csl::kIONew, and csl::IO::mStatus.

PAIO::~PAIO | ( |  | ) |

Destructor.

Definition at line 25 of file PAIO.cpp.

References close(), csl::kIOOpen, csl::kIORunning, csl::logMsg(), mInputParameters, mOutputParameters, csl::IO::mStatus, and stop().

## Member Function Documentation

void PAIO::open | ( |  | ) | throw (CException)
| virtual

open the IO

Reimplemented from csl::IO.

Definition at line 79 of file PAIO.cpp.

References csl::Buffer::allocateBuffers(), csl::CGestalt::blockSize(), csl::CGestalt::frameRate(), csl::Buffer::freeBuffers(), csl::kIOInit, csl::kIOOpen, csl::kLogError, csl::logMsg(), csl::Buffer::mAreBuffersAllocated, csl::IO::mInputBuffer, mInputParameters, csl::IO::mOutputBuffer, mOutputParameters, csl::IO::mStatus, mStream, and pa_callback().

Referenced by main().

void PAIO::start | ( | void |  | ) | throw (CException)
| virtual

start the callbacks

Reimplemented from csl::IO.

Definition at line 119 of file PAIO.cpp.

References handleError(), csl::kIOOpen, csl::kIORunning, csl::kLogError, csl::logMsg(), csl::IO::mStatus, and mStream.

Referenced by main().

void PAIO::stop | ( | void |  | ) | throw (CException)
| virtual

stop the callbacks

Reimplemented from csl::IO.

Definition at line 138 of file PAIO.cpp.

References handleError(), csl::kIOOpen, csl::kIORunning, csl::kLogError, csl::logMsg(), csl::IO::mStatus, and mStream.

Referenced by main(), and ~PAIO().

void PAIO::close | ( |  | ) | throw (CException)
| virtual

close the IO

Reimplemented from csl::IO.

Definition at line 155 of file PAIO.cpp.

References csl::Buffer::freeBuffers(), handleError(), csl::kIOInit, csl::kIOOpen, csl::kLogError, csl::logMsg(), csl::Buffer::mAreBuffersAllocated, csl::IO::mInputBuffer, csl::IO::mOutputBuffer, csl::IO::mStatus, and mStream.

Referenced by main(), and ~PAIO().

void PAIO::test | ( |  | ) | throw (CException)
| virtual

test the IO's graph

Reimplemented from csl::IO.

Definition at line 177 of file PAIO.cpp.

References csl::Buffer::allocateBuffers(), csl::CGestalt::blockSize(), csl::kLogError, csl::logMsg(), csl::IO::mGraph, csl::CException::mMessage, csl::UnitGenerator::nextBuffer(), and csl::CGestalt::numOutChannels().

void PAIO::handleError | ( | PaError | result | ) | throw (CException)
| protected

print the error message

Definition at line 69 of file PAIO.cpp.

References csl::kLogError, and csl::logMsg().

Referenced by close(), start(), and stop().

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

Actually initialize PortAudio driver.

Reimplemented from csl::IO.

Definition at line 195 of file PAIO.cpp.

References csl::CGestalt::blockSize(), csl_min, csl::CGestalt::frameRate(), csl::kIOInit, csl::kLogFatal, csl::logMsg(), csl::IO::mChannelMap, mDevices, csl::IODevice::mFrameRates, mInDev, csl::IO::mInputBuffer, mInputParameters, csl::IO::mNumInChannels, csl::IO::mNumOutChannels, csl::IO::mNumRealInChannels, csl::IO::mNumRealOutChannels, mOutDev, csl::IO::mOutputBuffer, mOutputParameters, csl::IO::mStatus, csl::CGestalt::numInChannels(), csl::CGestalt::numOutChannels(), csl::CGestalt::setBlockSize(), csl::CGestalt::setFrameRate(), csl::CGestalt::setNumInChannels(), csl::CGestalt::setNumOutChannels(), and csl::Buffer::setSize().

Referenced by PAIO().

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

test the IO's graph

Definition at line 1249 of file CSL_Core.cpp.

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

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

void IO::clearRoot | ( |  | ) |
| inherited

set/clear my graph root generator

Definition at line 1254 of file CSL_Core.cpp.

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

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

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 inherited

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 csl::IO::mInputBuffer, csl::Buffer::mNumChannels, and csl::Buffer::mNumFrames.

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

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 | ( |  | ) |
| inherited

increment and answer my seq #

Definition at line 1262 of file CSL_Core.cpp.

References csl::IO::mSequence.

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

PaStream* csl::PAIO::mStream

the PortAudio stream we play out/get data from

Definition at line 35 of file PAIO.h.

Referenced by close(), open(), start(), and stop().

PaStreamParameters* csl::PAIO::mInputParameters
| protected

PA IO stream parameters.

Definition at line 38 of file PAIO.h.

Referenced by initialize(), open(), and ~PAIO().

PaStreamParameters* csl::PAIO::mOutputParameters
| protected

Definition at line 39 of file PAIO.h.

Referenced by initialize(), open(), and ~PAIO().

PaDeviceIndex csl::PAIO::mInDev
| protected

Definition at line 41 of file PAIO.h.

Referenced by initialize().

PaDeviceIndex csl::PAIO::mOutDev
| protected

IO device numbers.

Definition at line 41 of file PAIO.h.

Referenced by initialize().

IODeviceVector csl::PAIO::mDevices
| protected

Definition at line 42 of file PAIO.h.

Referenced by initialize().

UnitGenerator* csl::IO::mGraph
| inherited

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(), csl::IO::clearRoot(), pa_callback(), csl::VSTIO::processReplacing(), RenderCallback(), csl::VSTIO::setProgramName(), csl::IO::setRoot(), test(), and csl::FileIO::writeNextBuffer().

Buffer csl::IO::mInputBuffer
| inherited

the most recent input buffer (if it's turned on)

Definition at line 740 of file CSL_Core.h.

Referenced by csl::JUCEIO::audioDeviceIOCallback(), close(), csl::AUIO::getInput(), csl::NullIO::getInput(), csl::IO::getInput(), initialize(), open(), pa_callback(), and csl::VSTIO::processReplacing().

Buffer csl::IO::mOutputBuffer
| inherited

the output buffer I use (passed to nextBuffer calls)

Definition at line 741 of file CSL_Core.h.

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

SampleBuffer csl::IO::mInputPointer
| inherited

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
| inherited

the output channel remapping array

Definition at line 743 of file CSL_Core.h.

Referenced by initialize().

unsigned csl::IO::mNumFramesPlayed
| inherited

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
| inherited

sequence counter

Definition at line 746 of file CSL_Core.h.

Referenced by csl::IO::getAndIncrementSequence().

unsigned csl::IO::mLoggingPeriod
| inherited

logging period in seconds

Definition at line 747 of file CSL_Core.h.

unsigned csl::IO::mNumInChannels
| inherited

# inputs

Definition at line 748 of file CSL_Core.h.

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

unsigned csl::IO::mNumOutChannels
| inherited

# outputs

Definition at line 749 of file CSL_Core.h.

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

unsigned csl::IO::mNumRealInChannels
| inherited

# physical inputs

Definition at line 750 of file CSL_Core.h.

Referenced by initialize().

unsigned csl::IO::mNumRealOutChannels
| inherited

# physical outputs

Definition at line 751 of file CSL_Core.h.

Referenced by initialize().

IO_Status csl::IO::mStatus
| inherited

status flag

Definition at line 752 of file CSL_Core.h.

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

bool csl::IO::mInterleaved
| inherited

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/IO/PAIO.h
- CSL/IO/PAIO.cpp