"""
Analog LFO Section
"""
from typing import Callable, Literal
from jdxi_editor.midi.data.parameter.analog.spec import JDXiMidiAnalog as Analog
from jdxi_editor.midi.io.helper import MidiIOHelper
from jdxi_editor.ui.editors.base.lfo import BaseLFOSection
from jdxi_editor.ui.widgets.editor import IconType
[docs]
class AnalogLFOSection(BaseLFOSection):
def __init__(
self,
send_midi_parameter: Callable | None = None,
midi_helper: MidiIOHelper = None,
):
[docs]
self.midi_helper = midi_helper
# configure BEFORE base UI build
from jdxi_editor.midi.data.parameter.analog.address import AnalogParam
[docs]
self.lfo_shape_param: Literal[AnalogParam.LFO_SHAPE] = AnalogParam.LFO_SHAPE
[docs]
self.wave_shape_param: Literal[AnalogParam.LFO_SHAPE] = AnalogParam.LFO_SHAPE
super().__init__(
icons_row_type=IconType.ADSR,
analog=True,
send_midi_parameter=send_midi_parameter,
)
# Base overwrites wave_shape_param with None; restore for MIDI shape messages
self.wave_shape_param = AnalogParam.LFO_SHAPE
# Share shape buttons with editor so _update_lfo_shape_buttons (preset load) works
self.lfo_shape_buttons.update(
{shape.value: btn for shape, btn in self.wave_shape_buttons.items()}
)