HISE Logo Forum
    • Categories
    • Register
    • Login

    Broadcasters best practices

    Scheduled Pinned Locked Moved Solved Scripting
    53 Posts 6 Posters 3.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.
    • d.healeyD
      d.healey @d.healey
      last edited by

      @d-healey said in Broadcasters best practices:

      I just tried using the broadcaster wizard for the first time. I selected ComponentVisibility in the second screen, this is what it gave me

      const var showAboutBroadcaster = Engine.createBroadcaster({
        "id": "showAboutBroadcaster",
        "args": ["component", "isVisible"],
        "tags": []
      });
      
      // attach to event Type
      showAboutBroadcaster.attachToComponentProperties(["pnlAboutContainer"], "Temp");
      
      // attach first listener
      showAboutBroadcaster.addComponentPropertyListener(["pnlAboutContainer"], ["visible"], "temp", function(index, component, isVisible){
      	return isVisible;
      });
      

      This gives an error argument amount mismatch: 2, Expected: 3

      I changed it to attachToComponentVisibility and the issue is resolved.

      Any ideas about this one Christoph? Is it a bug or did I use the wrong settings in the wizard?

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

      A 1 Reply Last reply Reply Quote 0
      • A
        aaronventure @d.healey
        last edited by

        @d-healey your function prototype is correct, now just make the arguments for the broadcaster match, i. e. add index to the args

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

          @aaronventure This is auto-generated by the broadcaster wizard - and it doesn't work, therefore I think it's a bug. It should be using attachToComponentVisibility, but it isn't.

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

          A 1 Reply Last reply Reply Quote 0
          • A
            aaronventure @d.healey
            last edited by

            @d-healey ah gotcha

            1 Reply Last reply Reply Quote 0
            • d.healeyD d.healey referenced this topic on
            • d.healeyD
              d.healey
              last edited by d.healey

              This is confusing

              00155799-f272-4d29-a9c4-a6c465dabe08-image.png

              I had no idea what was wanted here, but it's a string (must have quotes)

              I tried to add multiple events to the EQ broadcaster and the output was "BandAdded, BandRemoved, BandSelected" which doesn't work. It should be ["BandAdded", "BandRemoved", "BandSelected"]

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

              Christoph HartC 1 Reply Last reply Reply Quote 0
              • Christoph HartC
                Christoph Hart @d.healey
                last edited by

                @d-healey said in Broadcasters best practices:

                I had no idea what was wanted here, but it's a string (must have quotes)

                You can pass any object into the addCallback() function which will be assigned as this object in the executed function:

                const var list = [1, 2, 3];
                
                bc.addCallback(list, "something", function()
                {
                   for(n in this)
                      Console.print(n); // 1, 2, 3
                });
                

                In this case you would just enter list into the This Object field.

                The other issues you mentioned are fixed now.

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

                  @Christoph-Hart Ah ok that makes sense, thanks

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

                  LindonL 1 Reply Last reply Reply Quote 0
                  • LindonL
                    Lindon @d.healey
                    last edited by

                    @d-healey said in Broadcasters best practices:

                    @Christoph-Hart Ah ok that makes sense, thanks

                    does this mean you are investigating Broadcasters with a view to doing a video on it? (fingers crossed here...)

                    HISE Development for hire.
                    www.channelrobot.com

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

                      @Lindon I've been using them since they were a thing. I'll make a broadcaster video for this weekend 😀

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

                      Christoph HartC 1 Reply Last reply Reply Quote 5
                      • Christoph HartC
                        Christoph Hart @d.healey
                        last edited by

                        @d-healey If you find any UX hurdles during the making of the video, let me know then I'll clean it up.

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

                          Can broadcasters be defined as global? I might have finally found a use case for a global variable.

                          In my project I have a few MIDI processors that do things when the user changes articulation. My current method of handling this is each of the scripts has a knob to keep track of the current articulation. And when the articulation is changed all these knobs are updated and their callbacks triggered.

                          I'm thinking though it might be nice to just have a global articulation watcher instead of these knobs. That way the scripts will be more independent - which is the opposite of my usual argument against globals :)

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

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

                            @d-healey said in Broadcasters best practices:

                            Can broadcasters be defined as global?

                            Well I thought this was working, but then a user noticed a bug. If in the DAW the track with the plugin is duplicated the broadcaster behaviour seems to break. Are globals shared between plugin instances somehow?

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

                            A 1 Reply Last reply Reply Quote 0
                            • A
                              aaronventure @d.healey
                              last edited by

                              @d-healey ooh boy. Does it affect other globals as well?

                              d.healeyD Christoph HartC 2 Replies Last reply Reply Quote 0
                              • d.healeyD
                                d.healey @aaronventure
                                last edited by

                                @aaronventure This is the only global I'm using so haven't tested it with others

                                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 @aaronventure
                                  last edited by

                                  @aaronventure no globals are used per instance. The only relevant thing that I know that is shared is the timer thread so if you have multiple instances with busy timers you might experience UI freezes.

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

                                    @Christoph-Hart No timer here just a global broadcaster. When I remove that code and implement the same functionality without the global the problem goes away. I'll see if I can make an isolated example.

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

                                    Christoph HartC 1 Reply Last reply Reply Quote 0
                                    • Christoph HartC
                                      Christoph Hart @d.healey
                                      last edited by

                                      @d-healey yup an isolated example would be useful, I wouldn't know why it should behave like that but maybe I missed something, it's definitely not supposed to do so.

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

                                        I managed to isolate it.

                                        HiseSnippet 1189.3oc6W01ahaDDdMINWs6KpQs+.b8mLRnbP50qU8TTIPRphtKIniznVkdJZwdAVk06hrWRgFgz8Sq+j5+f1Y7KXycNMTTuuU9.hcl4YlYmclmcoWjxmEGqhHFVWNeBiX7Il8mK0i6NlxkjSOhXrq4fHEMvmFqYQWxh0jNymPiiYADCis9QzLCqsIIe9yenCUPk9rBQDxUJtO6U7PttPZu1ujKDmPCXWxCKY8yZepuR1UITSgTZKyljIT+aoiXmSQypYRL143.tVE0WS0rXhw1cTAy6OV8axT6uhGyGHX3hVj9fiREehRDfYLJkzcLWDzKeqGS.uzqnPrUZg3KMOiGvWJunf74IJbJPTtdXTa0zaqURuVkSulkRuJRoZkRosSSocM66GwmnKzf4yGadpDNZFRgxd4TI0VRseslYWEXgTuWH8V1IQvhkH7ddylMbfup+Ba6QB0.pvYzMkNwicNv49EnxUjtW37N9fpiki3R1d9QLX+1ov.O66ssb4AteuiKZpaCXIMZTLH3ZWtLfMy8M1Kvn9zm9UNClp0JYrMb3GqcFnkfqyS5QL8gBQWU3DkDVG64B5cQjCUQNdyb3RDQcaqY6EyzHrHknKUHF.8NdJInLSH.xxlKEPJ6LbpzWyURmxF34mGlFN2QESY0su2x15cCTZjtBM.DevANKgkDAK9PGuT3vBqJpb.bYvgwyk9mAGjP+s20fm2Kotbwvhrn9a.Gt.1oEI64JM6BoWcr.CpbdWUCGVotrMn.NZpRMNFF8OAzSNMb.KpnrjZHzatZCu4C2vWddzO8vsjgJ4oRt9hIL4CMkRx5Hv40rrBLUmLZ7YYiFcRZjHbXBXGSnj1jjjuv7PMx5ho0RLas1X1eMvzWvCXQIXdh4KkpAKCTAYI4mN8HplBaQircKTAlvhzbr3ZbD6NfLMkMvx7HV7sZ0jjxQVCC76GqfLaY7d60smWD7yaSVe2z5Acyu7uwM6+Pt4szUbySdzJ4C3m+PzNjGDHX8Twbrit7kUv73j97emUVVHcVoyi1j0kE9KxjVbuPqJYiutlYJI2czHmkzv.cWx0tHY2JW634tzF2TxRmag8aFQI9yRLkzf.rX34hxca3.L6HuNtB4qdMUBDMfv8a3zpj72mwD0TPYVAiYICphxz1ZYViA3PsNhCT7LuBwImZ4HR33PRSd7QrgPrB7pfzrdhmqhME13uhCqk.GVx0MNhrkPU3dd.dIDSScWzX4lvKgqE3xAWZkWIRYzS07hb49iw5VfGJAuvZw+SFuJYrwZP3siIVKy46LM1btNiRzB67XwaVdrlm+iMalGdymJXpfpW8gf3qeyTfTKkm2wNcIP4Lubf9O60gqaJtqYOt1eb04XsJxQ7gme.xwr2T+olGObHyWWjfaadxO+g4AzjWqlp4xQmQAxGrO37og8g+VgOChtTxD37A7p.DZx5l4sH8g2lkr3ufOYJagqMxT1JWIIj5GotwOs+Ge09GkHAxIYxeXwx7LbsSE2zCWKwuw2eUW8d.2eSA90aJvmso.+lME3y2Tfe6lB76dbf3svGNUqBSGaHjy5cbBakgwwRJzAlzsR9a.HSuTJ.
                                        

                                        So the buttons in the Interface script send a message to the broadcaster with the index of the button that was pressed. In the second script processor, there is a listener on the broadcaster. The listener gets the value that was passed, updates the knob value in the script processor and calls the .changed function on the knob. In the knob's callback it sets the value of the knob on the Interface script to this value.

                                        Now interestingly - if I don't use the .changed callback in the second script and instead put all the functionality in the listener then it works.

                                        I've been testing this as an expansion in Rhapsody so I didn't have to keep recompiling, I haven't actually tested it as a plugin...

                                        To recreate the issue, add the plugin to a track, click the buttons and you'll see the knob on the UI match the index of the button that was clicked. Then duplicate the track, open the plugin UI on the new instance, click the button and the knob value doesn't update.

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

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

                                          I did a test to see if it was just the changed call by itself - I removed the broadcaster entirely and just called .changed from both scripts. The problem was not present in this scenario so it seems the issue is with calling .changed from the broadcaster across scripts.

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

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

                                            Here's another test. This one I keep the broadcaster but remove the secondary MIDI processor, and everything works. So it definitely seems to be something related to calling it in another processor.

                                            HiseSnippet 1204.3ocsWEtSabDDdOfiT6lVUp5CvU+qyUHGeFBlTDpfMPqUBfUMIpUnHz5a2ydEq208t0o1EgTdz5aPeU5aP6r6c12cD6fqUi+AR6Ly2LeyryM6P6PoOMJRFhrJd0jgTj0Ss6LQn52rOlIPsNAYskc2PIl3iiTzvqnQJTiICwQQTBxxZ8eTalUgMPle+8Oz.ywBeZpHD5MRlO8UrALUpz1G8RFmeFlPuhMHi06dTKeonojKGATZc6pngX+aw8nWf0lslM5mvQ8QVemc0c8BBdQcbceZscI02qVcJoKsVvNA96WmP1IvKfT6E6+bj0lmRXJYXGEVQiPVazPRlzou72EwA3MrHVWNUevC0Ahbr3yjbhNE0RQM6y3j1SqUQHvKsSqbqGW49F6yYD1L4oUvuxnvIEQ1Bn0Z4o254nmWV5UMC8lCkrxPoMhozV1c7CYCUoZz74ysaIf6x.LbOkkJw1hV6uV2toDrPnpL.eK8rP3vLDt6Us51NveJePwh83xtXtSuaxzhD4bnyc2qUlSZkASZ3CpNUziInU7CoP91H0.2h2UrPIFoz26TRaZosgi3vdQffqKwDD53Rus385nBcHQJm2gCcdoP1sF3zozsGU0TNXnT.GbKYzVRifI3PPcBFI7ULovQJz57zvBkbW+oX1F7JeDsrlKFzUhnp2nE4Fq3fh5LawgyqTYMjDG2Dy4cg9W27wC7R9Tv6ilBdlT3YO6ac5NRo.fIn6pD4wcLmOCZjaIPuAYfLzwcrCSnQTtXgwymgfxT9UXNkrTClWAqPwBOLPwQJt7M14vCclAyDgBr.mjxJbnvbZW.3BxwQSD9mCcuvT.2qAOWwzLbYPJKJ+V8Eyb63pfIjWwfyBnEyzX4vSNVZam6XDc6FUgKc+1yxUWS.l0D3klEwJNXpb+9XQOJwUG8xGjoTcgTQuT3ZbAPLmGpJHXt5RJubfpySsdTY3GCnqXzftzvrcwZCgwA4mwXu3YLYGA5G2ZkwPonkfotbHUrnAinj9QXdjcBq.SUloQeYxznFl1XDCF5roMbgVEY3qdDDZYw3MCyZKMlZKQb5vYDZnAySrM2xSAYaYgRxukBXsG.70sNAqv54zIkHnrMjFpX5aDqSnuCdkLdpcA6SnQ2pjCM0vjdb3R7wphim8N56u9nIoOpdwQnk2MdKzM+5+E2TaQt483bt4IOZ4eA94O4GMfQHbZaYDS+YP1sPfOvG1g8GzrxFfGmYqjbj3oO5UYFR7a4IQjZh9KmMMFhVFJYa6UoJXoH6RRQiBBXiMa3Dv3ChT.QZM.F4gr9Z6WGQcHz.7HtxI5V.HLZ9VJ4Jow9GlXe3Z.vBHRxHNVkeqD8taIJzjM6p.5m6EPRLIaJ7+1pJKKE2xtMS42e9bbs4vQ3qqOEbLYAuuv9zf.puJkfaXe1u7oYaNzOKGoXhdmigNA3909hQC5.KE6SgnKDTtdLNL6SC0btp9rtBzAdyzb3efeIJ8lNERqzapRnywOTdie7DM8JjelQBvIgYc6B1mqO6LaFXZcFZzY236m2Ue.vZqJvcVUf6tp.e9pBbuUEX8UE39ONP8+vwwiTxAwe1fPm29TyyOVVmJvPGnoaE8u..Je6Y.
                                            

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

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

                                            52

                                            Online

                                            1.7k

                                            Users

                                            11.7k

                                            Topics

                                            102.2k

                                            Posts