HISE Logo Forum
    • Categories
    • Register
    • Login

    Is there any way to disable routing matrix reset behaviour when loading a sample-map or when creating a multi-mic set of samples?

    Scheduled Pinned Locked Moved General Questions
    23 Posts 4 Posters 1.3k 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.
    • A
      aaronventure @Orvillain
      last edited by

      @Orvillain said in Is there any way to disable routing matrix reset behaviour when loading a sample-map or when creating a multi-mic set of samples?:

      I guess what I'm gonna do is learn broadcasters

      This is such a core HISE Script concept and class (also among the best documented classes) that it should be the first thing anyone learns when they decide to do more advanced scripting.

      You're scripting the entire module tree build but you're sleeping on broadcasters?

      Yeah, you're about to unlock another dimension 😄

      O 1 Reply Last reply Reply Quote 2
      • O
        Orvillain @aaronventure
        last edited by

        @aaronventure said in Is there any way to disable routing matrix reset behaviour when loading a sample-map or when creating a multi-mic set of samples?:

        @Orvillain said in Is there any way to disable routing matrix reset behaviour when loading a sample-map or when creating a multi-mic set of samples?:

        I guess what I'm gonna do is learn broadcasters

        This is such a core HISE Script concept and class (also among the best documented classes) that it should be the first thing anyone learns when they decide to do more advanced scripting.

        You're scripting the entire module tree build but you're sleeping on broadcasters?

        Yeah, you're about to unlock another dimension 😄

        Yeah just had it on my list, but only just now finding a reason to prioritise it!

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

          @Orvillain

          Blooming blooms of bloomington! That was a lot easier than I had thought it was going to be! More or less the example in the documentation was all I needed to do. Here's the code for setting up the broadcaster. This happens in the main interface onInit function.

          const var b = Engine.createBroadcaster({
          	id: "sampleListener",
          	args: ["eventType", "samplerId", "data"]
          });
          
          b.attachToSampleMap("Kick_sampler", "SampleMapChanged", "");
          
          b.addListener("", "funky", function(eventType, samplerId, data)
          {
          	build_sampler_routing(samplerId);
          });
          
          

          This triggers a function called build_sampler_routing, which takes the samplerId in as an argument:

          inline function build_sampler_routing(sampler_id)
          {
          	local parts = sampler_id.split('_');
          	local slot_name = parts[0];
          	local routing_matrix = slots[slot_name]['sampler_routing_matrix'];
          	routing_matrix.setNumChannels(sampler_channel_count);
          	local slot_default_routing_data = default_channel_data[slot_name];
          	
          	for (channel in slot_default_routing_data)
          	{
          		local channel_data = slot_default_routing_data[channel];
          		
          		routing_matrix.addConnection(channel_data['source_idx'][0], channel_data['sampler_output_idx'][0]);
          		
          		if (channel_data['source_idx'].length > 1 && channel_data['sampler_output_idx'].length > 1)
          		{
          			routing_matrix.addConnection(channel_data['source_idx'][1], channel_data['sampler_output_idx'][1]);
          		}
          	}
          }
          

          That's how I needed it to work for my script anyway. Your mileage may blooming well very.

          Also shout out to @d-healey - signed up to your patreon guv, and learnt about broadcasters from your video. Would definitely love to see more there. Seems like broadcasters can handle a lot of the heavy lifting when it comes to communicating between different parts of a plugin.

          1 Reply Last reply Reply Quote 1
          • First post
            Last post

          17

          Online

          1.7k

          Users

          11.9k

          Topics

          103.7k

          Posts