HISE Logo Forum
    • Categories
    • Register
    • Login

    Waveform doesn't save in Preset

    Scheduled Pinned Locked Moved General Questions
    waveformgeneratorbuttons
    14 Posts 4 Posters 533 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.
    • trillbillyT
      trillbilly
      last edited by

      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);
      
      DanHD 1 Reply Last reply Reply Quote 0
      • ?
        A Former User
        last edited by

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

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

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

          Link Preview Image
          The video does not exist

          This video might be deleted or expired.

          favicon

          (www.veed.io)

          1 Reply Last reply Reply Quote 0
          • ?
            A Former User
            last edited by

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

            trillbillyT 1 Reply Last reply Reply Quote 0
            • ?
              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

                                44

                                Online

                                1.7k

                                Users

                                11.7k

                                Topics

                                102.0k

                                Posts