-odac sr = 48000 ksmps = 64 nchnls = 2 0dbfs = 1 seed 0 #include "sequencing_melodic_persistence.udo" opcode jsio_sendraw, 0, S Smessage xin prints "CBDT " prints Smessage prints "\n" endop gijsio_collections[][] init 20, 300 opcode jsio_getcollection Scollection, SonComplete xin endop instr jsio_loadcollection Sdata = strget(p4) endin gSjsioBuffer[] init 16 gijsioBufferMax = 0 gijsioBufferLock = 0 instr jsio_bufferadd icbid = p4 Sstatus = strget(p5) Sdetails = strget(p6) if (gijsioBufferLock == 1) then schedule(p1, 0.1, 1, icbid, Sstatus, Sdetails) else gijsioBufferLock = 1 Sitem = sprintf("{\"cbid\":%d", icbid) if (strcmp(Sstatus, "") != 0) then Sitem = strcat(Sitem, sprintf(",\"status\":\"%s\"", Sstatus)) endif if (strcmp(Sdetails, "") != 0) then Sitem = strcat(Sitem, sprintf(",\"details\":\"%s\"", Sdetails)) endif gSjsioBuffer[gijsioBufferMax] = strcat(Sitem, "}") gijsioBufferMax += 1 gijsioBufferLock = 0 endif turnoff endin instr jsio_bufferflush Schannel = strget(p4) if (gijsioBufferLock == 1) then schedule(p1, 0.1, 1, Schannel) else gijsioBufferLock = 1 if (gijsioBufferMax == 0) then chnset "", Schannel gijsioBufferLock = 0 else index = 0 Soutput = "[" while (index < gijsioBufferMax) do if (index > 0) then Soutput = strcat(Soutput, ",") endif Soutput = strcat(Soutput, gSjsioBuffer[index]) index += 1 od Soutput = strcat(Soutput, "]") chnset Soutput, Schannel gijsioBufferMax = 0 gijsioBufferLock = 0 endif endif turnoff endin i "jsio_bufferadd" 0 1