Reply To: [resolved] mask to 7 bits

Home Forums General Programming [resolved] mask to 7 bits Reply To: [resolved] mask to 7 bits

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

    I’m not sure about %127 modulo This is not working with the RA

    I tried %128 and this working

    %127 is working until checksum 7e and after this makes chksum errors

    
    --
    -- Called when a modulator value changes
    -- @mod   http://ctrlr.org/api/class_ctrlr_modulator.html
    -- @value    new numeric value of the modulator
    --
    tempo2 = function(mod, value)
    
    progtmp = panel:getModulatorByName("Program Tempo"):getModulatorValue()
     prgtxt = panel:getComponent("text PRG Tempo")
     prgval = progtmp / 10 
    prchks1 = (83+(progtmp / 128))%128
    prchks2 = (84+(progtmp%128))%128
    panel:sendMidiMessageNow(CtrlrMidiMessage{0xF0,0x3E,0x11,0x00,0x21,0x20,0x00,0x00,0x12,(progtmp / 128),prchks1,0xF7})
    panel:sendMidiMessageNow(CtrlrMidiMessage{0xF0,0x3E,0x11,0x00,0x21,0x20,0x00,0x00,0x13,(progtmp%128),prchks2,0xF7})
    
           if progtmp == 0 then 
              prgtxt:setComponentText (string.format ( "Global"))
       elseif progtmp == 1 then 
              prgtxt:setComponentText (string.format ( "Extern"))
       elseif progtmp >= 2 and progtmp <= 99 then 
              prgtxt:setComponentText (string.format ( "00%.1f  Bpm",prgval))
       elseif progtmp >= 100 and progtmp <= 999 then 
              prgtxt:setComponentText (string.format ( "0%.1f  Bpm",prgval))
       elseif progtmp >= 1000 then
              prgtxt:setComponentText (string.format ( "%.1f  Bpm",prgval))
          end
    end

    Can you give a feedback please Msepsis if you encounter errors with your chksum stuff ?

    Ctrlr