Skip to content

Commit 251bd63

Browse files
committed
codal_port/microbit_soundeffect: Add comments for CODAL fx constants.
It's not possible to include the CODAL header file that defines these constants because that header file is C++. Signed-off-by: Damien George <[email protected]>
1 parent d7f0a29 commit 251bd63

File tree

1 file changed

+7
-14
lines changed

1 file changed

+7
-14
lines changed

src/codal_port/microbit_soundeffect.c

+7-14
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
*/
2626

2727
#include "py/runtime.h"
28+
#include "microbithal.h"
2829
#include "modmicrobit.h"
2930
#include "modaudio.h"
3031

@@ -69,14 +70,6 @@
6970
#define SOUND_EFFECT_FX_VIBRATO (1)
7071
#define SOUND_EFFECT_FX_WARBLE (3)
7172

72-
// These default fx values are the same as used by MakeCode.
73-
#define SOUND_EFFECT_FX_VIBRATO_DEFAULT_PARAM (2)
74-
#define SOUND_EFFECT_FX_TREMOLO_DEFAULT_PARAM (3)
75-
#define SOUND_EFFECT_FX_WARBLE_DEFAULT_PARAM (2)
76-
#define SOUND_EFFECT_FX_VIBRATO_DEFAULT_STEPS (512)
77-
#define SOUND_EFFECT_FX_TREMOLO_DEFAULT_STEPS (900)
78-
#define SOUND_EFFECT_FX_WARBLE_DEFAULT_STEPS (700)
79-
8073
#define SOUND_EFFECT_DEFAULT_FREQ_START (500)
8174
#define SOUND_EFFECT_DEFAULT_FREQ_END (2500)
8275
#define SOUND_EFFECT_DEFAULT_DURATION (500)
@@ -125,15 +118,15 @@ static const soundeffect_attr_t soundeffect_attr_table[] = {
125118
};
126119

127120
static const uint8_t fx_default_param[] = {
128-
[SOUND_EFFECT_FX_VIBRATO] = SOUND_EFFECT_FX_VIBRATO_DEFAULT_PARAM,
129-
[SOUND_EFFECT_FX_TREMOLO] = SOUND_EFFECT_FX_TREMOLO_DEFAULT_PARAM,
130-
[SOUND_EFFECT_FX_WARBLE] = SOUND_EFFECT_FX_WARBLE_DEFAULT_PARAM,
121+
[SOUND_EFFECT_FX_VIBRATO] = MICROBIT_HAL_SFX_DEFAULT_VIBRATO_PARAM,
122+
[SOUND_EFFECT_FX_TREMOLO] = MICROBIT_HAL_SFX_DEFAULT_TREMOLO_PARAM,
123+
[SOUND_EFFECT_FX_WARBLE] = MICROBIT_HAL_SFX_DEFAULT_WARBLE_PARAM,
131124
};
132125

133126
static const uint16_t fx_default_steps[] = {
134-
[SOUND_EFFECT_FX_VIBRATO] = SOUND_EFFECT_FX_VIBRATO_DEFAULT_STEPS,
135-
[SOUND_EFFECT_FX_TREMOLO] = SOUND_EFFECT_FX_TREMOLO_DEFAULT_STEPS,
136-
[SOUND_EFFECT_FX_WARBLE] = SOUND_EFFECT_FX_WARBLE_DEFAULT_STEPS,
127+
[SOUND_EFFECT_FX_VIBRATO] = MICROBIT_HAL_SFX_DEFAULT_VIBRATO_STEPS,
128+
[SOUND_EFFECT_FX_TREMOLO] = MICROBIT_HAL_SFX_DEFAULT_TREMOLO_STEPS,
129+
[SOUND_EFFECT_FX_WARBLE] = MICROBIT_HAL_SFX_DEFAULT_WARBLE_STEPS,
137130
};
138131

139132
const char *microbit_soundeffect_get_sound_expr_data(mp_obj_t self_in) {

0 commit comments

Comments
 (0)