Selecting array with radio buttons.
-
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);
-
Looks like you're going to need a 2D array. Have you researched these yet?
-
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 ?
-
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)
-
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.