Home › Forums › General › Using Ctrlr › Link to Modulator modulation type property
Tagged: modulator
- This topic has 6 replies, 3 voices, and was last updated 4 years, 9 months ago by goodweather.
-
AuthorPosts
-
March 13, 2016 at 5:33 pm #68618
Hi, could someone explain the “Link to Modulator modulation type” property? It’s either numeric or text.
I’m trying to make a knob that displays text labels rather than numbers, and I’m wondering if that will do it.
- This topic was modified 8 years, 1 month ago by mgregory22.
March 13, 2016 at 7:12 pm #68620I’m trying to make a knob that displays text labels rather than numbers
Hi, not sure if it is the same but I’m doing something similar on my panels. Basically for buttons I’m using a uiImageSlider not displaying any label or value. I’m attaching to it an “On value change” method that modifies an uiLabel text somewhere in an “LCD panel” which is itself a uiGroup.
All modulators are declared in a PanelLoaded method as:
-- Main Screen lblParameter = panel:getModulatorByName("lblParameter") txtInformation = panel:getModulatorByName("txtInformation") txtCurrentValue = panel:getModulatorByName("txtCurrentValue") ...
Then, for example for Pitch, I’m using such method
-- -- Called when a modulator value changes -- @mod http://ctrlr.org/api/class_ctrlr_modulator.html -- @value new numeric value of the modulator -- Osc1Pitch_OnChange = function(--[[ CtrlrModulator --]] mod, --[[ number --]] value, --[[ number --]] source) -- No action if the panel is in bootstrap or program states if not isPanelReady() then return end -- Display current pitch Octave = math.floor(value/12) Note = math.fmod(value, 12) if Note==0 then sNote="C"..Octave end if Note==1 then sNote="C#"..Octave end if Note==2 then sNote="D"..Octave end if Note==3 then sNote="Eb"..Octave end if Note==4 then sNote="E"..Octave end if Note==5 then sNote="F"..Octave end if Note==6 then sNote="F#"..Octave end if Note==7 then sNote="G"..Octave end if Note==8 then sNote="G#"..Octave end if Note==9 then sNote="A"..Octave end if Note==10 then sNote="Bb"..Octave end if Note==11 then sNote="B"..Octave end txtCurrentValue:getComponent():setPropertyString ("uiLabelText", sNote) end
March 13, 2016 at 10:52 pm #68621Thanks, but that’s not working for me. It says:
At line [8]: [string “PfmPan_OnChange”]
Error message: [string “PfmPan_OnChange”]:8: attempt to call global ‘isPanelReady’ (a nil value)
And if I remove the ready check, it says:
At line [15]: [string “PfmPan_OnChange”]
Error message: [string “PfmPan_OnChange”]:15: attempt to index global ‘txtCurrentValue’ (a nil value)
March 14, 2016 at 11:59 am #68625you have to define txtCurrentValue, as goodweather in his PanelLoaded method:
txtCurrentValue = panel:getModulatorByName(“txtCurrentValue”)This looks interesting but I don’t understand the following line at all:
Osc1Pitch_OnChange = function(–[[ CtrlrModulator –]] mod, –[[ number –]] value, –[[ number –]] source)March 14, 2016 at 11:14 pm #68626@Possemo:
That line declares a function. Osc1Pitch_OnChange is the name. mod, value, and source are the formal parameters. –[[ CtrlrModulator –]], –[[ number –]], and –[[ number –]] are comments indicating the parameter types.
@goodweather:
I don’t know where to find the PanelLoaded method. I assume you’re referring to the method assigned to the “Called when the panel has finished loading” property?I tried to assigned a variable in there, but my OnChange can’t see it. Even if I call GetModulator() right in my OnChange handler, it has no effect.
March 29, 2016 at 8:47 pm #68749Sorry, didn’t see your replies…
isPanelReady is a method as:-- -- Check if the panel is not busy to load or receiving a program -- isPanelReady = function() if panel:getBootstrapState() == false and panel:getProgramState() == false then return (true) else return (false) end end
Create a method that you call Miscellaneous and put the function inside it after deleting everything.
PanelLoaded is a separate method on his own in which I’m setting variables for all modulators. Atom explained in a post that it was the most efficient. If you use getModulatorByName, the system as to scan a table containing all modulators to find it. If the one you search is at the end, it will take time. Hence the PanelLoaded.
You need to select your panel and set the property “Called when the panel has finsihed loading” to PanelLoaded.
Good luck…
July 17, 2019 at 8:44 pm #115529FYI, I’m just busy to make my first VST versions of my panels and had the problem that no Lua code was launched as dll. Spent the whole afternoon reading the forum about VST preparation.
Found the issue then found different posts on the forum and adding the following info.I discovered that we should not have getProgramState() in the condition in the isPanelReady function.
Removing that and thus only using
if panel:getBootstrapState() == false and bPanelLoaded == true then
solves the issue.I will search further in the forum about the meaning of getProgramState().
All the startup phase of a panel is still a bit cryptic even if I understand it more and more. -
AuthorPosts
- The forum ‘Using Ctrlr’ is closed to new topics and replies.