HISE Logo Forum
    • Categories
    • Register
    • Login

    onControl() triggered during compile

    Scheduled Pinned Locked Moved General Questions
    3 Posts 2 Posters 58 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.
    • MorphoiceM
      Morphoice
      last edited by Morphoice

      I'm trying to make tabbed pages, according to the BasicSynth example in Christoph's repository. I noticed, however, upon compiling the script and starting the plugin onControl() is triggered multiple times messing up the default Page to show. Did anyone in anyone encounter a smiliar problem before? I cant figure out how to set the initial page

      
      const tabControls 		= Content.getComponent("Controls");
      const tabEproms 		= Content.getComponent("Eproms");
      const tabSettings 		= Content.getComponent("Settings");
      const regControls		= Content.getComponent("regControls");
      const regEproms 		= Content.getComponent("regEproms");
      const regSettings 		= Content.getComponent("regSettings");
      
      const var tabs = [tabSettings, tabControls, tabEproms];
      const var regs = [regSettings, regControls, regEproms];
      
      handleTabs(tabControls);
      
      inline function handleTabs(activeTab)
      {
      
      	for(i = 0; i < tabs.length; i++)
       	{   
      	    regs[i].setValue( activeTab == tabs[i]);
          	tabs[i].set("visible", activeTab == tabs[i]);
          }
      }
      

      this is in my OnControl Callbacks

      function onControl(number, value)
      {
      	Console.print(number);
      	switch(number)
         {
             case regControls: handleTabs(tabControls); break;
             case regEproms: handleTabs(tabEproms); break;
             case regSettings: handleTabs(tabSettings); break;
         }   
      }
       
      

      i can switch the tabs no problem there, but initially it's always the wrong one (settings) instead of Controls. I put a console output in there and it lists a buttload of numbers when I click compile

      https://instagram.com/morphoice - 80s inspired Synthwave Music, Arcade & Gameboy homebrew!

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

        When you hit compile, or load your project all components that have saveInPreset enabled will have their callbacks triggered. So to prevent this, disable the saveInPreset setting.

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

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

          @d-healey never in a million years would I have figured that out ;) thanks dan! Not it works like a charm! ;)

          https://instagram.com/morphoice - 80s inspired Synthwave Music, Arcade & Gameboy homebrew!

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

          15

          Online

          1.7k

          Users

          11.9k

          Topics

          103.2k

          Posts