Re: [pulseaudio-discuss] Switching output ports across sound cards will cause the Headphone to be silent.
On Mon, Nov 20, 2023 at 03:03:41PM +0800, 赵成义 wrote: > OK, so your custom client application is deliberately changing the > default sink? Note that just changing the default sink will not move > existing sink input streams. You will need to do that yourself, for > example with the pa_context_move_sink_input_by_index function. > > > > Hi Sean, > > > In fact, the sink-input has been moved correctly. If the speaker port is > closed, this problem will not occur. > > > > I think this is a kernel problem. At that time, the speaker was always on and > switching between sound cards > > was performed when the headphone was plugged and unplugged. > > > > logs: > --- > > 11月 20 13:40:10.689190 uos60-PC pulseaudio[8944]: I: [pulseaudio] core.c: > configured_default_sink: alsa_output.pci-_00_1f.3.analog-stereo - > alsa_output.usb-C-Media_Electronics_Inc._USB_PnP_Sound_Device-00.analog-stereo > 11月 20 13:40:10.689190 uos60-PC pulseaudio[8944]: I: [pulseaudio] core.c: > default_sink: alsa_output.pci-_00_1f.3.analog-stereo - > alsa_output.usb-C-Media_Electronics_Inc._USB_PnP_Sound_Device-00.analog-stereo > 11月 20 13:40:10.689623 uos60-PC pulseaudio[8944]: D: [pulseaudio] > module-suspend-on-idle.c: Sink alsa_output.pci-_00_1f.3.analog-stereo > becomes idle, timeout in 2 seconds. > 11月 20 13:40:10.689623 uos60-PC pulseaudio[8944]: D: [pulseaudio] > sink-input.c: Starting to move sink input 0 from > 'alsa_output.pci-_00_1f.3.analog-stereo' I'm unable to reproduce the behavior you are describing. I tried on several machines with both internal soundcards and a USB sound card attached, and I was able to move sink inputs between the two cards immediately after plugging in headphones with no issues. As a next step, you should try to determine where in the stack the issue is. Your logs don't have any smoking guns in them, so I would get your system into the problematic state while your audio source is running, then check everything starting at the source of the audio: - Audio player is actually playing media (e.g. not paused) - Pulse APIs are consuming audio samples (e.g. not stalled) - Pulse reports that the sink input is not corked, not muted, and set at a reasonable volume level - Pulse reports that the sink input is routed to the correct sink - Pulse reports that the sink is running, not muted, set to a reasonable volume, and has the correct active port - Alsamixer shows the device master channel as unmuted and at approximately the same volume that pulse reports - Alsamixer shows the intended port's channel at 100% volume and not muted --Sean
Re: [pulseaudio-discuss] Switching output ports across sound cards will cause the Headphone to be silent.
OK, so your custom client application is deliberately changing the default sink? Note that just changing the default sink will not move existing sink input streams. You will need to do that yourself, for example with the pa_context_move_sink_input_by_index function. Hi Sean, Please refer to the log in the attachment when the Headphone is plugged in. BR, Chengyi Switching-across-cards-when-plugged-headphone.txt Description: Binary data
Re: [pulseaudio-discuss] Switching output ports across sound cards will cause the Headphone to be silent.
OK, so your custom client application is deliberately changing the default sink? Note that just changing the default sink will not move existing sink input streams. You will need to do that yourself, for example with the pa_context_move_sink_input_by_index function. Hi Sean, In fact, the sink-input has been moved correctly. If the speaker port is closed, this problem will not occur. I think this is a kernel problem. At that time, the speaker was always on and switching between sound cards was performed when the headphone was plugged and unplugged. logs: --- 11月 20 13:40:10.689190 uos60-PC pulseaudio[8944]: I: [pulseaudio] core.c: configured_default_sink: alsa_output.pci-_00_1f.3.analog-stereo - alsa_output.usb-C-Media_Electronics_Inc._USB_PnP_Sound_Device-00.analog-stereo 11月 20 13:40:10.689190 uos60-PC pulseaudio[8944]: I: [pulseaudio] core.c: default_sink: alsa_output.pci-_00_1f.3.analog-stereo - alsa_output.usb-C-Media_Electronics_Inc._USB_PnP_Sound_Device-00.analog-stereo 11月 20 13:40:10.689623 uos60-PC pulseaudio[8944]: D: [pulseaudio] module-suspend-on-idle.c: Sink alsa_output.pci-_00_1f.3.analog-stereo becomes idle, timeout in 2 seconds. 11月 20 13:40:10.689623 uos60-PC pulseaudio[8944]: D: [pulseaudio] sink-input.c: Starting to move sink input 0 from 'alsa_output.pci-_00_1f.3.analog-stereo' BR, Chengyi Switching-across-cards.txt Description: Binary data
Re: [pulseaudio-discuss] Switching output ports across sound cards will cause the Headphone to be silent.
On Mon, Nov 20, 2023 at 01:58:34PM +0800, 赵成义 wrote: > Hi Sean, > > > Thanks for your reply. > > Yes, at first, unplugging theheadphones should switch to the speaker channel > of > > the same ALSA card, but then the client sends > "command_set_default_sink_or_source" > > to switth to USB Speaker, so the following switching sequence occurs. > headphone - speaker- usb speaker (or Bluetooth earphone) > > Part of the log is as follows: > -- > 11月 20 13:40:10.686234 uos60-PC pulseaudio[8944]: I: [pulseaudio] sink.c: > Changed port of sink 1 "alsa_output.pci-_00_1f.3.analog-stereo" to > analog-output-speaker > 11月 20 13:40:10.686234 uos60-PC pulseaudio[8944]: I: [pulseaudio] core.c: > default_sink: > alsa_output.usb-C-Media_Electronics_Inc._USB_PnP_Sound_Device-00.analog-stereo > - alsa_output.pci-_00_1f.3.analog-stereo > > ... > > 11月 20 13:40:10.689190 uos60-PC pulseaudio[8944]: I: [pulseaudio] core.c: > configured_default_sink: alsa_output.pci-_00_1f.3.analog-stereo - > alsa_output.usb-C-Media_Electronics_Inc._USB_PnP_Sound_Device-00.analog-stereo > 11月 20 13:40:10.689190 uos60-PC pulseaudio[8944]: I: [pulseaudio] core.c: > default_sink: alsa_output.pci-_00_1f.3.analog-stereo - > alsa_output.usb-C-Media_Electronics_Inc._USB_PnP_Sound_Device-00.analog-stereo OK, so your custom client application is deliberately changing the default sink? Note that just changing the default sink will not move existing sink input streams. You will need to do that yourself, for example with the pa_context_move_sink_input_by_index function. --Sean
Re: [pulseaudio-discuss] Switching output ports across sound cards will cause the Headphone to be silent.
--Original-- From: "SeanGreenslade"
Re: [pulseaudio-discuss] Switching output ports across sound cards will cause the Headphone to be silent.
On Fri, Nov 17, 2023 at 04:59:44PM +0800, 赵成义 wrote: > Hi Guys, > > > In the following scenario, switching output ports across sound cards will > cause the Headphone to be silent. > (Tips: USB speakers or Bluetooth earphones use independent sound cards, and > the device uses an onboard sound card.) > > > 1. headphone is unplugged, automatically change port: headphone - > speaker- usb speaker (or Bluetooth earphone) > 2. headphone is plugged, automatically change port: usb speaker(or Bluetooth > earphone) - headphone > > > Step 1. When the headphone is unplugged, the port is automatically switched > from the headphone to the speaker. > The following configuration items in the analog-output-speaker.conf file will > be applied, and then the port is > switched to the USB speaker. > Close Headphone volume > [Element Headphone] > switch=off > volume=off > > > Step 2, when the headphone is plugged in, the port is automatically switched > from the USB speaker to the headphone, > and the following configuration items in the analog-output-headphone.conf > file will be applied. > [Element Headphone] > required-any = any > switch = mute > volume=merge > override-map.1 = all > override-map.2 = all-left,all-right > > > As you can see through alsamixer, the volume of the Headphone has been > restored, but the Headphone is silent. > > > > Could you please help slove this issue, thanks! Hi, Chengyi. Your question is somewhat unclear. The behavior you're describing is not how pulseaudio operates by default, but the config file snippets you provide are not modified from the defaults. By default, unplugging the headphones should switch to the speaker channel of the same ALSA card. Have you made any modifications to the various pulseaudo alsa-mixer paths conf files? If so, please show what you have changed. --Sean
[pulseaudio-discuss] Switching output ports across sound cards will cause the Headphone to be silent.
Hi Guys, In the following scenario, switching output ports across sound cards will cause the Headphone to be silent. (Tips: USB speakers or Bluetooth earphones use independent sound cards, and the device uses an onboard sound card.) 1. headphone is unplugged, automatically change port: headphone - speaker- usb speaker (or Bluetooth earphone) 2. headphone is plugged, automatically change port: usb speaker(or Bluetooth earphone) - headphone Step 1. When the headphone is unplugged, the port is automatically switched from the headphone to the speaker. The following configuration items in the analog-output-speaker.conf file will be applied, and then the port is switched to the USB speaker. Close Headphone volume [Element Headphone] switch=off volume=off Step 2, when the headphone is plugged in, the port is automatically switched from the USB speaker to the headphone, and the following configuration items in the analog-output-headphone.conf file will be applied. [Element Headphone] required-any = any switch = mute volume=merge override-map.1 = all override-map.2 = all-left,all-right As you can see through alsamixer, the volume of the Headphone has been restored, but the Headphone is silent. Could you please help slove this issue, thanks! Best Regards, Chengyi