README.md
1TinyALSA
2========
3
4[![Build Status](https://travis-ci.org/tinyalsa/tinyalsa.svg?branch=master)](https://travis-ci.org/tinyalsa/tinyalsa)
5
6TinyALSA is a small library to interface with ALSA in the Linux kernel.
7
8The aims are:
9
10 - Provide a basic pcm and mixer API.
11 - If it's not absolutely needed, don't add it to the API.
12 - Avoid supporting complex and unnecessary operations, that could be
13 dealt with at a higher level.
14 - Provide comprehensive documentation.
15
16### Building
17
18TinyALSA supports these build systems:
19
20 - [CMake](https://en.wikipedia.org/wiki/CMake)
21 - [Make](https://en.wikipedia.org/wiki/Make_(software))
22 - [Meson](https://en.wikipedia.org/wiki/Meson_(software))
23 - [Soong](https://android.googlesource.com/platform/build/soong/+/refs/heads/master/README.md) for Android
24
25To build and install with Make, run the commands:
26
27```
28make
29sudo make install
30sudo ldconfig
31```
32
33### Installing
34
35TinyALSA is now available as a set of the following [Debian](https://en.wikipedia.org/wiki/Debian)
36packages from [launchpad](https://launchpad.net/~taylorcholberton/+archive/ubuntu/tinyalsa):
37
38| Package Name: | Description: |
39|-----------------|-----------------------------------------------------|
40| tinyalsa | Contains tinyplay, tinycap, tinymix and tinypcminfo |
41| libtinyalsa | Contains the shared library |
42| libtinyalsa-dev | Contains the static library and header files |
43
44To install these packages, run the commands:
45
46```
47sudo apt-add-repository ppa:taylorcholberton/tinyalsa
48sudo apt-get update
49sudo apt-get install tinyalsa
50sudo apt-get install libtinyalsa-dev
51```
52
53### Documentation
54
55Once installed, the man pages are available via:
56
57```
58man tinyplay
59man tinycap
60man tinymix
61man tinypcminfo
62man libtinyalsa-pcm
63man libtinyalsa-mixer
64```
65
66### Test
67
68To test libtinyalsa, please follow the instructions,
69
70#### Setup Bazel build environment
71
72Visit [here](https://docs.bazel.build/versions/3.7.0/install.html) to get more info to setup Bazel environment.
73
74#### Insert loopback devices
75
76The test program does pcm_* operations on loopback devices. You have to insert loopback devices after your system boots up.
77
78```
79sudo modprobe snd-aloop
80sudo chmod 777 /dev/snd/*
81```
82
83#### Run test program
84
85```
86bazel test //:tinyalsa_tests --test_output=all
87```
88
89The default playback device is hw:2,0 and the default capture device is hw:2,1. If your loopback devices are not hw:2,0 and hw:2,1, you can specify the loopback device.
90
91```
92bazel test //:tinyalsa_tests --test_output=all \
93 --copt=-DTEST_LOOPBACK_CARD=[loopback card] \
94 --copt=-DTEST_LOOPBACK_PLAYBACK_DEVICE=[loopback playback device] \
95 --copt=-DTEST_LOOPBACK_CAPTURE_DEVICE=[loopback capture device]
96```
97
98#### Generate coverage report
99
100```
101bazel coverage //:tinyalsa_tests --combined_report=lcov --test_output=all
102genhtml bazel-out/_coverage/_coverage_report.dat -o tinyalsa_tests_coverage
103```
104