CC To Sync



  • I've got a situation where I want to use a CC value (0-127) to control an on screen knob set to TempoSync mode (0-11), and output the tempo sync value in a separate label.

    If you find yourself in this situation you may find this little snippet helpful.

    const var knbCC = Content.addKnob("CC", 0, 0);
    knbCC.setRange(0, 127, 1);
    
    const var lblCCToSync = Content.addLabel("CC to Sync", 150, 10);
    
    const var knbSync = Content.addKnob("Sync",300, 0);
    knbSync.set("mode", "TempoSync");
    
    reg rates = ["1/1", "1/2", "1/2T", "1/4", "1/4T", "1/8", "1/8T", "1/16", "1/16T", "1/32", "1/32T"];
    reg x;function onNoteOn()
    {
    	
    }
    function onNoteOff()
    {
    	
    }
    function onController()
    {
    	
    }
    function onTimer()
    {
    	
    }
    function onControl(number, value)
    {
    	if (number == knbCC)
    	{
    		x = Math.floor((value * 11) / 128);
    		knbSync.setValue(x);
    		lblCCToSync.set("text", rates[x]);
    	}
    }
    
    HiseSnippet 932.3ocsVEtaaaCDlxwZXRsdXsXO.BF6G1CcNVNosAHHXoQsoHnMod0dACnnHflhJlHRjFTTs1snua8QZuAqGEkpjSz5hGvDRBMu69N8kOx6NOVJHzzTgDYcmoqVPQV20dxJtZdvbLiiN4oHKW6ffoBvHAczpE3zTZHxxZqmq8a4zFk+7W+1Q3XLmPqLgPmKXD5KYILUk0wG9BVb7w3P5TVRsn28vSHBdfHVjAbYK6gnEXxU3Komg0g0xF8NF88oHqg16LZf7J+Ye3ICzOGMn74o+AQ76OO2Pfd+37.PjLojxUmCvQV1V+M7XY+rPlRHmnvJJjS6iDgqlLW7dt4UeNKkMKlp23il.bxX9XQbn9ed8mOgqnxHLgVCFJXNKNbbojlhPVsGWIvaYD3ex9TVH6q1qD5eL2gWEh5xsUq0ob60nr+sgxMPOqZzqsgd2ydBQxVnp7n418Kr9OvNiSTKQKa3TLU48Nrz6J9rf.uC7BDfVwUCvggufKl0qaPP2G3MD9o+9cbyiZPJU8ZL+RZOvr+nGC+Q6qiaU1hmEWdOb8b9R7LZrNodJgm1Mjb+GpyyvqmC3ccS7FNY.tyvZzRaRSrdcSDgTHqcmRSVjyftlLKoW5I0mGPFeSW+s80A4u8nhkol0cKVJ1tWwRwV+GUtVXXmQkqS6918Mujk6GkwIJlf6I3mITzWw6028itNtex85dhhZxk9eXoHNlJaxqtVT9Mf0imkLiJe.nhwYz73XQdEV8N3.yYc+NtNeD90YInGmhUyGDEKDxd8xQ48Kd99881FNe2SKeNN0z3y0QzaowdsiZi9qnKUfnjK0uY4a6uuiiqym.lBWrWurv81UVPLG+0BTvOgyTuZAsnVtTlugknn5lpj05VykyFBqzjeC0hnhqjPU4VEgCeRkWS9CEUeShYgTIhA0bsgtxnbc8q8P+7EGhtNxNEHyKRxAdW6pJkxDX5N7u+R+N65nJac+yGhtYaDnYlHLKFqVuCmdpQgC3B1Z8PzcT4oL0p5SU1f1dCarsWiR8sjt2ydLSQl2Lea0.egyt+u4awPjN1OKJhRTUjss8w+4+0IFa.UdsHSw3WBU2R1RXx4YYISfQ1DJvDNmFqmlZ0Rec1renduVYlP4gCKG.W3zWu2pvoeoSTBlHEWPL2G0io99bK.m34eY.G6S0687qe+MAlcdAgnEheEXdyHFswH1YiQr6Fi3gaLhGswHd7FiXuuAB8WT4IYJQhor.g9BvCb+VO
    

Log in to reply

Looks like your connection to CC To Sync was lost, please wait while we try to reconnect.