HISE Logo Forum
    • Categories
    • Register
    • Login

    Waveform doesn't save in Preset

    Scheduled Pinned Locked Moved General Questions
    waveformgeneratorbuttons
    14 Posts 4 Posters 539 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

      It looks like it's going through every button in the sequence when you recall the preset, which would explain why it lands on the Noise oscillator.

      LindonL 1 Reply Last reply Reply Quote 0
      • DanHD
        DanH @trillbilly
        last edited by DanH

        @trillbilly You can use a sliderpack to store and control the values of the buttons so they restore correctly.

        DHPlugins / DC Breaks | Artist / Producer / DJ / Developer
        https://dhplugins.com/ | https://dcbreaks.com/
        London, UK

        DanHD 1 Reply Last reply Reply Quote 0
        • DanHD
          DanH @DanH
          last edited by

          @DanH this kinda thing (I'm using it for filter mode buttons)

          /// DEFINE ARRAY
          
          const var pfButtons = [Content.getComponent("FILTButton1"),
                                 Content.getComponent("FILTButton5"),
                                 Content.getComponent("FILTButton3"),
                                 Content.getComponent("FILTButton4"),
                                 Content.getComponent("FILTButton2")];
          
          /// CALLBACK FOR PFBUTTONS
          
          for (b in pfButtons)
              b.setControlCallback(onpfButtonsControl);
              
          inline function onpfButtonsControl(component, value)
          {
              local index = pfButtons.indexOf(component);
          
              for (i = 0; i < pfButtons.length; i++)
              {
                  pfButtons[i].setValue(i == index);
                  SliderPack3.setSliderAtIndex(i, i == index);
              }
              
          }
          
          /// SLIDERPACK3 CALLBACK
          
          SliderPack3.setControlCallback(onSliderPack3Control);
          
          inline function onSliderPack3Control(component, value)
          {
              for (i = 0; i < value.length; i++)
              {
                  pfButtons[i].setValue(component.getSliderValueAt(i));
          
              }
          }
          

          DHPlugins / DC Breaks | Artist / Producer / DJ / Developer
          https://dhplugins.com/ | https://dcbreaks.com/
          London, UK

          1 Reply Last reply Reply Quote 1
          • LindonL
            Lindon @A Former User
            last edited by

            @iamlamprey said in Waveform doesn't save in Preset:

            It looks like it's going through every button in the sequence when you recall the preset, which would explain why it lands on the Noise oscillator.

            @trillbilly

            do you start your radio buttons code with:

            if(value)
            {
            
            ..your code here
            
            } 
            

            HISE Development for hire.
            www.channelrobot.com

            1 Reply Last reply Reply Quote 1
            • trillbillyT
              trillbilly @A Former User
              last edited by

              @iamlamprey Yes, buttons are in a radio group via the property editor.

              @DanH Ok cool, let me try this. I havent even began using slider packs yet so its a good time to do it.

              @Lindon No, I have them as radio buttons via the property editor.

              LindonL 1 Reply Last reply Reply Quote 0
              • LindonL
                Lindon @trillbilly
                last edited by

                @trillbilly said in Waveform doesn't save in Preset:

                @iamlamprey Yes, buttons are in a radio group via the property editor.

                @DanH Ok cool, let me try this. I havent even began using slider packs yet so its a good time to do it.

                @Lindon No, I have them as radio buttons via the property editor.

                There lies your problem, an easier fix than using slider packs - put the code in each radio button and make it execute ONLY when the radio button is on...

                HISE Development for hire.
                www.channelrobot.com

                trillbillyT 1 Reply Last reply Reply Quote 0
                • trillbillyT
                  trillbilly @Lindon
                  last edited by

                  @Lindon I havent scripted radio buttons or used slider packs so I guess its time to learn both lol

                  LindonL 1 Reply Last reply Reply Quote 0
                  • LindonL
                    Lindon @trillbilly
                    last edited by Lindon

                    @trillbilly said in Waveform doesn't save in Preset:

                    @Lindon I havent scripted radio buttons or used slider packs so I guess its time to learn both lol

                    -- what are you wanting the radio buttons to do?

                    I assume the buttons in your example code in the first post are radio buttons....

                    inline function onSinebtn1Control(component, value)
                    {
                    WaveformGenerator1.setAttribute(WaveformGenerator1.WaveForm1, 1);
                    };
                    
                    Content.getComponent("Sinebtn1").setControlCallback(onSinebtn1Control);
                    

                    so the way you have this coded each radio button will exceute in turn - the last radio button is noise so noise will get loaded...

                    but if you change the code to this:

                    inline function onSinebtn1Control(component, value)
                    {
                        if(value)
                        {
                      WaveformGenerator1.setAttribute(WaveformGenerator1.WaveForm1, 1);
                    };
                    
                    };
                    
                    Content.getComponent("Sinebtn1").setControlCallback(onSinebtn1Control);
                    

                    ..then only the ON button will be executed on preset load...

                    HISE Development for hire.
                    www.channelrobot.com

                    trillbillyT 1 Reply Last reply Reply Quote 1
                    • trillbillyT
                      trillbilly @Lindon
                      last edited by trillbilly

                      @Lindon Just allow only 1 waveform to be selected at a time. I just found an easy solution that seemed to work, it sounds like what you were suggesting but without scripting the Radio Buttons.

                      simply by changing this

                      //Sine
                      inline function onSinebtn1Control(component, value)
                      {
                      	WaveformGenerator1.setAttribute(WaveformGenerator1.WaveForm1, 1);
                      };
                      Content.getComponent("Sinebtn1").setControlCallback(onSinebtn1Control);
                      

                      to this

                      //Sine
                      inline function onSinebtn1Control(component, value)
                      {
                      	if (value)
                      	WaveformGenerator1.setAttribute(WaveformGenerator1.WaveForm1, 1);
                      };
                      Content.getComponent("Sinebtn1").setControlCallback(onSinebtn1Control);
                      

                      seems to have done the job. Is this what you meant? If not, do you see any problems doing it this way?

                      EDIT: Just seen your comment, its exactly what you were telling me lol

                      LindonL 1 Reply Last reply Reply Quote 0
                      • LindonL
                        Lindon @trillbilly
                        last edited by

                        @trillbilly see above - yes thats what I mean - you need to add if(value) to each of the button callbacks.

                        HISE Development for hire.
                        www.channelrobot.com

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

                        62

                        Online

                        1.7k

                        Users

                        11.7k

                        Topics

                        102.1k

                        Posts