Link to Modulator modulation type property

Home Forums General Using Ctrlr Link to Modulator modulation type property

Tagged: 

This topic contains 6 replies, has 3 voices, and was last updated by goodweather goodweather 1 month, 1 week ago.

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #68618

    mgregory22
    Participant
    • Topics: 1
    • Replies: 2
    • Total: 3

    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 3 years, 5 months ago by  mgregory22.
    #68620
    goodweather
    goodweather
    Participant
    • Topics: 40
    • Replies: 392
    • Total: 432
    • ★★

    I’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
    #68621

    mgregory22
    Participant
    • Topics: 1
    • Replies: 2
    • Total: 3

    Thanks, 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)

    #68625
    Possemo
    Possemo
    Participant
    • Topics: 13
    • Replies: 582
    • Total: 595
    • ★★★

    you 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)

    #68626

    mgregory22
    Participant
    • Topics: 1
    • Replies: 2
    • Total: 3

    @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.

    #68749
    goodweather
    goodweather
    Participant
    • Topics: 40
    • Replies: 392
    • Total: 432
    • ★★

    Sorry, 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…

    #115529
    goodweather
    goodweather
    Participant
    • Topics: 40
    • Replies: 392
    • Total: 432
    • ★★

    FYI, 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.

Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.

There is currently 0 users and 25 guests online
No users are currently active
Forum Statistics
Threads: 2,241, Posts: 15,791, Members: 55,954
Most users ever online was 12 on January 22, 2019 3:47 pm
Do NOT follow this link or you will be banned from the site!