Accessing sampler instance from within midi processor
-
Heya. So I want to access the name of each midi processor instance that a particular script is attached to. Or optionally, I'd just like to get an object reference to its parent.
So this is my generic midi processor script, for example:
var sampler_name = "Sampler1"; var samplerObj = Synth.getSampler(sampler_name); samplerObj.enableRoundRobin(false); samplerObj.refreshRRMap(); function onNoteOn() { // blahblahblah // round robin processing code here } function onNoteOff() { // process biscuits into face // etc etc etc } function onController() { // empty } function onTimer() { // empty } function onControl(number, value) { // empty }
So the issue I'm having is that I want one single generic script for all of my midi processors - around 10 of them, because I have 10 samplers.
My slot_name variable cannot be a hard-coded variable. I was hoping for something like:
var slot_name = this.name;
But the 'this' keyword does not seem to work from inside of a midi processor.
Ultimately I want an object reference to the parent sampler for the midi processor object.
Sorry if this is a dumb question, but I poured over the docs a fair bit and couldn't see an obvious solution.
-
@Orvillain You can get the sampler that the processor is within using
Synth.getIdList("Sampler")[0];
-
@d-healey said in Accessing midi processor name from within connected script:
@Orvillain You can get the sampler that the processor is within using
Synth.getIdList("Sampler")[0];
nnnnghhhhhhhhhhhh!!! This works!
I was misunderstanding the documentation for that function, at the same time as misreading the hierarchy in the module tree. I thought the midi processor was a child of the sampler, but it isn't. It's a child of the synth chain! Doh!
Thanks Dave!
-
@Orvillain said in Accessing midi processor name from within connected script:
I'm fairly confident this will enable me to have my generic script,
That's how I do it
-
-