Skip to content

Commit a9e3f65

Browse files
committed
compile errors
1 parent 71773bf commit a9e3f65

File tree

2 files changed

+31
-30
lines changed

2 files changed

+31
-30
lines changed

src/AudioBasic/Int24.h

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class int24_t {
3232
}
3333

3434
int24_t(const int64_t &in) {
35-
set(in) ;
35+
set((int32_t)in) ;
3636
}
3737

3838
int24_t(const int24_t &in) {
@@ -72,24 +72,28 @@ class int24_t {
7272
return *this;
7373
}
7474

75-
operator int() const {
75+
operator int() {
7676
return toInt();
7777
}
7878

79-
operator int() {
79+
explicit operator float() {
80+
return toInt();
81+
}
82+
83+
explicit operator int64_t() {
8084
return toInt();
8185
}
8286

83-
int24_t& operator +=(int32_t value){
87+
int24_t& operator +=(int32_t valueA){
8488
int32_t temp = toInt();
85-
temp += value;
89+
temp += valueA;
8690
set(temp);
8791
return *this;
8892
}
8993

90-
int24_t& operator -=(int32_t value){
94+
int24_t& operator -=(int32_t valueA){
9195
int32_t temp = toInt();
92-
temp -= value;
96+
temp -= valueA;
9397
set(temp);
9498
return *this;
9599
}
@@ -100,16 +104,16 @@ class int24_t {
100104
}
101105

102106
/// convert to float
103-
float toFloat() const { return toInt(); }
107+
float toFloat() const { return (float)toInt(); }
104108

105109
/// provides value between -32767 and 32767
106110
int16_t scale16() const {
107-
return toInt() >> 8 ;
111+
return static_cast<int16_t>(toInt() >> 8) ;
108112
}
109113

110114
/// provides value between -2,147,483,647 and 2,147,483,647
111115
int32_t scale32() const {
112-
return toInt() << 8;
116+
return static_cast<int32_t>(toInt() << 8);
113117
}
114118

115119
/// provides value between -1.0 and 1.0
@@ -121,7 +125,7 @@ class int24_t {
121125
}
122126

123127
int16_t getAndScale16() {
124-
return value >> 16;
128+
return static_cast<int16_t>(value >> 16);
125129
}
126130

127131
private:

src/AudioCodecs/CodecBase64.h

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,22 @@ namespace audio_tools {
1414

1515

1616
enum Base46Logic { NoCR, CRforFrame, CRforWrite };
17+
static char encoding_table[] = {
18+
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M',
19+
'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
20+
'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm',
21+
'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
22+
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '+', '/'};
23+
static int mod_table[] = {0, 2, 1};
24+
25+
static const int B64index[256] = {
26+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
27+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
28+
0, 0, 0, 0, 0, 0, 0, 62, 63, 62, 62, 63, 52, 53, 54, 55, 56, 57,
29+
58, 59, 60, 61, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6,
30+
7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
31+
25, 0, 0, 0, 0, 63, 0, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36,
32+
37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51};
1733

1834
/**
1935
* @brief DecoderBase64 - Converts a Base64 encoded Stream into the original
@@ -89,7 +105,6 @@ class DecoderBase64 : public AudioDecoder {
89105
Vector<uint8_t> result;
90106
RingBuffer<uint8_t> buffer{1500};
91107
AudioInfo info;
92-
static const int B64index[256];
93108

94109
void decodeLine(uint8_t *data, size_t byteCount) {
95110
LOGD("decode: %d", (int)byteCount);
@@ -157,14 +172,6 @@ class DecoderBase64 : public AudioDecoder {
157172
}
158173
};
159174

160-
const int DecoderBase64::B64index[256] = {
161-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
162-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
163-
0, 0, 0, 0, 0, 0, 0, 62, 63, 62, 62, 63, 52, 53, 54, 55, 56, 57,
164-
58, 59, 60, 61, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6,
165-
7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
166-
25, 0, 0, 0, 0, 63, 0, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36,
167-
37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51};
168175

169176
/**
170177
* @brief EncoderBase64s - Encodes the input data into a Base64 string.
@@ -258,8 +265,6 @@ class EncoderBase64 : public AudioEncoder {
258265
Vector<uint8_t> ret;
259266
AudioInfo info;
260267
int frame_size;
261-
static char encoding_table[64];
262-
static int mod_table[3];
263268

264269
void flush() {
265270
#if defined(ESP32)
@@ -305,12 +310,4 @@ class EncoderBase64 : public AudioEncoder {
305310
}
306311
};
307312

308-
char EncoderBase64::encoding_table[] = {
309-
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M',
310-
'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
311-
'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm',
312-
'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
313-
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '+', '/'};
314-
int EncoderBase64::mod_table[] = {0, 2, 1};
315-
316313
} // namespace audio_tools

0 commit comments

Comments
 (0)