[Csnd] flexible routing with audio arrays

i like the possibility to put an audio array in out, like

  audio_sigs:a[] = [poscil:a(.2,500),poscil:a(.2,400)]
  out(audio_sigs)

however, sometimes i want to route it to higher channel numbers, or to irregular numbers, for instance, sending four audio signals in an array to the outputs 1,2,5,6.

i would like to do something like this:

  hw_out_chnls:i[] = [3,4]
  audio_sigs:a[] = [poscil:a(.2,500),poscil:a(.2,400)]
  for h,i in hw_out_chnls do
        outch(h,audio_sigs[i])
  od

this obviously cannot work because only the last array element is sent via outch.

i could solve it with a recursive UDO, but i am wondering:
is there any more elegant solution now in CS7?

thanks -
  joachim

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        GitHub · Where software is built
Discussions of bugs and features can be posted here

you mean "cannot" rather than "can"?
do you mean the same what i described as "this obviously cannot work because only the last array element is sent via outch"?
otherwise i don't get what you mean.

He means outch() can be used in a loop without any problems - it doesn't hold state from one call to another.

Prof. Victor Lazzarini
Maynooth University
Ireland

but i only hear the last array element (and the output shows the same).
here is the full code:

instr 1
   // array of hardware output channels (starting at 1)
   hw_out_chnls:i[] = [3,4]

   // array of audio signals
   audio_sigs:a[] = [poscil:a(.2,500),poscil:a(.2,400)]

   for h,i in hw_out_chnls do
     outch(h,audio_sigs[i])
   od
endin

anything i overlooked?