HISE Logo Forum
    • Categories
    • Register
    • Login

    Accessing sampler instance from within midi processor

    Scheduled Pinned Locked Moved Solved Scripting
    4 Posts 2 Posters 47 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • O
      Orvillain
      last edited by Orvillain

      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.

      d.healeyD 1 Reply Last reply Reply Quote 0
      • d.healeyD
        d.healey @Orvillain
        last edited by

        @Orvillain You can get the sampler that the processor is within using Synth.getIdList("Sampler")[0];

        Libre Wave - Freedom respecting instruments and effects
        My Patreon - HISE tutorials
        YouTube Channel - Public HISE tutorials

        O 1 Reply Last reply Reply Quote 0
        • O
          Orvillain @d.healey
          last edited by Orvillain

          @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!

          d.healeyD 1 Reply Last reply Reply Quote 1
          • d.healeyD
            d.healey @Orvillain
            last edited by

            @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

            Libre Wave - Freedom respecting instruments and effects
            My Patreon - HISE tutorials
            YouTube Channel - Public HISE tutorials

            1 Reply Last reply Reply Quote 1
            • O Orvillain marked this topic as a question on
            • O Orvillain has marked this topic as solved on
            • First post
              Last post

            39

            Online

            1.7k

            Users

            11.7k

            Topics

            102.1k

            Posts