synthio: make most Note constructor args kw-only

for similar reasons as Envelope. The mandatory frequency argument can
still be given as a positional argument.
This commit is contained in:
Jeff Epler 2023-05-04 10:16:19 -05:00
parent c839888e28
commit a94031d094
No known key found for this signature in database
GPG Key ID: D5BF15AB975AB4DE

View File

@ -35,17 +35,18 @@
static const mp_arg_t note_properties[] = { static const mp_arg_t note_properties[] = {
{ MP_QSTR_frequency, MP_ARG_OBJ | MP_ARG_REQUIRED, {.u_obj = NULL } }, { MP_QSTR_frequency, MP_ARG_OBJ | MP_ARG_REQUIRED, {.u_obj = NULL } },
{ MP_QSTR_amplitude, MP_ARG_OBJ, {.u_obj = MP_ROM_INT(1) } }, { MP_QSTR_amplitude, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = MP_ROM_INT(1) } },
{ MP_QSTR_tremolo_rate, MP_ARG_OBJ, {.u_obj = NULL } }, { MP_QSTR_tremolo_rate, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = NULL } },
{ MP_QSTR_tremolo_depth, MP_ARG_OBJ, {.u_obj = NULL } }, { MP_QSTR_tremolo_depth, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = NULL } },
{ MP_QSTR_vibrato_rate, MP_ARG_OBJ, {.u_obj = NULL } }, { MP_QSTR_vibrato_rate, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = NULL } },
{ MP_QSTR_vibrato_depth, MP_ARG_OBJ, {.u_obj = NULL } }, { MP_QSTR_vibrato_depth, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = NULL } },
{ MP_QSTR_waveform, MP_ARG_OBJ, {.u_obj = MP_ROM_NONE } }, { MP_QSTR_waveform, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = MP_ROM_NONE } },
{ MP_QSTR_envelope, MP_ARG_OBJ, {.u_obj = MP_ROM_NONE } }, { MP_QSTR_envelope, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = MP_ROM_NONE } },
}; };
//| class Note: //| class Note:
//| def __init__( //| def __init__(
//| self, //| self,
//| *,
//| frequency: float, //| frequency: float,
//| amplitude: float = 1.0, //| amplitude: float = 1.0,
//| waveform: Optional[ReadableBuffer] = None, //| waveform: Optional[ReadableBuffer] = None,