1010#include "shared-bindings/synthio/BlockBiquad.h"
1111#include "shared-bindings/util.h"
1212
13- //| class FilterType :
13+ //| class FilterMode :
1414//| """The type of filter"""
1515//|
16- //| LOW_PASS: FilterType
16+ //| LOW_PASS: FilterMode
1717//| """A low-pass filter"""
18- //| HIGH_PASS: FilterType
18+ //| HIGH_PASS: FilterMode
1919//| """A high-pass filter"""
20- //| BAND_PASS: FilterType
20+ //| BAND_PASS: FilterMode
2121//| """A band-pass filter"""
2222//|
2323
24- MAKE_ENUM_VALUE (synthio_filter_type , kind , LOW_PASS , SYNTHIO_LOW_PASS );
25- MAKE_ENUM_VALUE (synthio_filter_type , kind , HIGH_PASS , SYNTHIO_HIGH_PASS );
26- MAKE_ENUM_VALUE (synthio_filter_type , kind , BAND_PASS , SYNTHIO_BAND_PASS );
24+ MAKE_ENUM_VALUE (synthio_filter_mode_type , mode , LOW_PASS , SYNTHIO_LOW_PASS );
25+ MAKE_ENUM_VALUE (synthio_filter_mode_type , mode , HIGH_PASS , SYNTHIO_HIGH_PASS );
26+ MAKE_ENUM_VALUE (synthio_filter_mode_type , mode , BAND_PASS , SYNTHIO_BAND_PASS );
2727
28- MAKE_ENUM_MAP (synthio_filter ) {
29- MAKE_ENUM_MAP_ENTRY (kind , LOW_PASS ),
30- MAKE_ENUM_MAP_ENTRY (kind , HIGH_PASS ),
31- MAKE_ENUM_MAP_ENTRY (kind , BAND_PASS ),
28+ MAKE_ENUM_MAP (synthio_filter_mode ) {
29+ MAKE_ENUM_MAP_ENTRY (mode , LOW_PASS ),
30+ MAKE_ENUM_MAP_ENTRY (mode , HIGH_PASS ),
31+ MAKE_ENUM_MAP_ENTRY (mode , BAND_PASS ),
3232};
3333
34- static MP_DEFINE_CONST_DICT (synthio_filter_locals_dict , synthio_filter_locals_table );
34+ static MP_DEFINE_CONST_DICT (synthio_filter_mode_locals_dict , synthio_filter_mode_locals_table );
3535
36- MAKE_PRINTER (synthio , synthio_filter );
36+ MAKE_PRINTER (synthio , synthio_filter_mode );
3737
38- MAKE_ENUM_TYPE (synthio , FilterType , synthio_filter );
38+ MAKE_ENUM_TYPE (synthio , FilterMode , synthio_filter_mode );
3939
40- static synthio_filter_e validate_synthio_filter (mp_obj_t obj , qstr arg_name ) {
41- return cp_enum_value (& synthio_filter_type , obj , arg_name );
40+ static synthio_filter_mode validate_synthio_filter_mode (mp_obj_t obj , qstr arg_name ) {
41+ return cp_enum_value (& synthio_filter_mode_type , obj , arg_name );
4242}
4343
4444//| class BlockBiquad:
4545//| def __init__(
4646//| self,
47- //| kind: FilterType ,
47+ //| mode: FilterMode ,
4848//| frequency: BlockInput,
4949//| q_factor: BlockInput = 0.7071067811865475,
5050//| ) -> None:
@@ -61,13 +61,13 @@ static synthio_filter_e validate_synthio_filter(mp_obj_t obj, qstr arg_name) {
6161//| appears to work as you'd expect."""
6262
6363static const mp_arg_t block_biquad_properties [] = {
64- { MP_QSTR_kind , MP_ARG_OBJ | MP_ARG_REQUIRED , {.u_obj = MP_OBJ_NULL } },
64+ { MP_QSTR_mode , MP_ARG_OBJ | MP_ARG_REQUIRED , {.u_obj = MP_OBJ_NULL } },
6565 { MP_QSTR_frequency , MP_ARG_OBJ | MP_ARG_REQUIRED , {.u_obj = MP_OBJ_NULL } },
6666 { MP_QSTR_Q , MP_ARG_OBJ , {.u_obj = MP_OBJ_NULL } },
6767};
6868
6969static mp_obj_t synthio_block_biquad_make_new (const mp_obj_type_t * type_in , size_t n_args , size_t n_kw , const mp_obj_t * all_args ) {
70- enum { ARG_kind , ARG_frequency , ARG_Q };
70+ enum { ARG_mode , ARG_frequency , ARG_Q };
7171
7272 mp_arg_val_t args [MP_ARRAY_SIZE (block_biquad_properties )];
7373 mp_arg_parse_all_kw_array (n_args , n_kw , all_args , MP_ARRAY_SIZE (block_biquad_properties ), block_biquad_properties , args );
@@ -76,21 +76,21 @@ static mp_obj_t synthio_block_biquad_make_new(const mp_obj_type_t *type_in, size
7676 args [ARG_Q ].u_obj = mp_obj_new_float (MICROPY_FLOAT_CONST (0.7071067811865475 ));
7777 }
7878
79- synthio_filter_e kind = validate_synthio_filter (args [ARG_kind ].u_obj , MP_QSTR_kind );
80- return common_hal_synthio_block_biquad_new (kind , args [ARG_frequency ].u_obj , args [ARG_Q ].u_obj );
79+ synthio_filter_mode mode = validate_synthio_filter_mode (args [ARG_mode ].u_obj , MP_QSTR_mode );
80+ return common_hal_synthio_block_biquad_new (mode , args [ARG_frequency ].u_obj , args [ARG_Q ].u_obj );
8181}
8282
8383//|
84- //| kind: FilterType
85- //| """The kind of filter (read-only)"""
86- static mp_obj_t synthio_block_biquad_get_kind (mp_obj_t self_in ) {
84+ //| mode: FilterMode
85+ //| """The mode of filter (read-only)"""
86+ static mp_obj_t synthio_block_biquad_get_mode (mp_obj_t self_in ) {
8787 synthio_block_biquad_t * self = MP_OBJ_TO_PTR (self_in );
88- return cp_enum_find (& synthio_filter_type , common_hal_synthio_block_biquad_get_kind (self ));
88+ return cp_enum_find (& synthio_filter_mode_type , common_hal_synthio_block_biquad_get_mode (self ));
8989}
90- MP_DEFINE_CONST_FUN_OBJ_1 (synthio_block_biquad_get_kind_obj , synthio_block_biquad_get_kind );
90+ MP_DEFINE_CONST_FUN_OBJ_1 (synthio_block_biquad_get_mode_obj , synthio_block_biquad_get_mode );
9191
92- MP_PROPERTY_GETTER (synthio_block_biquad_kind_obj ,
93- (mp_obj_t )& synthio_block_biquad_get_kind_obj );
92+ MP_PROPERTY_GETTER (synthio_block_biquad_mode_obj ,
93+ (mp_obj_t )& synthio_block_biquad_get_mode_obj );
9494
9595//|
9696//| frequency: BlockInput
@@ -133,7 +133,7 @@ MP_PROPERTY_GETSET(synthio_block_biquad_q_factor_obj,
133133 (mp_obj_t )& synthio_block_biquad_set_q_factor_obj );
134134
135135static const mp_rom_map_elem_t synthio_block_biquad_locals_dict_table [] = {
136- { MP_ROM_QSTR (MP_QSTR_kind ), MP_ROM_PTR (& synthio_block_biquad_kind_obj ) },
136+ { MP_ROM_QSTR (MP_QSTR_mode ), MP_ROM_PTR (& synthio_block_biquad_mode_obj ) },
137137 { MP_ROM_QSTR (MP_QSTR_frequency ), MP_ROM_PTR (& synthio_block_biquad_frequency_obj ) },
138138 { MP_ROM_QSTR (MP_QSTR_q_factor ), MP_ROM_PTR (& synthio_block_biquad_q_factor_obj ) },
139139};
0 commit comments