[Fixed 2.6 Beta] Minor Flaw In Globalmidiactions.lua ?

Hi there,

shouldn’t this library code of GlobalMidiActions.lua be modified:

  
function parameter_message_value(message, parameter)  
....  
if (parameter.polarity == renoise.DeviceParameter.POLARITY_BIPOLAR) then  
 local mid_value = (parameter.value_max - parameter.value_min) / 2;  
 if (new_value ~= mid_value and -- 128 to avoid rounding fuzz  
 math.abs(mid_value - new_value) < parameter_range / 128) then  
 new_value = mid_value  
 end  
end  
...  
  

into

  
if (parameter.polarity == renoise.DeviceParameter.POLARITY_BIPOLAR) then  
 local mid_value = (parameter.value_max - parameter.value_min) / 2 + parameter.value_min -- MODIFIED !!!  
 if (new_value ~= mid_value and -- 128 to avoid rounding fuzz  
 math.abs(mid_value - new_value) < parameter_range / 128) then  
 new_value = mid_value  
 end  
end  
  

Otherwise I think center points for bipolar parameters with offsets are not calculated correctly ?
E.g. EQ gain settings.

Though I’m not sure about what the whole function exactly (!) does, so maybe I make wrong assumptions, here.

Yay, you are right. This is broken for parameters with a min != 0.

e.g: EQ gain -> min is -20 dB, max is 20 dB, center should be at 0 dB

Right now:
(20 - -20) / 2 = 20

Should be:
-20 + (20 - -20) / 2 = 0

Will fix this for the next beta. Thanks.