csl::LSoundFile Class Reference

#include <SoundFileL.h>

Inheritance diagram for csl::LSoundFile:

csl::Abst_SoundFile csl::WavetableOscillator csl::Writeable csl::Seekable csl::Oscillator csl::UnitGenerator csl::Phased csl::Scalable csl::Model csl::Controllable csl::Controllable

List of all members.

Public Member Functions

 LSoundFile (string path, int start=-1, int stop=-1)
 Constructor. Values not passed default to null.
 LSoundFile (string folder, string path, int start=-1, int stop=-1)
 LSoundFile (LSoundFile &otherSndFile)
 Copy constructor -- shares sample buffer.
 ~LSoundFile ()
SoundFileFormat format ()
 get format
void openForRead () throw (CException)
void openForWrite (SoundFileFormat format=kSoundFileFormatAIFF, unsigned channels=1, unsigned rate=44100, unsigned bitDepth=16) throw (CException)
void openForReadWrite () throw (CException)
 open r/w
void close ()
unsigned seekTo (int position, SeekPosition whence=kPositionStart) throw (CException)
 seek to some position
void readBufferFromFile (unsigned numFrames)
 read a buffer from the file (possibly all of it)
void nextBuffer (Buffer &outB) throw (CException)
 UGen operations.
void writeBuffer (Buffer &inputBuffer) throw (CException)
 write a buffer of data into the file
SF_INFO * sfInfo ()
 perform sample-rate conversion
SNDFILE * sndFile ()
 libsndfile handle

Protected Member Functions

void initFromSndfile ()
 read SF header
void checkBuffer (unsigned numFrames)
 allocate buffer lazily

Protected Attributes

SF_INFO * mSFInfo
 libsndfile sf-info struct
SNDFILE * mSndfile
 libsndfile handle
Interleaver mInterleaver
 File IO interleaver/deinterleaver.


Detailed Description

Here's the sound file reader/writer class; it assumes libSndFile and interleaved sample buffers

Constructor & Destructor Documentation

LSoundFile::LSoundFile ( string  path,
int  start = -1,
int  stop = -1 
)

Constructor. Values not passed default to null.

References csl::Abst_SoundFile::mNumFrames, and mSFInfo.

LSoundFile::LSoundFile ( string  folder,
string  path,
int  start = -1,
int  stop = -1 
)

LSoundFile::LSoundFile ( LSoundFile otherSndFile  ) 

Copy constructor -- shares sample buffer.

References csl::Abst_SoundFile::isCached(), csl::kLogError, csl::logMsg(), and csl::Abst_SoundFile::mPath.

LSoundFile::~LSoundFile (  ) 


Member Function Documentation

SoundFileFormat LSoundFile::format (  )  [virtual]

void LSoundFile::openForRead (  )  throw (CException) [virtual]

void LSoundFile::openForWrite ( SoundFileFormat  format = kSoundFileFormatAIFF,
unsigned  channels = 1,
unsigned  rate = 44100,
unsigned  bitDepth = 16 
) throw (CException) [virtual]

Open a file for write. Default values are some common format.

Implements csl::Abst_SoundFile.

References csl::kLogError, kSoundFileFormatAIFF, kSoundFileFormatRaw, kSoundFileFormatSND, kSoundFileFormatWAV, kSoundFileWrite, and csl::logMsg().

void LSoundFile::openForReadWrite (  )  throw (CException)

void LSoundFile::close (  )  [virtual]

close file

Implements csl::Abst_SoundFile.

References csl::Abst_SoundFile::freeBuffer(), and mSndfile.

unsigned LSoundFile::seekTo ( int  position,
SeekPosition  whence = kPositionStart 
) throw (CException) [virtual]

seek to some position

Implements csl::Abst_SoundFile.

References csl::kPositionCurrent, csl::kPositionEnd, csl::kPositionStart, and csl::logMsg().

Referenced by initFromSndfile().

void LSoundFile::readBufferFromFile ( unsigned  numFrames  )  [virtual]

void LSoundFile::nextBuffer ( Buffer outB  )  throw (CException) [virtual]

void LSoundFile::writeBuffer ( Buffer inputBuffer  )  throw (CException) [virtual]

write a buffer of data into the file

Implements csl::Abst_SoundFile.

SF_INFO* csl::LSoundFile::sfInfo (  )  [inline]

perform sample-rate conversion

libsndfile sf-info struct

References mSFInfo.

SNDFILE* csl::LSoundFile::sndFile (  )  [inline]

libsndfile handle

References mSndfile.

void LSoundFile::initFromSndfile (  )  [protected, virtual]

void LSoundFile::checkBuffer ( unsigned  numFrames  )  [protected, virtual]

allocate buffer lazily

Reimplemented from csl::Abst_SoundFile.

References csl::CGestalt::maxBufferFrames(), and csl::UnitGenerator::mNumChannels.

Referenced by readBufferFromFile().


Member Data Documentation

SF_INFO* csl::LSoundFile::mSFInfo [protected]

SNDFILE* csl::LSoundFile::mSndfile [protected]

File IO interleaver/deinterleaver.

Referenced by readBufferFromFile().


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

Generated on Thu Sep 17 23:14:17 2009 for CSL by  doxygen 1.5.8