- Topics: 45
- Replies: 550
- Total: 595
Well, even if the code above is working, the simplest is just to have 2 uiImageSliders modulators:
– one to select the waveform: use an image of a 4 position button, values 0-3
– one to display the wave: use an image with your 4 waveforms, values 0-3
When changing the waveform button, change the value of the wave modulator to the same value with a small Lua code (uncomplete code below but to give you the idea)
-- -- Called when a modulator value changes -- @mod http://ctrlr.org/api/class_ctrlr_modulator.html -- @value new numeric value of the modulator -- Wave_OnChange = function(--[[ CtrlrModulator --]] mod, --[[ number --]] value, --[[ number --]] source) modWaveform:setValue(value, true) end
Look at my OscShape_OnChange method in my Pro2 panel. Button OSC 1 Shape/noise for example.
It is more complex than what I describe above because I’m also adapting the LCD screen, enabling/disabling other pulldowns based on the wave selection…
But the way I propose is easier than using custom components.
Anyway, in programming, there are always many different ways to achieve the same objective 😉