Closed arBalasquide closed 1 year ago
This is a known issue. The problem with your solution, is that it will add lots of duplicate processes to the application list, because while the name might stay the same, the sink input changes rapidly depending on lots of factors such as simply seeking in a YouTube video, or turning the volume all the way down.
A better solution is figuring out a good middleground between differentiating sources, and still recognizing the ones that are the same. This is a complicated problem to solve, but I'm open to suggestions.
One thing to note is that each audio source has a bunch of props that pulseshitter reads to try to find a suitable name to identify it with (since they are all different from app to app). Maybe a better idea would be to store this list of names, and use that as a comparison instead.
Edit: The reason I don't just replace the vec of sources immediately is because that makes games that do not provide an audio source the second you alt-tab or defocus impossible to select in pulseshitter.
I see. Perhaps we can have different filters pending the source of the audio and track specific applications. For example, firefox audio streams could be more volatile to audio changes (e.g YouTube) similar with Discord. So maybe having a list of "volatile" apps to keep track of them, and when an audio source originates from one, we use the strict is_same check.
I think the issue you describe only happens with a small number of apps, mostly browsers. Games I've tested only have the issue of alt-tabbing making it difficult to select the audio source.
There's already edge cases done for browsers. The idea was to implement a feature in the future that groups each source by its binary (when there's more than one source). It wouldn't be too bad of an idea to make an edge case for apps that don't play nice and over time build a solid library of apps so that pulseshitter can handle most things you throw at it.
The problem is I don't know if the application.process.binary
property appears on every SinkInput. There is sadly not very good documentation on this (as far as I can see), but if we can safely assume every SinkInput will have this property, we can cover edgecases.
I had to fix an issue with the git history, you may reopen this. But it's probably better if we continue the discussion in the issue: https://github.com/Enitoni/pulseshitter/issues/11
For example, in CSGO it launches two identically named streams called "csgo_linux64" one does not have in-game audio and the other one does. This is so you can select between the two, since at least for me, it always picked the one without in-game audio.