Right now I think the source is set arbitrarily via pa_stream_connect_record(..., source, ...) where source is nullptr at startup (which pulseaudio defines as setting the source as the system pleases). In my system this sets it to my audio monitor (alsa_output.pci-0000_00_1f.3.analog-stereo.monitor). We should figure out how to set the default input to the default source on startup.
While super clunky (as with everything in pulseaudio xD), one option is to get this via pa_context_get_server_info which triggers a callback including the server info which includes the default source name:
Another option is to set source = "@DEFAULT_SOURCE@" on startup, but when the default source gets set to magic mic, then this would also change. So if we did this we would want to immediately read the current source and then reassign it to the actual name.
Alternatively, to ease this issue, we could simply hide monitors so in cases where users only have one non-monitor mic, the default is correct. For reference, the output of pactl list sources for me is:
Right now I think the source is set arbitrarily via
pa_stream_connect_record(..., source, ...)
wheresource
isnullptr
at startup (which pulseaudio defines as setting the source as the system pleases). In my system this sets it to my audio monitor (alsa_output.pci-0000_00_1f.3.analog-stereo.monitor
). We should figure out how to set the default input to the default source on startup.While super clunky (as with everything in pulseaudio xD), one option is to get this via
pa_context_get_server_info
which triggers a callback including the server info which includes the default source name:Another option is to set
source = "@DEFAULT_SOURCE@"
on startup, but when the default source gets set to magic mic, then this would also change. So if we did this we would want to immediately read the current source and then reassign it to the actual name.Alternatively, to ease this issue, we could simply hide monitors so in cases where users only have one non-monitor mic, the default is correct. For reference, the output of
pactl list sources
for me is:Click to reveal
``` Source #0 State: RUNNING Name: alsa_output.pci-0000_00_1f.3.analog-stereo.monitor Description: Monitor of Built-in Audio Analog Stereo Driver: module-alsa-card.c Sample Specification: s16le 2ch 48000Hz Channel Map: front-left,front-right Owner Module: 6 Mute: no Volume: front-left: 63250 / 97% / -0.93 dB, front-right: 63250 / 97% / -0.93 dB balance 0.00 Base Volume: 65536 / 100% / 0.00 dB Monitor of Sink: alsa_output.pci-0000_00_1f.3.analog-stereo Latency: 0 usec, configured 25000 usec Flags: DECIBEL_VOLUME LATENCY Properties: device.description = "Monitor of Built-in Audio Analog Stereo" device.class = "monitor" alsa.card = "0" alsa.card_name = "HDA Intel PCH" alsa.long_card_name = "HDA Intel PCH at 0x94520000 irq 132" alsa.driver_name = "snd_hda_intel" device.bus_path = "pci-0000:00:1f.3" sysfs.path = "/devices/pci0000:00/0000:00:1f.3/sound/card0" device.bus = "pci" device.vendor.id = "8086" device.vendor.name = "Intel Corporation" device.product.id = "a171" device.product.name = "CM238 HD Audio Controller" device.form_factor = "internal" device.string = "0" module-udev-detect.discovered = "1" device.icon_name = "audio-card-pci" Formats: pcm Source #1 State: RUNNING Name: alsa_input.pci-0000_00_1f.3.analog-stereo Description: Built-in Audio Analog Stereo Driver: module-alsa-card.c Sample Specification: s16le 2ch 48000Hz Channel Map: front-left,front-right Owner Module: 6 Mute: no Volume: front-left: 14389 / 22% / -39.51 dB, front-right: 14389 / 22% / -39.51 dB balance 0.00 Base Volume: 6554 / 10% / -60.00 dB Monitor of Sink: n/a Latency: 8235 usec, configured 40000 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 = "ALC255 Analog" alsa.id = "ALC255 Analog" alsa.subdevice = "0" alsa.subdevice_name = "subdevice #0" alsa.device = "0" alsa.card = "0" alsa.card_name = "HDA Intel PCH" alsa.long_card_name = "HDA Intel PCH at 0x94520000 irq 132" alsa.driver_name = "snd_hda_intel" device.bus_path = "pci-0000:00:1f.3" sysfs.path = "/devices/pci0000:00/0000:00:1f.3/sound/card0" device.bus = "pci" device.vendor.id = "8086" device.vendor.name = "Intel Corporation" device.product.id = "a171" device.product.name = "CM238 HD Audio Controller" device.form_factor = "internal" device.string = "front:0" device.buffering.buffer_size = "352800" device.buffering.fragment_size = "176400" device.access_mode = "mmap+timer" device.profile.name = "analog-stereo" device.profile.description = "Analog Stereo" device.description = "Built-in Audio Analog Stereo" module-udev-detect.discovered = "1" device.icon_name = "audio-card-pci" Ports: analog-input-internal-mic: Internal Microphone (type: Mic, priority: 8900, availability unknown) analog-input-mic: Microphone (type: Mic, priority: 8700, not available) Active Port: analog-input-internal-mic Formats: pcm ```