Last active
May 28, 2023 05:49
-
-
Save aike/0e5b8f3c99026a162cb579dff984e792 to your computer and use it in GitHub Desktop.
KONTAKT KSP Wavetable UI example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on init | |
message("") | |
set_ui_height_px(250) | |
make_perfview | |
declare ui_knob $X(-1000000,1000000,1) | |
move_control_px($X, 500, 140) | |
$X := 600000 | |
declare ui_knob $Y(-1000000,1000000,1) | |
move_control_px($Y, 500, 190) | |
$Y := -1000000 | |
declare ui_wavetable $wavetable | |
{*** set the wavetable zone name here ***} | |
set_control_par(get_ui_id($wavetable), $CONTROL_PAR_WT_ZONE, find_zone("MyWave")) | |
set_control_par(get_ui_id($wavetable), $CONTROL_PAR_WIDTH, 450) | |
set_control_par(get_ui_id($wavetable), $CONTROL_PAR_HEIGHT, 230) | |
set_control_par(get_ui_id($wavetable), $CONTROL_PAR_POS_X, 25) | |
set_control_par(get_ui_id($wavetable), $CONTROL_PAR_POS_Y, 10) | |
set_control_par(get_ui_id($wavetable), $CONTROL_PAR_WAVE_COLOR, 900ff00h) | |
set_control_par(get_ui_id($wavetable), $CONTROL_PAR_WAVE_END_COLOR, 900ff00h) | |
set_control_par(get_ui_id($wavetable), $CONTROL_PAR_WAVETABLE_COLOR, 900bb00h) | |
set_control_par(get_ui_id($wavetable), $CONTROL_PAR_BG_COLOR, 9222222h) | |
set_control_par(get_ui_id($wavetable), $CONTROL_PAR_WT_VIS_MODE, $NI_WT_VIS_3D) | |
set_control_par(get_ui_id($wavetable), $CONTROL_PAR_PARALLAX_X, $X) | |
set_control_par(get_ui_id($wavetable), $CONTROL_PAR_PARALLAX_Y, $Y) | |
declare ui_knob $Position(0,100,1) | |
move_control_px($Position, 500, 10) | |
declare ui_button $LFO | |
$LFO := 1 | |
move_control_px($LFO, 500, 60) | |
declare $pos | |
declare ~angle | |
set_listener($NI_SIGNAL_TIMER_MS, 30000) | |
end on | |
on listener | |
if ($LFO = 1) | |
~angle := ~angle + 0.03 | |
$pos := int(sin(~angle) * 500000.0) + 500000 | |
$Position := $pos / 10000 | |
set_engine_par($ENGINE_PAR_WT_POSITION, $pos, 0, 0, -1) | |
end if | |
end on | |
on ui_control($Position) | |
set_engine_par($ENGINE_PAR_WT_POSITION, $Position * 10000, 0, 0, -1) | |
end on | |
on ui_control($X) | |
set_control_par(get_ui_id($wavetable), $CONTROL_PAR_PARALLAX_X, $X) | |
end on | |
on ui_control($Y) | |
set_control_par(get_ui_id($wavetable), $CONTROL_PAR_PARALLAX_Y, $Y) | |
end on | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment