make_instr_persistent for function/group select

foundation77
foundation77 Member Posts: 2 Member

Assuming I have a callback for switches selecting a sample group.

If I was to switch samples/groups how do I keep this persistent if the script is reset (panic reset)?

Below is a snippet of what I am doing (as an example)

function callback
 set_control_par(%ID[$original],$CONTROL_PAR_VALUE,0)
 set_control_par(%ID[$selected],$CONTROL_PAR_VALUE,1)
 $original := $selected
 end function

on ui_control($switch)
  $selected:= 0
  $group := 0
  call callback
  end on

on persistence_changed
  call callback
  end on

I'm allowing and disallowing 'on note'

Any pointers appreciated :)

Thank you

Answers

  • EvilDragon
    EvilDragon Moderator Posts: 1,023 mod

    I'm assuming you have more than one switch there, that all select from the pool of available sounds. Say 10 switches but only 1 selection out of those 10. In that case I would have a variable that stores which sound is selected (0-9) and make that persistent (not instrument persistent, because this wouldn't be stored in snapshots, which is probably what you don't want). Then your function would run through all 10 switches and only set the one matching the value of that persistent variable to 1, others to 0.

  • foundation77
    foundation77 Member Posts: 2 Member
    edited March 2022

    Your assumption is correct.

    I'll try this script in a different slot and report back, should it help anyone else out.

    This is a good point re: snapshots.

    I don't currently have any intention of using them, but should they be needed later, it's best to cover all bases.


    Thanks Mario


    - Rich

Back To Top