getTableValue no longer working properly
-
An important function of my plugin is not working all of a sudden with the latest HISE. I have a table where you can set the curve to alter the value of a controller.
onController() { if(Message.getControllerNumber() == 4) { Message.setControllerValue(Math.round(1.27 * (MyTable.getTableValue(Message.getControllerValue())*100))); } }
This used to work seamlessly. Now I get either 0 or 127, depending if the controller is all the way up or down. I checked, and the controller is working perfectly. The script above is no longer working, and it seems that it is not getting the proper value from the table.
-
I think I've changed the range of the input of
getTableValue()
to be consistent with other functions so it expects a0.0 - 1.0
input (instead of the0...127
).Does this help:
onController() { if(Message.getControllerNumber() == 4) { Message.setControllerValue(Math.round(1.27 * (MyTable.getTableValue(Message.getControllerValue()/127.0)*100))); } }
-
And for the love of god please change
1.27 * 100
to
127
:) -
@Christoph-Hart Thanks so much! Yes, dividing the table result by 127.0 fixed the issue.
I changed the silly "1.27 * 100" after I made the original post. That was actually simplified from the original script (which I didn't write), that hadlocal scaler = 127 / 100;
Another unusual thing. If I write:
onController() { if(Message.getControllerNumber() == 4) { local tv = Message.setControllerValue(Math.round(1.27 * (MyTable.getTableValue(Message.getControllerValue()/127.0)*100))); Console.print("table value: " + tv); } }
I get that the "table value: is undefined".
Why is that? Shouldn't it print the value?
-
@Christoph-Hart Nevermind the second part. I figured it out.