10
10
#include "shared-bindings/synthio/BlockBiquad.h"
11
11
#include "shared-bindings/util.h"
12
12
13
- //| class FilterType :
13
+ //| class FilterMode :
14
14
//| """The type of filter"""
15
15
//|
16
- //| LOW_PASS: FilterType
16
+ //| LOW_PASS: FilterMode
17
17
//| """A low-pass filter"""
18
- //| HIGH_PASS: FilterType
18
+ //| HIGH_PASS: FilterMode
19
19
//| """A high-pass filter"""
20
- //| BAND_PASS: FilterType
20
+ //| BAND_PASS: FilterMode
21
21
//| """A band-pass filter"""
22
22
//|
23
23
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 );
27
27
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 ),
32
32
};
33
33
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 );
35
35
36
- MAKE_PRINTER (synthio , synthio_filter );
36
+ MAKE_PRINTER (synthio , synthio_filter_mode );
37
37
38
- MAKE_ENUM_TYPE (synthio , FilterType , synthio_filter );
38
+ MAKE_ENUM_TYPE (synthio , FilterMode , synthio_filter_mode );
39
39
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 );
42
42
}
43
43
44
44
//| class BlockBiquad:
45
45
//| def __init__(
46
46
//| self,
47
- //| kind: FilterType ,
47
+ //| mode: FilterMode ,
48
48
//| frequency: BlockInput,
49
49
//| q_factor: BlockInput = 0.7071067811865475,
50
50
//| ) -> None:
@@ -61,13 +61,13 @@ static synthio_filter_e validate_synthio_filter(mp_obj_t obj, qstr arg_name) {
61
61
//| appears to work as you'd expect."""
62
62
63
63
static 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 } },
65
65
{ MP_QSTR_frequency , MP_ARG_OBJ | MP_ARG_REQUIRED , {.u_obj = MP_OBJ_NULL } },
66
66
{ MP_QSTR_Q , MP_ARG_OBJ , {.u_obj = MP_OBJ_NULL } },
67
67
};
68
68
69
69
static 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 };
71
71
72
72
mp_arg_val_t args [MP_ARRAY_SIZE (block_biquad_properties )];
73
73
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
76
76
args [ARG_Q ].u_obj = mp_obj_new_float (MICROPY_FLOAT_CONST (0.7071067811865475 ));
77
77
}
78
78
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 );
81
81
}
82
82
83
83
//|
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 ) {
87
87
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 ));
89
89
}
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 );
91
91
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 );
94
94
95
95
//|
96
96
//| frequency: BlockInput
@@ -133,7 +133,7 @@ MP_PROPERTY_GETSET(synthio_block_biquad_q_factor_obj,
133
133
(mp_obj_t )& synthio_block_biquad_set_q_factor_obj );
134
134
135
135
static 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 ) },
137
137
{ MP_ROM_QSTR (MP_QSTR_frequency ), MP_ROM_PTR (& synthio_block_biquad_frequency_obj ) },
138
138
{ MP_ROM_QSTR (MP_QSTR_q_factor ), MP_ROM_PTR (& synthio_block_biquad_q_factor_obj ) },
139
139
};
0 commit comments