63
63
//| rate: BlockInput = 1.0,
64
64
//| scale: BlockInput = 1.0,
65
65
//| offset: BlockInput = 0,
66
+ //| phase_offset: BlockInput = 0,
66
67
//| once=False
67
68
//| ):
68
69
//| pass
@@ -71,6 +72,7 @@ static const mp_arg_t lfo_properties[] = {
71
72
{ MP_QSTR_rate , MP_ARG_OBJ | MP_ARG_KW_ONLY , {.u_obj = MP_ROM_INT (1 ) } },
72
73
{ MP_QSTR_scale , MP_ARG_OBJ | MP_ARG_KW_ONLY , {.u_obj = MP_ROM_INT (1 ) } },
73
74
{ MP_QSTR_offset , MP_ARG_OBJ | MP_ARG_KW_ONLY , {.u_obj = MP_ROM_INT (0 ) } },
75
+ { MP_QSTR_phase_offset , MP_ARG_OBJ | MP_ARG_KW_ONLY , {.u_obj = MP_ROM_INT (0 ) } },
74
76
{ MP_QSTR_once , MP_ARG_OBJ | MP_ARG_KW_ONLY , {.u_obj = MP_ROM_INT (0 ) } },
75
77
};
76
78
@@ -141,6 +143,24 @@ MP_PROPERTY_GETSET(synthio_lfo_offset_obj,
141
143
(mp_obj_t )& synthio_lfo_get_offset_obj ,
142
144
(mp_obj_t )& synthio_lfo_set_offset_obj );
143
145
146
+ //| phase_offset: BlockInput
147
+ //| """An additive value applied to the LFO's phase"""
148
+ STATIC mp_obj_t synthio_lfo_get_phase_offset (mp_obj_t self_in ) {
149
+ synthio_lfo_obj_t * self = MP_OBJ_TO_PTR (self_in );
150
+ return common_hal_synthio_lfo_get_phase_offset_obj (self );
151
+ }
152
+ MP_DEFINE_CONST_FUN_OBJ_1 (synthio_lfo_get_phase_offset_obj , synthio_lfo_get_phase_offset );
153
+
154
+ STATIC mp_obj_t synthio_lfo_set_phase_offset (mp_obj_t self_in , mp_obj_t arg ) {
155
+ synthio_lfo_obj_t * self = MP_OBJ_TO_PTR (self_in );
156
+ common_hal_synthio_lfo_set_phase_offset_obj (self , arg );
157
+ return mp_const_none ;
158
+ }
159
+ MP_DEFINE_CONST_FUN_OBJ_2 (synthio_lfo_set_phase_offset_obj , synthio_lfo_set_phase_offset );
160
+ MP_PROPERTY_GETSET (synthio_lfo_phase_offset_obj ,
161
+ (mp_obj_t )& synthio_lfo_get_phase_offset_obj ,
162
+ (mp_obj_t )& synthio_lfo_set_phase_offset_obj );
163
+
144
164
//| scale: BlockInput
145
165
//| """An additive value applied to the LFO's output"""
146
166
STATIC mp_obj_t synthio_lfo_get_scale (mp_obj_t self_in ) {
@@ -161,7 +181,9 @@ MP_PROPERTY_GETSET(synthio_lfo_scale_obj,
161
181
162
182
//|
163
183
//| once: bool
164
- //| """True if the waveform should stop when it reaches its last output value, false if it should re-start at the beginning of its waveform"""
184
+ //| """True if the waveform should stop when it reaches its last output value, false if it should re-start at the beginning of its waveform
185
+ //|
186
+ //| This applies to the ``phase`` *before* the addition of any ``phase_offset`` """
165
187
STATIC mp_obj_t synthio_lfo_get_once (mp_obj_t self_in ) {
166
188
synthio_lfo_obj_t * self = MP_OBJ_TO_PTR (self_in );
167
189
return mp_obj_new_bool (common_hal_synthio_lfo_get_once (self ));
@@ -226,6 +248,7 @@ STATIC const mp_rom_map_elem_t synthio_lfo_locals_dict_table[] = {
226
248
{ MP_ROM_QSTR (MP_QSTR_rate ), MP_ROM_PTR (& synthio_lfo_rate_obj ) },
227
249
{ MP_ROM_QSTR (MP_QSTR_scale ), MP_ROM_PTR (& synthio_lfo_scale_obj ) },
228
250
{ MP_ROM_QSTR (MP_QSTR_offset ), MP_ROM_PTR (& synthio_lfo_offset_obj ) },
251
+ { MP_ROM_QSTR (MP_QSTR_phase_offset ), MP_ROM_PTR (& synthio_lfo_phase_offset_obj ) },
229
252
{ MP_ROM_QSTR (MP_QSTR_once ), MP_ROM_PTR (& synthio_lfo_once_obj ) },
230
253
{ MP_ROM_QSTR (MP_QSTR_value ), MP_ROM_PTR (& synthio_lfo_value_obj ) },
231
254
{ MP_ROM_QSTR (MP_QSTR_phase ), MP_ROM_PTR (& synthio_lfo_phase_obj ) },
0 commit comments