HISE Logo Forum
    • Categories
    • Register
    • Login

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

    Scheduled Pinned Locked Moved Scripting
    3 Posts 2 Posters 18 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

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

          28

          Online

          2.0k

          Users

          12.9k

          Topics

          111.7k

          Posts