You are not logged in.

#1 2017-06-29 18:46:56

Maniaxx
Member
Registered: 2014-05-14
Posts: 732

ALSA - simultaneous streams with 'multi' plug

Hallo,
i want sound output to my Audigy2 and HDMI simultaneous. That works with the .asoundrc below. But the problem is that only one app can access the card.

$ aplay /usr/share/sounds/alsa/Front_Center.wav & aplay /usr/share/sounds/alsa/Front_Center.wav
[1] 15640
ALSA lib pcm_dmix.c:1156:(snd_pcm_dmix_open) unable to open slave
aplay: main:807: audio open error: Invalid argument
$ Playing WAVE '/usr/share/sounds/alsa/Front_Center.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Mono

[1]+  Done                    aplay /usr/share/sounds/alsa/Front_Center.wav

The Audigy2 has a hardware mixer and it does work properly. Wine for example doesn't use pcm.default but somehow the card directly and its the only app that can mix sound into pcm.default at the moment.
Creating another dmix with plug:both is not possible (Invalid type 'multi' for slave PCM). dmix needs 'hw:x' for interrupt access.

So, how can i allow multiple apps to access/share the pcm.default?

.asoundrc:

pcm.!default plug:both

ctl.!default {
  type hw
  card Audigy2
}

pcm.both {
  type route;
  slave.pcm {
      type multi;
      slaves.a.pcm "myaudigy2";
      slaves.b.pcm "mynvidia";
      slaves.a.channels 2;
      slaves.b.channels 2;
      bindings.0.slave a;
      bindings.0.channel 0;
      bindings.1.slave a;
      bindings.1.channel 1;

      bindings.2.slave b;
      bindings.2.channel 0;
      bindings.3.slave b;
      bindings.3.channel 1;
  }
  ttable.0.0 1;
  ttable.1.1 1;
  ttable.0.2 1;
  ttable.1.3 1;
}

ctl.both {
  type hw;
  card Audigy2;
}

pcm.myaudigy2 {
   type dmix
   ipc_key 1024
   slave {
       pcm "hw:0,0"
       period_time 0
       period_size 2048
       buffer_size 65536
       buffer_time 0
       periods 128
       #rate 48000
       channels 2
    }
    bindings {
       0 0
       1 1
    }
}

ctl.myaudigy2 {
   type hw
   card "Audigy2"
}

pcm.mynvidia {
   type dmix
   ipc_key 2048
   slave {
       pcm "hw:1,7"
       period_time 0
       period_size 2048
       buffer_size 65536
       buffer_time 0
       periods 128
       #rate 48000
       channels 2
    }
    bindings {
       0 0
       1 1
    }
}

ctl.mynvidia {
   type hw
   card "NVidia"
}

sys2064

Offline

Board footer

Powered by FluxBB