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.3.0"
17
18#ifdef __cplusplus
19extern "C" {
20#endif
21
25 typedef enum {
43
47 typedef enum {
55
59 typedef enum {
70
74 typedef enum {
78
82 typedef enum {
89
93 typedef struct SG_COM_PlayerConfig {
96 float buffer_sec;
98
102 typedef struct SG_COM_Player* SG_COM_PlayerHandle;
103
107 typedef struct SG_COM_Engine* SG_COM_EngineHandle;
108
117 SG_COM_EngineHandle engine_handle,
118 char* packet,
119 sg_size packet_bytes,
120 void* custom_engine_data);
121
130 SG_COM_EngineHandle engine_handle,
131 SG_COM_Status status,
132 const char *message,
133 void* custom_engine_data);
134
138 typedef enum {
143
147 typedef struct SG_COM_EngineConfig {
159
163 typedef struct SG_COM_Position {
164 float x;
165 float y;
166 float z;
168
174
195
196 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);
197
204
213
221 SG_DYN unsigned int SG_COM_GetVersionNumber(void);
222
230 const SG_COM_EngineConfig *engine_config,
231 SG_COM_EngineHandle *engine_handle
232 );
233
243 const SG_COM_EngineConfig* engine_config,
244 SG_COM_EngineHandle* engine_handle,
245 const unsigned char* algorithms_file,
246 unsigned int algorithms_file_size
247 );
248
255 SG_COM_EngineHandle engine_handle
256 );
257
270 SG_COM_EngineHandle engine_handle,
271 const void* data,
272 sg_size data_bytes
273 );
274
285 SG_COM_EngineHandle engine_handle,
286 const void* data,
287 sg_size data_bytes
288 );
289
306 SG_COM_EngineHandle engine_handle,
307 int *processed_frames,
308 int *remaining_frames
309 );
310
317 SG_COM_EngineHandle engine_handle
318 );
319
329 SG_COM_EngineHandle engine_handle,
330 const char* mode
331 );
332
343 SG_COM_EngineHandle engine_handle,
344 const char* mode
345 );
346
357 SG_COM_EngineHandle engine_handle,
358 SG_COM_AutoMode auto_mode,
359 const char* mode
360 );
361
370 SG_COM_EngineHandle engine_handle
371 );
372
382 SG_COM_EngineHandle engine_handle
383 );
384
397 SG_COM_EngineHandle engine_handle,
398 const char* expression,
399 sg_size duration_ms,
400 float scale
401 );
402
411 SG_COM_EngineHandle engine_handle,
412 char* mode,
413 sg_size buffersize
414 );
415
424 SG_COM_EngineHandle engine_handle,
425 char* mode_list,
426 sg_size buffersize
427 );
428
436 SG_COM_EngineHandle engine_handle,
437 SG_COM_Role role
438 );
439
447 SG_COM_EngineHandle engine_handle,
448 SG_COM_Role *role
449 );
450
459 SG_COM_EngineHandle engine_handle,
460 SG_COM_Modifier modifier,
461 float *value
462 );
463
472 SG_COM_EngineHandle engine_handle,
473 SG_COM_Modifier modifier,
474 float value
475 );
476
489 SG_COM_EngineHandle engine_handle,
490 SG_COM_Position* target_position,
491 SG_COM_Position* left_eye_base_position,
492 SG_COM_Position* right_eye_base_position,
493 SG_COM_Position* eye_root_base_position
494 );
495
504 SG_COM_EngineHandle engine_handle,
505 float activation
506 );
507
519 SG_COM_EngineHandle engine_handle,
520 char* left_eye_joint,
521 char* right_eye_joint,
522 char* eye_root_joint,
523 sg_size buffersize
524 );
525
533 const SG_COM_PlayerConfig *player_config,
534 SG_COM_PlayerHandle *player_handle
535 );
536
543 SG_COM_PlayerHandle player_handle
544 );
545
554 SG_COM_PlayerHandle player_handle,
555 const char *packet,
556 sg_size packet_bytes
557 );
558
567 SG_COM_PlayerHandle player_handle,
568 const char* event,
569 sg_size event_bytes
570 );
571
580 SG_COM_PlayerHandle player_handle,
581 SG_AnimationNode **animation_nodes,
582 sg_size *num_animation_nodes
583 );
584
595 SG_COM_PlayerHandle player_handle,
596 double time_ms,
597 double *current_time_ms
598 );
599
607 SG_COM_PlayerHandle player_handle,
608 double* min_time_ms,
609 double* max_time_ms
610 );
611
612#ifdef __cplusplus
613}
614#endif
615
616#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:87
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:116
SG_COM_Role
Enum of roles.
Definition: SG_Com.h:74
@ SG_COM_ROLE_SPEAK
Speaking role.
Definition: SG_Com.h:75
@ SG_COM_ROLE_LISTEN
Listening role.
Definition: SG_Com.h:76
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_GetLookatHeadJoints(SG_COM_EngineHandle engine_handle, char *left_eye_joint, char *right_eye_joint, char *eye_root_joint, sg_size buffersize)
Get the names of the three joints whose base positions are needed to know the character's base head p...
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.
struct SG_COM_Position SG_COM_Position
Structure containing 3D positional coordinates.
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:59
@ SG_COM_MOD_DART_FREQ
Adjusts frequency of microdarts. Default is 1.0.
Definition: SG_Com.h:67
@ SG_COM_MOD_EXPRESSION_FREQ
Adjusts frequency of expression change. Default is 1.0.
Definition: SG_Com.h:65
@ SG_COM_MOD_BLINK_FREQ
Adjusts frequency of blinks. Default is 1.0.
Definition: SG_Com.h:66
@ SG_COM_MOD_NONVERBAL_MAG
Adjusts magnitude of nonverbal muscle motion. Default is 1.0.
Definition: SG_Com.h:61
@ SG_COM_MOD_BREATH_SPEED
Adjusts speed of breath. Default is 1.0.
Definition: SG_Com.h:64
@ SG_COM_MOD_BEAT_FREQ
Adjusts frequency of speech beat. Default is 1.0, corresponding to a minimal duration of 1 sec betwee...
Definition: SG_Com.h:68
@ SG_COM_MOD_SPEECH_MAG
Adjusts magnitude of speech muscle motion. Default is 1.0.
Definition: SG_Com.h:60
@ SG_COM_MOD_BREATH_MAG
Adjusts magnitude of breath. Default is 1.0.
Definition: SG_Com.h:63
@ SG_COM_MOD_NONVERBAL_SPEED
Adjusts speed of nonverbal muscle motion. Default is 1.0.
Definition: SG_Com.h:62
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:129
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
struct SG_COM_EngineConfig SG_COM_EngineConfig
Structure containing an Engine configuration.
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:102
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_SetLookatTarget(SG_COM_EngineHandle engine_handle, SG_COM_Position *target_position, SG_COM_Position *left_eye_base_position, SG_COM_Position *right_eye_base_position, SG_COM_Position *eye_root_base_position)
Set the lookat target.
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:107
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_SPEECH_BEAT
A speech beat is detected. The accompanying message contains the value of the stress at that time,...
Definition: SG_Com.h:53
@ 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_DYN SG_COM_Error SG_COM_ReceiveEvent(SG_COM_PlayerHandle player_handle, const char *event, sg_size event_bytes)
Receive an event loaded in memory into the corresponding Player.
SG_DYN SG_COM_Error SG_COM_SetLookatActivation(SG_COM_EngineHandle engine_handle, float activation)
Set the lookat activation.
struct SG_COM_PlayerConfig SG_COM_PlayerConfig
Structure containing a Player configuration.
SG_COM_EngineConfigFlag
Enum of Engine configuration flags.
Definition: SG_Com.h:138
@ SG_COM_ENGINE_CONFIG_FIXED_RANDOM_SEED
Use a fixed seed in random number generators for deterministic output.
Definition: SG_Com.h:141
@ SG_COM_ENGINE_CONFIG_NONE
Definition: SG_Com.h:139
@ SG_COM_ENGINE_CONFIG_ENABLE_IDLE
Enable idle mode.
Definition: SG_Com.h:140
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:82
@ SG_COM_ACKNOWLEDGE_MODE
The mode triggered when a conditions for an acknowledgement are detected in Listen role.
Definition: SG_Com.h:87
@ SG_COM_NEGATIVE_MODE
The mode triggered when negative emotion is detected.
Definition: SG_Com.h:84
@ SG_COM_LAUGH_MODE
The mode triggered when a laugh is detected.
Definition: SG_Com.h:86
@ SG_COM_EFFORT_MODE
The mode triggered when an effort sound is detected.
Definition: SG_Com.h:85
@ SG_COM_POSITIVE_MODE
The mode triggered when positive emotion is detected.
Definition: SG_Com.h:83
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:147
SG_AudioSampleRate audio_sample_rate
The input audio sample rate.
Definition: SG_Com.h:151
SG_AudioSampleType audio_sample_type
The input audio sample type.
Definition: SG_Com.h:150
SG_COM_EngineStatusCallback engine_status_callback
Callback for Engine status updates.
Definition: SG_Com.h:154
SG_COM_EngineBroadcastCallback engine_broadcast_callback
Callback to broadcast packets to remote Players (nullptr if not broadcasting).
Definition: SG_Com.h:153
SG_COM_EngineConfigFlag flag
Combination of engine configuration flags to enable/disable features.
Definition: SG_Com.h:156
sg_size character_file_bytes
The size of the loaded character file in bytes.
Definition: SG_Com.h:149
void * custom_engine_data
Custom user data (or nullptr).
Definition: SG_Com.h:157
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:152
float buffer_sec
The maximum duration (in seconds) that the input buffer can hold.
Definition: SG_Com.h:155
sg_byte * character_file_in_memory
The character file loaded into a memory buffer.
Definition: SG_Com.h:148
Structure containing a Player configuration.
Definition: SG_Com.h:93
sg_byte * character_file_in_memory
The character file data loaded into memory.
Definition: SG_Com.h:94
float buffer_sec
The maximum duration (in seconds) that the output buffer can hold.
Definition: SG_Com.h:96
sg_size character_file_bytes
The size of the character file data in bytes.
Definition: SG_Com.h:95
Structure containing 3D positional coordinates.
Definition: SG_Com.h:163