HISE Logo Forum
    • Categories
    • Register
    • Login

    Synth.setMacroControl(8, value) -macroIndex must be between 1 and 8

    Scheduled Pinned Locked Moved Scripting
    8 Posts 3 Posters 81 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.
    • M
      MaedDeam
      last edited by

      Hi there, I am new to programing, I spend almost two weeks of evenings solving, what should be easy in my expectations.

      1. When I map slider to macro, functions that copies value to blank label (design choice) does not work

      2. When I map slider dynamicaly by code, using Synth.setMacroControl everything is fine until I get to macro 8. When I have
        Synth.setMacroControl(8, value);
        in function it gets me
        macroIndex must be between 1 and 8!

      I paste whole construction below

      Content.makeFrontInterface(1280, 720);

      const var SL_MACRO1 = Content.getComponent("SL_MACRO1");
      const var SL_MACRO_LABEL1 = Content.getComponent("SL_MACRO_LABEL1");
      const var SL_MACRO2 = Content.getComponent("SL_MACRO2");
      const var SL_MACRO_LABEL2 = Content.getComponent("SL_MACRO_LABEL2");
      const var SL_MACRO8 = Content.getComponent("SL_MACRO8");
      const var SL_MACRO_LABEL8 = Content.getComponent("SL_MACRO_LABEL8");
      const var SL_MACRO4 = Content.getComponent("SL_MACRO4");
      const var SL_MACRO_LABEL4 = Content.getComponent("SL_MACRO_LABEL4");
      const var SL_MACRO3 = Content.getComponent("SL_MACRO3");
      const var SL_MACRO_LABEL3 = Content.getComponent("SL_MACRO_LABEL3");
      const var SL_MACRO7 = Content.getComponent("SL_MACRO7");
      const var SL_MACRO_LABEL7 = Content.getComponent("SL_MACRO_LABEL7");
      const var SL_MACRO6 = Content.getComponent("SL_MACRO6");
      const var SL_MACRO_LABEL6 = Content.getComponent("SL_MACRO_LABEL6");
      const var SL_MACRO5 = Content.getComponent("SL_MACRO5");
      const var SL_MACRO_LABEL5 = Content.getComponent("SL_MACRO_LABEL5");

      inline function onSL_MACRO1Control(component, value)
      {
      Synth.setMacroControl(1, value);
      SL_MACRO_LABEL1.set("text", Math.round(value));
      }

      SL_MACRO1.setControlCallback(onSL_MACRO1Control);

      inline function onSL_MACRO2Control(component, value)
      {
      Synth.setMacroControl(2, value);
      SL_MACRO_LABEL2.set("text", Math.round(value));
      }

      SL_MACRO2.setControlCallback(onSL_MACRO2Control);

      inline function onSL_MACRO3Control(component, value)
      {
      Synth.setMacroControl(3, value);
      SL_MACRO_LABEL3.set("text", Math.round(value));
      }

      SL_MACRO3.setControlCallback(onSL_MACRO3Control);

      inline function onSL_MACRO4Control(component, value)
      {
      Synth.setMacroControl(4, value);
      SL_MACRO_LABEL4.set("text", Math.round(value));
      }

      SL_MACRO4.setControlCallback(onSL_MACRO4Control);

      inline function onSL_MACRO5Control(component, value)
      {
      Synth.setMacroControl(5, value);
      SL_MACRO_LABEL5.set("text", Math.round(value));
      }

      SL_MACRO5.setControlCallback(onSL_MACRO5Control);

      inline function onSL_MACRO6Control(component, value)
      {
      Synth.setMacroControl(6, value);
      SL_MACRO_LABEL6.set("text", Math.round(value));
      }

      SL_MACRO6.setControlCallback(onSL_MACRO6Control);

      inline function onSL_MACRO7Control(component, value)
      {
      Synth.setMacroControl(7, value);
      SL_MACRO_LABEL7.set("text", Math.round(value));
      }

      SL_MACRO7.setControlCallback(onSL_MACRO7Control);

      inline function onSL_MACRO8Control(component, value)
      {
      Synth.setMacroControl(8, value);
      SL_MACRO_LABEL8.set("text", Math.round(value));
      }

      SL_MACRO8.setControlCallback(onSL_MACRO8Control);

      function onMacroControl(index, value)
      {
      if (index == 0)
      {
      SL_MACRO1.setValue(value);
      SL_MACRO_LABEL1.set("text", Math.round(value));
      }
      else if (index == 1)
      {
      SL_MACRO2.setValue(value);
      SL_MACRO_LABEL2.set("text", Math.round(value));
      }
      else if (index == 2)
      {
      SL_MACRO3.setValue(value);
      SL_MACRO_LABEL3.set("text", Math.round(value));
      }
      else if (index == 3)
      {
      SL_MACRO4.setValue(value);
      SL_MACRO_LABEL4.set("text", Math.round(value));
      }
      else if (index == 4)
      {
      SL_MACRO5.setValue(value);
      SL_MACRO_LABEL5.set("text", Math.round(value));
      }
      else if (index == 5)
      {
      SL_MACRO6.setValue(value);
      SL_MACRO_LABEL6.set("text", Math.round(value));
      }
      else if (index == 6)
      {
      SL_MACRO7.setValue(value);
      SL_MACRO_LABEL7.set("text", Math.round(value));
      }
      else if (index == 7)
      {
      SL_MACRO8.setValue(value);
      SL_MACRO_LABEL8.set("text", Math.round(value));
      }
      }

      Thanks in advance

      1 Reply Last reply Reply Quote 0
      • M
        MaedDeam
        last edited by

        Of course thanks in advance for any help in resolving this case:)

        BTW this community is lit.

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

          Can you post a minimal snippet? In HISE go to Export > Export as HISE Snippet, and paste it here within code tags d0ebe9de-a8bd-4e51-90f6-41c067727339-image.png

          Just include the absolute minimum to demonstrate the problem you're trying to solve. So 1 macro, and 1 label. Make it as simple as possible so we can easily find a solution.

          Free HISE Bootcamp Full Course for beginners.
          YouTube Channel - Public HISE tutorials
          My Patreon - HISE tutorials

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

            @d-healey

            HiseSnippet 999.3ocsVssaaaCFlxIZXVcdXAnO.B9JkgfBIetnHXNwwY0n1Id0YA6NOZJpXhHQJHQ0Eih.zGs8Hs2fURcvVJ1YNPXU5Jx+Cee+7z2+z.FBGFxB.JZ2rxGCT9A0Yqn7kCVBITvnK.JUUG9.zy2ECNekOLLDaCTTN3WklUpdHH96e9kygtPJBuYJ.3VFAgGS7H7MyNs+GHttWBsw2P7x4cq9iPL5.lKKRPkCTMA9Pz8v6vWAktUQE7dX3RfxOq1ngCpmoYulMaaBgMsgvVV3luE6zwA017sl1KZaJ96.T9tg1DNKXFGxwg.kCOmYuZ1R1eQS.3VRHYgnpDCr.yDHmL8kLWaYIJmELXIw0dZ1ZTHPjkoaVwNHYE60pSH1j0yuYk6mhMnuIh7KfJUJRuCJPOq7zyLG81AkTxQoCSnzQpyPADe9FKR97J0QTNNvAhJtWl3KnxippCXBOn723AuGeYfXv5HLrZzy7D8tMLO9c0zpoI1tB45eBFnOa77ImM3iW2S+T8r3uCyGv77YTw.i5q8ntL1sib93yNe338Gepe0SXPMMB0kPw5NQTDmvn5L5ZjjIJf4ZfxxxIBDcivGWS6y0zhOh+lPLeBDEvx7sWlOhz+DHk9ZTmiefW+D8IPQvArHpsQh+x.dTRn0vK8OMsCfttKDGlM1lcI0QN5WfNDpM9gBzl3nmLq9ompalVJo4zRB4sReMdlhv5EUDX2PrdAfrJBTi8BTiRBTih.0bu.0rj.0rHPs1KPsJIPsJBT68BT6RBT6h.0Yu.0oj.0oHPc2KPcKIPcKBTu8BzK6N5i4tscEiiulZbr1m0pp8nl9SM43rSao2OcwA6zrTXK3+JPCZj2BbP1M6LGEOdWTQP84UDxKXgRdxLmiL5HJgesOl9bxXfz2YkpGorR3JOV63GS0Nl4RrwA.hsT3X81.HlzoB2e40WMnO32GcAjCyRkHqBj7wAbhrHTt.+IQa.IxRUUu.GdOm4KTzW+7tnPeQ.+v5tE9xu0e0lVGtouGbis+ddev1otVZpGCWfciy7QpO4zyyk+9+Ye4QJQpTR5fYKwVgLOyNxExKp8K6PJ0fX6uffqTTkFR3qx2A0+aMD7Ro3QpSIbzxcywJ6fihs3uEbLsMpZpCcbvH9FBdn5k+w2ldl.ejEwIz6DuRDPDa7pWE4MSz5IBKPmREuFI2uqHunjL1La+eFlZGO3eEeoFsjiURMZkYD3IEymiRtdIaT66imQvIZbSsUUik60sJbmJ9ySz23bDpXp1JvFkMvlkMvVkMv1kMvNkMvtkMvd6OPYa8mEwYdIWa.fISGF+FnhxPJTbBL9zJ3qfs7JrV
            

            I stripped down to one fresh knob and fresh label - i have tried looped it with indexes, and works fine besides 8 macro, which gave me same error.

            At the end of a day I tried to make knob tied to macro and with some text to display value.

            Thanks!

            ulrikU 1 Reply Last reply Reply Quote 0
            • ulrikU
              ulrik @MaedDeam
              last edited by ulrik

              @MaedDeam Have you tried with indexes from 0 -7, maybe the Macros is indexed like that?

              I am refering to this:

              inline function onSL_MACRO1Control(component, value)
              {
              Synth.setMacroControl(1, value);
              SL_MACRO_LABEL1.set("text", Math.round(value));
              }
              

              maybe it should be

              Synth.setMacroControl(0, value);
              

              Hise Develop branch
              MacOs 15.3.1, Xcode 16.2
              http://musikboden.se

              ulrikU 1 Reply Last reply Reply Quote 0
              • ulrikU
                ulrik @ulrik
                last edited by

                @ulrik @MaedDeam
                Forget it, it seems like a bug,

                Synth.setMacroControl(0, value); //does not work
                Synth.setMacroControl(8, value); //doesn't work either
                

                Hise Develop branch
                MacOs 15.3.1, Xcode 16.2
                http://musikboden.se

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

                  Your snippet is working here. I've set it up with 4 macros so you can see a simpler way to write it. You can add all 8 macro knobs without needing additional code - as long as you name them using the same convention I've used.

                  Peek 2025-11-20 11-31.gif

                  HiseSnippet 1040.3ocsV0saaaCElzNpH1adXEnO.B4Jmsf.KmX6DTLT23XuZz7iQcVQwZ6RoonhIBEofDUqMFJvdp108AXWuq1CwdC1H0OVRwtqNqo5Nxy46ie7nygmyHeAlDDH7AvpWL2i.fesw34b4zdSQTNX3w.XEi9yPtdLB3n4dnf.hM.BK+iZyvJa.h996GcDhg3XR1V.vyETL4DpKUls6ntOkxXCP1jKnt47d+tCwBdOASDpjRYiF.OD9ZzUjyPZ2JY.dBJXJ.9cFcZbHo4dGZ0dxAMZ21Z+NVjCmzvYxAXmlM6zo09sZ0hztsRj2quMUJ7GKQRR..twQB64imJdGO9.dNMfNQcqTKr.iUmb71CDLa8UTuKn2TJydTZLJ.nXYTVDqbbD6AFmRsoK1OKx8sQFLyPjO.BKUTdkKHOq7xqQN4sBIAyIoMhkz8MFi8odxLKZ87UFC4RhuCBW7eYrufROojQOgxCtbWWz0jA9pEKPT2p4AM1wrSyFa+vZUqUU86JPZdMexoHruv7GLSgdEQ9XFqmv0SvUqCpuUpSu5U1aoAGCkMg8ogl5TJzZUcD9l0mYR4KN6sq9qUqLa2.hTyiuf0CwXSToO0E7TeRrr8Cq9dEGTNixIlNgbrjJ3lK4WcbpF1w7sHVHY6Z5CgIvHl5nsIyTpNEytQabtSFH0wTqZkn5HsrJvbL5u2zJkY0spR507kQVesFT8sjjYxs1w7TjhEeQH2tdL.Mh2GEJxz+YBI4bd8nPg5JZdSSNNqzVhnXD+UZVWi5+eArNOzcBwO8pj5nJOrXxswGO4NesGNNOHmiB9PNUdtGg+wpHAIIO5ZyDUobUFUF7MIkAiYTahOfZqqAR+s0.DI5j2fdiye9rtfaEAVEH32dvu7y2RBZdCE76u3VRvdEH3C+wIurK3mFdLRhzOKjDXTAKOhujp+O.Ol7V0ixwORTw3XRv0RgG.t4hZN0+p0J1MS4Hbf5Tmm8H9EccQyVr7CWpuMKn8dwzVKg1SPSHrDVSy9WIqceSWcgf1vSUKIp7JTTpCrL3VpZqX9+q6VUuRVyoZ5mopaFyuO7NU0qj0bpF+Yp58h4eyR2opdkrlS0t2T0K2ZT0TVXGxPxhcp0yyjXP8BWg1i5Vf7.pbd94ctyZeutR79FinR7zUqwRqPipm.9RnwjgdpYz2wgfkYBbCiAu3KyDNfmIBkT9UpNg9TcBvYgtiUCJhIpSmyILcGFXIcuf30Mzq0QfwDtczh+Q8kXzRuFlXzJ0HvUmecIN94W8XUaFsiRS7nQPqXDOsh0xsMbUS4cIFWjpk.1b41EqGv8VtMw5Ab+kaOrd.aU.Xz25Ar8+WfctAP0SCqGvC9zmndH7GGJEtwkM.voi5G0iDB6y0uTDksB9WLLxStE
                  

                  Edit: Ah yeah I see the bug, index 8 doesn't work. Make a bug report on github and link to this thread, should be an easy fix.

                  Edit 2: I fixed it

                  Free HISE Bootcamp Full Course for beginners.
                  YouTube Channel - Public HISE tutorials
                  My Patreon - HISE tutorials

                  M 1 Reply Last reply Reply Quote 2
                  • M
                    MaedDeam @d.healey
                    last edited by

                    Thank you very much, actually I'm glad that my logic was quite ok and I am not isane:) Your example was claryfing some stuff too. Thanks!

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

                    15

                    Online

                    2.0k

                    Users

                    12.9k

                    Topics

                    111.8k

                    Posts