Need help with preset %array saving and setting engine parameter

I'm stuck on this :- I have an %array to save and load the gain parameter of a gainer in slot 1 of instrument insert fx. The full script below loads and saves the $gain ui_knob value but does not load / set the gain parameter value in the engine.
set_engine_par($ENGINE_PAR_GN_GAIN,$gain,-1,0,1)
I have tried several options including expanding the array and including the line above but it makes no difference so I can't figure it out :( . What am I missing? Any help would be greatly appreciated in a clear explaintion of how to do this to a beginner. I cannot find a clear explanation in the KSP reference manual for saving of a ui_knob/slider including it's path to it's engine parameter then how to recall it. If you know of one then please post the link Thank you :-
on init declare $i declare $load_arr_id := -1 declare $save_arr_id := -1 declare ui_button $Load declare ui_button $Save declare ui_knob $gain (0, 1000000,1) make_persistent($gain) declare %preset[1] end on on ui_control ($gain) $i:= 0 while ($i < 1) %preset[$i] := $gain set_engine_par($ENGINE_PAR_GN_GAIN,$gain,-1,0,1) inc($i) end while end on on ui_control ($Load) $load_arr_id := load_array(%preset, 0) end on on ui_control ($Save) $save_arr_id := save_array(%preset, 0) end on on async_complete if ($NI_ASYNC_ID = $load_arr_id) $load_arr_id := -1 $Load := 0 if ($NI_ASYNC_EXIT_STATUS = 1) $i := 0 while($i < 1) $gain := %preset[$i] inc($i) end while end if end if if ($NI_ASYNC_ID = $save_arr_id) $save_arr_id := -1 $Save := 0 end if end on
Comments
-
You need to
set_engine_par($ENGINE_PAR_GN_GAIN,$gain,-1,0,1)
in the async callback too, after the successful loading of the value.
1 -
Thank you medusa! Life saver! , seems obvious now and makes me feel like a 🤡
0
Categories
- All Categories
- 19 Welcome
- 1.5K Hangout
- 62 NI News
- 786 Tech Talks
- 4.1K Native Access
- 16.6K Komplete
- 2K Komplete General
- 4.3K Komplete Kontrol
- 5.7K Kontakt
- 1.6K Reaktor
- 380 Battery 4
- 846 Guitar Rig & FX
- 429 Massive X & Synths
- 1.3K Other Software & Hardware
- 5.8K Maschine
- 7.3K Traktor
- 7.3K 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