00001 // 00002 // FileIO.h -- IO using libsndfile 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" 00011 #include "SoundFile.h" 00012 00013 namespace csl { 00014 00015 class FileIO : public IO { 00016 public: 00017 FileIO(char *path); 00018 ~FileIO(); 00019 00020 bool mIsPlaying; 00021 bool mIsThreadRunning; 00022 unsigned mDuration; 00023 void open() throw(CException); 00026 void start(float seconds = 0) throw(CException); 00027 void stop() throw(CException); 00028 void close() throw(CException); 00029 void test() throw(CException) {}; 00030 Buffer & getInput() throw(CException) { return mInBuffer; }; 00031 Buffer & getInput(unsigned numFrames, unsigned numChannels) throw(CException) { return mInBuffer; }; 00032 00033 protected: 00034 char *mPath; // the output file name 00035 SoundFile mFile; // the output sound file 00036 Thread *mThread; // the background thread 00037 static void *threadFunction(void *); // the background thread function 00038 00039 Buffer mInBuffer; // buffer we use for input 00040 Buffer mOutBuffer; // buffer we use for output 00041 void writeNextBuffer(); 00042 00043 }; 00044 00045 } 00046 00047 #endif 00048
1.4.5-20051010