FileIO.h

Go to the documentation of this file.
00001 //
00002 //  FileIO.h -- IO using a sound file for writing data to sound files
00003 //  See the copyright notice and acknowledgment of authors in the file COPYRIGHT
00004 //
00005 
00006 #ifndef CSL_FileIO_H
00007 #define CSL_FileIO_H
00008 
00009 #include "CSL_Includes.h"
00010 #include "ThreadUtilities.h"            // PThread utilities
00011 
00012                                         // what to call the output by default
00013 #define DEFAULT_SND_FILE_NAME "csl_out.aiff"
00014 
00015 namespace csl {
00016 
00020 
00021 class FileIO : public IO {
00022 public:
00024     FileIO(char *path = DEFAULT_SND_FILE_NAME);
00025     ~FileIO();
00026 
00027     bool mIsPlaying;                    
00028     bool mIsThreadRunning;              
00029     unsigned mDuration;                 
00030     void open() throw(CException);
00034     void start(float seconds = 0) throw(CException);
00035     void stop() throw(CException);
00036     void close() throw(CException);
00037     void test() throw(CException) { };  
00038 
00039     Buffer & getInput() throw(CException) { return mInBuffer; };
00040     Buffer & getInput(unsigned numFrames, unsigned numChannels) throw(CException) { return mInBuffer; };
00041 
00042 protected:
00043     char *mPath;                        // the output file name
00044     SoundFile mFile;                    // the output sound file
00045     Thread *mThread;                    // the background thread
00046     static void *threadFunction(void *); // the background thread function
00047 
00048     Buffer mInBuffer;                   // buffer we use for input
00049     Buffer mOutBuffer;                  // buffer we use for output
00050     void writeNextBuffer();
00051 };
00052 
00053 }
00054 
00055 #endif
00056 

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