Re: [linux-audio-dev] LADSPA Update (http://www.ladspa.org)

New Message Reply About this list Date view Thread view Subject view Author view Other groups

Subject: Re: [linux-audio-dev] LADSPA Update (http://www.ladspa.org)
From: David Benson (daveb_AT_idealab.com)
Date: Sun May 21 2000 - 19:50:46 EEST


> I think that the interference is not that big as you think.
> IMHO it is not a big deal if only one or multiple plugins call
> srand() at init time, with a seed based on the current time.
> ( time() )

Many batch jobs can be run in one second. Based on this,
srand(time()) is not so great. A host (or plugin) can
produce a more tweaked seed (eg time() ^ (getpid()<<16))
but basically the optimal seed generator varies host-to-host.
(sucking a seed from /dev/random would be better still,
but less portable)

Furthermore, it might be nice to add a --seed option to hosts
to get reproducible results.

So if we could specify, I'd probably vote for host-side srand().
However, it is too late .. I think hosts and plugins must
bear whatever behavior.

Of course, you don't *have* to call srand, it just outputs
a reproducible stream; it still has the right distribution.
And how could a host really tell? (Hosts should never assume
plugins are deterministic)

However, hosts that care can make it work no matter what.

Merely write rand() and srand() that override the libc versions
and do whatever you want (including per-plugin based rng
or ignoring srand from plugins or whatever...)
ugly ... but functional...
(and I'd bet most shared-library environments will causually play ball...)
(not that i'd call it "portable" either)

- Dave

> Plus if all plugins run in the same thread (the host process),
> they in fact use a single random generator source.

i sort of think this may be a weakness on some levels though.


New Message Reply About this list Date view Thread view Subject view Author view Other groups

This archive was generated by hypermail 2b28 : Sun May 21 2000 - 20:21:03 EEST