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 | Static Protected Member Functions | Protected Attributes
csl::FileIO Class Reference

FileIO.h – IO using a sound file for storing output sample data. More...

`#include <FileIO.h>`

Inheritance diagram for csl::FileIO:

List of all members.

## Public Member Functions
| FileIO (char *path=NULL)
| < the path name determines the file type, e.g., xx.aiff, zz.snd, or yy.wav
| ~FileIO ()
void | open () throw (CException)
void | start (float seconds=0) throw (CException)
| seconds is optional. If not passed, starts a background thread, playing and writing, otherwise run for x seconds (so it doesn't return until done).
void | stop () throw (CException)
void | close () throw (CException)
| open/close start/stop methods
void | test () throw (CException)
Buffer & | getInput () throw (CException)
| test the IO's graph < Get the current input from the sound card
Buffer & | getInput (unsigned numFrames, unsigned numChannels) throw (CException)
virtual void | start () 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
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
bool | mIsPlaying
| whether or not it's playing
bool | mIsThreadRunning
| is the background thread running?
unsigned | mDuration
| the file's buffer rate;
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 | writeNextBuffer ()
virtual void | initialize (unsigned sr, unsigned bs, int is, int os, unsigned ic, unsigned oc)
| initialize overridden in subclasses

## Static Protected Member Functions
static void * | threadFunction (void *)

## Protected Attributes
string | mPath
SoundFile * | mFile
CThread * | mThread
Buffer | mInBuffer
Buffer | mOutBuffer

## Detailed Description

FileIO.h – IO using a sound file for storing output sample data.

Definition at line 19 of file FileIO.h.

## Constructor & Destructor Documentation

FileIO::FileIO | ( | char * | path = `NULL` | ) |

< the path name determines the file type, e.g., xx.aiff, zz.snd, or yy.wav

Definition at line 10 of file FileIO.cpp.

References mFile, mPath, and csl::CGestalt::sndFileName().

FileIO::~FileIO | ( |  | ) |

Definition at line 18 of file FileIO.cpp.

References mFile, and mThread.

## Member Function Documentation

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

Reimplemented from csl::IO.

Definition at line 27 of file FileIO.cpp.

References csl::Buffer::allocateBuffers(), csl::CGestalt::blockSize(), csl::CGestalt::frameRate(), csl::Buffer::freeBuffers(), csl::kLogError, kSoundFileFormatAIFF, kSoundFileFormatSND, kSoundFileFormatWAV, csl::logMsg(), csl::CThread::MakeThread(), csl::Buffer::mAreBuffersAllocated, mDuration, mFile, mInBuffer, mOutBuffer, mPath, mThread, csl::CGestalt::numOutChannels(), and csl::Buffer::setSize().

void FileIO::start | ( | float | seconds = `0` | ) | throw (CException)

seconds is optional. If not passed, starts a background thread, playing and writing, otherwise run for x seconds (so it doesn't return until done).

Definition at line 63 of file FileIO.cpp.

References csl::CGestalt::frameRate(), and csl::logMsg().

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

Reimplemented from csl::IO.

Definition at line 77 of file FileIO.cpp.

References mDuration, mIsPlaying, mIsThreadRunning, and csl::sleepUsec().

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

open/close start/stop methods

Reimplemented from csl::IO.

Definition at line 85 of file FileIO.cpp.

References csl::Buffer::freeBuffers(), csl::Buffer::mAreBuffersAllocated, mFile, mInBuffer, and mOutBuffer.

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

Reimplemented from csl::IO.

Definition at line 35 of file FileIO.h.

Buffer& csl::FileIO::getInput | ( |  | ) | throw (CException)
| inline virtual

test the IO's graph < Get the current input from the sound card

Reimplemented from csl::IO.

Definition at line 37 of file FileIO.h.

References mInBuffer.

Buffer& csl::FileIO::getInput | ( | unsigned | numFrames,
|  | unsigned | numChannels
| ) |  | throw (CException)
| inline virtual

Reimplemented from csl::IO.

Definition at line 38 of file FileIO.h.

void * FileIO::threadFunction | ( | void * | ptr | ) |
| static protected

Definition at line 106 of file FileIO.cpp.

References GET_TIME, csl::logMsg(), mDuration, mIsPlaying, mIsThreadRunning, csl::sleepUsec(), and writeNextBuffer().

void FileIO::writeNextBuffer | ( |  | ) |
| protected

Definition at line 95 of file FileIO.cpp.

References mFile, csl::IO::mGraph, csl::Buffer::mNumFrames, csl::IO::mNumFramesPlayed, mOutBuffer, csl::UnitGenerator::nextBuffer(), and csl::Buffer::zeroBuffers().

Referenced by threadFunction().

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

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

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

unsigned IO::getAndIncrementSequence | ( |  | ) |
| inherited

increment and answer my seq #

Definition at line 1262 of file CSL_Core.cpp.

References csl::IO::mSequence.

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

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

bool csl::FileIO::mIsPlaying

whether or not it's playing

Definition at line 25 of file FileIO.h.

Referenced by stop(), and threadFunction().

bool csl::FileIO::mIsThreadRunning

is the background thread running?

Definition at line 26 of file FileIO.h.

Referenced by stop(), and threadFunction().

unsigned csl::FileIO::mDuration

the file's buffer rate;

Definition at line 27 of file FileIO.h.

Referenced by open(), stop(), and threadFunction().

string csl::FileIO::mPath
| protected

Definition at line 38 of file FileIO.h.

Referenced by FileIO(), and open().

SoundFile* csl::FileIO::mFile
| protected

Definition at line 42 of file FileIO.h.

Referenced by close(), FileIO(), open(), writeNextBuffer(), and ~FileIO().

CThread* csl::FileIO::mThread
| protected

Definition at line 43 of file FileIO.h.

Referenced by open(), and ~FileIO().

Buffer csl::FileIO::mInBuffer
| protected

Definition at line 46 of file FileIO.h.

Referenced by close(), getInput(), and open().

Buffer csl::FileIO::mOutBuffer
| protected

Definition at line 47 of file FileIO.h.

Referenced by close(), open(), and writeNextBuffer().

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(), csl::PAIO::test(), and 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(), csl::PAIO::close(), csl::AUIO::getInput(), csl::NullIO::getInput(), csl::IO::getInput(), csl::PAIO::initialize(), csl::PAIO::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(), 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
| 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 csl::PAIO::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 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(), csl::PAIO::initialize(), and pa_callback().

unsigned csl::IO::mNumOutChannels
| inherited

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

# physical inputs

Definition at line 750 of file CSL_Core.h.

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

unsigned csl::IO::mNumRealOutChannels
| inherited

# physical outputs

Definition at line 751 of file CSL_Core.h.

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

IO_Status csl::IO::mStatus
| inherited

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