<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>jd&#039;s &#187; multiseat linux</title>
	<atom:link href="http://disjunkt.com/jd/t/en/multiseat-linux/feed/" rel="self" type="application/rss+xml" />
	<link>http://disjunkt.com/jd</link>
	<description>/usr/[misc&#124;share]/*</description>
	<lastBuildDate>Thu, 09 Jan 2014 13:35:17 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>multiseat linux : system-wide pulseaudio for routing sounds</title>
		<link>http://disjunkt.com/jd/2010/en/multiseat-linux/multiseat-linux-system-wide-pulseaudio-for-routing-sounds-109/</link>
		<comments>http://disjunkt.com/jd/2010/en/multiseat-linux/multiseat-linux-system-wide-pulseaudio-for-routing-sounds-109/#comments</comments>
		<pubDate>Tue, 20 Apr 2010 22:19:57 +0000</pubDate>
		<dc:creator>jd</dc:creator>
				<category><![CDATA[multiseat linux]]></category>

		<guid isPermaLink="false">http://disjunkt.com/jd/?p=109</guid>
		<description><![CDATA[When using a multi-seat linux &#8211; multiseat : I really mean there are several users using one machine with numerous keyboards, mice and screens, each user having its own X at the same time &#8211; it used to be rather difficult to route sounds towards the proper output devices, or even to share the (very [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://disjunkt.com/jd/wp-content/uploads/2010/04/dualh2.jpg"><img src="http://disjunkt.com/jd/wp-content/uploads/2010/04/dualh2.jpg" alt="many users - one machine" title="dualh2" width="290" height="230" class="alignright size-full wp-image-126" /></a></a>When using a multi-seat linux &#8211; <em>multiseat : I really mean there are several users using one machine with numerous keyboards, mice and screens, each user having its own X at the same time</em> &#8211; it used to be rather difficult to route sounds towards the proper output devices, or even to share the (very often only) available sound card ; <strong><em>pulseaudio system-wide daemon</em></strong> is an elegant solution &#8230;</p>
<p>Obviously any process wants its  own sound device. That&#8217;s why sound servers were introduced after the inititial oss design. From the past, I used to tweak <a href="http://disjunkt.com/dualhead/bruby-dualhead.html">multiseat configs</a> a lot with every last trend of sound servers, oss, esd, alsa, even tried jackd which isn&#8217;t really suited for general use. Finally, when I switched from debian to ubuntu for desktop use, I took a glance at pulseaudio.</p>
<p>Pulseaudio has one main point against the others : it is ubuntu&#8217;s current choice and it comes with a rather simple and convenient front-end for setting processes sound-volume individually (pavucontrol &#8211; Pulse Audio Volume Control).</p>
<p>With the multiseat constraints, I could not get a decent stable system keeping the initial <em>per-user</em> design ; this document mainly details most tricks needed to switch from a <em>per-user</em> to a <em>system-wide</em> pulseaudio daemon.</p>
<h3>/etc/default/pulseaudio</h3>
<p>The system-wide daemon is started once for all at the starting of the machine by it&#8217;s <strong>/etc/init.d/pulseaudio</strong> startup script.</p>
<pre>PULSEAUDIO_SYSTEM_START=1</pre>
<h3>/etc/group</h3>
<p>One main trouble when sharing sound devices is all those old binaries that try to steal <strong>/dev/dsp</strong> one to each other, but the same trouble may occur on <strong>/dev/snd/*/*</strong> device files ; that&#8217;s why I finally choosed to</p>
<ul>
<li>remove all users from <strong>audio</strong> group except <strong>pulse</strong></li>
<li>put back all users into <strong>pulse-access</strong> group</li>
</ul>
<p>this way, stealing to each other is much more difficult (though pulseaudio daemon is a setuid application so some more has to be done, see below).</p>
<h3>/etc/pulse/system.pa</h3>
<pre>load-module module-alsa-sink device="front:Intel" sink_name=global
load-module module-remap-sink sink_name=big channels=2 channel_map=right,left master_channel_map=right,left remix=no
load-module module-remap-sink sink_name=small channels=2 channel_map=right,left master_channel_map=rear-left,rear-right remix=no
; those three lines permit splitting a unique common multi-channel sound card to a pair of stereo sinks
; one using the front jack, the other the rear output jack.

.../...

# pulseaudio system-wide deamon keep the sound card for himself ...
# load-module module-suspend-on-idle</pre>
<h3>/etc/pulse/daemon.conf</h3>
<pre># on my box, 2.6.33 introduced some troubles around there ...
no-cpu-limit = yes
# this one is for enabling four channel on the global sink (for watching movies ?)
default-sample-channels = 4</pre>
<h3>/etc/pulse/client.conf</h3>
<pre>; don't let user launch pulseaudio deamons at need, there's already one
autospawn=no</pre>
<h3>/etc/profile.d/pulseaudio-client.sh</h3>
<p>as the environment variable <strong>$PULSE_SINK</strong> takes precedence over global or file tunings, another entry into <strong>/etc/profile.d</strong> sounds efficient :</p>
<pre>#!/bin/sh

# in oder to match a screen-set to a pulseaudio sink :
# pour le cas ou l'on veut faire correspondre a un terminal un canal pulseaudio :
if [ "$DISPLAY" ]
then
    if [ "$DISPLAY" = ":0" ]
    then
        PULSE_SINK="big"
    fi
    if [ "$DISPLAY" = ":1" ]
    then
        PULSE_SINK="small"
    fi
fi</pre>
<p>this script has to be usable by anyone :</p>
<pre># chmod 755 /etc/profile.d/pulseaudio-client.sh</pre>
<h3>update all ~users/.asoundrc</h3>
<p>I confess I&#8217;m not (yet) sure for that one, I should start over with a clean ubuntu to check about it, anyway it shouldn&#8217;t hurt much : for each user, play :</p>
<pre>&gt; asoundconf set-pulseaudio</pre>
<p>in order to get a default <em>alsa</em> mapping to <em>pulse</em>.</p>
<h3>~/.pulse/client.conf</h3>
<p>Any user may have its own additional settings, but should take care of eventually erasing the <strong>$PULSE_SINK</strong> var if needed (for example, my children have sound following their seats whilst I always have the big loudspeakers).</p>
<pre>default-sink=small
; probablement mieux de ne pas avoir de pulseaudio lancés par les users
autospawn=no</pre>
<h2>there we are</h2>
<p>Eventually <strong>/etc/group</strong> changes won&#8217;t be effective before X-session endings, the system-wide daemon has to be launched after killing anything in the way to soundcards, but at this point things should work, no more &#8220;release the sound for me please&#8221; battleground !</p>
]]></content:encoded>
			<wfw:commentRss>http://disjunkt.com/jd/2010/en/multiseat-linux/multiseat-linux-system-wide-pulseaudio-for-routing-sounds-109/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
