make_instr_persistent for function/group select

foundation77 Member Posts: 2 Newcomer

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
 $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


  • EvilDragon
    EvilDragon Moderator Posts: 947 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 Newcomer
    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