HISE Logo Forum
    • Categories
    • Register
    • Login

    Calling child functions

    Scheduled Pinned Locked Moved Scripting
    8 Posts 3 Posters 1.8k 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.
    • d.healeyD
      d.healey
      last edited by

      In my instrument I have 3 samplers, each one has a function for setting up the key colours related to its own samples. On the master container's interface the user can change various settings which has the result of changing some of the keyboard colours. Rather than putting the keyboard colour script in the master containers script I think it would be better to call the child's function. This would keep things nicely encapsulated.

      The method I have of doing this is to store the child's function in a variable inside the Globals object. I'm happy with this method but I wanted to know if there is another or better way of doing this in HISE?

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

      1 Reply Last reply Reply Quote 0
      • Christoph HartC
        Christoph Hart
        last edited by

        This works, but I would recommend using include statements and external files for boring function declarations.

        The problem with the global object is that the scripts get compiled top down. When the instrument is loaded and the main script is accessing a function at compiling which is not defined yet (because the sampler script isn't compiled yet), it won't call the function (because the name is undefined).

        And from a encapsulation point of view, it also might be better to put them in the main container script because then you'll have everything interface related at one place (that's how I am handling it): one main interface with deferred callbacks and multiple MIDI processor scripts at various places that are controlled by the main interface script.

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

          That sounds like a good approach. I'm already finding the include statement useful for all the JSON stuff.

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

          1 Reply Last reply Reply Quote 0
          • LindonL
            Lindon
            last edited by

            OK so I have a similar set up that defined by Dave, actually 4 samplers in containers, I would like to "direct" play_note to only specific containers, so holding the play_note activity at the sub-container level and calling it as a function would be really nice, in effect giving us an extensible encapsulation model. In this instance I'm attempting to get $EVENT_PAR_ALLOW_GROUP type functionality, but I could see how other stuff would work nicely this way. Still is there a way to get at least this $EVENT_PAR_ALLOW_GROUP functionality?

            HISE Development for hire.
            www.channelrobot.com

            1 Reply Last reply Reply Quote 0
            • Christoph HartC
              Christoph Hart
              last edited by Christoph Hart

              Sampler.setActiveGroup does the same thing IIRC.

              I can add the Synth.playNote function to child synth objects, although I have to be careful not to mess up the natural event flow with this...

              1 Reply Last reply Reply Quote 1
              • LindonL
                Lindon
                last edited by

                OK great, so Sampler.setActiveGroup means all play-note commands just get pointed at the Active Group? AN "Group" is a pseudonym for Container?

                HISE Development for hire.
                www.channelrobot.com

                1 Reply Last reply Reply Quote 0
                • Christoph HartC
                  Christoph Hart
                  last edited by

                  Not quite. Think of the group as z-axis for the usual two dimensional mapping notenumber / velocity.

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

                    Coming from Kontakt I think of it this way, each sampler you use in HISE is essentially what you get when you have a single NKI in Kontakt. Each sampler can have groups, just like a Kontakt instrument, into which you can map your RR or dynamic layer samples.

                    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

                    20

                    Online

                    1.7k

                    Users

                    11.9k

                    Topics

                    103.6k

                    Posts