Automation doesn't redraw panels
-
@christoph-hart I've only tested in Reaper. I've tried setting it to use
repaint()
andrepaintImmediately()
but it didn't make a difference.Here is the minimal test I did
HiseSnippet 1336.3ocsW0saaaCElxIJHwaFXEaWsKF37ECRaIN1ascEqHnt0NY0XMsF0cYcXqnfVh1hHRjdRzNwqH.6l8lrGj9JrmicydCxNjTxR9mjTOfpKRBOmyG424GxyIciEdzjDQLxZmWLcDEY8g18lxkAsBHLNpSaj011cioITI5QSGQRRn9HKqM9dkVqc1Do+92G7HRHg6QyEgPmHXdzmvhXxboca9CrvviH9zWvhJX8sa1wSvaIBEiAlrgcczHh2ojgzmRTlUxFYs0g9LoHtmjHoIHqMejveZu.wYbi8mvRX8CopEMP8fMxH9HQnuhwJonVArP+tYdbBB1kt49+FF++SrOl4ylIOON7QZE3bDEiGVktN503loW8UQOqBzaSC8tkcOuX1HYtFE29.6NbIMd.ARAEokwVTIqsraI.K3xZQjSoGECKlgv4t0quK9N0q6d+JkqTFRDIR7DRLtKgSCwGfyfNjJaIhFI3vBmpZsMpp.kC4Ij9WCDsVCjJk03qAEVNUIgghyZA+rOj0SptKtZqPF7W6herXBMF+E31wjgCY7goX2eeba5.Fmh8RQg6SCHSXP8Sgc9Xw3DZ195LXL2SxDbG5DfMtUJ+lJkwvGa.1Hplm5To9tF4opUe6ueOxDJVFPAuLbLEOHVDoWFoNBrFXt4x.VRMehjTSqtMTFbhF1AFUPTQu1Q4MJ.WX9EMLgtzYmSOeHH3lqnfMFNhAW0abHTApoVBkmvjrIL4TCqm2dU5xmkHU2aw.yJbHuDuGNe0O6h2G2ndccjewcfSOKy0NlHCpES3CoNWY.3qlcj6NKT3TMhwq5Nm.x4UccW5.UghYG3muTvzcdqWH9n9zEflZNI8bITokscYYhhe47IQRG0i86zpt3CN.2.+.itjri135hwb+Y7y0E+cKX0MdVwzQvqMxNQQTeFjFCm5bk15Enhz9KYvE4KuXVw0EKbkqq5XdtXrDtBkeuXnaZHSkX0IxBEroIEnxXg718ywXbPUsTlMOlxFFHcTUP5MzE+kXm8VXGfphEyjYNk4WCqM.Za7vvPmbj8GZZWTclwCUdlQXA6XRZzhVt3N+bpmz4WpmWAlQ68LdTtheh4KCbbW1xW4deytBg5r.JVvepPReF2ws7aJuS4KJunlACVkJ0imwhvPZ7pzp5bFeMvb3ii5Si20bmOyNnAx7cn15cqCkm4g7BFJ3c3L4yFQSWe8sXQocBftYkRIHXpT2KqRVuLUYIh4qm0P2UAo4d57A3+7e96GftJv5qzofM8Wx.CSMf9wNsgWgTsRS4AvsQzXISEBrZSm.ynXZrticaZxoRwHssosrfwgtQpd9rwX9CRyo4yz7qMOSUrLSva62LPWrLSRyeq47c9PVep8U04CkUvCv25xKu7uT6PdwsR5GS+rK0RS5FNFvzkDCiOAc4AWpzn4EYFrZa6dgLevfDn8VGd5fdf0yEC19Fi3mWbvu7XvaeUyQjXXOJtYYwsAPBQ8lZNz6sbDS8JsISt7nPv.YBeU6t4mRSMZZpB3dwbiCoF4Q0SbZwQWWiQ2p+NOY46JcukcWlzKX07szJ3q5dz6Y9lNHbE6CGL.dXLmraZezK++N06ZPESeogPO0XFTXY+zwQ8fJbOJvDNT5.GjsUI0SKl00UqUQldTtudAb83xTkMTqsRU1HSIJh3EKdsm4ME0n1aqk.bhquXri8wp03YOln3cDL++q87TAh8.luZDe8Zi3aVaD2dsQbm0FwcWaDe6Zi3dWCB0+r0CGKEQlqEfftGpeK2x5PNAppzUfn+Ci6LBDB
-
I just tested in Bitwig and it's exactly the same so I don't think it's a host issue.
-
@dustbro Kindly tested this for me on Windows and the result was the same for him.
-
Here's what I'm seeing
-
In your example you don't call
Panel.repaint()
in the control callback, so it's no wonder why it doesn't repaint :)Actually the recommended way of handling this is to just calculate the value in the mouse callback, call
changed()
and do all necessary UI updates in the it the control callback that's about to follow.This way you make sure that it works in all scenarios:
// Define callback behaviour Panel.setMouseCallback(function(event) { if (event.clicked) { //Save the value from the mouse click this.data.mouseDownValue = this.getValue(); } else { if (event.drag) { // Calculate the sensitivity value var distance = (event.dragX - event.dragY) / 100; var newValue = Math.range(this.data.mouseDownValue + distance, this.get("min"), this.get("max")); if (newValue != this.getValue()) { this.get("stepSize") == 1 ? this.setValue(Math.round(newValue)) : this.setValue(newValue); this.repaintImmediately(); // <= BAD, do not call this here, but let the controlCallback do it's work.. this.changed(); } } } }); function onControl(number, value) { // Call repaint here. Fun fact: in the new HISE version, repaintImmediately and repaint() do exactly the same thing :) Panel.repaint(); // Theoretically you also need to call this here. BUT: if you're automating this control, it will fire in the audio callback // (or whatever other high priority thread the host is using for automation). // This is bad practice and will make the new AudioThreadGuard go crazy. The solution to this problem would be to // make this asynchronous somehow (the quickest and nastiest hack would be calling this in the paint routine of the panel // that's about to be executed asynchronously). Label.set("text", value); }
-
@christoph-hart But for most of my sliders I don't have a control callback because they perform their action through the parameter ID system which doesn't trigger the control callback.
-
Ah, I see. In this case you probably need something like a method
Panel.set("repaintOnValueChange", true);
that handles this automatically. Shouldn't be too hard and is a sensible request. You're still on your own when it comes to update the label though - this would be the line where you have to leave the comfort zone of the parameter ID system.
-
Actually I took a look in the source code and it should already automatically repaint itself if it's connected to a parameter ID. Your minimal example is not connected.
I think the reasoning behind this solution is that you either:
- Have not connected the slider to anything. Then it's just a dummy control and doesn't need to be updated from external automation - like your minimal example :)
- Have a script defined callback. Then it's your responsibility to call
repaint()
in the script. - Have the panel connected to a parameter. In this case the engine will call
repaint()
for you.
Do you experience this problem with real-world scenarios?
-
@christoph-hart I'm putting together a more realistic test now and will report back soon
-
I just edited the example to control the release of an envelope for the sine wave generator and the result is the same.
HiseSnippet 1579.3oc4Ws0aaTDEdWmrUItDDUTjP7.ZvOf1ERbrglREUQ0oNIsVzzZEmdAAUUi2cr8nt6La2crSBUQhG4GB+C3OP+IvOk9FOFNyL6MeIWgBRv9PhmykY9NWly4Lsi3tj3Xdjg4h6cXHwv78r5bHSLn4.LkYzZSCyErZGQhIBi6dXHNNl3YXZN28jbMWbdC02auycw9XlKImjgwS3TWxCnATQ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