From 696117b048bd39d9480cfa5a2ee0871942eba816 Mon Sep 17 00:00:00 2001 From: sommersoft Date: Sun, 25 Aug 2019 14:53:34 -0500 Subject: [PATCH] disable audiomixer on boards it doesn't fit on --- .../boards/feather_m0_express/mpconfigboard.mk | 2 ++ .../boards/feather_m0_supersized/mpconfigboard.mk | 2 ++ .../boards/metro_m0_express/mpconfigboard.mk | 2 ++ ports/atmel-samd/boards/snekboard/mpconfigboard.mk | 2 ++ .../boards/sparkfun_redboard_turbo/mpconfigboard.mk | 2 ++ shared-module/audiocore/__init__.c | 12 ++++++++++++ 6 files changed, 22 insertions(+) diff --git a/ports/atmel-samd/boards/feather_m0_express/mpconfigboard.mk b/ports/atmel-samd/boards/feather_m0_express/mpconfigboard.mk index 756c293ad9..001d1e9842 100644 --- a/ports/atmel-samd/boards/feather_m0_express/mpconfigboard.mk +++ b/ports/atmel-samd/boards/feather_m0_express/mpconfigboard.mk @@ -14,3 +14,5 @@ LONGINT_IMPL = MPZ CFLAGS_INLINE_LIMIT = 60 SUPEROPT_GC = 0 + +CIRCUITPY_AUDIOMIXER = 0 diff --git a/ports/atmel-samd/boards/feather_m0_supersized/mpconfigboard.mk b/ports/atmel-samd/boards/feather_m0_supersized/mpconfigboard.mk index e34d069623..fb8d014b91 100644 --- a/ports/atmel-samd/boards/feather_m0_supersized/mpconfigboard.mk +++ b/ports/atmel-samd/boards/feather_m0_supersized/mpconfigboard.mk @@ -14,3 +14,5 @@ LONGINT_IMPL = MPZ CFLAGS_INLINE_LIMIT = 60 SUPEROPT_GC = 0 + +CIRCUITPY_AUDIOMIXER = 0 diff --git a/ports/atmel-samd/boards/metro_m0_express/mpconfigboard.mk b/ports/atmel-samd/boards/metro_m0_express/mpconfigboard.mk index 93a8ffc117..7543f6efa6 100644 --- a/ports/atmel-samd/boards/metro_m0_express/mpconfigboard.mk +++ b/ports/atmel-samd/boards/metro_m0_express/mpconfigboard.mk @@ -14,3 +14,5 @@ LONGINT_IMPL = MPZ CFLAGS_INLINE_LIMIT = 60 SUPEROPT_GC = 0 + +CIRCUITPY_AUDIOMIXER = 0 diff --git a/ports/atmel-samd/boards/snekboard/mpconfigboard.mk b/ports/atmel-samd/boards/snekboard/mpconfigboard.mk index 9892ade8f2..d96487a6f8 100644 --- a/ports/atmel-samd/boards/snekboard/mpconfigboard.mk +++ b/ports/atmel-samd/boards/snekboard/mpconfigboard.mk @@ -14,3 +14,5 @@ LONGINT_IMPL = MPZ CFLAGS_INLINE_LIMIT = 60 SUPEROPT_GC = 0 + +CIRCUITPY_AUDIOMIXER = 0 diff --git a/ports/atmel-samd/boards/sparkfun_redboard_turbo/mpconfigboard.mk b/ports/atmel-samd/boards/sparkfun_redboard_turbo/mpconfigboard.mk index 3be1a17d3a..2ed809c247 100755 --- a/ports/atmel-samd/boards/sparkfun_redboard_turbo/mpconfigboard.mk +++ b/ports/atmel-samd/boards/sparkfun_redboard_turbo/mpconfigboard.mk @@ -14,3 +14,5 @@ LONGINT_IMPL = MPZ CFLAGS_INLINE_LIMIT = 60 SUPEROPT_GC = 0 + +CIRCUITPY_AUDIOMIXER = 0 diff --git a/shared-module/audiocore/__init__.c b/shared-module/audiocore/__init__.c index 8433a17709..f9762676fd 100644 --- a/shared-module/audiocore/__init__.c +++ b/shared-module/audiocore/__init__.c @@ -42,9 +42,11 @@ uint32_t audiosample_sample_rate(mp_obj_t sample_obj) { } else if (MP_OBJ_IS_TYPE(sample_obj, &audioio_wavefile_type)) { audioio_wavefile_obj_t* file = MP_OBJ_TO_PTR(sample_obj); return file->sample_rate; + #if CIRCUITPY_AUDIOMIXER } else if (MP_OBJ_IS_TYPE(sample_obj, &audiomixer_mixer_type)) { audiomixer_mixer_obj_t* mixer = MP_OBJ_TO_PTR(sample_obj); return mixer->sample_rate; + #endif } return 16000; } @@ -56,9 +58,11 @@ uint8_t audiosample_bits_per_sample(mp_obj_t sample_obj) { } else if (MP_OBJ_IS_TYPE(sample_obj, &audioio_wavefile_type)) { audioio_wavefile_obj_t* file = MP_OBJ_TO_PTR(sample_obj); return file->bits_per_sample; + #if CIRCUITPY_AUDIOMIXER } else if (MP_OBJ_IS_TYPE(sample_obj, &audiomixer_mixer_type)) { audiomixer_mixer_obj_t* mixer = MP_OBJ_TO_PTR(sample_obj); return mixer->bits_per_sample; + #endif } return 8; } @@ -70,9 +74,11 @@ uint8_t audiosample_channel_count(mp_obj_t sample_obj) { } else if (MP_OBJ_IS_TYPE(sample_obj, &audioio_wavefile_type)) { audioio_wavefile_obj_t* file = MP_OBJ_TO_PTR(sample_obj); return file->channel_count; + #if CIRCUITPY_AUDIOMIXER } else if (MP_OBJ_IS_TYPE(sample_obj, &audiomixer_mixer_type)) { audiomixer_mixer_obj_t* mixer = MP_OBJ_TO_PTR(sample_obj); return mixer->channel_count; + #endif } return 1; } @@ -84,9 +90,11 @@ void audiosample_reset_buffer(mp_obj_t sample_obj, bool single_channel, uint8_t } else if (MP_OBJ_IS_TYPE(sample_obj, &audioio_wavefile_type)) { audioio_wavefile_obj_t* file = MP_OBJ_TO_PTR(sample_obj); audioio_wavefile_reset_buffer(file, single_channel, audio_channel); + #if CIRCUITPY_AUDIOMIXER } else if (MP_OBJ_IS_TYPE(sample_obj, &audiomixer_mixer_type)) { audiomixer_mixer_obj_t* file = MP_OBJ_TO_PTR(sample_obj); audiomixer_mixer_reset_buffer(file, single_channel, audio_channel); + #endif } } @@ -100,9 +108,11 @@ audioio_get_buffer_result_t audiosample_get_buffer(mp_obj_t sample_obj, } else if (MP_OBJ_IS_TYPE(sample_obj, &audioio_wavefile_type)) { audioio_wavefile_obj_t* file = MP_OBJ_TO_PTR(sample_obj); return audioio_wavefile_get_buffer(file, single_channel, channel, buffer, buffer_length); + #if CIRCUITPY_AUDIOMIXER } else if (MP_OBJ_IS_TYPE(sample_obj, &audiomixer_mixer_type)) { audiomixer_mixer_obj_t* file = MP_OBJ_TO_PTR(sample_obj); return audiomixer_mixer_get_buffer(file, single_channel, channel, buffer, buffer_length); + #endif } return GET_BUFFER_DONE; } @@ -118,9 +128,11 @@ void audiosample_get_buffer_structure(mp_obj_t sample_obj, bool single_channel, audioio_wavefile_obj_t* file = MP_OBJ_TO_PTR(sample_obj); audioio_wavefile_get_buffer_structure(file, single_channel, single_buffer, samples_signed, max_buffer_length, spacing); + #if CIRCUITPY_AUDIOMIXER } else if (MP_OBJ_IS_TYPE(sample_obj, &audiomixer_mixer_type)) { audiomixer_mixer_obj_t* file = MP_OBJ_TO_PTR(sample_obj); audiomixer_mixer_get_buffer_structure(file, single_channel, single_buffer, samples_signed, max_buffer_length, spacing); + #endif } }