0e27fc9c4b73a88aadb2d7e18424c383ba062ef7
[rrq/newlisp/alsa-dispatcher.git] / alsa-dispatcher.8.adoc
1 = alsa-dispatcher(8)
2 :doctype: manpage
3 :revdate: {sys:date "+%Y-%m-%d %H:%M:%S"}
4
5 == NAME
6
7 alsa-dispatcher - ALSA playback priority dispatcher for temporarily
8 connected playback endpoints.
9
10 == SYNOPSIS
11
12 *alsa-dispatcher.lsp*
13
14 == DESCRIPTION
15
16 *alsa-dispatcher.lsp* is an ALSA utility that handles dispatch of
17 audio playback via a priority list of possible endpoints. The dispatch
18 logic works through the list trying to open each ALSA PCM device in
19 order until one succeeds, and thereafter *alsa-dispatcher.lsp* simply
20 channels the playback audio stream from its standard input to the
21 successfully opened PCM playback device.
22
23 The program is a _newlisp_ script of manageable size which links up
24 with _libasound.so_ for ALSA API actions.
25
26 == CONFIGURATIONS
27
28 The system setup for using *alsa-dispatcher.lsp* includes two
29 configuration aspects:
30
31  1. The ALSA configuration collection needs to be augmented with a
32  _pcm_ block that directs playback to *alsa-dispatcher.lsp* and
33  capture from, say, _plughw_ (i.e., the primary sound card).
34
35  2. The priority list for *alsa-dispatcher.lsp* of posible endpoints
36  is a text file named _$HOME/.alsa-dispatcher_.
37
38 []
39
40 *ALSA configuration (e.g. $HOME/.asoundrc)*::
41
42 The ALSA configuration collection needs to include setup for
43 *alsa-dispatcher* as an ALSA PCM by means of e.g. a short declaration
44 in the user's _$HOME/.asoundrc_ file, or system-wide in
45 _/etc/asoundrc.conf_ The following is an example.
46 +
47 ----
48 pcm.!default dispatch
49
50 pcm.dispatch {
51     type asym
52     playback {
53         pcm "file:|exec /usr/local/bin/alsa-dispatcher.lsp"
54     }
55     capture plughw
56 }
57 ----
58 +
59 The first of those lines asserts that "dispatch" is the default
60 PCM.
61 +
62 The lines below declares the "dispatch" PCM to have its playback
63 stream directed via a pipe to the command
64 _/usr/local/bin/alsa-dispatcher.lsp_ (assuming that is where
65 *alsa-dispatcher.lsp* is), and its capture stream is sourced from
66 _plughw_ (i.e. the default sound card).
67
68 *About $HOME/.alsa-dispatcher*::
69
70 The possible endpoints are enumerated in _$HOME/.alsa-dispatcher_ with
71 one line for each PCM device: its name and optionally some specific
72 setting variation for that device in the form of _key=value_. Blank
73 lines and lines starting with "#" are comments. The following is an
74 example.
75 +
76 ----
77 bt
78 plughw
79 ----
80 +
81 The example _$HOME/.alsa-dispatcher_ nominates _bt_ as the first ALSA
82 PCM to try, and then _plughw_ as the second (and last). This suggest a
83 bluetooth device _bt_ that has priority when in use;
84 *alsa-dispatcher.lsp* will direct playback to _bt_ if it is in use and
85 otherwise fall back on _plughw_ (i.e. the default sound card).
86
87 == SEE ALSO
88
89 *newlisp*
90
91 == AUTHOR
92
93 Ralph Ronnquist <ralph.ronnquist@gmail.com>