Repository navigation
Re-add audio device combo box to synth select dialog #15486
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
Changes from 1 commit
4aef139
e451724
5ae8ac0
eb16cd6
6088352
de2589d
bde651c
43ddcb8
92269a2
2405dc1
7204b7b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,6 +18,8 @@ | |
| import typing | ||
| import wx | ||
| from NVDAState import WritePaths | ||
| import NVDAState | ||
| from buildVersion import version_year | ||
|
|
||
| from vision.providerBase import VisionEnhancementProviderSettings | ||
| from wx.lib.expando import ExpandoTextCtrl | ||
|
|
@@ -1108,6 +1110,8 @@ def makeSettings(self, settingsSizer): | |
| self.synthList = settingsSizerHelper.addLabeledControl(synthListLabelText, wx.Choice, choices=[]) | ||
| self.bindHelpEvent("SelectSynthesizerSynthesizer", self.synthList) | ||
| self.updateSynthesizerList() | ||
| if version_year < 2024 and NVDAState._allowDeprecatedAPI(): | ||
| _addAudioCombos(self, settingsSizerHelper) | ||
|
|
||
| def postInit(self): | ||
| # Finally, ensure that focus is on the synthlist | ||
|
|
@@ -1130,6 +1134,8 @@ def onOk(self, evt): | |
| # The list of synths has not been populated yet, so we didn't change anything in this panel | ||
| return | ||
|
|
||
| config.conf["speech"]["outputDevice"] = self.deviceList.GetStringSelection() | ||
|
|
||
| newSynth=self.synthNames[self.synthList.GetSelection()] | ||
| if not setSynth(newSynth): | ||
| _synthWarningDialog(newSynth.name) | ||
|
codeofdusk marked this conversation as resolved.
Outdated
|
||
|
|
@@ -2566,6 +2572,38 @@ def _synthWarningDialog(newSynth: str): | |
| ) | ||
|
|
||
|
|
||
| def _addAudioCombos(panel, sHelper): | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can this please get type hints?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. any thoughts on making this a static method? it will greatly simplify the diff and also simplify reverting in 2024.1 |
||
| "#15486: temporarily re-add audio options to synth dialog for 2023.3." | ||
| # Translators: This is the label for the select output device combo in the synthesizer dialog. | ||
|
codeofdusk marked this conversation as resolved.
Outdated
|
||
| # Examples of an output device are default soundcard, usb headphones, etc. | ||
| deviceListLabelText = _("Audio output &device:") | ||
| deviceNames = nvwave.getOutputDeviceNames() | ||
| # #11349: On Windows 10 20H1 and 20H2, Microsoft Sound Mapper returns an empty string. | ||
| if deviceNames[0] in ("", "Microsoft Sound Mapper"): | ||
| # Translators: name for default (Microsoft Sound Mapper) audio output device. | ||
| deviceNames[0] = _("Microsoft Sound Mapper") | ||
| panel.deviceList = sHelper.addLabeledControl(deviceListLabelText, wx.Choice, choices=deviceNames) | ||
| panel.bindHelpEvent("SelectSynthesizerOutputDevice", panel.deviceList) | ||
| try: | ||
| selection = deviceNames.index(config.conf["speech"]["outputDevice"]) | ||
| except ValueError: | ||
| selection = 0 | ||
| panel.deviceList.SetSelection(selection) | ||
|
|
||
| # Translators: This is a label for the audio ducking combo box in the Audio Settings dialog. | ||
| duckingListLabelText = _("Audio d&ucking mode:") | ||
| panel.duckingList = sHelper.addLabeledControl( | ||
| duckingListLabelText, | ||
| wx.Choice, | ||
| choices=[mode.displayString for mode in audioDucking.AudioDuckingMode] | ||
| ) | ||
| panel.bindHelpEvent("SelectSynthesizerDuckingMode", panel.duckingList) | ||
| index = config.conf["audio"]["audioDuckingMode"] | ||
| panel.duckingList.SetSelection(index) | ||
| if not audioDucking.isAudioDuckingSupported(): | ||
| panel.duckingList.Disable() | ||
|
|
||
|
|
||
| class AudioPanel(SettingsPanel): | ||
| # Translators: This is the label for the audio settings panel. | ||
| title = _("Audio") | ||
|
|
@@ -2574,34 +2612,7 @@ class AudioPanel(SettingsPanel): | |
| def makeSettings(self, settingsSizer: wx.BoxSizer) -> None: | ||
| sHelper = guiHelper.BoxSizerHelper(self, sizer=settingsSizer) | ||
|
|
||
| # Translators: This is the label for the select output device combo in the synthesizer dialog. | ||
| # Examples of an output device are default soundcard, usb headphones, etc. | ||
| deviceListLabelText = _("Audio output &device:") | ||
| deviceNames = nvwave.getOutputDeviceNames() | ||
| # #11349: On Windows 10 20H1 and 20H2, Microsoft Sound Mapper returns an empty string. | ||
| if deviceNames[0] in ("", "Microsoft Sound Mapper"): | ||
| # Translators: name for default (Microsoft Sound Mapper) audio output device. | ||
| deviceNames[0] = _("Microsoft Sound Mapper") | ||
| self.deviceList = sHelper.addLabeledControl(deviceListLabelText, wx.Choice, choices=deviceNames) | ||
| self.bindHelpEvent("SelectSynthesizerOutputDevice", self.deviceList) | ||
| try: | ||
| selection = deviceNames.index(config.conf["speech"]["outputDevice"]) | ||
| except ValueError: | ||
| selection = 0 | ||
| self.deviceList.SetSelection(selection) | ||
|
|
||
| # Translators: This is a label for the audio ducking combo box in the Audio Settings dialog. | ||
| duckingListLabelText = _("Audio d&ucking mode:") | ||
| self.duckingList = sHelper.addLabeledControl( | ||
| duckingListLabelText, | ||
| wx.Choice, | ||
| choices=[mode.displayString for mode in audioDucking.AudioDuckingMode] | ||
| ) | ||
| self.bindHelpEvent("SelectSynthesizerDuckingMode", self.duckingList) | ||
| index = config.conf["audio"]["audioDuckingMode"] | ||
| self.duckingList.SetSelection(index) | ||
| if not audioDucking.isAudioDuckingSupported(): | ||
| self.duckingList.Disable() | ||
| _addAudioCombos(self, sHelper) | ||
|
|
||
| # Translators: This is the label for a checkbox control in the | ||
| # Audio settings panel. | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.