Forum
    • Categories
    • Register
    • Login

    Empty slot for combobox?

    Scheduled Pinned Locked Moved Solved Scripting
    comboboxirsreverb
    7 Posts 2 Posters 47 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.
    • S
      ScreamingWaves
      last edited by

      Console.print("HELLO WORLD");

      How can i add an empty slot on the combobox menu?

      I've sampled my drumset with the room mics included, then i got IRs from other rooms. What i need to do is: if in the combobox an IR is selected, the room sampler will turn off, and the convolution reverb will turn on, else the opposite

      I'm stuck here, trying to tell HISE if nothing is selected, keep the smpRoom running, but i realized there is no "no selection" slot.

      //////////////////////////////////////// reverb ComboBox
      const irs = Engine.loadAudioFilesIntoPool();
      
      const var ComboBox0 = Content.getComponent("ComboBox0");
      const var convRev = Synth.getAudioSampleProcessor("convRev");
      
      inline function onComboBox0Control(component, value)
      {
      	local smpRoom = Synth.getChildSynth("smpRoom");
      	if (value > 0)
      		convRev.setFile(irs[value - 1]);
      	else 
      		smpRoom.setAttribute(Gain, 0);
      		
      }
      
      Content.getComponent("ComboBox0").setControlCallback(onComboBox0Control);
      
      ComboBox0.set("items", "");
      
      for (x in irs)
      	ComboBox0.addItem(x.replace("{PROJECT_FOLDER}").replace(""));
      	
      

      Any tips?

      Thanx!

      David HealeyD 1 Reply Last reply Reply Quote 0
      • David HealeyD
        David Healey @ScreamingWaves
        last edited by

        @ScreamingWaves

        What about

        ComboBox0.set("items", "");
        
        ComboBox0.addItem("Nothing");
        
        for (x in irs)
        	ComboBox0.addItem(x.replace("{PROJECT_FOLDER}").replace(""));
        

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

        S 1 Reply Last reply Reply Quote 1
        • S
          ScreamingWaves @David Healey
          last edited by ScreamingWaves

          @David-Healey it adds an empty slot, but it basically loads the first file anyway, so the last file of the list won't load.

          I added a blank wav file and use it to call the Room sampler, but it's not working :/ I'm doing your Hise scripting foundation course, but it's still hard to put it in an Audio context.

          inline function onComboBox0Control(component, value)
          {
          	local smpRoom = Synth.getChildSynth("smpRoom");
          	if (value > 0)
          	convRev.setFile(irs[value - 1]) && smpRoom.setAttribute(Gain, -100) && convRev.setAttribute(WetGain, 0);
          	else if (value = 4)
          		convRev.setAttribute(WetGain, -100) && smpRoom.setAttribute(Gain, 0);		
          }
          

          the IRs get loaded, but volumes don't change and i get no error when compiling. what am I doing wrong? (4 is the blank wav file)

          David HealeyD 1 Reply Last reply Reply Quote 1
          • David HealeyD
            David Healey @ScreamingWaves
            last edited by

            @ScreamingWaves said in Empty slot for combobox?:

            it basically loads the first file anyway, so the last file of the list won't load.

            Yes you will need to handle that in your script because all the indexes will now be shifted by 1.

            inline function onComboBox0Control(component, value)
            {
            	local smpRoom = Synth.getChildSynth("smpRoom"); // This should be a const in on init like your reverb.
            
            /*	if (value > 0) // Combo box values start at 1, not 0.
            		convRev.setFile(irs[value - 1]);
            	else 
            		smpRoom.setAttribute(Gain, 0);  // "Gain" is not a valid constant, this is covered later in the course :)
            */
            
                if (value > 1) // 1 is now the empty slot
                {
                    convRev.setFile(irs[value - 2]); // Subtract 2 because we have an empty slot in position 1
                }
                else
                {
                    smpRoom.setAttribute(smpRoom.Gain, 0);
                }	
            }
            

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

            S 1 Reply Last reply Reply Quote 0
            • S
              ScreamingWaves @David Healey
              last edited by

              @David-Healey
              ah I forgot to write smpRoom.Gain thanx :)

              or did you mean that using the Gain of the sampler is not valid? because now it goes to -100, but won't go back to 0

              David HealeyD 1 Reply Last reply Reply Quote 0
              • David HealeyD
                David Healey @ScreamingWaves
                last edited by

                @ScreamingWaves Oh yeah it's a sampler, so you need to convert the value to a gain factor because it uses that unit instead of dB. However I wouldn't set the sampler gain dynamically like this because you might get audio artefacts. Instead use a Simple Gain effect, it has smoothing applied automatically and it uses dB.

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

                S 1 Reply Last reply Reply Quote 1
                • S
                  ScreamingWaves @David Healey
                  last edited by

                  @David-Healey thanx, this helps a lot!! :D

                  1 Reply Last reply Reply Quote 0
                  • S ScreamingWaves has marked this topic as solved
                  • First post
                    Last post

                  17

                  Online

                  2.1k

                  Users

                  13.1k

                  Topics

                  113.3k

                  Posts