HISE Logo Forum
    • Categories
    • Register
    • Login

    Selecting array with radio buttons.

    Scheduled Pinned Locked Moved General Questions
    5 Posts 2 Posters 226 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.
    • lalalandsynthL
      lalalandsynth
      last edited by

      So I am building a Convolution Reverb.
      I want to use a knob to select/switch Impulses, I have this working very nicely now.
      But now I want to be able to switch between impulse arrays using radio buttons.

      So small - medium - large and use the same main selector knob to switch indexes in array.

      This is what I am using to select indexes in one array with the knob.

       // Change Impulse with knob -knobSel
      
      const var ConvolutionReverb1 = Synth.getAudioSampleProcessor("Convolution Reverb1");
      Engine.loadAudioFilesIntoPool(); // Load All IR into memory to be pool
      
      const var irs = [];
      
      irs[0] = "Akg BX15 1 Convert.wav";
      irs[1] = "Akg BX15 1.wav";
      irs[2] = "AKG BX15 2.wav";
      irs[3] = "AKG BX15 3.wav";
      
      
      inline function onknobSelControl(component, value)
      {
      ConvolutionReverb1.setFile("{PROJECT_FOLDER}"+irs[value]);
      };
      Content.getComponent("knobSel").setControlCallback(onknobSelControl);
      
      

      I am using this from @Lindon to set the categories but need some help selecting arrays with the radio buttons.

      Content.makeFrontInterface(600, 500);
      
      var catagory1 = ["Room","C1:name2","C1:name3","C1:name4","C1:name5",];
      var catagory2 = ["Hall","C2:name2","C2:name3","C2:name4","C2:name5",];
      var catagory3 = ["Tunnel","C3:name2","C3:name3","C3:name4","C3:name5",];
      const var Label1 = Content.getComponent("Label1");
      const var Label2 = Content.getComponent("Label2");
      const var Knob1 = Content.getComponent("Knob1");
      
      var selectedCategory = 0;
      
      
      function setTheIR(category)
      {
          // you se the IR here.. I just change some labels..
          switch(category)
          {
             case 1:
                 Label1.set("text","Small");
                 Label2.set("text",catagory1[Knob1.getValue()] );
             case 2:
                 Label1.set("text","Medium");
                 Label2.set("text",catagory2[Knob1.getValue()] );
             case 3:
                 Label1.set("text","Large");
                 Label2.set("text",catagory3[Knob1.getValue()] );
          };
      };
      
      
      inline function onsmallControl(component, value)
      {
      	// 
      	if (value)
          {
              selectedCategory = 1;
              setTheIR(selectedCategory);
          };
      };
      
      Content.getComponent("small").setControlCallback(onsmallControl);
      
      inline function onmediumControl(component, value)
      {
      	//
      	if (value)
          {
              selectedCategory = 2;
              setTheIR(selectedCategory);
          };
      };
      
      Content.getComponent("medium").setControlCallback(onmediumControl);
      
      
      
      inline function onlargeControl(component, value)
      {
      	//
      	if (value)
          {
      	    selectedCategory = 3;
      	    setTheIR(selectedCategory);
          };
      };
      
      Content.getComponent("large").setControlCallback(onlargeControl);
      
      
      
      inline function onKnob1Control(component, value)
      {
      	//
      	setTheIR(selectedCategory);
      };
      
      Content.getComponent("Knob1").setControlCallback(onKnob1Control);
      
      
      
      

      https://lalalandaudio.com/

      https://lalalandsynth.com/

      https://www.facebook.com/lalalandsynth

      https://www.facebook.com/lalalandsynth

      1 Reply Last reply Reply Quote 0
      • Dan KorneffD
        Dan Korneff
        last edited by

        Looks like you're going to need a 2D array. Have you researched these yet?

        Dan Korneff - Producer / Mixer / Audio Nerd

        1 Reply Last reply Reply Quote 1
        • lalalandsynthL
          lalalandsynth
          last edited by lalalandsynth

          Cool, looking at that .

          I guess I could also ... When I switch from say small to medium panel , I could also switch to another Selector knob and have that address the index of Array 2 , If I am making sense ?

          Not entirely sure if that would work though ?

          Unsure if switching would trigger the index of the knob though or If I would have to move it to select and index ?

          https://lalalandaudio.com/

          https://lalalandsynth.com/

          https://www.facebook.com/lalalandsynth

          https://www.facebook.com/lalalandsynth

          1 Reply Last reply Reply Quote 0
          • lalalandsynthL
            lalalandsynth
            last edited by

            It does work like this , have to test if it works putting the knobSel and knobSel1 on separate panels and if switching between them will recall the correct Impulse.

            // Change Impulse with knob -knobSel
            
            const var ConvolutionReverb1 = Synth.getAudioSampleProcessor("Convolution Reverb1");
            Engine.loadAudioFilesIntoPool(); // Load All IR into memory to be pool
            
            const var irs = [];
            
            irs[0] = "Akg BX15 1 Convert.wav";
            irs[1] = "Akg BX15 1.wav";
            irs[2] = "AKG BX15 2.wav";
            irs[3] = "AKG BX15 3.wav";
            
            
            inline function onknobSelControl(component, value)
            {
            ConvolutionReverb1.setFile("{PROJECT_FOLDER}"+irs[value]);
            };
            Content.getComponent("knobSel").setControlCallback(onknobSelControl);
            
            const var irs2 = [];
            
            irs2[0] = "Akg BX15 1 Convert.wav";
            irs2[1] = "Akg BX15 1.wav";
            irs2[2] = "AKG BX15 2.wav";
            irs2[3] = "AKG BX15 3.wav";
            
            
            inline function onknobSel1Control(component, value)
            {
            ConvolutionReverb1.setFile("{PROJECT_FOLDER}"+irs2[value]);
            };
            Content.getComponent("knobSel1").setControlCallback(onknobSel1Control)
            

            https://lalalandaudio.com/

            https://lalalandsynth.com/

            https://www.facebook.com/lalalandsynth

            https://www.facebook.com/lalalandsynth

            1 Reply Last reply Reply Quote 0
            • lalalandsynthL
              lalalandsynth
              last edited by lalalandsynth

              Ok, so ...making 2 x knobSel knobs , each controlling separate arrays , works BUT.
              When I place them on separate panels , set one to select impulse 1 and the other to select impulse 4 it does not switch between them when I switch panels .

              Any thoughts on how to make it switch or am I going about this wrong ?

              looks like I still need the panels/ Radio buttons to select which array I want to work with .
              Not finding much on 2d Arrays on the forum.

              https://lalalandaudio.com/

              https://lalalandsynth.com/

              https://www.facebook.com/lalalandsynth

              https://www.facebook.com/lalalandsynth

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

              55

              Online

              1.7k

              Users

              11.7k

              Topics

              101.8k

              Posts