• Dark Theme
    • Categories
    • Register
    • Login
    HISE Logo Forum
    • Categories
    • Register
    • Login

    Waveform doesn't save in Preset

    Scheduled Pinned Locked Moved General Questions
    waveformgeneratorbuttons
    14 Posts 4 Posters 440 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.
    • T
      trillbilly
      last edited by 3 Nov 2022, 02:06

      Hey Gang,

      I've got a Waveform Generator with Waveform displayed on my UI. Ive got buttons scripted to change the Waveform Type. All of this works until I save a preset and try to re-open or even just re-compile the plugin.

      Buttons are "Save In Preset" enabled.

      Any suggestions on where to go next?

      //OSC1 WAVEFORM BUTTONS
      const var WaveformGenerator1 = Synth.getChildSynth("WaveformGenerator1");
      
      //Sine
      inline function onSinebtn1Control(component, value)
      {
      WaveformGenerator1.setAttribute(WaveformGenerator1.WaveForm1, 1);
      };
      
      Content.getComponent("Sinebtn1").setControlCallback(onSinebtn1Control);
      
      //Triangle
      inline function onTrianglebtn1Control(component, value)
      {
      WaveformGenerator1.setAttribute(WaveformGenerator1.WaveForm1, 2);
      };
      
      Content.getComponent("Trianglebtn1").setControlCallback(onTrianglebtn1Control);
      
      //Saw
      inline function onSawbtn1Control(component, value)
      {
      WaveformGenerator1.setAttribute(WaveformGenerator1.WaveForm1, 3);
      };
      
      Content.getComponent("Sawbtn1").setControlCallback(onSawbtn1Control);
      
      //Square
      inline function onSquarebtn1Control(component, value)
      {
      WaveformGenerator1.setAttribute(WaveformGenerator1.WaveForm1, 4);
      };
      
      Content.getComponent("Squarebtn1").setControlCallback(onSquarebtn1Control);
      
      //Noise
      inline function onNoisebtn1Control(component, value)
      {
      WaveformGenerator1.setAttribute(WaveformGenerator1.WaveForm1, 5);
      };
      
      Content.getComponent("Noisebtn1").setControlCallback(onNoisebtn1Control);
      
      D 1 Reply Last reply 3 Nov 2022, 08:49 Reply Quote 0
      • ?
        A Former User
        last edited by 3 Nov 2022, 02:10

        I believe they only show after a note is played, due to a technical limitation.

        T 1 Reply Last reply 3 Nov 2022, 02:19 Reply Quote 0
        • T
          trillbilly @A Former User
          last edited by trillbilly 11 Mar 2022, 02:42 3 Nov 2022, 02:19

          @iamlamprey The display isnt necessarily the issue. It's displaying the chosen Waveform type according to the backend Waveform Generator. The issue seems to be the Waveform Generator is saving the "Noise" waveform in each preset instead of the one displayed on UI button.

          Example:
          I create a preset with a SAW in Waveform Generator 1. I save said preset. I navigate from this preset to another and back to this preset. The preset is now saved with a NOISE Waveform even though my UI button is saved as SAW.

          Here is a video to help as well...

          https://www.veed.io/view/4d665370-2180-4699-9857-33bd71057c1c

          1 Reply Last reply Reply Quote 0
          • ?
            A Former User
            last edited by 3 Nov 2022, 04:35

            Hmm I see now, are the buttons in a Radio Group?

            T 1 Reply Last reply 3 Nov 2022, 13:18 Reply Quote 0
            • ?
              A Former User
              last edited by 3 Nov 2022, 04:37

              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.

              L 1 Reply Last reply 3 Nov 2022, 09:32 Reply Quote 0
              • D
                DanH @trillbilly
                last edited by DanH 11 Mar 2022, 08:49 3 Nov 2022, 08:49

                @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

                D 1 Reply Last reply 3 Nov 2022, 08:52 Reply Quote 0
                • D
                  DanH @DanH
                  last edited by 3 Nov 2022, 08:52

                  @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
                  • L
                    Lindon @A Former User
                    last edited by 3 Nov 2022, 09:32

                    @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
                    • T
                      trillbilly @A Former User
                      last edited by 3 Nov 2022, 13:18

                      @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.

                      L 1 Reply Last reply 3 Nov 2022, 13:31 Reply Quote 0
                      • L
                        Lindon @trillbilly
                        last edited by 3 Nov 2022, 13:31

                        @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

                        T 1 Reply Last reply 3 Nov 2022, 13:36 Reply Quote 0
                        • T
                          trillbilly @Lindon
                          last edited by 3 Nov 2022, 13:36

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

                          L 1 Reply Last reply 3 Nov 2022, 13:41 Reply Quote 0
                          • L
                            Lindon @trillbilly
                            last edited by Lindon 11 Mar 2022, 13:46 3 Nov 2022, 13:41

                            @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

                            T 1 Reply Last reply 3 Nov 2022, 13:46 Reply Quote 1
                            • T
                              trillbilly @Lindon
                              last edited by trillbilly 11 Mar 2022, 13:47 3 Nov 2022, 13:46

                              @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

                              L 1 Reply Last reply 3 Nov 2022, 13:47 Reply Quote 0
                              • L
                                Lindon @trillbilly
                                last edited by 3 Nov 2022, 13:47

                                @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
                                7 out of 14
                                • First post
                                  Last post

                                53

                                Online

                                1.9k

                                Users

                                10.8k

                                Topics

                                94.2k

                                Posts