sr = 44100
kr = 4410
nchnls = 1
opcode autorec, k, kiii
ksig, itimet, ivalt, isize xin
kcount init 0
if (kcount > isize) kgoto done
ktime timeinsts
kch changed ksig
if (kch == 0 && kcount != 0) kgoto done
tablew ktime, kcount, itimet
tablew ksig, kcount, ivalt
kcount = kcount+1
done:
xout kcount
endop
opcode autoplay, kk, iii
itimet, ivalt, isize xin
kcount init 0
knext init 0
if (kcount > isize) kgoto done
ktime timeinsts
if (knext > ktime) kgoto done
knext table kcount, itimet
ksig table kcount, ivalt
kcount = kcount+1
done:
xout ksig, kcount
endop
instr 1
ksig linseg 0, (1), 0, (0), 1, (1), 1, (0), 0
kidx autorec ksig, p4, p5, p6
ktm timeinsts
printf "kidx: %f ksig: %f time %f\n", kidx, kidx, ksig, ktm
endin
instr 2
ksig, kidx autoplay p4, p5, p6
ktm timeinsts
printf "kidx: %f ksig: %f time %f\n", kidx, kidx, ksig, ktm
endin
f 1 0 16 7 0 16 0
f 2 0 16 7 0 16 0
i 1 0 2 1 2 16
i 2 2 2 1 2 2