Skip to content

Commit 23a5c57

Browse files
authored
Merge 2ffc74b into 3f89b60
2 parents 3f89b60 + 2ffc74b commit 23a5c57

5 files changed

Lines changed: 19 additions & 13 deletions

File tree

source/config/__init__.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
from .featureFlag import (
4040
_transformSpec_AddFeatureFlagDefault,
4141
_validateConfig_featureFlag,
42+
FeatureFlag,
4243
)
4344
from typing import (
4445
Any,
@@ -1247,13 +1248,17 @@ def __setitem__(
12471248
except KeyError:
12481249
pass
12491250
else:
1250-
if self._isSection(val) or self._isSection(curVal):
1251-
# If value is a section, continue to update
1252-
pass
1253-
elif str(val) == str(curVal):
1251+
if (
1252+
# Feature flags override __eq__.
12541253
# Check str comparison as this is what is written to the config.
12551254
# If the value is unchanged, do not update
12561255
# or mark the profile as dirty.
1256+
(
1257+
isinstance(val, FeatureFlag)
1258+
or isinstance(curVal, FeatureFlag)
1259+
)
1260+
and str(val) == str(curVal)
1261+
):
12571262
return
12581263

12591264
# Set this value in the most recently activated profile.

source/synthDriverHandler.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -428,8 +428,9 @@ def getSynth() -> Optional[SynthDriver]:
428428

429429

430430
def getSynthInstance(name, asDefault=False):
431+
from synthDrivers.oneCore import OneCoreSynthDriver
431432
newSynth: SynthDriver = _getSynthDriver(name)()
432-
if asDefault and newSynth.name == 'oneCore':
433+
if asDefault and isinstance(newSynth, OneCoreSynthDriver):
433434
# Will raise an exception if oneCore does not support the system language
434435
newSynth._getDefaultVoice(pickAny=False)
435436
newSynth.initSettings()

source/synthDrivers/espeak.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -422,10 +422,10 @@ def _set_inflection(self,val):
422422
val=self._percentToParam(val, _espeak.minPitch, _espeak.maxPitch)
423423
_espeak.setParameter(_espeak.espeakRANGE,val,0)
424424

425-
def _get_volume(self):
425+
def _get_volume(self) -> int:
426426
return _espeak.getParameter(_espeak.espeakVOLUME,1)
427427

428-
def _set_volume(self,volume):
428+
def _set_volume(self, volume: int):
429429
_espeak.setParameter(_espeak.espeakVOLUME,volume,0)
430430

431431
def _getAvailableVoices(self):

source/synthDrivers/oneCore.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -222,9 +222,9 @@ def __init__(self):
222222
# Set initial values for parameters that can't be queried when prosody is not supported.
223223
# This initialises our cache for the value.
224224
# When prosody is supported, the values are used for cachign reasons.
225-
self._rate = 50
226-
self._pitch = 50
227-
self._volume = 100
225+
self._rate: int = 50
226+
self._pitch: int = 50
227+
self._volume: int = 100
228228

229229
if self.supportsProsodyOptions:
230230
self._dll.ocSpeech_getPitch.restype = ctypes.c_double
@@ -339,13 +339,13 @@ def _set_pitch(self, pitch):
339339
rawPitch = self._percentToParam(pitch, self.MIN_PITCH, self.MAX_PITCH)
340340
self._queuedSpeech.append((self._dll.ocSpeech_setPitch, rawPitch))
341341

342-
def _get_volume(self):
342+
def _get_volume(self) -> int:
343343
if not self.supportsProsodyOptions:
344344
return self._volume
345345
rawVolume = self._dll.ocSpeech_getVolume(self._ocSpeechToken)
346346
return int(rawVolume * 100)
347347

348-
def _set_volume(self, volume):
348+
def _set_volume(self, volume: int):
349349
self._volume = volume
350350
if not self.supportsProsodyOptions:
351351
return

source/synthDrivers/sapi5.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ def _get_rate(self):
163163
def _get_pitch(self):
164164
return self._pitch
165165

166-
def _get_volume(self):
166+
def _get_volume(self) -> int:
167167
return self.tts.volume
168168

169169
def _get_voice(self):

0 commit comments

Comments
 (0)