Switching stereo field.
-
Don't you still need to remove the old connection?
-
@marcLab something is telling me that inv and !value might be equivalent
-
@d-healey did the test, they seem to change when only calling .addConnection
-
@d-healey just can't figure out how to arrive at only 2 lines of code
.addConnection(0,0) // L -> L
.addConnection(1,1) // R -> ROR
.addConnection(0,1) // L -> R
.addConnection(1,0) // R -> LWith juggling with my value (0 or 1) without the if statement.
inline function onstereoFieldControl(component,value) { local index = btnStereo.indexOf(component); // L->L R->R samplerMatrix[index].addConnection(value, value); samplerMatrix[index].addConnection(!value, !value); // L->R R->L if (!value) { samplerMatrix[index].addConnection(value, !value); samplerMatrix[index].addConnection(!value, value); } }
-
@marcLab Index has magically appeared, do you have more than one stereo button? And do you have a snippet?
-
@d-healey yeah index because I have 6 btn for 6 different samplers :p, but this part is working :)
I'm just trying to reduce the number of lines. For being full optimal.
-
I'm just trying to reduce the number of lines. For being full optimal.
Give me a simple snippet with a single sampler and routing matrix etc and I'll see what I can do.
The number of lines doesn't always make much difference to the performance but it can make a different to maintenance, reuse, and debugging.
-
HiseSnippet 1598.3oc6b1saaaCEGWJNpKwqoXsnWraFfZ1tvAoNUNwNc.Ys0INIEAKNwvJsX.EcELRz1DUlTPhJqYE898nrK2dC16wdI5av1gRxVeT2TGk90Vnunv7PdN7O+PmyOkfzNdLKruOySQc9iN0EqndUMySo7AsFfHTk81VQcNMeN1CyT15TWjuO1VQUszCE8pN+rJged8C1B4fnV3DSJJOlQrv6SFR3IV6z7GINN6hrwGQFlZz0atmEi1h4vB.kTRyPwEY8bTe7AHwvlQSQ8J6XS3LOSNhi8UTmcKl8olCX+BMZ7Ol3SN1AKZTSwDBTj4cYN1BEK9tRqADG6NiVw9JJpk6jr9KEs9uoVahMYr8j8guJrC8DORuenNyYIuZokmwDkWsIIO0Txa1H4ccMSKOhKOoGg19Rs8nvgTODbDjVVQiUYleujVKFLBJekgnmi20CZL1iJqaXba8FFFKswBkWnLbP3y0O3Qsel4ls6r+Nc0um95o54XN0L7BAX+IOciQl8QCccvds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COjlX4lM6hcvH+TOl+cM2GdeGjW1G9OW6E0l98hy575q0hjqtHwm9+OpcV5ResyyZq6ZwUN0gY2i+Y947U0By0qKJM+oRpY9wm.UCgZil.OfENcExYDUciZaLphoIlZG13efOwcVSIBoMryZi5TwZTnf0V72CeMF0RXpnzQHRnCTn1I8UZef5PHInDXAHmVURNIImjjSRxoK.4zpRxII4jjbRRNcohbZsKGjSu9ARxooibR7qXOGXzbuGAixBFjZnuUJo2wuZbIwzmLho0jDSRhIIwjjX5REwTcIwjjXRRLIIlJ.wTcIwjjXRRLIIltTQL0PRLIIljDSRhoBPL0PRLIIljDSRhoKUDSqKIljDSRhIIwTAHlVWRLIIljDSRho+CSLUHUpbVpT8MT4PjkG6YVQ+U5Jz5bgV.URC++Zh40ZKZqO9uPYMMiULTFB0pdlkk3AgpvN7j8Y0B3yZEvm5EvmFEvm0KfO2s.978moOBLgMC3rgQIIACc1I5hk5NiuXUR4eA.erEXN
-
@d-healey said in Switching stereo field.:
The number of lines doesn't always make much difference to the performance but it can make a different to maintenance, reuse, and debugging.
Trying to be PROFESSIONAL :P
-
inline function onstereoFieldControl(component, value) { local index = btnStereo.indexOf(component); samplerMatrix[index].addConnection(value, value - 1 * value); samplerMatrix[index].addConnection(!value, !value + 1 * value); }
-
@d-healey damn..let me try this!
-
@d-healey You little jokester
-
@d-healey said in Switching stereo field.:
The number of lines doesn't always make much difference to the performance but it can make a different to maintenance, reuse, and debugging.
In my experience it also doesn‘t make sense going into full-riddle mode and condensing the functionality down to the least amount of characters because you will come back in a few months and think „what lunatic has written this“.
But it‘s a fun excercise...
-
@Christoph-Hart I agree, you have to find a balance and should always aim to make the code readable, even if that means it's more verbose. In this case I'd go with the two line version, but I'm used to reading code like this so my vision might be skewed :)