disable audiomixer on boards it doesn't fit on

This commit is contained in:
sommersoft 2019-08-25 14:53:34 -05:00
parent 7f64af38cb
commit 696117b048
6 changed files with 22 additions and 0 deletions

View File

@ -14,3 +14,5 @@ LONGINT_IMPL = MPZ
CFLAGS_INLINE_LIMIT = 60 CFLAGS_INLINE_LIMIT = 60
SUPEROPT_GC = 0 SUPEROPT_GC = 0
CIRCUITPY_AUDIOMIXER = 0

View File

@ -14,3 +14,5 @@ LONGINT_IMPL = MPZ
CFLAGS_INLINE_LIMIT = 60 CFLAGS_INLINE_LIMIT = 60
SUPEROPT_GC = 0 SUPEROPT_GC = 0
CIRCUITPY_AUDIOMIXER = 0

View File

@ -14,3 +14,5 @@ LONGINT_IMPL = MPZ
CFLAGS_INLINE_LIMIT = 60 CFLAGS_INLINE_LIMIT = 60
SUPEROPT_GC = 0 SUPEROPT_GC = 0
CIRCUITPY_AUDIOMIXER = 0

View File

@ -14,3 +14,5 @@ LONGINT_IMPL = MPZ
CFLAGS_INLINE_LIMIT = 60 CFLAGS_INLINE_LIMIT = 60
SUPEROPT_GC = 0 SUPEROPT_GC = 0
CIRCUITPY_AUDIOMIXER = 0

View File

@ -14,3 +14,5 @@ LONGINT_IMPL = MPZ
CFLAGS_INLINE_LIMIT = 60 CFLAGS_INLINE_LIMIT = 60
SUPEROPT_GC = 0 SUPEROPT_GC = 0
CIRCUITPY_AUDIOMIXER = 0

View File

@ -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)) { } else if (MP_OBJ_IS_TYPE(sample_obj, &audioio_wavefile_type)) {
audioio_wavefile_obj_t* file = MP_OBJ_TO_PTR(sample_obj); audioio_wavefile_obj_t* file = MP_OBJ_TO_PTR(sample_obj);
return file->sample_rate; return file->sample_rate;
#if CIRCUITPY_AUDIOMIXER
} else if (MP_OBJ_IS_TYPE(sample_obj, &audiomixer_mixer_type)) { } else if (MP_OBJ_IS_TYPE(sample_obj, &audiomixer_mixer_type)) {
audiomixer_mixer_obj_t* mixer = MP_OBJ_TO_PTR(sample_obj); audiomixer_mixer_obj_t* mixer = MP_OBJ_TO_PTR(sample_obj);
return mixer->sample_rate; return mixer->sample_rate;
#endif
} }
return 16000; 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)) { } else if (MP_OBJ_IS_TYPE(sample_obj, &audioio_wavefile_type)) {
audioio_wavefile_obj_t* file = MP_OBJ_TO_PTR(sample_obj); audioio_wavefile_obj_t* file = MP_OBJ_TO_PTR(sample_obj);
return file->bits_per_sample; return file->bits_per_sample;
#if CIRCUITPY_AUDIOMIXER
} else if (MP_OBJ_IS_TYPE(sample_obj, &audiomixer_mixer_type)) { } else if (MP_OBJ_IS_TYPE(sample_obj, &audiomixer_mixer_type)) {
audiomixer_mixer_obj_t* mixer = MP_OBJ_TO_PTR(sample_obj); audiomixer_mixer_obj_t* mixer = MP_OBJ_TO_PTR(sample_obj);
return mixer->bits_per_sample; return mixer->bits_per_sample;
#endif
} }
return 8; 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)) { } else if (MP_OBJ_IS_TYPE(sample_obj, &audioio_wavefile_type)) {
audioio_wavefile_obj_t* file = MP_OBJ_TO_PTR(sample_obj); audioio_wavefile_obj_t* file = MP_OBJ_TO_PTR(sample_obj);
return file->channel_count; return file->channel_count;
#if CIRCUITPY_AUDIOMIXER
} else if (MP_OBJ_IS_TYPE(sample_obj, &audiomixer_mixer_type)) { } else if (MP_OBJ_IS_TYPE(sample_obj, &audiomixer_mixer_type)) {
audiomixer_mixer_obj_t* mixer = MP_OBJ_TO_PTR(sample_obj); audiomixer_mixer_obj_t* mixer = MP_OBJ_TO_PTR(sample_obj);
return mixer->channel_count; return mixer->channel_count;
#endif
} }
return 1; 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)) { } else if (MP_OBJ_IS_TYPE(sample_obj, &audioio_wavefile_type)) {
audioio_wavefile_obj_t* file = MP_OBJ_TO_PTR(sample_obj); audioio_wavefile_obj_t* file = MP_OBJ_TO_PTR(sample_obj);
audioio_wavefile_reset_buffer(file, single_channel, audio_channel); audioio_wavefile_reset_buffer(file, single_channel, audio_channel);
#if CIRCUITPY_AUDIOMIXER
} else if (MP_OBJ_IS_TYPE(sample_obj, &audiomixer_mixer_type)) { } else if (MP_OBJ_IS_TYPE(sample_obj, &audiomixer_mixer_type)) {
audiomixer_mixer_obj_t* file = MP_OBJ_TO_PTR(sample_obj); audiomixer_mixer_obj_t* file = MP_OBJ_TO_PTR(sample_obj);
audiomixer_mixer_reset_buffer(file, single_channel, audio_channel); 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)) { } else if (MP_OBJ_IS_TYPE(sample_obj, &audioio_wavefile_type)) {
audioio_wavefile_obj_t* file = MP_OBJ_TO_PTR(sample_obj); audioio_wavefile_obj_t* file = MP_OBJ_TO_PTR(sample_obj);
return audioio_wavefile_get_buffer(file, single_channel, channel, buffer, buffer_length); 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)) { } else if (MP_OBJ_IS_TYPE(sample_obj, &audiomixer_mixer_type)) {
audiomixer_mixer_obj_t* file = MP_OBJ_TO_PTR(sample_obj); audiomixer_mixer_obj_t* file = MP_OBJ_TO_PTR(sample_obj);
return audiomixer_mixer_get_buffer(file, single_channel, channel, buffer, buffer_length); return audiomixer_mixer_get_buffer(file, single_channel, channel, buffer, buffer_length);
#endif
} }
return GET_BUFFER_DONE; 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_obj_t* file = MP_OBJ_TO_PTR(sample_obj);
audioio_wavefile_get_buffer_structure(file, single_channel, single_buffer, samples_signed, audioio_wavefile_get_buffer_structure(file, single_channel, single_buffer, samples_signed,
max_buffer_length, spacing); max_buffer_length, spacing);
#if CIRCUITPY_AUDIOMIXER
} else if (MP_OBJ_IS_TYPE(sample_obj, &audiomixer_mixer_type)) { } else if (MP_OBJ_IS_TYPE(sample_obj, &audiomixer_mixer_type)) {
audiomixer_mixer_obj_t* file = MP_OBJ_TO_PTR(sample_obj); audiomixer_mixer_obj_t* file = MP_OBJ_TO_PTR(sample_obj);
audiomixer_mixer_get_buffer_structure(file, single_channel, single_buffer, samples_signed, audiomixer_mixer_get_buffer_structure(file, single_channel, single_buffer, samples_signed,
max_buffer_length, spacing); max_buffer_length, spacing);
#endif
} }
} }