<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[How do you avoid creating 16 callback functions for an array of 16 buttons?]]></title><description><![CDATA[<p dir="auto">Let's say I have 16 buttons in an array for an arpeggiator. I want button 0 to turn on/off step 0. I want button 1 to turn on/off step 1. How do you do that without doing:</p>
<pre><code>switch(control)
{
    case(ButtonArray[0]): 
        setStepOnOff[0] = value;
        break;
    case(ButtonArray[1]): 
        setStepOnOff[1] = value;
        break;
    case(ButtonArray[2]): 
        setStepOnOff[2] = value;
        break;

etc...

}
</code></pre>
]]></description><link>https://forum.hise.audio/topic/256/how-do-you-avoid-creating-16-callback-functions-for-an-array-of-16-buttons</link><generator>RSS for Node</generator><lastBuildDate>Wed, 22 Apr 2026 18:09:25 GMT</lastBuildDate><atom:link href="https://forum.hise.audio/topic/256.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 17 May 2017 15:41:08 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to How do you avoid creating 16 callback functions for an array of 16 buttons? on Wed, 17 May 2017 20:18:37 GMT]]></title><description><![CDATA[<p dir="auto">Not every control, you can do a check to see if the control is in the array before looping, which now that I think of it would give you the array index of the control so you wouldn't need a loop after all.</p>
<p dir="auto">I just realised that's what Christoph has suggested.</p>
]]></description><link>https://forum.hise.audio/post/1596</link><guid isPermaLink="true">https://forum.hise.audio/post/1596</guid><dc:creator><![CDATA[David Healey]]></dc:creator><pubDate>Wed, 17 May 2017 20:18:37 GMT</pubDate></item><item><title><![CDATA[Reply to How do you avoid creating 16 callback functions for an array of 16 buttons? on Wed, 17 May 2017 18:08:03 GMT]]></title><description><![CDATA[<pre><code class="language-javascript">local i = ButtonRow.indexOf(control);
setStepOnOff[i] = value;
</code></pre>
]]></description><link>https://forum.hise.audio/post/1588</link><guid isPermaLink="true">https://forum.hise.audio/post/1588</guid><dc:creator><![CDATA[Christoph Hart]]></dc:creator><pubDate>Wed, 17 May 2017 18:08:03 GMT</pubDate></item><item><title><![CDATA[Reply to How do you avoid creating 16 callback functions for an array of 16 buttons? on Wed, 17 May 2017 17:00:53 GMT]]></title><description><![CDATA[<p dir="auto">...that loop would have to happen for every control movement, not good.</p>
]]></description><link>https://forum.hise.audio/post/1583</link><guid isPermaLink="true">https://forum.hise.audio/post/1583</guid><dc:creator><![CDATA[elanhickler]]></dc:creator><pubDate>Wed, 17 May 2017 17:00:53 GMT</pubDate></item><item><title><![CDATA[Reply to How do you avoid creating 16 callback functions for an array of 16 buttons? on Wed, 17 May 2017 16:39:56 GMT]]></title><description><![CDATA[<p dir="auto">I do it with a loop that goes through each index in the array</p>
]]></description><link>https://forum.hise.audio/post/1581</link><guid isPermaLink="true">https://forum.hise.audio/post/1581</guid><dc:creator><![CDATA[David Healey]]></dc:creator><pubDate>Wed, 17 May 2017 16:39:56 GMT</pubDate></item></channel></rss>