HISE Logo Forum
    • Categories
    • Register
    • Login

    Confusing Button Default Values

    Scheduled Pinned Locked Moved Scripting
    3 Posts 2 Posters 312 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.
    • ?
      A Former User
      last edited by

      Hey first public post here :)

      I'm having some weird trouble with Buttons. When Compiling (or loading in a DAW) the only button that can start on by default is the fourth one (16). When I compile or export with any other button enabled (including with defaultValue=1), it's disabled upon opening (VST).

      I basically want Ratio 4 to be the default when opening the plugin, but currently only Ratio 16 saves on as default. I'll post a video of what I mean. I have some code that disables the other buttons whenever one is selected, which I believe is the culprit, I just can't figure out why. It's like somewhere in the oninit it's calling a value change for the 16 Ratio button, which calls the other script, turning off everything else.

      I've tried:

      • Using defaultValue in the GUI Editor.
      • Scripting setValue(1); in oninit script after referencing the control.
      • Exporting after saving the project with Ratio 4 enabled.
      • Making new buttons.
      • Moving script around.
      • Using 1-Value in the exclusivity script for button-switching.

      Nothing changes, the only default-activating button is Ratio 16 (and the Compressor is set to Ratio 16 on initialization).

      Video of what I mean

      And here's the code, sorry for the messy labelling, the buttons in question are Button1, Button2, Button3, Button4 (with Button4 being the only one that works). The functions are in the "Setting Ratios" section.

      Content.makeFrontInterface(257, 486);
      
      const var Button1 = Content.getComponent("Button1");
      const var Button2 = Content.getComponent("Button2");
      const var Button3 = Content.getComponent("Button3");
      const var Button4 = Content.getComponent("Button4");
      const var Button5 = Content.getComponent("Button5");
      const var Button7 = Content.getComponent("Button7");
      const var Button6 = Content.getComponent("Button6");
      
      
      const var ShapeFX1 = Synth.getEffect("Shape FX1");
      const var ShapeFX2 = Synth.getEffect("Shape FX2");
      const var ParametriqEQ1 = Synth.getEffect("Parametriq EQ1");
      const var Dynamics1 = Synth.getEffect("Dynamics1");
      const var SimpleGain1 = Synth.getEffect("Simple Gain1");
      
      const var Drive_LIGHT = Content.getComponent("Drive_LIGHT");
      const var Shape_LIGHT = Content.getComponent("Shape_LIGHT");
      const var Comp_LIGHT = Content.getComponent("Comp_LIGHT");
      
      const var OutputLevel = Content.getComponent("OutputLevel");
      const var Knob2 = Content.getComponent("Knob2");
      
      
      
      
      //EFFECT BYPASSES
      
      
      inline function onButton5Control(component, value)
      {
      	ShapeFX1.setBypassed(1-value);
      	ShapeFX2.setBypassed(1-value);
      	SimpleGain1.setBypassed(1-value);
      	Drive_LIGHT.setValue(value);
      	
      };
      
      Content.getComponent("Button5").setControlCallback(onButton5Control);
      
      
      inline function onButton7Control(component, value)
      {
          ParametriqEQ1.setBypassed(1-value);
      	Shape_LIGHT.setValue(value);
      
      };
      
      Content.getComponent("Button7").setControlCallback(onButton7Control);
      
      
      inline function onButton6Control(component, value)
      {
          Dynamics1.setBypassed(1-value);
      	Comp_LIGHT.setValue(value);
      };
      
      Content.getComponent("Button6").setControlCallback(onButton6Control);
      
      
      
      
      
      
      inline function onKnob2Control(component, value)
      {
      	Knob2.setValue(1-value);
      
      };
      
      Content.getComponent("Knob2").setControlCallback(onKnob2Control);
      
      
      
      
      inline function onDrive_LIGHTControl(component, value)
      {
          Button5.setValue(value);
      
      };
      
      Content.getComponent("Drive_LIGHT").setControlCallback(onDrive_LIGHTControl);
      
      
      inline function onShape_LIGHTControl(component, value)
      {
          Button7.setValue(value);
      
      };
      
      Content.getComponent("Shape_LIGHT").setControlCallback(onShape_LIGHTControl);
      
      
      inline function onComp_LIGHTControl(component, value)
      {
      	Button6.setValue(value);
      };
      
      Content.getComponent("Comp_LIGHT").setControlCallback(onComp_LIGHTControl);
      
      
      //SETTING RATIOS
      
      inline function onButton1Control(component, value)
      {
      	Dynamics1.setAttribute(Dynamics1.CompressorRatio, 2);
      	Button2.setValue(0);
      	Button3.setValue(0);	
      	Button4.setValue(0);
      };
      
      Content.getComponent("Button1").setControlCallback(onButton1Control);
      
      inline function onButton2Control(component, value)
      {
      	Dynamics1.setAttribute(Dynamics1.CompressorRatio, 4);
      	Button1.setValue(0);
      	Button3.setValue(0);	
      	Button4.setValue(0);
      };
      
      Content.getComponent("Button2").setControlCallback(onButton2Control);
      
      inline function onButton3Control(component, value)
      {
      	Dynamics1.setAttribute(Dynamics1.CompressorRatio, 8);
      	Button1.setValue(0);
      	Button2.setValue(0);
      	Button4.setValue(0);	
      };
      
      Content.getComponent("Button3").setControlCallback(onButton3Control);
      
      
      inline function onButton4Control(component, value)
      {
      	Dynamics1.setAttribute(Dynamics1.CompressorRatio, 16);
      	Button1.setValue(0);
      	Button2.setValue(0);
      	Button3.setValue(0);	
      };
      
      Content.getComponent("Button4").setControlCallback(onButton4Control);
      
      
      
      
      
      1 Reply Last reply Reply Quote 0
      • d.healeyD
        d.healey
        last edited by

        My first guess is you have saveInPreset enabled on your radio buttons? Therefore any value you set in on init will be overwritten once the control values are restored.

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

        ? 1 Reply Last reply Reply Quote 0
        • ?
          A Former User @d.healey
          last edited by

          @d-healey thank you! Of course it was that simple, I feel dumb.

          now time to make this UV meter work 😟

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

          23

          Online

          1.8k

          Users

          12.1k

          Topics

          104.9k

          Posts