Autoplay Preset
-
@DanH make a button that doesn't save with preset (you can save it manually using the file system and make your own pref file if you need), and use the preset handler setPostCallback to do what you want
-
@ustk ah yes, thanks.
-
@ustk I'm getting into a bit of a muddle trying to execute this... IS this the right kind of path? It's making my project crash when changing preset so something is triggering @d-healey
const var myPresetHandler = Engine.createUserPresetHandler(); inline function autoplay(//is something meant to go in here?) { Console.print("hi"); } myPresetHandler.setPostCallback(autoplay);
https://docs.hise.audio/scripting/scripting-api/userpresethandler/index.html
-
You can't use an inline function as a callback, it has to be a standard function.
-
@d-healey so like:
myPresetHandler.setPostCallback(function(autoplay) { });
-
@DanH The function doesn't take a parameter.
-
myPresetHandler.setPostCallback(function() { });
? And how would I call it from a button callback?
-
A callback is a response to an event. The
on note on
callback is triggered when a note on message is received, a button callback is triggered when the button is clicked, a mouse callback is triggered when you interact with a panel using the mouse.The
setPostCallback
is trigged post (after) a preset has been loaded. You don't need to call it manually. -
@d-healey oh yep so I should use an if statement like if my button is on then do this...
Out of interest I'm still using a method of yours which involves a knob to update the preset name in a label from way back when - I'm assuming this was pre these functions and I'm probably better off using these new functions?!
-
@DanH said in Autoplay Preset:
@d-healey oh yep so I should use an if statement like if my button is on then do this...
Yeah
Out of interest I'm still using a method of yours which involves a knob to update the preset name in a label from way back when - I'm assuming this was pre these functions and I'm probably better off using these new functions?!
Maybe, different situations call for different methods. See what works :)
-
@d-healey ok thank you! :)