To make it easier, you can download the free version of the Tetra editor
http://www.soundtower.com/tetra/index.htm
Then set the midi port to a virtual midi port and see the output message with some midi spy app.
This is what I get when moving the o/c 1 frequency knob full right (max value)
msg chn cc val
Control 1 99 0
Control 1 98 0
Control 1 6 0
Control 1 38 120
so you would send 0xb0 , 99,0,98,0,6,0, 38, floor(x*120)
If the usb is not null (value greater than 127) then the full range is :
msb * 128 + lsb
example if the max value is
Control 1 6 2
Control 1 38 100
2*128 + 100 =356, which means that when x = 1.0, the value is 356
and you would send:
0xb0 , 99,0,98,0,6,floor((x*356)/128), 38, floor((x*356)%128)
if x is to the max ( = 1.0) then we would have
1.0 * 356 / 128 = 2.7 , floor(2.7) = 2; msb = 2
1.0 * 356 % 128 = 100; lsb = 100
if x is in half position ( = 0.5) then we would have
0.5 * 356 / 128 = 1.39 , floor(1.39) = 1; msb = 1
0.5 * 356 % 128 = 50; lsb = 50
Off course you can use the full formula in all situations, even if the total value is smaller than 128
If I take the first example where the max value is 120
1 * 120 / 128 = 0.93 , floor(0.93) = 0; msb = 0
1 * 120 % 128 = 120; lsb = 120
% means modulo, it returns the remainder of a division ( 10 % 3 = 1 is the same as 10- floor(10/3)*3 = 1
Hope you are a little more confused now