類別 SpeechSynthesizer
class SpeechSynthesizer
: public std::enable_shared_from_this< SpeechSynthesizer >
語音合成器類別。 已在 1.14.0 版中更新。
成員
性能
語法:public PropertyCollection & Properties;
為此SpeechSynthesizer定義的屬性及其值集合。
SynthesisStarted
語法:public EventSignal< const SpeechSynthesisEventArgs & > SynthesisStarted;
事件表示剛開始合成時,會收到語音合成結果。
合成
語法:public EventSignal< const SpeechSynthesisEventArgs & > Synthesizing;
事件表示在合成進行時收到語音合成結果。
SynthesisCompleted
語法:public EventSignal< const SpeechSynthesisEventArgs & > SynthesisCompleted;
事件表示合成完成時會收到語音合成結果。
SynthesisCanceled
語法:public EventSignal< const SpeechSynthesisEventArgs & > SynthesisCanceled;
事件表示取消合成時,會收到語音合成結果。
WordBoundary
語法:public EventSignal< const SpeechSynthesisWordBoundaryEventArgs & > WordBoundary;
事件表示在合成進行時,會收到語音合成字邊界。 已在1.7.0版中新增。
VisemeReceived
語法:public EventSignal< const SpeechSynthesisVisemeEventArgs & > VisemeReceived;
事件表示在合成進行時收到語音合成viseme事件。 已在1.16.0版中新增。
BookmarkReached
語法:public EventSignal< const SpeechSynthesisBookmarkEventArgs & > BookmarkReached;
事件會發出語音合成書籤在合成進行時到達的訊號。 已在1.16.0版中新增。
SpeakText
語法:public inline std::shared_ptr< SpeechSynthesisResult > SpeakText ( const std::string & text );
以同步方式在純文字上執行語音合成。
參數
-
text
用於合成的純文字。
退貨
智慧型指標會包裝語音合成結果。
SpeakText
語法:public inline std::shared_ptr< SpeechSynthesisResult > SpeakText ( const std::wstring & text );
以同步方式在純文字上執行語音合成。 已在1.9.0中新增。
參數
-
text
用於合成的純文字。
退貨
智慧型指標會包裝語音合成結果。
SpeakSsml
語法:public inline std::shared_ptr< SpeechSynthesisResult > SpeakSsml ( const std::string & ssml );
以同步方式在 SSML 上執行語音合成。
參數
-
ssml
用於合成的 SSML。
退貨
智慧型指標會包裝語音合成結果。
SpeakSsml
語法:public inline std::shared_ptr< SpeechSynthesisResult > SpeakSsml ( const std::wstring & ssml );
以同步方式在 SSML 上執行語音合成。 已在1.9.0版中新增。
參數
-
ssml
用於合成的 SSML。
退貨
智慧型指標會包裝語音合成結果。
說
語法:public inline std::shared_ptr< SpeechSynthesisResult > Speak ( const std::shared_ptr< SpeechSynthesisRequest > & request );
以同步方式在要求上執行語音合成。 此 API 可用來從輸入文字數據流合成語音,以減少文字產生案例的延遲。 注意:此功能處於預覽狀態,而且可能會變更。 已在1.37.0版中新增。
參數
-
request
合成要求。
退貨
智慧型指標會包裝語音合成結果。
SpeakTextAsync
語法:public inline std::future< std::shared_ptr< SpeechSynthesisResult > > SpeakTextAsync ( const std::string & text );
以異步方式在純文本上執行語音合成。
參數
-
text
用於合成的純文字。
退貨
表示合成的異步作。 它會傳回 SpeechSynthesisResult 值,結果。
SpeakTextAsync
語法:public inline std::future< std::shared_ptr< SpeechSynthesisResult > > SpeakTextAsync ( const std::wstring & text );
以異步方式在純文本上執行語音合成。 已在1.9.0版中新增。
參數
-
text
用於合成的純文字。
退貨
表示合成的異步作。 它會傳回 SpeechSynthesisResult 值,結果。
SpeakSsmlAsync
語法:public inline std::future< std::shared_ptr< SpeechSynthesisResult > > SpeakSsmlAsync ( const std::string & ssml );
以異步方式在 SSML 上執行語音合成。
參數
-
ssml
用於合成的 SSML。
退貨
表示合成的異步作。 它會傳回 SpeechSynthesisResult 值,結果。
SpeakSsmlAsync
語法:public inline std::future< std::shared_ptr< SpeechSynthesisResult > > SpeakSsmlAsync ( const std::wstring & ssml );
以異步方式在 SSML 上執行語音合成。 已在1.9.0版中新增。
參數
-
ssml
用於合成的 SSML。
退貨
表示合成的異步作。 它會傳回 SpeechSynthesisResult 值,結果。
SpeakAsync
語法:public inline std::future< std::shared_ptr< SpeechSynthesisResult > > SpeakAsync ( const std::shared_ptr< SpeechSynthesisRequest > & request );
在要求上同步執行語音合成。 此 API 可用來從輸入文字數據流合成語音,以減少文字產生案例的延遲。 注意:此功能處於預覽狀態,而且可能會變更。 已在1.37.0版中新增。
參數
-
request
合成要求。
退貨
表示合成的異步作。 它會傳回 SpeechSynthesisResult 值,結果。
StartSpeakingText
語法:public inline std::shared_ptr< SpeechSynthesisResult > StartSpeakingText ( const std::string & text );
以同步方式在純文字上啟動語音合成。
參數
-
text
用於合成的純文字。
退貨
智慧型指標會包裝語音合成結果。
StartSpeakingText
語法:public inline std::shared_ptr< SpeechSynthesisResult > StartSpeakingText ( const std::wstring & text );
以同步方式在純文字上啟動語音合成。 已在1.9.0版中新增。
參數
-
text
用於合成的純文字。
退貨
智慧型指標會包裝語音合成結果。
StartSpeakingSsml
語法:public inline std::shared_ptr< SpeechSynthesisResult > StartSpeakingSsml ( const std::string & ssml );
以同步方式在 SSML 上啟動語音合成。
參數
-
ssml
用於合成的 SSML。
退貨
智慧型指標會包裝語音合成結果。
StartSpeakingSsml
語法:public inline std::shared_ptr< SpeechSynthesisResult > StartSpeakingSsml ( const std::wstring & ssml );
以同步方式在 SSML 上啟動語音合成。 已在1.9.0版中新增。
參數
-
ssml
用於合成的 SSML。
退貨
智慧型指標會包裝語音合成結果。
StartSpeaking
語法:public inline std::shared_ptr< SpeechSynthesisResult > StartSpeaking ( const std::shared_ptr< SpeechSynthesisRequest > & request );
在要求上以同步方式啟動語音合成。 此 API 可用來從輸入文字數據流合成語音,以減少文字產生案例的延遲。 注意:此功能處於預覽狀態,而且可能會變更。 已在1.37.0版中新增。
參數
-
request
合成要求。
退貨
智慧型指標會包裝語音合成結果。
StartSpeakingTextAsync
語法:public inline std::future< std::shared_ptr< SpeechSynthesisResult > > StartSpeakingTextAsync ( const std::string & text );
以異步方式在純文本上啟動語音合成。
參數
-
text
用於合成的純文字。
退貨
表示合成的異步作。 它會傳回 SpeechSynthesisResult 值,結果。
StartSpeakingTextAsync
語法:public inline std::future< std::shared_ptr< SpeechSynthesisResult > > StartSpeakingTextAsync ( const std::wstring & text );
以異步方式在純文本上啟動語音合成。 已在1.9.0版中新增。
參數
-
text
用於合成的純文字。
退貨
表示合成的異步作。 它會傳回 SpeechSynthesisResult 值,結果。
StartSpeakingSsmlAsync
語法:public inline std::future< std::shared_ptr< SpeechSynthesisResult > > StartSpeakingSsmlAsync ( const std::string & ssml );
以異步方式在 SSML 上啟動語音合成。
參數
-
ssml
用於合成的 SSML。
退貨
表示合成的異步作。 它會傳回 SpeechSynthesisResult 值,結果。
StartSpeakingSsmlAsync
語法:public inline std::future< std::shared_ptr< SpeechSynthesisResult > > StartSpeakingSsmlAsync ( const std::wstring & ssml );
以異步方式在 SSML 上啟動語音合成。 已在1.9.0版中新增。
參數
-
ssml
用於合成的 SSML。
退貨
表示合成的異步作。 它會傳回 SpeechSynthesisResult 值,結果。
StopSpeakingAsync
語法:public inline std::future< void > StopSpeakingAsync ( );
以異步方式停止語音合成。 已在1.14.0版中新增。
退貨
空的未來。
GetVoicesAsync
語法:public inline std::future< std::shared_ptr< SynthesisVoicesResult > > GetVoicesAsync ( const std::string & locale );
以異步方式取得可用的語音。 已在1.16.0版中新增。
參數
-
locale
以BCP-47格式指定語音的地區設定;或將它保留空白,以取得所有可用的語音。
退貨
代表語音清單的異步作。 其會傳回結果為 SynthesisVoicesResult 的值。
SetAuthorizationToken
語法:public inline void SetAuthorizationToken ( const std::string & token );
設定將用於連線至服務的授權令牌。 注意:呼叫端必須確定授權令牌有效。 授權令牌到期之前,呼叫端必須以新的有效令牌呼叫此 setter 來重新整理它。 否則,合成器會在語音合成時遇到錯誤。 已在1.7.0版中新增。
參數
-
token
授權令牌。
GetAuthorizationToken
語法:public inline std::string GetAuthorizationToken ( ) const;
取得授權令牌。 已在1.7.0版中新增。
退貨
授權令牌
~SpeechSynthesizer
語法:public inline ~SpeechSynthesizer ( );
解構函式。
FromConfig
語法:public inline static std::shared_ptr< SpeechSynthesizer > FromConfig ( std::shared_ptr< SpeechConfig > speechconfig , std::nullptr_t );
從語音設定建立語音合成器。
參數
-
speechconfig
語音設定。
退貨
智慧型指標包裝語音合成器指標。
FromConfig
語法:public inline static std::shared_ptr< SpeechSynthesizer > FromConfig ( std::shared_ptr< EmbeddedSpeechConfig > speechconfig , std::nullptr_t );
從內嵌語音設定建立語音合成器。已在1.19.0版中新增。
參數
-
speechconfig
內嵌語音設定。
退貨
智慧型指標包裝語音合成器指標。
FromConfig
語法:public inline static std::shared_ptr< SpeechSynthesizer > FromConfig ( std::shared_ptr< HybridSpeechConfig > speechconfig , std::nullptr_t );
從混合式語音設定建立語音合成器。
參數
-
speechconfig
混合式語音設定。
退貨
智慧型指標包裝語音合成器指標。
FromConfig
語法:public inline static std::shared_ptr< SpeechSynthesizer > FromConfig ( std::shared_ptr< SpeechConfig > speechconfig , std::shared_ptr< Audio::AudioConfig > audioconfig );
從語音組態和音訊組態建立語音合成器。
參數
speechconfig
語音設定。audioconfig
音訊設定。
退貨
智慧型指標包裝語音合成器指標。
FromConfig
語法:public inline static std::shared_ptr< SpeechSynthesizer > FromConfig ( std::shared_ptr< EmbeddedSpeechConfig > speechconfig , std::shared_ptr< Audio::AudioConfig > audioconfig );
從內嵌語音組態和音訊組態建立語音合成器。已在1.19.0版中新增。
參數
speechconfig
內嵌語音設定。audioconfig
音訊設定。
退貨
智慧型指標包裝語音合成器指標。
FromConfig
語法:public inline static std::shared_ptr< SpeechSynthesizer > FromConfig ( std::shared_ptr< HybridSpeechConfig > speechconfig , std::shared_ptr< Audio::AudioConfig > audioconfig );
從混合式語音組態和音訊組態建立語音合成器。
參數
speechconfig
混合式語音設定。audioconfig
音訊設定。
退貨
智慧型指標包裝語音合成器指標。
FromConfig
語法:public inline static std::shared_ptr< SpeechSynthesizer > FromConfig ( std::shared_ptr< SpeechConfig > speechconfig , std::shared_ptr< AutoDetectSourceLanguageConfig > autoDetectSourceLangConfig , std::shared_ptr< Audio::AudioConfig > audioconfig );
從語音設定、自動偵測來源語言設定和1.13.0中新增的音訊設定建立語音合成器。
參數
speechconfig
語音設定。autoDetectSourceLangConfig
自動偵測來源語言設定。audioconfig
音訊設定。
退貨
智慧型指標包裝語音合成器指標。