Skip to content

Commit d37fab1

Browse files
dcoredumpHolger Wirtz
andauthored
Fixing compiler errors for Arduino-IDE with TeensyDuino. (#60)
Co-authored-by: Holger Wirtz <[email protected]>
1 parent 67dfc14 commit d37fab1

File tree

2 files changed

+20
-20
lines changed

2 files changed

+20
-20
lines changed

src/IndexableFile.h

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,20 @@ constexpr bool isPowerOf2(size_t value){
2020

2121
template<size_t BUFFER_SIZE, size_t MAX_NUM_BUFFERS, class TFile> // BUFFER_SIZE needs to be a power of two
2222
class IndexableFile {
23+
protected:
24+
TFile _file;
25+
char *_filename;
26+
std::vector<indexedbuffer*> _buffers;
27+
28+
indexedbuffer* find_with_index(uint32_t i) {
29+
for (auto && x : _buffers){
30+
if (x->index == i) {
31+
return x;
32+
}
33+
}
34+
return nullptr;
35+
}
36+
2337
public:
2438
static_assert(isPowerOf2(BUFFER_SIZE), "BUFFER_SIZE must be a power of 2");
2539

@@ -85,20 +99,6 @@ class IndexableFile {
8599
_filename = nullptr;
86100
}
87101
}
88-
89-
protected:
90-
TFile _file;
91-
char *_filename;
92-
std::vector<indexedbuffer*> _buffers;
93-
94-
indexedbuffer* find_with_index(uint32_t i) {
95-
for (auto && x : _buffers){
96-
if (x->index == i) {
97-
return x;
98-
}
99-
}
100-
return nullptr;
101-
}
102102
};
103103

104104
}

src/ResamplingReader.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -268,11 +268,11 @@ class ResamplingReader {
268268
}
269269
} else {
270270
if (_playbackRate >= 0.0) {
271-
if (_crossfade == 0.0 && _bufferPosition1 > (_loop_finish - _numChannels) - _crossfadeDurationInSamples) {
271+
if (_crossfade == 0.0 && _bufferPosition1 > int32_t((_loop_finish - _numChannels) - _crossfadeDurationInSamples)) {
272272
_bufferPosition2 = _loop_start;
273273
_crossfade = 1.0 - (( (_loop_finish-_numChannels) - _bufferPosition1 ) / static_cast<double>(_crossfadeDurationInSamples));
274274
_crossfadeState = 1;
275-
} else if (_crossfade == 1.0 && _bufferPosition2 > (_loop_finish - _numChannels)- _crossfadeDurationInSamples) {
275+
} else if (_crossfade == 1.0 && _bufferPosition2 > int32_t((_loop_finish - _numChannels)- _crossfadeDurationInSamples)) {
276276
_bufferPosition1 = _loop_start;
277277
_crossfade = ((_loop_finish - _numChannels) - _bufferPosition2) / static_cast<double>(_crossfadeDurationInSamples);
278278
_crossfadeState = 2;
@@ -290,11 +290,11 @@ class ResamplingReader {
290290
}
291291
}
292292
} else {
293-
if (_crossfade == 0.0 && _bufferPosition1 < _crossfadeDurationInSamples + _header_offset) {
293+
if (_crossfade == 0.0 && _bufferPosition1 < int32_t(_crossfadeDurationInSamples + _header_offset)) {
294294
_bufferPosition2 = _loop_finish - _numChannels;
295295
_crossfade = 1.0 - (_bufferPosition1 - _header_offset) / static_cast<double>(_crossfadeDurationInSamples);
296296
_crossfadeState = 1;
297-
} else if (_crossfade == 1.0 && _bufferPosition2 < _crossfadeDurationInSamples + _header_offset) {
297+
} else if (_crossfade == 1.0 && _bufferPosition2 < int32_t(_crossfadeDurationInSamples + _header_offset)) {
298298
_bufferPosition1 = _loop_finish - _numChannels;
299299
_crossfade = (_bufferPosition2 - _header_offset) / static_cast<double>(_crossfadeDurationInSamples);
300300
_crossfadeState = 2;
@@ -659,8 +659,8 @@ class ResamplingReader {
659659
double _remainder = 0.0;
660660
loop_type _loopType = loop_type::looptype_none;
661661
play_start _play_start = play_start::play_start_sample;
662-
int _bufferPosition1 = 0;
663-
int _bufferPosition2 = 0;
662+
int32_t _bufferPosition1 = 0;
663+
int32_t _bufferPosition2 = 0;
664664
double _crossfade = 0.0;
665665
bool _useDualPlaybackHead = false;
666666
unsigned int _crossfadeDurationInSamples = 256;

0 commit comments

Comments
 (0)