Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pipewire/pw-jack audio input device issue with Linux #3987

Open
muxy23 opened this issue Jan 29, 2025 · 1 comment
Open

pipewire/pw-jack audio input device issue with Linux #3987

muxy23 opened this issue Jan 29, 2025 · 1 comment

Comments

@muxy23
Copy link

muxy23 commented Jan 29, 2025

Environment:

  • OS: Arch Linux 6.12.10-arch1-1
  • Window Manager: KDE Plasma
  • Audio System: PipeWire/pw-jack
  • Audio Interface: Focusrite Scarlett 18i20
  • Game: Counter-Strike 2 (CS2)
  • System Information Gist: here

Issue:

  • The game outputs audio correctly, but I am unable to select an audio input device, either from the in-game settings or via the in-game console. (unlike here, where the author has no audio at all and apparently uses straight JACK instead of pipewire-jack, I only have input issues: CS2 JACK audio backend not working #3509 )
  • In QJackCtl and qpwraph, the CS2 node is visible, and its output is correctly routed to my virtual output ([CS2] No audio when using Behringer UMC1820 (Audio Interface) #3419 (comment) done similar to this), but the CS2/SDL node does not have any available inputs.
  • This issue only seems to occur on CS2 for me and not on any games not natively supported on Linux and is probably caused by SDL implementation if I'd guess. All the other games I've tried, running either natively or with proton, show up with the node having working input devices.

Steps to Reproduce: (see Pictures at the bottom)

  1. Launch Counter-Strike 2 on Arch Linux using Wayland, using pipewire/pw-jack as your sound system.
  2. Attempt to change the input device via in-game settings or the console.
  3. Observe that the input device cannot be selected, and the console logs the following error message:
    [SoundSystem] SDL Device Capture Audio Stream Failed To Open: Invalid audio device instance ID
    
  4. Check QJackCtl or QPWGraph, and notice that while the output routing works fine, there are no input devices available in the CS2 node.

Launch Options Used:

  • Default:

    SDL_DYNAMIC_API="/lib64/libSDL2.so" %command% -vulkan -novid
    
  • I’ve tried setting the following options for audio:

However, the issue persists and also occurs with "Streamlined Push to talk" enabled.


Expected Behavior:

  • I should be able to select an input device from the in-game settings or console and the audio input device should work correctly with the game.

Actual Behavior:

  • Input device selection is not functional and the console outputs the error:
    [SoundSystem] SDL Device Capture Audio Stream Failed To Open: Invalid audio device instance ID
    

Logs:

  • The relevant log output in the console when attempting to change the input device:
    [SoundSystem] SDL Device Capture Audio Stream Failed To Open: Invalid audio device instance ID
    
  • Audio related logs when starting the game with steam running in verbose mode: (note that "speakers" is just the chosen name for the sink, all the audio coming from my PC goes through that sink into my interface output, where can switch between speakers and headphones when using it as a soundcard)
    PulseAudio: Sink Speakers is default
    PulseAudio: Adding sink[36] Speakers with priority 3, monitor is Speakers.monitor
    PulseAudio: Adding sink[69] alsa_output.usb-Focusrite_Scarlett_18i20_USB_P97P0NR2A12C4B-00.pro-output-0 with priority 1, monitor is alsa_output.usb-Focusrite_Scarlett_18i20_USB_P97P0NR2A12C4B-00.pro-output-0.monitor
    PulseAudio: Recording on device Speakers.monitor
    PulseAudio: Connected to device Speakers.monitor (36, not suspended).
    PulseAudio: Using sample spec 's16le 2ch 48000Hz', channel map 'front-left,front-right'.
    Audio mix: start=10804605466, returned=114062
    Audio source [System Pulse]: init=10804981764, adjustment=0, through=114542, last_start=114062, mixed=96480, drop_before=0, drop_after=0
    Audio source [System Pulse]: Signal levels: ---, ---
    Audio mix: start=10804605466, returned=2993582
    Audio source [System Pulse]: init=10804981764, adjustment=0, through=2994062, last_start=2993582, mixed=2879520, drop_before=0, drop_after=0
    
    
  • pw-metadata returns: (Artix Linux - CSGO microphone not working but on Steam&gmod it works. #3147 (comment))
    Found "default" metadata 41
    update: id:0 key:'default.configured.audio.sink' value:'{"name":"Speakers"}' type:'Spa:String:JSON'
    update: id:0 key:'default.audio.sink' value:'{"name":"Speakers"}' type:'Spa:String:JSON'
    update: id:0 key:'default.audio.source' value:'{"name":"alsa_input.usb-Focusrite_Scarlett_18i20_USB_P97P0NR2A12C4B-00.pro-input-0"}' type:'Spa:String:JSON'
    
    

Pictures:

Changing Audio Input Device:
Image
Image

CS2 Node without Input in QjackCtl (looks the same in qpwgraph, also, just to avoid confusion if you have never used QjackCtl and only qpwgraph: the inputs and outputs are consolidated on one single node instead of the two nodes qpwgraph uses)
Image

Running the game with PRESSURE_VESSEL_SHELL=instead, shows that the game is running with pipewire when SDL_AUDIO_DRIVER=pipewire
Image

Edit: I tried the audio input in Counter-Strike:Source (which also uses SDL, albeit an old version) and this is how it should look like, when the input of my interface/a microphone is used.
In this case, there is a steam node connected to the input of the Interface.
It still worked in-game in the menu, however it crashed as soon as i tested it on a server.
Image


Any help or ideas, on how this could be fixed, or what else I could try, would be greatly appreciated.
I'm not sure, if this counts as duplicate, but imo this problem is not really mentioned on any other issue here and the ones that somewhat do, are either old or for audio in general and not only audio input.

@muxy23
Copy link
Author

muxy23 commented Feb 3, 2025

I was already halfway there with the virtual sink device.
The solution was to add a virtual source. Quite simple in hindsight.
Still, I strongly believe that the CS2 node (I don't know if it applies to DotA too) should be a duplex node by default instead of a separate sink and source node, if supported by SDL. While it might work on small interfaces/integrated audio, it obviously doesn't work for larger interfaces, or at least this specific interface.

Image

If anyone else has this issue: https://gitlab.freedesktop.org/pipewire/pipewire/-/wikis/Virtual-Devices#configuration

However...

...I don't think I should already close this issue though, as it inherently is a bad design choice to not use a duplex node (or at least finding the audio devices itself without needing to create virtual devices), for this game like other games and software do it.
Unless it is just not possible to implement with SDL or whatever kind of magic is going on behind the scenes, I believe there would be no harm in defaulting to a duplex node (AND being able to use a large interface without virtual sinks and sources) or at least having a launch option to run the game in duplex mode.

Feel free to prove me wrong and/or close this issue, I am not an expert in this field, this is only the information I've gathered after multiple hours of research and fiddling around.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants