firing a preview note when sampler has loaded new sample map
-
@Morphoice said in firing a preview note when sampler has loaded new sample map:
I'm loading sample maps of one shots like so:
inline function onSnarePromControl(control, value) { if (snareProms.contains(control)) { for(e in snareProms) e.setValue( e == control); Snare.asSampler().loadSampleMap(snareMaps[snareProms.indexOf(control)]); Snare.setLoadingCallback(function(isPreloading) { Synth.playNote(38,127); }); } }
if I understand the documentation correctly the loadingCallback should be executed as soon as the sample map is loaded. however nothing happens, no note is played. What am I doing wrong?
well first DONT put your setLoadingCallback inside another inline function.....
second check the value of isPreLoading
third look at the documatition of preLoading callback - it has to be a callback on a panel -
@Lindon wouldn't this simply work?
Snare.setLoadingCallback(Synth.playNote(38,127));
-
@Morphoice snare is a sampler - so no, it has to be on a panel read the documentation:
https://docs.hise.dev/scripting/scripting-api/scriptpanel/index.html#setloadingcallback
-
Use this instead:
https://docs.hise.dev/scripting/scripting-api/broadcaster/index.html#attachtosamplemap
The loading callback of a panel is more suited towards UI tasks (eg. displaying a loading bar).
-
@Christoph-Hart said in firing a preview note when sampler has loaded new sample map:
Use this instead:
@Morphoice The documentation is a little inaccurate so a couple of threads you might want to read:
https://forum.hise.audio/topic/9879/code-snippet-new-samplemap-broadcaster-attachment
https://forum.hise.audio/topic/5644/do-i-not-understand-the-setloadingcallback -
@d-healey said in firing a preview note when sampler has loaded new sample map:
https://forum.hise.audio/topic/5644/do-i-not-understand-the-setloadingcallback
y'all got me confused talking about a panel when I want a sampler to play something but I'll work through it. Just returned home! thanks for the links and advice!
-
@Morphoice said in firing a preview note when sampler has loaded new sample map:
@d-healey said in firing a preview note when sampler has loaded new sample map:
https://forum.hise.audio/topic/5644/do-i-not-understand-the-setloadingcallback
y'all got me confused talking about a panel when I want a sampler to play something but I'll work through it. Just returned home! thanks for the links and advice!
Well its not actually the sampler you care about - but instead the process of loading a sample into a sampler - which happens over on another (background) thread, so you need something to tell you when this process is finished..... looks like the only truly reliable way is still some ways off - but a broadcaster will be your best option so far...
-
@Christoph-Hart @Lindon I shall learn about broadcasters then. But on a first readthrough it'll probably take 5 more to grasp what it is about and how I can implement what I want using it. Bear with me as I try
-
-
@d-healey
that antenna reminds me of the one I have once written a song about!
https://www.youtube.com/watch?v=g-bqbd0v70g
destiny!