js slider/sysex question (negative values)
hey..
i'm trying to make a js sysex editor for my kawai k3. the actual values of some of the parameters go from say -15 to 15. sysex values by definition are unsigned (always positive) so kawai accomplishes negative values by changing one of the hex values in the sysex string to a specific number to indicate a negative value. (i'm sure i could word this better ha)
so specifically this is a typical handling of a sysex string in js:
slider28:0<0,15,1>fine //fine tuning of an oscillator labelled "fine" integers from 0 to 15 with a default of 0:
@init
//FINE
slider28buf = 0;
slider28buf0 = $x40|0; //kawai id number
slider28buf1 = $x00|0; //midi channel
slider28buf2 = $x10|0; //function number
slider28buf3 = $x00|0; //group number
slider28buf4 = $x01|0; //k3 id number
slider28buf5 = $x09|0; //parameter that gets changed (fine tune)
slider28buf6 = $x00|0; //this seems to signify positive values (it would be "08" to indicate the negative values)
@slider
@block
(slider28 != oldslider28) ?
(
slider28value=floor(slider28);
buf=0;
buf[0]=slider28buf0; //send the specified buf value we established before
buf[1]=slider28buf1; //send the specified buf value we established before
buf[2]=slider28buf2; //send the specified buf value we established before
buf[3]=slider28buf3; //send the specified buf value we established before
buf[4]=slider28buf4; //send the specified buf value we established before
buf[5]=slider28buf5; //send the specified buf value we established before
buf[6]=slider28buf6; //send the specified buf value we established before
buf[7]=slider28value;
midisyx(0, buf, 8); //send the value of the slider as midi sysex)
oldslider28 = slider28;
);
on the midi instrument it goes from -15 to 15 so i can do this:
slider28:0<-15,15,1>fine
but somehow i need to make this:
slider28buf6 = $x00|0;
turn into this:
slider28buf6 = $x08|0;
when slider28 is a negative value.
i understand the logic involved but i need someone to spell out the js syntax for me like i'm a 2 year old ha.
thanks.
j
0=0
|