ALSA: 두 개의 오디오 장치에 오디오 보내기

ALSA: 두 개의 오디오 장치에 오디오 보내기

내 노트북에는 온보드 사운드 카드가 있고 Bluetooth 헤드셋이 연결되어 있습니다. 다음 위치에서 블루투스 장치를 구성했습니다 /etc/asound.conf.

# cat /etc/asound.conf

pcm.bluetooth {
    type bluetooth
    device 12:34:56:78:9a:bc
    profile "auto"
}

ctl.bluetooth {
    type bluetooth
}

이제 새 오디오 장치를 지정하여 헤드폰으로 오디오를 재생할 수 있습니다. 예를 들면 다음과 같습니다.

mplayer -ao alsa:device=bluetooth file.mp3

기본 장치에서 플레이하려면 해당 장치를 무시하면 됩니다.

mplayer file.mp3

그러나 각 애플리케이션에 대해 이 설정을 명시적으로 설정할 필요 없이 기본적으로 모든 사운드가 두 장치 모두에 전송되도록 ALSA를 구성해야 합니다.

즉:

mplayer file.mp3

노트북 사운드 카드와 블루투스 헤드폰에서 재생해야 합니다.

어떻게 해야 하나요?

답변1

이것은 한 가지 방법입니다~/.asoundrc;기본 PCM과 함께 사용되는 온보드 및 Soundblaster Live 카드를 보여주는 예입니다.

# duplicate audio to both devices
pcm.!default plug:both

ctl.!default {
  type hw
  card SB
}

pcm.both {
  type route;
  slave.pcm {
      type multi;
      slaves.a.pcm "sblive";
      slaves.b.pcm "onboard";
      slaves.a.channels 2;
      slaves.b.channels 4;
      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;
      bindings.4.slave b;
      bindings.4.channel 2;
      bindings.5.slave b;
      bindings.5.channel 3;
  }

  ttable.0.0 1;
  ttable.1.1 1;

  ttable.0.2 1; # front left
  ttable.1.3 1; # front right
  ttable.0.4 1; # copy front left to rear left
  ttable.1.5 1; # copy front right to rear right
}

ctl.both {
  type hw;
  card Live;
}

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

pcm.sblive {
   type dmix
   ipc_key 2048
   slave {
       pcm "hw:1,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.onboard {
   type hw
   card "SB"
}

ctl.sblive {
   type hw
   card "Live"
}

(원천)

답변2

- 플러그인을 사용하고 싶습니다 multi.

잘 문서화된 몇 가지 사용 예가 있습니다.

알자스에서 출발:https://alsa.opensrc.org/TwoCardsAsOne

비슷한 문제가 있는 사람으로부터:https://unix.stackexchange.com/a/194631/127903

답변3

펄스 오디오도 옵션인 경우 출력을 다른 모든 출력에 복사하는 다중 출력 장치를 만드는 우아한 솔루션이 있습니다.

간단히 말해서:

  • 설치 및 실행파프스또는
  • pactl 로드 모듈 모듈 조합 수신기

바라보다https://askubuntu.com/questions/78174/play-sound-through-two-or-more-outputs-devices

관련 정보