Problem with Mic Mixer...
-
Hi,
I've been following and learning loads of the amazing human Dave Healeys Videos.
Ive sort of combined what he did over both of his mic mixer videos and its all working great except the first solo button. which does not work.
When I print to console the local index of the onbtnSoloControl I get the correct numbers for buttons 1 2 3 and 4 but for button 0 i get a -1 or a 0. I think this is the issue but im not sure how to fix it.
Here is my script...
Content.makeFrontInterface(600, 600); // Get sampler const var Sampler1 = Synth.getChildSynth("Sampler1"); const NUM_CHANNELS = 5; //Purge Buttons const var btnPurge = []; for (i = 0; i < NUM_CHANNELS; i++) { btnPurge[i] = Content.getComponent("btnPurge"+i); btnPurge[i].setControlCallback(purgeMicPosition); } inline function purgeMicPosition(component, value) { local idx = btnPurge.indexOf(component); local micName = Sampler1.asSampler().getMicPositionName(idx); Sampler1.asSampler().purgeMicPosition(micName, value); } // Mute Solo Volume Synth.deferCallbacks(true); const soloState = []; //Gather compoonents and fx const gainFX=[]; const knbGain=[]; const btnMute=[]; const btnSolo=[]; for (i = 0; i < NUM_CHANNELS; i++) { gainFX.push(Synth.getEffect("Simple Gain"+i)); knbGain.push(Content.getComponent("knbGain"+i)); knbGain[i].setControlCallback(onknbGainControl); btnMute.push(Content.getComponent("btnMute"+i)); btnMute[i].setControlCallback(onbtnMuteControl); btnSolo.push(Content.getComponent("btnSolo"+i)); btnSolo[i].setControlCallback(onbtnSoloControl); } //kbnGain inline function onknbGainControl(component, value) { local index = knbGain.indexOf(component); if((!btnMute[index].getValue() && !soloState.contains(1)) || btnSolo[index].getValue()) { gainFX[index].setAttribute(gainFX[index].Gain, value); } } //btnMute inline function onbtnMuteControl(component, value) { soloMuteProcess(); } //btnSolo inline function onbtnSoloControl(component, value) { local index = btnSolo.indexOf(component, value); soloState[index] = value; Console.print(index); soloMuteProcess(); } // Functions inline function soloMuteProcess() { for (i=0; i < NUM_CHANNELS; i++) { if (( !soloState.contains(1) || btnSolo[i].getValue()) && (!btnMute[i].getValue() || btnSolo[i].getValue())) { gainFX[i].setAttribute(gainFX[i].Gain, knbGain[i].getValue()); } else { gainFX[i].setAttribute(gainFX[i].Gain, -100); } } }
Here are my button names
Here are the settings for the button not functioning properly.
Really appreciate any and all help :)
Thanks
-
the amazing human Dave Healey
@d-healey that should be your tagline from now on...
-
@crubbish post a snippet demonstrating the problem...
-
So this is the console print from moving up the buttons gradually pressing each twice. As you can see the other 4 buttons work fine but button 0 should return two 0's instead i get -1 and 0.
The buttons using some of the amazing human Dave Healeys clever If statements turn down a gain FX on any channel not soloed.
As you can see below with button 1 pressed all channels are at -100dB with just channel 1 at 0dB
but with button 0 pressed there is nothing turned down.
All of the above is based on my super beginner understanding from watching youtube!
thanks
Jack
-
@crubbish post a snippet demonstrating the problem...
do you know how to do that?
Export Menu> Export as HISE snippet
..then paste it here between the code tags.
-
Ive exported it...
Dumb question and please don't give up on me ... how do i post it ? in the manual it just says in triple fences?
THANKS AGAIN!!
-
so in the editor..
select the code tags, and you will get the image above...
just paste your snippet over the "code_text"
-
hang on.....
-
HiseSnippet 2506.3oc6bssaabiFdjkmznosooEcA5dwBvFrnPFIwQmrSJxlrxmqwF4HX43sEEAoimgxhviFJLCUhc2ZftuA6s4t9Hr6k8N+njGg8MH6O4vQhy3Yj0gnVGux.Nvj+7m+G3G+HmgbRcOpE12m5okI2dmzAqk4izabhKq0ZsLItZautVlqou2d6WTa0S5X56is0xjI6VbYYxMul3m+6ecUSGSWKb+pzz1mRrvOgzlv5Wa8p+Mhiyll138HsUZckpaaQcWi5P6B9QV8BZcLsNx7P7Nl7lMmN3DaXSXTuFLSF1WKy7qRsOoQK5qbCZ+9DexANXdghZMfNJn5MoN1bOlWq1ZsHN10CiWeMsL506G8YCh9OWuFwlzq99YgaJDf5qgZ9HybQcurQbuhptWAE2KAWJihKMefK8o5Mr7HcX8kv8mOTeaWF1qoIj1Uckf1pMG955qQgV3xVrs4Q3M8fB8zH+xEJbGD7OK7PCCz8tGZKLC4a1tiC1y.AiE9LzKM8PMBppH5QHAnXwCwLgOKJk+VgxuEzOnPE24Y0dwZe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W2HlTF.6h6fMY0BtiGgdY0c2cKOZ2Nw0pXUwoAsmmo0QPFQMTepKFfuL0pVyi562DhJQe4qlED2U.a0Z1ECj29QqCfxpfX9t0elOlOkgXEh262ZgUJrmoXZyb5AkKFqboXkKGqbkXkWJV4kiU998KGjPqY1gCP9DwGWM5tnZccXjy+8zbsgaEHn2.lEriRKWkbXOKETyEbbUW6R2WC8ucmU56lOX6bg9Xv9W1.1mgCEpIbQzllvfbXsQYDpQcocZQcIVQA6.38vCwdp9dhAzJLFLWqeMed0cwNXSekYq+4pOg3hM8hNGdjxEEG4Od8DGu9B8.2Ewowtbuh8.OW6rC04Z+NwGG+yxdpmhtgbMNDXQO1kvwvORWPAi3KbdE9THG+Wf+3+tuF+GabD2wkUXJCpQ92hufmLYwt7UVEWyDGXuANQtk98tCqUJVQSarTrTwwTwkFKEuldkBkev3o4tTZ6eygcZCB1kYPvNsAA6xLHXm1ffcYFDrSaPvtLmC101zxi9Bqfu1LN365hZfQDWw+0zjSuFuLp22HmtdgEKvuG1jWXYwYmuKfBRVmRigNkGCcpLF5rzXnyxigN2eLz4ACTG99RWoKi1NX0Znh5aDLIJyF8lDkU6+AfGr5yC
This ok ?
-
@crubbish yep thats how you do it...
here's your problem:
your code:
//btnSolo inline function onbtnSoloControl(component, value) { local index = btnSolo.indexOf(component, value); soloState[index] = value; Console.print(index); soloMuteProcess(); }
the problem line:
local index = btnSolo.indexOf(component, value);
Can you see the problem? Maybe not 'cause its sorta curly edge casey...
the documentation says:
Array.indexOf(var elementToLookFor, int startOffset, int typeStrictness)
--start offset is optional, as is typestrictness, so in the end we need:
Array.indexOf(var elementToLookFor)
-- so it wants one and only one attribute, you gave it two.....and the second is startOffset , and you used the button value(1) at this point.....so it didnt complain... BUT:
you told it to look in the Array from offset position 1(the second element) for the first button, and no surprise it couldnt find it...so Console.print = -1(not found)
Personally I've never used the offset or the strictness parameters....so in nearly every case in your development you want to say:
//btnSolo inline function onbtnSoloControl(component, value) { local index = btnSolo.indexOf(component); soloState[index] = value; Console.print(index); soloMuteProcess(); }
make this change and your code works fine.
-
Thanks a bunch for your help!