Heyy
Not sure if this is a result of the pass-by-reference default behaviour in Csound 7, but I get errors when passing a ftgen to the UDO
giLoad ftgen 1, 0, 0, 1, "path/to/file.wav", 0, 0, 1
giload1len = filelen(gSpath1)
opcode FlooperOverlap(amp:k, rate:k, loopstart:k, loopsize:k, crossfade:k, mytab:i, ptr:k, nvoices:i, cnt:i):(a)
puts("FlooperOverlap",1)
print mytab ;will print 1.0
asig = flooper2:a(amp, rate, loopstart, loopsize, crossfade, mytab)
if cnt < nvoices-1 then
asig += FlooperOverlap(amp, rate+random(-0.01, 0.01), loopstart, loopstart+0.1, crossfade, mytab, ptr, nvoices, cnt+1)
endif
xout(asig)
endop
instr FloopTest
idur = p3
ifnlen = p4
ptr:k = line(0, idur, 1) * ifnlen
print giLoad1 ;will print 1.0
res:a = FlooperOverlap(1, 1, 0, 0.25, 0.05, giLoad, ptr, 4, 0)
outs res, res
endin
schedule(FloopTest, 0, 10, giload1len)
I get this error:
instr 1: giLoad1 = 1.000
FlooperOverlap
UDO FlooperOverlap: mytab = 1.000
Invalid ftable no. 0.000000
INIT ERROR in instr 1 (opcode FlooperOverlap) line 37: function table not found
for some reason the mytab
value passed to asig = flooper2:a(amp, rate, loopstart, loopsize, crossfade, mytab)
is getting lost.
It’s not an issue in the Cs6 style udo