@@ -20,15 +20,15 @@ static const mp_arg_t note_properties[] = {
20
20
{ MP_QSTR_amplitude , MP_ARG_OBJ | MP_ARG_KW_ONLY , {.u_obj = MP_ROM_INT (1 ) } },
21
21
{ MP_QSTR_bend , MP_ARG_OBJ | MP_ARG_KW_ONLY , {.u_obj = MP_ROM_INT (0 ) } },
22
22
{ 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 ) } },
25
25
{ MP_QSTR_envelope , MP_ARG_OBJ | MP_ARG_KW_ONLY , {.u_obj = MP_ROM_NONE } },
26
26
{ MP_QSTR_filter , MP_ARG_OBJ | MP_ARG_KW_ONLY , {.u_obj = MP_ROM_NONE } },
27
27
{ MP_QSTR_ring_frequency , MP_ARG_OBJ , {.u_obj = MP_ROM_INT (0 ) } },
28
28
{ MP_QSTR_ring_bend , MP_ARG_OBJ , {.u_obj = MP_ROM_INT (0 ) } },
29
29
{ 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 ) } },
32
32
};
33
33
//| class Note:
34
34
//| def __init__(
@@ -37,17 +37,17 @@ static const mp_arg_t note_properties[] = {
37
37
//| frequency: float,
38
38
//| panning: BlockInput = 0.0,
39
39
//| 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,
42
42
//| envelope: Optional[Envelope] = None,
43
43
//| amplitude: BlockInput = 1.0,
44
44
//| bend: BlockInput = 0.0,
45
45
//| filter: Optional[Biquad] = None,
46
46
//| ring_frequency: float = 0.0,
47
47
//| ring_bend: float = 0.0,
48
48
//| 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,
51
51
//| ) -> None:
52
52
//| """Construct a Note object, with a frequency in Hz, and optional panning, waveform, envelope, tremolo (volume change) and bend (frequency change).
53
53
//|
@@ -198,29 +198,31 @@ MP_PROPERTY_GETSET(synthio_note_waveform_obj,
198
198
(mp_obj_t )& synthio_note_get_waveform_obj ,
199
199
(mp_obj_t )& synthio_note_set_waveform_obj );
200
200
201
- //| waveform_loop_start: int
201
+
202
+
203
+ //| waveform_loop_start: BlockInput
202
204
//| """The sample index of where to begin looping waveform data.
203
205
//|
204
206
//| Values outside the range ``0`` to ``waveform_max_length-1`` (inclusive) are rejected with a `ValueError`.
205
207
//|
206
208
//| Values greater than or equal to the actual waveform length are treated as 0."""
207
209
static mp_obj_t synthio_note_get_waveform_loop_start (mp_obj_t self_in ) {
208
210
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 );
210
212
}
211
213
MP_DEFINE_CONST_FUN_OBJ_1 (synthio_note_get_waveform_loop_start_obj , synthio_note_get_waveform_loop_start );
212
214
213
215
static mp_obj_t synthio_note_set_waveform_loop_start (mp_obj_t self_in , mp_obj_t arg ) {
214
216
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 );
216
218
return mp_const_none ;
217
219
}
218
220
MP_DEFINE_CONST_FUN_OBJ_2 (synthio_note_set_waveform_loop_start_obj , synthio_note_set_waveform_loop_start );
219
221
MP_PROPERTY_GETSET (synthio_note_waveform_loop_start_obj ,
220
222
(mp_obj_t )& synthio_note_get_waveform_loop_start_obj ,
221
223
(mp_obj_t )& synthio_note_set_waveform_loop_start_obj );
222
224
223
- //| waveform_loop_end: int
225
+ //| waveform_loop_end: BlockInput
224
226
//| """The sample index of where to end looping waveform data.
225
227
//|
226
228
//| 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,
231
233
//|
232
234
static mp_obj_t synthio_note_get_waveform_loop_end (mp_obj_t self_in ) {
233
235
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 );
235
237
}
236
238
MP_DEFINE_CONST_FUN_OBJ_1 (synthio_note_get_waveform_loop_end_obj , synthio_note_get_waveform_loop_end );
237
239
238
240
static mp_obj_t synthio_note_set_waveform_loop_end (mp_obj_t self_in , mp_obj_t arg ) {
239
241
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 );
241
243
return mp_const_none ;
242
244
}
243
245
MP_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,
331
333
(mp_obj_t )& synthio_note_get_ring_waveform_obj ,
332
334
(mp_obj_t )& synthio_note_set_ring_waveform_obj );
333
335
334
- //| ring_waveform_loop_start: int
336
+ //| ring_waveform_loop_start: BlockInput
335
337
//| """The sample index of where to begin looping waveform data.
336
338
//|
337
339
//| Values outside the range ``0`` to ``waveform_max_length-1`` (inclusive) are rejected with a `ValueError`.
338
340
//|
339
341
//| Values greater than or equal to the actual waveform length are treated as 0."""
340
342
static mp_obj_t synthio_note_get_ring_waveform_loop_start (mp_obj_t self_in ) {
341
343
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 );
343
345
}
344
346
MP_DEFINE_CONST_FUN_OBJ_1 (synthio_note_get_ring_waveform_loop_start_obj , synthio_note_get_ring_waveform_loop_start );
345
347
346
348
static mp_obj_t synthio_note_set_ring_waveform_loop_start (mp_obj_t self_in , mp_obj_t arg ) {
347
349
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 );
349
351
return mp_const_none ;
350
352
}
351
353
MP_DEFINE_CONST_FUN_OBJ_2 (synthio_note_set_ring_waveform_loop_start_obj , synthio_note_set_ring_waveform_loop_start );
352
354
MP_PROPERTY_GETSET (synthio_note_ring_waveform_loop_start_obj ,
353
355
(mp_obj_t )& synthio_note_get_ring_waveform_loop_start_obj ,
354
356
(mp_obj_t )& synthio_note_set_ring_waveform_loop_start_obj );
355
357
356
- //| ring_waveform_loop_end: int
358
+ //| ring_waveform_loop_end: BlockInput
357
359
//| """The sample index of where to end looping waveform data.
358
360
//|
359
361
//| 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,
364
366
//|
365
367
static mp_obj_t synthio_note_get_ring_waveform_loop_end (mp_obj_t self_in ) {
366
368
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 );
368
370
}
369
371
MP_DEFINE_CONST_FUN_OBJ_1 (synthio_note_get_ring_waveform_loop_end_obj , synthio_note_get_ring_waveform_loop_end );
370
372
371
373
static mp_obj_t synthio_note_set_ring_waveform_loop_end (mp_obj_t self_in , mp_obj_t arg ) {
372
374
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 );
374
376
return mp_const_none ;
375
377
}
376
378
MP_DEFINE_CONST_FUN_OBJ_2 (synthio_note_set_ring_waveform_loop_end_obj , synthio_note_set_ring_waveform_loop_end );
0 commit comments