onNoteOn() - Illegal operation in audio thread: String creation (in HISE plugin only!?)
-
@Christoph-Hart I tried that. Now I get:
Call of setNoteNumber() outside of midi event callback
on the following line for my note audition buttons and mapping (onNoteOn):
Message.setNoteNumber(noteSources[arrayPos]);
Full portion of that code:
arrayPos = noteTriggers.indexOf(Message.getNoteNumber()); if (arrayPos > -1) { Message.setNoteNumber(noteSources[arrayPos]); // yes so play its matching source note }else{ Message.ignoreEvent(true); // no ignore it.. };
If moving a controller, I get this:
Call of setControllerValue() outside of midi event callback
for that infamous Table line I recently cried bug about:
if(Message.getControllerNumber() == 4) { UnifiedVari = Message.getControllerValue(); tv = Math.round(127 * (VarHatsControllerTable.getTableValue(UnifiedVari/127.0))); Message.setControllerValue(tv); Console.print("table value: " + tv); }
If I could understand exactly what kind of script should go where, I could perhaps split them. It seems that only these two are throwing a fit.
What does this mean and what do I need to do, please?
-
You basically have two tasks in one function that cannot coexist:
- you can only change the note number in a synchronous callback
- you can only do UI stuff in a deferred callback
You'll need to untwist that into separate functions. Ideally anything that changes the note number is a separate script and the rest can stay in the main UI script.
-
@Christoph-Hart Thank you!
So, lets say I create a script file called extra.js.
Inside it, I put the script relevant to the mapping (and anything else which may currently cause an error), including the relevant onNoteOn portion of the script.
I include the script in my project with
include("extra.js");
before the line
Synth.deferCallbacks(true);
And that should do the job?
-
@gorangrooves You need to put the audio stuff in a completely separate MIDI processor.
-
@d-healey So, I create a MIDI script processor for the Main Container (the sampler window) and put all of this there?
-
@gorangrooves I can't say without being more familiar with your project.
Anything that is not UI related needs to go into one or more separate MIDI processors.
-
@d-healey Ok, but are we talking about the same thing? See the image, please.
-
@gorangrooves Yes
-
@d-healey Alright. Thank you. I'll give it a shot.
-
I am getting nowhere with this. It is like a f'ing Rubik's cube 🥴
Is anyone of you guys available 1-on-1 to help me with this? I'll compensate you fairly. I want to get this done asap and move on. -
so you need to get this bit of code into your seperate midi processor - the one you've identified.
arrayPos = noteTriggers.indexOf(Message.getNoteNumber()); if (arrayPos > -1) { Message.setNoteNumber(noteSources[arrayPos]); // yes so play its matching source note }else{ Message.ignoreEvent(true); // no ignore it.. };
so it wont know about noteSources, so you need a way to tell it - ahead of time when noteSources changes - or explicitly if its always the same.
so either:
declare noteSources in the midi processor init and populate it
or
make noteSources a global variable (not a great solution)
or
create a table in the MIDI processor that you can reference (and set) from your UI script -
Update: @Lindon saved the day (and a few more) by helping me today. I got the scripts separated. Massive thanks!