Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 8 Jan 2008 20:10:19 -0500 (EST)
From:      Stuart Barkley <stuartb@4gh.net>
To:        Chuck Robey <chuckr@chuckr.org>
Cc:        freebsd-multimedia@freebsd.org
Subject:   Re: sound works, but how?
Message-ID:  <20080108193023.B70212@freeman.4gh.net>
In-Reply-To: <478409A4.60709@chuckr.org>
References:  <478409A4.60709@chuckr.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, 8 Jan 2008 at 18:39 -0500, Chuck Robey wrote:

> Anyhow, I have a Motherboard with a AD1988b sound chip (it's
> hda/Azalia). I have both the sound, snd_hda, and the oss sound kld'd
> in. and an ossinfo seems to like things,

Are you trying to use the FreeBSD sound system or the OSS sound system
(http://www.opensound.com)?  It sounds like you might be using the OSS
drivers (from the later reference to /dev/oss/hdaudio0/pcm0).

> As a GUI, I run gnome, and things like all the various gnome beeps,
> blips and moans come out as designed, so I think that a lot of sound
> works.

Some of the GUIs will grab /dev/dsp preventing other applications from
using it at the same time.  Is esound (esd) running?  Does anything
have /dev/dsp (or /dev/oss/hdaudio0/pcm0) open?  You might try:

    # lsof | egrep -i "dsp|pcm"

The FreeBSD drivers now support virtual channels which really helps
deal with multiple applications all wanting to bleep and groan.  I put
the following in /etc/sysctl.conf:

    hw.snd.maxautovchans=8
    hw.snd.targetirqrate=30
    hw.snd.verbose=2

I don't know if the OSS drivers support this functionality.

> My problem is, no other sound playing works now.  For instance, I
> used to be able to play mp3's with either xmms or mpg123, but now,
> they neither of them work. I've experimented with a pretty wide
> array of sound tools, nothing works.  The errors come in two flavors
> ... mostly, they complain that they weren't able to open the
> /dev/dsp0 which seems fine, it's a softlink here to
> /dev/oss/hdaudio0/pcm0,

Without virtual channel support this is the type of message you will
see if something already has the sound device open (under any of its
various names).

> [...]
>
> Am I using the right device, which is that dsp0 link, which is
> created by the oss driver? is that device able to be opened by both
> the GUI and othjer progs at the same time?

In general the best device to try is /dev/dsp (even if it doesn't show
as a file in /dev).

Without the FreeBSD virtual channel support the FreeBSD drivers will
only allow a single application to open the device at a time.

> Seems stupid not to allow the GUI to share the device, right?

It takes something to mediate the various sample rates, data bit
depths and mixing the digital data streams from multiple applications.
Audiophiles may not like the simple sample rate conversion performed
and many prefer not having that behavior on their high end devices.

FreeBSD virtual channels does this and doesn't require special support
in every application.  I've been a much happier camper since this
support has stabilized.

esound is another thing which attempts to do this, but all
applications need to be built against it.  It's possible you built
some ports before you built gnome and that they didn't all get rebuilt
with esound support.

> Am I right to run both snd_hda and the oss hda modules both at the
> same time?  Or should I use oss alone?

I suspect you should only be using one or the other.  I have not
recently tried the OSS drivers.

> I've tried this both as a regular user and as root, to get past the
> permission problem (I wasn't sure) but could it still, somehow, be a
> permission problem?

You should also try without any GUI running.  Either run from a
console window or ssh into the system from another system.  mpg123
will run from the command line.  With the virtual channel support you
should be able to run mpg123 in two different terminal sessions
playing two different files.

Stuart Barkley
http://www.4gh.net/tudor/resume.html
-- 
I've never been lost; I was once bewildered for three days, but never lost!
                                        --  Daniel Boone



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20080108193023.B70212>