Skip to content

Commit 89f2ae1

Browse files
committed
Remove unnecessary kwarg setters.
1 parent 155f197 commit 89f2ae1

File tree

1 file changed

+20
-60
lines changed

1 file changed

+20
-60
lines changed

shared-bindings/audiofilters/Distortion.c

Lines changed: 20 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -185,20 +185,12 @@ static mp_obj_t audiofilters_distortion_obj_get_drive(mp_obj_t self_in) {
185185
}
186186
MP_DEFINE_CONST_FUN_OBJ_1(audiofilters_distortion_get_drive_obj, audiofilters_distortion_obj_get_drive);
187187

188-
static mp_obj_t audiofilters_distortion_obj_set_drive(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
189-
enum { ARG_drive };
190-
static const mp_arg_t allowed_args[] = {
191-
{ MP_QSTR_drive, MP_ARG_OBJ | MP_ARG_REQUIRED, {} },
192-
};
193-
audiofilters_distortion_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]);
194-
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
195-
mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
196-
197-
common_hal_audiofilters_distortion_set_drive(self, args[ARG_drive].u_obj);
198-
188+
static mp_obj_t audiofilters_distortion_obj_set_drive(mp_obj_t self_in, mp_obj_t drive_in) {
189+
audiofilters_distortion_obj_t *self = MP_OBJ_TO_PTR(self_in);
190+
common_hal_audiofilters_distortion_set_drive(self, drive_in);
199191
return mp_const_none;
200192
}
201-
MP_DEFINE_CONST_FUN_OBJ_KW(audiofilters_distortion_set_drive_obj, 1, audiofilters_distortion_obj_set_drive);
193+
MP_DEFINE_CONST_FUN_OBJ_2(audiofilters_distortion_set_drive_obj, audiofilters_distortion_obj_set_drive);
202194

203195
MP_PROPERTY_GETSET(audiofilters_distortion_drive_obj,
204196
(mp_obj_t)&audiofilters_distortion_get_drive_obj,
@@ -212,20 +204,12 @@ static mp_obj_t audiofilters_distortion_obj_get_pre_gain(mp_obj_t self_in) {
212204
}
213205
MP_DEFINE_CONST_FUN_OBJ_1(audiofilters_distortion_get_pre_gain_obj, audiofilters_distortion_obj_get_pre_gain);
214206

215-
static mp_obj_t audiofilters_distortion_obj_set_pre_gain(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
216-
enum { ARG_pre_gain };
217-
static const mp_arg_t allowed_args[] = {
218-
{ MP_QSTR_pre_gain, MP_ARG_OBJ | MP_ARG_REQUIRED, {} },
219-
};
220-
audiofilters_distortion_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]);
221-
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
222-
mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
223-
224-
common_hal_audiofilters_distortion_set_pre_gain(self, args[ARG_pre_gain].u_obj);
225-
207+
static mp_obj_t audiofilters_distortion_obj_set_pre_gain(mp_obj_t self_in, mp_obj_t pre_gain_in) {
208+
audiofilters_distortion_obj_t *self = MP_OBJ_TO_PTR(self_in);
209+
common_hal_audiofilters_distortion_set_pre_gain(self, pre_gain_in);
226210
return mp_const_none;
227211
}
228-
MP_DEFINE_CONST_FUN_OBJ_KW(audiofilters_distortion_set_pre_gain_obj, 1, audiofilters_distortion_obj_set_pre_gain);
212+
MP_DEFINE_CONST_FUN_OBJ_2(audiofilters_distortion_set_pre_gain_obj, audiofilters_distortion_obj_set_pre_gain);
229213

230214
MP_PROPERTY_GETSET(audiofilters_distortion_pre_gain_obj,
231215
(mp_obj_t)&audiofilters_distortion_get_pre_gain_obj,
@@ -239,20 +223,12 @@ static mp_obj_t audiofilters_distortion_obj_get_post_gain(mp_obj_t self_in) {
239223
}
240224
MP_DEFINE_CONST_FUN_OBJ_1(audiofilters_distortion_get_post_gain_obj, audiofilters_distortion_obj_get_post_gain);
241225

242-
static mp_obj_t audiofilters_distortion_obj_set_post_gain(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
243-
enum { ARG_post_gain };
244-
static const mp_arg_t allowed_args[] = {
245-
{ MP_QSTR_post_gain, MP_ARG_OBJ | MP_ARG_REQUIRED, {} },
246-
};
247-
audiofilters_distortion_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]);
248-
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
249-
mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
250-
251-
common_hal_audiofilters_distortion_set_post_gain(self, args[ARG_post_gain].u_obj);
252-
226+
static mp_obj_t audiofilters_distortion_obj_set_post_gain(mp_obj_t self_in, mp_obj_t post_gain_in) {
227+
audiofilters_distortion_obj_t *self = MP_OBJ_TO_PTR(self_in);
228+
common_hal_audiofilters_distortion_set_post_gain(self, post_gain_in);
253229
return mp_const_none;
254230
}
255-
MP_DEFINE_CONST_FUN_OBJ_KW(audiofilters_distortion_set_post_gain_obj, 1, audiofilters_distortion_obj_set_post_gain);
231+
MP_DEFINE_CONST_FUN_OBJ_2(audiofilters_distortion_set_post_gain_obj, audiofilters_distortion_obj_set_post_gain);
256232

257233
MP_PROPERTY_GETSET(audiofilters_distortion_post_gain_obj,
258234
(mp_obj_t)&audiofilters_distortion_get_post_gain_obj,
@@ -268,21 +244,13 @@ static mp_obj_t audiofilters_distortion_obj_get_mode(mp_obj_t self_in) {
268244
}
269245
MP_DEFINE_CONST_FUN_OBJ_1(audiofilters_distortion_get_mode_obj, audiofilters_distortion_obj_get_mode);
270246

271-
static mp_obj_t audiofilters_distortion_obj_set_mode(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
272-
enum { ARG_mode };
273-
static const mp_arg_t allowed_args[] = {
274-
{ MP_QSTR_mode, MP_ARG_OBJ | MP_ARG_REQUIRED, {} },
275-
};
276-
audiofilters_distortion_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]);
277-
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
278-
mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
279-
280-
audiofilters_distortion_mode mode = validate_distortion_mode(args[ARG_mode].u_obj, MP_QSTR_mode);
247+
static mp_obj_t audiofilters_distortion_obj_set_mode(mp_obj_t self_in, mp_obj_t mode_in) {
248+
audiofilters_distortion_obj_t *self = MP_OBJ_TO_PTR(self_in);
249+
audiofilters_distortion_mode mode = validate_distortion_mode(mode_in, MP_QSTR_mode);
281250
common_hal_audiofilters_distortion_set_mode(self, mode);
282-
283251
return mp_const_none;
284252
}
285-
MP_DEFINE_CONST_FUN_OBJ_KW(audiofilters_distortion_set_mode_obj, 1, audiofilters_distortion_obj_set_mode);
253+
MP_DEFINE_CONST_FUN_OBJ_2(audiofilters_distortion_set_mode_obj, audiofilters_distortion_obj_set_mode);
286254

287255
MP_PROPERTY_GETSET(audiofilters_distortion_mode_obj,
288256
(mp_obj_t)&audiofilters_distortion_get_mode_obj,
@@ -296,20 +264,12 @@ static mp_obj_t audiofilters_distortion_obj_get_mix(mp_obj_t self_in) {
296264
}
297265
MP_DEFINE_CONST_FUN_OBJ_1(audiofilters_distortion_get_mix_obj, audiofilters_distortion_obj_get_mix);
298266

299-
static mp_obj_t audiofilters_distortion_obj_set_mix(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
300-
enum { ARG_mix };
301-
static const mp_arg_t allowed_args[] = {
302-
{ MP_QSTR_mix, MP_ARG_OBJ | MP_ARG_REQUIRED, {} },
303-
};
304-
audiofilters_distortion_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]);
305-
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
306-
mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
307-
308-
common_hal_audiofilters_distortion_set_mix(self, args[ARG_mix].u_obj);
309-
267+
static mp_obj_t audiofilters_distortion_obj_set_mix(mp_obj_t self_in, mp_obj_t mix_in) {
268+
audiofilters_distortion_obj_t *self = MP_OBJ_TO_PTR(self_in);
269+
common_hal_audiofilters_distortion_set_mix(self, mix_in);
310270
return mp_const_none;
311271
}
312-
MP_DEFINE_CONST_FUN_OBJ_KW(audiofilters_distortion_set_mix_obj, 1, audiofilters_distortion_obj_set_mix);
272+
MP_DEFINE_CONST_FUN_OBJ_2(audiofilters_distortion_set_mix_obj, audiofilters_distortion_obj_set_mix);
313273

314274
MP_PROPERTY_GETSET(audiofilters_distortion_mix_obj,
315275
(mp_obj_t)&audiofilters_distortion_get_mix_obj,

0 commit comments

Comments
 (0)