@@ -20,15 +20,15 @@ static const mp_arg_t note_properties[] = {
2020 { MP_QSTR_amplitude , MP_ARG_OBJ | MP_ARG_KW_ONLY , {.u_obj = MP_ROM_INT (1 ) } },
2121 { MP_QSTR_bend , MP_ARG_OBJ | MP_ARG_KW_ONLY , {.u_obj = MP_ROM_INT (0 ) } },
2222 { MP_QSTR_waveform , MP_ARG_OBJ | MP_ARG_KW_ONLY , {.u_obj = MP_ROM_NONE } },
23- { MP_QSTR_waveform_loop_start , MP_ARG_OBJ , {.u_obj = MP_ROM_INT (0 ) } },
24- { MP_QSTR_waveform_loop_end , MP_ARG_OBJ , {.u_obj = MP_ROM_INT (SYNTHIO_WAVEFORM_SIZE ) } },
23+ { MP_QSTR_waveform_loop_start , MP_ARG_OBJ | MP_ARG_KW_ONLY , {.u_obj = MP_ROM_INT (0 ) } },
24+ { MP_QSTR_waveform_loop_end , MP_ARG_OBJ | MP_ARG_KW_ONLY , {.u_obj = MP_ROM_INT (SYNTHIO_WAVEFORM_SIZE ) } },
2525 { MP_QSTR_envelope , MP_ARG_OBJ | MP_ARG_KW_ONLY , {.u_obj = MP_ROM_NONE } },
2626 { MP_QSTR_filter , MP_ARG_OBJ | MP_ARG_KW_ONLY , {.u_obj = MP_ROM_NONE } },
2727 { MP_QSTR_ring_frequency , MP_ARG_OBJ , {.u_obj = MP_ROM_INT (0 ) } },
2828 { MP_QSTR_ring_bend , MP_ARG_OBJ , {.u_obj = MP_ROM_INT (0 ) } },
2929 { MP_QSTR_ring_waveform , MP_ARG_OBJ | MP_ARG_KW_ONLY , {.u_obj = MP_ROM_NONE } },
30- { MP_QSTR_ring_waveform_loop_start , MP_ARG_OBJ , {.u_obj = MP_ROM_INT (0 ) } },
31- { MP_QSTR_ring_waveform_loop_end , MP_ARG_OBJ , {.u_obj = MP_ROM_INT (SYNTHIO_WAVEFORM_SIZE ) } },
30+ { MP_QSTR_ring_waveform_loop_start , MP_ARG_OBJ | MP_ARG_KW_ONLY , {.u_obj = MP_ROM_INT (0 ) } },
31+ { MP_QSTR_ring_waveform_loop_end , MP_ARG_OBJ | MP_ARG_KW_ONLY , {.u_obj = MP_ROM_INT (SYNTHIO_WAVEFORM_SIZE ) } },
3232};
3333//| class Note:
3434//| def __init__(
@@ -37,17 +37,17 @@ static const mp_arg_t note_properties[] = {
3737//| frequency: float,
3838//| panning: BlockInput = 0.0,
3939//| waveform: Optional[ReadableBuffer] = None,
40- //| waveform_loop_start: int = 0,
41- //| waveform_loop_end: int = waveform_max_length,
40+ //| waveform_loop_start: BlockInput = 0,
41+ //| waveform_loop_end: BlockInput = waveform_max_length,
4242//| envelope: Optional[Envelope] = None,
4343//| amplitude: BlockInput = 1.0,
4444//| bend: BlockInput = 0.0,
4545//| filter: Optional[Biquad] = None,
4646//| ring_frequency: float = 0.0,
4747//| ring_bend: float = 0.0,
4848//| ring_waveform: Optional[ReadableBuffer] = None,
49- //| ring_waveform_loop_start: int = 0,
50- //| ring_waveform_loop_end: int = waveform_max_length,
49+ //| ring_waveform_loop_start: BlockInput = 0,
50+ //| ring_waveform_loop_end: BlockInput = waveform_max_length,
5151//| ) -> None:
5252//| """Construct a Note object, with a frequency in Hz, and optional panning, waveform, envelope, tremolo (volume change) and bend (frequency change).
5353//|
@@ -198,29 +198,31 @@ MP_PROPERTY_GETSET(synthio_note_waveform_obj,
198198 (mp_obj_t )& synthio_note_get_waveform_obj ,
199199 (mp_obj_t )& synthio_note_set_waveform_obj );
200200
201- //| waveform_loop_start: int
201+
202+
203+ //| waveform_loop_start: BlockInput
202204//| """The sample index of where to begin looping waveform data.
203205//|
204206//| Values outside the range ``0`` to ``waveform_max_length-1`` (inclusive) are rejected with a `ValueError`.
205207//|
206208//| Values greater than or equal to the actual waveform length are treated as 0."""
207209static mp_obj_t synthio_note_get_waveform_loop_start (mp_obj_t self_in ) {
208210 synthio_note_obj_t * self = MP_OBJ_TO_PTR (self_in );
209- return mp_obj_new_int ( common_hal_synthio_note_get_waveform_loop_start (self ) );
211+ return common_hal_synthio_note_get_waveform_loop_start (self );
210212}
211213MP_DEFINE_CONST_FUN_OBJ_1 (synthio_note_get_waveform_loop_start_obj , synthio_note_get_waveform_loop_start );
212214
213215static mp_obj_t synthio_note_set_waveform_loop_start (mp_obj_t self_in , mp_obj_t arg ) {
214216 synthio_note_obj_t * self = MP_OBJ_TO_PTR (self_in );
215- common_hal_synthio_note_set_waveform_loop_start (self , mp_obj_get_int ( arg ) );
217+ common_hal_synthio_note_set_waveform_loop_start (self , arg );
216218 return mp_const_none ;
217219}
218220MP_DEFINE_CONST_FUN_OBJ_2 (synthio_note_set_waveform_loop_start_obj , synthio_note_set_waveform_loop_start );
219221MP_PROPERTY_GETSET (synthio_note_waveform_loop_start_obj ,
220222 (mp_obj_t )& synthio_note_get_waveform_loop_start_obj ,
221223 (mp_obj_t )& synthio_note_set_waveform_loop_start_obj );
222224
223- //| waveform_loop_end: int
225+ //| waveform_loop_end: BlockInput
224226//| """The sample index of where to end looping waveform data.
225227//|
226228//| Values outside the range ``1`` to ``waveform_max_length`` (inclusive) are rejected with a `ValueError`.
@@ -231,13 +233,13 @@ MP_PROPERTY_GETSET(synthio_note_waveform_loop_start_obj,
231233//|
232234static mp_obj_t synthio_note_get_waveform_loop_end (mp_obj_t self_in ) {
233235 synthio_note_obj_t * self = MP_OBJ_TO_PTR (self_in );
234- return mp_obj_new_int ( common_hal_synthio_note_get_waveform_loop_end (self ) );
236+ return common_hal_synthio_note_get_waveform_loop_end (self );
235237}
236238MP_DEFINE_CONST_FUN_OBJ_1 (synthio_note_get_waveform_loop_end_obj , synthio_note_get_waveform_loop_end );
237239
238240static mp_obj_t synthio_note_set_waveform_loop_end (mp_obj_t self_in , mp_obj_t arg ) {
239241 synthio_note_obj_t * self = MP_OBJ_TO_PTR (self_in );
240- common_hal_synthio_note_set_waveform_loop_end (self , mp_obj_get_int ( arg ) );
242+ common_hal_synthio_note_set_waveform_loop_end (self , arg );
241243 return mp_const_none ;
242244}
243245MP_DEFINE_CONST_FUN_OBJ_2 (synthio_note_set_waveform_loop_end_obj , synthio_note_set_waveform_loop_end );
@@ -331,29 +333,29 @@ MP_PROPERTY_GETSET(synthio_note_ring_waveform_obj,
331333 (mp_obj_t )& synthio_note_get_ring_waveform_obj ,
332334 (mp_obj_t )& synthio_note_set_ring_waveform_obj );
333335
334- //| ring_waveform_loop_start: int
336+ //| ring_waveform_loop_start: BlockInput
335337//| """The sample index of where to begin looping waveform data.
336338//|
337339//| Values outside the range ``0`` to ``waveform_max_length-1`` (inclusive) are rejected with a `ValueError`.
338340//|
339341//| Values greater than or equal to the actual waveform length are treated as 0."""
340342static mp_obj_t synthio_note_get_ring_waveform_loop_start (mp_obj_t self_in ) {
341343 synthio_note_obj_t * self = MP_OBJ_TO_PTR (self_in );
342- return mp_obj_new_int ( common_hal_synthio_note_get_ring_waveform_loop_start (self ) );
344+ return common_hal_synthio_note_get_ring_waveform_loop_start (self );
343345}
344346MP_DEFINE_CONST_FUN_OBJ_1 (synthio_note_get_ring_waveform_loop_start_obj , synthio_note_get_ring_waveform_loop_start );
345347
346348static mp_obj_t synthio_note_set_ring_waveform_loop_start (mp_obj_t self_in , mp_obj_t arg ) {
347349 synthio_note_obj_t * self = MP_OBJ_TO_PTR (self_in );
348- common_hal_synthio_note_set_ring_waveform_loop_start (self , mp_obj_get_int ( arg ) );
350+ common_hal_synthio_note_set_ring_waveform_loop_start (self , arg );
349351 return mp_const_none ;
350352}
351353MP_DEFINE_CONST_FUN_OBJ_2 (synthio_note_set_ring_waveform_loop_start_obj , synthio_note_set_ring_waveform_loop_start );
352354MP_PROPERTY_GETSET (synthio_note_ring_waveform_loop_start_obj ,
353355 (mp_obj_t )& synthio_note_get_ring_waveform_loop_start_obj ,
354356 (mp_obj_t )& synthio_note_set_ring_waveform_loop_start_obj );
355357
356- //| ring_waveform_loop_end: int
358+ //| ring_waveform_loop_end: BlockInput
357359//| """The sample index of where to end looping waveform data.
358360//|
359361//| Values outside the range ``1`` to ``waveform_max_length`` (inclusive) are rejected with a `ValueError`.
@@ -364,13 +366,13 @@ MP_PROPERTY_GETSET(synthio_note_ring_waveform_loop_start_obj,
364366//|
365367static mp_obj_t synthio_note_get_ring_waveform_loop_end (mp_obj_t self_in ) {
366368 synthio_note_obj_t * self = MP_OBJ_TO_PTR (self_in );
367- return mp_obj_new_int ( common_hal_synthio_note_get_ring_waveform_loop_end (self ) );
369+ return common_hal_synthio_note_get_ring_waveform_loop_end (self );
368370}
369371MP_DEFINE_CONST_FUN_OBJ_1 (synthio_note_get_ring_waveform_loop_end_obj , synthio_note_get_ring_waveform_loop_end );
370372
371373static mp_obj_t synthio_note_set_ring_waveform_loop_end (mp_obj_t self_in , mp_obj_t arg ) {
372374 synthio_note_obj_t * self = MP_OBJ_TO_PTR (self_in );
373- common_hal_synthio_note_set_ring_waveform_loop_end (self , mp_obj_get_int ( arg ) );
375+ common_hal_synthio_note_set_ring_waveform_loop_end (self , arg );
374376 return mp_const_none ;
375377}
376378MP_DEFINE_CONST_FUN_OBJ_2 (synthio_note_set_ring_waveform_loop_end_obj , synthio_note_set_ring_waveform_loop_end );
0 commit comments