ALSAPAS

ALSAPAS

(ALSA Library Bindings for Pascal)

Version 0.9.7, September 2003
Copyright (c) 2002-2003, Pedro Lopez-Cabanillas < plcl@bigfoot.com >

Esta página está disponible en español

Introduction

This package is a Pascal language translation of the ALSA library header files (*.h), version 0.9.7

ALSA is the acronym of "Advanced Linux Sound Architecture" that allows you to use digital audio and MIDI devices in Linux systems. To get more information, see http://www.alsa-project.org/

Using this translation you can make Pascal programs that take advantage of the ALSA functionalities. Currently working compilers are:

Download

How to use

As far as I know, ALSA exists only in Linux. This means that does not have sense to use this unit in Delphi for Windows programs, or in Free Pascal programs for other operating systems.

Add the following clause to the sources that need to use ALSA:

    uses asoundlib;

Often will be necessary to also include the following line:

    uses Libc; { Kylix 3 and Free Pascal Compiler 1.0.10 }

You can use conditional compile directives in your program, if needed.

    {$IFDEF FPC}
{ some code for Free Pascal Compiler only }
{$ELSE}
{ some code for Borland Kylix }
{$ENDIF}

For additional information, see the "examples" directory. The ALSA API library documentation is included in the ALSA packages and is also available online, at http://www.alsa-project.org/alsa-doc/alsa-lib/

Compiling and installing

This package does not use GNU/autoconf, but fpcmake. In the distribution there are already included the generated Makefiles, along with the Makefile.fpc files that you can customize. In order to regenerate the Makefiles, execute the following command in each distribution's directory:

$ fpcmake

To automatically compile the unit with Free Pascal Compiler:

$ make

To compile the examples, using Free Pascal Compiler:

$ make examples

To install:

$ make install
$ make install_examples

Borland Kylix compiler can be used also:

$ source /path_to/kylix3/bin/kylixpath
$ make kylix
$ make kylix_examples

For further information on fpcmake, make and the syntax of the Makefile.fpc files, see the document "prog.pdf" that belongs to the Free Pascal Compiler documentation package.

Main differences with C headers

I have tried to make the most exact translation possible; nevertheless, due to different circumstances, small differences exists.

Macros not translated

Except for <seqmid .h> macros, that due to their importance has been completely translated implementing them as functions, other macros declared in the original headers have been omitted, because several reasons. Particularly, it is not possible to use the snd_XXXX_alloca macros. In order to assign memory and to obtain pointers to one of the library hidden data structures, you have to use the functions  snd_XXXX_malloc/snd_XXXX_free .

Name changes

In some cases, I have had to change the name of certain functions, due to the existence of duplicated symbols and to the case insensibility of Pascal language. These are the changed functions:

Header Original Name (C) New name (Pascal)
control.h 'snd_ctl_nonblock' snd_ctl_set_nonblock
pcm.h 'snd_pcm_nonblock' snd_pcm_set_nonblock
pcm.h 'snd_pcm_format_float' snd_pcm_format_is_float
rawmidi.h 'snd_rawmidi_nonblock' snd_rawmidi_set_nonblock
seq.h 'snd_seq_nonblock' snd_seq_set_nonblock

Because of Pascal reserved words clashing, some symbols had changed:
Inside the structure snd_seq_event (seq_event.h/seq_eventh.inc), the field "type" has been translated as "_type" (event type).
In snd_seq_ev_loop (seq_event.h/seq_eventh.inc), the field "end" has been translated as "_end" (loop end in samples).

Headers nontranslated

The header files "conv.h" and "iatomic.h" have not been translated. Only a small part of "global.h" has been translated.

Example programs

The following programs are included in the distribution, within the directory "examples".

testctl.pas Translation of the program: alsa-lib/test/control.c
testimer.pas Translation of the program: alsa-lib/test/timer.c
testpcm1.pas Outputs a simple sound using the PCM interface. Based on chapter 2 of the document "alsa090 howto" by Matthias Nagorni.
testpcm2.pas Mini FM Synth. Shows the combined use of PCM and MIDI sequencer. Translation of the program "miniFMsynth.c" of "alsa090 howto" by Matthias Nagorni
testraw1.pas Outputs a single note, using the "RawMIDI" interface.
testraw2.pas Reads and writes MIDI data, using the ALSA native "RawMIDI" interface and the OSS compatibility mode. Translation of the program: alsa-lib/test/rawmidi.c
testseq1.pas MIDI Monitor. Shows how to capture input events using ALSA MIDI sequencer. Based on chapter 4 (seqdemo.c) of the document "alsa090 howto" by Matthias Nagorni.
testseq2.pas Shows the ALSA MIDI sequencer's client list.

Thanks and License

Thanks to the ALSA development team.

Thanks to Dr. Matthias Nagorni. Several example programs are based on his tutorial "alsa090 howto" ( http://www.suse.de/~mana/alsa090_howto.html )

Thanks to the Free Pascal Compiler development team.

Copyright (c) 2002-2003, Pedro Lopez-Cabanillas <plcl@bigfoot.com>

This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

NO WARRANTY

BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.

IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.