Home Forums General Programming Modulator and Component questions

This topic contains 4 replies, has 3 voices, and was last updated by goodweather goodweather 4 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #61764
    goodweather
    goodweather
    Participant

    Hi,
    can someone explain the difference between a Modulator (the buttons we are adding for example) and Components?

    Then explain the reason and differences when using different Lua codes like the following

    To switch a normal uiImageButton modulator representing a LED on, I’m using this code on the button that triggres it (a momentary uiImageButton modulator):

    function ledFilterSlopes(modulator, modValue)
    
    	-- -6dB slope
    	if modValue==0 then
    		panel:getComponent("ledSlope6"):setValue(1,true)
    		panel:getComponent("ledSlope12"):setValue(0,true)
    		panel:getComponent("ledSlope18"):setValue(0,true)
    		panel:getComponent("ledSlope24"):setValue(0,true)
    	end
    	-- -12dB slope
    	if modValue==1 then
    		panel:getComponent("ledSlope6"):setValue(0,true)
    		panel:getComponent("ledSlope12"):setValue(1,true)
    		panel:getComponent("ledSlope18"):setValue(0,true)
    		panel:getComponent("ledSlope24"):setValue(0,true)
    	end
    end

    So, here I’m using directly the name in getComponent().

    Is it also correct to use function ledFilterSlopes(modulator, modValue) or shall I use ledFilterSlopes = function(modulator, modValue)?

    At other places, I’m using:

    txtParameter=panel:getModulatorByName("txtParameter")
    txtParameter:getComponent():setPropertyString ("uiLabelText", sParameter)

    So, what is the correct way to set values?
    Are both correct but maybe that their respective usage is depending on something?

    Is the second method to be used for setting properties of the component within the modulator while the first one is setting the value of the modulator?

    Thx in advance for explanations!

    #71834

    human fly
    Participant

    am currently round about this point…

    #71855
    goodweather
    goodweather
    Participant

    Actualy, my question is from some time ago when I was discovering Ctrlr. I still don’t have the exact answer fro mAtom but we can say that a modulator is some kind of higher object having properties and that it contains a component which has also properties.
    Atom defined different components with different properties.

    So, you can see this as a way to handle a common layer of properties (the modulator) and a specific layer of properties depending on the component you use.

    Maintenance wise, you only need to manage the modulator properties at one place.

    This is my guess…

    #71863

    Mr.ToR
    Participant

    Hi goodweather,

    Look at my post here where I explained just that 🙂

    Lua Basics for Ctrlr – Beginners

    #71869
    goodweather
    goodweather
    Participant

    Yep! Thx Mr.ToR 😉

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

You must be logged in to reply to this topic.

Comments are closed.