But that isn’t what I want to talk about.
The issue I am having is with capturing information from the API. I have an example with screenshots.
After doing some research and writing a test within my existing code I have found that the oldValue doesn’t actually exist. I’ve seen examples of this, and clearly was confused. The callback has no oldValue.
I have multiplied the newValue in the callback by 100 to make it easier to read, and logged it to the console every time the callback is made. I have bound a knob to a fader to make it easier to discuss. I have also fibbed and made myself the “manufacturer” to avoid conflicts and having the code erased.
In this example the “fader” refers to moving the bound value by the computer’s mouse. The “knob” refers to the actually hardware knob. So Fader is through the UI, Knob is through hardware. Contrary to the expectation in code that I have seen, and discussions that I have been in, this will show that the callback is made whenever the knob is moved, or the fader is moved, but that the actual value is only ever change by the knob on the hardware.
Here is the initial state as the script was loaded. The fader on the left, the UI in the middle and the log of the callback on the right. It starts off with newValue being 0. Note that the UI is aware of the difference between this initial state of the captured value that is presented in the callback, and the state of the fader.
Here I have moved the fader. But not the knob. The callback is called, but the value of newValue stays the same. The UI is aware of the difference and is able to display that difference, but the value sent to the callback has not changed.
Now I have moved the knob down to 0 (underneath the fader, never matching it’s position). I then moved it back up again. The callback receives the values of the knob position.
Now I have moved the fader again. The newValue remains the same. The callback is being called, but the value is the same as the last time the knob was moved.
Now I have moved the knob up to “capture” the fader, and then moved it about. The UI in the middle has responded to this, and is now showing that the values are in synch.
Again I have moved the fader away from the value of the knob. The UI has updated to show the difference between that of the knob and the fader, but the value provided to the callback is still the last known position of the knob.
And again moving the knob in the direction of the fader, but not enough for the pickup to capture.
This means the following.
- The newValue is only ever changed by the knob.
- Knob movements generate an event for which the callback is executed.
- Fader movements generate an even for which the callback is executed.
- The UI is capturing different events, than those being provided to the MR callback.
Without a more in-depth discussion of the API, I am not sure whether I have uncovered a defect, or if there is some misunderstanding as to how this is suppose to be used. Either way, I would like to know what the intent is, or how the API might evolve.