-odac sr = 44100 ksmps = 64 nchnls = 2 0dbfs = 1 seed 0 #include "/scss/elasticlip_sequencer.udo" ;#include "/scss/mixer/base.udo" #include "/interop.udo" #include "/bussing.udo" #include "/table_tools.udo" opcode ecpweb_getdata, S, iii ichannel, iclipindex, itime xin Sname = gSecp_clipnames[iclipindex] Sresponse = sprintf("{\"-1\":%f,\"-2\":\"%s\",\"-4\":%d", itime, Sname, ichannel) index = 2 while (index < giecp_controlitemnum) do ival = tab_i(index, giecp_fnclips[iclipindex]) Sformat = strcat(",\"%d\":%", (frac(ival) == 0) ? "d" : "f") Sresponse = strcat(Sresponse, sprintf(Sformat, index, ival)) index += 1 od Sresponse = strcat(Sresponse, "}") xout Sresponse endop opcode ecpweb_getdata, S, i iseqindex xin ichannel, iclipindex, itime ecpseq_get iseqindex Sresponse ecpweb_getdata ichannel, iclipindex, itime xout Sresponse endop instr ecpweb_getdata icbid = p4 iseqindex = p5 endin instr ecpweb_tabdestroy ifn = p4 tab_destroy ifn turnoff endin instr ecpweb_setbpm ibpm = p4 gkseq_tempo init ibpm turnoff endin instr ecpweb_loadsound icbid = p4 Spath = strget(p5) ichannel = p6 itime = p7 iforcemono = p8 iclipindex ecp_loadsound Spath, 4, iforcemono ;beats contentious, analyse and also set warp mode iseqindex ecpseq_getnewindex ecpseq_set iseqindex, ichannel, iclipindex, itime Sdata ecpweb_getdata ichannel, iclipindex, itime ifnwave ecp_getwaveform iclipindex Sresponse = sprintf("{\"cbid\":%d,\"data\":%s,\"waveform\":%d}", icbid, Sdata, ifnwave) io_sendstring("callback", Sresponse) turnoff endin instr ecpweb_copyclip icbid = p4 iseqindex = p5 ichannel = p6 itime = p7 i_, iclipindex, i_ ecpseq_get iseqindex iseqindex ecpseq_getnewindex ecpseq_set iseqindex, ichannel, iclipindex, itime Sresponse = sprintf("{\"cbid\":%d}", icbid) io_sendstring("callback", Sresponse) endin instr ecpweb_setdata icbid = p4 iseqindex = p5 idataindex = p6 ;p7 is value ihastwin = p8 Sresponse = sprintf("{\"cbid\":%d", icbid) iapplyupdate = 0 ichannel, iclipindex, itime ecpseq_get iseqindex if (ihastwin == 1 && idataindex != -1) then iclipindex ecp_cloneclip iclipindex Sresponse = strcat(Sresponse, sprintf(",\"clipindex\":%d", iclipindex)) ; needed? endif if (idataindex < 0) then if (idataindex == -2) then ;name Sname = strget(p7) ecp_set_name iclipindex, Sname Sresponse = strcat(Sresponse, sprintf(",\"name\":\"%s\"", Sname)) elseif (idataindex == -1) then ;position itime = p7 iapplyupdate = 1 elseif (idataindex == -4) then ;channel ichannel = p7 iapplyupdate = 1 endif elseif (idataindex >= 2) then ivalue = p7 tabw_i ivalue, idataindex, giecp_fnclips[iclipindex] endif if (iapplyupdate == 1) then ecpseq_set iseqindex, ichannel, iclipindex, itime endif io_sendstring("callback", strcat(Sresponse, "}")) turnoff endin instr boot schedule("mx_boot", 0, 1) aL0, aR0 bus_read "mxchan0" aL1, aR1 bus_read "mxchan1" aL2, aR2 bus_read "mxchan2" aL3, aR3 bus_read "mxchan3" aoutL = aL0 + aL1 + aL2 + aL3 aoutR = aR0 + aR1 + aR2 + aR3 outs aoutL, aoutR endin i"boot" 0 36000 f0 z