diff --git a/src/codal_port/microbit_soundeffect.c b/src/codal_port/microbit_soundeffect.c index cd51f8a..70bc969 100644 --- a/src/codal_port/microbit_soundeffect.c +++ b/src/codal_port/microbit_soundeffect.c @@ -25,6 +25,7 @@ */ #include "py/runtime.h" +#include "microbithal.h" #include "modmicrobit.h" #include "modaudio.h" @@ -69,14 +70,6 @@ #define SOUND_EFFECT_FX_VIBRATO (1) #define SOUND_EFFECT_FX_WARBLE (3) -// These default fx values are the same as used by MakeCode. -#define SOUND_EFFECT_FX_VIBRATO_DEFAULT_PARAM (2) -#define SOUND_EFFECT_FX_TREMOLO_DEFAULT_PARAM (3) -#define SOUND_EFFECT_FX_WARBLE_DEFAULT_PARAM (2) -#define SOUND_EFFECT_FX_VIBRATO_DEFAULT_STEPS (512) -#define SOUND_EFFECT_FX_TREMOLO_DEFAULT_STEPS (900) -#define SOUND_EFFECT_FX_WARBLE_DEFAULT_STEPS (700) - #define SOUND_EFFECT_DEFAULT_FREQ_START (500) #define SOUND_EFFECT_DEFAULT_FREQ_END (2500) #define SOUND_EFFECT_DEFAULT_DURATION (500) @@ -125,15 +118,15 @@ static const soundeffect_attr_t soundeffect_attr_table[] = { }; static const uint8_t fx_default_param[] = { - [SOUND_EFFECT_FX_VIBRATO] = SOUND_EFFECT_FX_VIBRATO_DEFAULT_PARAM, - [SOUND_EFFECT_FX_TREMOLO] = SOUND_EFFECT_FX_TREMOLO_DEFAULT_PARAM, - [SOUND_EFFECT_FX_WARBLE] = SOUND_EFFECT_FX_WARBLE_DEFAULT_PARAM, + [SOUND_EFFECT_FX_VIBRATO] = MICROBIT_HAL_SFX_DEFAULT_VIBRATO_PARAM, + [SOUND_EFFECT_FX_TREMOLO] = MICROBIT_HAL_SFX_DEFAULT_TREMOLO_PARAM, + [SOUND_EFFECT_FX_WARBLE] = MICROBIT_HAL_SFX_DEFAULT_WARBLE_PARAM, }; static const uint16_t fx_default_steps[] = { - [SOUND_EFFECT_FX_VIBRATO] = SOUND_EFFECT_FX_VIBRATO_DEFAULT_STEPS, - [SOUND_EFFECT_FX_TREMOLO] = SOUND_EFFECT_FX_TREMOLO_DEFAULT_STEPS, - [SOUND_EFFECT_FX_WARBLE] = SOUND_EFFECT_FX_WARBLE_DEFAULT_STEPS, + [SOUND_EFFECT_FX_VIBRATO] = MICROBIT_HAL_SFX_DEFAULT_VIBRATO_STEPS, + [SOUND_EFFECT_FX_TREMOLO] = MICROBIT_HAL_SFX_DEFAULT_TREMOLO_STEPS, + [SOUND_EFFECT_FX_WARBLE] = MICROBIT_HAL_SFX_DEFAULT_WARBLE_STEPS, }; const char *microbit_soundeffect_get_sound_expr_data(mp_obj_t self_in) {