Commands sent on page selection

I’d really like it if there was a way to specify some midi commands to be sent on page selection and on preset selection.

You can use an event hook to do whatever you want on page selection:

print ("Events demo")

events.subscribe(PAGES | POTS)
events.setPort(PORT_CTRL)

function events.onPageChange(newPageId, oldPageId)
  print ("old: " .. oldPageId)
  print ("new:" .. newPageId)
end

function events.onPotTouch(potId, controlId, touched)
  print ("potId: " .. potId)
  print ("controlId: " .. controlId)
  print ("touched: " .. (touched and "yes" or "no"))
end

Here are the hooks for presets:

preset.onLoad()

A callback function that is called immediately after the preset is loaded, but before the default values are initialized.

preset.onReady()

A callback function that is called when the preset is fully initialized and ready to be used.

A callback function that is called when user actives the preset by changing currently selected preset slot.

preset.onLeave()

A callback function that is called when user leaves the preset in order to switch to another preset slot.

preset.onExit()

A callback function that is called when preset is removed from the controller. Note, it is not called when user switches to another preset.

2 Likes