@@ -142,6 +142,31 @@ function _init()
142142 table.insert (m .widgets , button )
143143 end
144144
145+ for mode in all (entities [" Checkbox" ]) do
146+ local button = widgets :create_checkbox (mode )
147+ table.insert (m .widgets , button )
148+ end
149+
150+ for effect in all (entities [" Sweep" ]) do
151+ local active = wire .find_widget (m .widgets , effect .fields .Enabled )
152+ local acceleration = wire .find_widget (m .widgets , effect .fields .Acceleration )
153+ local sweep = wire .find_widget (m .widgets , effect .fields .Sweep )
154+
155+ wire .produce_to (active , { " value" }, state , { " instrument" , " sweep" , " active" })
156+ wire .consume_on_update (active , { " value" }, state , { " instrument" , " sweep" , " active" })
157+
158+ wire .produce_to (acceleration , { " value" }, state , { " instrument" , " sweep" , " acceleration" })
159+ wire .consume_on_update (acceleration , { " value" }, state , { " instrument" , " sweep" , " acceleration" })
160+
161+ wire .produce_to (sweep , { " value" }, state , { " instrument" , " sweep" , " frequency" }, function (source , target , value )
162+ return juice .pow2 (200 , 2000 , value )
163+ end )
164+ wire .consume_on_update (sweep , { " value" }, state , { " instrument" , " sweep" , " frequency" }, function (source , target , value )
165+ return (value - 200 ) / (2000 - 200 )
166+ end )
167+
168+ end
169+
145170 -- force setting correct values
146171 if (state .on_change ) then
147172 state :on_change ()
0 commit comments