Reply To: Sysex Math

Home Forums General Programming Sysex Math Reply To: Sysex Math

#118664
dnaldoog
Participant
    • Topics: 4
    • Replies: 480
    • Total: 484
    • ★★

    Hi ccregor,

    I think you would have to do it in lua.

    Something like

    
    myMethod = function( mod,value,source)
    
    local bi=BigInteger(value)
    
    local MS=bi:getBitRangeAsInt(7,14)
    local LS=bi:getBitRangeAsInt(0,7)
    
    for i=0,2 do
    	local ls=LS+i
    	local ms=MS
    	if ls > 0x7f then -- 127
    		ls=0+(i-1)
    		ms=ms+1
    	end
    	local mStr=string.format("f0 41 10 00 00 00 0e 12 19 01 22 0a %.2x %.2x f7",ms,ls)
    	panel:sendMidiMessageNow(CtrlrMidiMessage(mStr))
    end
    
    end
    

    This code takes into account the ‘overspill’ you get if you enter in a number like 255 which would then be sending 256 and 257. Hope I understood the question right.

    Ctrlr