<?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[Using panel as keyboard advise....]]></title><description><![CDATA[<p dir="auto">I have this code on the init callback, it's a panel divided into zones where the different zones trigger NoteOn and NoteOff values, they also trigger some GUI stuff and what I want is to separate the GUI stuff from the mouseCallback events which are the most important and need to be as fast as they could be.<br />
As I understand it, I'm not able to use the audio thread for the mouseCallback so how would you do to separate them and set the NoteOns and Offs to highest priority?</p>
<p dir="auto">Here's an excerpt from the code:</p>
<pre><code>function NoteOn(n,v)
{
    if(n&gt;=0 &amp;&amp; n&lt;playBack.length)
    {
        id = Synth.addNoteOn(1, playBack[n], v, 0);
        Message.makeArtificial();
        cxList[n] = cx;
        idList[n] = id;
        KeyArr[n].set("itemColour2", col2);
        KeyNameArr[n].set("enabled", true);
    }
    
}

function NoteOff(n)
{
    if(n&gt;=0 &amp;&amp; n&lt;playBack.length)
    {
        Synth.noteOffByEventId(idList[n]);
        KeyArr[n].set("itemColour2", col1);
        KeyNameArr[n].set("enabled", false);
        cxList[n] = "";
        idList[n] = "";
    }
    
}
KeybPanel.setMouseCallback(function(event)
{
    x = event.dragX;
    c = event.mouseDownX;
    cx = Math.floor(((c + x) * playBack.length) / KeybPanel.get("width"));
    //p = (c + x) - parseInt(borderList[cx]);
    
	if(event.clicked == 1 &amp;&amp; idList[cx] == "")
    {
        v = 127 - Math.floor((event.mouseDownY + event.dragY) / KeybPanel.get("height")* 126);
        NoteOn(cx,v);
        
        //Synth.setVoicePitchValue(playBack[cx], p);
        //Console.print("c "+c);
        //Console.print("cx "+cx);
    }
    
    if(event.drag == 1)
    {
        //Console.print("p "+p);
        if(cxList[cx] == "" || typeof cxList[cx] === "undefined")
        {
            v = 127 - Math.floor((event.mouseDownY + event.dragY) / KeybPanel.get("height")* 126);
            NoteOn(cx,v);
        
            if((c+x) &gt; borderList[cx])
            {
                NoteOff(cx+1);
            }
            else if((c+x) &lt; borderList[cx])
            {
                NoteOff(cx-1);
            }
        }
        //Synth.addPitchFade(idList[cx], 100, 0, p*0.2);
    }
    if(event.mouseUp)
    {
        var evX = Math.floor((event.x * playBack.length) / KeybPanel.get("width"));
        NoteOff(evX);
        //Console.print("evX "+evX);
    }
</code></pre>
]]></description><link>https://forum.hise.audio/topic/1357/using-panel-as-keyboard-advise</link><generator>RSS for Node</generator><lastBuildDate>Fri, 14 Aug 2026 09:37:59 GMT</lastBuildDate><atom:link href="https://forum.hise.audio/topic/1357.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 31 Mar 2019 22:11:08 GMT</pubDate><ttl>60</ttl></channel></rss>