The Synthesis ToolKit in C++ (STK)

Home Information Classes Download Usage Mail List Requirements Links FAQ Tutorial

# FileWrite.h

    00001 #ifndef STK_FILEWRITE_H
    00002 #define STK_FILEWRITE_H
    00003
    00004 #include "Stk.h"
    00005
    00006 namespace stk {
    00007
    00008 /***************************************************/
    00029 /***************************************************/
    00030
    00031 class FileWrite : public Stk
    00032 {
    00033  public:
    00034
    00035   typedef unsigned long FILE_TYPE;
    00036
    00037   static const FILE_TYPE FILE_RAW;
    00038   static const FILE_TYPE FILE_WAV;
    00039   static const FILE_TYPE FILE_SND;
    00040   static const FILE_TYPE FILE_AIF;
    00041   static const FILE_TYPE FILE_MAT;
    00043
    00044   FileWrite( void );
    00045
    00047
    00050   FileWrite( std::string fileName, unsigned int nChannels = 1, FILE_TYPE type = FILE_WAV, Stk::StkFormat format = STK_SINT16 );
    00051
    00053   virtual ~FileWrite();
    00054
    00056
    00059   void open( std::string fileName, unsigned int nChannels = 1,
    00060              FileWrite::FILE_TYPE type = FILE_WAV, Stk::StkFormat format = STK_SINT16 );
    00061
    00063   void close( void );
    00064
    00066   bool isOpen( void );
    00067
    00069
    00074   void write( StkFrames& buffer );
    00075
    00076  protected:
    00077
    00078   // Write STK RAW file header.
    00079   bool setRawFile( std::string fileName );
    00080
    00081   // Write WAV file header.
    00082   bool setWavFile( std::string fileName );
    00083
    00084   // Close WAV file, updating the header.
    00085   void closeWavFile( void );
    00086
    00087   // Write SND (AU) file header.
    00088   bool setSndFile( std::string fileName );
    00089
    00090   // Close SND file, updating the header.
    00091   void closeSndFile( void );
    00092
    00093   // Write AIFF file header.
    00094   bool setAifFile( std::string fileName );
    00095
    00096   // Close AIFF file, updating the header.
    00097   void closeAifFile( void );
    00098
    00099   // Write MAT-file header.
    00100   bool setMatFile( std::string fileName );
    00101
    00102   // Close MAT-file, updating the header.
    00103   void closeMatFile( void );
    00104
    00105   FILE *fd_;
    00106   FILE_TYPE fileType_;
    00107   StkFormat dataType_;
    00108   unsigned int channels_;
    00109   unsigned long frameCounter_;
    00110   bool byteswap_;
    00111
    00112 };
    00113
    00114 } // stk namespace
    00115
    00116 #endif

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