SG Com
SG_Com.h
Go to the documentation of this file.
1
7
8#ifndef SG_COM_H
9#define SG_COM_H
10
11#include "SG.h"
12
16#define SG_COM_VERSION_NAME "5.2.0"
17
18#ifdef __cplusplus
19extern "C" {
20#endif
21
43
54
68
76
87
96
100 typedef struct SG_COM_Player* SG_COM_PlayerHandle;
101
105 typedef struct SG_COM_Engine* SG_COM_EngineHandle;
106
115 SG_COM_EngineHandle engine_handle,
116 char* packet,
117 sg_size packet_bytes,
118 void* custom_engine_data);
119
128 SG_COM_EngineHandle engine_handle,
129 SG_COM_Status status,
130 const char *message,
131 void* custom_engine_data);
132
141
157
163
184
185 SG_DYN SG_COM_Error SG_COM_Initialize(SG_LoggingLevel logging_level, SG_LoggingCallback logging_callback, const char* license_data, const char* license_unique_id, const char* license_custom_data);
186
193
202
210 SG_DYN unsigned int SG_COM_GetVersionNumber(void);
211
219 const SG_COM_EngineConfig *engine_config,
220 SG_COM_EngineHandle *engine_handle
221 );
222
232 const SG_COM_EngineConfig* engine_config,
233 SG_COM_EngineHandle* engine_handle,
234 const unsigned char* algorithms_file,
235 unsigned int algorithms_file_size
236 );
237
244 SG_COM_EngineHandle engine_handle
245 );
246
259 SG_COM_EngineHandle engine_handle,
260 const void* data,
261 sg_size data_bytes
262 );
263
274 SG_COM_EngineHandle engine_handle,
275 const void* data,
276 sg_size data_bytes
277 );
278
295 SG_COM_EngineHandle engine_handle,
296 int *processed_frames,
297 int *remaining_frames
298 );
299
306 SG_COM_EngineHandle engine_handle
307 );
308
318 SG_COM_EngineHandle engine_handle,
319 const char* mode
320 );
321
332 SG_COM_EngineHandle engine_handle,
333 const char* mode
334 );
335
346 SG_COM_EngineHandle engine_handle,
347 SG_COM_AutoMode auto_mode,
348 const char* mode
349 );
350
359 SG_COM_EngineHandle engine_handle
360 );
361
371 SG_COM_EngineHandle engine_handle
372 );
373
386 SG_COM_EngineHandle engine_handle,
387 const char* expression,
388 sg_size duration_ms,
389 float scale
390 );
391
400 SG_COM_EngineHandle engine_handle,
401 char* mode,
402 sg_size buffersize
403 );
404
413 SG_COM_EngineHandle engine_handle,
414 char* mode_list,
415 sg_size buffersize
416 );
417
425 SG_COM_EngineHandle engine_handle,
426 SG_COM_Role role
427 );
428
436 SG_COM_EngineHandle engine_handle,
437 SG_COM_Role *role
438 );
439
446 SG_COM_EngineHandle engine_handle,
447 SG_COM_Modifier modifier,
448 float *value
449 );
450
457 SG_COM_EngineHandle engine_handle,
458 SG_COM_Modifier modifier,
459 float value
460 );
461
469 const SG_COM_PlayerConfig *player_config,
470 SG_COM_PlayerHandle *player_handle
471 );
472
479 SG_COM_PlayerHandle player_handle
480 );
481
490 SG_COM_PlayerHandle player_handle,
491 const char *packet,
492 sg_size packet_bytes
493 );
494
503 SG_COM_PlayerHandle player_handle,
504 SG_AnimationNode **animation_nodes,
505 sg_size *num_animation_nodes
506 );
507
518 SG_COM_PlayerHandle player_handle,
519 double time_ms,
520 double *current_time_ms
521 );
522
530 SG_COM_PlayerHandle player_handle,
531 double* min_time_ms,
532 double* max_time_ms
533 );
534
535#ifdef __cplusplus
536}
537#endif
538
539#endif // SG_ANIMATION_DLL_H
unsigned int sg_size
Definition SG.h:21
void(* SG_LoggingCallback)(const char *message)
Callback that will be called by an Engine to output log messages.
Definition SG.h:86
unsigned char sg_byte
Definition SG.h:22
SG_AudioSampleType
Enum of audio sample types.
Definition SG.h:34
SG_AudioSampleRate
Enum of audio sample rates.
Definition SG.h:43
#define SG_DYN
Used to determine if we are building a shared library, as opposed to building a static library or con...
Definition SG.h:17
SG_LoggingLevel
Enum for logging level.
Definition SG.h:56
SG_DYN SG_COM_Error SG_COM_GetModeList(SG_COM_EngineHandle engine_handle, char *mode_list, sg_size buffersize)
Get a list of the available behavior modes in an Engine.
void(* SG_COM_EngineBroadcastCallback)(SG_COM_EngineHandle engine_handle, char *packet, sg_size packet_bytes, void *custom_engine_data)
Callback that will be called by an Engine to output packets.
Definition SG_Com.h:114
SG_COM_Role
Enum of roles.
Definition SG_Com.h:72
@ SG_COM_ROLE_SPEAK
Speaking role.
Definition SG_Com.h:73
@ SG_COM_ROLE_LISTEN
Listening role.
Definition SG_Com.h:74
SG_DYN SG_COM_Error SG_COM_GetModifier(SG_COM_EngineHandle engine_handle, SG_COM_Modifier modifier, float *value)
Get the value of a modifier.
SG_DYN SG_COM_Error SG_COM_ProcessTick(SG_COM_EngineHandle engine_handle, int *processed_frames, int *remaining_frames)
Performs processing necessary to move one 10ms frame through the pipeline.
SG_DYN SG_COM_Error SG_COM_GetMode(SG_COM_EngineHandle engine_handle, char *mode, sg_size buffersize)
Get the current behavior mode of an Engine.
SG_DYN SG_COM_Error SG_COM_GetPlayableRange(SG_COM_PlayerHandle player_handle, double *min_time_ms, double *max_time_ms)
Get the range of buffered animation.
SG_COM_Modifier
Enum of modifiers.
Definition SG_Com.h:58
@ SG_COM_MOD_DART_FREQ
Adjusts frequency of microdarts. Default is 1.0.
Definition SG_Com.h:66
@ SG_COM_MOD_EXPRESSION_FREQ
Adjusts frequency of expression change. Default is 1.0.
Definition SG_Com.h:64
@ SG_COM_MOD_BLINK_FREQ
Adjusts frequency of blinks. Default is 1.0.
Definition SG_Com.h:65
@ SG_COM_MOD_NONVERBAL_MAG
Adjusts magnitude of nonverbal muscle motion. Default is 1.0.
Definition SG_Com.h:60
@ SG_COM_MOD_BREATH_SPEED
Adjusts speed of breath. Default is 1.0.
Definition SG_Com.h:63
@ SG_COM_MOD_SPEECH_MAG
Adjusts magnitude of speech muscle motion. Default is 1.0.
Definition SG_Com.h:59
@ SG_COM_MOD_BREATH_MAG
Adjusts magnitude of breath. Default is 1.0.
Definition SG_Com.h:62
@ SG_COM_MOD_NONVERBAL_SPEED
Adjusts speed of nonverbal muscle motion. Default is 1.0.
Definition SG_Com.h:61
SG_DYN SG_COM_Error SG_COM_GetRole(SG_COM_EngineHandle engine_handle, SG_COM_Role *role)
Get the current role of an Engine.
SG_DYN SG_COM_Error SG_COM_UnsetAutoModes(SG_COM_EngineHandle engine_handle)
Clear the definitions for all auto modes.
SG_DYN SG_COM_Error SG_COM_CreateAltEngine(const SG_COM_EngineConfig *engine_config, SG_COM_EngineHandle *engine_handle, const unsigned char *algorithms_file, unsigned int algorithms_file_size)
Create an alternative Engine confguration using algorithms file.
SG_DYN SG_COM_Error SG_COM_Reset(SG_COM_EngineHandle engine_handle)
Clears an Engine and resets to initial state.
SG_DYN SG_COM_Error SG_COM_DestroyPlayer(SG_COM_PlayerHandle player_handle)
Destroy a Player.
void(* SG_COM_EngineStatusCallback)(SG_COM_EngineHandle engine_handle, SG_COM_Status status, const char *message, void *custom_engine_data)
Callback that will be called in the event of Engine status update.
Definition SG_Com.h:127
SG_DYN SG_COM_Error SG_COM_InsertExpression(SG_COM_EngineHandle engine_handle, const char *expression, sg_size duration_ms, float scale)
Insert an expression.
SG_DYN SG_COM_Error SG_COM_UpdateAnimation(SG_COM_PlayerHandle player_handle, double time_ms, double *current_time_ms)
Set the current play time and update the animation nodes.
SG_COM_Error
Enum of error codes.
Definition SG_Com.h:25
@ SG_COM_ERROR_INVALID_PARAM
An invalid parameter was passed to a function.
Definition SG_Com.h:31
@ SG_COM_ERROR_INPUT_OVERRUN
The input buffer does not have sufficient free space to perform the requested operation.
Definition SG_Com.h:34
@ SG_COM_ERROR_INVALID_PACKET
An invalid data packet was received.
Definition SG_Com.h:30
@ SG_COM_ERROR_OUT_OF_ORDER_PACKET_DISCARDED
Process tick was called while the previous tick was in progress.
Definition SG_Com.h:33
@ SG_COM_ERROR_CONTEXT_NOT_INITIALIZED
The SG Com context is not initialized. Call SG_COM_Initialize() first.
Definition SG_Com.h:40
@ SG_COM_ERROR_NOT_IMPLEMENTED
This operation is not implemented.
Definition SG_Com.h:37
@ SG_COM_ERROR_INVALID_HANDLE
An invalid Engine or Player was created or referenced.
Definition SG_Com.h:29
@ SG_COM_ERROR_LOW_MEMORY
A low memory condition was detected.
Definition SG_Com.h:27
@ SG_COM_ERROR_LICENSE_CHECKOUT_FAILURE
Failed to checkout a valid license.
Definition SG_Com.h:39
@ SG_COM_ERROR_UNDEFINED
An unclassified error occurred.
Definition SG_Com.h:38
@ SG_COM_ERROR_OK
No error.
Definition SG_Com.h:26
@ SG_COM_ERROR_INVALID_LICENSE
The license is invalid.
Definition SG_Com.h:28
@ SG_COM_ERROR_CONTEXT_ALREADY_INITIALIZED
The SG Com context is already initialized. Call SG_COM_Shutdown() first.
Definition SG_Com.h:41
@ SG_COM_ERROR_INPUT_UNDERRUN
The input buffer does not contain sufficient data to perform the requested operation.
Definition SG_Com.h:35
@ SG_COM_ERROR_EXCEPTION
An exception was raised, call SG_COM_GetExceptionText() for details.
Definition SG_Com.h:36
@ SG_COM_ERROR_TICK_IN_PROGRESS
Definition SG_Com.h:32
SG_DYN unsigned int SG_COM_GetVersionNumber(void)
Get the runtime version number for this library.
struct SG_COM_Player * SG_COM_PlayerHandle
Handle type.
Definition SG_Com.h:100
SG_DYN SG_COM_Error SG_COM_CreateEngine(const SG_COM_EngineConfig *engine_config, SG_COM_EngineHandle *engine_handle)
Create an Engine.
SG_DYN const char * SG_COM_GetExceptionText(void)
Retrieve exception text after SG_ERROR_EXCEPTION error.
SG_DYN SG_COM_Error SG_COM_DestroyEngine(SG_COM_EngineHandle engine_handle)
Destroy an Engine.
SG_DYN const char * SG_COM_GetVersionString(void)
Get the runtime version number for this library in string format.
SG_DYN SG_COM_Error SG_COM_SetModifier(SG_COM_EngineHandle engine_handle, SG_COM_Modifier modifier, float value)
Set the value of a modifier.
struct SG_COM_Engine * SG_COM_EngineHandle
Handle type.
Definition SG_Com.h:105
SG_COM_Status
Enum of status codes.
Definition SG_Com.h:47
@ SG_COM_STATUS_BREATH_CHANGED
The breath switched either from inhale to exhale or from exhale to inhale. The accompanying message i...
Definition SG_Com.h:52
@ SG_COM_STATUS_EXPRESSION_CHANGED
The expression of the character changed. The accompanying message contains the path of the expression...
Definition SG_Com.h:50
@ SG_COM_STATUS_MODE_CHANGED
The current behavior mode of the character changed, either manually or automatically....
Definition SG_Com.h:48
@ SG_COM_STATUS_VOICE_ACTIVITY_CHANGED
A change in voice activity was detected. The accompanying message contains "0" or "1".
Definition SG_Com.h:51
@ SG_COM_STATUS_AUTO_MODE_CHANGED
The latest triggered auto mode. The accompanying message contains name of the auto mode.
Definition SG_Com.h:49
SG_DYN SG_COM_Error SG_COM_SetRole(SG_COM_EngineHandle engine_handle, SG_COM_Role role)
Set the role of an Engine vis-a-vis the incoming speech: to move as if speaking, or to move as if lis...
SG_DYN SG_COM_Error SG_COM_SetMode(SG_COM_EngineHandle engine_handle, const char *mode)
Set the current behavior mode of an Engine.
SG_DYN SG_COM_Error SG_COM_CreatePlayer(const SG_COM_PlayerConfig *player_config, SG_COM_PlayerHandle *player_handle)
Create a Player to play the output from a Broadcast Engine.
SG_DYN SG_COM_Error SG_COM_ActivateAutoModes(SG_COM_EngineHandle engine_handle)
Activate auto modes.
SG_COM_EngineConfigFlag
Enum of Engine configuration flags.
Definition SG_Com.h:136
@ SG_COM_ENGINE_CONFIG_FIXED_RANDOM_SEED
Use a fixed seed in random number generators for deterministic output.
Definition SG_Com.h:139
@ SG_COM_ENGINE_CONFIG_NONE
Definition SG_Com.h:137
@ SG_COM_ENGINE_CONFIG_ENABLE_IDLE
Enable idle mode.
Definition SG_Com.h:138
SG_DYN SG_COM_Error SG_COM_InputAuxData(SG_COM_EngineHandle engine_handle, const void *data, sg_size data_bytes)
Input auxiliary data for processing.
SG_COM_AutoMode
Enum of auto modes.
Definition SG_Com.h:80
@ SG_COM_ACKNOWLEDGE_MODE
The mode triggered when a conditions for an acknowledgement are detected in Listen role.
Definition SG_Com.h:85
@ SG_COM_NEGATIVE_MODE
The mode triggered when negative emotion is detected.
Definition SG_Com.h:82
@ SG_COM_LAUGH_MODE
The mode triggered when a laugh is detected.
Definition SG_Com.h:84
@ SG_COM_EFFORT_MODE
The mode triggered when an effort sound is detected.
Definition SG_Com.h:83
@ SG_COM_POSITIVE_MODE
The mode triggered when positive emotion is detected.
Definition SG_Com.h:81
SG_DYN SG_COM_Error SG_COM_Initialize(SG_LoggingLevel logging_level, SG_LoggingCallback logging_callback, const char *license_data, const char *license_unique_id, const char *license_custom_data)
Initialize the internal context of SG Com.
SG_DYN SG_COM_Error SG_COM_GetAnimationNodes(SG_COM_PlayerHandle player_handle, SG_AnimationNode **animation_nodes, sg_size *num_animation_nodes)
Get the animation nodes for a given Player.
SG_DYN SG_COM_Error SG_COM_ReceivePacket(SG_COM_PlayerHandle player_handle, const char *packet, sg_size packet_bytes)
Receive an output packet from an Engine into the corresponding Player.
SG_DYN SG_COM_Error SG_COM_SetDefaultMode(SG_COM_EngineHandle engine_handle, const char *mode)
Set the default behavior mode of an Engine.
SG_DYN SG_COM_Error SG_COM_Shutdown(void)
Shut down and dispose of the internal context of SG Com.
SG_DYN SG_COM_Error SG_COM_SetAutoMode(SG_COM_EngineHandle engine_handle, SG_COM_AutoMode auto_mode, const char *mode)
Define an auto mode by mapping it to a specific behavior mode.
SG_DYN SG_COM_Error SG_COM_InputAudio(SG_COM_EngineHandle engine_handle, const void *data, sg_size data_bytes)
Input audio data for processing.
Structure containing an animation node.
Definition SG.h:74
Structure containing an Engine configuration.
Definition SG_Com.h:145
SG_AudioSampleRate audio_sample_rate
The input audio sample rate.
Definition SG_Com.h:149
SG_AudioSampleType audio_sample_type
The input audio sample type.
Definition SG_Com.h:148
SG_COM_EngineStatusCallback engine_status_callback
Callback for Engine status updates.
Definition SG_Com.h:152
SG_COM_EngineBroadcastCallback engine_broadcast_callback
Callback to broadcast packets to remote Players (nullptr if not broadcasting).
Definition SG_Com.h:151
SG_COM_EngineConfigFlag flag
Combination of engine configuration flags to enable/disable features.
Definition SG_Com.h:154
sg_size character_file_bytes
The size of the loaded character file in bytes.
Definition SG_Com.h:147
void * custom_engine_data
Custom user data (or nullptr).
Definition SG_Com.h:155
SG_COM_PlayerHandle local_player
A handle to a Player object that can be used to create local animation output from this engine.
Definition SG_Com.h:150
float buffer_sec
The maximum duration (in seconds) that the input buffer can hold.
Definition SG_Com.h:153
sg_byte * character_file_in_memory
The character file loaded into a memory buffer.
Definition SG_Com.h:146
Structure containing a Player configuration.
Definition SG_Com.h:91
sg_byte * character_file_in_memory
The character file data loaded into memory.
Definition SG_Com.h:92
float buffer_sec
The maximum duration (in seconds) that the output buffer can hold.
Definition SG_Com.h:94
sg_size character_file_bytes
The size of the character file data in bytes.
Definition SG_Com.h:93