Csound Csound-dev Csound-tekno Search About

[Csnd] pindex bug in reinit loop

Date2008-05-22 08:42
Fromjoachim heintz
Subject[Csnd] pindex bug in reinit loop
Attachmentspindex_reinit_bug.csd  
I noticed a strange behavior of pindex when used
1. in a reinit loop, and
2. if the instrument is called indirectly (by an other instrument or  
an FLTK widget).
In this case, just the first time pindex is working correctly. Then  
(after reinitializing) it just returns zero.
Together with Oeyvind, I tried to work out a hopefully clear example.  
See below and attached.

	joachim



-odac


instr 1
ipfields	pcount
ipfield	init		4
loop:
		timout	0, .1, do
		reinit	loop
do:
ival		pindex	ipfield
		print		ipfield, ival
ipfield	=		(ipfield == ipfields ? 4 : ipfield + 1)
endin

instr 2
event_i	"i", 1, 0, 1, 1, 2, 3
endin



;please try this one by one
;i2 0 1		; doesn't work
;i1 0 1 1 2 3 	; does work
/*
;then try these ones together
i2 0 1		; works, seemingly because i1 is activated (later)
i1 3 1 1 2 3 	; does work
*/
/*
;then try these ones together
i2 0 1		; does work
i1 2 1 1 2 3 	; does NOT work
i2 4 1		; and now it doesn't work, too ...
*/