Partager via


XSpeechToTextSendString

Displays text on the Game title screen.

Syntax

HRESULT XSpeechToTextSendString(  
         const char* speakerName,  
         const char* content,  
         XSpeechToTextType type  
)  

Parameters

speakerName   _In_z_
Type: char*

The name of the speaker that is the source of the text.

content   _In_z_
Type: char*

The text to display on the Game title screen.

type   _In_
Type: XSpeechToTextType

An enumeration value representing the source type of the text: transcribed game voice chat, in-game speech subtitles, in-game text reading, or in-game text chat. The game title uses the value of the type parameter to display either a microphone icon or a keyboard next to the text on the game screen.

Return value

Type: HRESULT

HRESULT if successful. Otherwise, returns an error code.
For a list of error codes, see Error Codes.

Remarks

Note

This function isn't safe to call on a time-sensitive thread. For more information, see Time-sensitive threads.

For this function to be successful, closed captions must be enabled. The user must enable the closed captions feature in the UI of the Game title. If the user enabled closed captions, your Game title can flag the status of closed captions by calling XClosedCaptionSetEnabled.

The following example demonstrates how to display text on the speech-to-text window.

auto hr = XSpeechToTextSendString("Sandy", "This is my text.", XSpeechToTextType::Text);
)  

Requirements

Header: XAccessibility.h

Library: xgameruntime.lib

Supported platforms: Windows, Xbox One family consoles and Xbox Series consoles

See also

XAccessibility

XSpeechToTextType

XClosedCaptionSetEnabled