Simple Filter Selection ComboBox
-
@dabdab Here is an example of SVF HP & SVF LP filter selections from the Hise Filter Module (non-scriptnode version). I used if/else conditions for this, but alternatively you can use switch/case too.
HiseSnippet 979.3oc0WssaaTDFdVmLH1EbUKBUQk5EixUNRgHaZoEIT.W6XCVjj5TGp5EHUMd1wwixryrr6rs0spOBbGOP7nvi.uAv+rG7tor0wXoJQVKY6+i9a9ONdbjlwii0QHG2yVDxQNeJdxBkYd+4TgBM5PjyMvGSiM7HRFqdKBowwbejiyV+fkgi61nzm+566QkTEiWxBgdpVv3GIBDlRti69SBobH0melHnh12u6HlV0WK0I.d1B2FERYWPOmeB0pVCLx4iF3KL5nIFpgGib1tm1ewj45Wpxz+ohXwTI2RzAMAbTF6gZouEwVtn9yER+wEm6XD3kwkQgsxhBeN9XguXI+xnwMSEPJsnZ7vowpfWmpvq85COmJva6L3cK7DVjHzTJwhsOAORAIpYTHETEVY5hZ76Mv80fFJy9AzK3Ci.hkVz5dsauGAda2usom8EjJhMjWPiHCERPoNjCHokF6eN2LX1LNyzZmbQ6jYToI80AS08zuJS9DtDzVGAdn..fO.cB0Jfn0N0q9NEPQnjBEmLKQwLBshXKRpy.qyizxVrBOuG.FYBe2lduoomqXFoUJM4fCHc.ltD3I+HreL27HiIRLMwvaUv7XsOeOxCs.IUY3CtLl6l800z7GT07lduM8T8eKPXce9oqOUJmB8EsthnPQvK6UkX2IZC+wpV658FOWu25QdWQylUqrb2J4Q0J11JGsJCaoRBlxiJRIEJB0zWtoA+9aZp1SyxheUTTqFoDlGGxUuuVITdP21TkiJPUSZK0MyaoJhoHAz67E35CwnzyP0QenedzgTCsvyvOB7CGxiLB6Yx4P9Kf4fYMut3C4wWXzgo5lm5gQaaBNdUIFlzcwRh+3W5FPAYXmF.kvvC.Pba7ONlLbzQmM3IdGs7av33+03EXHm1OQRMWdxmcbet.HydoQL1wHpXgYQ0XxGjwgqKbuEdrvvlWOdaTCdgT2GZ7luboINa7YIX2FO7Ya5lj5Wz09p1jjut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aKeexDkOiHgjIZUZoOO6fhAsTgXH7zJoqJbFzK6xkBtjQFEK8zbkjXd7ddSngjBUhpdYLTMfTgyL4.M8blY8tkVGxGFqYUyFD1WX0Zb2BqvedVkLDuYsbD6Lc0U+UCCa269uswXl3TTlsVq9FVM4OIk8s.OruRydrr5ptuvsj64tjW00nQy0WZoErv451HnFdUIVUFOYHKLidyBDTVtnzE9xktJpr5Y4vBApj8jb8iCXxKSPCkR7FosTTAgpSD1tcpvVFuh3fB1mhmOMiRVCEa.g9wdaS0zrJCSBLwArPM2rlb1l8LnajUBsDdaVzoZUPRroa+PClEAGmkigAslNy3O9kVIOXhbN.6taf6iBbsRXtVwK2YZQtyjpbuf9jalxjapXjapJDZBElTriaR+zWq+.zkR4GKn5K15xzuN0Abn3B8HL8AjQb8zhz4ak9YWW3dGbet1a77w6RyAuvt9aa7ld6fxXa2ubvtBt6O8N9p.o2W6iv8UhoAiURtm8XYBfJgS0FuhKrgPcCYOMlI8xXw+94e6u25fhGALJq41UZcPLUjy5j+5k+4Vs4AJAM7Zsir70SV4MbIsq5XymfmsnH2fNqa1Yt4f2OCmtoSLj8MGbeK7A+O.rGph0FYbJbMFiJ99wSF.uxiGC.pTxDl1uNKYZTZsaXrSZtvj9IF+C7I0YSisSpylYNg9Cdgpm3YauZd948SFAvjL4koJAuUGXSZl0DEiarVCzD3kadhmmQP6K.rO+b9xEHm6s.4r9BjyFKPN2eAxYyEHmu5Jyw7dkaEqUSrmMgA5uSxkYbb1QRgSYIGSQ+Kj6lRcA
-
@dabdab This is the solution I use on my projects. I have found it here in forum sometime ago.
HiseSnippet 1031.3oc0W0saaaCElxIrX1aoncXn.6NBicgLfWp7Va2OECMwNwaFqI0YNsX.CCEzRzwDlhTShpKFA4IYOG6sY69c4dC1NThRxI0vwy.aXQW4yu7iGdNejdXrxmkjnhQN0OcdDC47d3Qyk5o8lR4RzfCPN2EeDMQyhI4p5NOhljvBPNNa80FEN02Fk88mOqKUPk9rJUHzqTbe1y4gbck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w7IaPLe5FDyi1fXd7FDyS1fX9rMHlOekwX9GJ6mpUg48lfhgGl83CGmCkTnKKqME82LJ6MaG
-
-
@orange I have tried with Switch Case..
Content.makeFrontInterface(500, 400); const var Filter1 = Synth.getEffect("Filter1"); const var ComboBox1 = Content.getComponent("ComboBox1"); inline function onComboBox1Control(component, value) { switch(value) { case 1: Filter1.setAttribute(Filter1.Mode, 6); case 2: Filter1.setAttribute(Filter1.Mode, 7); case 3: Filter1.setAttribute(Filter1.Mode, 8); case 4: Filter1.setAttribute(Filter1.Mode, 15); } }; Content.getComponent("ComboBox1").setControlCallback(onComboBox1Control);
-
@DabDab Your snippet doesn't work here.
-
@d-healey Is it a bug?
-
@dabdab The other snippets in this thread are working, it was just the one you posted that didn't
-
@d-healey May be I changed some HISE Source code.. that's why..
I will post my snippets from another (untouched version) HISE in future. -
@dabdab said in Simple Filter Selection ComboBox:
@orange I have tried with Switch Case..
Content.makeFrontInterface(500, 400); const var Filter1 = Synth.getEffect("Filter1"); const var ComboBox1 = Content.getComponent("ComboBox1"); inline function onComboBox1Control(component, value) { switch(value) { case 1: Filter1.setAttribute(Filter1.Mode, 6); case 2: Filter1.setAttribute(Filter1.Mode, 7); case 3: Filter1.setAttribute(Filter1.Mode, 8); case 4: Filter1.setAttribute(Filter1.Mode, 15); } }; Content.getComponent("ComboBox1").setControlCallback(onComboBox1Control);
read the documentation about switch statement... specifically the
break;
statement
-
@lindon Yes.. You are right.
break
is the best practice. But HISE was not throwing any error withoutbreak
so I skipped it. -
@dabdab You won't get an error, because sometimes you don't need
break
but when you do need it and don't use it things won't work how you expect. So unless you are leaving it out because you wantcases
to fall through it is better to always usebreak
(or sometimesreturn
).Here's an example where breaks are placed in such a way to create groups of conditions
const myValue = 1; switch(myValue) { case 0: case 1: Console.print("My value is 0 or 1"); break; case 20: case 30: Console.print("My value is 20 or 30"); break; }
Here's an example where no breaks are used so you can tell which range a values falls within.
const myValue = 21; switch (true) { case (myValue > 10): Console.print("My value is > 10"); case (myValue > 20): Console.print("My value is > 20"); case (myValue > 30): Console.print("My value is > 30"); }