Ok, the volume range of a instrument can be set when a knob is declared:
Code: Select all
declare ui_knob $example(0,631000,1) {0 dB}
Code: Select all
declare ui_knob $example(0,500000,1) {-6.0 dB}
Code: Select all
declare ui_knob $example(0,[b]$value[/b],1)
I have done a script hat does something similar, but not totally exact, since the knob start to respond when its half way:
Code: Select all
on init
make_perfview
set_ui_height(2)
declare $volume
declare ui_switch $a
set_text($a,"0.0db")
$a := 0
declare ui_switch $b
set_text($b,"-6.0db")
$b := 0
declare ui_knob $MasterVol (0,1000000,1)
set_knob_unit ($MasterVol,$KNOB_UNIT_DB)
set_text($MasterVol,"Volume")
message ("")
end on
{ UI_UPDATE }
on ui_update
$volume := $MasterVol
if (get_engine_par($ENGINE_PAR_VOLUME,-1,-1,-1) # $volume)
$volume := get_engine_par($ENGINE_PAR_VOLUME,-1,-1,-1)
end if
$MasterVol := _get_engine_par($ENGINE_PAR_VOLUME,-1,-1,-1) {el knob coge el volumen del slider}
set_knob_label($MasterVol,_get_engine_par_disp($ENGINE_PAR_VOLUME,-1,-1,-1))
end on
{ UI_CONTROL }
on ui_control($a)
if ($a = 1)
$b := 0
end if
end on
on ui_control($b)
if ($b = 1)
$a := 0
end if
end on
on ui_control ($MasterVol)
if ($a = 1)
$volume := $MasterVol
_set_engine_par($ENGINE_PAR_VOLUME,$MasterVol - 369000,-1,-1,-1) {{0 dB}
set_knob_label($MasterVol,_get_engine_par_disp($ENGINE_PAR_VOLUME,-1,-1,-1))
end if
if ($b = 1)
$volume := $MasterVol
_set_engine_par($ENGINE_PAR_VOLUME,$MasterVol - 500000,-1,-1,-1) {-6.0 dB}
set_knob_label($MasterVol,_get_engine_par_disp($ENGINE_PAR_VOLUME,-1,-1,-1))
end if
if ($a = 0 and $b = 0)
$volume := $MasterVol
_set_engine_par($ENGINE_PAR_VOLUME,$MasterVol,-1,-1,-1)
set_knob_label($MasterVol,_get_engine_par_disp($ENGINE_PAR_VOLUME,-1,-1,-1))
end if
end on
Cheers