Skip to content

C API: Text to emote

A sentence to stock clips and a face: Text to emote.

sona_emote_from_text

sona_result sona_emote_from_text(const char *text, sona_emote *out);
Parameter and type Meaning
text
const char *
A sentence, such as "wave excitedly" (required)
out
sona_emote *
Receives the sona_emote (required)

Returns SONA_OK. Errors SONA_E_ARGUMENT, SONA_E_LIMIT (what each means).

Example (also in Cookbook: recipes for game moments):

sona_emote e = { sizeof e };
if (sona_emote_from_text("jump for joy", &e) == SONA_OK && e.count > 0)
  sona_avatar_emote(avatar, &e, 0.25f);

A sentence in ("wave excitedly", "shrug, not sure"), stock clips and a face out: up to four clips with weights to blend, a speed and an expression. Pure, no ctx: the same text gives the same answer. count 0 with a face is a mood with no action ("smile"). Set out->size first. Text to emote has the table.

sona_avatar_emote

sona_result sona_avatar_emote(sona_avatar *a, const sona_emote *e,
                              float fade_seconds);
Parameter and type Meaning
a
sona_avatar *
The avatar (required)
e
const sona_emote *
A sona_emote (required)
fade_seconds
float
Seconds to blend over

Returns SONA_OK. Errors SONA_E_ARGUMENT, SONA_E_DESTROYED, SONA_E_LIMIT, SONA_E_MEMORY (what each means).

Example (also in Cookbook: recipes for game moments):

sona_emote e = { sizeof e };
if (sona_emote_from_text("jump for joy", &e) == SONA_OK && e.count > 0)
  sona_avatar_emote(avatar, &e, 0.25f);

Plays it on a: the clips blended on the emote layers (SONA_LAYER_MAX - count to SONA_LAYER_MAX - 1, each over the ones below by its share of the weight), faded in over fade_seconds; the face set when it has one. An emote plays once and hands back to the clip, but a dance, sleep, hover or run loops until the next emote. count 0 with no face stops the emote's layers and hands the face back. It never stops a layer the app played (a layer it played is the app's once the app plays anything on it): SONA_E_LIMIT, with nothing changed, when one is on a layer the emote needs. SONA_E_MEMORY also changes nothing.

This page as Markdown · All the docs as one file (llms-full.txt)