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

Mute/audio forward disable on shortcut #4053

Open
grnassar opened this issue Jun 2, 2023 · 5 comments
Open

Mute/audio forward disable on shortcut #4053

grnassar opened this issue Jun 2, 2023 · 5 comments

Comments

@grnassar
Copy link

grnassar commented Jun 2, 2023

  • [ X] I have checked that a similar feature request does not already exist. (Don't worry, this isn't yet another "disable on PC and reenable on phone while running" request.)

Is your feature request related to a problem? Please describe.
The audio forwarding feature is a great add -- but I find that even when I am using it, it would be nice to be able to mute/disable it for short periods to do something else audio-related with the host machine.

Describe the solution you'd like
It'd be great to have a host-side keyboard shortcut to toggle muting/disabling the audio on the host side. (It's effectively a server-side mute, but been avoiding using "mute" to not conflate it with muting the phone itself.)

Describe alternatives you've considered
Muting the phone itself: ...I mean, it works, sorta. But it's definitely unwieldy -- even the existing volume up/down shortcuts just mirror the phone's vol up/down, meaning sometimes they affect media audio, sometimes call audio, sometimes alerts. Mute itself on phones is of course the same way -- depending on the phone, you may mute media but still get alerts, or mute calls but still get media audio (this happens very often). It'd be great to have a host-side "master switch" for audio that can just be toggled off and on.

Additional context
None come to mind. Thank you for a fantastically useful tool!

@rom1v
Copy link
Collaborator

rom1v commented Jun 2, 2023

I like the idea.

It is often possible to control the volume per application at the system level, but it is not straightforward enough.

It's effectively a server-side mute

It would be a client-side mute, because there is buffering on the client side (for example if the audio is delayed via --audio-buffer=1000 and you toggle mute, you want to mute immediately, not in 1 second). IMO, it would not even pause the audio device not to interact with buffering/synchronization at all, it would just play zeros if mute is disabled, so that unmute would work without glitches immediately.

Like the fullscreen toogle shortcut, which has an option to start in fullscreen mode (--fullscreen), there should be an option to start "muted" (--mute?).

One problem I see is that, for consistency, this option should work whether or not video is enabled (in the next release, there will be a flag --no-video, see #3978). But if there is no video, there is no window, so it is not possible to capture shortcuts :/. Maybe there should be a window for audio-only mirroring similar to what is done for OTG mode (with an option to disable it).

@Gottox
Copy link

Gottox commented Jun 11, 2023

An alternative to this would be to control the actual audio on the android device from the desktop as described in #4080.

@grnassar
Copy link
Author

It would be a client-side mute, because there is buffering on the client side

You're entirely right; I misspoke there, as I'd pictured this functionality being most easily implemented on the client side anyway. In my head I was thinking of "server" in the context of the adb architecture, which is funny because the "client" and "server" as adb defines those both sit on the same machine... :) Not useful, brain!

it would just play zeros if mute is disabled, so that unmute would work without glitches immediately.

Yup! That's the sort of thing I was thinking. Don't touch what's happening between daemon and server, just throw away the daemon's audio data.

Like the fullscreen toogle shortcut, which has an option to start in fullscreen mode (--fullscreen), there should be an option to start "muted" (--mute?).

Stands to reason, I think. --mute seems like it would work.

One problem I see is that, for consistency, this option should work whether or not video is enabled (in the next release, there will be a flag --no-video, see #3978). But if there is no video, there is no window, so it is not possible to capture shortcuts :/. Maybe there should be a window for audio-only mirroring similar to what is done for OTG mode (with an option to disable it).

I think I see your point, but I'm not sure that it would perhaps be necessary. From reading the other issues wrt the no-video/no-mirror requests, it seems like much of the utility of no-video is for capturing the audio. In that case, there would be two different ways I can think of that this feature would work: either mute would work for the recording like it would in the played audio, in which case you're recording dead air for a while and it would make more sense to just cut off the recording for that period; or you would want the played audio to mute but the recording to continue capturing, but in that case it's more likely you'd want it that way the entire time and would just use no-mirror with the output file option (in other words: the --no-mirror --record=nnnn.opus example given in #3978 ).

So perhaps it actually makes more sense for what I'll for now call the --mute feature to only have meaning if audio and video mirroring are both in use. Just trying to think through the use case here. (On the bright side, that probably makes the implementation a bit simpler too, which is a nice added bonus.)

@rom1v
Copy link
Collaborator

rom1v commented Jun 17, 2023

From reading the other issues wrt the no-video/no-mirror requests, it seems like much of the utility of no-video is for capturing the audio.

Yes. For example, you're playing some music on your device, you want it to play on your computer. You can use scrcpy (with video) and mute it with a shortcut. But in the end, you don't necessarily need the video, so you run scrcpy --no-video and it plays only the audio. But then you can't mute anymore.

@grnassar
Copy link
Author

Just thought I'd ping about this again -- apologies if there's no need; just saw that there'd been an update just a couple of weeks ago with the video/audio splitting and thought, "hey, I wonder if that means the mute feature is coming up soon!" Wanted to check if it was indeed, or if it might be a little bit. Thanks again!

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

No branches or pull requests

3 participants