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

next in thread | previous in thread | raw e-mail | index | archive | help
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Stuart Barkley wrote:
> 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).

This is going to sound like I'm being cute, but believe me, I'm not ... I
don't know what it means to use the snd_hda, I mean, when I run this alone,
I see no sound devices pop up for me to vector sound in/out to.  Because of
that, I went ahead and also ran oss.  If you can tell me how to run the
snd_hda alone, I will try it immediately.

> 
>> 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"
> 

OK.  lsof gave me the return:
gam_serve 28160 chuckr  390r    VREG        0,104       2255 2008768
/usr/local/share/mimelnk/audio/x-adpcm.desktop

I think that's not opening pcm or dsp directly, but I found the process
owned by gam_server, and sent it a HUP, but that only resulted in 3
gam_server processes.  Trying to kill them gave me 5 gam_servers, after
which I abandoned that strategy.  Anyhow, lsof didn't show anything opening
 pcm or dsp directly.

> 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

Man, I really hate to play with things that I don't know how they work.
The only docs I have been able to find on any of the vchan stuff is that
section 7.2.3 of the manual, which is a whole long way from being complete.
 Even giving a really complete discription of the sysctl oids inside hw.snd
would be helpful.  Like, I just tried doing "sysctl -a | grep hw.snd" and
sysctl tells me it hasn't got any such oid.  Great.

I have no docs, and sysctl tells me it hasnt' any such oid.  I'm afraid if
I just experiment blindly in /etc/sysctl with what you're showing me, I
might be blowing things up, but I don't see a lot of choice.

You know, when I tried running sound and snd_hda alone, I found no sound
type devices in /dev.  the snd_hda man page doesn't tell me which ones to
look for, could yo umaybe offer me some help in that direction?  I begin to
wonder if I shouldn't be runnig snd_hda and oss together.

Maybe, I am going to have to sit and read all the code.

> 
> 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

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.4 (FreeBSD)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHhSMgz62J6PPcoOkRApuTAJ9ubsdhSPTyBINaSVAlal8SgaN70wCeIFUJ
pw+fqqsSWTRicSZ8bTvqwkQ=
=DOXM
-----END PGP SIGNATURE-----



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