Issue with slider behaviour - click release changes the value
Hey guys,
I have an issue with a slider (reverb volume in my case, although I don't think it's relevant).
When I click the slider, adjust the value and I see the value changing in a display label. However when I release the mouse click the value changes a little.
While trying to explore the issue I figured out that if I'm turning the volume up…the value I get after the mouse-click release is a bit higher than shown before (ex. start from -inf turn it up to -17.4 dB and after click release the value jumps to -15.6).
Similar thing is happening while turning the volume down - then after the click release I get a lower value than before the click release.
Can anybody suggest how to fix this issue?
Is it a make_persistent/read_persistent thing that I've done wrong?
Thanks in advance!
Comments
-
It'd be code conflict, poor value scaling, mouse_behavior or anything. It's hard to judge without seeing the code :)
0 -
on init
declare ui_slider $sli_reverb_vol (0, 500000)
set_control_par ($sli_reverb_vol, $CONTROL_PAR_MOUSE_BEHAVIOUR, -2500)
set_control_par ($sli_reverb_vol, $CONTROL_PAR_DEFAULT_VALUE, 200000)
make_persistent($sli_reverb_vol)
read_persistent_var($sli_reverb_vol)
set_engine_par($ENGINE_PAR_SEND_EFFECT_OUTPUT_GAIN, $sli_reverb_vol, -1, 6, 0)
declare ui_label $lbl_rev_vol_read (1, 1)
set_text($lbl_rev_vol_read, $sli_reverb_vol & " dB")
hide_part($lbl_rev_vol_read, $HIDE_PART_BG)
set_control_par(get_ui_id($lbl_rev_vol_read),$CONTROL_PAR_FONT_TYPE,25)
set_text($lbl_rev_vol_read, get_engine_par_disp($ENGINE_PAR_SEND_EFFECT_OUTPUT_GAIN, -1, 6, -1) & " dB")
end on on ui_control($sli_reverb_vol)
set_engine_par($ENGINE_PAR_SEND_EFFECT_OUTPUT_GAIN, $sli_reverb_vol, -1, 6, 0)
set_text($lbl_rev_vol_read, get_engine_par_disp($ENGINE_PAR_SEND_EFFECT_OUTPUT_GAIN, -1, 6, -1) & " dB")
end on
Both slider and label I've declared with a macro containing the position, sizes, image, etc. but I'm not able to paste the code properly… However this is what actually goes in the macro but broken down.
In the "on ui control" part I've tried adding a wait(10000) and then set_text with the exact same line of code in order to fix the issue, assuming the issue was result of fast turning of the knob… however the problematic behaviour is the same.0 -
I just tried your code, and it works fine, no lag or weird values. Double check if any other code is causing conflicts when you display the value on the screen or if your slider is linked to any MIDI CC automation.
By the way, the group-slot-index values should be the same in bothset_engine_par
andget_engine_par_disp
. It might not change anything in your current example, but it's a good practice for your future KSP projects. :)1 -
Thanks for the tip, definitely will have this in mind (group-slot-index values).
Also…I will try to get rid of the macro creating the slider and label and try creating them manually…maybe there's something that is not precise in the macro, although all the other 15-20 buttons/sliders/labels in the library are created the same way and they seem to be working as expected.0 -
There's probably an issue in your script. If everything else is working fine, the problem is likely with the callback for your reverb slider. The code snippet you sent me works as expected. Are you sure no other callback is using the same code to display values? Maybe when you copied and pasted the code for the other UI callbacks, you left something related to the reverb slider. Right now, it's a bit of a guessing game since, as you mentioned, there are many more elements than just the slider.
0
Categories
- All Categories
- 19 Welcome
- 1.5K Hangout
- 61 NI News
- 778 Tech Talks
- 4K Native Access
- 16.4K Komplete
- 2K Komplete General
- 4.3K Komplete Kontrol
- 5.7K Kontakt
- 1.6K Reaktor
- 377 Battery 4
- 835 Guitar Rig & FX
- 425 Massive X & Synths
- 1.3K Other Software & Hardware
- 5.7K Maschine
- 7.2K Traktor
- 7.2K Traktor Software & Hardware
- Check out everything you can do
- Create an account
- See member benefits
- Answer questions
- Ask the community
- See product news
- Connect with creators