Home Information Classes Download Usage Mail List Requirements Links FAQ Tutorial
00001 /***************************************************/ 00030 /***************************************************/ 00031 00032 #ifndef STK_FILEREAD_H 00033 #define STK_FILEREAD_H 00034 00035 #include "Stk.h" 00036 00037 class FileRead : public Stk 00038 { 00039 public: 00041 FileRead(); 00042 00044 00050 FileRead( std::string fileName, bool typeRaw = false, unsigned int nChannels = 1, 00051 StkFormat format = STK_SINT16, StkFloat rate = 22050.0 ); 00052 00054 ~FileRead(); 00055 00057 00063 void open( std::string fileName, bool typeRaw = false, unsigned int nChannels = 1, 00064 StkFormat format = STK_SINT16, StkFloat rate = 22050.0 ); 00065 00067 void close( void ); 00068 00070 bool isOpen( void ); 00071 00073 unsigned long fileSize( void ) const { return fileSize_; }; 00074 00076 unsigned int channels( void ) const { return channels_; }; 00077 00079 00084 StkFloat fileRate( void ) const { return fileRate_; }; 00085 00087 00099 void read( StkFrames& buffer, unsigned long startFrame = 0, bool doNormalize = true ); 00100 00101 protected: 00102 00103 // Get STK RAW file information. 00104 bool getRawInfo( const char *fileName, unsigned int nChannels, 00105 StkFormat format, StkFloat rate ); 00106 00107 // Get WAV file header information. 00108 bool getWavInfo( const char *fileName ); 00109 00110 // Get SND (AU) file header information. 00111 bool getSndInfo( const char *fileName ); 00112 00113 // Get AIFF file header information. 00114 bool getAifInfo( const char *fileName ); 00115 00116 // Get MAT-file header information. 00117 bool getMatInfo( const char *fileName ); 00118 00119 FILE *fd_; 00120 bool byteswap_; 00121 bool wavFile_; 00122 unsigned long fileSize_; 00123 unsigned long dataOffset_; 00124 unsigned int channels_; 00125 StkFormat dataType_; 00126 StkFloat fileRate_; 00127 }; 00128 00129 #endif
The Synthesis ToolKit in C++ (STK) |
©1995-2007 Perry R. Cook and Gary P. Scavone. All Rights Reserved. |