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.0.9"
17
18#ifdef __cplusplus
19extern "C" {
20#endif
21
25 typedef enum {
41
45 typedef enum {
50
54 typedef enum {
59
63 typedef enum {
67
71 typedef enum {
77
81 typedef struct SG_COM_PlayerConfig {
84 float buffer_sec;
86
90 typedef struct SG_COM_Player* SG_COM_PlayerHandle;
91
95 typedef struct SG_COM_Engine* SG_COM_EngineHandle;
96
105 SG_COM_EngineHandle engine_handle,
106 char* packet,
107 sg_size packet_bytes,
108 void* custom_engine_data);
109
118 SG_COM_EngineHandle engine_handle,
119 SG_COM_Status status,
120 const char *message,
121 void* custom_engine_data);
122
126 typedef enum {
131
135 typedef struct SG_COM_EngineConfig {
147
153
174
175 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);
176
183
192
200 SG_DYN unsigned int SG_COM_GetVersionNumber(void);
201
209 const SG_COM_EngineConfig *engine_config,
210 SG_COM_EngineHandle *engine_handle
211 );
212
219 SG_COM_EngineHandle engine_handle
220 );
221
234 SG_COM_EngineHandle engine_handle,
235 const void* data,
236 sg_size data_bytes
237 );
238
249 SG_COM_EngineHandle engine_handle,
250 const void* data,
251 sg_size data_bytes
252 );
253
267 SG_COM_EngineHandle engine_handle,
268 int *processed_frames,
269 int *remaining_frames
270 );
271
278 SG_COM_EngineHandle engine_handle
279 );
280
290 SG_COM_EngineHandle engine_handle,
291 const char* mode
292 );
293
304 SG_COM_EngineHandle engine_handle,
305 const char* mode
306 );
307
318 SG_COM_EngineHandle engine_handle,
319 SG_COM_AutoMode auto_mode,
320 const char* mode
321 );
322
331 SG_COM_EngineHandle engine_handle
332 );
333
343 SG_COM_EngineHandle engine_handle
344 );
345
354 SG_COM_EngineHandle engine_handle,
355 char* mode,
356 sg_size buffersize
357 );
358
367 SG_COM_EngineHandle engine_handle,
368 char* mode_list,
369 sg_size buffersize
370 );
371
379 SG_COM_EngineHandle engine_handle,
380 SG_COM_Role role
381 );
382
390 SG_COM_EngineHandle engine_handle,
391 SG_COM_Role *role
392 );
393
400 SG_COM_EngineHandle engine_handle,
401 SG_COM_Modifier modifier,
402 float *value
403 );
404
411 SG_COM_EngineHandle engine_handle,
412 SG_COM_Modifier modifier,
413 float value
414 );
415
423 const SG_COM_PlayerConfig *player_config,
424 SG_COM_PlayerHandle *player_handle
425 );
426
433 SG_COM_PlayerHandle player_handle
434 );
435
444 SG_COM_PlayerHandle player_handle,
445 const char *packet,
446 sg_size packet_bytes
447 );
448
457 SG_COM_PlayerHandle player_handle,
458 SG_AnimationNode **animation_nodes,
459 sg_size *num_animation_nodes
460 );
461
472 SG_COM_PlayerHandle player_handle,
473 double time_ms,
474 double *current_time_ms
475 );
476
484 SG_COM_PlayerHandle player_handle,
485 double* min_time_ms,
486 double* max_time_ms
487 );
488
489#ifdef __cplusplus
490}
491#endif
492
493#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:104
SG_COM_Role
Enum of roles.
Definition: SG_Com.h:63
@ SG_COM_ROLE_SPEAK
Speaking role.
Definition: SG_Com.h:64
@ SG_COM_ROLE_LISTEN
Listening role.
Definition: SG_Com.h:65
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:54
@ SG_COM_MOD_SCALE
Scale factor of muscle motion. Default is 1.0.
Definition: SG_Com.h:55
@ SG_COM_MOD_EXPRESSION_FREQ
Increase or decrease in frequency of expression change. Default is 1.0.
Definition: SG_Com.h:57
@ SG_COM_MOD_SPEED
Speed factor of muscle motion. Default is 1.0.
Definition: SG_Com.h:56
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_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:117
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_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_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:90
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:95
SG_COM_Status
Enum of status codes.
Definition: SG_Com.h:45
@ SG_COM_STATUS_EXPRESSION_CHANGED
The expression of the character changed. The accompanying message contains the path of the expression...
Definition: SG_Com.h:47
@ SG_COM_STATUS_MODE_CHANGED
The current behavior mode of the character changed, either manually or automatically....
Definition: SG_Com.h:46
@ SG_COM_STATUS_VOICE_ACTIVITY_CHANGED
A change in voice activity was detected. The accompanying message contains "0" or "1".
Definition: SG_Com.h:48
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:126
@ SG_COM_ENGINE_CONFIG_FIXED_RANDOM_SEED
Use a fixed seed in random number generators for deterministic output.
Definition: SG_Com.h:129
@ SG_COM_ENGINE_CONFIG_NONE
Definition: SG_Com.h:127
@ SG_COM_ENGINE_CONFIG_ENABLE_IDLE
Enable idle mode.
Definition: SG_Com.h:128
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:71
@ SG_COM_ACKNOWLEDGE_MODE
The mode triggered when a conditions for an acknowledgement are detected in Listen role.
Definition: SG_Com.h:75
@ SG_COM_NEGATIVE_MODE
The mode triggered when negative emotion is detected.
Definition: SG_Com.h:73
@ SG_COM_EFFORT_MODE
The mode triggered when an effort sound is detected.
Definition: SG_Com.h:74
@ SG_COM_POSITIVE_MODE
The mode triggered when positive emotion is detected.
Definition: SG_Com.h:72
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:135
SG_AudioSampleRate audio_sample_rate
The input audio sample rate.
Definition: SG_Com.h:139
SG_AudioSampleType audio_sample_type
The input audio sample type.
Definition: SG_Com.h:138
SG_COM_EngineStatusCallback engine_status_callback
Callback for Engine status updates.
Definition: SG_Com.h:142
SG_COM_EngineBroadcastCallback engine_broadcast_callback
Callback to broadcast packets to remote Players (nullptr if not broadcasting).
Definition: SG_Com.h:141
SG_COM_EngineConfigFlag flag
Combination of engine configuration flags to enable/disable features.
Definition: SG_Com.h:144
sg_size character_file_bytes
The size of the loaded character file in bytes.
Definition: SG_Com.h:137
void * custom_engine_data
Custom user data (or nullptr).
Definition: SG_Com.h:145
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:140
float buffer_sec
The maximum duration (in seconds) that the input buffer can hold.
Definition: SG_Com.h:143
sg_byte * character_file_in_memory
The character file loaded into a memory buffer.
Definition: SG_Com.h:136
Structure containing a Player configuration.
Definition: SG_Com.h:81
sg_byte * character_file_in_memory
The character file data loaded into memory.
Definition: SG_Com.h:82
float buffer_sec
The maximum duration (in seconds) that the output buffer can hold.
Definition: SG_Com.h:84
sg_size character_file_bytes
The size of the character file data in bytes.
Definition: SG_Com.h:83