mute a note when another is pressed

Options
jose9
jose9 Member Posts: 2 Newcomer
edited May 2023 in Scripting Workshop

I would like to add to this code that when $C1 is pressed, $G1 does not sound.

but when $C1 is released, $G1 sounds (It can now sound ... that is, it is enabled again)

this is the code:

on init

 make_perfview

 set_ui_height_px(300)

declare $C1

$C1:= 36

declare $Csos1

$Csos1:= 37

declare $D1

$D1:= 38

declare $Dsos1

$Dsos1:= 39

declare $E1

$E1:= 40

declare $F1

$F1:= 41

declare $Fsos1

$Fsos1:= 42

declare $G1

$G1:= 43

declare $Gsos1

$Gsos1:= 44

declare $A1

$A1:= 45

declare $Asos1

$Asos1:= 46

declare $B1

$B1:= 47


set_key_pressed_support(1) 


declare ui_switch $Cmaj

end on


on note

if ($Cmaj= 1)

disallow_group($ALL_GROUPS)

  allow_group(0)

end if


if ($EVENT_NOTE=$C1 and $Cmaj=1)

play_note($C1 -12, 60, 0, -1)

end if

if ($EVENT_NOTE=$Csos1 and $Cmaj=1)

play_note($EVENT_NOTE -12, 60, 0, -1)

end if

if ($EVENT_NOTE=$D1 and $Cmaj=1)

play_note($EVENT_NOTE -12, 60, 0, -1)

end if

if ($EVENT_NOTE=$Dsos1 and $Cmaj=1)

play_note($EVENT_NOTE -12, 60, 0, -1)

end if

if ($EVENT_NOTE=$E1 and $Cmaj=1)

play_note($EVENT_NOTE -12, 60, 0, -1)

end if

if ($EVENT_NOTE=$F1 and $Cmaj=1)

play_note($EVENT_NOTE -12, 60, 0, -1)

end if

if ($EVENT_NOTE=$Fsos1 and $Cmaj=1)

play_note($EVENT_NOTE -12, 60, 0, -1)

end if

if ($EVENT_NOTE=$G1 and $Cmaj=1)

 play_note($EVENT_NOTE -12, 60, 0, -1)

end if

if ($EVENT_NOTE=$Gsos1 and $Cmaj=1)

play_note($EVENT_NOTE -12, 60, 0, -1)

end if

if ($EVENT_NOTE=$A1 and $Cmaj=1)

play_note($EVENT_NOTE -12, 60, 0, -1)

end if

if ($EVENT_NOTE=$Asos1 and $Cmaj=1)

play_note($EVENT_NOTE -12, 60, 0, -1)

end if

if ($EVENT_NOTE=$B1 and $Cmaj=1)

play_note($EVENT_NOTE -12, 60, 0, -1)

end if

end on


on ui_control($Cmaj)

if ($Cmaj= 1)

end if

end on

Back To Top