<?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>spoofedpacket &#187; Multimedia</title>
	<atom:link href="http://www.spoofedpacket.net/index.php/category/multimedia/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.spoofedpacket.net</link>
	<description></description>
	<lastBuildDate>Thu, 22 Dec 2011 17:08:47 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Virtual sound channels in FreeBSD</title>
		<link>http://www.spoofedpacket.net/index.php/2007/04/11/virtual-sound-channels-in-freebsd/</link>
		<comments>http://www.spoofedpacket.net/index.php/2007/04/11/virtual-sound-channels-in-freebsd/#comments</comments>
		<pubDate>Wed, 11 Apr 2007 12:09:06 +0000</pubDate>
		<dc:creator>rob</dc:creator>
				<category><![CDATA[FreeBSD]]></category>
		<category><![CDATA[Multimedia]]></category>

		<guid isPermaLink="false">http://www.spoofedpacket.net/index.php/2007/04/11/virtual-sound-channels-in-freebsd/</guid>
		<description><![CDATA[Following on from my earlier post about nspluginwrapper and Firefox; I noticed that the plugin likes to keep its file handles open even after you&#8217;ve finished viewing a flash-based site. This is a bit of an issue with things like the sound device &#8211; /dev/dsp0: [rob@tachikoma] >> fstat &#124; grep dsp rob mplayer 80327 9&#8230;]]></description>
			<content:encoded><![CDATA[<p>Following on from my earlier <a href="http://www.spoofedpacket.net/index.php/2007/04/05/nspluginwrapper/">post</a> about nspluginwrapper and Firefox; I noticed that the plugin likes to keep its file handles open even after you&#8217;ve finished viewing a flash-based site. This is a bit of an issue with things like the sound device &#8211; /dev/dsp0:</p>
<p><code><br />
[rob@tachikoma] >> fstat | grep dsp<br />
rob      mplayer    80327    9 /dev         45 crw-rw-rw-  dsp0.1  w<br />
rob      npviewer.bin 80305   63 /dev         42 crw-rw-rw-  dsp0.0 rw<br />
rob      npviewer.bin 80299   63 /dev         42 crw-rw-rw-  dsp0.0 rw<br />
</code></p>
<p>So if you happen to forget about this and go to play an mp3 or something later on, you&#8217;ll be left scratching your head. I didn&#8217;t feel like running a sound daemon like esound or arts, luckily FreeBSD has a kernel-based solution to this problem in the form of virtual sound channels which can be configured using the standard sysctl MIBs.</p>
<p>So we&#8217;ll try to allocate out 4 virtual sound channels:</p>
<p><code><br />
[rob@tachikoma] >> sudo sysctl hw.snd.pcm0.vchans=4<br />
hw.snd.pcm0.vchans: 0<br />
sysctl: hw.snd.pcm0.vchans: Device busy<br />
</code></p>
<p>Oops, of course we must first close any programs that are using the sound card.</p>
<p><code><br />
[rob@tachikoma] >> sudo sysctl hw.snd.pcm0.vchans=4<br />
hw.snd.pcm0.vchans: 0 -> 4<br />
[rob@tachikoma] >> sudo sysctl hw.snd.maxautovchans=4<br />
hw.snd.maxautovchans: 0 -> 4<br />
</code></p>
<p>hw.snd.pcm0.vchans is the number of virtual channels pcm0 has and hw.snd.maxautovchans is the number of virtual channels given to new devices. All the virtual channels are automagically allocated using devfs.</p>
<p>I was then able to view flash sites, and open up audio applications afterwards without any problems &#8211; I&#8217;m starting to see the benefits of the move to devfs <img src='http://www.spoofedpacket.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.spoofedpacket.net/index.php/2007/04/11/virtual-sound-channels-in-freebsd/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

