Csound Csound-dev Csound-tekno Search About

issue with channels..

Date2017-07-05 11:07
FromRory Walsh
Subjectissue with channels..
As far as I can see, the following code should set the values of two channels to 1, but only manages to set the first channel? The value of the second channels remains at 0 even after chnset is called. I vaguely remember coming across this issue before, but can't for the life of me remember how I resolved it...  

<CsoundSynthesizer>
<CsOptions>
-odac
</CsOptions>
<CsInstruments>
sr = 44100
ksmps = 32
nchnls = 2
0dbfs = 1


instr 100
kChan init 1
kVal init 1

    if metro(1) == 1 && kChan < 3 then
         Schannel sprintfk "rslider%d", kChan
         chnset k(1), Schannel
         printks "Slider%dVal:%f\n", 0, kChan, chnget:k(Schannel)
         kChan+=1
    endif

endin

</CsInstruments>
<CsScore>
i100 0 z
</CsScore>
</CsoundSynthesizer>
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

Date2017-07-05 11:51
FromTarmo Johannes
SubjectRe: issue with channels..
I think chnget takes string only in init time so all later k-time operations are void.
This is of course quite a problem in many cases...
Tarmo

05.07.2017 13:08 kirjutas kuupäeval "Rory Walsh" <rorywalsh@ear.ie>:
As far as I can see, the following code should set the values of two channels to 1, but only manages to set the first channel? The value of the second channels remains at 0 even after chnset is called. I vaguely remember coming across this issue before, but can't for the life of me remember how I resolved it...  

<CsoundSynthesizer>
<CsOptions>
-odac
</CsOptions>
<CsInstruments>
sr = 44100
ksmps = 32
nchnls = 2
0dbfs = 1


instr 100
kChan init 1
kVal init 1

    if metro(1) == 1 && kChan < 3 then
         Schannel sprintfk "rslider%d", kChan
         chnset k(1), Schannel
         printks "Slider%dVal:%f\n", 0, kChan, chnget:k(Schannel)
         kChan+=1
    endif

endin

</CsInstruments>
<CsScore>
i100 0 z
</CsScore>
</CsoundSynthesizer>
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

Date2017-07-05 12:05
FromRory Walsh
SubjectRe: issue with channels..
Thanks Tarmo. This sounds familiar now! I think to avoid this in the past I used arrays, and then used the strings from the arrays to query my channels. That should work.  

On 5 July 2017 at 11:51, Tarmo Johannes <trmjhnns@gmail.com> wrote:
I think chnget takes string only in init time so all later k-time operations are void.
This is of course quite a problem in many cases...
Tarmo

05.07.2017 13:08 kirjutas kuupäeval "Rory Walsh" <rorywalsh@ear.ie>:
As far as I can see, the following code should set the values of two channels to 1, but only manages to set the first channel? The value of the second channels remains at 0 even after chnset is called. I vaguely remember coming across this issue before, but can't for the life of me remember how I resolved it...  

<CsoundSynthesizer>
<CsOptions>
-odac
</CsOptions>
<CsInstruments>
sr = 44100
ksmps = 32
nchnls = 2
0dbfs = 1


instr 100
kChan init 1
kVal init 1

    if metro(1) == 1 && kChan < 3 then
         Schannel sprintfk "rslider%d", kChan
         chnset k(1), Schannel
         printks "Slider%dVal:%f\n", 0, kChan, chnget:k(Schannel)
         kChan+=1
    endif

endin

</CsInstruments>
<CsScore>
i100 0 z
</CsScore>
</CsoundSynthesizer>
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

Date2017-07-05 12:50
FromRory Walsh
SubjectRe: issue with channels..
Hmm. I thought the following would work, but I get an invalid channel name error?

instr 100
kChan init 0
iCnt init 0
SChannels[] init 4

while iCnt < 2 do
   SChannels[iCnt] sprintf "rslider%d", iCnt+1
   iCnt+=1
od

    if metro(1) == 1 && kChan < 2 then
    printks SChannels[kChan], 0
        chnset k(1), SChannels[kChan]
        ;printks "Value of slider channel: %f", 0, chnget:k(SChannels[kChan])
        kChan+=1
    endif

endin

On 5 July 2017 at 12:05, Rory Walsh <rorywalsh@ear.ie> wrote:
Thanks Tarmo. This sounds familiar now! I think to avoid this in the past I used arrays, and then used the strings from the arrays to query my channels. That should work.  

On 5 July 2017 at 11:51, Tarmo Johannes <trmjhnns@gmail.com> wrote:
I think chnget takes string only in init time so all later k-time operations are void.
This is of course quite a problem in many cases...
Tarmo

05.07.2017 13:08 kirjutas kuupäeval "Rory Walsh" <rorywalsh@ear.ie>:
As far as I can see, the following code should set the values of two channels to 1, but only manages to set the first channel? The value of the second channels remains at 0 even after chnset is called. I vaguely remember coming across this issue before, but can't for the life of me remember how I resolved it...  

<CsoundSynthesizer>
<CsOptions>
-odac
</CsOptions>
<CsInstruments>
sr = 44100
ksmps = 32
nchnls = 2
0dbfs = 1


instr 100
kChan init 1
kVal init 1

    if metro(1) == 1 && kChan < 3 then
         Schannel sprintfk "rslider%d", kChan
         chnset k(1), Schannel
         printks "Slider%dVal:%f\n", 0, kChan, chnget:k(Schannel)
         kChan+=1
    endif

endin

</CsInstruments>
<CsScore>
i100 0 z
</CsScore>
</CsoundSynthesizer>
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

Date2017-07-05 13:08
FromTarmo Johannes
SubjectRe: issue with channels..
String from array witk k-index is still a k-time string and chget does not get it at i-time.
Very annoying. I think I needed to write another instrument to do the work on i-time but I agree it should not be that unconfortable.
Tarmo

05.07.2017 14:50 kirjutas kuupäeval "Rory Walsh" <rorywalsh@ear.ie>:
Hmm. I thought the following would work, but I get an invalid channel name error?

instr 100
kChan init 0
iCnt init 0
SChannels[] init 4

while iCnt < 2 do
   SChannels[iCnt] sprintf "rslider%d", iCnt+1
   iCnt+=1
od

    if metro(1) == 1 && kChan < 2 then
    printks SChannels[kChan], 0
        chnset k(1), SChannels[kChan]
        ;printks "Value of slider channel: %f", 0, chnget:k(SChannels[kChan])
        kChan+=1
    endif

endin

On 5 July 2017 at 12:05, Rory Walsh <rorywalsh@ear.ie> wrote:
Thanks Tarmo. This sounds familiar now! I think to avoid this in the past I used arrays, and then used the strings from the arrays to query my channels. That should work.  

On 5 July 2017 at 11:51, Tarmo Johannes <trmjhnns@gmail.com> wrote:
I think chnget takes string only in init time so all later k-time operations are void.
This is of course quite a problem in many cases...
Tarmo

05.07.2017 13:08 kirjutas kuupäeval "Rory Walsh" <rorywalsh@ear.ie>:
As far as I can see, the following code should set the values of two channels to 1, but only manages to set the first channel? The value of the second channels remains at 0 even after chnset is called. I vaguely remember coming across this issue before, but can't for the life of me remember how I resolved it...  

<CsoundSynthesizer>
<CsOptions>
-odac
</CsOptions>
<CsInstruments>
sr = 44100
ksmps = 32
nchnls = 2
0dbfs = 1


instr 100
kChan init 1
kVal init 1

    if metro(1) == 1 && kChan < 3 then
         Schannel sprintfk "rslider%d", kChan
         chnset k(1), Schannel
         printks "Slider%dVal:%f\n", 0, kChan, chnget:k(Schannel)
         kChan+=1
    endif

endin

</CsInstruments>
<CsScore>
i100 0 z
</CsScore>
</CsoundSynthesizer>
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

Date2017-07-05 13:45
FromRory Walsh
SubjectRe: issue with channels..
Ouch. That sounds like a nightmare. Was it always this way? I can't seem to remember having those issues before. 

On 5 July 2017 at 13:08, Tarmo Johannes <trmjhnns@gmail.com> wrote:
String from array witk k-index is still a k-time string and chget does not get it at i-time.
Very annoying. I think I needed to write another instrument to do the work on i-time but I agree it should not be that unconfortable.
Tarmo

05.07.2017 14:50 kirjutas kuupäeval "Rory Walsh" <rorywalsh@ear.ie>:
Hmm. I thought the following would work, but I get an invalid channel name error?

instr 100
kChan init 0
iCnt init 0
SChannels[] init 4

while iCnt < 2 do
   SChannels[iCnt] sprintf "rslider%d", iCnt+1
   iCnt+=1
od

    if metro(1) == 1 && kChan < 2 then
    printks SChannels[kChan], 0
        chnset k(1), SChannels[kChan]
        ;printks "Value of slider channel: %f", 0, chnget:k(SChannels[kChan])
        kChan+=1
    endif

endin

On 5 July 2017 at 12:05, Rory Walsh <rorywalsh@ear.ie> wrote:
Thanks Tarmo. This sounds familiar now! I think to avoid this in the past I used arrays, and then used the strings from the arrays to query my channels. That should work.  

On 5 July 2017 at 11:51, Tarmo Johannes <trmjhnns@gmail.com> wrote:
I think chnget takes string only in init time so all later k-time operations are void.
This is of course quite a problem in many cases...
Tarmo

05.07.2017 13:08 kirjutas kuupäeval "Rory Walsh" <rorywalsh@ear.ie>:
As far as I can see, the following code should set the values of two channels to 1, but only manages to set the first channel? The value of the second channels remains at 0 even after chnset is called. I vaguely remember coming across this issue before, but can't for the life of me remember how I resolved it...  

<CsoundSynthesizer>
<CsOptions>
-odac
</CsOptions>
<CsInstruments>
sr = 44100
ksmps = 32
nchnls = 2
0dbfs = 1


instr 100
kChan init 1
kVal init 1

    if metro(1) == 1 && kChan < 3 then
         Schannel sprintfk "rslider%d", kChan
         chnset k(1), Schannel
         printks "Slider%dVal:%f\n", 0, kChan, chnget:k(Schannel)
         kChan+=1
    endif

endin

</CsInstruments>
<CsScore>
i100 0 z
</CsScore>
</CsoundSynthesizer>
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

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

Date2017-07-05 14:16
FromOeyvind Brandtsegg
SubjectRe: issue with channels..
Could you do:

if metro(1) == 1 && kChan < 3 then
  if changed(kChan) then
    reinit chan_name
  endif
  chan_name:
  Schannel sprintf "rslider%d", i(kChan)
  chnset k(1), Schannel
  rireturn

?

2017-07-05 14:45 GMT+02:00 Rory Walsh <rorywalsh@ear.ie>:
Ouch. That sounds like a nightmare. Was it always this way? I can't seem to remember having those issues before. 

On 5 July 2017 at 13:08, Tarmo Johannes <trmjhnns@gmail.com> wrote:
String from array witk k-index is still a k-time string and chget does not get it at i-time.
Very annoying. I think I needed to write another instrument to do the work on i-time but I agree it should not be that unconfortable.
Tarmo

05.07.2017 14:50 kirjutas kuupäeval "Rory Walsh" <rorywalsh@ear.ie>:
Hmm. I thought the following would work, but I get an invalid channel name error?

instr 100
kChan init 0
iCnt init 0
SChannels[] init 4

while iCnt < 2 do
   SChannels[iCnt] sprintf "rslider%d", iCnt+1
   iCnt+=1
od

    if metro(1) == 1 && kChan < 2 then
    printks SChannels[kChan], 0
        chnset k(1), SChannels[kChan]
        ;printks "Value of slider channel: %f", 0, chnget:k(SChannels[kChan])
        kChan+=1
    endif

endin

On 5 July 2017 at 12:05, Rory Walsh <rorywalsh@ear.ie> wrote:
Thanks Tarmo. This sounds familiar now! I think to avoid this in the past I used arrays, and then used the strings from the arrays to query my channels. That should work.  

On 5 July 2017 at 11:51, Tarmo Johannes <trmjhnns@gmail.com> wrote:
I think chnget takes string only in init time so all later k-time operations are void.
This is of course quite a problem in many cases...
Tarmo

05.07.2017 13:08 kirjutas kuupäeval "Rory Walsh" <rorywalsh@ear.ie>:
As far as I can see, the following code should set the values of two channels to 1, but only manages to set the first channel? The value of the second channels remains at 0 even after chnset is called. I vaguely remember coming across this issue before, but can't for the life of me remember how I resolved it...  

<CsoundSynthesizer>
<CsOptions>
-odac
</CsOptions>
<CsInstruments>
sr = 44100
ksmps = 32
nchnls = 2
0dbfs = 1


instr 100
kChan init 1
kVal init 1

    if metro(1) == 1 && kChan < 3 then
         Schannel sprintfk "rslider%d", kChan
         chnset k(1), Schannel
         printks "Slider%dVal:%f\n", 0, kChan, chnget:k(Schannel)
         kChan+=1
    endif

endin

</CsInstruments>
<CsScore>
i100 0 z
</CsScore>
</CsoundSynthesizer>
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

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

Date2017-07-05 14:16
FromOeyvind Brandtsegg
SubjectRe: issue with channels..
(not tested here, beware of typos)

2017-07-05 15:16 GMT+02:00 Oeyvind Brandtsegg <oyvind.brandtsegg@ntnu.no>:
Could you do:

if metro(1) == 1 && kChan < 3 then
  if changed(kChan) then
    reinit chan_name
  endif
  chan_name:
  Schannel sprintf "rslider%d", i(kChan)
  chnset k(1), Schannel
  rireturn

?

2017-07-05 14:45 GMT+02:00 Rory Walsh <rorywalsh@ear.ie>:
Ouch. That sounds like a nightmare. Was it always this way? I can't seem to remember having those issues before. 

On 5 July 2017 at 13:08, Tarmo Johannes <trmjhnns@gmail.com> wrote:
String from array witk k-index is still a k-time string and chget does not get it at i-time.
Very annoying. I think I needed to write another instrument to do the work on i-time but I agree it should not be that unconfortable.
Tarmo

05.07.2017 14:50 kirjutas kuupäeval "Rory Walsh" <rorywalsh@ear.ie>:
Hmm. I thought the following would work, but I get an invalid channel name error?

instr 100
kChan init 0
iCnt init 0
SChannels[] init 4

while iCnt < 2 do
   SChannels[iCnt] sprintf "rslider%d", iCnt+1
   iCnt+=1
od

    if metro(1) == 1 && kChan < 2 then
    printks SChannels[kChan], 0
        chnset k(1), SChannels[kChan]
        ;printks "Value of slider channel: %f", 0, chnget:k(SChannels[kChan])
        kChan+=1
    endif

endin

On 5 July 2017 at 12:05, Rory Walsh <rorywalsh@ear.ie> wrote:
Thanks Tarmo. This sounds familiar now! I think to avoid this in the past I used arrays, and then used the strings from the arrays to query my channels. That should work.  

On 5 July 2017 at 11:51, Tarmo Johannes <trmjhnns@gmail.com> wrote:
I think chnget takes string only in init time so all later k-time operations are void.
This is of course quite a problem in many cases...
Tarmo

05.07.2017 13:08 kirjutas kuupäeval "Rory Walsh" <rorywalsh@ear.ie>:
As far as I can see, the following code should set the values of two channels to 1, but only manages to set the first channel? The value of the second channels remains at 0 even after chnset is called. I vaguely remember coming across this issue before, but can't for the life of me remember how I resolved it...  

<CsoundSynthesizer>
<CsOptions>
-odac
</CsOptions>
<CsInstruments>
sr = 44100
ksmps = 32
nchnls = 2
0dbfs = 1


instr 100
kChan init 1
kVal init 1

    if metro(1) == 1 && kChan < 3 then
         Schannel sprintfk "rslider%d", kChan
         chnset k(1), Schannel
         printks "Slider%dVal:%f\n", 0, kChan, chnget:k(Schannel)
         kChan+=1
    endif

endin

</CsInstruments>
<CsScore>
i100 0 z
</CsScore>
</CsoundSynthesizer>
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

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

Date2017-07-05 14:24
FromRory Walsh
SubjectRe: issue with channels..
Probably, to it seems very cumbersome. I wonder is there any way chnget can be updated to deal with k-time strings? 

On 5 July 2017 at 14:16, Oeyvind Brandtsegg <oyvind.brandtsegg@ntnu.no> wrote:
(not tested here, beware of typos)

2017-07-05 15:16 GMT+02:00 Oeyvind Brandtsegg <oyvind.brandtsegg@ntnu.no>:
Could you do:

if metro(1) == 1 && kChan < 3 then
  if changed(kChan) then
    reinit chan_name
  endif
  chan_name:
  Schannel sprintf "rslider%d", i(kChan)
  chnset k(1), Schannel
  rireturn

?

2017-07-05 14:45 GMT+02:00 Rory Walsh <rorywalsh@ear.ie>:
Ouch. That sounds like a nightmare. Was it always this way? I can't seem to remember having those issues before. 

On 5 July 2017 at 13:08, Tarmo Johannes <trmjhnns@gmail.com> wrote:
String from array witk k-index is still a k-time string and chget does not get it at i-time.
Very annoying. I think I needed to write another instrument to do the work on i-time but I agree it should not be that unconfortable.
Tarmo

05.07.2017 14:50 kirjutas kuupäeval "Rory Walsh" <rorywalsh@ear.ie>:
Hmm. I thought the following would work, but I get an invalid channel name error?

instr 100
kChan init 0
iCnt init 0
SChannels[] init 4

while iCnt < 2 do
   SChannels[iCnt] sprintf "rslider%d", iCnt+1
   iCnt+=1
od

    if metro(1) == 1 && kChan < 2 then
    printks SChannels[kChan], 0
        chnset k(1), SChannels[kChan]
        ;printks "Value of slider channel: %f", 0, chnget:k(SChannels[kChan])
        kChan+=1
    endif

endin

On 5 July 2017 at 12:05, Rory Walsh <rorywalsh@ear.ie> wrote:
Thanks Tarmo. This sounds familiar now! I think to avoid this in the past I used arrays, and then used the strings from the arrays to query my channels. That should work.  

On 5 July 2017 at 11:51, Tarmo Johannes <trmjhnns@gmail.com> wrote:
I think chnget takes string only in init time so all later k-time operations are void.
This is of course quite a problem in many cases...
Tarmo

05.07.2017 13:08 kirjutas kuupäeval "Rory Walsh" <rorywalsh@ear.ie>:
As far as I can see, the following code should set the values of two channels to 1, but only manages to set the first channel? The value of the second channels remains at 0 even after chnset is called. I vaguely remember coming across this issue before, but can't for the life of me remember how I resolved it...  

<CsoundSynthesizer>
<CsOptions>
-odac
</CsOptions>
<CsInstruments>
sr = 44100
ksmps = 32
nchnls = 2
0dbfs = 1


instr 100
kChan init 1
kVal init 1

    if metro(1) == 1 && kChan < 3 then
         Schannel sprintfk "rslider%d", kChan
         chnset k(1), Schannel
         printks "Slider%dVal:%f\n", 0, kChan, chnget:k(Schannel)
         kChan+=1
    endif

endin

</CsInstruments>
<CsScore>
i100 0 z
</CsScore>
</CsoundSynthesizer>
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

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

Date2017-07-05 17:37
Fromjoachim heintz
SubjectRe: issue with channels..
i think what you could do is to call an instrument which does the job at 
i-time:

instr 100
kChan init 1
kVal init 1

     if metro(1) == 1 && kChan < 3 then
          event "i", "Reset", 0, 1, kChan, kVal
          kChan+=1
     endif

endin

instr Reset

  Schannel sprintf "rslider%d", p4
          chnset p5, Schannel
          prints "Slider%dVal:%f\n", p4, chnget:i(Schannel)
  turnoff

endin


would this work for you?
	joachim



On 05/07/17 15:24, Rory Walsh wrote:
> Probably, to it seems very cumbersome. I wonder is there any way chnget
> can be updated to deal with k-time strings?
>
> On 5 July 2017 at 14:16, Oeyvind Brandtsegg  > wrote:
>
>     (not tested here, beware of typos)
>
>     2017-07-05 15:16 GMT+02:00 Oeyvind Brandtsegg
>     >:
>
>         Could you do:
>
>         if metro(1) == 1 && kChan < 3 then
>           if changed(kChan) then
>             reinit chan_name
>           endif
>           chan_name:
>           Schannel sprintf "rslider%d", i(kChan)
>           chnset k(1), Schannel
>           rireturn
>
>         ?
>
>         2017-07-05 14:45 GMT+02:00 Rory Walsh          >:
>
>             Ouch. That sounds like a nightmare. Was it always this way?
>             I can't seem to remember having those issues before.
>
>             On 5 July 2017 at 13:08, Tarmo Johannes              > wrote:
>
>                 String from array witk k-index is still a k-time string
>                 and chget does not get it at i-time.
>                 Very annoying. I think I needed to write another
>                 instrument to do the work on i-time but I agree it
>                 should not be that unconfortable.
>                 Tarmo
>
>                 05.07.2017 14:50 kirjutas kuupäeval "Rory Walsh"
>                 >:
>
>                     Hmm. I thought the following would work, but I get
>                     an invalid channel name error?
>
>                     instr 100
>                     kChan init 0
>                     iCnt init 0
>                     SChannels[] init 4
>
>                     while iCnt < 2 do
>                        SChannels[iCnt] sprintf "rslider%d", iCnt+1
>                        iCnt+=1
>                     od
>
>                         if metro(1) == 1 && kChan < 2 then
>                         printks SChannels[kChan], 0
>                             chnset k(1), SChannels[kChan]
>                             ;printks "Value of slider channel: %f", 0,
>                     chnget:k(SChannels[kChan])
>                             kChan+=1
>                         endif
>
>                     endin
>
>                     On 5 July 2017 at 12:05, Rory Walsh
>                     > wrote:
>
>                         Thanks Tarmo. This sounds familiar now! I think
>                         to avoid this in the past I used arrays, and
>                         then used the strings from the arrays to query
>                         my channels. That should work.
>
>                         On 5 July 2017 at 11:51, Tarmo Johannes
>                         >
>                         wrote:
>
>                             I think chnget takes string only in init
>                             time so all later k-time operations are void.
>                             This is of course quite a problem in many
>                             cases...
>                             Tarmo
>
>                             05.07.2017 13:08 kirjutas kuupäeval "Rory
>                             Walsh"                              >:
>
>                                 As far as I can see, the following code
>                                 should set the values of two channels to
>                                 1, but only manages to set the first
>                                 channel? The value of the second
>                                 channels remains at 0 even after chnset
>                                 is called. I vaguely remember coming
>                                 across this issue before, but can't for
>                                 the life of me remember how I resolved
>                                 it...
>
>                                 
>                                 
>                                 -odac
>                                 
>                                 
>                                 sr = 44100
>                                 ksmps = 32
>                                 nchnls = 2
>                                 0dbfs = 1
>
>
>                                 instr 100
>                                 kChan init 1
>                                 kVal init 1
>
>                                     if metro(1) == 1 && kChan < 3 then
>                                          Schannel sprintfk "rslider%d",
>                                 kChan
>                                          chnset k(1), Schannel
>                                          printks "Slider%dVal:%f\n", 0,
>                                 kChan, chnget:k(Schannel)
>                                          kChan+=1
>                                     endif
>
>                                 endin
>
>                                 
>                                 
>                                 i100 0 z
>                                 
>                                 
>                                 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
>
>
>             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
>
>
>
>
>         --
>
>         Oeyvind Brandtsegg
>         Professor of Music Technology
>         NTNU
>         7491 Trondheim
>         Norway
>         Cell: +47 92 203 205
>
>         http://www.partikkelaudio.com/
>         http://crossadaptive.hf.ntnu.no 
>         http://gdsp.hf.ntnu.no/
>         http://soundcloud.com/brandtsegg 
>         http://flyndresang.no/
>         http://soundcloud.com/t-emp
>
>
>
>
>
>     --
>
>     Oeyvind Brandtsegg
>     Professor of Music Technology
>     NTNU
>     7491 Trondheim
>     Norway
>     Cell: +47 92 203 205
>
>     http://www.partikkelaudio.com/
>     http://crossadaptive.hf.ntnu.no 
>     http://gdsp.hf.ntnu.no/
>     http://soundcloud.com/brandtsegg 
>     http://flyndresang.no/
>     http://soundcloud.com/t-emp
>
>     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

Date2017-07-05 18:08
FromRory Walsh
SubjectRe: issue with channels..
I think both of these solutions would work. I think it would be nice though if we could do it straight out of the box. 

On 5 July 2017 at 17:37, joachim heintz <jh@joachimheintz.de> wrote:
i think what you could do is to call an instrument which does the job at i-time:

instr 100
kChan init 1
kVal init 1

    if metro(1) == 1 && kChan < 3 then
         event "i", "Reset", 0, 1, kChan, kVal
         kChan+=1
    endif

endin

instr Reset

 Schannel sprintf "rslider%d", p4
         chnset p5, Schannel
         prints "Slider%dVal:%f\n", p4, chnget:i(Schannel)
 turnoff

endin


would this work for you?
        joachim



On 05/07/17 15:24, Rory Walsh wrote:
Probably, to it seems very cumbersome. I wonder is there any way chnget
can be updated to deal with k-time strings?

On 5 July 2017 at 14:16, Oeyvind Brandtsegg <oyvind.brandtsegg@ntnu.no
<mailto:oyvind.brandtsegg@ntnu.no>> wrote:

    (not tested here, beware of typos)

    2017-07-05 15:16 GMT+02:00 Oeyvind Brandtsegg
    <oyvind.brandtsegg@ntnu.no <mailto:oyvind.brandtsegg@ntnu.no>>:

        Could you do:

        if metro(1) == 1 && kChan < 3 then
          if changed(kChan) then
            reinit chan_name
          endif
          chan_name:
          Schannel sprintf "rslider%d", i(kChan)
          chnset k(1), Schannel
          rireturn

        ?

        2017-07-05 14:45 GMT+02:00 Rory Walsh <rorywalsh@ear.ie
        <mailto:rorywalsh@ear.ie>>:

            Ouch. That sounds like a nightmare. Was it always this way?
            I can't seem to remember having those issues before.

            On 5 July 2017 at 13:08, Tarmo Johannes <trmjhnns@gmail.com
            <mailto:trmjhnns@gmail.com>> wrote:

                String from array witk k-index is still a k-time string
                and chget does not get it at i-time.
                Very annoying. I think I needed to write another
                instrument to do the work on i-time but I agree it
                should not be that unconfortable.
                Tarmo

                05.07.2017 14:50 kirjutas kuupäeval "Rory Walsh"
                <rorywalsh@ear.ie <mailto:rorywalsh@ear.ie>>:

                    Hmm. I thought the following would work, but I get
                    an invalid channel name error?

                    instr 100
                    kChan init 0
                    iCnt init 0
                    SChannels[] init 4

                    while iCnt < 2 do
                       SChannels[iCnt] sprintf "rslider%d", iCnt+1
                       iCnt+=1
                    od

                        if metro(1) == 1 && kChan < 2 then
                        printks SChannels[kChan], 0
                            chnset k(1), SChannels[kChan]
                            ;printks "Value of slider channel: %f", 0,
                    chnget:k(SChannels[kChan])
                            kChan+=1
                        endif

                    endin

                    On 5 July 2017 at 12:05, Rory Walsh
                    <rorywalsh@ear.ie <mailto:rorywalsh@ear.ie>> wrote:

                        Thanks Tarmo. This sounds familiar now! I think
                        to avoid this in the past I used arrays, and
                        then used the strings from the arrays to query
                        my channels. That should work.

                        On 5 July 2017 at 11:51, Tarmo Johannes
                        <trmjhnns@gmail.com <mailto:trmjhnns@gmail.com>>
                        wrote:

                            I think chnget takes string only in init
                            time so all later k-time operations are void.
                            This is of course quite a problem in many
                            cases...
                            Tarmo

                            05.07.2017 13:08 kirjutas kuupäeval "Rory
                            Walsh" <rorywalsh@ear.ie
                            <mailto:rorywalsh@ear.ie>>:


                                As far as I can see, the following code
                                should set the values of two channels to
                                1, but only manages to set the first
                                channel? The value of the second
                                channels remains at 0 even after chnset
                                is called. I vaguely remember coming
                                across this issue before, but can't for
                                the life of me remember how I resolved
                                it...

                                <CsoundSynthesizer>
                                <CsOptions>
                                -odac
                                </CsOptions>
                                <CsInstruments>
                                sr = 44100
                                ksmps = 32
                                nchnls = 2
                                0dbfs = 1


                                instr 100
                                kChan init 1
                                kVal init 1

                                    if metro(1) == 1 && kChan < 3 then
                                         Schannel sprintfk "rslider%d",
                                kChan
                                         chnset k(1), Schannel
                                         printks "Slider%dVal:%f\n", 0,
                                kChan, chnget:k(Schannel)
                                         kChan+=1
                                    endif

                                endin

                                </CsInstruments>
                                <CsScore>
                                i100 0 z
                                </CsScore>
                                </CsoundSynthesizer>
                                Csound mailing list
                                Csound@listserv.heanet.ie
                                <mailto:Csound@listserv.heanet.ie>
                                https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
                                <https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND>
                                Send bugs reports to
                                https://github.com/csound/csound/issues
                                <https://github.com/csound/csound/issues> Discussions
                                of bugs and features can be posted here


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



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

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


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




        --

        Oeyvind Brandtsegg
        Professor of Music Technology
        NTNU
        7491 Trondheim
        Norway
        Cell: +47 92 203 205

        http://www.partikkelaudio.com/
        http://crossadaptive.hf.ntnu.no <http://crossadaptive.hf.ntnu.no>
        http://gdsp.hf.ntnu.no/
        http://soundcloud.com/brandtsegg <http://soundcloud.com/brandtsegg>
        http://flyndresang.no/
        http://soundcloud.com/t-emp





    --

    Oeyvind Brandtsegg
    Professor of Music Technology
    NTNU
    7491 Trondheim
    Norway
    Cell: +47 92 203 205

    http://www.partikkelaudio.com/
    http://crossadaptive.hf.ntnu.no <http://crossadaptive.hf.ntnu.no>
    http://gdsp.hf.ntnu.no/
    http://soundcloud.com/brandtsegg <http://soundcloud.com/brandtsegg>
    http://flyndresang.no/
    http://soundcloud.com/t-emp

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


Csound mailing list Csound@listserv.heanet.ie
<mailto: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