OSDN Git Service

Fixed inability to use certain Microsoft Speech API version 5 voices such as Koba...
authorJames Teh <jamie@jantrid.net>
Fri, 15 Mar 2013 07:27:47 +0000 (17:27 +1000)
committerJames Teh <jamie@jantrid.net>
Fri, 15 Mar 2013 07:27:47 +0000 (17:27 +1000)
Fixes #2629.

source/synthDrivers/sapi5.py
user_docs/en/changes.t2t

index cc73c4e..1c866de 100644 (file)
@@ -54,7 +54,9 @@ class SynthDriver(SynthDriver):
        def _getAvailableVoices(self):\r
                voices=OrderedDict()\r
                v=self._getVoiceTokens()\r
-               for i in range(len(v)):\r
+               # #2629: Iterating uses IEnumVARIANT and GetBestInterface doesn't work on tokens returned by some token enumerators.\r
+               # Therefore, fetch the items by index, as that method explicitly returns the correct interface.\r
+               for i in xrange(len(v)):\r
                        try:\r
                                ID=v[i].Id\r
                                name=v[i].GetDescription()\r
@@ -113,7 +115,11 @@ class SynthDriver(SynthDriver):
                        self.tts.audioOutput=self.tts.getAudioOutputs()[outputDeviceID]\r
 \r
        def _set_voice(self,value):\r
-               for voice in self._getVoiceTokens():\r
+               tokens = self._getVoiceTokens()\r
+               # #2629: Iterating uses IEnumVARIANT and GetBestInterface doesn't work on tokens returned by some token enumerators.\r
+               # Therefore, fetch the items by index, as that method explicitly returns the correct interface.\r
+               for i in xrange(len(tokens)):\r
+                       voice=tokens[i]\r
                        if value==voice.Id:\r
                                break\r
                else:\r
index 065d56b..02ef640 100644 (file)
@@ -73,6 +73,7 @@ Please see the [Commands Quick Reference keyCommands.html] document for the new
 - In IBM Lotus Symphony and OpenOffice, moving the caret now moves the review cursor if appropriate.\r
 - Adobe Flash content is now accessible in Internet Explorer in Windows 8. (#2454)\r
 - Fixed Bluetooth support for Papenmeier Braillex Trio. (#2995)\r
+- Fixed inability to use certain Microsoft Speech API version 5 voices such as Koba Speech 2 voices. (#2629)\r
 \r
 \r
 == Changes for Developers ==\r