Skip to content

Commit 63a055e

Browse files
authored
Merge 23d4000 into e01caee
2 parents e01caee + 23d4000 commit 63a055e

6 files changed

Lines changed: 59 additions & 52 deletions

File tree

source/audio/appsVolume.py

Lines changed: 20 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# A part of NonVisual Desktop Access (NVDA)
2-
# Copyright (C) 2024 NV Access Limited
2+
# Copyright (C) 2024 NV Access Limited, Tony Malykh, Bill Dengler
33
# This file is covered by the GNU General Public License.
44
# See the file COPYING for more details.
55

@@ -105,24 +105,30 @@ def _updateAppsVolumeImpl(
105105
_activeCallback.register()
106106

107107

108+
WASAPI_DISABLED_MESSAGE: str = _(
109+
# Translators: error message when wasapi is turned off.
110+
"Application volume cannot be controlled by NVDA when WASAPI is disabled. "
111+
"Please enable it in the advanced settings panel.",
112+
)
113+
114+
115+
VOLUME_ADJUSTMENT_DISABLED_MESSAGE: str = _(
116+
# Translators: error message when applications' volume is disabled
117+
"Application volume control disabled",
118+
)
119+
120+
108121
def _adjustAppsVolume(
109122
volumeAdjustment: int | None = None,
110123
):
111124
if not nvwave.usingWasapiWavePlayer():
112-
message = _(
113-
# Translators: error message when wasapi is turned off.
114-
"Other applications' volume cannot be adjusted. "
115-
"Please enable WASAPI in the Advanced category in NVDA Settings to use it.",
116-
)
117-
ui.message(message)
125+
ui.message(WASAPI_DISABLED_MESSAGE)
118126
return
119127
volume: int = config.conf["audio"]["applicationsSoundVolume"]
120128
muted: bool = config.conf["audio"]["applicationsSoundMuted"]
121129
state = config.conf["audio"]["applicationsVolumeMode"]
122130
if state != AppsVolumeAdjusterFlag.ENABLED:
123-
# Translators: error message when applications' volume is disabled
124-
msg = _("Please enable applications' volume adjuster in order to adjust applications' volume")
125-
ui.message(msg)
131+
ui.message(VOLUME_ADJUSTMENT_DISABLED_MESSAGE)
126132
return
127133
volume += volumeAdjustment
128134
volume = max(0, min(100, volume))
@@ -132,7 +138,7 @@ def _adjustAppsVolume(
132138
# We skip running terminators here to avoid application volume spiking to 100% for a split second.
133139
_updateAppsVolumeImpl(volume / 100.0, muted, state)
134140
# Translators: Announcing new applications' volume message
135-
msg = _("Applications volume {}").format(volume)
141+
msg = _("{} percent application volume").format(volume)
136142
ui.message(msg)
137143

138144

@@ -144,12 +150,7 @@ def _adjustAppsVolume(
144150

145151
def _toggleAppsVolumeState():
146152
if not nvwave.usingWasapiWavePlayer():
147-
message = _(
148-
# Translators: error message when wasapi is turned off.
149-
"Other applications' volume cannot be adjusted. "
150-
"Please enable WASAPI in the Advanced category in NVDA Settings to use it.",
151-
)
152-
ui.message(message)
153+
ui.message(WASAPI_DISABLED_MESSAGE)
153154
return
154155
state = config.conf["audio"]["applicationsVolumeMode"]
155156
volume: int = config.conf["audio"]["applicationsSoundVolume"]
@@ -167,20 +168,13 @@ def _toggleAppsVolumeState():
167168

168169
def _toggleAppsVolumeMute():
169170
if not nvwave.usingWasapiWavePlayer():
170-
message = _(
171-
# Translators: error message when wasapi is turned off.
172-
"Other applications' mute status cannot be adjusted. "
173-
"Please enable WASAPI in the Advanced category in NVDA Settings to use it.",
174-
)
175-
ui.message(message)
171+
ui.message(WASAPI_DISABLED_MESSAGE)
176172
return
177173
state = config.conf["audio"]["applicationsVolumeMode"]
178174
volume: int = config.conf["audio"]["applicationsSoundVolume"]
179175
muted: bool = config.conf["audio"]["applicationsSoundMuted"]
180176
if state != AppsVolumeAdjusterFlag.ENABLED:
181-
# Translators: error message when applications' volume is disabled
182-
msg = _("Please enable applications' volume adjuster in order to mute other applications")
183-
ui.message(msg)
177+
ui.message(VOLUME_ADJUSTMENT_DISABLED_MESSAGE)
184178
return
185179
muted = not muted
186180
config.conf["audio"]["applicationsSoundMuted"] = muted

source/config/featureFlagEnums.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# A part of NonVisual Desktop Access (NVDA)
2-
# Copyright (C) 2022 NV Access Limited, Bill Dengler, Rob Meredith
2+
# Copyright (C) 2022 NV Access Limited, Bill Dengler, Rob Meredith, Tony Malykh
33
# This file is covered by the GNU General Public License.
44
# See the file COPYING for more details.
55

@@ -70,10 +70,12 @@ class AppsVolumeAdjusterFlag(DisplayStringEnum):
7070
@property
7171
def _displayStringLabels(self):
7272
return {
73-
# Translators: Label for applications volume adjuster in NVDA settings.
74-
self.DISABLED: _("Disabled Applications volume adjuster"),
75-
# Translators: Label for applications volume adjuster in NVDA settings.
76-
self.ENABLED: _("Enabled Applications volume adjuster"),
73+
# Translators: A choice disabling "application volume adjustment"
74+
# in the audio settings panel.
75+
self.DISABLED: _("No"),
76+
# Translators: A choice enabling "application volume adjustment"
77+
# in the audio settings panel.
78+
self.ENABLED: _("Yes"),
7779
}
7880

7981
DEFAULT = enum.auto()

source/globalCommands.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4753,7 +4753,7 @@ def script_cycleSoundSplit(self, gesture: "inputCore.InputGesture") -> None:
47534753
@script(
47544754
description=_(
47554755
# Translators: Describes a command.
4756-
"Increases the volume of the other applications",
4756+
"Increases the volume of other applications",
47574757
),
47584758
category=SCRCAT_AUDIO,
47594759
gesture="kb:NVDA+alt+pageUp",
@@ -4764,7 +4764,7 @@ def script_increaseApplicationsVolume(self, gesture: "inputCore.InputGesture") -
47644764
@script(
47654765
description=_(
47664766
# Translators: Describes a command.
4767-
"Decreases the volume of the other applications",
4767+
"Decreases the volume of other applications",
47684768
),
47694769
category=SCRCAT_AUDIO,
47704770
gesture="kb:NVDA+alt+pageDown",

source/gui/settingsDialogs.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
# A part of NonVisual Desktop Access (NVDA)
22
# Copyright (C) 2006-2024 NV Access Limited, Peter Vágner, Aleksey Sadovoy,
33
# Rui Batista, Joseph Lee, Heiko Folkerts, Zahari Yurukov, Leonard de Ruijter,
4-
# Derek Riemer, Babbage B.V., Davy Kager, Ethan Holliger, Bill Dengler, Thomas Stivers,
5-
# Julien Cochuyt, Peter Vágner, Cyrille Bougot, Mesar Hameed, Łukasz Golonka, Aaron Cannon,
6-
# Adriani90, André-Abush Clause, Dawid Pieper, Heiko Folkerts, Takuya Nishimoto, Thomas Stivers,
7-
# jakubl7545, mltony, Rob Meredith, Burman's Computer and Education Ltd, hwf1324.
4+
# Derek Riemer, Babbage B.V., Davy Kager, Ethan Holliger, Bill Dengler,
5+
# Thomas Stivers, Julien Cochuyt, Peter Vágner, Cyrille Bougot, Mesar Hameed,
6+
# Łukasz Golonka, Aaron Cannon, Adriani90, André-Abush Clause, Dawid Pieper,
7+
# Takuya Nishimoto, jakubl7545, Tony Malykh, Rob Meredith,
8+
# Burman's Computer and Education Ltd, hwf1324.
89
# This file is covered by the GNU General Public License.
910
# See the file COPYING for more details.
1011
import logging
@@ -3104,8 +3105,12 @@ def makeSettings(self, settingsSizer: wx.BoxSizer) -> None:
31043105

31053106
self._appendSoundSplitModesList(sHelper)
31063107

3107-
# Translators: This is a label for the applications volume adjuster combo box in settings.
3108-
label = _("&Application volume adjuster status")
3108+
# Translators: This is a label for the
3109+
# "allow NVDA to control the volume of other applications"
3110+
# combo box in settings.
3111+
label = _(
3112+
"&Allow NVDA to control the volume of other applications:",
3113+
)
31093114
self.appVolAdjusterCombo: nvdaControls.FeatureFlagCombo = sHelper.addLabeledControl(
31103115
labelText=label,
31113116
wxCtrlClass=nvdaControls.FeatureFlagCombo,

user_docs/en/changes.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@
66

77
### New Features
88

9-
* The volume of other applications can be adjusted by `NVDA+alt+pageUp` and `NVDA+alt+pageDown`. In order to use this feature, application volume adjuster needs to be enabled in Audio pane of NVDA settings. (#16052, @mltony)
10-
* Added command to mute or unmute all other applications, assigned to `NVDA+alt+delete`.
11-
In order to use this feature, the application volume adjuster needs to be enabled in the Audio category of NVDA settings. (#16052, @mltony)
9+
* Commands to adjust the volume of other applications besides NVDA have been added.
10+
To use this feature, "allow NVDA to control the volume of other applications" must be enabled in the audio settings panel. (#16052, @mltony, @codeofdusk)
11+
* `NVDA`+`Alt`+`Pageup`: Increase the volume of all other applications.
12+
* `NVDA`+`Alt`+`Pagedown`: Decrease the volume of all other applications.
13+
* `NVDA`+`Alt`+`Delete`: Mute the volume of all other applications.
1214
* When editing in Microsoft PowerPoint text boxes, you can now move per sentence with `alt+upArrow`/`alt+downArrow`. (#17015, @LeonarddeR)
1315
* In Mozilla Firefox, NVDA will report the highlighted text when a URL containing a text fragment is visited. (#16910, @jcsteh)
1416
* NVDA can now report when a link destination points to the current page. (#141, @LeonarddeR, @nvdaes)

user_docs/en/userGuide.md

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2465,35 +2465,39 @@ By default only three modes are included.
24652465
Note that it is necessary to check at least one mode.
24662466
This option is not available if you have started NVDA with [WASAPI disabled for audio output](#WASAPI) in Advanced Settings.
24672467

2468-
##### Applications volume adjuster status {#AppsVolumeAdjusterStatus}
2468+
##### Allow NVDA to control the volume of other applications {#AppsVolumeAdjusterStatus}
24692469

2470-
This combo box allows you to select the status of the applications volume adjuster.
2471-
The applications volume adjuster allows you to adjust volume of all other applications except for NVDA or mute them with a single keystroke.
2470+
| . {.hideHeaderRow} |.|
2471+
|---|---|
2472+
|Options |No, Yes|
2473+
|Default |No|
2474+
2475+
This combo box determines whether NVDA commands can be used to adjust the volume of other applications running on the system.
24722476

24732477
Possible values are:
24742478

2475-
* Disabled: NVDA doesn't interfere with volume levels of other applications.
2476-
* Enabled: volume of other applications can be adjusted via [other applications volume slider](#OtherAppVolume).
2479+
* No: NVDA doesn't interfere with the volume levels of other applications.
2480+
* Yes: The volume of other applications can be adjusted via [other applications volume slider](#OtherAppVolume) and NVDA commands.
2481+
Enabling this option causes NVDA's configuration to override any external changes to running applications' volumes (such as adjustments made by the Windows Volume Mixer) whenever NVDA modifies them.
24772482

24782483
This option is not available if you have started NVDA with [WASAPI disabled for audio output](#WASAPI) in Advanced Settings.
2484+
While [audio ducking](#SelectSynthesizerDuckingMode) does change the volume of other applications when engaged, it operates independently of this option.
24792485

24802486
##### Volume of other applications {#OtherAppVolume}
24812487

24822488
This slider allows you to adjust the volume of all currently running applications other than NVDA.
2483-
This volume setting will apply to all other applications sound output, even if they start after this setting is changed.
24842489
This volume can also be controlled via the following keyboard commands from anywhere:
24852490

24862491
| Name | Key | Description |
24872492
|---|---|---|
2488-
| Increase applications volume | `NVDA+alt+pageUp` | Increases volume of all applications except NVDA. |
2489-
| Decrease applications volume | `NVDA+alt+pageDown` | Decreases volume of all applications except NVDA. |
2493+
| Increase application volume | `NVDA+alt+pageUp` | Increases the volume of all applications except NVDA. |
2494+
| Decrease application volume | `NVDA+alt+pageDown` | Decreases the volume of all applications except NVDA. |
24902495

24912496
This option is not available if you have started NVDA with [WASAPI disabled for audio output](#WASAPI) in Advanced Settings.
24922497

2493-
##### Muting other applications {#OtherAppMute}
2498+
##### Mute other applications {#OtherAppMute}
24942499

24952500
This check box allows you to mute or unmute all applications except NVDA at once.
2496-
This mute setting will apply to all other applications sound output, even if they start after this setting is changed.
24972501

24982502
The following keyboard command can also be used from anywhere:
24992503

0 commit comments

Comments
 (0)