Home Information Classes Download Usage Mail List Requirements Links FAQ Tutorial

# FileLoop.h

    00001 #ifndef STK_FILELOOP_H
    00002 #define STK_FILELOOP_H
    00003
    00004 #include "FileWvIn.h"
    00005
    00006 namespace stk {
    00007
    00008 /***************************************************/
    00024 /***************************************************/
    00025
    00026 class FileLoop : protected FileWvIn
    00027 {
    00028  public:
    00030   FileLoop( unsigned long chunkThreshold = 1000000, unsigned long chunkSize = 1024 );
    00031
    00033   FileLoop( std::string fileName, bool raw = false, bool doNormalize = true,
    00034             unsigned long chunkThreshold = 1000000, unsigned long chunkSize = 1024 );
    00035
    00037   ~FileLoop( void );
    00038
    00040
    00049   void openFile( std::string fileName, bool raw = false, bool doNormalize = true );
    00050
    00052   void closeFile( void ) { FileWvIn::closeFile(); };
    00053
    00055   void reset( void ) { FileWvIn::reset(); };
    00056
    00058
    00062   void normalize( void ) { FileWvIn::normalize( 1.0 ); };
    00063
    00065
    00069   void normalize( StkFloat peak ) { FileWvIn::normalize( peak ); };
    00070
    00072   unsigned long getSize( void ) const { return data_.frames(); };
    00073
    00075
    00080   StkFloat getFileRate( void ) const { return data_.dataRate(); };
    00081
    00083
    00086   void setRate( StkFloat rate );
    00087
    00089
    00095   void setFrequency( StkFloat frequency ) { this->setRate( file_.fileSize() * frequency / Stk::sampleRate() ); };
    00096
    00098   void addTime( StkFloat time );
    00099
    00101
    00106   void addPhase( StkFloat angle );
    00107
    00109
    00114   void addPhaseOffset( StkFloat angle );
    00115
    00117
    00126   StkFloat lastOut( unsigned int channel = 0 ) { return FileWvIn::lastOut( channel ); };
    00127
    00129
    00138   StkFloat tick( unsigned int channel = 0 );
    00139
    00141
    00150   StkFrames& tick( StkFrames& frames );
    00151
    00152  protected:
    00153
    00154   StkFrames firstFrame_;
    00155   StkFloat phaseOffset_;
    00156
    00157 };
    00158
    00159 } // stk namespace
    00160
    00161 #endif

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