Csound Csound-dev Csound-tekno Search About

problem with the changed opcode..

Date2015-12-14 21:12
FromRory Walsh
Subjectproblem with the changed opcode..
Attachmentsstrange.mov  
I've come across a strange problem in one of my instruments. It seems that the changed opcode is not working for some reason? It's best seen in the attached video. When I press the reset button its value alternates between 0 and 1. We can see the values being printed to the Csound console in the bottom left hand corner, so we know k1 is changing, but changed never returns 1. I have a lot of other changed opcodes in my code, which I've attached here. They all work fine. You won't be able to run the code without Cabbage, but can anyone spot anything that might be causing the problem?



;============= UPDATES COLOURS OF STEP BUTTONS ========================
opcode colourSteps, k, Sk
SChannel, kReset xin
SIdentChannl sprintfk "%s_ident", SChannel

kOut init 0
if kReset == 0 then
;printf "Activeding a step:%s\n", 1, SIdentChannl
chnset "colour:0(0,0,0), colour:1(0,0,0)", SIdentChannl
else
;printf "DeActiveding a step:%s\n", 1, SIdentChannl
chnset "colour:0(58, 110, 182), colour:1(58, 110, 182)", SIdentChannl
endif

xout kOut
endop

gaSig init 0

;============= MAIN INSTRUMENT, ALWAYS ON========================
instr 1

kStepPos init 1
kTable init 101

if changed:k(chnget:k("step1"))==1 then
kTable=101
kStep1 colourSteps "step1", 0
elseif changed:k(chnget:k("step2"))==1 then
kTable=102
kStep1 colourSteps "step2", 0
elseif changed:k(chnget:k("step3"))==1 then
kTable=103
kStep1 colourSteps "step3", 0
elseif changed:k(chnget:k("step4"))==1 then
kTable=104
kStep1 colourSteps "step4", 0
elseif changed:k(chnget:k("step5"))==1 then
kTable=105
kStep1 colourSteps "step5", 0
elseif changed:k(chnget:k("step6"))==1 then
kTable=106
kStep1 colourSteps "step6", 0
elseif changed:k(chnget:k("step7"))==1 then
kTable=107
kStep1 colourSteps "step7", 0
elseif changed:k(chnget:k("step8"))==1 then
kTable=108
kStep1 colourSteps "step8", 0
elseif changed:k(chnget:k("step9"))==1 then
kTable=109
kStep1 colourSteps "step9", 0
elseif changed:k(chnget:k("step10"))==1 then
kTable=110
kStep1 colourSteps "step10", 0
elseif changed:k(chnget:k("step11"))==1 then
kTable=111
kStep1 colourSteps "step11", 0
elseif changed:k(chnget:k("step12"))==1 then
kTable=112
kStep1 colourSteps "step12", 0
endif


k1 chnget "resetbutton"
printk2 k1

if changed:k(chnget:k("resetbutton"))==1 then
prints "I changed", 0
endif

kStepPos=0

kKeyChange changed chnget:k("key1"), chnget:k("key2"), chnget:k("key3"), chnget:k("key4"), \
chnget:k("key5"), chnget:k("key6"), chnget:k("key7"), chnget:k("key8"), \
chnget:k("key9"), chnget:k("key10"), chnget:k("key11"), chnget:k("key12"), chnget:k("key13")
if changed:k(kKeyChange)==1 then
event "i", "SetColours", 0, .1, kTable
endif

kStepChange changed chnget:k("step1"), chnget:k("step2"), chnget:k("step3"), chnget:k("step4"), \
chnget:k("step5"), chnget:k("step6"), chnget:k("step7"), chnget:k("step8"), \
chnget:k("step9"), chnget:k("step10"), chnget:k("step11"), chnget:k("step12")


if changed(kStepChange)==1 then
event "i", "ChangePattern", 0.1, 1, kTable
;event "i", "PrintTableValues", 0, 1, kTable
endif

endin
Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

Date2015-12-14 21:23
FromVictor Lazzarini
SubjectRe: problem with the changed opcode..
What happens if you change to check for the value of k1 instead of checking the chnget value again?

Victor Lazzarini
Dean of Arts, Celtic Studies, and Philosophy
Maynooth University
Ireland

> On 14 Dec 2015, at 21:12, Rory Walsh  wrote:
> 
> I've come across a strange problem in one of my instruments. It seems that the changed opcode is not working for some reason? It's best seen in the attached video. When I press the reset button its value alternates between 0 and 1. We can see the values being printed to the Csound console in the bottom left hand corner, so we know k1 is changing, but changed never returns 1. I have a lot of other changed opcodes in my code, which I've attached here. They all work fine. You won't be able to run the code without Cabbage, but can anyone spot anything that might be causing the problem?
> 
> 
> 
> ;============= UPDATES COLOURS OF STEP BUTTONS ========================
> opcode colourSteps, k, Sk
> SChannel, kReset xin
> SIdentChannl sprintfk "%s_ident", SChannel
> 
> kOut init 0
> 		if kReset == 0 then
> 			;printf "Activeding a step:%s\n", 1, SIdentChannl
> 			chnset "colour:0(0,0,0), colour:1(0,0,0)", SIdentChannl
> 		else
> 			;printf "DeActiveding a step:%s\n", 1, SIdentChannl
> 			chnset "colour:0(58, 110, 182), colour:1(58, 110, 182)", SIdentChannl
> 		endif
> 
> 	xout kOut
> endop
> 
> gaSig init 0
> 
> ;============= MAIN INSTRUMENT, ALWAYS ON========================
> instr 1
> 
> kStepPos init 1
> kTable init 101
> 
> 	if changed:k(chnget:k("step1"))==1 then
> 		kTable=101
> 		kStep1 colourSteps "step1", 0
> 		
> 	elseif changed:k(chnget:k("step2"))==1 then
> 		kTable=102
> 		kStep1 colourSteps "step2", 0
> 		
> 	elseif changed:k(chnget:k("step3"))==1 then
> 		kTable=103
> 		kStep1 colourSteps "step3", 0
> 		
> 	elseif changed:k(chnget:k("step4"))==1 then
> 		kTable=104
> 		kStep1 colourSteps "step4", 0
> 		
> 	elseif changed:k(chnget:k("step5"))==1 then
> 		kTable=105
> 		kStep1 colourSteps "step5", 0
> 		
> 	elseif changed:k(chnget:k("step6"))==1 then
> 		kTable=106
> 		kStep1 colourSteps "step6", 0
> 		
> 	elseif changed:k(chnget:k("step7"))==1 then
> 		kTable=107
> 		kStep1 colourSteps "step7", 0
> 		
> 	elseif changed:k(chnget:k("step8"))==1 then
> 		kTable=108
> 		kStep1 colourSteps "step8", 0
> 		
> 	elseif changed:k(chnget:k("step9"))==1 then
> 		kTable=109
> 		kStep1 colourSteps "step9", 0
> 		
> 	elseif changed:k(chnget:k("step10"))==1 then
> 		kTable=110
> 		kStep1 colourSteps "step10", 0
> 		
> 	elseif changed:k(chnget:k("step11"))==1 then
> 		kTable=111
> 		kStep1 colourSteps "step11", 0
> 		
> 	elseif changed:k(chnget:k("step12"))==1 then
> 		kTable=112
> 		kStep1 colourSteps "step12", 0
> 	endif
> 
> 
> 	k1 chnget "resetbutton"
> 	printk2 k1
> 
> 	if changed:k(chnget:k("resetbutton"))==1 then
> 		prints "I changed", 0 	
> 	endif
> 
> 	kStepPos=0
> 
> 	kKeyChange changed chnget:k("key1"), chnget:k("key2"), chnget:k("key3"), chnget:k("key4"), \
> 						chnget:k("key5"), chnget:k("key6"), chnget:k("key7"), chnget:k("key8"), \
> 						chnget:k("key9"), chnget:k("key10"), chnget:k("key11"), chnget:k("key12"), chnget:k("key13")
> 	if changed:k(kKeyChange)==1 then
> 		event "i", "SetColours", 0, .1, kTable
> 	endif
> 
> 	kStepChange changed chnget:k("step1"), chnget:k("step2"), chnget:k("step3"), chnget:k("step4"), \
> 						chnget:k("step5"), chnget:k("step6"), chnget:k("step7"), chnget:k("step8"), \
> 						chnget:k("step9"), chnget:k("step10"), chnget:k("step11"), chnget:k("step12")
> 
> 
> 						
> 	if changed(kStepChange)==1 then
> 			event "i", "ChangePattern", 0.1, 1, kTable
> 			;event "i", "PrintTableValues", 0, 1, kTable
> 	endif
> 
> endin
> Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here
> 

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here

Date2015-12-14 21:32
FromRory Walsh
SubjectRe: problem with the changed opcode..
You mean like this:

k1 chnget "resetbutton"
printk2 k1

if changed:k(k1)==1 then
prints "I changed", 0
endif

Same. I already tried that. To be fair, I've tried quite a few things now. I've changed the channel name, I removed objects, rewritten things. I can't figure it out. I have a lot of channels, but I assume there is no limit to the number channels one can have? 

On 14 December 2015 at 21:23, Victor Lazzarini <Victor.Lazzarini@nuim.ie> wrote:
What happens if you change to check for the value of k1 instead of checking the chnget value again?

Victor Lazzarini
Dean of Arts, Celtic Studies, and Philosophy
Maynooth University
Ireland

> On 14 Dec 2015, at 21:12, Rory Walsh <rorywalsh@EAR.IE> wrote:
>
> I've come across a strange problem in one of my instruments. It seems that the changed opcode is not working for some reason? It's best seen in the attached video. When I press the reset button its value alternates between 0 and 1. We can see the values being printed to the Csound console in the bottom left hand corner, so we know k1 is changing, but changed never returns 1. I have a lot of other changed opcodes in my code, which I've attached here. They all work fine. You won't be able to run the code without Cabbage, but can anyone spot anything that might be causing the problem?
>
>
>
> ;============= UPDATES COLOURS OF STEP BUTTONS ========================
> opcode colourSteps, k, Sk
> SChannel, kReset xin
> SIdentChannl sprintfk "%s_ident", SChannel
>
> kOut init 0
>               if kReset == 0 then
>                       ;printf "Activeding a step:%s\n", 1, SIdentChannl
>                       chnset "colour:0(0,0,0), colour:1(0,0,0)", SIdentChannl
>               else
>                       ;printf "DeActiveding a step:%s\n", 1, SIdentChannl
>                       chnset "colour:0(58, 110, 182), colour:1(58, 110, 182)", SIdentChannl
>               endif
>
>       xout kOut
> endop
>
> gaSig init 0
>
> ;============= MAIN INSTRUMENT, ALWAYS ON========================
> instr 1
>
> kStepPos init 1
> kTable init 101
>
>       if changed:k(chnget:k("step1"))==1 then
>               kTable=101
>               kStep1 colourSteps "step1", 0
>
>       elseif changed:k(chnget:k("step2"))==1 then
>               kTable=102
>               kStep1 colourSteps "step2", 0
>
>       elseif changed:k(chnget:k("step3"))==1 then
>               kTable=103
>               kStep1 colourSteps "step3", 0
>
>       elseif changed:k(chnget:k("step4"))==1 then
>               kTable=104
>               kStep1 colourSteps "step4", 0
>
>       elseif changed:k(chnget:k("step5"))==1 then
>               kTable=105
>               kStep1 colourSteps "step5", 0
>
>       elseif changed:k(chnget:k("step6"))==1 then
>               kTable=106
>               kStep1 colourSteps "step6", 0
>
>       elseif changed:k(chnget:k("step7"))==1 then
>               kTable=107
>               kStep1 colourSteps "step7", 0
>
>       elseif changed:k(chnget:k("step8"))==1 then
>               kTable=108
>               kStep1 colourSteps "step8", 0
>
>       elseif changed:k(chnget:k("step9"))==1 then
>               kTable=109
>               kStep1 colourSteps "step9", 0
>
>       elseif changed:k(chnget:k("step10"))==1 then
>               kTable=110
>               kStep1 colourSteps "step10", 0
>
>       elseif changed:k(chnget:k("step11"))==1 then
>               kTable=111
>               kStep1 colourSteps "step11", 0
>
>       elseif changed:k(chnget:k("step12"))==1 then
>               kTable=112
>               kStep1 colourSteps "step12", 0
>       endif
>
>
>       k1 chnget "resetbutton"
>       printk2 k1
>
>       if changed:k(chnget:k("resetbutton"))==1 then
>               prints "I changed", 0
>       endif
>
>       kStepPos=0
>
>       kKeyChange changed chnget:k("key1"), chnget:k("key2"), chnget:k("key3"), chnget:k("key4"), \
>                                               chnget:k("key5"), chnget:k("key6"), chnget:k("key7"), chnget:k("key8"), \
>                                               chnget:k("key9"), chnget:k("key10"), chnget:k("key11"), chnget:k("key12"), chnget:k("key13")
>       if changed:k(kKeyChange)==1 then
>               event "i", "SetColours", 0, .1, kTable
>       endif
>
>       kStepChange changed chnget:k("step1"), chnget:k("step2"), chnget:k("step3"), chnget:k("step4"), \
>                                               chnget:k("step5"), chnget:k("step6"), chnget:k("step7"), chnget:k("step8"), \
>                                               chnget:k("step9"), chnget:k("step10"), chnget:k("step11"), chnget:k("step12")
>
>
>
>       if changed(kStepChange)==1 then
>                       event "i", "ChangePattern", 0.1, 1, kTable
>                       ;event "i", "PrintTableValues", 0, 1, kTable
>       endif
>
> endin
> Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here
> <strange.mov>

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here

Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

Date2015-12-14 21:42
FromSteven Yi
SubjectRe: problem with the changed opcode..
Hi Rory,

I checked and the manual entry for prints says:

"Prints at init-time using a printf() style syntax."

Maybe try printks?

steven

On Mon, Dec 14, 2015 at 4:32 PM, Rory Walsh  wrote:
> You mean like this:
>
> k1 chnget "resetbutton"
> printk2 k1
>
> if changed:k(k1)==1 then
> prints "I changed", 0
> endif
>
> Same. I already tried that. To be fair, I've tried quite a few things now.
> I've changed the channel name, I removed objects, rewritten things. I can't
> figure it out. I have a lot of channels, but I assume there is no limit to
> the number channels one can have?
>
> On 14 December 2015 at 21:23, Victor Lazzarini 
> wrote:
>>
>> What happens if you change to check for the value of k1 instead of
>> checking the chnget value again?
>>
>> Victor Lazzarini
>> Dean of Arts, Celtic Studies, and Philosophy
>> Maynooth University
>> Ireland
>>
>> > On 14 Dec 2015, at 21:12, Rory Walsh  wrote:
>> >
>> > I've come across a strange problem in one of my instruments. It seems
>> > that the changed opcode is not working for some reason? It's best seen in
>> > the attached video. When I press the reset button its value alternates
>> > between 0 and 1. We can see the values being printed to the Csound console
>> > in the bottom left hand corner, so we know k1 is changing, but changed never
>> > returns 1. I have a lot of other changed opcodes in my code, which I've
>> > attached here. They all work fine. You won't be able to run the code without
>> > Cabbage, but can anyone spot anything that might be causing the problem?
>> >
>> >
>> >
>> > ;============= UPDATES COLOURS OF STEP BUTTONS ========================
>> > opcode colourSteps, k, Sk
>> > SChannel, kReset xin
>> > SIdentChannl sprintfk "%s_ident", SChannel
>> >
>> > kOut init 0
>> >               if kReset == 0 then
>> >                       ;printf "Activeding a step:%s\n", 1, SIdentChannl
>> >                       chnset "colour:0(0,0,0), colour:1(0,0,0)",
>> > SIdentChannl
>> >               else
>> >                       ;printf "DeActiveding a step:%s\n", 1,
>> > SIdentChannl
>> >                       chnset "colour:0(58, 110, 182), colour:1(58, 110,
>> > 182)", SIdentChannl
>> >               endif
>> >
>> >       xout kOut
>> > endop
>> >
>> > gaSig init 0
>> >
>> > ;============= MAIN INSTRUMENT, ALWAYS ON========================
>> > instr 1
>> >
>> > kStepPos init 1
>> > kTable init 101
>> >
>> >       if changed:k(chnget:k("step1"))==1 then
>> >               kTable=101
>> >               kStep1 colourSteps "step1", 0
>> >
>> >       elseif changed:k(chnget:k("step2"))==1 then
>> >               kTable=102
>> >               kStep1 colourSteps "step2", 0
>> >
>> >       elseif changed:k(chnget:k("step3"))==1 then
>> >               kTable=103
>> >               kStep1 colourSteps "step3", 0
>> >
>> >       elseif changed:k(chnget:k("step4"))==1 then
>> >               kTable=104
>> >               kStep1 colourSteps "step4", 0
>> >
>> >       elseif changed:k(chnget:k("step5"))==1 then
>> >               kTable=105
>> >               kStep1 colourSteps "step5", 0
>> >
>> >       elseif changed:k(chnget:k("step6"))==1 then
>> >               kTable=106
>> >               kStep1 colourSteps "step6", 0
>> >
>> >       elseif changed:k(chnget:k("step7"))==1 then
>> >               kTable=107
>> >               kStep1 colourSteps "step7", 0
>> >
>> >       elseif changed:k(chnget:k("step8"))==1 then
>> >               kTable=108
>> >               kStep1 colourSteps "step8", 0
>> >
>> >       elseif changed:k(chnget:k("step9"))==1 then
>> >               kTable=109
>> >               kStep1 colourSteps "step9", 0
>> >
>> >       elseif changed:k(chnget:k("step10"))==1 then
>> >               kTable=110
>> >               kStep1 colourSteps "step10", 0
>> >
>> >       elseif changed:k(chnget:k("step11"))==1 then
>> >               kTable=111
>> >               kStep1 colourSteps "step11", 0
>> >
>> >       elseif changed:k(chnget:k("step12"))==1 then
>> >               kTable=112
>> >               kStep1 colourSteps "step12", 0
>> >       endif
>> >
>> >
>> >       k1 chnget "resetbutton"
>> >       printk2 k1
>> >
>> >       if changed:k(chnget:k("resetbutton"))==1 then
>> >               prints "I changed", 0
>> >       endif
>> >
>> >       kStepPos=0
>> >
>> >       kKeyChange changed chnget:k("key1"), chnget:k("key2"),
>> > chnget:k("key3"), chnget:k("key4"), \
>> >                                               chnget:k("key5"),
>> > chnget:k("key6"), chnget:k("key7"), chnget:k("key8"), \
>> >                                               chnget:k("key9"),
>> > chnget:k("key10"), chnget:k("key11"), chnget:k("key12"), chnget:k("key13")
>> >       if changed:k(kKeyChange)==1 then
>> >               event "i", "SetColours", 0, .1, kTable
>> >       endif
>> >
>> >       kStepChange changed chnget:k("step1"), chnget:k("step2"),
>> > chnget:k("step3"), chnget:k("step4"), \
>> >                                               chnget:k("step5"),
>> > chnget:k("step6"), chnget:k("step7"), chnget:k("step8"), \
>> >                                               chnget:k("step9"),
>> > chnget:k("step10"), chnget:k("step11"), chnget:k("step12")
>> >
>> >
>> >
>> >       if changed(kStepChange)==1 then
>> >                       event "i", "ChangePattern", 0.1, 1, kTable
>> >                       ;event "i", "PrintTableValues", 0, 1, kTable
>> >       endif
>> >
>> > endin
>> > Csound mailing list Csound@listserv.heanet.ie
>> > https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to
>> > https://github.com/csound/csound/issues Discussions of bugs and features can
>> > be posted here
>> > 
>>
>> Csound mailing list
>> Csound@listserv.heanet.ie
>> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
>> Send bugs reports to
>>         https://github.com/csound/csound/issues
>> Discussions of bugs and features can be posted here
>
>
> Csound mailing list Csound@listserv.heanet.ie
> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to
> https://github.com/csound/csound/issues Discussions of bugs and features can
> be posted here

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here

Date2015-12-14 21:45
FromVictor Lazzarini
SubjectRe: problem with the changed opcode..
Did you try setting k1 using a different source, say an alternating square wave?

I don't have a computer now to test this,
but I presume if changed did not work,
you would notice it everywhere.

You could also implement changed as a UDO, to see if that is the problem

opcode Changed,k,k
kst init 0
kvar xin
 xout (kvar != kst ? 1 : 0)
kst = kvar
endop

Victor Lazzarini
Dean of Arts, Celtic Studies, and Philosophy
Maynooth University
Ireland

On 14 Dec 2015, at 21:32, Rory Walsh <rorywalsh@EAR.IE> wrote:

You mean like this:

k1 chnget "resetbutton"
printk2 k1

if changed:k(k1)==1 then
prints "I changed", 0
endif

Same. I already tried that. To be fair, I've tried quite a few things now. I've changed the channel name, I removed objects, rewritten things. I can't figure it out. I have a lot of channels, but I assume there is no limit to the number channels one can have? 

On 14 December 2015 at 21:23, Victor Lazzarini <Victor.Lazzarini@nuim.ie> wrote:
What happens if you change to check for the value of k1 instead of checking the chnget value again?

Victor Lazzarini
Dean of Arts, Celtic Studies, and Philosophy
Maynooth University
Ireland

> On 14 Dec 2015, at 21:12, Rory Walsh <rorywalsh@EAR.IE> wrote:
>
> I've come across a strange problem in one of my instruments. It seems that the changed opcode is not working for some reason? It's best seen in the attached video. When I press the reset button its value alternates between 0 and 1. We can see the values being printed to the Csound console in the bottom left hand corner, so we know k1 is changing, but changed never returns 1. I have a lot of other changed opcodes in my code, which I've attached here. They all work fine. You won't be able to run the code without Cabbage, but can anyone spot anything that might be causing the problem?
>
>
>
> ;============= UPDATES COLOURS OF STEP BUTTONS ========================
> opcode colourSteps, k, Sk
> SChannel, kReset xin
> SIdentChannl sprintfk "%s_ident", SChannel
>
> kOut init 0
>               if kReset == 0 then
>                       ;printf "Activeding a step:%s\n", 1, SIdentChannl
>                       chnset "colour:0(0,0,0), colour:1(0,0,0)", SIdentChannl
>               else
>                       ;printf "DeActiveding a step:%s\n", 1, SIdentChannl
>                       chnset "colour:0(58, 110, 182), colour:1(58, 110, 182)", SIdentChannl
>               endif
>
>       xout kOut
> endop
>
> gaSig init 0
>
> ;============= MAIN INSTRUMENT, ALWAYS ON========================
> instr 1
>
> kStepPos init 1
> kTable init 101
>
>       if changed:k(chnget:k("step1"))==1 then
>               kTable=101
>               kStep1 colourSteps "step1", 0
>
>       elseif changed:k(chnget:k("step2"))==1 then
>               kTable=102
>               kStep1 colourSteps "step2", 0
>
>       elseif changed:k(chnget:k("step3"))==1 then
>               kTable=103
>               kStep1 colourSteps "step3", 0
>
>       elseif changed:k(chnget:k("step4"))==1 then
>               kTable=104
>               kStep1 colourSteps "step4", 0
>
>       elseif changed:k(chnget:k("step5"))==1 then
>               kTable=105
>               kStep1 colourSteps "step5", 0
>
>       elseif changed:k(chnget:k("step6"))==1 then
>               kTable=106
>               kStep1 colourSteps "step6", 0
>
>       elseif changed:k(chnget:k("step7"))==1 then
>               kTable=107
>               kStep1 colourSteps "step7", 0
>
>       elseif changed:k(chnget:k("step8"))==1 then
>               kTable=108
>               kStep1 colourSteps "step8", 0
>
>       elseif changed:k(chnget:k("step9"))==1 then
>               kTable=109
>               kStep1 colourSteps "step9", 0
>
>       elseif changed:k(chnget:k("step10"))==1 then
>               kTable=110
>               kStep1 colourSteps "step10", 0
>
>       elseif changed:k(chnget:k("step11"))==1 then
>               kTable=111
>               kStep1 colourSteps "step11", 0
>
>       elseif changed:k(chnget:k("step12"))==1 then
>               kTable=112
>               kStep1 colourSteps "step12", 0
>       endif
>
>
>       k1 chnget "resetbutton"
>       printk2 k1
>
>       if changed:k(chnget:k("resetbutton"))==1 then
>               prints "I changed", 0
>       endif
>
>       kStepPos=0
>
>       kKeyChange changed chnget:k("key1"), chnget:k("key2"), chnget:k("key3"), chnget:k("key4"), \
>                                               chnget:k("key5"), chnget:k("key6"), chnget:k("key7"), chnget:k("key8"), \
>                                               chnget:k("key9"), chnget:k("key10"), chnget:k("key11"), chnget:k("key12"), chnget:k("key13")
>       if changed:k(kKeyChange)==1 then
>               event "i", "SetColours", 0, .1, kTable
>       endif
>
>       kStepChange changed chnget:k("step1"), chnget:k("step2"), chnget:k("step3"), chnget:k("step4"), \
>                                               chnget:k("step5"), chnget:k("step6"), chnget:k("step7"), chnget:k("step8"), \
>                                               chnget:k("step9"), chnget:k("step10"), chnget:k("step11"), chnget:k("step12")
>
>
>
>       if changed(kStepChange)==1 then
>                       event "i", "ChangePattern", 0.1, 1, kTable
>                       ;event "i", "PrintTableValues", 0, 1, kTable
>       endif
>
> endin
> Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here
> <strange.mov>

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here

Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

Date2015-12-14 21:53
FromRory Walsh
SubjectRe: problem with the changed opcode..
Steven you're right! Oh man. I just didn't notice that. Thanks guys. 

On 14 December 2015 at 21:45, Victor Lazzarini <Victor.Lazzarini@nuim.ie> wrote:
Did you try setting k1 using a different source, say an alternating square wave?

I don't have a computer now to test this,
but I presume if changed did not work,
you would notice it everywhere.

You could also implement changed as a UDO, to see if that is the problem

opcode Changed,k,k
kst init 0
kvar xin
 xout (kvar != kst ? 1 : 0)
kst = kvar
endop

Victor Lazzarini
Dean of Arts, Celtic Studies, and Philosophy
Maynooth University
Ireland

On 14 Dec 2015, at 21:32, Rory Walsh <rorywalsh@EAR.IE> wrote:

You mean like this:

k1 chnget "resetbutton"
printk2 k1

if changed:k(k1)==1 then
prints "I changed", 0
endif

Same. I already tried that. To be fair, I've tried quite a few things now. I've changed the channel name, I removed objects, rewritten things. I can't figure it out. I have a lot of channels, but I assume there is no limit to the number channels one can have? 

On 14 December 2015 at 21:23, Victor Lazzarini <Victor.Lazzarini@nuim.ie> wrote:
What happens if you change to check for the value of k1 instead of checking the chnget value again?

Victor Lazzarini
Dean of Arts, Celtic Studies, and Philosophy
Maynooth University
Ireland

> On 14 Dec 2015, at 21:12, Rory Walsh <rorywalsh@EAR.IE> wrote:
>
> I've come across a strange problem in one of my instruments. It seems that the changed opcode is not working for some reason? It's best seen in the attached video. When I press the reset button its value alternates between 0 and 1. We can see the values being printed to the Csound console in the bottom left hand corner, so we know k1 is changing, but changed never returns 1. I have a lot of other changed opcodes in my code, which I've attached here. They all work fine. You won't be able to run the code without Cabbage, but can anyone spot anything that might be causing the problem?
>
>
>
> ;============= UPDATES COLOURS OF STEP BUTTONS ========================
> opcode colourSteps, k, Sk
> SChannel, kReset xin
> SIdentChannl sprintfk "%s_ident", SChannel
>
> kOut init 0
>               if kReset == 0 then
>                       ;printf "Activeding a step:%s\n", 1, SIdentChannl
>                       chnset "colour:0(0,0,0), colour:1(0,0,0)", SIdentChannl
>               else
>                       ;printf "DeActiveding a step:%s\n", 1, SIdentChannl
>                       chnset "colour:0(58, 110, 182), colour:1(58, 110, 182)", SIdentChannl
>               endif
>
>       xout kOut
> endop
>
> gaSig init 0
>
> ;============= MAIN INSTRUMENT, ALWAYS ON========================
> instr 1
>
> kStepPos init 1
> kTable init 101
>
>       if changed:k(chnget:k("step1"))==1 then
>               kTable=101
>               kStep1 colourSteps "step1", 0
>
>       elseif changed:k(chnget:k("step2"))==1 then
>               kTable=102
>               kStep1 colourSteps "step2", 0
>
>       elseif changed:k(chnget:k("step3"))==1 then
>               kTable=103
>               kStep1 colourSteps "step3", 0
>
>       elseif changed:k(chnget:k("step4"))==1 then
>               kTable=104
>               kStep1 colourSteps "step4", 0
>
>       elseif changed:k(chnget:k("step5"))==1 then
>               kTable=105
>               kStep1 colourSteps "step5", 0
>
>       elseif changed:k(chnget:k("step6"))==1 then
>               kTable=106
>               kStep1 colourSteps "step6", 0
>
>       elseif changed:k(chnget:k("step7"))==1 then
>               kTable=107
>               kStep1 colourSteps "step7", 0
>
>       elseif changed:k(chnget:k("step8"))==1 then
>               kTable=108
>               kStep1 colourSteps "step8", 0
>
>       elseif changed:k(chnget:k("step9"))==1 then
>               kTable=109
>               kStep1 colourSteps "step9", 0
>
>       elseif changed:k(chnget:k("step10"))==1 then
>               kTable=110
>               kStep1 colourSteps "step10", 0
>
>       elseif changed:k(chnget:k("step11"))==1 then
>               kTable=111
>               kStep1 colourSteps "step11", 0
>
>       elseif changed:k(chnget:k("step12"))==1 then
>               kTable=112
>               kStep1 colourSteps "step12", 0
>       endif
>
>
>       k1 chnget "resetbutton"
>       printk2 k1
>
>       if changed:k(chnget:k("resetbutton"))==1 then
>               prints "I changed", 0
>       endif
>
>       kStepPos=0
>
>       kKeyChange changed chnget:k("key1"), chnget:k("key2"), chnget:k("key3"), chnget:k("key4"), \
>                                               chnget:k("key5"), chnget:k("key6"), chnget:k("key7"), chnget:k("key8"), \
>                                               chnget:k("key9"), chnget:k("key10"), chnget:k("key11"), chnget:k("key12"), chnget:k("key13")
>       if changed:k(kKeyChange)==1 then
>               event "i", "SetColours", 0, .1, kTable
>       endif
>
>       kStepChange changed chnget:k("step1"), chnget:k("step2"), chnget:k("step3"), chnget:k("step4"), \
>                                               chnget:k("step5"), chnget:k("step6"), chnget:k("step7"), chnget:k("step8"), \
>                                               chnget:k("step9"), chnget:k("step10"), chnget:k("step11"), chnget:k("step12")
>
>
>
>       if changed(kStepChange)==1 then
>                       event "i", "ChangePattern", 0.1, 1, kTable
>                       ;event "i", "PrintTableValues", 0, 1, kTable
>       endif
>
> endin
> Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here
> <strange.mov>

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here

Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here
Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here