lua&demo panel question

Home Forums General Programming lua&demo panel question

Viewing 6 posts - 21 through 26 (of 26 total)
  • Author
    Posts
  • #14191
    atom
    Keymaster
      • Topics: 159
      • Replies: 2945
      • Total: 3104
      • ★★★★★

      Ofcourse it’s the same code so it will be fixed on all platforms.

      #14197
      zeoka
      Participant
        • Topics: 73
        • Replies: 466
        • Total: 539
        • ★★★

        i’ve reduced my code to the max for sound dump
        the problem is the same Ctrlr is too busy to do anything else than assign value to mods
        Atom is there a way to improve that or stay with the old method : assign values to mods 1 by 1

         myNewMethod = function(midi)
        
        vendor = midi:getLuaData():getByte(1)
         model = midi:getLuaData():getByte(2)
          typ1 = midi:getLuaData():getByte(4)
          typ2 = midi:getLuaData():getByte(5)
          typ3 = midi:getLuaData():getByte(6)
           txt = panel:getComponent("modulator-1")
          lbl2 = panel:getComponent("Current Value")
            if vendor == 62 and model == 17 and typ1 == 16 then
                i0to13 = midi:getLuaData():getRange(7,14) 
               i16to23 = midi:getLuaData():getRange(23,8)
               i26to33 = midi:getLuaData():getRange(33,8)
               i36to50 = midi:getLuaData():getRange(43,15)
               i53to67 = midi:getLuaData():getRange(60,15)
               i69to73 = midi:getLuaData():getRange(76,5)
               i75to83 = midi:getLuaData():getRange(82,9)
               i85to91 = midi:getLuaData():getRange(92,7)
                   i94 = midi:getLuaData():getByte(101)
                 sound = MemoryBlock(string.format("%s %s %s %s %s %s %s %s %.2x", i0to13:toHexString(1),i16to23:toHexString(1),i26to33:toHexString(1),i36to50:toHexString(1),i53to67:toHexString(1),i69to73:toHexString(1),i75to83:toHexString(1),i85to91:toHexString(1),i94))
                         panel:setModulatorValuesFromData(sound, "vstIndex", CtrlrPanel.EncodeNormal, (typ3 * 82), 1, false)
                      if typ3 <= 8 then
                         txt:setText (string.format("Sound 0%s",typ3 + 1))
                    else 
                         txt:setText (string.format("Sound %s",typ3 + 1))                 
                     end
        elseif vendor == 62 and model == 17 and typ1 == 21 then 
                i0to12 = midi:getLuaData():getRange(7,13)
               fx1and2 = MemoryBlock(string.format("%s",i0to12:toHexString(1)))
                 i0to8 = midi:getLuaData():getRange(7,9)
                   i10 = midi:getLuaData():getByte(17)
               fx3and4 = MemoryBlock(string.format("%s %.2x",i0to8:toHexString(1),i10))
                      if typ3 == 0 then
                         panel:setModulatorValuesFromData(fx1and2, "vstIndex", CtrlrPanel.EncodeNormal, 1968, 1, false)
                  elseif typ3 == 1 then
                         panel:setModulatorValuesFromData(fx1and2, "vstIndex", CtrlrPanel.EncodeNormal, 1981, 1, false)
                  elseif typ3 >= 2 then
                         panel:setModulatorValuesFromData(fx3and4, "vstIndex", CtrlrPanel.EncodeNormal, 1994, 1, false)
                  elseif typ3 >= 3 then
                         panel:setModulatorValuesFromData(fx3and4, "vstIndex", CtrlrPanel.EncodeNormal, 2004, 1, false)
                     end
          end
        end
        #14203
        atom
        Keymaster
          • Topics: 159
          • Replies: 2945
          • Total: 3104
          • ★★★★★

          Well this method is just a utility method to set modulator values quickly from a MemoryBlock, it happens in the main thread so it will block the UI and since that change causes any component attached to the modulator to get repainted it will cause a CPU spike, if there is a lot of stuff to change it will have to take a moment. I’ll have to think if it can be done better but i doubt it.

          #14204
          zeoka
          Participant
            • Topics: 73
            • Replies: 466
            • Total: 539
            • ★★★

            Yes all works in fact but not refreshed
            I tried to have a monitoring of label with the console :

            txt:setText (string.format(“Sound 0%s”,typ3 + 1))
            mon = txt:getText()
            console(“mon = “..mon)
            not sure it is correct…. but your explanation is clear

            Anyway i have pleasure to use Ctrlr to make sound and music !

            Thank you

            #14286
            zeoka
            Participant
              • Topics: 73
              • Replies: 466
              • Total: 539
              • ★★★

              Ok i got the new method working very well on other panel that have only 1 sound params integrated (82).
              Replaced :
              panel:setModulatorValuesFromData(sound, “vstIndex”, CtrlrPanel.EncodeNormal,
              (typ3 * 82), 1, false)
              by
              panel:setModulatorValuesFromData(sound, “vstIndex”, CtrlrPanel.EncodeNormal,
              0, 1, false)

              All 24 sounds go to sound 1 , and text is displayed fine

              So my question is What this first INT ( i know about the last INT : the nb of byte to assign to modulator, by one byte most of time) ????

              From what you see i’ve done , i believed this first INT was the starting vstindex nb ?

              Can you confirm please ?? May be i was wrong….

              #14424
              zeoka
              Participant
                • Topics: 73
                • Replies: 466
                • Total: 539
                • ★★★

                Ok the method is working with a new panel
                it seems layer changes on old panel blocks the ui i keep the old method for it
                and use the new one with the new panel

                This new method is very interesting for multimbral synths

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