val:setMin(), setMax() in 3.1.6 beta

seeing weird behavior in the setMin() and setMax() calls (unless I coded it wrong)

This code produces the following output. Note that the names are showing up correctly.

r0MinMax  = {462,561, 506,518, 496,527, 385,638, 497,527, 488,537, 384,639, 512,513, 493,531, 491,532, 496,528}

function configCtl(name, control, ofst)
   local aCtl = controls.get(control)
   local aVal = aCtl:getValue("value")

   print(string.format("inside configCtl (ofst is %d): current min,max = %d, %d", ofst, aVal:getMin(), aVal:getMax()))
   print(string.format("new vals = %d,%d", r0MinMax[ofst], r0MinMax[ofst+1]))

   print(string.format("after set: current min,max = %d, %d", aVal:getMin(), aVal:getMax()))
17:05:13.322 lua: inside configCtl (ofst is 1): current min,max = 462, 561
17:05:13.322 lua: new vals = 462,561
17:05:13.323 lua: after set: current min,max = 206, 49

Your code got truncated (or at least it is shown clipped on an iPad)

I am traveling today, but it scrolls horizontally on my phone.

Point is - get the current min and max for a control, set them to something, then get them again and the values seem to be corrupted.

I am looking at that. The numbers you get are actually reminders after division by 256. So it looks like that only 8-bits are used when working with the variables. So far I have no clue why that happens, but I am on it.

3.1.7 is available on beta. I found the 8-bit limit and it got fixed. 14-bit MIDI values are now fully supported via Lua API interface now too.

I’m also finding weird results with the setMin and setMax but I was on 3.1.6 still.I’ll first upgrade and come back

Please do. Also note, I have added a few presets to They expose all API calls for certain Lua objects. They are meant to be a quick reference for manipulating data with Lua. 3.1.7 is needed for these too.

Some things have been resolved in 3.1.7 :wink:

But not all; I have a control to which I assign setMin = 0 and setMax = 99. I can reach its full range by turning about 300 degrees on the encoder, which is good. Then I reassign the vaules to setMin = 0 and setMax = 60. With every turn the amount of degrees to get to the full range seems to be increasing, until it takes more than a trun to get ot the full range. That is impractical. I’dd rather expect the amoont of degrees to turn the knob to decrease to 180 degrees, or remain the same, but certainly not to see it increase. Weird thing, with values of setMax set on 12, 99, 100 all is good. But values between 33 and 62 are a drag.

@Martin, I believe there is also a way not only to change the display values, but the MIDI value range as well via lua ? How to do that?

Midi Message has been read-only object so far. I am going to change that, I will allow changes to min, max, type, parameter…

I will look at the sensitivity setting of the pot.


more playing around in 3.1.7 and setMin(), setMax() still seems to be broken.

(virtual controls only here, if that matters)
On the control, leave min/max/default blank.
Set Min MIDI Value to 200
Set Max MIDI Value to 824

in the LUA code,

   aCtl = controls.get(50)
   aVal = aCtl:getValue("value")
   print(string.format("pre min=%d, max=%d", aVal:getMin(), aVal:getMax()))
   aCtl:setName("V 1")
   print(string.format("post min=%d, max=%d", aVal:getMin(), aVal:getMax()))

the prints look good:

16:13:17.542 lua: pre min=200, max=824
16:13:17.546 lua: post min=462, max=562

However, trying to manipulate the control directly shows it moving and sending across the entire original range


@oldgearguy - in what situation do you call the above code? I tried that from setup (global lua) and from the function (changing the range by pressing pad on the screen). The control is has been reconfigured and re-painted ok. From what you describe it looks like that the data is changed but it is not reflected in the on-screen component.

When I get home today I will retry it.
What I see is this:

define a virtual control with range 0 to 255.
Create a ‘set range’ toggle button that changes the range of the first control from 0-255 to 63-127 using LUA and the setMin() and setMax() calls.

What I am seeing is that it appears that the range is changed, but either I can turn the encoder past the new limit or the control now skips values and does not move smoothly from 63,64,65,66, … it gets very jumpy as I turn the encoder.

Again - I will check later when I am back in front of my Electra One and computer.

confirmed on OS 3.2

If the control is defined as: virtual, unipolar fader, top values (min, max, default) left blank, MIDI values at the bottom set to 462 to 561 I can scroll the control and the value printed inside the LUA format function show a smooth increment, decrement by 1.

If I use setMin() and setMax(), to 496 to 527, the values inside the format function increment and decrement by 3 or 4 and still move through the full original range, not the new min/max.

1 Like