Csound Csound-dev Csound-tekno Search About

[Csnd] problems with chnget for widgets

Date2013-12-17 22:00
Fromjoachim heintz
Subject[Csnd] problems with chnget for widgets
hi all -

as the chnget opcode is much more cpu-friendly in csoundqt than the 
invalue opcode, i try to change some examples in this way. but in 
replacing invalue by chnget has one major issue which i don't know how 
to solve.

say you have a checkbox, and it is checked, so has the value 1. this 
line of code will return 1 a value of kCheck when running:
kCheck invalue "my_checkbox"

but this line will return 0 for kCheck in the same situation:
kCheck chnget "my_checkbox"

is this as it should be? any ways to retrieve the correct widget value 
at start?

thanks -

	joachim

Date2013-12-18 10:10
FromTarmo Johannes
SubjectRe: [Csnd] problems with chnget for widgets
Hi,

I don't get the same result. With a small test orchestra:

chn_k "check", 1

schedule 1,0,1
instr 1
	;kval invalue "check"
	kval chnget "check"
	printk2 kval

endin

the output is correctly
SECTION 1:
 i1     1.00000

when the checkbox is checked.

Didn't you forget the chn_k declaration?
There is a script in Scripts->Editor->invalue_chnget.py that will insert the 
declarations for you, if you have a lot of channels.

Best!
tarmo




On Tuesday 17 December 2013 23:00:45 joachim heintz wrote:
> hi all -
> 
> as the chnget opcode is much more cpu-friendly in csoundqt than the
> invalue opcode, i try to change some examples in this way. but in
> replacing invalue by chnget has one major issue which i don't know how
> to solve.
> 
> say you have a checkbox, and it is checked, so has the value 1. this
> line of code will return 1 a value of kCheck when running:
> kCheck invalue "my_checkbox"
> 
> but this line will return 0 for kCheck in the same situation:
> kCheck chnget "my_checkbox"
> 
> is this as it should be? any ways to retrieve the correct widget value
> at start?
> 
> thanks -
> 
> 	joachim
> 
> 
> Send bugs reports to the Sourceforge bug trackers
> csound6:
>             https://sourceforge.net/p/csound/tickets/
> csound5:
>             https://sourceforge.net/p/csound/bugs/
> Discussions of bugs and features can be posted here
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe
> csound"

Date2013-12-18 10:24
FromTarmo Johannes
SubjectRe: [Csnd] problems with chnget for widgets
> There is a script in Scripts->Editor->invalue_chnget.py that will insert the

I meant the script  add_chn_k.py

tarmo


On Wednesday 18 December 2013 12:10:23 Tarmo Johannes wrote:
> Hi,
> 
> I don't get the same result. With a small test orchestra:
> 
> chn_k "check", 1
> 
> schedule 1,0,1
> instr 1
> 	;kval invalue "check"
> 	kval chnget "check"
> 	printk2 kval
> 
> endin
> 
> the output is correctly
> SECTION 1:
>  i1     1.00000
> 
> when the checkbox is checked.
> 
> Didn't you forget the chn_k declaration?

> declarations for you, if you have a lot of channels.
> 
> Best!
> tarmo
> 
> On Tuesday 17 December 2013 23:00:45 joachim heintz wrote:
> > hi all -
> > 
> > as the chnget opcode is much more cpu-friendly in csoundqt than the
> > invalue opcode, i try to change some examples in this way. but in
> > replacing invalue by chnget has one major issue which i don't know how
> > to solve.
> > 
> > say you have a checkbox, and it is checked, so has the value 1. this
> > line of code will return 1 a value of kCheck when running:
> > kCheck invalue "my_checkbox"
> > 
> > but this line will return 0 for kCheck in the same situation:
> > kCheck chnget "my_checkbox"
> > 
> > is this as it should be? any ways to retrieve the correct widget value
> > at start?
> > 
> > thanks -
> > 
> > 	joachim
> > 
> > Send bugs reports to the Sourceforge bug trackers
> > 
> > csound6:
> >             https://sourceforge.net/p/csound/tickets/
> > 
> > csound5:
> >             https://sourceforge.net/p/csound/bugs/
> > 
> > Discussions of bugs and features can be posted here
> > To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe
> > csound"

Date2013-12-20 14:26
Fromjoachim heintz
SubjectRe: [Csnd] problems with chnget for widgets
thanks very much, tarmo. this did the trick. i did not know that it was 
necessary to declare the channel in advance.

btw, the script add_chn_k.py did not only add the chn_k lines, but also 
creates sliders without asking. i suppose these lines are to be removed:

for (i, chn) in enumerate(channels):
     q.createNewSlider(i*30, 40, chn)

best -

	joachim


Am 18.12.2013 11:10, schrieb Tarmo Johannes:
> Hi,
>
> I don't get the same result. With a small test orchestra:
>
> chn_k "check", 1
>
> schedule 1,0,1
> instr 1
> 	;kval invalue "check"
> 	kval chnget "check"
> 	printk2 kval
>
> endin
>
> the output is correctly
> SECTION 1:
>   i1     1.00000
>
> when the checkbox is checked.
>
> Didn't you forget the chn_k declaration?
> There is a script in Scripts->Editor->invalue_chnget.py that will insert the
> declarations for you, if you have a lot of channels.
>
> Best!
> tarmo
>
>
>
>
> On Tuesday 17 December 2013 23:00:45 joachim heintz wrote:
>> hi all -
>>
>> as the chnget opcode is much more cpu-friendly in csoundqt than the
>> invalue opcode, i try to change some examples in this way. but in
>> replacing invalue by chnget has one major issue which i don't know how
>> to solve.
>>
>> say you have a checkbox, and it is checked, so has the value 1. this
>> line of code will return 1 a value of kCheck when running:
>> kCheck invalue "my_checkbox"
>>
>> but this line will return 0 for kCheck in the same situation:
>> kCheck chnget "my_checkbox"
>>
>> is this as it should be? any ways to retrieve the correct widget value
>> at start?
>>
>> thanks -
>>
>> 	joachim
>>
>>
>> Send bugs reports to the Sourceforge bug trackers
>> csound6:
>>              https://sourceforge.net/p/csound/tickets/
>> csound5:
>>              https://sourceforge.net/p/csound/bugs/
>> Discussions of bugs and features can be posted here
>> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe
>> csound"
>
>
> Send bugs reports to the Sourceforge bug trackers
> csound6:
>              https://sourceforge.net/p/csound/tickets/
> csound5:
>              https://sourceforge.net/p/csound/bugs/
> Discussions of bugs and features can be posted here
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"
>
>
>