Keeping keyboard colours the same when resetting Kontakt
Andrew Finch
Member Posts: 17 Newcomer
Hey all,
Currently I have two buttons that colour different key ranges when selected. Looking at the code below, when I press button1 and then the reset '!' in Kontakt I want the current button key range to stay the same and not revert back to what I have written for the initialization section, how can I make the key ranges persistent on resetting? Thanks in advance.
on init declare ui_switch $button1 set_text($button1,"") make_persistent ($button1) declare ui_switch $button2 set_text($button2,"") make_persistent ($button2) {****************KEYBOARD COLOURS******************} {Initialization} declare $count declare %key_color[128] declare %all_white_keys [71] := (0,2,4,5,7,9,11,... 12,14,16,17,19,21,23,... 24,26,28,29,31,33,35,... 36,38,40,41,43,45,47,... 48,50,52,53,55,57,59,... 60,62,64,65,67,69,71,... 72,74,76,77,79,81,83,... 84,86,88,89,91,93,95,... 96,98,100,101,103,105,107,... 108,110,112,113,115,117,119,120) $count := 0 while ($count < 127) set_key_color($count, $KEY_COLOR_INACTIVE) inc($count) end while $count := 0 while ($count <= 70) set_key_color(%all_white_keys[$count],$KEY_COLOR_BLACK) inc($count) end while $count := 36 while ($count <= 96) %key_color[$count] := $KEY_COLOR_BLUE inc($count) end while {---Set Colours---} $count := 36 while ($count <= 96) set_key_color($count, %key_color[$count]) inc($count) end while end on {================Callbacks=================} on ui_control ($button1) $button2 := 0 $count := 0 while ($count < 127) set_key_color($count, $KEY_COLOR_INACTIVE) inc($count) end while $count := 36 while ($count <= 60) %key_color[$count] := $KEY_COLOR_BLUE inc($count) end while $count := 0 while ($count <= 70) set_key_color(%all_white_keys[$count],$KEY_COLOR_BLACK) inc($count) end while { set key colors } $count := 36 while ($count <= 60) set_key_color($count, %key_color[$count]) inc($count) end while end on on ui_control ($button2) $button1 := 0 $count := 0 while ($count < 127) set_key_color($count, $KEY_COLOR_INACTIVE) inc($count) end while $count := 36 while ($count <= 96) %key_color[$count] := $KEY_COLOR_BLUE inc($count) end while $count := 0 while ($count <= 70) set_key_color(%all_white_keys[$count],$KEY_COLOR_BLACK) inc($count) end while { set key colors } $count := 36 while ($count <= 96) set_key_color($count, %key_color[$count]) inc($count) end while end on
0
Answers
-
I would suggest to do all your keycoloring in ONE function that you call from each button. Then you also call this function from "on persistence_changed" callback.
0
This discussion has been closed.
Back To Top
Categories
- All Categories
- 19 Welcome
- 1.5K Hangout
- 62 NI News
- 785 Tech Talks
- 4.1K Native Access
- 16.5K Komplete
- 2K Komplete General
- 4.3K Komplete Kontrol
- 5.7K Kontakt
- 1.6K Reaktor
- 379 Battery 4
- 845 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