Skip to content

Removed unneeded kwarg handler in setters of audiodelays and audiofilters #9864

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 16 additions & 48 deletions shared-bindings/audiodelays/Echo.c
Original file line number Diff line number Diff line change
Expand Up @@ -153,20 +153,12 @@ static mp_obj_t audiodelays_echo_obj_get_delay_ms(mp_obj_t self_in) {
}
MP_DEFINE_CONST_FUN_OBJ_1(audiodelays_echo_get_delay_ms_obj, audiodelays_echo_obj_get_delay_ms);

static mp_obj_t audiodelays_echo_obj_set_delay_ms(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum { ARG_delay_ms };
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_delay_ms, MP_ARG_OBJ | MP_ARG_REQUIRED, {} },
};
audiodelays_echo_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]);
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_audiodelays_echo_set_delay_ms(self, args[ARG_delay_ms].u_obj);

static mp_obj_t audiodelays_echo_obj_set_delay_ms(mp_obj_t self_in, mp_obj_t delay_ms_in) {
audiodelays_echo_obj_t *self = MP_OBJ_TO_PTR(self_in);
common_hal_audiodelays_echo_set_delay_ms(self, delay_ms_in);
return mp_const_none;
}
MP_DEFINE_CONST_FUN_OBJ_KW(audiodelays_echo_set_delay_ms_obj, 1, audiodelays_echo_obj_set_delay_ms);
MP_DEFINE_CONST_FUN_OBJ_2(audiodelays_echo_set_delay_ms_obj, audiodelays_echo_obj_set_delay_ms);

MP_PROPERTY_GETSET(audiodelays_echo_delay_ms_obj,
(mp_obj_t)&audiodelays_echo_get_delay_ms_obj,
Expand All @@ -179,20 +171,12 @@ static mp_obj_t audiodelays_echo_obj_get_decay(mp_obj_t self_in) {
}
MP_DEFINE_CONST_FUN_OBJ_1(audiodelays_echo_get_decay_obj, audiodelays_echo_obj_get_decay);

static mp_obj_t audiodelays_echo_obj_set_decay(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum { ARG_decay };
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_decay, MP_ARG_OBJ | MP_ARG_REQUIRED, {} },
};
audiodelays_echo_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]);
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_audiodelays_echo_set_decay(self, args[ARG_decay].u_obj);

static mp_obj_t audiodelays_echo_obj_set_decay(mp_obj_t self_in, mp_obj_t decay_in) {
audiodelays_echo_obj_t *self = MP_OBJ_TO_PTR(self_in);
common_hal_audiodelays_echo_set_decay(self, decay_in);
return mp_const_none;
}
MP_DEFINE_CONST_FUN_OBJ_KW(audiodelays_echo_set_decay_obj, 1, audiodelays_echo_obj_set_decay);
MP_DEFINE_CONST_FUN_OBJ_2(audiodelays_echo_set_decay_obj, audiodelays_echo_obj_set_decay);

MP_PROPERTY_GETSET(audiodelays_echo_decay_obj,
(mp_obj_t)&audiodelays_echo_get_decay_obj,
Expand All @@ -205,20 +189,12 @@ static mp_obj_t audiodelays_echo_obj_get_mix(mp_obj_t self_in) {
}
MP_DEFINE_CONST_FUN_OBJ_1(audiodelays_echo_get_mix_obj, audiodelays_echo_obj_get_mix);

static mp_obj_t audiodelays_echo_obj_set_mix(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum { ARG_mix };
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_mix, MP_ARG_OBJ | MP_ARG_REQUIRED, {} },
};
audiodelays_echo_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]);
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_audiodelays_echo_set_mix(self, args[ARG_mix].u_obj);

static mp_obj_t audiodelays_echo_obj_set_mix(mp_obj_t self_in, mp_obj_t mix_in) {
audiodelays_echo_obj_t *self = MP_OBJ_TO_PTR(self_in);
common_hal_audiodelays_echo_set_mix(self, mix_in);
return mp_const_none;
}
MP_DEFINE_CONST_FUN_OBJ_KW(audiodelays_echo_set_mix_obj, 1, audiodelays_echo_obj_set_mix);
MP_DEFINE_CONST_FUN_OBJ_2(audiodelays_echo_set_mix_obj, audiodelays_echo_obj_set_mix);

MP_PROPERTY_GETSET(audiodelays_echo_mix_obj,
(mp_obj_t)&audiodelays_echo_get_mix_obj,
Expand All @@ -233,20 +209,12 @@ static mp_obj_t audiodelays_echo_obj_get_freq_shift(mp_obj_t self_in) {
}
MP_DEFINE_CONST_FUN_OBJ_1(audiodelays_echo_get_freq_shift_obj, audiodelays_echo_obj_get_freq_shift);

static mp_obj_t audiodelays_echo_obj_set_freq_shift(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum { ARG_freq_shift };
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_freq_shift, MP_ARG_BOOL | MP_ARG_REQUIRED, {} },
};
audiodelays_echo_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]);
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_audiodelays_echo_set_freq_shift(self, args[ARG_freq_shift].u_bool);

static mp_obj_t audiodelays_echo_obj_set_freq_shift(mp_obj_t self_in, mp_obj_t freq_shift_in) {
audiodelays_echo_obj_t *self = MP_OBJ_TO_PTR(self_in);
common_hal_audiodelays_echo_set_freq_shift(self, mp_obj_is_true(freq_shift_in));
return mp_const_none;
}
MP_DEFINE_CONST_FUN_OBJ_KW(audiodelays_echo_set_freq_shift_obj, 1, audiodelays_echo_obj_set_freq_shift);
MP_DEFINE_CONST_FUN_OBJ_2(audiodelays_echo_set_freq_shift_obj, audiodelays_echo_obj_set_freq_shift);

MP_PROPERTY_GETSET(audiodelays_echo_freq_shift_obj,
(mp_obj_t)&audiodelays_echo_get_freq_shift_obj,
Expand Down
32 changes: 8 additions & 24 deletions shared-bindings/audiofilters/Filter.c
Original file line number Diff line number Diff line change
Expand Up @@ -139,20 +139,12 @@ static mp_obj_t audiofilters_filter_obj_get_filter(mp_obj_t self_in) {
}
MP_DEFINE_CONST_FUN_OBJ_1(audiofilters_filter_get_filter_obj, audiofilters_filter_obj_get_filter);

static mp_obj_t audiofilters_filter_obj_set_filter(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum { ARG_filter };
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_filter, MP_ARG_OBJ | MP_ARG_REQUIRED, {} },
};
audiofilters_filter_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]);
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_audiofilters_filter_set_filter(self, args[ARG_filter].u_obj);

static mp_obj_t audiofilters_filter_obj_set_filter(mp_obj_t self_in, mp_obj_t filter_in) {
audiofilters_filter_obj_t *self = MP_OBJ_TO_PTR(self_in);
common_hal_audiofilters_filter_set_filter(self, filter_in);
return mp_const_none;
}
MP_DEFINE_CONST_FUN_OBJ_KW(audiofilters_filter_set_filter_obj, 1, audiofilters_filter_obj_set_filter);
MP_DEFINE_CONST_FUN_OBJ_2(audiofilters_filter_set_filter_obj, audiofilters_filter_obj_set_filter);

MP_PROPERTY_GETSET(audiofilters_filter_filter_obj,
(mp_obj_t)&audiofilters_filter_get_filter_obj,
Expand All @@ -166,20 +158,12 @@ static mp_obj_t audiofilters_filter_obj_get_mix(mp_obj_t self_in) {
}
MP_DEFINE_CONST_FUN_OBJ_1(audiofilters_filter_get_mix_obj, audiofilters_filter_obj_get_mix);

static mp_obj_t audiofilters_filter_obj_set_mix(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum { ARG_mix };
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_mix, MP_ARG_OBJ | MP_ARG_REQUIRED, {} },
};
audiofilters_filter_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]);
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_audiofilters_filter_set_mix(self, args[ARG_mix].u_obj);

static mp_obj_t audiofilters_filter_obj_set_mix(mp_obj_t self_in, mp_obj_t mix_in) {
audiofilters_filter_obj_t *self = MP_OBJ_TO_PTR(self_in);
common_hal_audiofilters_filter_set_mix(self, mix_in);
return mp_const_none;
}
MP_DEFINE_CONST_FUN_OBJ_KW(audiofilters_filter_set_mix_obj, 1, audiofilters_filter_obj_set_mix);
MP_DEFINE_CONST_FUN_OBJ_2(audiofilters_filter_set_mix_obj, audiofilters_filter_obj_set_mix);

MP_PROPERTY_GETSET(audiofilters_filter_mix_obj,
(mp_obj_t)&audiofilters_filter_get_mix_obj,
Expand Down