3 Way Switch
-
Hi guys, I've made a 3 way switch (kind of) in order to switch between voice modes, so poly / mono / glide. I'm using 3 radio buttons to achieve this, and I've overlaid the buttons so it feels like toggling just one button. It all works, but when saving and reloading a preset it all goes to pieces! I assume the preset is loading in the state of each button (rather than just the button saved in the 'on' position) which gives the conflicting result.
Obviously I'm doing it wrong. Perhaps I need to make an array or loop of some sort?
HiseSnippet 1759.3ocuX0saaaCElxIrM1sYsEX6dUeQgCPRljb9cEAy4G6TileLhSS1vvPghMsMWkE8jnSiQQF5c6MX2tWkMf8frGg8FrcHojkjisqsa6zEFl7b9n9NGdDOmCq3wpQ78YdHszm2qCAo8Pb0dt7V62xl5hJe.RaQb0KKe99uP+7hUOGsWuN199j5HMs4NTnhV54Qxm+4a2y1w1sFIZJD5BFsF4HZaJOZ1JEdI0wojccx4z1wzdsBkqwb2m4v5BzYNrApics2X2jbhsPsTXj18JVmxYdU41bhORa98X06UsE6stJ8uf5SuxgHFXhpBKjZ5RLm5BFKlEseKpS8JglsOBVkJQNg4TNguDeLsNs+7QNiGKEnGgHt+PK03nm4LRu4hQu4Uz6I3p07nc3QRDb6A3xtbhWCaXKHNsT5hR8myi2mAZ3xWss8aHk7fA8QjaCCik0W2vXomuXFXavmqessmdEaWhio9N5gHaR36yZ2g4BCxkUIN6PvXMdLVCCS9wiI+.XNp3gGua0yKdlfexfVApDab4xFoz.nO7nxGTbbHUJHQsXFpqC0kn2nqaMNk4pyb2qKmybME70i4jqVHYWFVcmtjkVLy6VLSZkwtpODDDpoR7yCEZlPn4J5QxULXUeBOb6LmoTPjQkPnbu6VIeGtaLfyYWR.K3UtusiyUv2Y4FzjTF9nMcqo2zSXcp8zQ3ZFhoaLNS2bxLcqwa5VSnomeRLcywsqm+S2t9DZ54GuomOloGydOgwIm5laoLuKS5L2lQePQMZLTYAKlCwanhEm66MNf4b619JhWnWMTQ3.vjmvhmrSXqo7KwTj4V1kxOsCwcTm6hBblhSfCXE7Ot772uH37WkqCQgiYSiC95AIob7z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sIQPurofb2uLAIu5boUhF8Tsz97TQs8ZIaXGRVT8AqS7VyPHUaoz810R2HkLVjgjPQtEo7BCURdXDvtMCLP+0zCYVVSYfJBqRpHyJcaF7ghqfAJUcDCHGJxuzZRgYCqtKgM7mcQeMBSvuCVqkte7V3Gv.tzH4+.vHjvGFfRXut0Trwnat7URixxOfTqSPs.u+3kqLFGOVlehIApCKCbi6kytRLUOKS.xNWaK5+12CSeLwEJlcyQRtYu0A.YwF89t9actztr8r4uh4TAcNmpyK8uP5dWxLokuna91qC9BW++ey25o9CIGMetfaWS19ji+6scD+WAU9SSgUpu3DlMS5DjmVjDAO7wE.SzZgJ2oM64ZrprCb1tSlHgNtz3CvWcvPmMtNXXSPPFyyLujW0N5dW4aJ8.bRW9j5.3scvltpOjPBbpe34tWx4tihG.buaL+3Vf4QaAlGuEXdxVfY+s.yS2BL+zmDi6eZ7aEVSRUaB3X1QkyCw3izLPkUpHQ+KflmoI7�
-
@d-healey said in 3 Way Switch:
Thanks David. How can I put my various callbacks into this, or should I just have a knob for each switch?
-
@DanH Put a switch statement in the knob's callback and call a sub-function for each case.
-
Or just make the button from a scriptPanel
-
HiseSnippet 1000.3ocsV0uaaaCDmxIpnVcdXEXO.DEX.xncFx8ygYLzz3jLXrkDg4tf8eEzTz1DllTPj1oFC4coOZ8QnuAcGEkrTb7RS8vz+ce763Od2w6TblhxzZUFxq4aWkxPdei+vURyz9SIbIZvQHuu0+Th1vxvNUGtJkn0rDjm2d+pUgWy8Q4ee50GRDDIkUoBgtPworemOmapzFevuwEhSHIr2xmWy6mev.pR1WITK.9rmeDJkPmQlvNiXcqgOx6dGmvMprgFhgoQd6enJY0vopKkN+ufq4iDLqPWzPHPN0mnDIVFa0h5OkKRhKu2ZDDk3prvdtrv26eJOguVeU136xMfqPTOe3031nW2uL8h1F87pQu8cz6g9CoY7TSkEK2df+.ITnFSfRPcZ47E0HcO+9JvCooybxL1IYfvZDguLJ5I3WDE0tWPP.TGzF7RRFNlHYht3eAWBcByzWMOUIAgvG4L+n18ZEzJvIzQyLwP9x7GpEFtjENdgjZ3JY3j1A+cq.L7oujanSwglobsMhWPDKXgsa6rV3j8iRzLbzOimzYLzy7FgHz0en6LBPrjqDLS6d3QYLxrda.q61fwkIbhLik7ug5oaCkfOYpYESHTWtFWNrqBZFbEjxZET61epZgl0mHDif92pqOaIjxVmBrI2k1qMja2HMTPofl7wXGpNTAmNCH8MRP4P0kPe7icg7GvOqcuMbhNkHmvRfvWv7qxK0sB3RATlvk7DqjtqhshmoDgzxx8SbDFHAPflfYMj96jlA05PmE3LupW8FghXrNYrQrs.9O+Ui3moLrykgPR1VWBvaZZ73sZqfMBV1VMaGSkca.CkKlOhkUleJcDdud8ABO3tMPf5dpUyQkbfjaNOkUHWehV4stzZDZ8kstpp6Xcs4Wss3VkpaNQBULJvNapvcvUS9joVkSlrUYDGn388cUbTdtAl1euFkKG9yAGQLjxv.QDNkTVlgayUdGAOuoL2.ul9GwzyLpzbeKZGg0AewC88qWu7A9AqVK7wjCH1Gyk8kZaP5aeiowmKEqPZxR1.YbFC5ggyrA5lCggUApjEBh456GrKEKL.8HWaPrcXqTyMqpuz7qXoQzcdm1cktOzO1NHd67swV3KTr9+luEqfa4e73wLpohr66exesq6a+Jnhas0jSIlLNz93e1h4Cgk.TFvDIzTAGjumsGtPNxJayLCYxjbgOCeEF6Zk8JL1szHZNglodG083wtj+94Z.NIy+WmlvOcAx30uZ78i5DglC+6w6nTap3GAtucLOcGv7rc.yy2ALuXGv7xc.yq1AL+zshw9aeuYgQM28LATDeb9zKOuikDnKKuiD8OZKCCIA
-
@ustk said in 3 Way Switch:
Thank you :)I tried saving and loading these as presets but the colours wouldn't load (the values printed correctly).
The code looks really helpful though
-
@DanH Probably because I forgot to put
component.repaint();
in the panel callback... -
-
@ustk ok this is working great, but my panel needs to have a border radius of '2'
- I'm trying to shove in some drawRoundedRectangle commands but it's not changing anything. Any ideas?!
-
@DanH Instead of
fillAll
, justsetColour
, and after the switch draw yourRound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