HISE Logo Forum
    • Categories
    • Register
    • Login

    Midi Script Processor - How to callback from a ui control?

    Scheduled Pinned Locked Moved ScriptNode
    6 Posts 2 Posters 111 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.
    • griffinboyG
      griffinboy
      last edited by

      How can I get a midi processor to react to a UI control?

      I've got a scriptnode synth, and I need a callback or listener of some kind, so that when I change a control on the UI, the scriptnode synth Midi Script Processor knows that there has been a change.

      The purpose is to kill all voices and reset some arrays for the scriptnode synth when a control is altered.

      griffinboyG 1 Reply Last reply Reply Quote 0
      • griffinboyG
        griffinboy @griffinboy
        last edited by griffinboy

        @griffinboy

        So, my workaround has been to use global variables to pass stuff between the synth scripts and the UI.
        This works, but idk if it's optimal. And it's not a callback, but this way I can edit data that belongs to the scriptnode synth in the main UI script, since the data is global...

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

          @griffinboy said in Midi Script Processor - How to callback from a ui control?:

          global variables

          😢

          You can connect your UI components to other modules using the parameter id and processor id settings in the property editor. Or you can use .setAttribute() to do it through scripting.

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

          griffinboyG 1 Reply Last reply Reply Quote 0
          • griffinboyG
            griffinboy @d.healey
            last edited by

            @d-healey

            I'm not sure I get it!

            What I'm trying to do is trigger code.
            Say I have an array inside a midi processor inside of a scriptnode synth.

            If I wanted to clear the array using a button on the main UI, I don't see any way of doing so!

            Since code that exists in the interface script is not in the same scope as the scriptnode synth. Since that's the whole point of the encapsulation I guess

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

              @griffinboy Think of every midi processor as a self-contained island. In your midi processor with the array you want to clear, add a button that clears the array. Then you can connect the button on your UI to the button on your midi processor.

              Avoid global variables if you can - and I've never "had" to use them yet.

              In fact yesterday someone sent me a link to a script I posted as part of a project on github many years ago. They wanted to use this script in their project but it wasn't working. I took a look and realised it wasn't working because it was relying on various global variables existing and being set in other midi processors that weren't present in their project. This was a bad design choice but past Dave didn't know it.

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

              griffinboyG 1 Reply Last reply Reply Quote 1
              • griffinboyG
                griffinboy @d.healey
                last edited by

                @d-healey

                Interesting.
                Okay I've never done this before I didn't know set attribute could be used that way.
                I'll have a go

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

                57

                Online

                1.7k

                Users

                11.7k

                Topics

                101.7k

                Posts