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   unsigned int channelsOut( void ) const { return data_.channels(); };
    00059
    00061
    00065   void normalize( void ) { FileWvIn::normalize( 1.0 ); };
    00066
    00068
    00072   void normalize( StkFloat peak ) { FileWvIn::normalize( peak ); };
    00073
    00075   unsigned long getSize( void ) const { return data_.frames(); };
    00076
    00078
    00083   StkFloat getFileRate( void ) const { return data_.dataRate(); };
    00084
    00086
    00089   void setRate( StkFloat rate );
    00090
    00092
    00098   void setFrequency( StkFloat frequency ) { this->setRate( file_.fileSize() * frequency / Stk::sampleRate() ); };
    00099
    00101   void addTime( StkFloat time );
    00102
    00104
    00109   void addPhase( StkFloat angle );
    00110
    00112
    00117   void addPhaseOffset( StkFloat angle );
    00118
    00120
    00129   StkFloat lastOut( unsigned int channel = 0 ) { return FileWvIn::lastOut( channel ); };
    00130
    00132
    00141   StkFloat tick( unsigned int channel = 0 );
    00142
    00144
    00153   StkFrames& tick( StkFrames& frames );
    00154
    00155  protected:
    00156
    00157   StkFrames firstFrame_;
    00158   StkFloat phaseOffset_;
    00159
    00160 };
    00161
    00162 } // stk namespace
    00163
    00164 #endif

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