To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.

The primary repository for this project is hosted at https://github.com/sonic-visualiser/sv-dependency-builds .
This repository is a read-only copy which is updated automatically every hour.

Statistics Download as Zip
| Branch: | Tag: | Revision:

root / src / portaudio_20161030_catalina_patch / doc / src / tutorial / compile_linux.dox @ 162:d43aab368df9

History | View | Annotate | Download (3.96 KB)

1
/** @page compile_linux Building Portaudio for Linux
2
@ingroup tutorial
3

    
4
<i>Note: this page has not been reviewed, and may contain errors.</i>
5

    
6
@section comp_linux1 Installing ALSA Development Kit
7

    
8
The OSS sound API is very old and not well supported. It is recommended that you use the ALSA sound API.
9
The PortAudio configure script will look for the ALSA SDK. You can install the ALSA SDK on Ubuntu using:
10

    
11
@code
12
sudo apt-get install libasound-dev
13
@endcode
14

    
15
You might need to use yum, or some other package manager, instead of apt-get on your machine.
16
If you do not install ALSA then you might get a message when testing that says you have no audio devices.
17

    
18
You can find out more about ALSA here: http://www.alsa-project.org/
19

    
20
@section comp_linux2 Configuring and Compiling PortAudio
21

    
22
You can build PortAudio in Linux Environments using the standard configure/make tools:
23

    
24
@code
25
./configure && make
26
@endcode
27

    
28
That will build PortAudio using Jack, ALSA and OSS in whatever combination they are found on your system. For example, if you have Jack and OSS but not ALSA, it will build using Jack and OSS but not ALSA. This step also builds a number of tests, which can be found in the bin directory of PortAudio. It's a good idea to run some of these tests to make sure PortAudio is working correctly.
29

    
30
@section comp_linux3 Using PortAudio in your Projects
31

    
32
To use PortAudio in your apps, you can simply install the .so files:
33

    
34
@code
35
sudo make install
36
@endcode
37

    
38
Projects built this way will expect PortAudio to be installed on target systems in order to run. If you want to build a more self-contained binary, you may use the libportaudio.a file:
39

    
40
@code
41
cp lib/.libs/libportaudio.a /YOUR/PROJECT/DIR
42
@endcode
43

    
44
On some systems you may need to use:
45

    
46
@code
47
cp /usr/local/lib/libportaudio.a /YOUR/PROJECT/DIR
48
@endcode
49

    
50
You may also need to copy portaudio.h, located in the include/ directory of PortAudio into your project. Note that you will usually need to link with the approriate libraries that you used, such as ALSA and JACK, as well as with librt and libpthread. For example:
51

    
52
@code
53
gcc main.c libportaudio.a -lrt -lm -lasound -ljack -pthread -o YOUR_BINARY
54
@endcode
55

    
56
@section comp_linux4 Linux Extensions
57

    
58
Note that the ALSA PortAudio back-end adds a few extensions to the standard API that you may take advantage of. To use these functions be sure to include the pa_linux_alsa.h file found in the include file in the PortAudio folder. This file contains further documentation on the following functions:
59

    
60
 PaAlsaStreamInfo/PaAlsa_InitializeStreamInfo::
61
  Objects of the !PaAlsaStreamInfo type may be used for the !hostApiSpecificStreamInfo attribute of a !PaStreamParameters object, in order to specify the name of an ALSA device to open directly. Specify the device via !PaAlsaStreamInfo.deviceString, after initializing the object with PaAlsa_InitializeStreamInfo.
62
 
63
 PaAlsa_EnableRealtimeScheduling::
64
  PA ALSA supports real-time scheduling of the audio callback thread (using the FIFO pthread scheduling policy), via the extension PaAlsa_EnableRealtimeScheduling. Call this on the stream before starting it with the <i>enableScheduling</i> parameter set to true or false, to enable or disable this behaviour respectively.
65
 
66
 PaAlsa_GetStreamInputCard::
67
  Use this function to get the ALSA-lib card index of the stream's input device.
68
 
69
 PaAlsa_GetStreamOutputCard::
70
  Use this function to get the ALSA-lib card index of the stream's output device.
71

    
72
Of particular importance is PaAlsa_EnableRealtimeScheduling, which allows ALSA to run at a high priority to prevent ordinary processes on the system from preempting audio playback. Without this, low latency audio playback will be irregular and will contain frequent drop-outs.
73

    
74
@section comp_linux5 Linux Debugging
75

    
76
Eliot Blennerhassett writes:
77

    
78
On linux build, use e.g. "libtool gdb bin/patest_sine8" to debug that program.
79
This is because on linux bin/patest_sine8 is a libtool shell script that wraps 
80
bin/.libs/patest_sine8  and allows it to find the appropriate libraries within 
81
the build tree.
82

    
83
*/