HISE Logo Forum
    • Categories
    • Register
    • Login

    Q: Does HISE still split included modules?

    Scheduled Pinned Locked Moved Scripting
    6 Posts 2 Posters 407 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.
    • R
      RCJacH
      last edited by

      I read from this post that when all five functions are defined within a script, HISE splits the file and place the callback into their own tabs.

      I wrote a test file including only the following:

      // test.js
      Console.print("init");
      function onNoteOn()
      {
        Console.print("noteOn");
      }
      function onNoteOff()
      {
        Console.print("noteOff");
      }
      function onController()
      {
        Console.print("controller");
      }
      function onTimer()
      {
        Console.print("timer");
      }
      function onControl(number, value)
      {
        Console.print("control");
      }
      
      

      I tried to import this file, and no matter where I import this with include("test.js"), I only get feedback from the tab which I import from plus onInit. So apparently HISE is not splitting the file into tabs.
      Am I missing something?

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

        HISE splits the file and place the callback into their own tabs.

        That doesn't happen when using includes. That happens when you replace a script with one on the clipboard by right clicking in the script editor and selecting Load script from clipboard.

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

        R 1 Reply Last reply Reply Quote 0
        • R
          RCJacH @d.healey
          last edited by

          @d-healey I see! Thank you.

          A question then,
          If I want to apply the same behavior to multiple processors, with only difference in the value of variable, what's the best way to do so without hardcoding everything?

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

            @RCJacH

            Could you describe what you're trying to achieve in more details so I can best advise a suitable approach?

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

            R 1 Reply Last reply Reply Quote 0
            • R
              RCJacH @d.healey
              last edited by

              @d-healey I'm trying to build a guitar strumming library where each fret is sampled on each string, and each string is triggered with a different MIDI channel.
              So each string has similar behavior, except that each string has its own boolean variable to detect whether to play muted sample.
              The boolean is latched with a dedicated CC or Key, all notes played during the latch is muted. So I need a variable to save whether it's open or muted, and use that variable in an if clause.

              I just found out about the ability to connect to an external script, are variables declared in the external script stay local to each processor that uses it?

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

                @RCJacH Oh you're doing something fun. I spent several months of 2019 working on a still unfinished guitar strumming engine. :D

                When you include a script it's the same as if you've copied/pasted the script directly in to the MIDI processor's on init callback. So yes, each one is independent. You should use a namespace in your external script too so that a) you get access to more reg variables and b) it's easier to see where various function calls are coming from.

                If you edit the external script though those changes will be reflected wherever you have included it.

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

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

                46

                Online

                1.7k

                Users

                11.7k

                Topics

                101.9k

                Posts