num/denom v's double (was: Re: [LAD] [ANN] LV2 beta3)

Steve Harris steve at plugin.org.uk
Sat May 12 19:35:31 UTC 2007


On 12 May 2007, at 10:52, Jens M Andreasen wrote:

> On Fri, 2007-05-11 at 21:37 +0200, Fons Adriaensen wrote:
>
>> ??? In the current spec the sample rate is an integer. JACK and ALSA
>> will give you an integer. Just set the denominator to 1 if your host
>> runs all plugins at the normal sample rate, as most will do.
>>
>
> Given the function f(a,b), where most people would only need to bother
> about f(a), we could do:
>
> #define  f(a) f2(a,1)
>
> So there you have it. In this case it really is possible to both eat
> your cake and keep it.
>
> The friendly one-page skeleton pass-thru demo will not mention the
> second parameter, but it will be documented in the man page.

Ugh. I really don't like that. If the API mandates a num/denom, make  
sure its propertly documented and people use it, otherwise it's a  
waste of everyone's time, and it will never be possible to use it in  
practice.

I can only assume that Fons was joking when he said that, as he's so  
concerned about compatibility.

Also,

    if (denom != 1) return 1;
    double fs = (double)num;

is more complex than

    double fs = (double)num/(double)denom;

- Steve



More information about the Linux-audio-dev mailing list