6363//| rate: BlockInput = 1.0,
6464//| scale: BlockInput = 1.0,
6565//| offset: BlockInput = 0,
66+ //| phase_offset: BlockInput = 0,
6667//| once=False
6768//| ):
6869//| pass
@@ -71,6 +72,7 @@ static const mp_arg_t lfo_properties[] = {
7172 { MP_QSTR_rate , MP_ARG_OBJ | MP_ARG_KW_ONLY , {.u_obj = MP_ROM_INT (1 ) } },
7273 { MP_QSTR_scale , MP_ARG_OBJ | MP_ARG_KW_ONLY , {.u_obj = MP_ROM_INT (1 ) } },
7374 { 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 ) } },
7476 { MP_QSTR_once , MP_ARG_OBJ | MP_ARG_KW_ONLY , {.u_obj = MP_ROM_INT (0 ) } },
7577};
7678
@@ -141,6 +143,24 @@ MP_PROPERTY_GETSET(synthio_lfo_offset_obj,
141143 (mp_obj_t )& synthio_lfo_get_offset_obj ,
142144 (mp_obj_t )& synthio_lfo_set_offset_obj );
143145
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+
144164//| scale: BlockInput
145165//| """An additive value applied to the LFO's output"""
146166STATIC mp_obj_t synthio_lfo_get_scale (mp_obj_t self_in ) {
@@ -161,7 +181,9 @@ MP_PROPERTY_GETSET(synthio_lfo_scale_obj,
161181
162182//|
163183//| 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`` """
165187STATIC mp_obj_t synthio_lfo_get_once (mp_obj_t self_in ) {
166188 synthio_lfo_obj_t * self = MP_OBJ_TO_PTR (self_in );
167189 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[] = {
226248 { MP_ROM_QSTR (MP_QSTR_rate ), MP_ROM_PTR (& synthio_lfo_rate_obj ) },
227249 { MP_ROM_QSTR (MP_QSTR_scale ), MP_ROM_PTR (& synthio_lfo_scale_obj ) },
228250 { 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 ) },
229252 { MP_ROM_QSTR (MP_QSTR_once ), MP_ROM_PTR (& synthio_lfo_once_obj ) },
230253 { MP_ROM_QSTR (MP_QSTR_value ), MP_ROM_PTR (& synthio_lfo_value_obj ) },
231254 { MP_ROM_QSTR (MP_QSTR_phase ), MP_ROM_PTR (& synthio_lfo_phase_obj ) },
0 commit comments