Skip to content

Commit e3c066c

Browse files
committed
Fix CodecAPTX
1 parent ee9c323 commit e3c066c

File tree

2 files changed

+13
-12
lines changed

2 files changed

+13
-12
lines changed

src/AudioBasic/Int24Ex.h renamed to src/AudioBasic/Int24x.h

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,31 +13,31 @@ namespace audio_tools {
1313
* @copyright GPLv3
1414
*
1515
*/
16-
class int24_t {
16+
class int24x_t {
1717
public:
18-
int24_t() {
18+
int24x_t() {
1919
value[0] = 0;
2020
value[1] = 0;
2121
value[2] = 0;
2222
}
2323

24-
int24_t(void *ptr) {
24+
int24x_t(void *ptr) {
2525
memcpy(value, ptr, 3);
2626
}
2727

28-
int24_t(const int16_t &in) {
28+
int24x_t(const int16_t &in) {
2929
value[2] = in > 0 ? 0 : 0xFF;
3030
value[1] = (in >> 8) & 0xFF;
3131
value[0] = in & 0xFF;
3232
}
3333

34-
int24_t(const int32_t &in) {
34+
int24x_t(const int32_t &in) {
3535
set(in);
3636
}
3737

3838
#if defined(STM32) || defined(ESP32C3)
3939

40-
int24_t(const int &in) {
40+
int24x_t(const int &in) {
4141
set(in);
4242
}
4343

@@ -49,12 +49,12 @@ class int24_t {
4949
value[0] = in & 0xFF;
5050
}
5151

52-
int24_t& operator=(const int24_t& other){
52+
int24x_t& operator=(const int24x_t& other){
5353
set(other);
5454
return *this;
5555
}
5656

57-
int24_t& operator=(const float& other){
57+
int24x_t& operator=(const float& other){
5858
set((int32_t)other);
5959
return *this;
6060
}
@@ -63,14 +63,14 @@ class int24_t {
6363
return toInt();
6464
}
6565

66-
int24_t& operator +=(int32_t value){
66+
int24x_t& operator +=(int32_t value){
6767
int32_t temp = toInt();
6868
temp += value;
6969
set(temp);
7070
return *this;
7171
}
7272

73-
int24_t& operator -=(int32_t value){
73+
int24x_t& operator -=(int32_t value){
7474
int32_t temp = toInt();
7575
temp -= value;
7676
set(temp);

src/AudioCodecs/CodecAPTX.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
*/
1111
#pragma once
1212
#include "AudioCodecs/AudioEncoded.h"
13+
#include "AudioBasic/Int24x.h"
1314
#include "openaptx.h"
1415

1516
/**
@@ -105,7 +106,7 @@ class APTXDecoder : public AudioDecoder {
105106
int samples = written / 3;
106107
LOGI("written: %d", written);
107108
LOGI("samples: %d", samples);
108-
int24_t *p_int24 = (int24_t *)output_buffer.data();
109+
int24x_t *p_int24 = (int24x_t *)output_buffer.data();
109110
int16_t *p_int16 = (int16_t *)output_buffer.data();
110111
for (int j = 0; j < samples; j++) {
111112
p_int16[j] = p_int24[j].getAndScale16();
@@ -298,7 +299,7 @@ class APTXEncoder : public AudioEncoder {
298299
protected:
299300
bool is_hd;
300301
AudioInfo info;
301-
Vector<int24_t> input_buffer{4 * 2};
302+
Vector<int24x_t> input_buffer{4 * 2};
302303
Vector<uint8_t> output_buffer;
303304
int input_pos = 0;
304305
int output_pos = 0;

0 commit comments

Comments
 (0)