pactl list 中的“monitor”这个词让我很困惑

pactl list 中的“monitor”这个词让我很困惑

我知道概念:PulseAudio中的接收器和源,客户端可以将音频发送到“接收器”并从“源”接收音频,所以接收器是输出(音频到那里),源是输入(音频来自那里),什么是监视器然后?

以下文字摘自pactl list

Sink #11
    State: SUSPENDED
    Name: alsa_output.pci-0000_09_00.6.analog-stereo
    Description: Family 17h (Models 10h-1fh) HD Audio Controller Analog Stereo
    Driver: module-alsa-card.c
    Sample Specification: s16le 2ch 48000Hz
    Channel Map: front-left,front-right
    Owner Module: 7
    Mute: no
    Volume: front-left: 50463 /  77% / -6.81 dB,   front-right: 50463 /  77% / -6.81 dB
            balance 0.00
    Base Volume: 65536 / 100% / 0.00 dB
    Monitor Source: alsa_output.pci-0000_09_00.6.analog-stereo.monitor
    Latency: 0 usec, configured 0 usec
    Flags: HARDWARE HW_MUTE_CTRL HW_VOLUME_CTRL DECIBEL_VOLUME LATENCY 
    Properties:
        alsa.resolution_bits = "16"
        device.api = "alsa"
        device.class = "sound"
        alsa.class = "generic"
        alsa.subclass = "generic-mix"
        alsa.name = "ALC662 rev3 Analog"
        alsa.id = "ALC662 rev3 Analog"
        alsa.subdevice = "0"
        alsa.subdevice_name = "subdevice #0"
        alsa.device = "0"
        alsa.card = "1"
        alsa.card_name = "HD-Audio Generic"
        alsa.long_card_name = "HD-Audio Generic at 0xfccc0000 irq 60"
        alsa.driver_name = "snd_hda_intel"
        device.bus_path = "pci-0000:09:00.6"
        sysfs.path = "/devices/pci0000:00/0000:00:08.1/0000:09:00.6/sound/card1"
        device.bus = "pci"
        device.vendor.id = "1022"
        device.vendor.name = "Advanced Micro Devices, Inc. [AMD]"
        device.product.id = "15e3"
        device.product.name = "Family 17h (Models 10h-1fh) HD Audio Controller"
        device.string = "front:1"
        device.buffering.buffer_size = "352768"
        device.buffering.fragment_size = "176384"
        device.access_mode = "mmap+timer"
        device.profile.name = "analog-stereo"
        device.profile.description = "Analog Stereo"
        device.description = "Family 17h (Models 10h-1fh) HD Audio Controller Analog Stereo"
        alsa.mixer_name = "Realtek ALC662 rev3"
        alsa.components = "HDA:10ec0662,10ec0000,00100300"
        module-udev-detect.discovered = "1"
        device.icon_name = "audio-card-pci"
    Ports:
        analog-output-lineout: Line Out (priority: 9000, available)
        analog-output-headphones: Headphones (priority: 9900, not available)
    Active Port: analog-output-lineout
    Formats:
        pcm

Source #15
    State: SUSPENDED
    Name: alsa_output.pci-0000_09_00.6.analog-stereo.monitor
    Description: Monitor of Family 17h (Models 10h-1fh) HD Audio Controller Analog Stereo
    Driver: module-alsa-card.c
    Sample Specification: s16le 2ch 48000Hz
    Channel Map: front-left,front-right
    Owner Module: 7
    Mute: no
    Volume: front-left: 27537 /  42% / -22.59 dB,   front-right: 27537 /  42% / -22.59 dB
            balance 0.00
    Base Volume: 65536 / 100% / 0.00 dB
    Monitor of Sink: alsa_output.pci-0000_09_00.6.analog-stereo
    Latency: 0 usec, configured 0 usec
    Flags: DECIBEL_VOLUME LATENCY 
    Properties:
        device.description = "Monitor of Family 17h (Models 10h-1fh) HD Audio Controller Analog Stereo"
        device.class = "monitor"
        alsa.card = "1"
        alsa.card_name = "HD-Audio Generic"
        alsa.long_card_name = "HD-Audio Generic at 0xfccc0000 irq 60"
        alsa.driver_name = "snd_hda_intel"
        device.bus_path = "pci-0000:09:00.6"
        sysfs.path = "/devices/pci0000:00/0000:00:08.1/0000:09:00.6/sound/card1"
        device.bus = "pci"
        device.vendor.id = "1022"
        device.vendor.name = "Advanced Micro Devices, Inc. [AMD]"
        device.product.id = "15e3"
        device.product.name = "Family 17h (Models 10h-1fh) HD Audio Controller"
        device.string = "1"
        module-udev-detect.discovered = "1"
        device.icon_name = "audio-card-pci"
    Formats:
        pcm

Monitor Source: alsa_output.pci-0000_09_00.6.analog-stereo.monitor从 11 号水槽获取。从来源 #15
获取。Monitor of Sink: alsa_output.pci-0000_09_00.6.analog-stereo

1.为什么Monitor of Sink是一种源,而不是Monitor Source一种汇?
2.我可以写Monitor SourceMonitor of Source,反之亦然,我可以写Monitor of SinkMonitor Sink吗?

答案1

监视器是分别与特定“父”接收器/源相关联的“子”源/接收器。

A监控源可用于记录其父信号的副本下沉正在输出。

A监控接收器可用于输出父母正在记录的信号的副本来源

您的 11 号水槽是alsa_output.pci-0000_09_00.6.analog-stereo。它的描述中有这一行:

Monitor Source: alsa_output.pci-0000_09_00.6.analog-stereo.monitor

实际上,它表示“该接收器有一个与其关联的监视器源,这是它的名称。”

然后,监视器源alsa_output.pci-0000_09_00.6.analog-stereo.monitor有自己的信息块作为您的源 #15。该信息块有相应的行:

Monitor of Sink: alsa_output.pci-0000_09_00.6.analog-stereo

这指向“父”接收器设备。它指示该源设备是音频接收器监控

答案2

简而言之监视器是一个源,可用于将接收器的输出定向到另一个设备。

假设您在 Audacious 上玩 ABBA。 Audacious 生成由模拟立体声输出接收器读取的样本。 (消息来源没有发送数据本身,它产生样本,并从接收器输入读取接收器。)

每次接收器读取样本时,它也会将样本写入监视器

现在,如果您启动 Audacity,请单击监视器仪表(麦克风旁边的仪表)。然后打开pavucontrol捕获自您可以选择XXX的班长

完成后,您可以看到 Audacity 中的音频表开始显示活动。

因此它读取样本监视器。这些样本是由接收器从接收器输入读取的数据写入的;它们也会写入耳机的输出。


                IN
>----------------------------------------->
             ,-- [source output]
  [source] --|
      |      '-- [source output]
      |                 |
      |                 |
   sample             sample
  producer           recorder
 (mic, ...)       (audacity, ...)
>------------------------------------------>
                OUT
>------------------------------------------>
 [sink input A] -.
                 +--> [sink] --> output + monitor
 [sink input B] -'      |           |
       |                |      the output device (speaker, ...)
       |                |              
 produces samples    consumes and mixes samples
    (mpv, ...)              (clocking, latency)
>------------------------------------------>

PulseAudio 的底层原理

每个接收器都会自动获得一个接收器监视器,命名为“<sink_name>.monitor”。每次当接收器从其接收器输入读取一个块时,它也会将该块写入接收器监视器。

所以;每次pulseaudio从接收器输入读取

alsa_output.pci-0000_09_00.6.analog-stereo

它还将该数据写入监视器接收器

alsa_output.pci-0000_09_00.6.analog-stereo.monitor

相关内容