Skip to main content

Speech

Contents

Text To Speech (TTS) API

To use this API please send a request to for more information on the API naming convention used. For licensing reasons Trimble Maps needs to correctly report the integrations using this capability as it is opening access to third party software.

This API is used to send the request to CoPilot to speak the TTS message through CoPilot. For this to work CoPilot should have TTS voices selected.

Supported SinceMinimum Operating System
CoPilot 9.2.0Windows 10, Android 4.1

Syntax (Prototyped in alkmsg.h)

long Msg_ (const char* pString);

Parameters

ParameterDescription
pStringString to be spoken. For Example “Welcome to CoPilot”

Return Value

  • -1 or less than 0 - Error
  • Greater than zero - Successful in sending the request to CoPilot.

Related APIs

  • Msg_TTSRequestCallback - Used to set the callback and receive notification about when the message is being played.

Note: The requested voice can be interrupted if there is another high priority message to be played such as Turn Instruction.


Msg_TTSRequestCallback

This API is used to set callback to receive notifications when requesting a TTS message to be played by CoPilot.

Supported SinceMinimum Operating System
CoPilot 9.2.0Windows 10, Android 4.1

Syntax (Prototyped in alkmsg.h)

long Msg_TTSRequestCallback(void* fnProcessMsg, callingConvention convention =
convention_default);

Parameters

ParameterDescription
fnProcessMsgType call back function of the following type. typedef void (*MsgFlexTtsCallback) (char* cName, char* cStr, int iResponse);
ConventionCalling convention – Managed Apps should use convention_stdcall

For Android and using JNI layer

Syntax (Prototyped in AlkMsg.java)

long Msg_TTSRequestCallback(String callbackFunctionName,
   int convention,
   Object callBackObj);

Parameters

ParameterDescription
callbackFunctionNamecallback function name of type MsgFlexTtsCallback
conventionCalling convention. Should use convention_default.
callBackObjPass the object of the class which implemented CallbackFunctionName method so JNI layer will call this method once message arrived.

Return Value

  • 1

Note

The requested voice can be interrupted if there is another high priority message to be played such as Turn Instruction.

Enum

enum callingConvention

{
convention_default,
convention_cdecl,
convention_stdcall
};

MsgFlexTTSCallback

Function definition of the callback function when setting a callback using Msg_TTSRequestCallback.

Supported SinceMinimum Operating System
CoPilot 9.2.0Windows 10, Android 4.1

Syntax (Prototyped in alkmsg.h)

typedef void (*MsgFlexTtsCallback) (char* cName, char* cStr, int iResponse);

For Android and using JNI layer

Syntax (Prototyped in AlkMsg.java)

void MsgFlexTtsCallback (String cName,
                         String cStr,
                         int iResponse);

Parameters

ParameterDescription
cNameFlex message name, client application can ignore it.
cStrString requested to be played
iResponse0,1,2 Corresponding to following Enum enum ETtsEvent { ENoTts = 0, EPlaying, EInterrupted }; ENoTts – TTS voice is not enabled in CoPilot EPlaying – About to play the requested string EInterrupted – Interrupting the requested string (cStr) to play the higher priority message (Turn Instruction)

Return Value

  • 1
Last updated October 19, 2022.
Contents