[Lxc-users] LXC - ALSA & Audio in container
TuxRaiderPen
tuxraiderpen at wpascanner.com
Thu Aug 15 18:32:08 UTC 2013
In my quest to expand LXC use beyond my current use and possibly solve a
little niche item for myself...
After seeing a thread about using a certain VOIP/web cam package inside a LXC
conatiner I am curious about how this might play out for my little area.
So...while using something like screen in some cases or any or all might be
simpler and less cumbersome solution... LXC offers a little bit more of a
regimented and segmented method whereby each little operation is in its own
little world (container)....
The thread about the the VOIP/webcam program mentioned about giving access to
devices....
With that in mind...and one other caveat pulseaudio is OUT, VERBOTEN,
PROHIBITED, WILL NOT TOUCH MY SYSTEMS EVER! This is one of the first things I
remove... it just doesn't work.
Since another thread mentions that sharing an ALSA device is not going to work
and would violate the above..
http://www.jonnor.com/2010/03/hardware-passthrough-in-lxc-or-running-a-
desktop-in-a-cgroup/
http://www.mail-archive.com/lxc-users@lists.sourceforge.net/msg01107.html
Ok... having each container have its own little USB audio device is fine..
So what needs to be in the LXC container conf to allow this... I reviewed one
for arch... but I don't use that, and it is honestly above my pay grade...
http://pastebin.com/yjDMLppn
Setup:
LXC Host Kubuntu 12.04 LTR ALSA ONLY! LXC 0.7.5 minimum
LXC containers would be the standard
lxc-create -n Audio1 -t ubuntu
lxc-create -n Audio2 -t ubuntu
Where the HOST audio -> LXC HOST - No change HW: 0,1
Audio1 = ALSA HW 1,1
Audio2= ALSA HW 2,1
etc...
If there was a chance to use the HOST audio device ala :
/etc/asound.conf
pcm.onboard{
type hw
card 0
}
ctl.onboard {
type hw
card 0
}
### Dsnoop both channels
pcm.dsnoop_onboard {
type dsnoop
ipc_key 32
slave {
pcm "onboard"
channels 2
period_size 320
rate 48000
buffer_size 8192
format S32_LE
}
bindings {
0 0
1 1
}
}
### Dsnoop splited channels
pcm.onboard_left {
type dsnoop
ipc_key 32
slave {
pcm "onboard"
channels 2
}
bindings.0 0
}
pcm.onboard_right {
type dsnoop
ipc_key 32
slave {
pcm "onboard"
channels 2
}
bindings.0 1
}
### PLUGS ##
### used with darkice
### device = plug:plug_onboard_left
pcm.plug_onboard_left{
type route
slave.pcm "onboard_left"
slave.channels 1
ttable.0.0 1
}
pcm.plug_onboard_right{
type route
slave.pcm "onboard_right"
slave.channels 1
ttable.0.0 1
}
where then
plug_onboard_left = mic in on LXC Audio1
plug_onboard_right = mic in on LXC Audio2
and if I were to do the following (untested)
pcm.onboard{
type hw
card 1
}
ctl.onboard {
type hw
card 1
}
create say pcm.plug_onboard_rt and pcm_plug_onboard_lt etc
where
plug_onboard_rt = mic in ALSA LXC Audio3
pcm_plug_onboard_lt = mic in ALSA LXC Audio4
etc...
Any one doing any routing of sound devices to LXC containers ?? ?
Thanks in advance.
More information about the lxc-users
mailing list