Arduino STK  4.6.2
MemoryWvIn.h
1 #ifndef STK_MEMORYWVIN_H
2 #define STK_MEMORYWVIN_H
3 
4 #include "FileWvIn.h"
5 #include "MemoryFS.h"
6 #ifdef __RAW_ARRAYS__
7 
8 //#include <math.h>
9 
10 namespace stk {
11 
12 /***************************************************/
28 /***************************************************/
29 
30 class MemoryWvIn : public FileWvIn
31 {
32 public:
34  MemoryWvIn(unsigned long chunkSize=512);
35 
37 
40  MemoryWvIn(const char* fileName, const unsigned char *data, size_t size, unsigned long chunkSize=256);
41 
42 
44 
47  MemoryWvIn(const char* fileName, unsigned long chunkSize=256);
48 
49 
51  ~MemoryWvIn( void );
52 
54 
57  virtual void openFile( std::string fileName, bool raw = true, bool doNormalize = true, bool doInt2FloatScaling = true );
58 
60 
63  virtual void openFile( const char* fileName, bool raw = true, bool doNormalize = true, bool doInt2FloatScaling = true );
64 
66  virtual void closeFile( void );
67 
69 
72  virtual StkFloat getFileRate( void );
73 
75 
79  bool isOpen( void );
80 
82 
88  void setFrequency( StkFloat frequency ) { this->setRate( fileSize_ * frequency / Stk::sampleRate() ); };
89 
90 
91 protected:
92  virtual void fileRead( StkFrames& buffer, unsigned long startFrame, bool doNormalize );
93 
94  MemoryFS fs;
95 };
96 
97 } // stk namespace
98 
99 #endif
100 #endif
STK audio file input class.
Definition: FileWvIn.h:53
virtual void setRate(StkFloat rate)
Set the data read rate in samples. The rate can be negative.
STK in memory File An instance is representing an individual memory array which can be registered wit...
Definition: MemoryFS.h:46
STK audio input class from Memory.
Definition: MemoryWvIn.h:31
virtual void openFile(std::string fileName, bool raw=true, bool doNormalize=true, bool doInt2FloatScaling=true)
Open the specified file and load its data.
virtual StkFloat getFileRate(void)
Return the input file sample rate in Hz (not the data read rate).
MemoryWvIn(const char *fileName, const unsigned char *data, size_t size, unsigned long chunkSize=256)
Overloaded constructor for file input.
virtual void closeFile(void)
Close a file if one is open.
~MemoryWvIn(void)
Class destructor.
virtual void openFile(const char *fileName, bool raw=true, bool doNormalize=true, bool doInt2FloatScaling=true)
Open the specified file and load its data.
MemoryWvIn(const char *fileName, unsigned long chunkSize=256)
Overloaded constructor for file input.
MemoryWvIn(unsigned long chunkSize=512)
Default constructor.
void setFrequency(StkFloat frequency)
Set the data interpolation rate based on a looping frequency.
Definition: MemoryWvIn.h:88
bool isOpen(void)
Query whether a file is open.
An STK class to handle vectorized audio data.
Definition: Stk.h:287
static StkFloat sampleRate(void)
Static method that returns the current STK sample rate.
Definition: Stk.h:156
The STK namespace.
Definition: ADSR.h:8