I’ve put a value of a component in a variable. I want to alter the value of the variable by shifting bits.
Let’s say I’ve got a value of decunak 15. When I express decimal 15 in binary it is 0 0 0 0 1 1 1 1. My synthesizer accepts for a specific parameter decimal 15 as 0 0 0 1 1 1 1 0, which is in decimal 30. So I have to shift bits 4-7 one position to the left.
I’ve thought it to be in a function like:
function myBitShift(bits, positions, value)
-- bits = how many bits to be shifted
-- positions = how many positions to be shifted
-- value = the decimal value that has to be altered via a someValue = someModulator:getModulatorValue()
local i
for i = bits, 1 do
local shftValue = bit.lshift(value(i+1),positions)
end
end
How can I get this to work? Many thanks for all help!
-
This topic was modified 4 years ago by EnzoF04.
-
This topic was modified 4 years ago by EnzoF04.