Home   Information   Classes   Download   Usage   Mail List   Requirements   Links   FAQ   Tutorial


FileRead.h

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 
00048   FileRead( std::string fileName, bool typeRaw = false );
00049 
00051   ~FileRead();
00052 
00054 
00060   void open( std::string fileName, bool typeRaw = false );
00061 
00063   void close( void );
00064 
00066   bool isOpen( void );
00067 
00069   unsigned long fileSize( void ) const { return fileSize_; };
00070 
00072   unsigned int channels( void ) const { return channels_; };
00073 
00075 
00080   StkFloat fileRate( void ) const { return fileRate_; };
00081 
00083 
00095   void read( StkFrames& buffer, unsigned long startFrame = 0, bool doNormalize = true );
00096 
00097 protected:
00098 
00099   // Get STK RAW file information.
00100   bool getRawInfo( const char *fileName );
00101 
00102   // Get WAV file header information.
00103   bool getWavInfo( const char *fileName );
00104 
00105   // Get SND (AU) file header information.
00106   bool getSndInfo( const char *fileName );
00107 
00108   // Get AIFF file header information.
00109   bool getAifInfo( const char *fileName );
00110 
00111   // Get MAT-file header information.
00112   bool getMatInfo( const char *fileName );
00113 
00114   FILE *fd_;
00115   bool byteswap_;
00116   bool wavFile_;
00117   unsigned long fileSize_;
00118   unsigned long dataOffset_;
00119   unsigned int channels_;
00120   StkFormat dataType_;
00121   StkFloat fileRate_;
00122 };
00123 
00124 #endif

The Synthesis ToolKit in C++ (STK)
©1995-2007 Perry R. Cook and Gary P. Scavone. All Rights Reserved.