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

Better support for multiple output devices #40

Open
AndyM48 opened this issue Apr 6, 2021 · 14 comments
Open

Better support for multiple output devices #40

AndyM48 opened this issue Apr 6, 2021 · 14 comments

Comments

@AndyM48
Copy link

AndyM48 commented Apr 6, 2021

First, I just came across volctl, thank you for this programme.

The Mute options give slightly unexpected results in that if I use the Mute button on the pop up menu, volctl mutes the default stream and turn the systray icon to "muted". A left button click on the icon will show the volume controls for all the streams, with the default stream muted while any other streams could be either open or muted.

This means that I am now listening to the radio over the internet, with the volume icon showing as muted!

I can mute or unmute each stream from the volume controls, so I wonder if the Mute button is actually necessary.

My suggestion would be:

  • make the Mute button mute/unmute ALL the streams.
  • change the system tray icon to muted only when ALL the streams are muted.

Of course the volume controls still allow indivual streams to be muted or unmuted.

@buzz
Copy link
Owner

buzz commented Apr 6, 2021

Thanks for your feedback.

Are you using the latest release or the master branch?

I assume, with "stream" you mean output device? Currently all actions on the status icon (context menu mute, icon double click mute and mouse wheel volume change) work on the default PulseAudio output device.

volctl is intentionally kept simple. It's primary use case is to control application volume levels using one main output device (though you can control mute/volume for other devices using the slider popup). Having the status icon to control all output devices at once might be a bit counter-intuitive.

E.g. what happens if one raises the master volume, having devices with different volume levels. Should they all increase volume at once? Should they "jump" to the same level (very awkward) or adjust relatively to each other? What is if people have multiple audio devices and don't want all volumes/mute to be adjusted at once (listening to music on one device and doing all other things on a separate device). Also, I think, there are setups/audio interfaces that have multiple (virtual or hardware) output devices that should not be adjusted. That being said, I presume the current behavior is the sensible default.

But I could imagine having a toggle option for this. PR very welcome.

@AndyM48
Copy link
Author

AndyM48 commented Apr 6, 2021

I am using the current release in Arch linux AUR which is 0.8.2 and by "stream" I meant the Playback AudioStream as in the first tab of Pavucontrol. Left click on the tray icon shows a volume control, which can set the volume for each Output Device, and for each AudioStream. It can also mute any one of the Output Devices or AudioStreams individually, which is pretty cool.

I like the fact that volctl is simple and straightforward and I would not wish to change anything except that I find it counter-intuitive to have the tray icon showing that the audio is muted while I am listening to the internet radio.

All I would suggest is that the icon only shows as Muted if ALL the devices (or the audiostreams) have been muted, and if the mute option is selected on the pop up menu then ALL the devices (or audiostreams) should be muted. Since volctl already knows the state of the devices and audiostreams (see the volume control) this should not be a major change.

@buzz
Copy link
Owner

buzz commented Apr 6, 2021

[...] I am now listening to the radio over the internet, with the volume icon showing as muted!

[...] I find it counter-intuitive to have the tray icon showing that the audio is muted while I am listening to the internet radio.

Your interface is outputting audio when it's muted? That would probably indicate an issue with your audio setup but is not related to volctl, right?

Or are you suggesting there's a bug in volctl that shows your interface as muted while it's actually not?

All I would suggest is that the icon only shows as Muted if ALL the devices (or the audiostreams) have been muted, and if the mute option is selected on the pop up menu then ALL the devices (or audiostreams) should be muted. Since volctl already knows the state of the devices and audiostreams (see the volume control) this should not be a major change.

IMO the current behavior is the most intuitive: Show muted when muted, show unmuted when unmuted. But I might not fully understand the issue you are addressing.

@RiedleroD
Copy link

I suggest @FDServices should share a screen capture of the problem since I think miscommunication is likely here.

@AndyM48
Copy link
Author

AndyM48 commented Apr 7, 2021

I am afraid that I have not made myself clear.

I have two output devices.

  • Built in audio - default
  • Muzilli - Bluetooth

Audio is streamed to Muzilli
Volctl only mutes the default device and the tray icon only reflects the state of the default device.
Here is a screenshot to demonstrate the problem, as suggested by @RielderoD

2021-04-07_08-20

@RiedleroD
Copy link

Ok so, I agree with both of you - I do think that it's a problem, but I also think muting all output streams by default isn't the right choice. I think the best option would be a toggle in the settings that turns on/off if all output devices or just the default one is targeted. I don't have time for a PR right now, but I'm sure someone will come along sooner or later.

@buzz
Copy link
Owner

buzz commented Apr 7, 2021

I have two output devices.

That was the missing bit. So, I understood you correctly in my first answer.

TL;DR The volctl status icon controls/displays the state of your primary output device.

Ok so, I agree with both of you - I do think that it's a problem, but I also think muting all output streams by default isn't the right choice. I think the best option would be a toggle in the settings that turns on/off if all output devices or just the default one is targeted. I don't have time for a PR right now, but I'm sure someone will come along sooner or later.

Such functionality comes with edge cases and needs to respect all possible user configurations, like virtual output sinks, etc. This sort of complexity I'd rather like to avoid. To quote from the README:

It's not meant to be an replacement for a full-featured mixer application. If you're looking for that check out the excellent pavucontrol.

Having volctl icon handle the default audio device and nothing more is as simple as it gets. On/off, done. Putting the state of multiple audio devices into one status icon does not feel right. I'm afraid it might create more problems that it's trying to solve.

Possible options for handling multiple output devices in volctl:

  • Default: Primary output device (Current behavior, sensible for many users)
  • Alternative A: One status icon per output device. Playback streams associated with the device would be shown in the respective icon's sliders popup.
  • Alternative B: One status icon for all output devices. (variant proposed by @FDServices)

(Alternative A/B would probably need a toggle list in the settings, so the user can explicitly select the devices that should be controlled by volctl.)

A PR for a new status icon behavior could implement alternative A and/or B, preferably both.

@buzz buzz changed the title Mute gives unexpected results Better support for multiple output devices Apr 7, 2021
@AndyM48
Copy link
Author

AndyM48 commented Apr 7, 2021

That all sounds far too complicated.

May be Volctl should act on the active sink instead of the first sink?

Edit: changed "default" sink to "first" sink.

@buzz
Copy link
Owner

buzz commented Apr 7, 2021

That all sounds far too complicated.

Exactly.

May be Volctl should act on the active sink instead of the default sink?

What's an "active sink"?

@AndyM48
Copy link
Author

AndyM48 commented Apr 8, 2021

The active sink would be the sink that is running, unfortunately there may be more than one, so that would be a problem. How about using the default sink instead?

@AndyM48
Copy link
Author

AndyM48 commented Apr 8, 2021

OK, I have tried to set out my thought process as follows:

The default sink is the one that will be used for any new output that does not have a previously defined sink. It is the one marked with an asterisk in pacmd list-sinks:

  • index: 5
    To keep things simple, the volume control from the mouse wheel might alter the volume of the default sink, which is the more likely one in use, rather than the first device.

So, I have two sinks, if I start two audio streams then they will both play through the default sink (hideous):
2 sink(s) available.
index: 0
name: <alsa_output.pci-0000_00_1b.0.analog-stereo>
driver: <module-alsa-card.c>
flags: HARDWARE HW_MUTE_CTRL HW_VOLUME_CTRL DECIBEL_VOLUME LATENCY DYNAMIC_LATENCY
state: SUSPENDED
-----cut------

  • index: 5
    name: <bluez_sink.41_42_67_4F_CA_EC.a2dp_sink>
    driver: <module-bluez5-device.c>
    flags: HARDWARE DECIBEL_VOLUME LATENCY
    state: RUNNING

If I mute that sink then both audio streams are silent, muted (much better).

However I can send one of the audio streams to the first sink and it will play through that, while the second will play on the default sink, both sinks are now active (RUNNING):
2 sink(s) available.
index: 0
name: <alsa_output.pci-0000_00_1b.0.analog-stereo>
driver: <module-alsa-card.c>
flags: HARDWARE HW_MUTE_CTRL HW_VOLUME_CTRL DECIBEL_VOLUME LATENCY DYNAMIC_LATENCY
state: RUNNING
-----cut------

  • index: 7
    name: <bluez_sink.41_42_67_4F_CA_EC.a2dp_sink>
    driver: <module-bluez5-device.c>
    flags: HARDWARE DECIBEL_VOLUME LATENCY
    state: RUNNING

If I mute the default sink, the audio stream for the first sink will continue to be heard.

This is why I suggested originally that a simple mute action should mute both sinks, or better, mute all the sinks that are not already set to mute. Subsequently an unmute command would unmute all of the same sinks. The logic being that when the phone rings I want all the sound to be muted so that I can answer the phone.

Fine control of the sinks and the audio streams can always be made through the left-button pop up volume control.

@buzz
Copy link
Owner

buzz commented Apr 8, 2021

I'm against introducing any of this overly complicated logic (like filtering for state, etc.). It only introduces more edge cases, undesired behavior and complexity. The status icon actions would refer to a changing list of output devices, the user would not know what devices are actually affected. (Like muting -> mutes two devices, 1 second later unmute -> unmutes three devices).

I'd like to advocate the KISS principle and I opted for a simple design in the first place for a reason.

The logic being that when the phone rings I want all the sound to be muted so that I can answer the phone.

You want volctl to cover your personal use case which is understandable. But you need to keep in mind that there are a million of use cases and user preferences out there. I will not be able to satisfy every single one of them. As an interesting side note, not even pavucontrol covers your use case. You would need to mute every single output device just as it is the case with volctl.

That being said, I think we're going around in circles here.

For now, let's see if somebody wants to pick up on creating a PR for general improvement on multi device support, or even implement a "global mute" as you envision, I'm totally up for that. The only requirement being, keeping the complexity at a minimum.

@AndyM48
Copy link
Author

AndyM48 commented Apr 8, 2021

The status icon actions would refer to a changing list of output devices

Not as suggested. The icon would simply show muted or unmuted as at present. The difference being that muted would mean that all the "running" sinks were muted.

(Like muting -> mutes two devices, 1 second later unmute -> unmutes three devices).

In fact I suggested that if two sinks were muted then unmute would revert the same two sinks to their original unmuted state.

No problem, volctl works fine if you only have one sink, and I like the pop up volume control :).

@buzz
Copy link
Owner

buzz commented Apr 8, 2021

Not as suggested. The icon would simply show muted or unmuted as at present. The difference being that muted would mean that all the "running" sinks were muted.

As mentioned, the user has no means of knowing which devices are "running" currently. On top of that, the list of "running" devices changes over time. As a result, you'd end up with unpredictable behavior.

In fact I suggested that if two sinks were muted then unmute would revert the same two sinks to their original unmuted state.

Not really. What if the devices were already muted? You would not have that information and need to fall back to some other (undefined) behavior. Or the user would unmute after 2 weeks, should volctl then remember the muted devices from 2 weeks ago? Or the user adds/removes devices at runtime, and so forth...

It just doesn't add up, no matter how you look at it.

We have some proposals on how to proceed with this. This discussion is not going anywhere. Let's call it a day.

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

3 participants