diff --git a/ports/espressif/boards/adafruit_metro_esp32p4/mpconfigboard.mk b/ports/espressif/boards/adafruit_metro_esp32p4/mpconfigboard.mk index 39bab74e4f9..bfce2e41c35 100644 --- a/ports/espressif/boards/adafruit_metro_esp32p4/mpconfigboard.mk +++ b/ports/espressif/boards/adafruit_metro_esp32p4/mpconfigboard.mk @@ -10,7 +10,6 @@ CIRCUITPY_USB_DEVICE_INSTANCE = FULL_SPEED_INSTANCE CIRCUITPY_AUDIOFILEWRITER = 1 CIRCUITPY_USB_HOST = 1 CIRCUITPY_USB_HOST_AUDIO = 1 -CIRCUITPY_AUDIOTAP = 1 CIRCUITPY_ESP_HOSTED = 1 CIRCUITPY_ESP_FLASH_SIZE = 16MB diff --git a/ports/espressif/mpconfigport.mk b/ports/espressif/mpconfigport.mk index 42457843c91..a1dc5179a00 100644 --- a/ports/espressif/mpconfigport.mk +++ b/ports/espressif/mpconfigport.mk @@ -376,6 +376,9 @@ else ifeq ($(IDF_TARGET),esp32p4) # No DAC CIRCUITPY_AUDIOIO = 0 +CIRCUITPY_AUDIOFILTERS ?= 1 +CIRCUITPY_AUDIOTAP ?= 1 +CIRCUITPY_USB_HOST_AUDIO ?= $(CIRCUITPY_USB_HOST) # MII is available on these targets with EMAC hardware. CIRCUITPY_MII ?= 1 diff --git a/shared-module/audiofilters/Distortion.c b/shared-module/audiofilters/Distortion.c index 1498c402ea0..d235de59614 100644 --- a/shared-module/audiofilters/Distortion.c +++ b/shared-module/audiofilters/Distortion.c @@ -174,7 +174,11 @@ audioio_get_buffer_result_t audiofilters_distortion_get_buffer(audiofilters_dist self->last_buf_idx = !self->last_buf_idx; // If we are using 16 bit samples we need a 16 bit pointer, 8 bit needs an 8 bit pointer + // buffer[] was allocated on the heap, so it is aligned for 16-bit access. + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wcast-align" int16_t *word_buffer = (int16_t *)self->buffer[self->last_buf_idx]; + #pragma GCC diagnostic pop int8_t *hword_buffer = self->buffer[self->last_buf_idx]; uint32_t length = self->buffer_len / (self->base.bits_per_sample / 8); @@ -231,7 +235,11 @@ audioio_get_buffer_result_t audiofilters_distortion_get_buffer(audiofilters_dist // Determine how many bytes we can process to our buffer, the less of the sample we have left and our buffer remaining uint32_t n = MIN(MIN(self->sample_buffer_length, length), SYNTHIO_MAX_DUR * self->base.channel_count); + // The source's buffer is aligned, and it is only advanced in whole samples. + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wcast-align" int16_t *sample_src = (int16_t *)self->sample_remaining_buffer; // for 16-bit samples + #pragma GCC diagnostic pop int8_t *sample_hsrc = (int8_t *)self->sample_remaining_buffer; // for 8-bit samples // get the effect values we need from the BlockInput. These may change at run time so you need to do bounds checking if required diff --git a/shared-module/audiofilters/Filter.c b/shared-module/audiofilters/Filter.c index 37deaa06b58..ae907e365b4 100644 --- a/shared-module/audiofilters/Filter.c +++ b/shared-module/audiofilters/Filter.c @@ -130,7 +130,11 @@ audioio_get_buffer_result_t audiofilters_filter_get_buffer(audiofilters_filter_o self->last_buf_idx = !self->last_buf_idx; // If we are using 16 bit samples we need a 16 bit pointer, 8 bit needs an 8 bit pointer + // buffer[] was allocated on the heap, so it is aligned for 16-bit access. + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wcast-align" int16_t *word_buffer = (int16_t *)self->buffer[self->last_buf_idx]; + #pragma GCC diagnostic pop int8_t *hword_buffer = self->buffer[self->last_buf_idx]; uint32_t length = self->buffer_len / (self->base.bits_per_sample / 8); @@ -188,7 +192,11 @@ audioio_get_buffer_result_t audiofilters_filter_get_buffer(audiofilters_filter_o // Determine how many bytes we can process to our buffer, the less of the sample we have left and our buffer remaining uint32_t n = MIN(MIN(self->sample_buffer_length, length), SYNTHIO_MAX_DUR * self->base.channel_count); + // The source's buffer is aligned, and it is only advanced in whole samples. + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wcast-align" int16_t *sample_src = (int16_t *)self->sample_remaining_buffer; // for 16-bit samples + #pragma GCC diagnostic pop int8_t *sample_hsrc = (int8_t *)self->sample_remaining_buffer; // for 8-bit samples // get the effect values we need from the BlockInput. These may change at run time so you need to do bounds checking if required diff --git a/shared-module/audiofilters/Phaser.c b/shared-module/audiofilters/Phaser.c index 368824b4b43..367bc4b3f84 100644 --- a/shared-module/audiofilters/Phaser.c +++ b/shared-module/audiofilters/Phaser.c @@ -164,7 +164,11 @@ audioio_get_buffer_result_t audiofilters_phaser_get_buffer(audiofilters_phaser_o self->last_buf_idx = !self->last_buf_idx; // If we are using 16 bit samples we need a 16 bit pointer, 8 bit needs an 8 bit pointer + // buffer[] was allocated on the heap, so it is aligned for 16-bit access. + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wcast-align" int16_t *word_buffer = (int16_t *)self->buffer[self->last_buf_idx]; + #pragma GCC diagnostic pop int8_t *hword_buffer = self->buffer[self->last_buf_idx]; uint32_t length = self->buffer_len / (self->base.bits_per_sample / 8); @@ -221,7 +225,11 @@ audioio_get_buffer_result_t audiofilters_phaser_get_buffer(audiofilters_phaser_o // Determine how many bytes we can process to our buffer, the less of the sample we have left and our buffer remaining uint32_t n = MIN(MIN(self->sample_buffer_length, length), SYNTHIO_MAX_DUR * self->base.channel_count); + // The source's buffer is aligned, and it is only advanced in whole samples. + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wcast-align" int16_t *sample_src = (int16_t *)self->sample_remaining_buffer; // for 16-bit samples + #pragma GCC diagnostic pop int8_t *sample_hsrc = (int8_t *)self->sample_remaining_buffer; // for 8-bit samples // get the effect values we need from the BlockInput. These may change at run time so you need to do bounds checking if required