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 Since | Minimum Operating System |
---|---|
CoPilot 9.2.0 | Windows 10, Android 4.1 |
Syntax (Prototyped in alkmsg.h)
long Msg_ (const char* pString);
Parameters
Parameter | Description |
---|---|
pString
| String 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 Since | Minimum Operating System |
---|---|
CoPilot 9.2.0 | Windows 10, Android 4.1 |
Syntax (Prototyped in alkmsg.h)
long Msg_TTSRequestCallback(void* fnProcessMsg, callingConvention convention =
convention_default);
Parameters
Parameter | Description |
---|---|
fnProcessMsg
| Type call back function of the following type. typedef void (*MsgFlexTtsCallback) (char* cName, char* cStr, int iResponse); |
Convention
| Calling 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
Parameter | Description |
---|---|
callbackFunctionName
| callback function name of type MsgFlexTtsCallback |
convention
| Calling convention. Should use convention_default. |
callBackObj
| Pass 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 Since | Minimum Operating System |
---|---|
CoPilot 9.2.0 | Windows 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
Parameter | Description |
---|---|
cName
| Flex message name, client application can ignore it. |
cStr
| String requested to be played |
iResponse
| 0,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