Skip to content

C API: Handles

Every handle is an opaque pointer: its struct is not in the header, so a program holds it and passes it back, never reads into it or copies it. The library makes each one in the call that gives it out (through an out-parameter, the **out last argument) and frees it in the one call named below; nothing else frees it, and a handle is not used after that call. Calls on a sona_ctx and on everything made from it come from one thread at a time (Rules every function follows).

Handle What it is Made by Freed by
sona_ctx The library's state: sources, caches, the clock, the job system sona_open sona_close, after the avatars and renderers made from it are freed
sona_avatar One avatar in a ctx sona_avatar_add, sona_avatar_add_base64, sona_avatar_add_state, sona_avatar_add_waiting, sona_item_preview_add sona_avatar_remove
sona_renderer A renderer on the host's device, or a headless one sona_renderer_create, sona_headless_renderer sona_renderer_destroy
sona_request One read in flight from a host-written source the core, when it calls the source's read the core, once the source calls sona_complete on it (exactly once)
sona_http_reply One request in flight on a host's HTTP layer the core, when it calls the layer's send the core, once the layer calls sona_http_done on it (exactly once; valid until then, even after sona_close)
sona_catalogue The offline catalogue, loaded sona_catalogue_load, sona_catalogue_load_memory sona_catalogue_free
sona_maker A catalogue's outfit rules, indexed for making avatars sona_maker_create sona_maker_free
sona_filter A content filter's rules sona_filter_create sona_filter_free
sona_blend_space A blend of clips by one or two values sona_blend_space_create sona_blend_space_destroy
sona_state_machine Clip states and the moves between them sona_state_machine_create sona_state_machine_destroy
sona_interaction Two avatars acting together sona_interaction_start sona_interaction_remove
sona_prop_mesh A stock prop's mesh, read for a host's own drawing sona_prop_mesh_stock sona_prop_mesh_release
sona_sheet A sprite sheet of a clip sona_sheet_render sona_sheet_free
sona_lipsync Mouth shapes from sound sona_lipsync_create sona_lipsync_destroy
sona_headless A renderer with no window, for pictures and video sona_headless_open sona_headless_close
sona_video A video or picture sequence being written sona_video_open sona_video_finish (also on an error)
sona_print A mesh for 3D printing sona_print_avatars, sona_print_triangles sona_print_free
sona_anim_file An animation file read for import sona_anim_file_open sona_anim_file_free
sona_players Players looked up by gamertag or id sona_players_open sona_players_close
sona_net_sender, sona_net_receiver One avatar's state sent over a network, and received sona_net_sender_create, sona_net_receiver_create sona_net_sender_destroy, sona_net_receiver_destroy
sona_recorder, sona_replay A recording of avatars' states, and its playback sona_recorder_create, sona_replay_open sona_recorder_destroy, sona_replay_close
sona_screen A ready-made screen: the quick creator or the wardrobe picker sona_quick_open, sona_wardrobe_open sona_screen_destroy (the avatars it shows, from sona_screen_view_avatar, are its own)

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