Csound Csound-dev Csound-tekno Search About

[Csnd] turnoff2 problem ("not initialised")

Date2009-03-28 14:10
Fromjoachim heintz
Subject[Csnd] turnoff2 problem ("not initialised")
I have a serious problem when I use turnoff2 to turn an instrument  
off, which uses soundin or diskin. The first time turnoff2 turns off  
the other instrument (instr 2), I get the error:

PERF ERROR in instr 2: soundin: not initialised

When I go on (instr 2 has turned on again and is stopped by instr 1  
the second time), Csound crashes (Terminal prints this message  
indefinetely, QuteCsound hangs on).
I give a simple example below. Thanks for any information whether this  
is a bug or the setting of the instruments must be changed for these  
cases.

	joachim



-o dac


instr 1
ktrig1	 metro	 .5
ktrig2	 metro	 1
if ktrig1 == 1 && ktrig2 == 1 then
printks	"ON%n", 0
event	 "i", 2, 0, 10
elseif ktrig1 == 0 && ktrig2 == 1 then
printks	"OFF%n", 0
turnoff2	2, 0, 0
endif
endin
instr 2
asig	 soundin	"fox.wav"
out	 asig
endin


i 1 0 1.5; turns instr 2 off, but with an initialization error
;i 1 0 4; this crashes csound, when turnoff2 stops instr 2 the second  
time
e



Date2009-03-30 08:32
FromOeyvind Brandtsegg
Subject[Csnd] Re: turnoff2 problem ("not initialised")
I did some testing here, and can confirm that it happens on several
recent versions too (5.07, 5.08, 5.09).
If you use anegative p3 for the "on" event, and use the event opcode
with a negative p2 to turn if off, then it will not crash. Perhaps
that can give a clue for someone to find the error in soundin.

Csd pasted below.

Oeyvind
***


-o dac



instr 1
ktrig1   metro   .5
ktrig2   metro   1
if ktrig1 == 1 && ktrig2 == 1 then
printks "ON%n", 0
event    "i", 2, 0, -10
elseif ktrig1 == 0 && ktrig2 == 1 then
printks "OFF%n", 0
;use one of the two next lines
;turnoff2        2, 0, 0 ; error first time (soundin not initialized),
crashes csound second time
event    "i", -2, 0, 10  ; does work, no crash

endif
endin

instr 2
asig     soundin        "sine.wav"
out      asig
endin


;i 1 0 1.5; turns instr 2 off, but with an initialization error
i 1 0 4; this crashes csound, when turnoff2 stops instr 2 the second time
i 1 5 2 ; (an extra event for instr 1, as in Csound 5.08, the first
error will lead to a "note aborted" of instr 1)
e


***

2009/3/28 joachim heintz :
> I have a serious problem when I use turnoff2 to turn an instrument off,
> which uses soundin or diskin. The first time turnoff2 turns off the other
> instrument (instr 2), I get the error:
>
> PERF ERROR in instr 2: soundin: not initialised
>
> When I go on (instr 2 has turned on again and is stopped by instr 1 the
> second time), Csound crashes (Terminal prints this message indefinetely,
> QuteCsound hangs on).
> I give a simple example below. Thanks for any information whether this is a
> bug or the setting of the instruments must be changed for these cases.
>
>        joachim
>
> 
> 
> -o dac
> 
> 
> instr 1
> ktrig1   metro   .5
> ktrig2   metro   1
> if ktrig1 == 1 && ktrig2 == 1 then
> printks "ON%n", 0
> event    "i", 2, 0, 10
> elseif ktrig1 == 0 && ktrig2 == 1 then
> printks "OFF%n", 0
> turnoff2        2, 0, 0
> endif
> endin
> instr 2
> asig     soundin        "fox.wav"
> out      asig
> endin
> 
> 
> i 1 0 1.5; turns instr 2 off, but with an initialization error
> ;i 1 0 4; this crashes csound, when turnoff2 stops instr 2 the second time
> e
> 
> 
>
>
> Send bugs reports to this list.
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe
> csound"
>


Date2009-03-30 19:18
Fromjoachim heintz
Subject[Csnd] Re: Re: turnoff2 problem ("not initialised")
Thanks for testing and for the nice trick. This is indeed a way to  
solve the problem for the moment. The only thing I'd like to add: I  
don't think it's a soundin problem, because it's the same with  
diskin2. It seems to be a turnoff2 problem.

	joachim



Am 30.03.2009 um 09:32 schrieb Oeyvind Brandtsegg:

> I did some testing here, and can confirm that it happens on several
> recent versions too (5.07, 5.08, 5.09).
> If you use anegative p3 for the "on" event, and use the event opcode
> with a negative p2 to turn if off, then it will not crash. Perhaps
> that can give a clue for someone to find the error in soundin.
>
> Csd pasted below.
>
> Oeyvind
> ***
> 
> 
> -o dac
> 
> 
>
> instr 1
> ktrig1   metro   .5
> ktrig2   metro   1
> if ktrig1 == 1 && ktrig2 == 1 then
> printks "ON%n", 0
> event    "i", 2, 0, -10
> elseif ktrig1 == 0 && ktrig2 == 1 then
> printks "OFF%n", 0
> ;use one of the two next lines
> ;turnoff2        2, 0, 0 ; error first time (soundin not initialized),
> crashes csound second time
> event    "i", -2, 0, 10  ; does work, no crash
>
> endif
> endin
>
> instr 2
> asig     soundin        "sine.wav"
> out      asig
> endin
> 
> 
> ;i 1 0 1.5; turns instr 2 off, but with an initialization error
> i 1 0 4; this crashes csound, when turnoff2 stops instr 2 the second  
> time
> i 1 5 2 ; (an extra event for instr 1, as in Csound 5.08, the first
> error will lead to a "note aborted" of instr 1)
> e
> 
> 
> ***
>
> 2009/3/28 joachim heintz :
>> I have a serious problem when I use turnoff2 to turn an instrument  
>> off,
>> which uses soundin or diskin. The first time turnoff2 turns off the  
>> other
>> instrument (instr 2), I get the error:
>>
>> PERF ERROR in instr 2: soundin: not initialised
>>
>> When I go on (instr 2 has turned on again and is stopped by instr 1  
>> the
>> second time), Csound crashes (Terminal prints this message  
>> indefinetely,
>> QuteCsound hangs on).
>> I give a simple example below. Thanks for any information whether  
>> this is a
>> bug or the setting of the instruments must be changed for these  
>> cases.
>>
>>        joachim
>>
>> 
>> 
>> -o dac
>> 
>> 
>> instr 1
>> ktrig1   metro   .5
>> ktrig2   metro   1
>> if ktrig1 == 1 && ktrig2 == 1 then
>> printks "ON%n", 0
>> event    "i", 2, 0, 10
>> elseif ktrig1 == 0 && ktrig2 == 1 then
>> printks "OFF%n", 0
>> turnoff2        2, 0, 0
>> endif
>> endin
>> instr 2
>> asig     soundin        "fox.wav"
>> out      asig
>> endin
>> 
>> 
>> i 1 0 1.5; turns instr 2 off, but with an initialization error
>> ;i 1 0 4; this crashes csound, when turnoff2 stops instr 2 the  
>> second time
>> e
>> 
>> 
>>
>>
>> Send bugs reports to this list.
>> To unsubscribe, send email sympa@lists.bath.ac.uk with body  
>> "unsubscribe
>> csound"
>>
>
>
> Send bugs reports to this list.
> To unsubscribe, send email sympa@lists.bath.ac.uk with body  
> "unsubscribe csound"