|
13 | 13 | #include "py/objproperty.h"
|
14 | 14 | #include "py/runtime.h"
|
15 | 15 | #include "shared-bindings/util.h"
|
| 16 | +#if CIRCUITPY_SYNTHIO |
| 17 | +#include "shared-module/synthio/block.h" |
| 18 | +#endif |
16 | 19 |
|
17 | 20 | //| class MixerVoice:
|
18 | 21 | //| """Voice objects used with Mixer
|
@@ -75,17 +78,18 @@ static mp_obj_t audiomixer_mixervoice_obj_stop(size_t n_args, const mp_obj_t *po
|
75 | 78 | }
|
76 | 79 | MP_DEFINE_CONST_FUN_OBJ_KW(audiomixer_mixervoice_stop_obj, 1, audiomixer_mixervoice_obj_stop);
|
77 | 80 |
|
78 |
| -//| level: float |
79 |
| -//| """The volume level of a voice, as a floating point number between 0 and 1.""" |
| 81 | +//| level: synthio.BlockInput |
| 82 | +//| """The volume level of a voice, as a floating point number between 0 and 1. If your board |
| 83 | +//| does not support synthio, this property will only accept a float value. |
| 84 | +//| """ |
80 | 85 | static mp_obj_t audiomixer_mixervoice_obj_get_level(mp_obj_t self_in) {
|
81 |
| - return mp_obj_new_float(common_hal_audiomixer_mixervoice_get_level(self_in)); |
| 86 | + return common_hal_audiomixer_mixervoice_get_level(self_in); |
82 | 87 | }
|
83 | 88 | MP_DEFINE_CONST_FUN_OBJ_1(audiomixer_mixervoice_get_level_obj, audiomixer_mixervoice_obj_get_level);
|
84 | 89 |
|
85 | 90 | static mp_obj_t audiomixer_mixervoice_obj_set_level(mp_obj_t self_in, mp_obj_t level_in) {
|
86 | 91 | audiomixer_mixervoice_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
87 |
| - mp_float_t level = mp_arg_validate_obj_float_range(level_in, 0, 1, MP_QSTR_level); |
88 |
| - common_hal_audiomixer_mixervoice_set_level(self, level); |
| 92 | + common_hal_audiomixer_mixervoice_set_level(self, level_in); |
89 | 93 | return mp_const_none;
|
90 | 94 | }
|
91 | 95 | MP_DEFINE_CONST_FUN_OBJ_2(audiomixer_mixervoice_set_level_obj, audiomixer_mixervoice_obj_set_level);
|
|
0 commit comments