Reads all 15 analog inputs and drops them as midi cc messages (mapped). Inputs have a threshold, to avoid noise. burek GPL
on (connect inlet pval!) off (jump) 1 0 0){ map[i] = imap[i]; } else map[i] = i+1; } waitforpickup=0; /* Good Initial Map: * 6,10,7,8,9,11,13,12,14,15,1,2,3,4,5, 21,25,22,23,24,26,28,27,29,20,16,17,18,19,20, */]]> (1<<17)){ // ignore mini-changes if (timer<(1<<23)) timer += 1<<17;//abs(currval-val[ioff]); // small change give you active time if (lastact!=active){ lastact = active; // outlet_ccchg = 1; } if (waitforpickup==1){ waitforpickup=11; // will stay 11 until we have pick-up currval = inlet_pval; } //LogTextMessage("write to %d",map[active]); PatchMidiInHandler(MIDI_DEVICE_INTERNAL,0,MIDI_CONTROL_CHANGE,map[ioff],__USAT(currval>>20,7));// write to midi cc //outlet_valchg = 1; } } else{ // waitforpickup = 2 and <11 if (waitforpickup<=10) { // waitforpickup>=2 : wait for cc/valchg until inlet_pval is ready waitforpickup--; } else if (abs(currval-inlet_pval)<(1<<19)){ // we got pickup //LogTextMessage("Gleich!!!"); waitforpickup = 0; } } val[ioff] = currval; } else{ if (abs(currval-val[ioff])>(1<<22)){ // to become active, larger chg required //LogTextMessage("Major Change: %1D is active now",map[ioff]); active = ioff; // LogTextMessage("%d is (p)active",ioff); if (attr_pickup&&(active!=lastact)) waitforpickup = 2; else waitforpickup = 0; disp_on = map[ioff]; timer = 1<<23; // for a little while, this is active } } if (timer < 0&&active>=0){//...but as time passes, it become inactive again //LogTextMessage("Left %1D at %3D",map[ioff],currval>>21); active=-1; } disp_active = (active >= 0); outlet_ccsoon = map[active]; outlet_value = val[lastact]; outlet_ccNo = map[lastact]; i++;]]> if there is any midi cc activity, "write" triggers after that activity is over for a little while, or whenever the cc number changes; when triggered by cc change, "val" and "cc" still deliver the value and cc number from *before* the change. This is meant to be used for writing midi cc data to a table without writing every minute change. burek GPL 0) active -= 1<<20; if ((active<=0)&&pending){ outlet_write = 1; pending = 0; } if (outlet_write) { //LogTextMessage("Writing to table: cc %d: %d",cc,val); } outlet_value = val; outlet_cc = cc;]]> write to table Johannes Taelman BSD table.axh 0) && !ntrig) { //LogTextMessage("Writing to table"); ntrig=1; if (inlet_a>attr_table.GAIN; } if (!(inlet_trig>0)) ntrig=0;]]> no 338 34 936 548