Can I manually trigger a Callback function?
-
@Lindon said in Can I manually trigger a Callback function?:
slightly frightened now...
It's more likely me misremembering some issue I ran into years ago.
-
@Lindon said in Can I manually trigger a Callback function?:
you probably want to do something on "empty"
they'll all be occupado in the end, I just wanted to focus on the functionality before I create all the sample maps and proceed to sample all my hardware drum machines
-
@Morphoice said in Can I manually trigger a Callback function?:
@Lindon @d-healey gotcha! seems to work like a charm, and it suddenly is successfully wirtten and recalled to/from a preset. that might - if I'm not overlooking anything - solve all my problems at once.
only thing I'd love to have is actually hearing the selected sample on selection but if I use the sample loading callback it would trigger upon preset restore aswell
I dont really understand what you are saying in this last bit - you select a button and it loads that map - isnt that what you want?
-
@Lindon said in Can I manually trigger a Callback function?:
you select a button and it loads that map - isnt that what you want?
yes. I was just thinking an audible preview of the sample after it's loaded might add some comfort for the user if they switch through the available samples
-
@Lindon I tried firing a note after the sample is loaded successfully but the problem was this would not work when the button is clicked but fire on recalling a preset, and there we wouldn't need it,
-
@Morphoice so use the preset manager to set a "loading a preset" flag , and uncheck once the preset is loaded...
In your buttons check to see if this flag is set - if not then it really is a user pressing the button(not a preset loading) - so you can play a demo note...
https://docs.hise.dev/scripting/scripting-api/userpresethandler/index.html
you want setPreCallback (to set the flag ON)
and setPostcallback (to turn the flag OFF) -
@d-healey I'm glad I'm not the only benefiting away from from the mess I caused. Unless you want all buttons off radio groups seem to be fine to use.
-
@Lindon aye! the playing never worked on the button press though. only ever on the preset load. I'll have to revisit the way I fired the note
-
@Lindon this was the way I did it before
Bass.asSampler().loadSampleMap(bassMaps[bassProms.indexOf(control)]); Bass.setLoadingCallback(Synth.playNote(36,127));
and that only seems to fire on preset loading, not on the actual button use
-
@Morphoice You can…
-
Call it by function name (pass in the component as the first argument).
-
If you want the callback after a component value change, call onChanged(). Except if it's during onInit. That won't work.
-
Register the callback for use with a broadcaster. Then, trigger the broadcaster manually.
-