Arduino STK  4.6.2
MemoryLoop.h
1 
2 #include "FileLoop.h"
3 #include "MemoryFS.h"
4 
5 #ifdef __RAW_ARRAYS__
6 
7 #ifndef STK_MEMORYLOOP_H
8 #define STK_MEMORYLOOP_H
9 
10 
11 namespace stk {
12 
13 /***************************************************/
27 /***************************************************/
28 
29 class MemoryLoop : public FileLoop {
30 
31  public:
33  MemoryLoop(unsigned long chunkSize=256);
34 
36  MemoryLoop(const char* fileName, const unsigned char *data, size_t size, unsigned long chunkSize=256);
37 
39  MemoryLoop(const char* fileName, unsigned long chunkSize=256);
40 
42  MemoryLoop(MemoryFS *data, unsigned long chunkSize=256);
43 
45  ~MemoryLoop( void );
46 
48 
51  virtual void openFile( std::string fileName, bool raw = true, bool doNormalize = true, bool doInt2FloatScaling = true );
52 
54 
57  virtual void openFile( const char* fileName, bool raw = true, bool doNormalize = true, bool doInt2FloatScaling = true );
58 
60 
65  void addPhaseOffset( StkFloat angle );
66 
68 
71  void closeFile(void );
72 
74 
78  bool isOpen(void );
79 
81 
84  StkFloat getFileRate( void );
85 
86 
87 protected:
88  virtual void fileRead( StkFrames& buffer, unsigned long startFrame, bool doNormalize );
89  virtual void open(MemoryFS *fs, bool owning_fs_ptr, bool doNormalize=true,bool doInt2FloatScaling=true);
90 
91  MemoryFS *fs_ptr;
92  bool owning_fs_ptr;
93 
94  StkFrames firstFrame_;
95  StkFloat phaseOffset_;
96 
97 };
98 
99 } // stk namespace
100 
101 #endif
102 #endif
STK file looping / oscillator class.
Definition: FileLoop.h:27
STK in memory File An instance is representing an individual memory array which can be registered wit...
Definition: MemoryFS.h:46
STK looping / oscillator class using a simple memory array as input.
Definition: MemoryLoop.h:29
MemoryLoop(MemoryFS *data, unsigned long chunkSize=256)
Class constructor that uses a MemoryFS.
MemoryLoop(const char *fileName, const unsigned char *data, size_t size, unsigned long chunkSize=256)
Class constructor that opens a specified file.
~MemoryLoop(void)
Class destructor.
StkFloat getFileRate(void)
Return the input file sample rate in Hz (not the data read rate).
MemoryLoop(unsigned long chunkSize=256)
Default constructor.
bool isOpen(void)
Query whether a file is open.
MemoryLoop(const char *fileName, unsigned long chunkSize=256)
Class constructor that opens a specified file. The file must have been registered.
virtual void openFile(const char *fileName, bool raw=true, bool doNormalize=true, bool doInt2FloatScaling=true)
Open the specified file and load its data.
virtual void openFile(std::string fileName, bool raw=true, bool doNormalize=true, bool doInt2FloatScaling=true)
Open the specified file and load its data.
void closeFile(void)
Close the actual file.
void addPhaseOffset(StkFloat angle)
Add a phase offset to the current read pointer.
An STK class to handle vectorized audio data.
Definition: Stk.h:287
The STK namespace.
Definition: ADSR.h:8