class Transcription::ConversationTranslator

class Transcription::ConversationTranslator
  : public std::enable_shared_from_this< ConversationTranslator >

A conversation translator that enables a connected experience where participants can use their own devices to see everyone else's recognitions and IMs in their own languages. Participants can also speak and send IMs to others. Added in 1.9.0.

Members

SessionStarted

Syntax: public EventSignal< const SessionEventArgs & > SessionStarted;

Signal for events indicating the start of a transcription session (operation).

SessionStopped

Syntax: public EventSignal< const SessionEventArgs & > SessionStopped;

Signal for events indicating the end of a transcription session (operation).

Canceled

Syntax: public EventSignal< const ConversationTranslationCanceledEventArgs & > Canceled;

Signal for events containing canceled recognition results (indicating a recognition attempt that was canceled as a result or a direct cancellation request or, alternatively, a transport or protocol failure).

ParticipantsChanged

Syntax: public EventSignal< const ConversationParticipantsChangedEventArgs & > ParticipantsChanged;

Signal for events indicating the conversation participants have changed.

ConversationExpiration

Syntax: public EventSignal< const ConversationExpirationEventArgs & > ConversationExpiration;

Signal for event indicating how many minutes are left until a conversation expires.

Transcribing

Syntax: public EventSignal< const ConversationTranslationEventArgs & > Transcribing;

Signal for events containing intermediate translated conversation transcription results.

Transcribed

Syntax: public EventSignal< const ConversationTranslationEventArgs & > Transcribed;

Signal for events containing final translated conversation transcription results. (indicating a successful recognition attempt).

TextMessageReceived

Syntax: public EventSignal< const ConversationTranslationEventArgs & > TextMessageReceived;

Raised when a text message is received from the conversation.

Properties

Syntax: public PropertyCollection & Properties;

A collection of properties and their values defined for this ConversationTranslator.

~ConversationTranslator

Syntax: public inline virtual ~ConversationTranslator ( );

Destructor.

JoinConversationAsync

Syntax: public inline std::future< void > JoinConversationAsync ( std::shared_ptr< Conversation > conversation , const std::string & nickname );

Joins a conversation. After you call this, you will start receiving events.

Parameters

  • conversation The conversation instance to use. This instance can be used by the host to manage the conversation.

  • nickname The display name to use for the current participant in the conversation.

Returns

An asynchronous operation.

JoinConversationAsync

Syntax: public inline std::future< void > JoinConversationAsync ( const std::string & conversationId , const std::string & nickname , const std::string & language );

Joins a conversation. After you call this, you will start receiving events.

Parameters

  • conversationId The identifier of the conversation you want to join.

  • nickname The display name of the current participant in the conversation.

  • language The language the participant is using.

Returns

An asynchronous operation.

StartTranscribingAsync

Syntax: public inline std::future< void > StartTranscribingAsync ( );

Starts sending audio to the conversation service for speech recognition.

Returns

An asynchronous operation.

StopTranscribingAsync

Syntax: public inline std::future< void > StopTranscribingAsync ( );

Stops sending audio to the conversation service.

Returns

An asynchronous operation.

SendTextMessageAsync

Syntax: public inline std::future< void > SendTextMessageAsync ( const std::string & message );

Sends an instant message to all participants in the conversation. This instant message will be translated into each participant's text language.

Parameters

  • message The message to send.

Returns

An asynchronous operation.

LeaveConversationAsync

Syntax: public inline std::future< void > LeaveConversationAsync ( );

Leaves the current conversation. After this is called, you will no longer receive any events.

Returns

An asynchronous operation.

SetAuthorizationToken

Syntax: public inline void SetAuthorizationToken ( const std::string & authToken , const std::string & region );

Sets the Cognitive Speech authorization token that will be used for connecting to the server.

Parameters

  • authToken The authorization token.

  • region The Azure region for this token.

GetAuthorizationToken

Syntax: public inline std::string GetAuthorizationToken ( );

Gets the authorization token.

Returns

Authorization token

GetParticipantId

Syntax: public inline std::string GetParticipantId ( );

Gets your participant identifier.

Returns

Participant ID

FromConfig

Syntax: public inline static std::shared_ptr< ConversationTranslator > FromConfig ( std::shared_ptr< Audio::AudioConfig > audioConfig );

Creates a conversation translator from an audio config.

Parameters

  • audioConfig Audio configuration.

Returns

Smart pointer to conversation translator instance.

ConversationTranslator

Syntax: protected inline explicit ConversationTranslator ( SPXCONVERSATIONTRANSLATORHANDLE handle );

OnSessionEventChanged

Syntax: protected inline void OnSessionEventChanged ( const EventSignal< const SessionEventArgs & > & evt );

OnCanceledEventChanged

Syntax: protected inline void OnCanceledEventChanged ( const EventSignal< const ConversationTranslationCanceledEventArgs & > & );

OnParticipantsEventChanged

Syntax: protected inline void OnParticipantsEventChanged ( const EventSignal< const ConversationParticipantsChangedEventArgs & > & );

OnExpirationEventChanged

Syntax: protected inline void OnExpirationEventChanged ( const EventSignal< const ConversationExpirationEventArgs & > & );

OnTranscriptionEventChanged

Syntax: protected inline void OnTranscriptionEventChanged ( const EventSignal< const ConversationTranslationEventArgs & > & evt );

OnTextMessageEventChanged

Syntax: protected inline void OnTextMessageEventChanged ( const EventSignal< const ConversationTranslationEventArgs & > & );