I am a Software Development Engineer in Test working for the Windows Sound team. You can contact me via email: mateer at microsoft dot com
Friend key: 28904932216450_59cd9d55374be03d8167d37c8ff4196b
Stamatis Pap asked in a forum thread how to use a Speech API ISpVoice with a non-default audio device. This MSDN article shows how to use SpEnumTokens to list all the currently active audio outputs, but the number and order of audio outputs is subject to change as things come and go, or as the default audio device changes.
I spent some time poking around the Speech API documentation and discovered that each audio output object has a DeviceId string value which is the WASAPI endpoint ID; this is the way to recognize a given audio output rather than relying on enumeration order.
As part of figuring this out, as a side effect I created a command-line tool to dump all the speech objects and all of their properties.
Source and binaries attached.
Pseudocode:
Here's the output on my system. Note the audio output has a DeviceId string value which matches the WASAPI endpoint ID.
>speech-attributes.exe
-- SPCAT_AUDIOOUT -- #1: [[Speakers] ([High Definition Audio Device])] Attributes Vendor = Microsoft Technology = MMSys (default) = [[Speakers] ([High Definition Audio Device])] CLSID = {A8C680EB-3D32-11D2-9EE7-00C04F797396} DeviceName = [[Speakers] ([High Definition Audio Device])] DeviceId = {0.0.0.00000000}.{c2cbdacb-a70d-4629-8368-542a00f5a4b0}
-- SPCAT_AUDIOIN --
-- SPCAT_VOICES -- #1: Microsoft Zira Desktop - English (United States) Attributes Version = 10.4 Language = 409 Gender = Female Age = Adult SharedPronunciation = Name = Microsoft Zira Desktop Vendor = Microsoft (default) = Microsoft Zira Desktop - English (United States) LangDataPath = C:\Windows\Speech\Engines\TTS\en-US\MSTTSLocEnUS.dat VoicePath = C:\Windows\Speech\Engines\TTS\en-US\M1033ZIR 409 = Microsoft Zira Desktop - English (United States) CLSID = {C64501F6-E6E6-451f-A150-25D0839BC510}
-- SPCAT_RECOGNIZERS --
-- SPCAT_APPLEXICONS --
-- SPCAT_PHONECONVERTERS -- #1: Simplified Chinese Phone Converter Attributes Language = 804 (default) = Simplified Chinese Phone Converter PhoneMap = (lengthy value redacted) CLSID = {9185F743-1143-4C28-86B5-BFF14F20E5C8} #2: English Phone Converter Attributes Language = 409 (default) = English Phone Converter PhoneMap = (lengthy value redacted) CLSID = {9185F743-1143-4C28-86B5-BFF14F20E5C8} #3: French Phone Converter Attributes Language = 40C (default) = French Phone Converter PhoneMap = (lengthy value redacted) CLSID = {9185F743-1143-4C28-86B5-BFF14F20E5C8} #4: German Phone Converter Attributes Language = 407 (default) = German Phone Converter PhoneMap = (lengthy value redacted) CLSID = {9185F743-1143-4C28-86B5-BFF14F20E5C8} #5: Japanese Phone Converter Attributes Language = 411 NumericPhones = NoDelimiter = (default) = Japanese Phone Converter PhoneMap = (lengthy value redacted) CLSID = {9185F743-1143-4C28-86B5-BFF14F20E5C8} #6: Spanish Phone Converter Attributes Language = 40A;C0A (default) = Spanish Phone Converter PhoneMap = (lengthy value redacted) CLSID = {9185F743-1143-4C28-86B5-BFF14F20E5C8} #7: Traditional Chinese Phone Converter Attributes Language = 404 NumericPhones = NoDelimiter = (default) = Traditional Chinese Phone Converter PhoneMap = (lengthy value redacted) CLSID = {9185F743-1143-4C28-86B5-BFF14F20E5C8} #8: Universal Phone Converter Attributes Language = (lengthy value redacted) (default) = Universal Phone Converter PhoneMap = (lengthy value redacted) CLSID = {9185F743-1143-4C28-86B5-BFF14F20E5C8}
-- SPCAT_RECOPROFILES -- None found.