Skip to content

Commit 21bfd84

Browse files
committed
remove dependencies from Arduino
1 parent 793bbc3 commit 21bfd84

File tree

3 files changed

+19
-12
lines changed

3 files changed

+19
-12
lines changed

src/AACDecoderHelix.h

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,12 @@ class AACDecoderHelix : public CommonHelix {
2121
AACDecoderHelix() {
2222
}
2323

24+
#ifdef ARDUINO
2425
AACDecoderHelix(Print &output, AACInfoCallback infoCallback=nullptr){
2526
this->out = &output;
2627
this->infoCallback = infoCallback;
2728
}
28-
29+
#endif
2930
AACDecoderHelix(AACDataCallback dataCallback){
3031
this->pwmCallback = dataCallback;
3132
}
@@ -37,10 +38,6 @@ class AACDecoderHelix : public CommonHelix {
3738
this->pwmCallback = cb;
3839
}
3940

40-
void setOutput(Print &output){
41-
this->out = &output;
42-
}
43-
4441
/// Starts the processing
4542
void begin(){
4643
LOG(Debug, "begin");
@@ -133,7 +130,9 @@ class AACDecoderHelix : public CommonHelix {
133130
if (info.sampRateOut!=aacFrameInfo.sampRateOut && infoCallback!=nullptr){
134131
infoCallback(info);
135132
}
133+
#ifdef ARDUINO
136134
out->write((uint8_t*)pwm_buffer, info.outputSamps);
135+
#endif
137136
}
138137
aacFrameInfo = info;
139138
}

src/CommonHelix.h

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
#pragma once
2+
3+
#ifdef ARDUINO
24
#include "Arduino.h"
5+
#endif
36

47
// User Settings: Activate/Deactivate logging
58
#ifndef HELIX_LOGGING_ACTIVE
@@ -57,6 +60,12 @@ class CommonHelix {
5760
}
5861
}
5962

63+
#ifdef ARDUINO
64+
void setOutput(Print &output){
65+
this->out = &output;
66+
}
67+
#endif
68+
6069
/**
6170
* @brief Starts the processing
6271
*
@@ -126,8 +135,9 @@ class CommonHelix {
126135

127136
protected:
128137
bool active = false;
138+
#ifdef ARDUINO
129139
Print *out = nullptr;
130-
Stream *in = nullptr;
140+
#endif
131141
uint32_t buffer_size = 0; // actually filled sized
132142
uint8_t *frame_buffer = nullptr;
133143
short *pwm_buffer = nullptr;

src/MP3DecoderHelix.h

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,13 @@ class MP3DecoderHelix : public CommonHelix {
2828
this->mp3_type = MP3Normal;
2929
}
3030

31+
#ifdef ARDUINO
3132
MP3DecoderHelix(Print &output, MP3Type mp3Type=MP3Normal, MP3InfoCallback infoCallback=nullptr){
3233
this->out = &output;
3334
this->infoCallback = infoCallback;
3435
this->mp3_type = mp3Type;
3536
}
36-
37+
#endif
3738
MP3DecoderHelix(MP3DataCallback dataCallback, MP3Type mp3Type=MP3Normal){
3839
this->pwmCallback = dataCallback;
3940
this->mp3_type = mp3Type;
@@ -51,11 +52,6 @@ class MP3DecoderHelix : public CommonHelix {
5152
this->pwmCallback = cb;
5253
}
5354

54-
void setOutput(Print &output){
55-
this->out = &output;
56-
}
57-
58-
5955
/// Starts the processing
6056
void begin(){
6157
LOG(Debug, "begin");
@@ -155,7 +151,9 @@ class MP3DecoderHelix : public CommonHelix {
155151
if (info.samprate!=mp3FrameInfo.samprate && infoCallback!=nullptr){
156152
infoCallback(mp3FrameInfo);
157153
}
154+
#ifdef ARDUINO
158155
out->write((uint8_t*)pwm_buffer, info.outputSamps);
156+
#endif
159157
}
160158
mp3FrameInfo = info;
161159
}

0 commit comments

Comments
 (0)