Home Information Classes Download Usage Mail List Requirements Links FAQ Tutorial

# FileRead.h

    00001 #ifndef STK_FILEREAD_H
    00002 #define STK_FILEREAD_H
    00003
    00004 #include "Stk.h"
    00005
    00006 namespace stk {
    00007
    00008 /***************************************************/
    00037 /***************************************************/
    00038
    00039 class FileRead : public Stk
    00040 {
    00041 public:
    00043   FileRead( void );
    00044
    00046
    00052   FileRead( std::string fileName, bool typeRaw = false, unsigned int nChannels = 1,
    00053             StkFormat format = STK_SINT16, StkFloat rate = 22050.0 );
    00054
    00056   ~FileRead( void );
    00057
    00059
    00065   void open( std::string fileName, bool typeRaw = false, unsigned int nChannels = 1,
    00066              StkFormat format = STK_SINT16, StkFloat rate = 22050.0 );
    00067
    00069   void close( void );
    00070
    00072   bool isOpen( void );
    00073
    00075   unsigned long fileSize( void ) const { return fileSize_; };
    00076
    00078   unsigned int channels( void ) const { return channels_; };
    00079
    00081
    00086   StkFloat fileRate( void ) const { return fileRate_; };
    00087
    00089
    00101   void read( StkFrames& buffer, unsigned long startFrame = 0, bool doNormalize = true );
    00102
    00103 protected:
    00104
    00105   // Get STK RAW file information.
    00106   bool getRawInfo( const char *fileName, unsigned int nChannels,
    00107                    StkFormat format, StkFloat rate );
    00108
    00109   // Get WAV file header information.
    00110   bool getWavInfo( const char *fileName );
    00111
    00112   // Get SND (AU) file header information.
    00113   bool getSndInfo( const char *fileName );
    00114
    00115   // Get AIFF file header information.
    00116   bool getAifInfo( const char *fileName );
    00117
    00118   // Get MAT-file header information.
    00119   bool getMatInfo( const char *fileName );
    00120
    00121   FILE *fd_;
    00122   bool byteswap_;
    00123   bool wavFile_;
    00124   unsigned long fileSize_;
    00125   unsigned long dataOffset_;
    00126   unsigned int channels_;
    00127   StkFormat dataType_;
    00128   StkFloat fileRate_;
    00129 };
    00130
    00131 } // stk namespace
    00132
    00133 #endif

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