Estou tentando gravar um comando bash para alternar entre dispositivos de áudio (não placas diferentes). Eu encontrei este post AskUbuntu sobre o tópico, então eu comecei a descer a lista abaixo tentando cada dispositivo de saída para descobrir qual é o meu alto-falantes e qual é o meu fone de ouvido. Existe um método melhor?
O que eu tentei:
pactl set-card-profile 0 output:hdmi-surround71
para cada dispositivo de áudio, sem alteração de alto-falante para saída de fone de ouvido.
$ pacmd list-cards | grep output\:
output:hdmi-stereo: Digital Stereo (HDMI) Output (priority 5400, available: unknown)
output:hdmi-surround: Digital Surround 5.1 (HDMI) Output (priority 300, available: unknown)
output:hdmi-surround71: Digital Surround 7.1 (HDMI) Output (priority 300, available: unknown)
output:hdmi-stereo-extra1: Digital Stereo (HDMI 2) Output (priority 5200, available: unknown)
output:hdmi-surround71-extra1: Digital Surround 7.1 (HDMI 2) Output (priority 100, available: unknown)
output:hdmi-stereo-extra2: Digital Stereo (HDMI 3) Output (priority 5200, available: unknown)
output:hdmi-surround-extra2: Digital Surround 5.1 (HDMI 3) Output (priority 100, available: unknown)
output:hdmi-surround71-extra2: Digital Surround 7.1 (HDMI 3) Output (priority 100, available: unknown)
output:hdmi-stereo-extra3: Digital Stereo (HDMI 4) Output (priority 5200, available: unknown)
output:hdmi-surround-extra3: Digital Surround 5.1 (HDMI 4) Output (priority 100, available: unknown)
output:hdmi-surround71-extra3: Digital Surround 7.1 (HDMI 4) Output (priority 100, available: unknown)
active profile: <output:hdmi-surround71>
output:analog-stereo: Analog Stereo Output (priority 6000, available: unknown)
output:analog-stereo+input:analog-stereo: Analog Stereo Duplex (priority 6060, available: unknown)
output:analog-surround-21: Analog Surround 2.1 Output (priority 800, available: unknown)
output:analog-surround-21+input:analog-stereo: Analog Surround 2.1 Output + Analog Stereo Input (priority 860, available: unknown)
output:analog-surround-40: Analog Surround 4.0 Output (priority 700, available: unknown)
output:analog-surround-40+input:analog-stereo: Analog Surround 4.0 Output + Analog Stereo Input (priority 760, available: unknown)
output:analog-surround-41: Analog Surround 4.1 Output (priority 800, available: unknown)
output:analog-surround-41+input:analog-stereo: Analog Surround 4.1 Output + Analog Stereo Input (priority 860, available: unknown)
output:analog-surround-50: Analog Surround 5.0 Output (priority 700, available: unknown)
output:analog-surround-50+input:analog-stereo: Analog Surround 5.0 Output + Analog Stereo Input (priority 760, available: unknown)
output:analog-surround-51: Analog Surround 5.1 Output (priority 800, available: unknown)
output:analog-surround-51+input:analog-stereo: Analog Surround 5.1 Output + Analog Stereo Input (priority 860, available: unknown)
output:analog-surround-71: Analog Surround 7.1 Output (priority 700, available: unknown)
output:analog-surround-71+input:analog-stereo: Analog Surround 7.1 Output + Analog Stereo Input (priority 760, available: unknown)
output:iec958-stereo: Digital Stereo (IEC958) Output (priority 5500, available: unknown)
output:iec958-stereo+input:analog-stereo: Digital Stereo (IEC958) Output + Analog Stereo Input (priority 5560, available: unknown)
active profile: <output:analog-stereo+input:analog-stereo>
iec958-stereo-output: Digital Output (S/PDIF) (priority 0, latency offset 0 usec, available: unknown)
$ pactl set-card-profile 0 output:hdmi-surround71
meus sumidouros:
$ pacmd list-sinks
2 sink(s) available.
* index: 10
name: <alsa_output.pci-0000_00_14.2.analog-stereo>
driver: <module-alsa-card.c>
flags: HARDWARE HW_MUTE_CTRL HW_VOLUME_CTRL DECIBEL_VOLUME LATENCY DYNAMIC_LATENCY
state: RUNNING
suspend cause:
priority: 9959
volume: front-left: 50462 / 77% / -6.81 dB, front-right: 50462 / 77% / -6.81 dB
balance 0.00
base volume: 65536 / 100% / 0.00 dB
volume steps: 65537
muted: no
current latency: 23.16 ms
max request: 4 KiB
max rewind: 64 KiB
monitor source: 11
sample spec: s16le 2ch 44100Hz
channel map: front-left,front-right
Stereo
used by: 1
linked by: 1
configured latency: 23.22 ms; range is 1.00 .. 371.52 ms
card: 1 <alsa_card.pci-0000_00_14.2>
module: 7
properties:
alsa.resolution_bits = "16"
device.api = "alsa"
device.class = "sound"
alsa.class = "generic"
alsa.subclass = "generic-mix"
alsa.name = "ALC892 Analog"
alsa.id = "ALC892 Analog"
alsa.subdevice = "0"
alsa.subdevice_name = "subdevice #0"
alsa.device = "0"
alsa.card = "0"
alsa.card_name = "HDA ATI SB"
alsa.long_card_name = "HDA ATI SB at 0xfe200000 irq 16"
alsa.driver_name = "snd_hda_intel"
device.bus_path = "pci-0000:00:14.2"
sysfs.path = "/devices/pci0000:00/0000:00:14.2/sound/card0"
device.bus = "pci"
device.vendor.id = "1002"
device.vendor.name = "Advanced Micro Devices, Inc. [AMD/ATI]"
device.product.id = "4383"
device.product.name = "SBx00 Azalia (Intel HDA)"
device.form_factor = "internal"
device.string = "front:0"
device.buffering.buffer_size = "65536"
device.buffering.fragment_size = "32768"
device.access_mode = "mmap+timer"
device.profile.name = "analog-stereo"
device.profile.description = "Analog Stereo"
device.description = "Built-in Audio Analog Stereo"
alsa.mixer_name = "Realtek ALC892"
alsa.components = "HDA:10ec0892,1462f640,00100302"
module-udev-detect.discovered = "1"
device.icon_name = "audio-card-pci"
ports:
analog-output-lineout: Line Out (priority 9900, latency offset 0 usec, available: no)
properties:
analog-output-headphones: Headphones (priority 9000, latency offset 0 usec, available: yes)
properties:
device.icon_name = "audio-headphones"
active port: <analog-output-headphones>
index: 14
name: <alsa_output.pci-0000_01_00.1.hdmi-stereo-extra1>
driver: <module-alsa-card.c>
flags: HARDWARE DECIBEL_VOLUME LATENCY DYNAMIC_LATENCY
state: SUSPENDED
suspend cause: IDLE
priority: 9050
volume: front-left: 65536 / 100% / 0.00 dB, front-right: 65536 / 100% / 0.00 dB
balance 0.00
base volume: 65536 / 100% / 0.00 dB
volume steps: 65537
muted: no
current latency: 0.00 ms
max request: 0 KiB
max rewind: 0 KiB
monitor source: 15
sample spec: s16le 2ch 44100Hz
channel map: front-left,front-right
Stereo
used by: 0
linked by: 0
configured latency: 0.00 ms; range is 0.50 .. 371.52 ms
card: 0 <alsa_card.pci-0000_01_00.1>
module: 6
properties:
alsa.resolution_bits = "16"
device.api = "alsa"
device.class = "sound"
alsa.class = "generic"
alsa.subclass = "generic-mix"
alsa.name = "HDMI 1"
alsa.id = "HDMI 1"
alsa.subdevice = "0"
alsa.subdevice_name = "subdevice #0"
alsa.device = "7"
alsa.card = "1"
alsa.card_name = "HDA NVidia"
alsa.long_card_name = "HDA NVidia at 0xfe080000 irq 26"
alsa.driver_name = "snd_hda_intel"
device.bus_path = "pci-0000:01:00.1"
sysfs.path = "/devices/pci0000:00/0000:00:02.0/0000:01:00.1/sound/card1"
device.bus = "pci"
device.vendor.id = "10de"
device.vendor.name = "NVIDIA Corporation"
device.product.id = "0fbb"
device.product.name = "GM204 High Definition Audio Controller"
device.string = "hdmi:1,1"
device.buffering.buffer_size = "65536"
device.buffering.fragment_size = "32768"
device.access_mode = "mmap+timer"
device.profile.name = "hdmi-stereo-extra1"
device.profile.description = "Digital Stereo (HDMI 2)"
device.description = "GM204 High Definition Audio Controller Digital Stereo (HDMI 2)"
alsa.mixer_name = "Nvidia GPU 71 HDMI/DP"
alsa.components = "HDA:10de0071,196e1131,00100100"
module-udev-detect.discovered = "1"
device.icon_name = "audio-card-pci"
ports:
hdmi-output-1: HDMI / DisplayPort 2 (priority 5800, latency offset 0 usec, available: yes)
properties:
device.icon_name = "video-display"
device.product.name = "ASUS VH238
"
active port: <hdmi-output-1>