MusicPlayerDaemon / MPD

Music Player Daemon
https://www.musicpd.org/
GNU General Public License v2.0
2.15k stars 347 forks source link

Mute and unmute volume #1065

Open petebueh opened 3 years ago

petebueh commented 3 years ago

Currently it is possible to mute MPD by setting the volume to 0 (The MPD clients that I use have a Button to do this). But it is not possible to unmute MPD, which would mean setting the volume back to the previous value.

Of course it is possible to pause the playback which also mutes the volume.

I think a "mute"-flag which can be toggled would be a cleaner solution. This could set the volume to 0 and store the previous volume for muting,
and for unmuting restore the previous volume.

MaxKellermann commented 3 years ago

Which do you think it's a "cleaner solution", and what does "clean" mean? MPD gives you two tools to mute, as you noted already. Why a third one? How will this "muting" work? What will clients see? How does the protocol look like? How will clients who don't know the feature deal with it?

petebueh commented 3 years ago

I tried the "toggleoutput" command, which does what I was thinking of (muting/unmuting), but it also stops the playback.

Maybe a "togglemute" command? And in addition the "setvol" command should also unmute the volume; this would let clients that don`t understand the "togglemute" command unmute the volume.

CyberShadow commented 2 years ago

Why a third one?

One more, in addition to the benefits already listed: PulseAudio has "mute" as a property on the sink input, so it would allow integrating it with PA implementations in the same way as for volume.

A use case to clarify on the points above: when playing a stream, it is often desirable to temporarily mute it. Pausing does not make sense for a stream; stopping incurs buffer latency when resuming. Muting here can be more desirable.

How will this "muting" work? What will clients see? How does the protocol look like? How will clients who don't know the feature deal with it?

Presumably this would be introduced through your existing mechanisms for protocol versioning? Old clients could see the volume as 0 if one were to want to go that far.

Would e.g. outputset 1 mute=1 be better from a protocol standpoint?

be1 commented 7 months ago

I'm refreshing the question with this comment. I am interested in having mute unmute and togglemute (or so) commands... too. But i understand it is a better approach to handle those commands in the client-side, for retro compatibility with older clients. Unless mpd would set volume to 0 on mute, and restore the previous value with unmute. This would be good for dumb small clients that do commands only and do not need the mpd status (think of remote controls).