Can I bypass this function?

treynterrio
treynterrio Member Posts: 64 Member
edited October 2024 in Scripting Workshop

Hi there, can anyone help with this? I want to bypass this function with a button?

I tried a couple things but to the code is never full bypassed (when I play everything is still monophonic)

on init

declare const $pitch_change_interval := 100
declare $glide_on
declare $currentnote_id
declare $newnote_id
declare $oldnote1_id
declare $oldnote2_id
declare $oldnote3_id
declare $current_pitch
declare $target_pitch
declare $pitch_shift
declare $actual_glide
declare $interval_cents
declare polyphonic $this_id

declare ui_slider $Glide(1000, 1000000)
declare $start
$Glide := 120000
make_persistent ($Glide)
declare $k_Glide
$k_Glide := get_ui_id($Glide)
set_control_par_str($k_Glide,$CONTROL_PAR_TEXT,"")
set_control_par_str($k_Glide,$CONTROL_PAR_PICTURE,"Glide")
set_control_par($k_Glide,$CONTROL_PAR_POS_X,262)
set_control_par($k_Glide,$CONTROL_PAR_POS_Y,10)
set_control_par($k_Glide,$CONTROL_PAR_MOUSE_BEHAVIOUR,$mouse_resp)

message("")
end on

on note

if ($EVENT_NOTE >= 36 and $EVENT_NOTE <= 107)
if ($glide_on =1)
ignore_event($EVENT_ID)
$newnote_id := play_note($EVENT_NOTE, $EVENT_VELOCITY, $Start, -1)
$this_id := $newnote_id
change_tune($newnote_id,$current_pitch - ($EVENT_NOTE*100000), 0)
$target_pitch := $EVENT_NOTE * 100000
$interval_cents := abs($target_pitch/1000 - $current_pitch/1000)
end if
$actual_glide := $Glide + ($Glide * $interval_cents / 1200)
fade_out($newnote_id, 0, 1)
fade_in ($newnote_id,$actual_glide)
fade_out($currentnote_id, $actual_glide, 1)

note_off($oldnote3_id)
$oldnote3_id := $oldnote2_id
$oldnote2_id := $oldnote1_id
$oldnote1_id := $currentnote_id
$currentnote_id := $newnote_id

$pitch_shift := ($target_pitch - $current_pitch) / ($actual_glide / $pitch_change_interval)
wait($pitch_change_interval)
while(abs($target_pitch - $current_pitch) > abs($pitch_shift))
if ($currentnote_id = $this_id)
change_tune($currentnote_id, $pitch_shift, 1)
change_tune($oldnote1_id, $pitch_shift, 1)
change_tune($oldnote2_id, $pitch_shift, 1)
change_tune($oldnote3_id, $pitch_shift, 1)
$current_pitch := $current_pitch + $pitch_shift
wait($pitch_change_interval)
else
exit
end if
end while
if ($currentnote_id = $this_id)
$pitch_shift := $target_pitch - $current_pitch
change_tune($currentnote_id, $pitch_shift, 1)
change_tune($oldnote1_id, $pitch_shift, 1)
change_tune($oldnote2_id, $pitch_shift, 1)
change_tune($oldnote3_id, $pitch_shift, 1)
$current_pitch := $target_pitch
end if
$currentnote_id := $EVENT_ID
$current_pitch := $EVENT_NOTE * 100000
$glide_on := 1
end if
end on

on release
if($EVENT_ID = $currentnote_id)
$glide_on := 0
note_off($oldnote3_id)
note_off($oldnote2_id)
note_off($oldnote1_id)
$current_pitch := $target_pitch
end if
if ($glide_on = 1 and $EVENT_ID # $oldnote3_id)
ignore_event($EVENT_ID)
wait($Glide)
note_off($EVENT_ID)
end if
end on
This discussion has been closed.
Back To Top