Skip to content

Commit 5f97586

Browse files
authored
Merge 758ea80 into 3d4a0a8
2 parents 3d4a0a8 + 758ea80 commit 5f97586

2 files changed

Lines changed: 19 additions & 1 deletion

File tree

source/audio/soundSplit.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,13 +212,13 @@ def setSoundSplitState(
212212
# We need to restore volume of all applications, but then don't set up callback for future audio sessions
213213
state = SoundSplitState.NVDA_BOTH_APPS_BOTH
214214
applyToFuture = False
215+
appsVolume = appsVolume or 1.0
215216
leftVolume, rightVolume = state.getAppVolume()
216217
if appsVolume is None:
217218
appsVolume = (
218219
config.conf["audio"]["applicationsSoundVolume"] / 100
219220
* (1 - int(config.conf["audio"]["applicationsMuted"]))
220221
)
221-
222222
leftVolume *= appsVolume
223223
rightVolume *= appsVolume
224224
leftNVDAVolume, rightNVDAVolume = state.getNVDAVolume()

source/globalCommands.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4520,6 +4520,12 @@ def script_cycleSoundSplit(self, gesture: "inputCore.InputGesture") -> None:
45204520
gesture="kb:NVDA+alt+pageUp",
45214521
)
45224522
def script_increaseApplicationsVolume(self, gesture: "inputCore.InputGesture") -> None:
4523+
state = audio.soundSplit.SoundSplitState(config.conf["audio"]["soundSplitState"])
4524+
if state == audio.soundSplit.SoundSplitState.OFF:
4525+
# Translators: An error message while trying to adjust applications volume
4526+
msg = _("Please enable sound split to use this command")
4527+
ui.message(msg)
4528+
return
45234529
volume = config.conf["audio"]["applicationsSoundVolume"]
45244530
volume = min(100, volume + 5)
45254531
config.conf["audio"]["applicationsSoundVolume"] = volume
@@ -4538,6 +4544,12 @@ def script_increaseApplicationsVolume(self, gesture: "inputCore.InputGesture") -
45384544
gesture="kb:NVDA+alt+pageDown",
45394545
)
45404546
def script_decreaseApplicationsVolume(self, gesture: "inputCore.InputGesture") -> None:
4547+
state = audio.soundSplit.SoundSplitState(config.conf["audio"]["soundSplitState"])
4548+
if state == audio.soundSplit.SoundSplitState.OFF:
4549+
# Translators: An error message while trying to adjust applications volume
4550+
msg = _("Please enable sound split to use this command")
4551+
ui.message(msg)
4552+
return
45414553
volume = config.conf["audio"]["applicationsSoundVolume"]
45424554
volume = max(0, volume - 5)
45434555
config.conf["audio"]["applicationsSoundVolume"] = volume
@@ -4556,6 +4568,12 @@ def script_decreaseApplicationsVolume(self, gesture: "inputCore.InputGesture") -
45564568
gesture="kb:NVDA+alt+delete",
45574569
)
45584570
def script_toggleApplicationsMute(self, gesture: "inputCore.InputGesture") -> None:
4571+
state = audio.soundSplit.SoundSplitState(config.conf["audio"]["soundSplitState"])
4572+
if state == audio.soundSplit.SoundSplitState.OFF:
4573+
# Translators: An error message while trying to adjust applications volume
4574+
msg = _("Please enable sound split to use this command")
4575+
ui.message(msg)
4576+
return
45594577
muted = config.conf["audio"]["applicationsMuted"]
45604578
muted = not muted
45614579
config.conf["audio"]["applicationsMuted"] = muted

0 commit comments

Comments
 (0)