Skip to content

Commit ca6d453

Browse files
committed
MemoryLoop
1 parent 776c9a1 commit ca6d453

File tree

4 files changed

+11
-13
lines changed

4 files changed

+11
-13
lines changed

examples/Instrument/Instrument.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#include "StkAll.h"
33

44
ArdStreamTextOut output(Serial);
5-
Drummer instrument;
5+
BeeThree instrument;
66
//Clarinet instrument(440);
77
int note = 90; // starting midi note
88

src/FileLoop.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ class FileLoop : protected FileWvIn
8383
their headers. STK RAW files have a sample rate of 22050 Hz
8484
by definition. MAT-files are assumed to have a rate of 44100 Hz.
8585
*/
86-
StkFloat getFileRate( void ) const { return data_.dataRate(); };
86+
virtual StkFloat getFileRate( void ) const { return data_.dataRate(); };
8787

8888
//! Set the data read rate in samples. The rate can be negative.
8989
/*!
@@ -117,7 +117,7 @@ class FileLoop : protected FileWvIn
117117
size and the current Stk::sampleRate. The \e angle value
118118
is a multiple of file size.
119119
*/
120-
void addPhaseOffset( StkFloat angle );
120+
virtual void addPhaseOffset( StkFloat angle );
121121

122122
//! Return the specified channel value of the last computed frame.
123123
/*!
@@ -154,7 +154,7 @@ class FileLoop : protected FileWvIn
154154
virtual StkFrames& tick( StkFrames& frames,unsigned int channel = 0 );
155155

156156
protected:
157-
void fileRead( StkFrames& buffer, unsigned long startFrame, bool doNormalize );
157+
virtual void fileRead( StkFrames& buffer, unsigned long startFrame, bool doNormalize );
158158

159159
StkFrames firstFrame_;
160160
StkFloat phaseOffset_;

src/MemoryLoop.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ void MemoryLoop :: closeFile( void ){
111111
finished_ = true;
112112
}
113113

114-
StkFloat MemoryLoop :: getFileRate( void ) {
114+
StkFloat MemoryLoop :: getFileRate( void ) const {
115115
return 22050.0;
116116
}
117117

src/MemoryLoop.h

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,48 +45,46 @@ class MemoryLoop : public FileLoop {
4545
/*!
4646
This method is provided to be compatible with the FileWvIn
4747
*/
48-
virtual void openFile( std::string fileName, bool raw = true, bool doNormalize = true, bool doInt2FloatScaling = true );
48+
virtual void openFile( std::string fileName, bool raw = true, bool doNormalize = true, bool doInt2FloatScaling = true ) override;
4949

5050
//! Open the specified file and load its data.
5151
/*!
5252
This method is provided to be compatible with the FileWvIn
5353
*/
54-
virtual void openFile( const char* fileName, bool raw = true, bool doNormalize = true, bool doInt2FloatScaling = true );
54+
virtual void openFile( const char* fileName, bool raw = true, bool doNormalize = true, bool doInt2FloatScaling = true ) ;
5555

5656
//! Add a phase offset to the current read pointer.
5757
/*!
5858
This function determines a time offset based on the file
5959
size and the current Stk::sampleRate. The \e angle value
6060
is a multiple of file size.
6161
*/
62-
void addPhaseOffset( StkFloat angle );
62+
void addPhaseOffset( StkFloat angle ) override;
6363

6464
//! Close the actual file
6565
/*!
6666
This method is provided to be compatible with the FileWvIn
6767
*/
68-
void closeFile(void );
68+
void closeFile(void ) override;
6969

7070
//! Query whether a file is open.
7171
/*!
7272
This does not have any importance since the data is available in the memory
7373
anyhow.
7474
*/
75-
bool isOpen(void );
75+
bool isOpen(void ) override;
7676

7777
//! Return the input file sample rate in Hz (not the data read rate).
7878
/*!
7979
STK RAW files have a sample rate of 22050 Hz
8080
*/
81-
StkFloat getFileRate( void );
82-
81+
virtual StkFloat getFileRate( void ) const override;
8382

8483
protected:
8584
virtual void fileRead( StkFrames& buffer, unsigned long startFrame, bool doNormalize ) override;
8685
virtual void open(bool doNormalize=true,bool doInt2FloatScaling=true);
8786

8887
MemoryFS memoryFS;
89-
9088
StkFrames firstFrame_;
9189
StkFloat phaseOffset_;
9290

0 commit comments

Comments
 (0)