Skip to content

Commit 37c35f9

Browse files
committed
Simplify int24_t
1 parent 6cdb43e commit 37c35f9

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

src/AudioBasic/Int24.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,29 +23,29 @@ class int24_t {
2323
memcpy(&value, ptr, 4);
2424
}
2525

26-
int24_t(const int16_t &in) {
26+
int24_t(const int16_t in) {
2727
set(in) ;
2828
}
2929

30-
int24_t(const int32_t &in) {
30+
int24_t(const int32_t in) {
3131
set(in);
3232
}
3333

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

3838
int24_t(const int24_t &in) {
3939
value = in.value;
4040
}
4141

42-
int24_t(const float &in) {
42+
int24_t(const float in) {
4343
set((int32_t)in);
4444
}
4545

46-
#if defined(STM32) || defined(ESP32C3) || defined(TARGET_RP2040) || defined(AUDIOKIT_USE_IDF) || defined(ARDUINO_ARCH_SAMD)
46+
#if defined(USE_INT24_FROM_INT)
4747

48-
int24_t(const int &in) {
48+
int24_t(const int in) {
4949
set(in);
5050
}
5151

src/AudioConfig.h

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@
161161
#if defined(ESP32) && defined(CONFIG_IDF_TARGET_ESP32C3)
162162
#define ESP32C3
163163
#define ESP32X
164+
#define USE_INT24_FROM_INT
164165
#endif
165166
#if defined(ESP32) && defined(CONFIG_IDF_TARGET_ESP32S2)
166167
#define ESP32S2
@@ -369,6 +370,7 @@ uint64_t millis() {return (xTaskGetTickCount() * portTICK_PERIOD_MS);}
369370
#define USE_TYPETRAITS
370371
#define USE_EFFECTS_SUITE
371372
#define USE_TIMER
373+
#define USE_INT24_FROM_INT
372374

373375
#define PIN_ADC_START 26
374376
#define PIN_PWM_START 6
@@ -403,6 +405,7 @@ uint64_t millis() {return (xTaskGetTickCount() * portTICK_PERIOD_MS);}
403405
#define USE_TYPETRAITS
404406
#define USE_EFFECTS_SUITE
405407
#define USE_TIMER
408+
#define USE_INT24_FROM_INT
406409

407410
#define PIN_ADC_START 26
408411
#define PIN_PWM_START 6
@@ -481,9 +484,10 @@ using WiFiServerSecure = BearSSL::WiFiServerSecure;
481484
#define USE_PWM
482485
#define USE_TIMER
483486
#define USE_ADC_ARDUINO
487+
#define USE_INT24_FROM_INT
488+
484489
#define ADC_BUFFER_SIZE 1024
485490
#define ADC_BUFFERS 20
486-
487491
#define PIN_ADC_START PA0
488492
#define PIN_PWM_START PA0
489493
#define PWM_DEFAULT_TIMER TIM2
@@ -502,6 +506,7 @@ using WiFiServerSecure = BearSSL::WiFiServerSecure;
502506

503507
#ifdef ARDUINO_ARCH_SAMD
504508
#define USE_I2S
509+
#define USE_INT24_FROM_INT
505510
#define PIN_I2S_BCK 1
506511
#define PIN_I2S_WS PIN_I2S_BCK+1
507512
#define PIN_I2S_DATA_IN 3
@@ -549,6 +554,9 @@ typedef WiFiClient WiFiClientSecure;
549554
# define USE_STREAM_READ_OVERRIDE
550555
#endif
551556

557+
#ifdef AUDIOKIT_USE_IDF
558+
# define USE_INT24_FROM_INT
559+
#endif
552560

553561
#if USE_INLINE_VARS && !defined(INGNORE_INLINE_VARS)
554562
# define INLINE_VAR inline

0 commit comments

Comments
 (0)