# HDA Intel (82801G) usable only by one process at the time

## Zucca

```
 # lspci | grep Audio

00:1b.0 Audio device: Intel Corporation 82801G (ICH7 Family) High Definition Audio Controller (rev 02)
```

I assume that my model is ALC883.

```
# cat /proc/asound/pcm 

00-06: Si3054 Modem : Si3054 Modem : playback 1 : capture 1

00-02: ALC883 Analog : ALC883 Analog : capture 2

00-00: ALC883 Analog : ALC883 Analog : playback 1 : capture 2
```

So I did this:

```
modprobe -r snd-hda-intel && modprobe snd-hda-intel model=ALC883
```

... but no affect. I can play sound but only one process can use my card at the time. With gens and dgen (Sega Megadrive emulators) sound is distorted a bit and the game itself is slowed down a bit because of this. I've tested with sound turned off and emulation works just fine. Strange thing is that with Generator emulator this does not affect. Game plays smoothly.

Any clues?

----------

## eccerr0r

Are you using native alsa applications, or are you using OSS emulation with your apps?  Or perhaps some other userland sound API (esound/arts/jack? etc.?)

I've found that it will auto-mix (dmix?) if I use all ALSA apps.  OSS doesn't seem to work for multiple-open, even under using ALSA emulation.

----------

## Zucca

Nope. Just ALSA, expect my KDE system sounds use Arts.

EDIT: I did some investigating:

```
# /etc/init.d/alsasound --verbose --debug restart 2>&1 | egrep --color=auto -i 'intel|modprobe|rmmod|insmod'

++ PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/sbin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin:/usr/i686-pc-linux-gnu/gcc-bin/4.1.2:/opt/intel/cc/10.0.026/bin:/opt/blackdown-jdk-1.4.2.03/bin:/opt/blackdown-jdk-1.4.2.03/jre/bin:/usr/kde/3.5/sbin:/usr/kde/3.5/bin:/usr/qt/3/bin

+ local 'revdeps=snd_pcm_oss snd_mixer_oss snd_seq_oss snd_seq snd_seq_device snd_hda_intel snd_pcm snd_timer snd_hwdep'

+ rmmod --wait snd_pcm_oss

+ rmmod --wait snd_mixer_oss

+ rmmod --wait snd_seq_oss

+ rmmod --wait snd_seq_dummy

+ rmmod --wait snd_seq_midi_event

+ rmmod --wait snd_seq

+ rmmod --wait snd_seq_device

+ unload_modules_recursive snd_hda_intel

++ sed -n -e 's/,/ /g' -e 's/^snd_hda_intel *[0-9]* *[0-9]* \(.*\)/\1/p'

+ vebegin 'Unloading: snd_hda_intel'

+ ebegin 'Unloading: snd_hda_intel'

+ local 'msg=Unloading: snd_hda_intel' dots spaces=

+ msg='Unloading: snd_hda_intel ...'

+ einfon 'Unloading: snd_hda_intel ...'

+ echo -ne ' *   Unloading: snd_hda_intel ...'

 *   Unloading: snd_hda_intel ...+ LAST_E_CMD=einfon

+ rmmod --wait snd_hda_intel

+ rmmod --wait snd_pcm

+ rmmod --wait snd_timer

+ rmmod --wait snd_hwdep

+ rmmod --wait snd

+ rmmod --wait snd_page_alloc

++ modprobe -c

++ modprobe -l

++ modprobe -l

++ modprobe -l

+ modprobe snd-card-0

+ modprobe snd-seq-oss

+ modprobe snd-pcm-oss
```

It looks to me that not all the required modules aren't loaded. Right?

----------

## Zucca

I read /usr/src/linux/Documentation/sound/alsa/ALSA-Configuration.txt

Here's a part of it:

```
   ALC883/888

     3stack-dig   3-jack with SPDIF I/O

     6stack-dig   6-jack digital with SPDIF I/O

     3stack-6ch    3-jack 6-channel

     3stack-6ch-dig 3-jack 6-channel with SPDIF I/O

     6stack-dig-demo  6-jack digital for Intel demo board

     acer      Acer laptops (Travelmate 3012WTMi, Aspire 5600, etc)

     acer-aspire   Acer Aspire 9810

     medion   Medion Laptops

     medion-md2   Medion MD2

     targa-dig   Targa/MSI

     targa-2ch-dig   Targs/MSI with 2-channel

     laptop-eapd   3-jack with SPDIF I/O and EAPD (Clevo M540JE, M550JE)

     lenovo-101e   Lenovo 101E

     lenovo-nb0763   Lenovo NB0763

     lenovo-ms7195-dig Lenovo MS7195

     haier-w66   Haier W66

     6stack-hp   HP machines with 6stack (Nettle boards)

     3stack-hp   HP machines with 3stack (Lucknow, Samba boards)

     auto      auto-config reading BIOS (default)
```

I have Acer Aspire 9522WSMi (9520 series).

Audio connectors I have in this model are:

FRONT: blue (line-in or out... not sure which), pink (mic), black (headphones AND spdif)

BACK: HDMI

Also: three built-in speakers (one of them, subwoofer :D) and two built in mics.

Right now nothing seems to affect the results. I've tested: 3stack-dig, 6stack-dig, acer, acer-aspire, laptop-eapd and auto. Each have the same results...

----------

## jcat

I would do some simple tests to determine if dmix is actually working, using some command line sound players like mpg321 or alsaplayer.  If you can't get 2 audio streams working then it suggest that dmix is broken.  Maybe these pages will help a little:

http://gentoo-wiki.com/HOWTO_ALSA/Software_dmix_Configurations

http://alsa.opensrc.org/index.php/Dmix

Cheers,

jcat

----------

## eccerr0r

Are you sure if ALL your applications (not DRIVER) are using ALSA or the OSS API, sure they're using ALSA?  OSS apps can run on both ALSA (with emulation) systems as well as their native OSS systems, but not vice versa - your drivers may be using ALSA but have OSS emulation running, just having the driver using ALSA is not sufficient to allow mixing to work.

One annoyance I've had in the past is that Macromedia/Adobe Flash player uses OSS and basically wreaks havoc on my ALSA system as it monopolizes my sound system.  I've worked around it so I'm not sure if it's been fixed yet.

On all my ALSA machines, one can run multiple apps like media-sound/mpg123 (make sure ALSA USE flag is set) and it will mix everything automatically.  Hint: ALSA apps should not be using /dev/dsp, /dev/dsp is a OSS-ism.  Even the user-mode mixers like aRts need to be aware and use ALSA to allow other ALSA programs to mix with them.

----------

## Zucca

- I can play (at least three, didn't test with more) different songs with mpg123 at the same time

- Amarok crashes when crossfading is enabled --> when skpipping a song --> "xine was unable to initialize any audio drivers" --> when hitting 'OK' the song changes without fading and starts to fade away immediately --> after fadeout occurs the crash

- While playing music with Amarok (or mplayer, flash... is using sound) dgen (Sega Genesis emulator) slows down

- If dgen "gets to use" the sound card, sound is still a bit distorted and fps is around 30 while sound disabled it gets close to 1000 fps at best, but over 60 in any case without sound

- Gens has same kind of sound distortion, but Generator doesn't (both emulatos too)

- If playing with mpg123 dgen can have a soundcard to play its sound and isn't slowed down, but fps stays around 30 once again

- If playing with amarok and trying to play with mpg123 this occurs:

```
ALSA lib pcm_dmix.c:996:(snd_pcm_dmix_open) unable to open slave

[alsa.c:146] error: cannot open device default

[audio.c:517] error: failed to open audio device

[mpg123.c:709] error: Failed to initialize output, goodbye.
```

So I assume dmix is working but it cannot handle some kind of more complex sound mixing?

----------

## jcat

The fact that you can play two audio streams at the same time using an alsa app indicates that dmix is working, so it looks to me like the problem lies elsewhere.

Is it possible this is a KDE mis-configuration?  I'm not overly familiar with KDE these days, maybe someone else can chime in..

Are your emulator apps configured to use ALSA or OSS?

Also, in Amarok, what "output plugin" have you configured for use with xine?

Cheers,

jcat

----------

## Zucca

Amarok uses alsa.

WHOA! OMG or something like that...

I just changed the xine-engine's settings:

It used alsa plughw:0,0 before (this setting worked on my older computer just fine) I changed it to use "default" device, and now it seems to work. At least fading with amarok works.

And I can play with dgen at the same time, but it's still a bit distorted. Hm. I shall test xmess if it runs better...

Now somebody explain me - Why plughw caused this kind of problems? I'm confused...

EDIT:

I edited /etc/modules.d/alsa and added line 

```
options snd-hda-intel model=3stack-dig
```

 (and ran update-modules).

In kmix (or in alsamixer) PCM slide really has some effect now.

It also works with acer and acer-aspire.

If you guys have any idea which one is the one for my laptop (Acer Aspire 9522WSMi - Aspire 9520 series)?

EDIT2:

When amarok starts to play a new song it plays for a very short time, then it pauses for about a same amout of time. After this it continues to play normally. Doesn't really matter, but might give some hints in solving sound distortion in dgen and gens.

----------

