[Qutecsound-users] how to get initial widget value via chnget?

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

[Qutecsound-users] how to get initial widget value via chnget?

joachim-3
hi all -

traditionally (still from MacCsound times ...) i used invalue to get the
widget values.  but for a bigger number of widgets chnget is much better
in performance (i just got a jump from 3/4 cpu to 1/4 cpu just by
replacing invalue by chnget!).

however, there is one behaviour in chnget which puzzled me all the time,
and still i am not able to solve it.

say i have a spin box with value 5 when i start my program: how can i
get this value into my csound code?  when i do
        kVal chnget "my_channel"
it reports 0.  when i do
        iVal chnget "my_channel"
        kVal chnget "my_channel"
        kVal init iVal
it still reports 0 (also for iVal which surprises me).

invalue works in this case:
        kVal invalue "my_channel"
reports 5.

any ideas?

thanks -
        joachim

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Qutecsound-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qutecsound-users
Reply | Threaded
Open this post in threaded view
|

Re: [Qutecsound-users] how to get initial widget value via chnget?

Nikhil Singh
Using global chnsets for the same channels allows effectively setting default values (that should also reflect in the widgets as appropriate). For example:

chnset 500, "freq"

chnset 0.5, "amp"


instr 1


kfreq chnget "freq"

kamp chnget "amp"


asig oscil kamp, kfreq

outs asig, asig


endin


I'm not sure if this is the most efficient way though!


On Wed, Jul 12, 2017 at 2:58 AM, joachim heintz <[hidden email]> wrote:
hi all -

traditionally (still from MacCsound times ...) i used invalue to get the widget values.  but for a bigger number of widgets chnget is much better in performance (i just got a jump from 3/4 cpu to 1/4 cpu just by replacing invalue by chnget!).

however, there is one behaviour in chnget which puzzled me all the time, and still i am not able to solve it.

say i have a spin box with value 5 when i start my program: how can i get this value into my csound code?  when i do
        kVal chnget "my_channel"
it reports 0.  when i do
        iVal chnget "my_channel"
        kVal chnget "my_channel"
        kVal init iVal
it still reports 0 (also for iVal which surprises me).

invalue works in this case:
        kVal invalue "my_channel"
reports 5.

any ideas?

thanks -       
        joachim

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Qutecsound-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qutecsound-users


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Qutecsound-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qutecsound-users
Reply | Threaded
Open this post in threaded view
|

Re: [Qutecsound-users] how to get initial widget value via chnget?

joachim-3
thanks. yes, this is a way to set initial values, but not to get the
value which you set in the widget itself.

for instance: when i had a performance, i would like to start the next
performance from the values i ended with.  this is the case when useing
invalue, but i cannot see how to do it with chnget.


On 12/07/17 09:57, Nikhil Singh wrote:

> Using global chnsets for the same channels allows effectively setting
> default values (that should also reflect in the widgets as appropriate).
> For example:
>
> chnset 500, "freq"
>
> chnset 0.5, "amp"
>
>
> instr 1
>
>
> kfreq chnget "freq"
>
> kamp chnget "amp"
>
>
> asig oscil kamp, kfreq
>
> outs asig, asig
>
>
> endin
>
>
> I'm not sure if this is the most efficient way though!
>
>
> On Wed, Jul 12, 2017 at 2:58 AM, joachim heintz <[hidden email]
> <mailto:[hidden email]>> wrote:
>
>     hi all -
>
>     traditionally (still from MacCsound times ...) i used invalue to get
>     the widget values.  but for a bigger number of widgets chnget is
>     much better in performance (i just got a jump from 3/4 cpu to 1/4
>     cpu just by replacing invalue by chnget!).
>
>     however, there is one behaviour in chnget which puzzled me all the
>     time, and still i am not able to solve it.
>
>     say i have a spin box with value 5 when i start my program: how can
>     i get this value into my csound code?  when i do
>             kVal chnget "my_channel"
>     it reports 0.  when i do
>             iVal chnget "my_channel"
>             kVal chnget "my_channel"
>             kVal init iVal
>     it still reports 0 (also for iVal which surprises me).
>
>     invalue works in this case:
>             kVal invalue "my_channel"
>     reports 5.
>
>     any ideas?
>
>     thanks -
>             joachim
>
>     ------------------------------------------------------------------------------
>     Check out the vibrant tech community on one of the world's most
>     engaging tech sites, Slashdot.org! http://sdm.link/slashdot
>     _______________________________________________
>     Qutecsound-users mailing list
>     [hidden email]
>     <mailto:[hidden email]>
>     https://lists.sourceforge.net/lists/listinfo/qutecsound-users
>     <https://lists.sourceforge.net/lists/listinfo/qutecsound-users>
>
>
>
>
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
>
>
>
> _______________________________________________
> Qutecsound-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/qutecsound-users
>

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Qutecsound-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qutecsound-users
Reply | Threaded
Open this post in threaded view
|

Re: [Qutecsound-users] how to get initial widget value via chnget?

Eduardo Moguillansky
In reply to this post by joachim-3
Hi Joachim,

Have you looked at the presets system in CsoundQt? It's there exactly for
that reason: you can save the state of all your widgets and at a later time
you can load it, which recalls the values and sends them down the line to
csound.  
 
On Mittwoch, 12. Juli 2017 08:58:33 CEST, joachim heintz wrote:

> hi all -
>
> traditionally (still from MacCsound times ...) i used invalue
> to get the widget values.  but for a bigger number of widgets
> chnget is much better in performance (i just got a jump from 3/4
> cpu to 1/4 cpu just by replacing invalue by chnget!).
>
> however, there is one behaviour in chnget which puzzled me all
> the time, and still i am not able to solve it.
>
> say i have a spin box with value 5 when i start my program: how
> can i get this value into my csound code?  when i do
> kVal chnget "my_channel"
> it reports 0.  when i do
> iVal chnget "my_channel"
> kVal chnget "my_channel"
> kVal init iVal
> it still reports 0 (also for iVal which surprises me).
>
> invalue works in this case:
> kVal invalue "my_channel"
> reports 5.
>
> any ideas?
>
> thanks -
> joachim
>
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Qutecsound-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qutecsound-users
Reply | Threaded
Open this post in threaded view
|

Re: [Qutecsound-users] how to get initial widget value via chnget?

Tarmo Johannes-2

Hi, Joachim,

 

can it be that you forgot to declare the channel with chn_k?

CsoundQt requires that to read the initial values from widgets, otherwise the value will be available only when widget has been moved For me this kind of code works as expected:

 

;;channels

chn_k "slider0",1

 

schedule 1, 0,0

instr 1

kval init chnget:i("slider0")

print i(kval)

endin

 

 

 

To make adding the chn_k lines as easy as possible, I added a featrue to v0.9.4 that you can rightclick on a widget and just click "Add chn_k to csd".

 

Best!

 

tarmo

 

On Wednesday, July 12, 2017 11:02:29 AM Eduardo Moguillansky wrote:

> Hi Joachim,

>

> Have you looked at the presets system in CsoundQt? It's there exactly for

> that reason: you can save the state of all your widgets and at a later time

> you can load it, which recalls the values and sends them down the line to

> csound.

>

> On Mittwoch, 12. Juli 2017 08:58:33 CEST, joachim heintz wrote:

> > hi all -

> >

> > traditionally (still from MacCsound times ...) i used invalue

> > to get the widget values. but for a bigger number of widgets

> > chnget is much better in performance (i just got a jump from 3/4

> > cpu to 1/4 cpu just by replacing invalue by chnget!).

> >

> > however, there is one behaviour in chnget which puzzled me all

> > the time, and still i am not able to solve it.

> >

> > say i have a spin box with value 5 when i start my program: how

> > can i get this value into my csound code? when i do

> >

> > kVal chnget "my_channel"

> >

> > it reports 0. when i do

> >

> > iVal chnget "my_channel"

> > kVal chnget "my_channel"

> > kVal init iVal

> >

> > it still reports 0 (also for iVal which surprises me).

> >

> > invalue works in this case:

> > kVal invalue "my_channel"

> >

> > reports 5.

> >

> > any ideas?

> >

> > thanks -

> >

> > joachim

> >

> > --------------------------------------------------------------------------

> > ---- Check out the vibrant tech community on one of the world's most

> > engaging tech sites, Slashdot.org! http://sdm.link/slashdot

>

> ----------------------------------------------------------------------------

> -- Check out the vibrant tech community on one of the world's most

> engaging tech sites, Slashdot.org! http://sdm.link/slashdot

> _______________________________________________

> Qutecsound-users mailing list

> [hidden email]

> https://lists.sourceforge.net/lists/listinfo/qutecsound-users

 


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Qutecsound-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qutecsound-users
Reply | Threaded
Open this post in threaded view
|

Re: [Qutecsound-users] how to get initial widget value via chnget?

joachim-3
hi tarmo -

thanks so much — that's the reason!

actually i did not forget to declare the channel; i simply did not know
that it was necessary to get the initial value from the widget.

the feature you added to the widget submenu is very useful, too.

i will add a section to our documentation about this.  it is probably
not possible to have this behaviour without explicitely declaring the
channel?

best -
        joachim


On 12/07/17 13:08, Tarmo Johannes wrote:

> Hi, Joachim,
>
>
>
> can it be that you forgot to declare the channel with chn_k?
>
> CsoundQt requires that to read the initial values from widgets,
> otherwise the value will be available only when widget has been moved
> For me this kind of code works as expected:
>
>
>
> ;;channels
>
> chn_k "slider0",1
>
>
>
> schedule 1, 0,0
>
> instr 1
>
> kval init chnget:i("slider0")
>
> print i(kval)
>
> endin
>
>
>
>
>
>
>
> To make adding the chn_k lines as easy as possible, I added a featrue to
> v0.9.4 that you can rightclick on a widget and just click "Add chn_k to
> csd".
>
>
>
> Best!
>
>
>
> tarmo
>
>
>
> On Wednesday, July 12, 2017 11:02:29 AM Eduardo Moguillansky wrote:
>
>> Hi Joachim,
>
>>
>
>> Have you looked at the presets system in CsoundQt? It's there exactly for
>
>> that reason: you can save the state of all your widgets and at a later
> time
>
>> you can load it, which recalls the values and sends them down the line to
>
>> csound.
>
>>
>
>> On Mittwoch, 12. Juli 2017 08:58:33 CEST, joachim heintz wrote:
>
>> > hi all -
>
>> >
>
>> > traditionally (still from MacCsound times ...) i used invalue
>
>> > to get the widget values. but for a bigger number of widgets
>
>> > chnget is much better in performance (i just got a jump from 3/4
>
>> > cpu to 1/4 cpu just by replacing invalue by chnget!).
>
>> >
>
>> > however, there is one behaviour in chnget which puzzled me all
>
>> > the time, and still i am not able to solve it.
>
>> >
>
>> > say i have a spin box with value 5 when i start my program: how
>
>> > can i get this value into my csound code? when i do
>
>> >
>
>> > kVal chnget "my_channel"
>
>> >
>
>> > it reports 0. when i do
>
>> >
>
>> > iVal chnget "my_channel"
>
>> > kVal chnget "my_channel"
>
>> > kVal init iVal
>
>> >
>
>> > it still reports 0 (also for iVal which surprises me).
>
>> >
>
>> > invalue works in this case:
>
>> > kVal invalue "my_channel"
>
>> >
>
>> > reports 5.
>
>> >
>
>> > any ideas?
>
>> >
>
>> > thanks -
>
>> >
>
>> > joachim
>
>> >
>
>> >
> --------------------------------------------------------------------------
>
>> > ---- Check out the vibrant tech community on one of the world's most
>
>> > engaging tech sites, Slashdot.org! http://sdm.link/slashdot
>
>>
>
>>
> ----------------------------------------------------------------------------
>
>> -- Check out the vibrant tech community on one of the world's most
>
>> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
>
>> _______________________________________________
>
>> Qutecsound-users mailing list
>
>> [hidden email]
>
>> https://lists.sourceforge.net/lists/listinfo/qutecsound-users
>
>
>
>
>
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
>
>
>
> _______________________________________________
> Qutecsound-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/qutecsound-users
>

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Qutecsound-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qutecsound-users