Re: [Csnd-dev] UDO problem in latest develop

Dave Seidel <[email protected]> Mon, 10 Nov 2025 11:59:12 -0500
Newsgroups gmane.comp.audio.csound.devel
Message-ID <CAMnrweAqBzUn_0Om9npvAHvGu2CJ7JvDAZH1eLvBYU1fOJW6Hw@mail.gmail.com>
To confirm, the UDO works if defined and invoked using the old syntax.

On Mon, Nov 10, 2025 at 11:55 AM Dave Seidel <[email protected]> wrote:

> Thanks, Hlöðver.
>
> On Mon, Nov 10, 2025 at 11:52 AM Hlöðver Sigurðsson <[email protected]>
> wrote:
>
>> I made a reproducible test here, it fails in instr 2, instr 1 works, so
>> you have a workaround for now, by placing the arguments positionally
>> "old-style" while I make a fix
>>
>> <CsoundSynthesizer>
>> <CsOptions>
>> -n -d
>> </CsOptions>
>> <CsInstruments>
>> sr = 44100
>> ksmps = 64
>> nchnls = 2
>> 0dbfs = 1
>>
>> giSine ftgen 0, 0, 4096, 10, 1
>>
>> opcode TestXout, aa, ikai
>>   ifreq, koff, aamp, itbl xin
>>   koff1 = koff
>>   koff2 = 2 * koff
>>
>>   a1 poscil aamp, ifreq+koff1, itbl
>>   a2 poscil aamp, ifreq+koff2, itbl
>>   a3 poscil aamp, ifreq-koff1, itbl
>>   a4 poscil aamp, ifreq-koff2, itbl
>>
>>   aL = a1 + a3
>>   aR = a2 + a4
>>
>>   xout aL, aR
>> endop
>>
>> instr 1
>>   ifreq = 440
>>   koff = 0.004
>>   aenv linen 0.5, 0.01, p3, 0.01
>>
>>   ; This should work - unpacking the outputs
>>   aL, aR TestXout ifreq, koff, aenv, giSine
>>   out aL, aR
>> endin
>>
>> instr 2
>>   ifreq = 440
>>   koff = 0.004
>>   aenv linen 0.5, 0.01, p3, 0.01
>>
>>   ; This tests the regression - calling UDO with multiple outputs
>> directly in out statement
>>   out TestXout(ifreq, koff, aenv, giSine)
>> endin
>>
>> </CsInstruments>
>> <CsScore>
>> i 1 0 0.1
>> i 2 0 0.1
>> </CsScore>
>> </CsoundSynthesizer>
>>
>> On Mon, 10 Nov 2025 at 18:51, Dave Seidel <[email protected]> wrote:
>>
>>> This is how it's being used in context:
>>>
>>> instr Drone
>>>     idur = p3
>>>     iamp = ampdb(p4) / 7
>>>     ifreq = p5
>>>
>>>     icps = ifreq / 4
>>>     icps2 = icps * 1.5
>>>     icps3 = icps * 2
>>>     prints("drones: %f, %f, %f\n", icps, icps2, icps3)
>>>
>>>     aenv = linen(iamp, 3, idur, 3)
>>>
>>>     a1L, a1R = RissetHarmOsc(icps,  0.004, aenv, giPrime)
>>>     a2L, a2R = RissetHarmOsc(icps2, 0.005, aenv, giPrime)
>>>     a3L, a3R = RissetHarmOsc(icps3, 0.006, aenv, giPrime)
>>>     ga_drone_L +=  a1L+a2L+a3L
>>>     ga_drone_R +=  a1R+a2R+a3R
>>>
>>>     printks("drone %f, %f\n", 2, ga_drone_L, ga_drone_R)
>>> endin
>>>
>>>
>>> On Mon, Nov 10, 2025 at 11:48 AM Dave Seidel <[email protected]>
>>> wrote:
>>>
>>>> I'm not getting any error message at all.
>>>>
>>>> On Mon, Nov 10, 2025 at 11:45 AM Hlöðver Sigurðsson <[email protected]>
>>>> wrote:
>>>>
>>>>> this is the error you are seeing?
>>>>>
>>>>> > error: opcode 'RissetHarmOsc' for expression with arg types icai
>>>>> returns out-args != 1, line 43
>>>>>
>>>>> On Mon, 10 Nov 2025 at 18:41, Hlöðver Sigurðsson <[email protected]>
>>>>> wrote:
>>>>>
>>>>>> I'm taking a look at this now, I don't know if my changes had
>>>>>> anything to do with it, not unlikely
>>>>>>
>>>>>> On Mon, 10 Nov 2025 at 18:39, Dave Seidel <[email protected]>
>>>>>> wrote:
>>>>>>
>>>>>>> The following UDO does not work with the latest develop sources. The
>>>>>>> print statement shows that all four inputs argos are coming in at 0; If I
>>>>>>> revert to the 7.0.0-beta.9 tag, it works fine.
>>>>>>>
>>>>>>> opcode RissetHarmOsc(freq:i,ofs:k,amp:a,tbl:i):(a,a)
>>>>>>>     koff1 = ofs
>>>>>>>     koff2 = 2 * ofs
>>>>>>>     koff3 = 3 * ofs
>>>>>>>     koff4 = 4 * ofs
>>>>>>>
>>>>>>>     printks(">> RissetHarmOsc ->%f %f %f %f\n", 5, freq, ofs, amp,
>>>>>>> tbl)
>>>>>>>
>>>>>>>     ; a1 = poscil3(kamp, freq, tbl
>>>>>>>     a2 = poscil3(amp, freq+koff1, tbl)
>>>>>>>     a3 = poscil3(amp, freq+koff2, tbl)
>>>>>>>     a4 = poscil3(amp, freq+koff3, tbl)
>>>>>>>     a5 = poscil3(amp, freq+koff4, tbl)
>>>>>>>     a6 = poscil3(amp, freq-koff1, tbl)
>>>>>>>     a7 = poscil3(amp, freq-koff2, tbl)
>>>>>>>     a8 = poscil3(amp, freq-koff3, tbl)
>>>>>>>     a9 = poscil3(amp, freq-koff4, tbl)
>>>>>>>     aL = a2+a4+a6+a8
>>>>>>>     aR = a3+a5+a7+a9
>>>>>>>
>>>>>>>     aoutL, aoutR = reverbsc(aL, aR, 0.4, 4000)
>>>>>>>     xout(aoutL+aL, aoutR+aR)
>>>>>>>     ; xout(aL, aR)
>>>>>>>   endop
>>>>>>>
>>>>>>> example calling statement:
>>>>>>>
>>>>>>> a1L, a1R = RissetHarmOsc(icps,  0.004, aenv, giPrime)
>>>>>>>
>>>>>>> Has something changed to make my UDO invalid in some way? I'm using
>>>>>>> this code in as performance on Saturday and I'm focused on preparing, but I
>>>>>>> can follow up with a minimal example.
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>