Rename stop to stop_voice in case we want stop to stop everything later.
This commit is contained in:
parent
2b0356c61f
commit
6da25c8893
|
@ -150,7 +150,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(audioio_mixer___exit___obj, 4, 4, aud
|
|||
//|
|
||||
//| Sample must be an `audioio.WaveFile`, `audioio.Mixer` or `audioio.RawSample`.
|
||||
//|
|
||||
//| If other samples are already playing, the encodings must match.
|
||||
//| The sample must match the Mixer's encoding settings given in the constructor.
|
||||
//|
|
||||
STATIC mp_obj_t audioio_mixer_obj_play(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
|
||||
enum { ARG_sample, ARG_voice, ARG_loop };
|
||||
|
@ -171,24 +171,24 @@ STATIC mp_obj_t audioio_mixer_obj_play(size_t n_args, const mp_obj_t *pos_args,
|
|||
}
|
||||
MP_DEFINE_CONST_FUN_OBJ_KW(audioio_mixer_play_obj, 1, audioio_mixer_obj_play);
|
||||
|
||||
//| .. method:: stop(voice=0)
|
||||
//| .. method:: stop_voice(voice=0)
|
||||
//|
|
||||
//| Stops playback and resets to the start of the sample on the given channel.
|
||||
//| Stops playback of the sample on the given voice.
|
||||
//|
|
||||
STATIC mp_obj_t audioio_mixer_obj_stop(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
|
||||
STATIC mp_obj_t audioio_mixer_obj_stop_voice(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
|
||||
enum { ARG_voice };
|
||||
static const mp_arg_t allowed_args[] = {
|
||||
{ MP_QSTR_voice, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = 0} },
|
||||
{ MP_QSTR_voice, MP_ARG_INT, {.u_int = 0} },
|
||||
};
|
||||
audioio_mixer_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]);
|
||||
raise_error_if_deinited(common_hal_audioio_mixer_deinited(self));
|
||||
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
|
||||
mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
|
||||
|
||||
common_hal_audioio_mixer_stop(self, args[ARG_voice].u_int);
|
||||
common_hal_audioio_mixer_stop_voice(self, args[ARG_voice].u_int);
|
||||
return mp_const_none;
|
||||
}
|
||||
MP_DEFINE_CONST_FUN_OBJ_KW(audioio_mixer_stop_obj, 1, audioio_mixer_obj_stop);
|
||||
MP_DEFINE_CONST_FUN_OBJ_KW(audioio_mixer_stop_voice_obj, 1, audioio_mixer_obj_stop_voice);
|
||||
|
||||
//| .. attribute:: playing
|
||||
//|
|
||||
|
@ -233,7 +233,7 @@ STATIC const mp_rom_map_elem_t audioio_mixer_locals_dict_table[] = {
|
|||
{ MP_ROM_QSTR(MP_QSTR___enter__), MP_ROM_PTR(&default___enter___obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR___exit__), MP_ROM_PTR(&audioio_mixer___exit___obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_play), MP_ROM_PTR(&audioio_mixer_play_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_stop), MP_ROM_PTR(&audioio_mixer_stop_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_stop_voice), MP_ROM_PTR(&audioio_mixer_stop_voice_obj) },
|
||||
|
||||
// Properties
|
||||
{ MP_ROM_QSTR(MP_QSTR_playing), MP_ROM_PTR(&audioio_mixer_playing_obj) },
|
||||
|
|
|
@ -44,7 +44,7 @@ void common_hal_audioio_mixer_construct(audioio_mixer_obj_t* self,
|
|||
void common_hal_audioio_mixer_deinit(audioio_mixer_obj_t* self);
|
||||
bool common_hal_audioio_mixer_deinited(audioio_mixer_obj_t* self);
|
||||
void common_hal_audioio_mixer_play(audioio_mixer_obj_t* self, mp_obj_t sample, uint8_t voice, bool loop);
|
||||
void common_hal_audioio_mixer_stop(audioio_mixer_obj_t* self, uint8_t voice);
|
||||
void common_hal_audioio_mixer_stop_voice(audioio_mixer_obj_t* self, uint8_t voice);
|
||||
|
||||
bool common_hal_audioio_mixer_get_playing(audioio_mixer_obj_t* self);
|
||||
uint32_t common_hal_audioio_mixer_get_sample_rate(audioio_mixer_obj_t* self);
|
||||
|
|
|
@ -110,7 +110,7 @@ void common_hal_audioio_mixer_play(audioio_mixer_obj_t* self, mp_obj_t sample, u
|
|||
voice->more_data = result == GET_BUFFER_MORE_DATA;
|
||||
}
|
||||
|
||||
void common_hal_audioio_mixer_stop(audioio_mixer_obj_t* self, uint8_t voice) {
|
||||
void common_hal_audioio_mixer_stop_voice(audioio_mixer_obj_t* self, uint8_t voice) {
|
||||
self->voice[voice].sample = NULL;
|
||||
}
|
||||
|
||||
|
@ -131,8 +131,6 @@ void audioio_mixer_reset_buffer(audioio_mixer_obj_t* self,
|
|||
}
|
||||
}
|
||||
|
||||
#pragma GCC push_options
|
||||
#pragma GCC optimize ("O0")
|
||||
uint32_t add8signed(uint32_t a, uint32_t b) {
|
||||
#if (defined (__ARM_FEATURE_DSP) && (__ARM_FEATURE_DSP == 1))
|
||||
return __QADD8(a, b);
|
||||
|
@ -152,7 +150,6 @@ uint32_t add8signed(uint32_t a, uint32_t b) {
|
|||
return result;
|
||||
#endif
|
||||
}
|
||||
#pragma GCC pop_options
|
||||
|
||||
uint32_t add8unsigned(uint32_t a, uint32_t b) {
|
||||
#if (defined (__ARM_FEATURE_DSP) && (__ARM_FEATURE_DSP == 1))
|
||||
|
|
Loading…
Reference in New Issue