Greg Berchin wrote: > > paul winkler wrote: > > >Sounds like a weird hack that would lose the whole point of using LADSPA > >in the first place (i.e. reusability by different applications and/or > >being able to use existing LADSPA hosts). > > Probably correct. I've seen weirder workarounds than this, though. I > don't like them, but they do occasionally have their place. Hang on - no such hack is necessary. Briefly: with a couple of typedef changes, LADSPA and Ecasound can use doubles instead of floats. So I'm going to suggest again that you not write code to deal with the soundcard driver at all; you can use Ecasound which provides a flexible framework for dealing with soundcards and setting up chains of DSP plugins. Then write your DSP as LADSPA plugins. This could save you an enormous amount of effort, if all your processing and control signal needs can be handled by LADSPA. Your black box could then just run ecasound using a boot-time shell script or python script to set up your processing chain. No UI necessary at all (though it would be nice to have some way to restart the processing program and/or cleanly reboot). Or you could, if necessary, write a new app using libecasound; it could still save you a lot of effort. More detail: Change the relevant line in ladspa.h to this: typedef double LADSPA_Data; /* was typedef float LADSPA_Data; */ I just tried that, did "make clean; make; make install" in my ladspa_sdk directory, and the tests ran fine. Cool. I thought "hmm, wonder if actual hosts can deal with that." I tried recompiling Ecasound (which includes from ladspa.h) ... got an error which was fixed by editing libecasound/sample_specs.h so that line 12 reads typedef double sample_type; Ecasound then compiles and runs using doubles instead of floats. Thank god for typedefs. So AFAICT I am now running ecasound using ladspa plugins at double precision... just tried an example which seems to be working: ecasound -i:null -t:5 -o:/dev/dsp \ -el:noise_white,1 -kos:1,0,1,2,0 \ -el:lpf,1 -kl:1,5000,0,5 Details are in the ecasound man page, but basically: the first line says to run with no input, for 5 seconds, output to /dev/dsp. The second line adds a ladspa plugin to generate white noise, and uses ecasound's built-in sine oscillator as a control signal for the noise amplitude. The last line then adds a ladspa low-pass filter plugin, and uses ecasound's built-in linear envelope to sweep the filter cutoff from 5000 hz to 0 hz in 5 seconds. I can't really answer any questions on how LADSPA plugins are written; I'd suggest you read the example plugins in the ladspa sdk, and maybe look at some of the other plugins linked from www.ladspa.org. Also check out Dave Phillip's overview on o'reilly.net ... http://linux.oreillynet.com/pub/a/linux/2001/02/02/ladspa.html -- ................... paul winkler .................... custom calendars & printing: http://www.calendargalaxy.com A member of ARMS: http://www.reacharms.com home page: http://www.slinkp.com
