Csound Csound-dev Csound-tekno Search About

[Csnd] overloading UDOs

Date2014-03-05 22:45
Fromjoachim heintz
Subject[Csnd] overloading UDOs
i have missed several times some flexibility of UDOs in respect to the 
number of input and/or output arguments. now i have read some code by 
martin neukom which shows that it's possible to re-define UDOs for 
overloading them. this is a simple example:



ksmps = 32

;one in, one out
opcode test, i, i
ibla xin
xout ibla
endop

;two in, two out
opcode test, ii, ii
ibla, iblu xin
xout ibla, iblu
endop

;one in, two out
opcode test, ii, i
ibla xin
xout ibla, ibla
endop

instr 1
idruck test 1
print idruck
ia, ib test 2
print ia, ib
ix, iy test 3, 4
print ix, iy
endin



i 1 0 1



returns:
instr 1:  idruck = 1.000
instr 1:  ia = 2.000  ib = 2.000
instr 1:  ix = 3.000  iy = 4.000


very nice feature ...

	joachim

Date2014-03-05 23:04
FromRory Walsh
SubjectRe: [Csnd] overloading UDOs

Wow! That's powerful!

On 5 Mar 2014 22:46, "joachim heintz" <jh@joachimheintz.de> wrote:
i have missed several times some flexibility of UDOs in respect to the number of input and/or output arguments. now i have read some code by martin neukom which shows that it's possible to re-define UDOs for overloading them. this is a simple example:

<CsoundSynthesizer>
<CsInstruments>
ksmps = 32

;one in, one out
opcode test, i, i
ibla xin
xout ibla
endop

;two in, two out
opcode test, ii, ii
ibla, iblu xin
xout ibla, iblu
endop

;one in, two out
opcode test, ii, i
ibla xin
xout ibla, ibla
endop

instr 1
idruck test 1
print idruck
ia, ib test 2
print ia, ib
ix, iy test 3, 4
print ix, iy
endin

</CsInstruments>
<CsScore>
i 1 0 1
</CsScore>
</CsoundSynthesizer>

returns:
instr 1:  idruck = 1.000
instr 1:  ia = 2.000  ib = 2.000
instr 1:  ix = 3.000  iy = 4.000


very nice feature ...

        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"