Home Information Classes Download Usage Mail List Requirements Links FAQ Tutorial

FileLoop.h
1 #ifndef STK_FILELOOP_H
2 #define STK_FILELOOP_H
3
4 #include "FileWvIn.h"
5
6 namespace stk {
7
8 /***************************************************/
24 /***************************************************/
25
26 class FileLoop : protected FileWvIn
27 {
28 public:
30 FileLoop( unsigned long chunkThreshold = 1000000, unsigned long chunkSize = 1024 );
31
33 FileLoop( std::string fileName, bool raw = false, bool doNormalize = true,
34 unsigned long chunkThreshold = 1000000, unsigned long chunkSize = 1024,
35 bool doInt2FloatScaling = true );
36
38 ~FileLoop( void );
39
41
51 void openFile( std::string fileName, bool raw = false, bool doNormalize = true, bool doInt2FloatScaling = true );
52
54 void closeFile( void ) { FileWvIn::closeFile(); };
55
57 void reset( void ) { FileWvIn::reset(); };
58
60 unsigned int channelsOut( void ) const { return data_.channels(); };
61
63
67 void normalize( void ) { FileWvIn::normalize( 1.0 ); };
68
70
74 void normalize( StkFloat peak ) { FileWvIn::normalize( peak ); };
75
77 unsigned long getSize( void ) const { return data_.frames(); };
78
80
85 StkFloat getFileRate( void ) const { return data_.dataRate(); };
86
88
91 void setRate( StkFloat rate );
92
94
100 void setFrequency( StkFloat frequency ) { this->setRate( fileSize_ * frequency / Stk::sampleRate() ); };
101
103 void addTime( StkFloat time );
104
106
111 void addPhase( StkFloat angle );
112
114
119 void addPhaseOffset( StkFloat angle );
120
122
131 StkFloat lastOut( unsigned int channel = 0 ) { return FileWvIn::lastOut( channel ); };
132
134
143 StkFloat tick( unsigned int channel = 0 );
144
146
153 virtual StkFrames& tick( StkFrames& frames,unsigned int channel = 0 );
154
155 protected:
156
157 StkFrames firstFrame_;
158 StkFloat phaseOffset_;
159
160 };
161
162 } // stk namespace
163
164 #endif

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