ALSA : 출력 장치를 일시적으로 변경하는 방법 가장 간단한

ALSA에서 가능한 가장 간단한 일을하고 싶습니다 : 태블릿의 내부 스피커 대신 USB 헤드폰으로 소리를냅니다. 나는 다음과 같은 변경 설정 파일을 원하지 않는 asound.rc또는 alsa.confasound.conf하고, 내가 헤드폰을 분리 단지 때까지 임시 효과를 원하는 영구적으로 장치의 순서를 변경하여 기본 출력 장치로 헤드폰을 설정합니다. 이상하게도 대답을 Google에 표시 할 수 없습니다. 가 alsamixer그 일을 할 수있는 (더처럼 보인다)?

Gnome에서는 PulseAudioGUI 또는 CLI 인터페이스에서를 사용하여 현재 출력 장치를 쉽게 선택할 수 있지만 PulseAudioALSA에서 작동합니다! ALSA가 어떻게 출력 장치를 변경하게하는지 궁금합니다.



답변

USB 장치가 시스템에서 사운드 카드로 표시 man amixer되면 unmute매개 변수 를 확인 하고 사용할 수 있습니다.

amixer -c 1 set Master playback 100% unmute

다른 채널 (PCM 등)도 확인하십시오. 매뉴얼의 예는 다음과 같습니다.

   amixer -c 1 sset Line,0 80%,40% unmute cap
          will set the second soundcard's left line input volume to 80% and right line
          input to 40%, unmute it, and select it as a source for capture (recording).

   amixer -c 1 -- sset Master playback -20dB
          will set the master volume of the second card to -20dB.  If the  master  has
          multiple channels, all channels are set to the same value.

   amixer -c 1 set PCM 2dB+
          will  increase  the PCM volume of the second card with 2dB.  When both play‐
          back and capture volumes exist, this is applied to both volumes.

   amixer -c 2 cset iface=MIXER,name='Line Playback Volume",index=1 40%
          will set the third soundcard's second line playback volume(s) to 40%

   amixer -c 2 cset numid=34 40%
          will set the 34th soundcard element to 40%

답변

IIUC 당신은 .asoundrc또는 /etc/asound.conf동적으로 업데이트 할 수 있습니다 . 따라서 두 개의 파일 headphones.conffront.conf기본 장치를 적절한 hw:channel,device숫자로 설정 한 다음 “ACPI 잭 / 헤드폰 HEADPHONE 플러그”이벤트로 전환 할 수 있어야합니다 . “ln”을 사용하여이 /etc/asound.conf중 하나에 연결하려고합니다./etc/sounds/{headphones,front}.conf