First, the next TTS Development Kit, Microsoft's TTS sdk5.0
# Include <windows. h>
# Include <SAPI. h>
# Include <wininet. h>
# Include <assert. h>
# Include <cstdio>
# Include <sphelper. h>
# Pragma comment (Lib, "wininet ")
Int main (INT argc, char * argv [])
{
Ispvoice * pvoice;
Ispobjecttoken * pvoicetoken;
Ienumspobjecttokens * penum;
Ulong ulcount = 0;
If (failed (: coinitialize (null )))
Return false;
Hresult hR = cocreateinstance (clsid_spvoice, null, clsctx_all, iid_ispvoice, (void **) & pvoice );
If (succeeded (HR ))
{
HR = spenumtokens (spcat_voices, null, null, & penum );
If (succeeded (HR ))
HR = penum-> getcount (& ulcount );
// Obtain a list of available voice tokens, set the voice to the token, and call speak
While (succeeded (HR) & ulcount --)
{
If (succeeded (HR ))
HR = penum-> next (1, & pvoicetoken, null );
If (succeeded (HR ))
HR = pvoice-> setvoice (pvoicetoken );
If (succeeded (HR ))
HR = pvoice-> speak (L "how are you? ", Spf_default, null );
HR = pvoice-> speak (L "Hello World", 0, null );
// Change pitch
HR = pvoice-> speak (L "This sounds normal <pitch middle = '-10'/> but the pitch drops half way through", spf_is_xml, null );
HR = pvoice-> speak (L "1234567 & sup1; & thorn; & sup1; & thorn;", 0, null );
Pvoicetoken-> release ();
Pvoicetoken = NULL;
}
Pvoice-> release ();
Pvoice = NULL;
}
: Couninitialize ();
Return true;
/*
Lpcstr url = "https: // 202.106.134.65 /";
Hinternet hinet = internetopen ("", internet_open_type_preconfig, null, null );
Assert (hinet );
Hinternet hhttps = internetopenurl (hinet, URL, null );
Assert (hhttps );
Ulong nread = 0;
Do {
Char buffer [1024];
Buffer [1000] = 0;
Internetreadfile (hhttps, buffer, 1000, & nread );
Puts (buffer );
} While (nread> 0 );
Internetclosehandle (hhttps );
Internetclosehandle (hinet );
*/
}
About: TTS vtxtauto
1. The first parameter of the member function transmits the text to be read to the TTS engine. The second parameter transmits the tone and priority of the reading, which is composed of two constants.
Constants with control priorities include:
Vtxtsp_high = 256 (& h100), read as soon as possible, join the playing queue to start
Vtxtsp_normal = 512 (& h200). By default, it is added to the end of the playback queue.
Vtxtsp_veryhigh = 128 (& h80), read immediately, can interrupt the content being read
Constants that control tone include:
Vtxtst_command = 4, command tone
Vtxtst_numbers = 32 (& H20), reading the tone of numbers
Vtxtst_question = 2 Question tone
Vtxtst_reading
Vtxtst_spreadsheet = 64 (& h40), read the tone of elements in the workbook
Vtxtst_statement = 1, the tone of speech at ordinary times
Vtxtst_warning = 8, warning tone
Isspeaking can be used to obtain the current status.
You can skip reading aloud either forward or backward by changing audioforward and audiorewind.
You can set the reading speed by modifying the speed attribute. The default value is speed = 170.
speech aloud Development Kit
www.smartysoft.cn