[CM] Ladspa stuff for snd.

Bill Schottstaedt bil@ccrma.Stanford.EDU
Fri, 01 Aug 2003 05:47:15 -0700


I added ladspa.scm to the Snd tarball.

 > So to make the above design make sense, the preview function needs
 > to be fixed properly. And I'm not sure how to do that. I guess
 > its enough to make a new apply-ladspa c-function that doesnt
 > store undo or update graphics?

You want to play the sound as processed by the plugin, without editing
anything?  There are examples of that in rtio.scm, bess.scm, and
bess1.scm.  Basically you open the DAC and send it arbitrary samples;
with modern machines, surprisingly complex stuff can work in this mode.
The only problem is that I have tested that code only in OSS/Linux.

 > ;; 3. Graphics may not update.

You can force an update with the function update-time-graph.


 > Unfortunately, I can't find a convenient way to get the number
 > of audio inputs/outputs a plug-in provides.

I've added struct accessors much as in the xm module:

(set! (ladspa-dir) "/home/bil/test/ladspa_sdk/plugins")
(init-ladspa)
(list-ladspa)
    (("amp" "amp_mono") ("amp" "amp_stereo") ("delay" "delay_5s") 
("filter" "lpf") ("filter" "hpf") ("noise" "noise_white") ("sine" 
"sine_faaa") ("sine" "sine_faac") ("sine" "sine_fcaa") ("sine" "sine_fcac"))
(analyse-ladspa "amp" "amp_mono")
    ("Mono Amplifier" "Richard Furse (LADSPA example plugins)" "None" 
(("Gain" "minimum" 0.0 "logarithmic")))

(define ptr (ladspa-descriptor "amp" "amp_mono"))
(.Label ptr)
    "amp_mono"
(.Name ptr)
    "Mono Amplifier"
(.Copyright ptr)
    "None"
(.Maker ptr)
    "Richard Furse (LADSPA example plugins)"
(.Properties ptr)
    4
(.UniqueID ptr)
    1048
(.PortNames ptr)
    ("Gain" "Input" "Output")
(.PortRangeHints ptr)
    ((593 0.0 0.0) (0 0.0 0.0) (0 0.0 0.0))
(.PortCount ptr)
    3
(.PortDescriptors ptr)
    (5 9 10)

plus the various constants to pick out bits from these descriptors:

(logand (cadr (.PortDescriptors ptr)) LADSPA_PORT_INPUT)
    1


The plugin functions are callable via ladspa-activate etc -- the list is
in grfsnd.html (I haven't actually tested these yet -- will write an
example over the weekend).