Linux/ALSA and Q3A sound

Locked
^misantropia^
Posts: 4022
Joined: Sat Mar 12, 2005 6:24 pm

Linux/ALSA and Q3A sound

Post by ^misantropia^ »

Cross-posted from http://www.forumplanet.com/planetquake/

I've been trying to get Q3A working with ALSA on Linux. All is well when it's only the game using the sound card. However, if it has to share the device with (for instance) xmms, it starts up fine but fails to initialize and produce sound[1]. Q3A uses OSS which is deprecated but still supported by ALSA... if it didn't mmap() the device into memory. I've tried redirection to /dev/adsp[2] with +set snddevice /path/to/device: still no sound but it *does* initialize. This is what s_info says:

----- Sound Info -----
1 stereo
32768 samples
16 samplebits
1 submission_chunk
22050 speed
0xb1d25000 dma buffer
No background file.
----------------------

Anyone an idea on how to fix this? I'd like to have some background music while watching demos.

[1] strace of Q3A using /dev/dsp:

open("/dev/dsp", O_RDWR) = -1 EBUSY (Device or resource busy)

[2] strace of Q3A using /dev/adsp:

open("/dev/adsp", O_RDWR) = 140
mmap2(NULL, 65536, PROT_READ|PROT_WRITE, MAP_SHARED, 140, 0) = 0xb1d25000
disinteger
Posts: 20
Joined: Mon Jul 25, 2005 7:30 am

Linux/ALSA and Q3A sound

Post by disinteger »

Is sound card ISA, PCI, or Onboard? I am curious as I have issues with my onboard sound card and Linux/ALSA/Q3a.
^misantropia^
Posts: 4022
Joined: Sat Mar 12, 2005 6:24 pm

Post by ^misantropia^ »

PCI and (supposedly) fully supported by ALSA. Been experimenting with it a little. The only result so far has been me hanging my rig good. My first lockup in at least two years :(
disinteger
Posts: 20
Joined: Mon Jul 25, 2005 7:30 am

Post by disinteger »

I found some useful information here....
http://www.linuxquestions.org/questions ... ost1212950


Maybee it will help
^misantropia^
Posts: 4022
Joined: Sat Mar 12, 2005 6:24 pm

Post by ^misantropia^ »

Thanks, disinteger. I tried that already and with little success, unfortunately. When Q3A has full access to the card, everything is working dandy. It's the mixing with other sound apps that's causing trouble. Welcome to the boards, btw :)
disinteger
Posts: 20
Joined: Mon Jul 25, 2005 7:30 am

Post by disinteger »

After I installed my alsa driver, library, and utility packages, I had to

chmod a+rw /dev/dsp /dev/mixer /dev/sequencer /dev/midi

The sound worked under q3, but after about 1/2 hr of play, the whole sys spontaneously shut down and *tried* to reboot.

:icon28:

Shame I didnt get to try and test some background music.

Anyways, Im back to the drawing board, ty for the welcome!
disinteger
Posts: 20
Joined: Mon Jul 25, 2005 7:30 am

Linux/ALSA and Q3A sound

Post by disinteger »

Well, looks like the crash I had was 80Gb WD hard drive giving up the ghost...

I replaced drive, reinstalled slackware 10.1, switched to kernel 2.6.10 with sound enabled and set for alsa module.

Then used alsa-driver-1.0.9b alsa-lib-1.0.9 and alsa-utils-1.0.9a

I was able to get sound from both q3 and for example the cd player simultaneously (although my onboard sound is not the best so there was some minor pausing in the gameplay).

I have yet only tested on point release 1.30 as of yet.
^misantropia^
Posts: 4022
Joined: Sat Mar 12, 2005 6:24 pm

Post by ^misantropia^ »

I'm using PR 1.32b-3 which works wonderfully except for sound. That is, it works but only with full access to the device, no mixing with other applications. CD audio works too, btw, but that's because of the drive-to-soundcard cable. What irks me is that with /dev/dsp (playback and recording) sound fails to initialize whereas /dev/adsp (playback only) works but produces no sound. See also my original post.

Yeah, WD drives. The two times I've bought on of those, they died after only six months or so. It's Maxtor these days and I haven't had problems since.
disinteger
Posts: 20
Joined: Mon Jul 25, 2005 7:30 am

Post by disinteger »

http://www.linuxquestions.org/questions ... ost1630469

Read this post then scroll down to post number 8.

It has a link in it that sounds like what you are talking about.

Hope this helps.

Edit.

copy of possible solution?
There's not an easy fix. This example shows exactly the broken API design
as OSS. We don't know at open time, if application requests the device for
read or write or duplex operation, so we assume that all directions are
wanted. There is no /dev/adsp device for EMU10K1.

Anyway, we have proc interface where you can tell to driver that only
playback is wanted. Try this:

% echo "quake 0 0 direct" > /proc/asound/card0/pcm0p/oss
% echo "quake 0 0 disable" > /proc/asound/card0/pcm0c/oss

Replace quake with real application name (use ps command to determine it
at runtime).

Jaroslav


So, what I did was put those to commands (quake3.x86 instead of quake) in my local.start bootup script, and voila, now alsa knows that quake3 will not come along and request full duplex or something during runtime. Works fine !!

pwk.linuxfan

PS: emu10k1 doest have /dev/adsp

--------------------------------------------------------------------------------
disinteger
Posts: 20
Joined: Mon Jul 25, 2005 7:30 am

Post by disinteger »

Prior to installing the modules listed below, I used my kernel menu program to set EVERYTHING I could that possibly had to do with sound (for both alsa and oss) for module loading, then re-compiled my kernel (2.6.10)

After booting new kernel, I used these modules:

alsa-driver-1.0.9b
alsa-lib-1.0.9,
alsa-utils-1.0.9a
alsa-oss-1.0.9

This lets me stream audio while playing q3/d3

*note* I was unable to get the alsa-plugins-1.0.9 and alsa-tools-1.0.9 to install. (something about jack it said I think)

Maybe this info might help you solve your problem if you haven't already.

gl

*note* I have not thoroughly tested XMMS on my system... I'm currently using RealAudio player to stream audio thru Mozilla web browser....
The sign of the cross I carry to WAR!

!Praise the Lowered and pass the ammunition!
^misantropia^
Posts: 4022
Joined: Sat Mar 12, 2005 6:24 pm

Post by ^misantropia^ »

Thanks, I'll give it a spin. My kernel has been stripped from nearly everything so that may very well be the cause.
Locked