Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Do I need DMIX?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Multimedia
View previous topic :: View next topic  
Author Message
OYTIS
n00b
n00b


Joined: 16 Aug 2010
Posts: 23

PostPosted: Wed Mar 20, 2013 8:51 pm    Post subject: Do I need DMIX? Reply with quote

Here's my problem: for some reason two processes can't play sound simultaneously. When some flash video is active in firefox I can't use mplayer and vice versa. Moreover, for several months I had no sound at all untill I launched 'lsof | grep "/dev/snd/seq"' and found that it was caught by timidity. This document says I don't need to setup dmix and it's enough just to add several strings to asound.conf. My asound.conf now looks like

Code:

pcm.!default {
    type hw
    card 2
}

pcm.dsp {
    type plug
    slave.pcm "dmix"
}

pcm.dmixer {
        type dmix
        ipc_key 1024
        ipc_key_add_uid 0
        ipc_perm 0660
}

ctl.!default {
    type hw           
    card 2
}



and the problem is still here. My sound card is Intel HDA (ATI SBx00 Azalia). Do you have any ideas about what can be done?
Thanks in advance.
Back to top
View user's profile Send private message
PaulBredbury
Watchman
Watchman


Joined: 14 Jul 2005
Posts: 7310

PostPosted: Wed Mar 20, 2013 9:14 pm    Post subject: Reply with quote

That config is wrong - it's setting the default PCM to NOT use dmix.

See config in my sig, for one that works.
_________________
Improve your font rendering and ALSA sound
Back to top
View user's profile Send private message
OYTIS
n00b
n00b


Joined: 16 Aug 2010
Posts: 23

PostPosted: Thu Mar 21, 2013 7:53 am    Post subject: Reply with quote

Looks like a great job, thanks!
I tried your config and the simplest config from here (just replacing hw:0,0 with hw:2,0) but the problem seems not to be that simple. Will continue reading.
Back to top
View user's profile Send private message
PaulBredbury
Watchman
Watchman


Joined: 14 Jul 2005
Posts: 7310

PostPosted: Thu Mar 21, 2013 12:08 pm    Post subject: Reply with quote

Yeah, it's still possible for apps to open the card in exclusive mode, using the ALSA API. To prevent that, I suppose there's 2 ways:

1. Set up the app so it plays nicely
2. Patch ALSA to disallow apps from playing nicely.

I've not heard of people going to the length of patching ALSA.

Use the speaker-test and fuser commands to determine which app is blocking the sound, then configure that app correctly.
Back to top
View user's profile Send private message
OYTIS
n00b
n00b


Joined: 16 Aug 2010
Posts: 23

PostPosted: Thu Mar 21, 2013 6:03 pm    Post subject: Reply with quote

I don't think it's about applications, I just can't configure alsa properly.
I tried to make my sound card be the first one by editing /etc/modprobe.d/alsa.conf but unfortunately my sound card from the point of view of linux kernel seems splitted into two, so the first place is always taken by "HD-Audio Generic" which uses the same module (snd_hda_intel) as the real card (HDA ATI SB) and produces no sound.

Code:

>> cat /proc/asound/cards
<<
 0 [Generic        ]: HDA-Intel - HD-Audio Generic
                      HD-Audio Generic at 0x90244000 irq 45
 1 [SB             ]: HDA-Intel - HDA ATI SB
                      HDA ATI SB at 0x90240000 irq 16
29 [ThinkPadEC     ]: ThinkPad EC - ThinkPad Console Audio Control
                      ThinkPad Console Audio Control at EC reg 0x30, fw unknown


I need to either make SB the first card (some suggest using PCI IDs in alsa.conf but I didn't find any information about how to do it) or make the card#1 the default one without disabling dmix. And I still have no idea about how to do it. :evil:
Back to top
View user's profile Send private message
PaulBredbury
Watchman
Watchman


Joined: 14 Jul 2005
Posts: 7310

PostPosted: Thu Mar 21, 2013 7:16 pm    Post subject: Reply with quote

That's the easy part! Look at these values in my sample config:
Code:
card 0
device 0
subdevice 0

Tweak those values.

Otherwise stated as "hw:0,0,0"
_________________
Improve your font rendering and ALSA sound
Back to top
View user's profile Send private message
OYTIS
n00b
n00b


Joined: 16 Aug 2010
Posts: 23

PostPosted: Thu Mar 21, 2013 7:43 pm    Post subject: Reply with quote

Yeah, I tried to replace "card 0" with "card 1" and "hw:0" with "hw:1" in your config and in a simpler one, but it seems not to work the simple way.
I have three programs using the sound: timidity, mplayer and flash plugin and every one disallows the other to use sound card.
Back to top
View user's profile Send private message
OYTIS
n00b
n00b


Joined: 16 Aug 2010
Posts: 23

PostPosted: Thu Mar 21, 2013 8:06 pm    Post subject: Reply with quote

OK, I tried the simplest one.

Code:
pcm.!default {
   type plug
   slave.pcm "dmixer"
    }

 
    pcm.dmixer  {
   type dmix
   ipc_key 1024
   slave {
       pcm "hw:1,0"
       period_time 0
       period_size 1024
       buffer_size 4096
       rate 44100
   }
   bindings {
       0 0
       1 1
   }
    }
    ctl.dmixer {
   type hw
   card 1
   }


Now I can launch mplayer and flash simultaneously, but timidity daemon still blocks all other processes. I use standard options -oS -iS.
Back to top
View user's profile Send private message
PaulBredbury
Watchman
Watchman


Joined: 14 Jul 2005
Posts: 7310

PostPosted: Thu Mar 21, 2013 8:22 pm    Post subject: Reply with quote

Then either fix the timidity daemon's ALSA code, or stop running it ;)

I stopped running the timidity daemon many years ago.
Back to top
View user's profile Send private message
OYTIS
n00b
n00b


Joined: 16 Aug 2010
Posts: 23

PostPosted: Thu Mar 21, 2013 11:44 pm    Post subject: Reply with quote

Oh, I got it.
Timidity daemon is launched under separate user, so you have to add "ipc_key_add_uid 0" to pcm.dmixer to make it work. Now everything is OK.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Multimedia All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum