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
10namespace stk {
11
12/***************************************************/
28/***************************************************/
29
30class MemoryWvIn : public FileWvIn
31{
32public:
34 MemoryWvIn(unsigned long chunkSize=512);
35
37
40 MemoryWvIn(std::string fileName, const unsigned char *data, size_t size, unsigned long chunkSize=256);
41
43
46 MemoryWvIn(std::string fileName, unsigned long chunkSize=256);
47
48
50 ~MemoryWvIn( void );
51
53
56 virtual void openFile( std::string fileName, bool raw = true, bool doNormalize = true, bool doInt2FloatScaling = true );
57
59
62 virtual void openFile( const char* fileName, bool raw = true, bool doNormalize = true, bool doInt2FloatScaling = true );
63
65 virtual void closeFile( void );
66
68
71 virtual StkFloat getFileRate( void );
72
74
78 bool isOpen( void );
79
81
87 void setFrequency( StkFloat frequency ) { this->setRate( fileSize_ * frequency / Stk::sampleRate() ); };
88
89
90protected:
91 virtual void fileRead( StkFrames& buffer, unsigned long startFrame, bool doNormalize );
92
93 MemoryFS fs;
94};
95
96} // stk namespace
97
98#endif
99#endif
FileWvIn(unsigned long chunkThreshold=1000000, unsigned long chunkSize=1024)
Default constructor.
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:52
MemoryWvIn(std::string fileName, unsigned long chunkSize=256)
Overloaded constructor for file input.
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(std::string 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(unsigned long chunkSize=512)
Default constructor.
void setFrequency(StkFloat frequency)
Set the data interpolation rate based on a looping frequency.
Definition MemoryWvIn.h:87
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