Re: On UDOs ...

From: Robin Davies (rerdavies@msn.com)
Date: Mon May 22 2000 - 22:13:52 EDT


Hmmm. the second example is definitely more interesting.

For the second example, Sfx generates the following.

>
>aopcode bar (ivar a[1])
>
>{
> ivar b;
>
> if (!b) // i-rate.
>

> b = a; // i-rate. [1] Please read on for comments on this line
specifically.
> }
> return(aphasor(b) - 0.5);
>}
>
>
>instr foo () {
>
> ivar d[1];
> ksig dummy;
>
> d[dummy] = d[dummy] + 1; // k-rate
>
> if (d[dummy] > 100) // k-rate
> {
> output(bar(d)); // mixed.
> }
>
>}

>
>aopcode bar (ivar a[1])
>
>{
> ivar b;
>
> if (!b)
> {
> b = a[0]; // zero.
> }
> return(aphasor(b) - 0.5);
>}
>
>
 IPass:
    Clear all variables.
    // bar ipass:
     if (!b)
    {
          b = d[0]; // d[0] is zero.
    }

 KPass:
    d[dummy] = d[dummy] + 1; // foo instance.

    temporary = (d[dummy] > 100);
     if (temporary)

         // Nothing. If statement elimitated by compiler.
     }

APass:
    if (temporary) {
        // bar retun inlined as an expression since it's a single-point
return.
        output(aphasor.APass(b)- 0.5); // b will always be zero.
    }

The instrument always returns -0.5. <now goes to peek to see what Giorgio
got>.

> b = a; // i-rate. [1] Please read on for comments on this line
specifically.

An interesting statement. Oddly enough, Sfx accepts it, although I would
suspect that it is probably illegal.

Shouldn't this statement actually be "b = a[0];"? I would assume that the
paramter "ivar a[1]" is a "multi-valued" variable. I can't remember why
(something to do with the dreaded input array), I decided to treat arrays of
length one as equivalent to scalar as a temporary hack to get the Sfx code
working on real sample code. I've been meaning to go back and look at this
again, but if it really is legal, I guess I don't have to. Is it?



This archive was generated by hypermail 2b29 : Mon Jan 28 2002 - 12:03:56 EST