Skip to content

Commit 375a9cd

Browse files
committed
add Synthesizer.release
1 parent ca6ea83 commit 375a9cd

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

shared-bindings/synthio/Synthesizer.c

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,20 @@ STATIC mp_obj_t synthio_synthesizer_press(mp_obj_t self_in, mp_obj_t press) {
9292
return mp_const_none;
9393
}
9494
STATIC MP_DEFINE_CONST_FUN_OBJ_2(synthio_synthesizer_press_obj, synthio_synthesizer_press);
95-
//
95+
//| def release(self, /, release: Sequence[int] = ()) -> None:
96+
//| """Turn some notes off. Notes use MIDI numbering, with 60 being middle C, approximately 262Hz.
97+
//|
98+
//| Releasing a note that was already released has no effect.
99+
//|
100+
//| :param Sequence[int] release: Any sequence of integer notes."""
101+
STATIC mp_obj_t synthio_synthesizer_release(mp_obj_t self_in, mp_obj_t release) {
102+
synthio_synthesizer_obj_t *self = MP_OBJ_TO_PTR(self_in);
103+
check_for_deinit(self);
104+
common_hal_synthio_synthesizer_release(self, release);
105+
return mp_const_none;
106+
}
107+
STATIC MP_DEFINE_CONST_FUN_OBJ_2(synthio_synthesizer_release_obj, synthio_synthesizer_release);
108+
96109
//| def release_then_press(
97110
//| self, release: Sequence[int] = (), press: Sequence[int] = ()
98111
//| ) -> None:
@@ -210,6 +223,7 @@ MP_PROPERTY_GETTER(synthio_synthesizer_pressed_obj,
210223
STATIC const mp_rom_map_elem_t synthio_synthesizer_locals_dict_table[] = {
211224
// Methods
212225
{ MP_ROM_QSTR(MP_QSTR_press), MP_ROM_PTR(&synthio_synthesizer_press_obj) },
226+
{ MP_ROM_QSTR(MP_QSTR_release), MP_ROM_PTR(&synthio_synthesizer_release_obj) },
213227
{ MP_ROM_QSTR(MP_QSTR_release_all), MP_ROM_PTR(&synthio_synthesizer_release_all_obj) },
214228
{ MP_ROM_QSTR(MP_QSTR_release_then_press), MP_ROM_PTR(&synthio_synthesizer_release_then_press_obj) },
215229
{ MP_ROM_QSTR(MP_QSTR_release_all_then_press), MP_ROM_PTR(&synthio_synthesizer_release_all_then_press_obj) },

0 commit comments

Comments
 (0)