You are not logged in.

#1 2011-05-07 00:10:54

maxshaw
Member
Registered: 2011-04-16
Posts: 6

[SOLVED] ALSA - sound limited to one source at a time

I've recently had to switch from OSS4 to ALSA (due to some programs not supporting the former) and have since been unable to play sound from multiple applications at the same time. If I run speaker-test in two terminals, the first works fine while the second complains about the resource being busy:

speaker-test 1.0.24.2

Playback device is default
Stream parameters are 48000Hz, S16_LE, 1 channels
Using 16 octaves of pink noise
Playback open error: -16,Device or resource busy

My sound card is Creative X-Fi Extreme Audio [SB0790], identified as CA0106. I do not think it does hardware mixing but I may well be mistaken. In any case, I was under the impression that software mixing was done by default.

I've read the wiki and searched the forums, but all the info I could find refers to editing /etc/asound.conf or ~/.asoundrc, which I believe is no longer relevant. In any case, trying to add some of the suggested additions to asound.conf produces no results. I'm currently using the followin asound.conf:

pcm.upmix51 {                                                                                                                                 
  type upmix
  slave.pcm "surround51"
  delay 15
  channels 6
}

pcm.!default "plug:upmix51"

defaults.pcm.rate_converter "samplerate_best"

While it does seem to provide proper upmixing, the device locking problem exists regardless of whether I use it or not.

If anyone has any suggestions on how to fix it, I would be grateful!

Last edited by maxshaw (2011-05-07 03:02:03)

Offline

#2 2011-05-07 00:59:09

student975
Member
From: Russian Federation
Registered: 2011-03-05
Posts: 613

Re: [SOLVED] ALSA - sound limited to one source at a time

/etc/asound.conf is definitely relevant for me smile Key word here is 'dmix' - try find an example for your card with dmix.

EDIT. The idea is to redefine 'default' device with dmix plugin.

Last edited by student975 (2011-05-07 01:12:39)


"I exist" is the best myth I know..

Offline

#3 2011-05-07 01:49:08

brebs
Member
Registered: 2007-04-03
Posts: 3,742

Re: [SOLVED] ALSA - sound limited to one source at a time

Offline

#4 2011-05-07 03:01:45

maxshaw
Member
Registered: 2011-04-16
Posts: 6

Re: [SOLVED] ALSA - sound limited to one source at a time

Thanks, brebs. Unfortunately my sound doesn't work at all with your config - speaker-test crashes claiming it couldn't initialize the card. Some more digging revealed an issue on the ALSA tracker that seems to apply. From there I found an asoundrc that seems to work properly for me, both mixing and expanding. For future reference, in case that link breaks, here's the code:

pcm.!default plug:both

ctl.!default {
  type hw
  card 0
}

pcm.both {
  type route
  slave.pcm {
    type multi
    slaves {
      a.pcm "dfront"
      a.channels 2
      b.pcm "drear"
      b.channels 2
      c.pcm "dcenter"
      c.channels 2
    }

    bindings {
      0.slave a;
      0.channel 0;
      1.slave a;
      1.channel 1;

      2.slave b;
      2.channel 0;
      3.slave b;
      3.channel 1;

      4.slave c;
      4.channel 0;
      5.slave c;
      5.channel 1;

    }
  }

  ttable {
    0.0 1;
    1.1 1;

    0.2 1;
    1.3 1;

    0.4 1;
    1.5 1;

  }
}

ctl.both {
  type hw
  card 0
}

pcm.dfront {
  type dmix
  ipc_key 1024
  slave {
    pcm "front"
    period_time 0
    period_size 1024
    buffer_size 8192
    rate 48000
  }
}

ctl.dfront {
  type hw
  card 0
  device 0
}

pcm.drear {
  type dmix
  ipc_key 2048
  slave {
    pcm "rear"
    period_time 0
    period_size 1024
    buffer_size 8192
    rate 48000
  }
}

ctl.dfront {
  type hw
  card 0
  device 1
}

pcm.dcenter {
  type dmix
  ipc_key 4096
  slave {
    pcm "center_lfe"
    period_time 0
    period_size 1024
    buffer_size 8192
    rate 48000
  }
}

ctl.dcenter {
  type hw
  card 0
  device 3
}

pcm.sblive {
  type plug
  slave {
    pcm "hw:1,0"
    rate 48000
  }
}

Offline

#5 2011-05-07 03:24:26

brebs
Member
Registered: 2007-04-03
Posts: 3,742

Re: [SOLVED] ALSA - sound limited to one source at a time

maxshaw wrote:

couldn't initialize the card

Try 48000 instead of 44100. Some (cheapo) soundcards don't support 44100.

Offline

Board footer

Powered by FluxBB