Getting Audio from a Zone
Posted
by bleonard
on Oracle Blogs
See other posts from Oracle Blogs
or by bleonard
Published on Fri, 1 Jul 2011 07:39:26 -0700
Indexed on
2011/07/01
16:26 UTC
Read the original article
Hit count: 261
/Solaris
Now that I have Firefox and Java Web Start running from a zone, the last piece of the puzzle was audio (essential because most Flash content is accompanied by sound).
In the global zone there's a nice little utility called audiotest for testing your sound:
bleonard@solaris:~$ audiotest Sound subsystem and version: SunOS Audio 4.0 (0x00040003) Platform: SunOS 5.11 snv_151a i86pc *** Scanning sound adapter #1 *** /dev/sound/audio810:0dsp (audio engine 0): audio810#0 - Performing audio playback test... <left> ................OK <right> ...............OK <stereo> ..............OK <measured sample rate 47727.00 Hz (-0.57%)> *** All tests completed OK ***
Of course, before you can try audiotest in a zone, it must be installed:
root@myzone:~# pkg install audio-utilities Packages to install: 1 Create boot environment: No DOWNLOAD PKGS FILES XFER (MB) Completed 1/1 6/6 0.4/0.4 PHASE ACTIONS Install Phase 20/20 PHASE ITEMS Package State Update Phase 1/1 Image State Update Phase 2/2
However, we'll need to do more than just install audiotest:
root@myzone:~# audiotest /dev/mixer: No such file or directory The device file is missing from /dev.
The audio devices also need to be added to the zone. For this we modify the zone configuration as follows:
bleonard@solaris:~$ sudo zonecfg -z myzone Password: zonecfg:myzone> add device zonecfg:myzone:device> set match=/dev/audio* zonecfg:myzone:device> end zonecfg:myzone> add device zonecfg:myzone:device> set match=/dev/sound/* zonecfg:myzone:device> end zonecfg:myzone> add device zonecfg:myzone:device> set match=/dev/mixer* zonecfg:myzone:device> end zonecfg:myzone> add device zonecfg:myzone:device> set match=/dev/sndstat zonecfg:myzone:device> end zonecfg:myzone> verify zonecfg:myzone> exit
Then reboot the zone:
bleonard@solaris:~$ sudo zoneadm -z myzone reboot
After which, audiotest should work:
root@myzone:~# audiotest Sound subsystem and version: SunOS Audio 4.0 (0x00040003) Platform: SunOS 5.11 snv_151a i86pc *** Scanning sound adapter #1 *** /dev/sound/audio810:0dsp (audio engine 0): audio810#0 - Performing audio playback test... <left> ................OK <right> ...............OK <stereo> ..............OK <measured sample rate 48208.00 Hz (0.43%)> *** All tests completed OK ***
You can also examine /dev/sndstat for additional information:
root@myzone:~# cat /dev/sndstat SunOS Audio Framework Audio Devices: 0: audio810#0 Intel AC'97, ICH (DUPLEX) Mixers: 0: audio810#0 Intel AC'97, ICH AC'97 codec: SigmaTel STAC9700
However, when testing the sound from Firefox (from a user account other than root), such as this recent Flash presentation on Solaris availability, you may still be disappointed. This is simply a permissions problem, as the devices only have read and write permissions for root:
root@myzone:~# ls -l /dev/audio* crw------- 1 root root 99, 3 Jul 1 10:21 /dev/audio crw------- 1 root root 99, 4 Jul 1 10:21 /dev/audioctl
To address this:
root@myzone:~# chmod 777 /dev/audio* root@myzone:~# chmod 777 /dev/sound/*
And you should be all set.
© Oracle Blogs or respective owner