Modulator and Component questions

Home Forums General Programming Modulator and Component questions

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #61764
    goodweather
    Participant
      • Topics: 45
      • Replies: 550
      • Total: 595
      • ★★★

      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
        • Topics: 124
        • Replies: 1070
        • Total: 1194
        • ★★★★

        am currently round about this point…

        #71855
        goodweather
        Participant
          • Topics: 45
          • Replies: 550
          • Total: 595
          • ★★★

          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
            • Topics: 7
            • Replies: 51
            • Total: 58

            Hi goodweather,

            Look at my post here where I explained just that 🙂

            Lua Basics for Ctrlr – Beginners

            #71869
            goodweather
            Participant
              • Topics: 45
              • Replies: 550
              • Total: 595
              • ★★★

              Yep! Thx Mr.ToR 😉

            Viewing 5 posts - 1 through 5 (of 5 total)
            • The forum ‘Programming’ is closed to new topics and replies.
            There is currently 0 users and 28 guests online
            No users are currently active
            Forum Statistics
            Threads: 2,495, Posts: 17,374, Members: 77,605
            Most users ever online was 12 on January 22, 2019 3:47 pm
            Ctrlr