Forum
    • Categories
    • Register
    • Login

    Custom Display panel questions...

    Scheduled Pinned Locked Moved Unsolved Scripting
    9 Posts 4 Posters 80 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.
    • J
      JamesC
      last edited by

      Happy holidays all!

      Haven't been able to spend as much time as I would like working on projects and ideas but I was pleased I managed to create a custom preset bar that would display the loaded preset (if you click that text it opens the preset browser, as well as having next and previous buttons) its not the most sophisticated but it works:

      Screenshot 2025-12-18 200257.png

      I know this can be done with a combo box (I've got that set up atm) but in order to keep the UI consistent I'm looking to create essentially the same but that using the buttons will cycle through the various IR files in the folder for the Convolution Reverb.

      Firstly is this possible? Can it be built onto what I've already done with the combo box and then making the combox not visible but behind the scenes? I know I can essentially recycle the look and feel bits and pieces I've done in terms of design its the under the hood bits and pieces that I can't envision in my head.

      As always thanks for your help/responses in advance!

      dannytaurusD J 2 Replies Last reply Reply Quote 0
      • dannytaurusD
        dannytaurus @JamesC
        last edited by

        @JamesC You can adapt the example in the docs:

        https://docs.hise.dev/hise-modules/effects/list/convolution.html#parameters

        Instead of a combo box, use control callbacks on the 2 buttons to call setFile(). You'd put the list of impulse names in an array, then the buttons would load the previous or next impulse.

        Meat Beats: https://meatbeats.com
        Klippr Video: https://klippr.video

        J 1 Reply Last reply Reply Quote 0
        • J JamesC has marked this topic as solved
        • J
          JamesC @JamesC
          last edited by JamesC

          @JamesC Nice its always the simplest thing here's what I ended up doing in case anyone else needs it and for any general feedback:

          const var ConvolutionReverb1 = Synth.getAudioSampleProcessor("Convolution Reverb1");
          const var irs = Engine.loadAudioFilesIntoPool();
          
          const var rvbnextbtn = Content.getComponent("rvbnextbtn");
          const var rvbprevbtn = Content.getComponent("rvbprevbtn");
          
          // Track current IR
          var currentIRIndex = 0;
          
          ConvolutionReverb1.setFile(irs[currentIRIndex]);
          
          inline function onrvbnextbtnControl(component, value)
          {
              if (value)
              {
                  currentIRIndex++;
          
                  if (currentIRIndex >= irs.length)
                      currentIRIndex = 0; 
          
                  ConvolutionReverb1.setFile(irs[currentIRIndex]);
              }
          }
          
          inline function onrvbprevbtnControl(component, value)
          {
              if (value)
              {
                  currentIRIndex--;
          
                  if (currentIRIndex < 0)
                      currentIRIndex = irs.length - 1; 
          
                  ConvolutionReverb1.setFile(irs[currentIRIndex]);
              }
          }
          
          rvbnextbtn.setControlCallback(onrvbnextbtnControl);
          rvbprevbtn.setControlCallback(onrvbprevbtnControl);
          

          Now all becomes about show the curently loaded file name in the panel!

          1 Reply Last reply Reply Quote 0
          • J JamesC has marked this topic as unsolved
          • J
            JamesC @dannytaurus
            last edited by

            @dannytaurus

            Thanks for that buttons now working as I wanted now working on the text appearing, I can't quite work out what I've missed, currently it displays undefined:

            Screenshot 2025-12-19 054159.png

            This is the current code in respect of the text:

            const var rvbfilename = Content.getComponent("rvbfilename");
            
            inline function onrvbfilenameControl(component, value)
            {
            	local currentReverb = ConvolutionReverb1.getCurrentlyLoadedFile();
            	    if (currentReverb == "")
            	    {
            	        rvbfilename.set("text", currentReverb);
            	    }
            	    else
            	    {
            	        rvbfilename.set("text", currentReverb);
            	    }
            	   rvbfilename.repaint();
            };
            
            Content.getComponent("rvbfilename").setControlCallback(onrvbfilenameControl);
            
            rvbfilename.setPaintRoutine(function(g)
            {
                var a = this.getLocalBounds(0);
                var cornerRadius = 4;
                
            
                // Text color
                if (isContainerOpen || isHovered)
                {
                    g.setColour(0xFFFFFFFF);
                }
                else
                {
                    g.setColour(0xFFFFFFFF);
                }
            
                // IR text
                var textArea = [a[0], a[1], a[2], a[3]];
                g.setFont("font", 20);
                if (currentReverb == "")
                {
                    g.drawAlignedText("Default", textArea, "centred");
                }
                else
                {
                    g.drawAlignedText(currentReverb, textArea, "centred");
                }
            });
            
            David HealeyD J 2 Replies Last reply Reply Quote 0
            • David HealeyD
              David Healey @JamesC
              last edited by David Healey

              @JamesC said in Custom Display panel questions...:

              getCurrentlyLoadedFile

              What does this return?

              Also, both clauses of your if statement do the same thing.

              Free HISE Bootcamp Full Course for beginners.
              YouTube Channel - Public HISE tutorials
              My Patreon - HISE tutorials

              J 1 Reply Last reply Reply Quote 0
              • J
                JamesC @JamesC
                last edited by

                This post is deleted!
                1 Reply Last reply Reply Quote 0
                • J
                  JamesC @David Healey
                  last edited by

                  @David-Healey I'm not sure I've tried to get it to print some info to console for me but stuck at this point. Here is the full code if that helps shed any further light:

                  ///Convo Reverb
                  const var ConvolutionReverb1 = Synth.getAudioSampleProcessor("Convolution Reverb1");
                  const var irs = Engine.loadAudioFilesIntoPool();
                  
                  const var rvbnextbtn = Content.getComponent("rvbnextbtn");
                  const var rvbprevbtn = Content.getComponent("rvbprevbtn");
                  
                  // Track current IR
                  var currentIRIndex = 0;
                  
                  ConvolutionReverb1.setFile(irs[currentIRIndex]);
                  
                  inline function onrvbnextbtnControl(component, value)
                  {
                      if (value)
                      {
                          currentIRIndex++;
                  
                          if (currentIRIndex >= irs.length)
                              currentIRIndex = 0; 
                  
                          ConvolutionReverb1.setFile(irs[currentIRIndex]);
                      }
                  }
                  
                  inline function onrvbprevbtnControl(component, value)
                  {
                      if (value)
                      {
                          currentIRIndex--;
                  
                          if (currentIRIndex < 0)
                              currentIRIndex = irs.length - 1; 
                  
                          ConvolutionReverb1.setFile(irs[currentIRIndex]);
                      }
                  }
                  
                  rvbnextbtn.setControlCallback(onrvbnextbtnControl);
                  rvbprevbtn.setControlCallback(onrvbprevbtnControl);
                  
                  const lafrvbnextbtn = Content.createLocalLookAndFeel();
                  rvbnextbtn.setLocalLookAndFeel(lafrvbnextbtn);
                  
                  lafrvbnextbtn.registerFunction("drawToggleButton", function(g, obj)
                  	{
                  		var c = obj.area;
                  		
                  		g.setFont("phosphor", 30);
                  		g.setColour(obj.textColour);
                  		g.drawAlignedText("\ue02e", c, "centred");
                  	});
                  
                  const lafrvbprevbtn = Content.createLocalLookAndFeel();
                  rvbprevbtn.setLocalLookAndFeel(lafrvbprevbtn);
                  	
                  	lafrvbprevbtn.registerFunction("drawToggleButton", function(g, obj)
                  	{
                  		var c = obj.area;
                  		
                  		g.setFont("phosphor", 30);
                  		g.setColour(obj.textColour);
                  		g.drawAlignedText("\ue05a", c, "centred");
                  	});
                  
                  const var rvbfilename = Content.getComponent("rvbfilename");
                  
                  inline function onrvbfilenameControl(component, value)
                  {
                  	local currentReverb = ConvolutionReverb1.getCurrentlyLoadedFile();
                  	    if (currentReverb == "")
                  	    {
                  	        rvbfilename.set("text", currentReverb);
                  	    }
                  	    else
                  	    {
                  	        rvbfilename.set("text", currentReverb);
                  	    }
                  	   rvbfilename.repaint();
                  };
                  
                  Content.getComponent("rvbfilename").setControlCallback(onrvbfilenameControl);
                  
                  rvbfilename.setPaintRoutine(function(g)
                  {
                      var a = this.getLocalBounds(0);
                      var cornerRadius = 4;
                      
                  
                      // Text color
                      if (isContainerOpen || isHovered)
                      {
                          g.setColour(0xFFFFFFFF);
                      }
                      else
                      {
                          g.setColour(0xFFFFFFFF);
                      }
                  
                      // IR text
                      var textArea = [a[0], a[1], a[2], a[3]];
                      g.setFont("font", 20);
                      if (currentReverb == "")
                      {
                          g.drawAlignedText("Default", textArea, "centred");
                      }
                      else
                      {
                  
                          g.drawAlignedText(currentReverb, textArea, "centred");
                      }
                  });
                  
                  
                  David HealeyD LindonL 2 Replies Last reply Reply Quote 0
                  • David HealeyD
                    David Healey @JamesC
                    last edited by

                    @JamesC

                    Combine the prev/next button actions into a single function, no need to repeat the same thing twice.

                    Here's an example of doing it with presets
                    https://youtu.be/rCJ0ljwzXjc

                    if (currentReverb == "")
                    {
                        rvbfilename.set("text", currentReverb); // This is the same
                    }
                    else
                    {
                        rvbfilename.set("text", currentReverb); //  as this
                    }
                    

                    ConvolutionReverb is an audio sample processor.

                    getCurrentlyLoadedFile this function only exists for audio files, not audio sample processors.

                    bd70fb68-e3df-43cf-9d3c-35a1a24c9980-image.png

                    Free HISE Bootcamp Full Course for beginners.
                    YouTube Channel - Public HISE tutorials
                    My Patreon - HISE tutorials

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

                      @JamesC said in Custom Display panel questions...:

                      inline function onrvbfilenameControl(component, value)
                      {
                      local currentReverb = ConvolutionReverb1.getCurrentlyLoadedFile();
                      if (currentReverb == "")
                      {
                      rvbfilename.set("text", currentReverb);
                      }
                      else
                      {
                      rvbfilename.set("text", currentReverb);
                      }
                      rvbfilename.repaint();
                      };

                      Ok well lets look at this:

                      local currentReverb = ConvolutionReverb1.getCurrentlyLoadedFile();
                      

                      is trying to get a file name..... from ConvolutionReverb1....

                      ConvolutionReverb1 is an AudioSampleProcessor, because of this:

                      const var ConvolutionReverb1 = Synth.getAudioSampleProcessor("Convolution Reverb1");
                      

                      but when we look in the documentation at AudioSampeProcessor it has no method called
                      .getCurrentlyLoadedFile();

                      https://docs.hise.dev/scripting/scripting-api/audiosampleprocessor/index.html

                      ..it does however have:

                      https://docs.hise.dev/scripting/scripting-api/audiosampleprocessor/index.html#getfilename

                      HISE Development for hire.
                      www.channelrobot.com

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

                      15

                      Online

                      2.1k

                      Users

                      13.1k

                      Topics

                      113.4k

                      Posts