Reply To: lua&demo panel question

Home Forums General Programming lua&demo panel question Reply To: lua&demo panel question

#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
    Ctrlr