[fpc-pascal] Re: Linux sound (especially MIDI) programming: ALSA?

Mark Morgan Lloyd markMLl.fpc-pascal at telemetry.co.uk
Tue May 15 13:15:27 CEST 2012

Mark Morgan Lloyd wrote:
> leledumbo wrote:
>> http://sourceforge.net/projects/fpalsa/
>> http://sourceforge.net/projects/humus/
> Thanks for those. Also 
> http://perso.wanadoo.es/plcl/alsapas/alsapas-en.html so as I thought 
> there appears to be (at least) two sets of ALSA bindings: fpalsa and 
> alsapas.
> Noted HuMuS, but that appears to be for PortAudio. However using that as 
> a seed I get to http://breakoutbox.de/pascal/pascal.html#PortAudio which 
> claims to include PortMidi support- this is supposedly cross-platform 
> but requires an additional library which might not be available on all 
> distreaux. Also MIDI is very much the "poor cousin" and operating 
> support is patchy, so since I've got ALSA working I'm reluctant to risk 
> breaking anything.
> Since running on anything other than Linux is not a significant 
> priority, I think I'll probably start off with by doing a comparison of 
> fpalsa and alsapas, and writing code that will support either if 
> possible. If I could also code to support PortMidi that would be a 
> bonus, but by no means essential: I'm trying to knock together a MIDI 
> transposer for my own use, and testbed some techniques for another project.

To wrap this up, alsapas is a translation of the ALSA headers etc. as of 
v0.9.7, and fpalsa is similar but corresponds to the slightly later 
v1.0.24. They have a slightly different style in that alsapas uses 
variable parameters while fpalsa uses pointers to be a bit closer to the 
original (and possibly to allow null parameters); alsapas is attractive 
in that it's got useful examples.

As far as MIDI is concerned, alsapas still works but there's a handful 
of parameters named "out" that are no longer compatible with FPC, I've 
followed the author's convention and renamed those to _out; basic 
operation appears OK on Debian "Squeeze" x86 with a 3.2 kernel.

Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]

More information about the fpc-pascal mailing list