getModulatorByName (nightly 1194)

Home Forums General Programming getModulatorByName (nightly 1194)

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #5330
    F7h
    Participant
      • Topics: 2
      • Replies: 6
      • Total: 8

      Hi!

      Is there any bug with getModulatorByName? It does not work with nightly 1194

      An uiButton changes random values…

      function valor_aleatorio ()
      m = panel:getModulatorByName("modulator-1")
      m2 = panel:getModulatorByName("modulator-4")
      if m ~= nil then
      c = m:getComponent()
      if c:getPropertyString("uiType") == "uiSlider" then
      m:setModulatorValue (utils.randomInt(127), false, true, true)
      m2:setModulatorValue (utils.randomInt(127), false, true, true)
      end
      end
      end

      #5331
      dasfaker
      Keymaster
        • Topics: 80
        • Replies: 793
        • Total: 873
        • ★★★

        Don’t know if it’s related, but I have problems with modulator:getLuaName(). In the console it shows the name correct, but in the methods it doesn’t work.

        This doesn’t works:

        PATCH_PresetSelect = function(modulator, newValue)
        if modulator:getLuaName() == "Bank Select 1" then

        This works
        PATCH_PresetSelect = function(modulator, newValue)
        if modulator:getVstIndex() == 601 then

        #5332
        atom
        Keymaster
          • Topics: 159
          • Replies: 2945
          • Total: 3104
          • ★★★★★

          Well i bound the getLuaName() to the getName() method they call the same method that returns a String() representation of the name, so the comparison will fail. But if you add L(getName()) it will work like so:

          PATCH_PresetSelect = function(modulator, newValue)
          if L(modulator:getLuaName()) == "Bank Select 1" then
          

          i’ll put getLuaName() back to normal behavior but it will still work with L() and without it, doesn’t matter

          • This reply was modified 11 years, 3 months ago by atom.
          #5334
          dasfaker
          Keymaster
            • Topics: 80
            • Replies: 793
            • Total: 873
            • ★★★

            To F7h

            Try with this, the bold text is what changes:

            m = panel:getModulatorByName("modulator-1")
            m2 = panel:getModulatorByName("modulator-4")
            if m ~= nil then
            c = m:getComponent()
            if c:getProperty("uiType") == "uiSlider" then
            console(m:getLuaName())
            m:setModulatorValue (math.random(127), false, true, true)
            m2:setModulatorValue (math.random(127), false, true, true)
            end
            end

            #5335
            F7h
            Participant
              • Topics: 2
              • Replies: 6
              • Total: 8

              dasfaker, thanks for your answer… It works well with m, but not with m2.

              I tried with this code:

              function valor_aleatorio ()
              m = panel:getModulatorByName("modulator-1")
              m2 = panel:getModulatorByName("modulator-4")
              if m ~= nil then
              c = m:getComponent()
              if c:getProperty("uiType") == "uiSlider" then
              console(m:getLuaName())
              m:setModulatorValue (math.random(127), false, true, true)
              end
              end
              if m2 ~= nil then
              c2 = m2:getComponent()
              if c2:getProperty("uiType") == "uiSlider" then
              console(m2:getLuaName())
              m2:setModulatorValue (math.random(127), false, true, true)
              end
              end
              end

              but I get this error message:
              At Line[2]…
              … C stack overflow
              ???

               

              #5336
              dasfaker
              Keymaster
                • Topics: 80
                • Replies: 793
                • Total: 873
                • ★★★

                For me it’s working. I put two sliders (modulator-1 and modulator-4) and a uibutton with the code, and both sliders change it’s value randomly.

                Here is attached the example panel with two buttons, one with the first and other with the second code.

                Attachments:
                You must be logged in to view attached files.
                #5358
                F7h
                Participant
                  • Topics: 2
                  • Replies: 6
                  • Total: 8

                  Hi.

                  Thank you very much. It´s strange having  the same code does not work. But your panel works well. I delete object and re-write and work.

                  Happy new year.

                  F7h

                   

                Viewing 7 posts - 1 through 7 (of 7 total)
                • The forum ‘Programming’ is closed to new topics and replies.
                There is currently 0 users and 40 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