Group Mute Kontakt script

Sampler and Sampling discussion (techniques, tips and tricks, etc.)
Post Reply New Topic
RELATED
PRODUCTS

Post

I'm learning how to write code and am getting an error in the last 7 lines. I'm doing something wrong.

I have created 2 mute buttons - one for the close mics and one for the stage mics. The mute button for the stage mics works, but the mute button for the close mics doesn't.

Can someone tell me what the correct code would be for the last 7 lines?

I get a "callback already defined" error on the last "on note" line.

Thanks!



on init
make_perfview
set_ui_height_px(284-68)
set_control_par_str($INST_WALLPAPER_ID,$CONTROL_PAR_PICTURE,"skin")
set_control_par($INST_ICON_ID,$CONTROL_PAR_HIDE,$HIDE_WHOLE_CONTROL)
make_perfview
set_ui_height_px(2)
declare $cc_value
declare ui_switch $muteclose
declare ui_switch $mutestage
declare $count := 0
declare ui_slider $Close(0, 631000)
move_control_px($Close,505,60)
declare ui_slider $Stage(0, 631000)
move_control_px($Stage,555,60)
declare $i
$Close := get_engine_par($ENGINE_PAR_VOLUME,0,-1,-1)
$Stage := get_engine_par($ENGINE_PAR_VOLUME,1,-1,-1)
set_control_par_str(get_ui_id($Close),$CONTROL_PAR_PICTURE,"slider" )

set_control_par_str(get_ui_id($Stage),$CONTROL_PAR_PICTURE,"slider" )
set_control_par_str(get_ui_id($muteclose),$CONTROL_PAR_PICTURE,"switch" )
set_control_par_str(get_ui_id($mutestage),$CONTROL_PAR_PICTURE,"switch" )

set_control_par(get_ui_id($muteclose),$CONTROL_PAR_WIDTH,15)
set_control_par_str(get_ui_id($muteclose),$CONTROL_PAR_TEXT,"")
set_control_par(get_ui_id($muteclose),$CONTROL_PAR_HEIGHT,45/2)
make_persistent($muteclose)
move_control_px($muteclose,495,175)

set_control_par(get_ui_id($mutestage),$CONTROL_PAR_WIDTH,15)
set_control_par_str(get_ui_id($mutestage),$CONTROL_PAR_TEXT,"")
set_control_par(get_ui_id($mutestage),$CONTROL_PAR_HEIGHT,45/2)
make_persistent($mutestage)
move_control_px($mutestage,555,175)


set_control_par(get_ui_id($Close),$CONTROL_PAR_DEFAULT_VALUE,500000)
set_control_par(get_ui_id($Stage),$CONTROL_PAR_DEFAULT_VALUE,500000)
set_control_par(get_ui_id($Close),$CONTROL_PAR_MOUSE_BEHAVIOUR,-2500)
set_control_par(get_ui_id($Stage),$CONTROL_PAR_MOUSE_BEHAVIOUR,-2500)
make_persistent($Close)
make_persistent($Stage)
set_control_par_str(get_ui_id($Close),$CONTROL_PAR_LABEL,get_engine_par_disp($ENGINE_PAR_VOLUME,0,-1,-1) & " dB")
set_control_par_str(get_ui_id($Stage),$CONTROL_PAR_LABEL,get_engine_par_disp($ENGINE_PAR_VOLUME,1,-1,-1) & " dB")
message("")
end on

on ui_control($Close)
$i := 0
set_engine_par($ENGINE_PAR_VOLUME,$Close,$i,-1,-1)
set_control_par_str(get_ui_id($Close),$CONTROL_PAR_LABEL,get_engine_par_disp($ENGINE_PAR_VOLUME,0,-1,-1) & " dB")
end on

on ui_control($Stage)
$i := 1
set_engine_par($ENGINE_PAR_VOLUME,$Stage,$i,-1,-1)
set_control_par_str(get_ui_id($Stage),$CONTROL_PAR_LABEL,get_engine_par_disp($ENGINE_PAR_VOLUME,1,-1,-1) & " dB")
end on

on note
if ($muteclose = 1)
disallow_group(0)
else
allow_group($ALL_GROUPS)
end if
end on

on note {ERROR HAPPENS HERE}
if ($mutestage = 1)
disallow_group(1)
else
allow_group($ALL_GROUPS)
end if
end on

Post

You can only use one "on note" callback in the script. Your callback should look like that:

Code: Select all

on note
	if ($muteclose = 1)
		disallow_group(0)
	end if
	if ($mutestage = 1)
		disallow_group(1)
	end if
end on

Post

Zombie Queen, thank you so much for the fast reply! I really appreciate it!

Post Reply

Return to “Samplers, Sampling & Sample Libraries”