Restore channel volume of applications upon exit#16312
Conversation
LeonarddeR
left a comment
There was a problem hiding this comment.
I have reopened #16287. I'd prefer this pr to fix that as well, i.e. ensure that soundsplit disabled really means that it is disabled.
Looking at the code of sound split in general, I have another concern. It looks like that Sound SPlit ignores the volume of every channel, simply resetting it to 1.0. What if an app prefers to change channel volumes to a lower level? I think sound split should respect that by using the average channel volume rather than a hardcoded value of 1.0
| f"Audio session for pid {self.pid} has {channelCount} channels instead of 2 - cannot set volume!" | ||
| ) | ||
| return | ||
| channelVolume.SetChannelVolume(0, 1.0, None) |
There was a problem hiding this comment.
Why should the volume be 1.0? What if the application itself lowered the volume of its channels?
I think the volume of both channels should be restored to the volume of the active channel. SO if soundsplit was active with NVDA left, application right and the application lowered its volume to 0.5, both channels should be set to 0.5 instead of 1.0.
|
In practice I've never seen applications to lower down their volume using IChannelAudioVolume interface. So restoring to 1.0 seems to be good enough. Moreover, the volume set via ISimpleAudioVolume is different from IChanelAudioVolume. If we assume that apps adjust their channel volume using simple volume, then their volume will be preserved. If apps adjust their volume via channel volume, then it is going to interfere with sound split no matter what, but again, I haven't seen this. |
|
Apart from the add-on that I already mentioned, there is also the
"soundVolumeView" application from NirSoft which allows you to adjust
the channel balance.
Under NVDA 2024beta, it is enough to adjust the channel balance of
foobar2000 once with this software and foobar2000 can be stopped and
restarted without losing this setting.
Under nvda lpha and when the sound separation mode is "Disabled", the
setting is lost each time foobar2000 is restarted and the channels are
systematically rebalanced.
Le 16/03/2024 18:57, mltony a écrit :
…
In practice I've never seen applications to lower down their volume
using IChannelAudioVolume interface. So restoring to 1.0 seems to be
good enough. Moreover, the volume set via ISimpleAudioVolume is
different from IChanelAudioVolume. If we assume that apps adjust their
channel volume using simple volume, then their volume will be
preserved. If apps adjust their volume via channel volume, then it is
going to interfere with sound split no matter what, but again, I
haven't seen this.
—
Reply to this email directly, view it on GitHub
<#16312 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ADZLFFFISKMSF26IVDGYJKTYYSBZFAVCNFSM6AAAAABEYS2JPCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMBSGA3DIOJRGM>.
You are receiving this because you are subscribed to this
thread.Message ID: ***@***.***>
|
Honestly, I don't care much about practice. I think it is common sense that NVDA should only change/touch things that are absolutely necessary. In other words, NVDA should leave my system as it was before after stopping it, especially when running as a portable copy. This is a fundamental principle for me, and the current implementation violates that. |
|
Sound split already restores all volumes to 1 upon exit. I don't see why in this feature the behavior should be different.
|
LeonarddeR
left a comment
There was a problem hiding this comment.
Sound split already restores all volumes to 1 upon exit. I don't see why in this feature the behavior should be different.
We are talking about Sound SPlit here. So if in this change the volume shouldn't be restored to 1.0. it should also be applied to sound split in general.
3. The only scenario I can imagine is when another application manages channel volumes. In this case that application would conflict with sound split no matter what. I can imagine corner cases where NVDA and said application adjust volumes at the same time. Race condition would be unavoidable. So Given utility of sound split I would say we should claim that sound split is not compatible with said application if one is ever to be discovered, because making it compatible is going to be hard if ever possible.
This actually emphasizes my concern that Sound Split touches channel volumes in the off state. I'm happy to accept that sound split is incompatible with some applications and even understand that these situations could be imaginary. But don't unnecessarily fiddle with my system parameters please.
Link to issue number:
Closes #16292
Summary of the issue:
When sound split is enabled, if an application is closed while NVDA is still running, its channel volume would be preserved even after the app is restarted later without NVDA.
Description of user facing changes
N/A
Description of development approach
Catching
on_state_changednotification and whennew_state == "Expired"- this means that the applciation just exited - we restore both left and right channel to full volume.Testing strategy:
Manual.
Known issues with pull request:
N/A
Code Review Checklist: