Help with my Solo in Place script
-
I'm scripting a solo/mute matrix for a mixer and have gotten 99% of the way there, but can't figure out the last step without making HISE crash.
I'm storing the value of my mute buttons in the variable muteStatus and the solo status is called soloOn. Hitting a solo button enables the mute buttons for all other channels. Once soloOn = 0, I want to transfer the muteStatus values back to the mute buttons.
I've commented out (what I think ) is the right code on line 62, but it's crashing HISE when I compile.
Snippit and code attached.
Any help is appreciatedHiseSnippet 1409.3oc6ZstaaaCElJIZs1YtHcXO.D8GExnYs1RdacHKat4VgQWRMlaR6PPPAiLcLQjHMjnRmgQds1yydD1avFIkjkrirhcbRwBp8OrCIOe57wyERcNHM8X1XeelGPqv652CCz9Z8V8o7ta2EQnfF6.zdjta.GC8YNL3NuArU+dHeebafl1xuVJiVgU.pO+yutExAQswISA.GwH13ei3R3Iy1r9aHNN6gZieGwMkz0p2vlQ2Vnn.AeVVuBnGx9bzY3CPRwVRGn8U61lvYds3HN1GnsxVr18a0k8IZn7GQ7Im5fkCpBZIdPgSuGyosjwxYAa2k3ztY791GHdJMSrBKGZE9V88IsICmOwZrlZAXBhz1CskxidUSSuJSO8zRQuUBo2i0aY6Q5wSVQxsU0aP4XuNHgKHMsBkErzesp91LgDT9ycQmi2ySLXHBCqJUVGZVoR4MJUrTQgivmCu.4Akd+pvMgwPOCy2l41iQECLdhZ0mHwLJBybQXlABqbQXkAhZ4hn1XHjAvSdenVMCDl4hvLCDV4hvJCD0xEQV6iXehJUUhY2Ncv1Q.xxkDOuYdfLm.Hq7.YMAP0xCT3d5pwYmFv4hIDPOFByOha8REg47I2XuaLVq4.qXOeR9XG2LNMVin31aDqhhfuwXslCryt0PZC26CQFibi7uFRkW7+MEp0MG5rYIjHjWuDnBKNILIhPcHTLrS.0lSXTn7pk8EBdXu1hKhLBnAhaBF5.Zh7D2mJN1ecX3JGgbBvCmsbohCB4CoiQpvviqbhj9JgMJC2bSXE3SeZ5.0iqdsRXdsRXcEIJGacFD+GNLajiB0aoByPGjiOdi3EuL9OvhYuNnbufLPF9aGlGzfHDpxFPB7mSyxm6fomw6Jl+YOKhdCR7gI9niImHvm5jMwDo1dQZ9RoObtzHoCzHdOEtoF2rNhdEOfBhOCB+ovX7yOVN0qBHEHzvH+9VhgJO1nr3EuXh7HwdNFgh8Tys0yXhlJIaqVdz7yAWMcMWS33BmbZVjruhy8HB3B4W+JHtbXPxs2VcJiSFI6al26Um7NoTQ0WpsgOjPSSg3ye7kOI4EHdLmsQNNmJpEvXzS1Jugzfj7nbkOpTzI9Q4N0OpgGgxnGv332RMJWbPwBEur33qzoSVKEoDGrWVqJK2wKGXFz.2SkmKegz.FKm3s9GsrB8IWVQ5pdrCu7MkfLZCJg+1dX5jJ1.DcisnriGFQJgnbUQGOJpnisTFW.QTawCT0FVEn3a5x9.SMXy4Ar07.t1MEr5ctlGvlyCXq4AbV64CarChijEZF47EAD8vdbhLVSaG7EhJ3CK6rf9NX+y4rdpninWmPTT90Fe7mIJznd+jAur9mHs4cSlnQ8tXxYcS0rfeoNXFTkYJUU+v6TUYkRU+s8cpppkRUP2zp5mtMUUXb8j7UGdaqpI6qt0U0j8U25pZh9p5SmptZydVSeeV6.GDez9PIa9VzBhKQFogOxl5P8I79oaN2cRyolV59X8lDtc2r46RYvWwwQ207MpUekzCqHKgrqnu2G9LzWuzsc7ACa9JwsmC90wTYU8g00lSmWAfcvNnQrduezPs+ndF8lUa4Q2VKOcuWw0rUxOLPRb38lv1uQWYXuOQXki+9CgWSuI5+CAD+NKfSnmsORTIl3.b8CBbawB7rwBpRoXG4qcqsj7UsBGWQNVRnVXZa0f+U7IZwpxwZQKVMdQvLkuatHeeQ99h78uXx2sVjuuHeeQ99WL460VjuuHeeQ998478OG5vEY6w9ncX+ckolOTMiXeSU+SQUPee4X3v9QKsMtj1jOZaK6jw2IrNYivblQXMyHpMyH99YFwOLyH9wYFwKyAg7+GrWEvYtgw6hIZtqpg5ZZ6RQhHWUnO3+nkyiIC
Content.makeFrontInterface(300, 200); const var mute1 = Content.getComponent("mute1"); const var mute2 = Content.getComponent("mute2"); const var mute3 = Content.getComponent("mute3"); const var mute4 = Content.getComponent("mute4"); const var solo1 = Content.getComponent("solo1"); const var solo2 = Content.getComponent("solo2"); const var solo3 = Content.getComponent("solo3"); const var solo4 = Content.getComponent("solo4"); const var solomute1 = Synth.getEffect("solomute1"); const var solomute2 = Synth.getEffect("solomute2"); const var solomute3 = Synth.getEffect("solomute3"); const var solomute4 = Synth.getEffect("solomute4"); const var mutebuttons = [ Content.getComponent("mute1"), Content.getComponent("mute2"), Content.getComponent("mute3"), Content.getComponent("mute4")] const var solobuttons = [ Content.getComponent("solo1"), Content.getComponent("solo2"), Content.getComponent("solo3"), Content.getComponent("solo4")] const var solomuteFX = [ Synth.getEffect("solomute1"), Synth.getEffect("solomute2"), Synth.getEffect("solomute3"), Synth.getEffect("solomute4")] const var muteStatus = [] inline function SoloMuteUpdate(unusedComponentParameter, unusedValueParameter) { if(solobuttons[0].getValue() == 0 && solobuttons[1].getValue() == 0 && solobuttons[2].getValue() == 0 && solobuttons[3].getValue() == 0) { local soloOn = false; } else { local soloOn = true; } for (i = 0; i < solobuttons.length; i++) { muteStatus[i] = mutebuttons[i].getValue(); } for (i = 0; i < solobuttons.length; i++) { if (soloOn == true && solobuttons[i].getValue()) { mutebuttons[i].setValue(0); } } for (i = 0; i < solobuttons.length; i++) { if (soloOn == false) { // mutebuttons[i].setValue(muteStatus); } } for (i = 0; i < solobuttons.length; i++) { if(solobuttons[i].getValue() == 1) { mutebuttons[i].setValue(0); solomuteFX[i].setAttribute(0,0); } } for (i = 0; i < solobuttons.length; i++) { if(soloOn == true && solobuttons[i].getValue()== 0) { mutebuttons[i].setValue(1); } } } for (s in solobuttons) { s.setControlCallback(SoloMuteUpdate); } for (m in mutebuttons) { m.setControlCallback(SoloMuteUpdate); }
-
Hi, I haven't tried to fix it yet but I've done some clean-up which you might find makes it easier to maintain the code. I renamed all controls and fx so their numbering starts from 0, I replaced all your getComponent/getEffect code with a single loop - btw it's rare that you should need to use
getComponent
with the same component name twice in the same script.HiseSnippet 1329.3oc6ZstaaaCElJIZo1ctncXO.D8GExHYsx1YacvqatwNovnKoFyMocnHnfQh1lHRjFRToyHHuq6QXuAaj5hEkiuV6LrfZ8CaSdNGd9N2nNjvs7XVXeelGPK2aGzGCz9Z81Cn7d06gHTPyF.sGn6FvwPelCC130f8GzG46isAZZa9JIOZ41BD972+59HGD0BmNE.bJiXg+MhKgmNaqZul33bHxF+VhqB26UqoEiVWnn.Ad1T2DzGYcApK9XjjsMzAZe0A1DNyqMGww9.ss1mYOncO1mnQ7eJwmbtCVNnDnsXghl9PlisDwxYA06QbrakX29.wpzJ0KrYjW3a0OhXSFNep23ggDfoRn5Oz1XZvqjJ7Lme3oo.ushf2izaa4Q5ySoHw180aR4XuNHQHPEVQ7B1ftsdclfCJ+otnKvG5IFLTBiJll6BKaZVrZg7ExKBD9b3kHOnL5ed.mKl.9B3GNqpJQYVwTIFl6DSoPdObWHI7WcXdPChfhYUHA9yv8DesyNEKj+pB4ghGEs9AxYB9RPdWLuNysOiJFX7XIaOdGhDyRoTfyzjRx1HRIWnHQBS+kBbPmNXqXtGpm7WGIyjdF0yISEBh7MRytPdB0gPwvNATKNgQgxzfiDLdReaQRiQ.MPD0Fh0VHOQtuHDsKLhxoHm.7vYS8WjNFpFu4YRKHjYihvWHbyvm7jLtmRyjixyjiJ2fihIdmqR9gCyB4DJ0anB2PGjiOtZBwgNSrX1YIJ2KXLRF88noSJn7oNXZWduj7qLZ.pDihh9Yy6TLuXMesLFtTZjzAZjXSQF0nt0L5Ur.4DOWE8UtQvmeBegksRFhbLxOWQHLLhULkpBiO6YSDOo90hUSEHFbIQsk1SZLQ2lD4kJlsV8paV5NU24nLmrQvguOl2Wx4dDg3B928FRb8vDlUmoNm4LYpDWXauzjsjB4ud3l29PBUEBI6E4KWI49tdLm5HGmyEuC2H6tbEqJcHoKkqboTfSxR4N2K0vsSYziYb7anFEyeU9b4uN+nT5zYbjhUhC1abTkso3MEwLnAtmK2i9RoCLgOwaqy1Nf9jaGPsaEqn2YovHi1jR3uoOlNolD.wunSztv8hAkfUdXyBOHtYg8Cct.hnmfsC6oyDDhW010.ysvkVFgKuLBW4yUXYxp4xHbokQ3xKiviylOoYCDGIaPLN3KRH5i83DYtlVC7khNuiZWLmdCr+EbV+vri3VKDMSOy7i+LUgF0FjN3409Dwl2Kchl05gIc6ozj+uTCr.ppjhppcxsppJqnp+x5VUUUTTEzUUU+zpTUQ40SJVcxpVUSNVsxU0jiUqbUMwXUs4SU27PZhiJxrCbP7rmeTdn4XBhWhj4fZxCiQ8I7ApGp9V4PkyKbejdKB2p23w6FiAuhsitswa7QzKnGc.sTvtk9gu+y873i+5BLm00Er8vKMg312A+pDnbe8jlEMmxMl..MvNnLdu2kMU6OpMl6TQayrl0lymYMCSY5oARfCuyj19M5gN16R.NLve2AvOTuE5+CID+NKfSncOBINIlXCb8iCbayB7rvBnRoXGYa2ZaHa0JZrobrDPswT6vA+i3IlXI4XsXhkRHBVn58Rqq2WWuutd+Kl58xqq2WWuutd+Kl58Jqq2WWuutd+tb89+E5vEY4w9nUz86JKMuW3LB6lF9mYHm9QxwvgWorz23RrIezxRdSFemv6LdIJuvRTYgkXuEVhuegk3GVXI9wEVhmOEIj+ONdY.m4FkuKln0AgWntl1ATjHyML0G7u.aEshx
I'm guessing the reason this line
mutebuttons[i].setValue(muteStatus);
causes a crash is becausemuteStatus
is an array and you haven't provided an index.Btw if you're going to release your source code under the GNU GPL I have already created a mic mixer with mute and solo functionality
https://github.com/davidhealey/HISE-Scripting-Framework/blob/master/modules/genericMicMixer.js -
@d-healey
Thanks! I'm gonna check this out.
This is going to be a closed project, so no GNU GPL. -
speaking of cleaning up, is there a better way to express:
solobuttons[0].getValue() == 0 && solobuttons[1].getValue() == 0 && solobuttons[2].getValue() == 0 && solobuttons[3].getValue() == 0
-
@dustbro Yes. What I do is I have a single variable that is set to 1 whenever any solo button is enabled, then all I have to do is check that one variable.
-
I also second David's approach, but even if you're sticking to your method, there's room for improvement.
The laws of logic say
(!A && !B) == !(A || B)
so this expression is shorter (because you don't need the zero comparator)
!(solobuttons[0].getValue() || solobuttons[1].getValue() || solobuttons[2].getValue() || solobuttons[3].getValue())
Programming is fun :)