# Bindings reference

Every public class, function, method and property of the C++, C#, Python, Rust and WebAssembly bindings, read from their sources: its declaration, what it does (from its own doc comment or, where it has none, from the C function it wraps) and the C functions it calls, each linked to its entry in the [C reference](../reference.md).

## C++

81 public names in `bindings/cpp/sona.hpp`.

### Functions

| Declaration | What it does |
|---|---|
| `sona_result check_layout(std::string *what = 0)` | Compares the size of every public struct and the offset of every field with the library's; SONA_OK when they all match, else SONA_E_UNSUPPORTED with the first that differs named in *what.<br>Calls [`sona_struct_size`](../reference.md#sona_struct_size), [`sona_struct_offset`](../reference.md#sona_struct_offset). |
| `sona_result abi(sona_abi_info &out)` | The loaded library's ABI and version.<br>Calls [`sona_abi_query`](../reference.md#sona_abi_query). |
| `sona_result emote_from_text(const char *text, sona_emote &out)` | A sentence to stock clips, a speed and a face; the same text gives the same answer.<br>Calls [`sona_emote_from_text`](../reference.md#sona_emote_from_text). |
| `sona_route slot_of(const sona_guid &id, uint32_t *mask = 0)` | Where an item id goes; its slot mask in *mask when mask is given.<br>Calls [`sona_slot_of`](../reference.md#sona_slot_of). |
| `std::string format_guid(const sona_guid &g)` | The id in its lowercase 36-character form.<br>Calls [`sona_guid_format`](../reference.md#sona_guid_format). |
| `View<uint8_t> shader_source(sona_shader_lang lang, sona_program prog, int stage)` | Text, or SPIR-V bytes; empty when that language is not in this build.<br>Calls [`sona_shader_source`](../reference.md#sona_shader_source). |
| `void camera_orbit(sona_view &v, const double target[3], double yaw_deg, double pitch_deg, double distance)` | Places the eye on an orbit around target.<br>Calls [`sona_camera_orbit`](../reference.md#sona_camera_orbit). |
| `View<uint8_t> vertices(const sona_mesh &m)` | The 76-byte vertices and the indices of one mesh. |

### View

`class View`: A read-only view over memory the core owns: valid as long as the call that gave it says.

| Declaration | What it does |
|---|---|
| `View()`<br>`View(const T *p, size_t n)` | A read-only view over memory the core owns: valid as long as the call that gave it says. |

### Error

`class Error : public std::exception`: What a call throws when it fails: code (a sona_result), message and fix, as sona_last_error gives them.

| Declaration | What it does |
|---|---|
| `Error(sona_result c, const std::string &m, const std::string &f)` | Makes the exception from a code, its message and its fix; its message reads "<code name>: <message> (<fix>)".<br>Calls [`sona_result_name`](../reference.md#sona_result_name). |
| `~Error() throw()` | An empty destructor: an Error owns nothing of the library's. |

### Manifest

`class Manifest`: An AvatarDescription and its edit verbs (pure; no ctx).

| Declaration | What it does |
|---|---|
| `sona_result parse(const uint8_t bytes[SONA_MANIFEST_BYTES], Manifest &out)` | Reads 1000 bytes into a sona_manifest.<br>Calls [`sona_manifest_parse`](../reference.md#sona_manifest_parse). |
| `sona_result parse_base64(const std::string &b64, Manifest &out)` | base64 text, as the web's add: at most 4096 characters.<br>Calls [`sona_base64_decode`](../reference.md#sona_base64_decode). |
| `std::vector<uint8_t> bytes() const` | The manifest's SONA_MANIFEST_BYTES bytes, packed as the console stores them. |
| `sona_result wear(const sona_guid &item, const uint32_t colours[3], uint32_t flags = 0)` | Puts an item on, with its three colours.<br>Calls [`sona_manifest_wear`](../reference.md#sona_manifest_wear). |

### Request

`class Request`: One read in flight.

| Declaration | What it does |
|---|---|
| `Request(sona_request *r = 0)` | One read in flight. |

### Source

`class Source`: A host-written source.

| Declaration | What it does |
|---|---|
| `~Source()` | A source is ended through the context; destroying it frees the binding's side. |
| `void cancel(Request)` | Optional. The C field sona_source.cancel (a function (NULL: none)). |
| `sona_source c_source()` | The sona_source that calls this object's read and cancel: put it in a source description of kind SONA_SOURCE_CUSTOM. |

### Config

`class Config`: sona_config with owned strings.

| Declaration | What it does |
|---|---|
| `Config()` | Sets abi and leaves everything else at its default.<br>Calls [`sona_config_defaults`](../reference.md#sona_config_defaults). |
| `Config &licence(const void *bytes, size_t len)` | Sona-licence.json from the download, as bytes. The C field sona_config.licence (pointer). |
| `bool licence_file(const std::string &path)` | false when the file could not be read. |
| `const sona_config *get()` | The sona_config, its pointers into this object. |

### Pose

`class Pose`: A view over sona_pose_data: valid until the next Context::update.

| Declaration | What it does |
|---|---|
| `Pose()`<br>`Pose(const sona_pose_data *p)` | A view over sona_pose_data: valid until the next Context::update. |

### Avatar

`class Avatar`: A handle to one avatar.

| Declaration | What it does |
|---|---|
| `Avatar()`<br>`Avatar(sona_avatar *a, sona_ctx *ctx)` | A handle to one avatar. |
| `sona_result ragdoll_motors(std::vector<sona_ragdoll_motor> &out) const` | The joint motor targets of the last pose; SONA_E_NOT_READY before sona_avatar_ragdoll.<br>Calls [`sona_avatar_ragdoll_motors`](../reference.md#sona_avatar_ragdoll_motors). |
| `sona_result play(const char *clip, const sona_play_options *opts = 0)` | Plays a clip.<br>Calls [`sona_avatar_play`](../reference.md#sona_avatar_play). |
| `void remove()` | Removes the avatar and frees what only it used.<br>Calls [`sona_avatar_remove`](../reference.md#sona_avatar_remove). |
| `sona_result pose(Pose &out) const`<br>`Pose pose() const` | The avatar's pose data, valid until the next sona_update.<br>Calls [`sona_pose`](../reference.md#sona_pose). |
| `sona_result pose_vertices(uint32_t mesh, uint32_t space, float *positions, float *normals = 0, size_t stride = 3)` | CPU skinning of one mesh; positions (and normals) hold vertex_count * stride floats.<br>Calls [`sona_pose_vertices`](../reference.md#sona_pose_vertices). |
| `sona_result camera_preset(sona_preset p, sona_view &view) const` | Sets view->eye and view->target to one of the console's framings on one ready avatar.<br>Calls [`sona_camera_preset`](../reference.md#sona_camera_preset). |
| `sona_result set_override(uint32_t joint, const float rotation[4], float weight = 1, uint32_t mode = SONA_OVERRIDE_REPLACE)` | rotation (x, y, z, w) after the clip; weight 0 or a NULL rotation clears the joint.<br>Calls [`sona_avatar_override`](../reference.md#sona_avatar_override). |
| `sona_result crossfade(const char *clip, float seconds, const sona_play_options *opts = 0)` | sona_avatar_play, blending from the current pose over seconds.<br>Calls [`sona_avatar_crossfade`](../reference.md#sona_avatar_crossfade). |
| `sona_result queue(const char *clip, float fade_seconds = 0, const sona_play_options *opts = 0)` | Plays clip when the current one ends; SONA_E_LIMIT past SONA_QUEUE_MAX.<br>Calls [`sona_avatar_queue`](../reference.md#sona_avatar_queue). |
| `sona_result expression_counts(uint32_t counts[3]) const` | counts0 mouth, 1 eyebrows, 2 eyes.<br>Calls [`sona_avatar_expression_counts`](../reference.md#sona_avatar_expression_counts). |
| `std::vector<sona_clip_event> clip_events()` | Every waiting clip event, oldest first.<br>Calls [`sona_avatar_clip_events`](../reference.md#sona_avatar_clip_events). |
| `sona_result preview_view(uint32_t width, uint32_t height, sona_view &out)` | The framed camera for a width x height picture: the slot's view preset gives the angle, the item's box the target and the distance.<br>Calls [`sona_item_preview_view`](../reference.md#sona_item_preview_view). |

### Context

`class Context`: Owns a sona_ctx; move-only.

| Declaration | What it does |
|---|---|
| `Context()`<br>`Context(sona_ctx *adopt)` | Owns a sona_ctx; move-only. |
| `Context &operator=(Context &&o) noexcept` | Moves the handle from another object, which is left empty. |
| `sona_result open(Config &cfg, Context &out)` | Checks the struct layout first: a header that does not match the library gives SONA_E_UNSUPPORTED.<br>Calls [`sona_open`](../reference.md#sona_open). |
| `void close()` | Closes a context.<br>Calls [`sona_close`](../reference.md#sona_close). |
| `sona_result add(const uint8_t manifest[SONA_MANIFEST_BYTES], Avatar &out, const sona_add_options *opts = 0)`<br>`Avatar add(const uint8_t manifest[SONA_MANIFEST_BYTES], const sona_add_options &opts = add_defaults())`<br>`Avatar add(const Manifest &m, const sona_add_options &opts = add_defaults())` | Queues an avatar and returns at once.<br>Calls [`sona_avatar_add`](../reference.md#sona_avatar_add). |
| `sona_result add_base64(const char *b64, Avatar &out, const sona_add_options *opts = 0)`<br>`Avatar add_base64(const std::string &b64, const sona_add_options &opts = add_defaults())` | The same, from base64 text of at most 4096 characters, as the web.<br>Calls [`sona_avatar_add_base64`](../reference.md#sona_avatar_add_base64). |
| `sona_result item_colourways(const char *item_id, std::vector<std::array<uint32_t, 3> > &out)` | An item's colourways (0xFFRRGGBB); SONA_PENDING until it has loaded.<br>Calls [`sona_item_colourways`](../reference.md#sona_item_colourways). |
| `sona_result custom_item_pack_mesh(const sona_mesh_item_spec &spec, std::vector<uint8_t> &out, std::string *why = 0)` | A.sonaitem (format 1.1) of your own skinned mesh; SONA_PENDING while the template loads; why gets the refusal.<br>Calls [`sona_custom_item_pack_mesh`](../reference.md#sona_custom_item_pack_mesh), [`sona_free`](../reference.md#sona_free). |
| `sona_result award_unlock(const char *player_token, const char *key, uint32_t &ticket)` | player_token: the signed-in player's access token (Sign in with 360sona).<br>Calls [`sona_award_unlock`](../reference.md#sona_award_unlock). |
| `sona_result update(double dt_seconds, const sona_view *view = 0, sona_frame_stats *out = 0)` | view may be NULL: nothing is culled and every avatar poses.<br>Calls [`sona_update`](../reference.md#sona_update). |
| `bool poll(Event &out)` | True when an event was written to out, false when there are none; call it until it is false.<br>Calls [`sona_poll_event`](../reference.md#sona_poll_event). |
| `std::vector<sona_clip_info> clips() const` | One clip by index, 0..<br>Calls [`sona_clip_get`](../reference.md#sona_clip_get). |
| `sona_scene_stats stats() const` | The scene statistics.<br>Calls [`sona_stats`](../reference.md#sona_stats). |
| `sona_result png_encode(const uint8_t *rgba, uint32_t w, uint32_t h, std::vector<uint8_t> &out)` | PNG bytes of an RGBA8 picture, with the web's three tEXt chunks after IHDR: Software "360sona", Source "https://360sona.com", Comment "Powered by 360sona".<br>Calls [`sona_png_encode`](../reference.md#sona_png_encode), [`sona_free`](../reference.md#sona_free). |
| `sona_result add_item_preview(const char *item_id, Avatar &out, const sona_preview_options *opts = 0)`<br>`Avatar add_item_preview(const std::string &item_id, const sona_preview_options &opts = preview_defaults())` | One item worn alone on a stand-in body; it reaches READY like an avatar and Avatar::remove frees it.<br>Calls [`sona_item_preview_add`](../reference.md#sona_item_preview_add). |
| `sona_lod_stats lod_stats() const` | The level-of-detail statistics: avatars in view at each step, those fading, the baked looks and the bakes of the last draw.<br>Calls [`sona_lod_stats_get`](../reference.md#sona_lod_stats_get). |

### Renderer

`class Renderer`: Owns a sona_renderer; move-only.

| Declaration | What it does |
|---|---|
| `Renderer()` | Owns a sona_renderer; move-only. |
| `Renderer &operator=(Renderer &&o) noexcept` | Moves the handle from another object, which is left empty. |
| `sona_result create(Context &ctx, const sona_device_desc &dev, Renderer &out)` | SONA_PENDING until the shading data has arrived through Context::update.<br>Calls [`sona_renderer_create`](../reference.md#sona_renderer_create). |
| `void destroy()` | Frees the renderer and its GPU objects.<br>Calls [`sona_renderer_destroy`](../reference.md#sona_renderer_destroy). |
| `sona_result draw(const sona_view &view, const sona_target &target, const sona_draw_options *opts = 0)` | Draws every visible ready avatar, as posed by the last sona_update, folding each palette with this view.<br>Calls [`sona_draw`](../reference.md#sona_draw). |
| `sona_result snapshot(const sona_view &view, uint32_t w, uint32_t h, std::vector<uint8_t> &rgba, const sona_draw_options *opts = 0)` | Straight RGBA8, row 0 at the top.<br>Calls [`sona_snapshot`](../reference.md#sona_snapshot). |
| `sona_result preview_draw(const Avatar &preview, const sona_target &target, const sona_view *view = 0, const sona_draw_options *opts = 0)` | Only this preview in the frame.<br>Calls [`sona_item_preview_draw`](../reference.md#sona_item_preview_draw). |
| `sona_result preview_snapshot(const Avatar &preview, uint32_t w, uint32_t h, std::vector<uint8_t> &rgba, const sona_draw_options *opts = 0)` | sona_snapshot of this preview alone, framed for width x height.<br>Calls [`sona_item_preview_snapshot`](../reference.md#sona_item_preview_snapshot). |

### Catalogue

`class Catalogue`: Every item id with its name, slots, game and source, from sona-catalogue.bin, so pickers need no web call. The C type sona_catalogue.

| Declaration | What it does |
|---|---|
| `Catalogue()` | Every item id with its name, slots, game and source, from sona-catalogue.bin, so pickers need no web call. The C type sona_catalogue. |
| `Catalogue &operator=(Catalogue &&o) noexcept` | Moves the handle from another object, which is left empty. |
| `sona_result load(const std::string &path, Catalogue &out, const Context *ctx = 0)` | ctx may be NULL (then malloc, and no message beyond the code).<br>Calls [`sona_catalogue_load`](../reference.md#sona_catalogue_load). |
| `sona_result load_memory(const void *bytes, size_t len, Catalogue &out, const Context *ctx = 0)` | The same from bytes in memory.<br>Calls [`sona_catalogue_load_memory`](../reference.md#sona_catalogue_load_memory). |
| `void free()` | Frees it and every string it handed out.<br>Calls [`sona_catalogue_free`](../reference.md#sona_catalogue_free). |
| `sona_result search(const sona_catalogue_query *q, std::vector<uint32_t> &out, uint32_t max, uint32_t *total = 0) const` | Up to max matching indexes in id order, after q->offset; total (may be NULL) is every match.<br>Calls [`sona_catalogue_search`](../reference.md#sona_catalogue_search). |
| `sona_result game(uint32_t index, const char *&name, uint32_t &items) const` | One game, sorted by name, and its item count.<br>Calls [`sona_catalogue_game`](../reference.md#sona_catalogue_game). |
| `sona_result item_name(uint32_t index, const char *lang, const char *&name) const` | SONA_E_NOT_FOUND when the item has no name in lang (show sona_item_info.name); not thrown.<br>Calls [`sona_catalogue_item_name`](../reference.md#sona_catalogue_item_name). |

### Types

| Declaration | What it does |
|---|---|
| `class Event` | The C type sona_event. |

## C#

1005 public names in `bindings/csharp/Sona.cs`, `bindings/csharp/Editor.cs`, `bindings/csharp/Track.cs`, `bindings/csharp/Picking.cs`.

### SonaException

`sealed class SonaException : Exception`: The last error on a ctx: code, message and what to do about it. The C type sona_error_info.

| Declaration | What it does |
|---|---|
| `SonaException(SonaResult code, string message, string fix)` | The last error on a ctx: code, message and what to do about it. The C type sona_error_info. |
| `SonaResult Code` | The C field sona_error_info.code (sona_result value). |
| `string Fix` | The C field sona_error_info.fix (text (UTF-8), NULL: none). |

### SonaLibrary

`static unsafe class SonaLibrary`: Where the native library is loaded from: SONA_LIB_DIR, then the system's library path.

| Declaration | What it does |
|---|---|
| `static string Version` | The library's version, "1.1.0".<br>Calls [`sona_version`](../reference.md#sona_version). |
| `static string Platform` | The binary platform id compiled into this library: "windows-x64", "linux-x64", "linux-arm64", "macos-arm64", "macos-x64", "ios-arm64", "android-arm64", "android-x64", "xbox360" or "wasm".<br>Calls [`sona_platform`](../reference.md#sona_platform). |
| `static string ResultName(SonaResult r)` | The name of a code ("licence", "gate",...): the same words as the web SDK's SonaError.code.<br>Calls [`sona_result_name`](../reference.md#sona_result_name). |
| `static void EnsureLayout()` | Throws unless every struct this binding mirrors has the library's size and field offsets. |

### SonaSource

`abstract class SonaSource`: A host-written asset source.

| Declaration | What it does |
|---|---|
| `abstract void Read(SonaReadKind kind, string name, SonaRequest request)` | The C field sona_source.read (a function (NULL: none)). |
| `virtual void Cancel(SonaRequest request)` | Optional. The C field sona_source.cancel (a function (NULL: none)). |
| `virtual void Destroy()` | Optional, called by sona_close. The C field sona_source.destroy (a function (NULL: none)). |

### SonaRequest

`sealed unsafe class SonaRequest`: one read in flight from a source The C type sona_request.

| Declaration | What it does |
|---|---|
| `bool IsCompleted` | True once the request has been answered (Complete, NotFound or Failed). |
| `void Complete(byte[] bytes)`<br>`void Complete(SonaResult status, byte[] bytes, int offset, int count)`<br>`void Complete(SonaResult status, ReadOnlySpan<byte> bytes)` | Finishes one read, exactly once, also after cancel; the request stays valid until then.<br>Calls [`sona_complete`](../reference.md#sona_complete). |
| `void NotFound()` | Answers the read: the source has no such file (SONA_E_NOT_FOUND). |
| `void Failed()` | Answers the read: the source failed and a retry may work (SONA_E_IO). |

### SonaHttpRequest

`sealed class SonaHttpRequest`: The C type sona_http_request.

| Declaration | What it does |
|---|---|
| `string Method` | "GET" or "POST". The C field sona_http_request.method (text (UTF-8), NULL: none). |
| `string Url` | The C field sona_http_request.url (text (UTF-8), NULL: none). |
| `string[] Headers` | "Name: value" strings, NULL-terminated; may be NULL. The C field sona_http_request.headers (text (UTF-8), NULL: none). |
| `byte[] Body` | The C field sona_http_request.body (pointer). |
| `uint TimeoutMs` | The C field sona_http_request.timeout_ms (ms). |

### SonaHttpReply

`sealed unsafe class SonaHttpReply`: The C type sona_http_reply.

| Declaration | What it does |
|---|---|
| `void Done(int status, byte[] body)`<br>`void Done(int status, byte[] body, int offset, int count)` | Exactly once per reply, from any thread; status 0 when the request could not be made.<br>Calls [`sona_http_done`](../reference.md#sona_http_done). |
| `bool IsDone` | True once the reply has been given. |

### SonaHttp

`abstract class SonaHttp`: An HTTP layer the host supplies (UnityWebRequest, HttpClient,...).

| Declaration | What it does |
|---|---|
| `abstract void Send(SonaHttpRequest request, SonaHttpReply reply)` | Start the request; finish it later, from any thread, with sona_http_done(reply,...). The C field sona_http.send (a function (NULL: none)). |

### SonaJob

`readonly struct SonaJob`: One piece of work the core hands to a host job system; Invoke runs it once, on any thread.

| Declaration | What it does |
|---|---|
| `void Invoke()` | Runs the job; call it once. |

### SonaJobs

`abstract class SonaJobs`: A host job system: run each job once, on any thread, and never block the caller on it.

| Declaration | What it does |
|---|---|
| `abstract uint Workers` | How many run at once. The C field sona_jobs.workers (count). |
| `abstract void Run(SonaJob job)` | Run fn(arg) once, on any thread. The C field sona_jobs.run (a function (NULL: none)). |

### SonaSourceSpec

`sealed class SonaSourceSpec`: The C type sona_source_desc.

| Declaration | What it does |
|---|---|
| `SonaSourceKind Kind` | The C field sona_source_desc.kind (sona_source_kind value). |
| `string Location` | The C field sona_source_desc.location (text (UTF-8), NULL: none). |
| `SonaSource Custom` | The C field sona_source_desc.custom (pointer to sona_source). |
| `static SonaSourceSpec Dir(string folder)` | A source that reads a folder of avatar files. |
| `static SonaSourceSpec Console(string contentRoot)` | A source that reads a console's content root. |
| `static SonaSourceSpec Gate(string baseUrl = null)` | A source that reads from 360sona's gate (the given base address, or the default). |
| `static SonaSourceSpec From(SonaSource source)` | A source the host implements (a SonaSource). |

### SonaBudget

`sealed class SonaBudget`: Memory budget in bytes. The C type sona_budget.

| Declaration | What it does |
|---|---|
| `ulong Total` | 0: no overall cap (default). The C field sona_budget.total (bytes). |
| `ulong Assets` | Decoded items no avatar uses: default 256 MiB. The C field sona_budget.assets (bytes). |
| `ulong Clips` | Retained clip blocks no avatar uses: default 32 MiB. The C field sona_budget.clips (bytes). |
| `ulong Faces` | Baked face sheets: default 64 MiB and at most 512 sheets, as the web. The C field sona_budget.faces (bytes). |
| `ulong SourceCache` | Fetched container bytes, in memory only: default 64 MiB. The C field sona_budget.source_cache (bytes). |
| `ulong GpuIdle` | GPU objects no avatar uses any more: default 64 MiB, as the web. The C field sona_budget.gpu_idle (bytes). |

### SonaOptions

`sealed class SonaOptions`: The C type sona_config.

| Declaration | What it does |
|---|---|
| `string AppId` | NULL: the app id stamped into this build. The C field sona_config.app_id (text (UTF-8), NULL: none). |
| `byte[] Licence` | Sona-licence.json from the download, as bytes. The C field sona_config.licence (pointer). |
| `readonly List<SonaSourceSpec> Sources = new List<SonaSourceSpec>()` | Asked in order; the first that has an asset wins. The C field sona_config.sources (a sona_source_desc (see its fields)). |
| `SonaHttp Http` | NULL: sona_http_platform. The C field sona_config.http (pointer to sona_http). |
| `int WorkerThreads = -1` | -1: cores - 1 (default); 0: none, work runs inside sona_update. The C field sona_config.worker_threads (count). |
| `SonaJobs Jobs` | Workers also pose (sona_update) and fold (sona_draw) with the owner thread once 8 or more avatars are in play; poses are the same bits as with 0 when.run is set it replaces worker_threads. The C field sona_config.jobs (a sona_jobs (see its fields)). |
| `uint Seed` | Idle and start-time randomness; 0: from the clock. The C field sona_config.seed (index or id). |
| `uint MaxAvatars = 256` | Default 256, at most 16384. The C field sona_config.max_avatars (count). |
| `float BuildBudgetMs = 6` | owner-thread loading work per sona_update (steps, commits; builds run on the workers); default 6. The C field sona_config.build_budget_ms (ms). |
| `uint FaceSize` | 0: auto (512 up to 4 avatars, 256 up to 32, else 128); or 128, 256, 512. The C field sona_config.face_size (px). |
| `SonaConfigFlags Flags` | SONA_CFG_*. The C field sona_config.flags (bit flags). |
| `SonaBudget Budget` | The C field sona_config.budget (a sona_budget (see its fields)). |
| `Action<SonaLogLevel, string> Log` | The C field sona_config.log (a function (NULL: none)). |
| `string CheckHost` | NULL: https://test.360sona.com, the devs site. The C field sona_config.check_host (text (UTF-8), NULL: none). |

### SonaPlacement

`struct SonaPlacement`: The C type sona_placement.

| Declaration | What it does |
|---|---|
| `float X` | Where the avatar stands, in metres: x. The C field sona_placement.position[0]. |
| `float Y` | Where the avatar stands, in metres: y. The C field sona_placement.position[1]. |
| `float Z` | Where the avatar stands, in metres: z. The C field sona_placement.position[2]. |
| `float TurnDeg` | Degrees about Y; 0 faces -Z. The C field sona_placement.turn_deg (degrees). |
| `float Scale` | Default 1. The C field sona_placement.scale (factor (unitless)). |
| `SonaPlacement(float x, float y, float z, float turnDeg = 0, float scale = 1)` | The C type sona_placement. |
| `static SonaPlacement Default` | At the origin, turned 0 degrees (facing -Z), scale 1. |

### SonaAddOptions

`sealed class SonaAddOptions`: The C type sona_add_options.

| Declaration | What it does |
|---|---|
| `SonaPlacement Placement = SonaPlacement.Default` | The C type sona_placement. |
| `string Clip` | A clip key, a raw clip id, "prop", "idle" or "still"; NULL: "idle". The C field sona_add_options.clip (text (UTF-8), NULL: none). |
| `bool Loop = true` | Default 1. The C field sona_add_options.loop (flag (0 or 1)). |
| `float Speed = 1` | Default 1. The C field sona_add_options.speed (factor (1: as made)). |
| `float StartAt` | Seconds; negative means random, to desynchronise a crowd. The C field sona_add_options.start_at (s). |
| `bool Visible = true` | Default 1. The C field sona_add_options.visible (flag (0 or 1)). |
| `int Priority` | Higher builds sooner; default 0. The C field sona_add_options.priority (order (higher first)). |

### SonaView

`struct SonaView`: A camera: the eye, the target, the vertical field of view in degrees, near and far, and the target size in pixels, kept in doubles. The C type sona_view.

| Declaration | What it does |
|---|---|
| `double EyeX` | The C field sona_view.eye, one part (m (world units)). |
| `double EyeY` | The C field sona_view.eye, one part (m (world units)). |
| `double EyeZ` | The C field sona_view.eye, one part (m (world units)). |
| `double TargetX` | Up is always +Y (lookAtLH), as the web camera. The C field sona_view.target, one part (m (world units)). |
| `double TargetY` | Up is always +Y (lookAtLH), as the web camera. The C field sona_view.target, one part (m (world units)). |
| `double TargetZ` | Up is always +Y (lookAtLH), as the web camera. The C field sona_view.target, one part (m (world units)). |
| `double FovDeg` | Vertical field of view in degrees; default 28.65, as the web. The C field sona_view.fov_deg (degrees). |
| `double NearZ` | Default 0.05. The C field sona_view.near_z (m (world units)). |
| `double FarZ` | Default 200 (the web SDK's; the editor uses 20). The C field sona_view.far_z (m (world units)). |
| `uint Width` | The target size in pixels, for LOD and culling. The C field sona_view.width (px). |
| `uint Height` | The target size in pixels, for LOD and culling. The C field sona_view.height (px). |
| `static unsafe SonaView Defaults()` | The web's full-body framing.<br>Calls [`sona_view_defaults`](../reference.md#sona_view_defaults). |
| `static unsafe SonaView FromNative(in Native.sona_view v)` | A SonaView from the C struct sona_view. |
| `unsafe Native.sona_view ToNative()` | The C struct sona_view for this view. |

### SonaEvent

`struct SonaEvent`: The C type sona_event.

| Declaration | What it does |
|---|---|
| `SonaEventType Type` | The C field sona_event.type (sona_event_type value). |
| `SonaAvatar Avatar` | READY and FAILED. The C field sona_event.avatar (pointer to sona_avatar). |
| `SonaResult Code` | The C field sona_event.code (sona_result value). |
| `string Message` | Valid until the next sona_poll_event. The C field sona_event.message (text (UTF-8), NULL: none). |
| `string Fix` | The C field sona_event.fix (text (UTF-8), NULL: none). |

### SonaClipInfo

`struct SonaClipInfo`: The C type sona_clip_info.

| Declaration | What it does |
|---|---|
| `string Key` | "GenericWave", "Stand0",... The C field sona_clip_info.key (text (UTF-8), NULL: none). |
| `string Id` | The clip's item id, or NULL for "idle", "still" and "prop". The C field sona_clip_info.id (text (UTF-8), NULL: none). |
| `string Caption` | May be NULL. The C field sona_clip_info.caption (text (UTF-8), NULL: none). |
| `float Seconds` | Negative when not known until decoded. The C field sona_clip_info.seconds (s). |
| `bool IsProp` | True when the clip holds a prop (its item and palette come with the pose). |

### SonaCreditImage

`sealed class SonaCreditImage`: The "Powered by 360sona" badge as pixels: its text, link, size and straight-alpha RGBA, from sona_credit_get.

| Declaration | What it does |
|---|---|
| `string Text` | The badge's words: "Powered by 360sona". |
| `string Url` | Where the badge links: https://360sona.com. |
| `uint Width` | The badge picture's width in px. |
| `uint Height` | The badge picture's height in px. |
| `byte[] Rgba` | The badge's pixels: straight-alpha RGBA8, row 0 at the top. |

### SonaShadingData

`sealed class SonaShadingData`: The fixed shading inputs, for hosts that rebuild our look in their own shaders. The C type sona_shading.

| Declaration | What it does |
|---|---|
| `uint IrradianceSize` | Texels a side of each irradiance face (16). |
| `ushort[] Irradiance` | 16x16 per face, RGBA16F, truncated from the captured floats as the web. The C field sona_shading.irradiance (a sona_texture (see its fields)). |
| `float IrradianceGain` | 1.0. The C field sona_shading.irradiance_gain (radians). |
| `float AoGain` | 0 in the SDK. The C field sona_shading.ao_gain (factor (unitless)). |
| `float BloomGain` | 0.1875. The C field sona_shading.bloom_gain (factor (unitless)). |
| `float[] ShadowRows = new float[12]` | The 3x4 light lookup the web ships. The C field sona_shading.shadow_rows (light lookup rows (unitless, 3x4)). |
| `float[] Rim = new float[4]` | 0.549, 0.502, 0.4039, 1.6. The C field sona_shading.rim (rim colour and power (unitless)). |

### SonaContext

`sealed unsafe class SonaContext : IDisposable`: The C type sona_ctx.

| Declaration | What it does |
|---|---|
| `SonaSource Source` | A host-written source. The C type sona_source. |
| `readonly ConcurrentDictionary<IntPtr, SonaRequest> Pending = new ConcurrentDictionary<IntPtr, SonaRequest>()` | The value of SONA_PENDING. |
| `SonaContext(SonaOptions options)` | Opens a context.<br>Calls [`sona_config_defaults`](../reference.md#sona_config_defaults), [`sona_open`](../reference.md#sona_open). |
| `IntPtr Handle` | The native handle this object owns, for a call the binding does not wrap. |
| `bool IsDisposed` | True once Dispose has run; every other call then throws. |
| `string AppId` | The app id this context runs as.<br>Calls [`sona_app_id`](../reference.md#sona_app_id). |
| `SonaException LastError()` | The last error on a ctx.<br>Calls [`sona_last_error`](../reference.md#sona_last_error). |
| `static Native.sona_prop_part PropPartDefaults()` | size set; colour 0xffffffff.<br>Calls [`sona_prop_part_defaults`](../reference.md#sona_prop_part_defaults). |
| `static Native.sona_prop_load_options PropLoadDefaults()` | size set; scale 1.<br>Calls [`sona_prop_load_defaults`](../reference.md#sona_prop_load_defaults). |
| `SonaPropMesh CreatePropMesh(Native.sona_prop_part[] parts)` | A prop mesh from triangles; the parts' pointers must stay valid for the call only.<br>Calls [`sona_prop_mesh_create`](../reference.md#sona_prop_mesh_create). |
| `SonaPropMesh LoadPropMesh(byte[] bytes, Native.sona_prop_load_options? options = null)` | A glTF 2.0 file (.glb, or.gltf with embedded buffers) as a prop mesh.<br>Calls [`sona_prop_mesh_load`](../reference.md#sona_prop_mesh_load). |
| `SonaPropMesh OpenPropMesh(string path, Native.sona_prop_load_options? options = null)` | A glTF file from a path; a.gltf's buffers and images next to it are read too.<br>Calls [`sona_prop_mesh_open`](../reference.md#sona_prop_mesh_open). |
| `SonaPropMesh StockPropMesh(string itemId)` | A stock prop item (a carryable); State is Pending until it has loaded.<br>Calls [`sona_prop_mesh_stock`](../reference.md#sona_prop_mesh_stock). |
| `static string[] PropPets()` | The catalogue's pets, as the site's pet mode lists them.<br>Calls [`sona_prop_pet_count`](../reference.md#sona_prop_pet_count), [`sona_prop_pet`](../reference.md#sona_prop_pet), [`sona_guid_format`](../reference.md#sona_guid_format). |
| `static bool PropIsPet(string itemId)` | 1 when the item id is one of the pets.<br>Calls [`sona_prop_is_pet`](../reference.md#sona_prop_is_pet). |
| `static Native.sona_interaction_desc InteractionDefaults(uint kind)` | Sets size, kind, the kind's default timings in seconds (high five 0.8, 0.15, 0.7; handshake 0.9, 1.6, 0.8; hug 1.1, 2.5, 1.0; hold hands 0.8, 0, 0.6; sit 1.3, 0, 1.4) and a default seat.<br>Calls [`sona_interaction_defaults`](../reference.md#sona_interaction_defaults). |
| `static Native.sona_seat SeatDefaults(uint kind)` | size set and a seat of that kind: height 0.45 (0 for GROUND), depth 0.45 (unlimited for GROUND), width 0.5 for a chair, 1.4 for a bench and unlimited on the ground.<br>Calls [`sona_seat_defaults`](../reference.md#sona_seat_defaults). |
| `static bool TryLayoutInteraction(in Native.sona_interaction_desc desc, out Native.sona_interaction_plan plan)` | Where an interaction would stand its avatars and where the contacts meet; false while the avatars (or, for SIT, the stock sit clip) are still loading.<br>Calls [`sona_interaction_layout`](../reference.md#sona_interaction_layout). |
| `SonaInteraction StartInteraction(in Native.sona_interaction_desc desc)` | Starts an interaction between desc.a and desc.b (SonaAvatar.Handle; b zero for SIT).<br>Calls [`sona_interaction_start`](../reference.md#sona_interaction_start). |
| `int ParamId(string name)` | The id of a parameter name, numbered from 0 in the order first asked for; -1 for a bad name or past 32.<br>Calls [`sona_param_id`](../reference.md#sona_param_id). |
| `SonaBlendSpace CreateBlendSpace(string paramX, string paramY, SonaBlendSample[] samples, bool unsynced = false, float smoothSeconds = 0.1f)` | A blend space over paramX (and paramY when 2D); one serves every avatar of this context.<br>Calls [`sona_blend_space_defaults`](../reference.md#sona_blend_space_defaults), [`sona_blend_space_create`](../reference.md#sona_blend_space_create). |
| `SonaStateMachine CreateStateMachine(SonaState[] states, SonaTransition[] transitions, string initial = null)` | A state machine; one serves every avatar of this context.<br>Calls [`sona_state_machine_defaults`](../reference.md#sona_state_machine_defaults), [`sona_state_machine_create`](../reference.md#sona_state_machine_create). |
| `SonaAvatar Add(byte[] manifest, SonaAddOptions options = null)` | Adds an avatar from its manifest bytes (sona_avatar_add); it builds in the background and shows once READY. |
| `SonaAvatar AddBase64(string base64, SonaAddOptions options = null)` | Adds an avatar from a base64 manifest, as the web SDK and the lookup routes give them (sona_avatar_add_base64). |
| `SonaAvatar AddState(byte[] blob)` | A new avatar with a saved state's look and state.<br>Calls [`sona_avatar_add_state`](../reference.md#sona_avatar_add_state). |
| `SonaAvatar AddWaiting(SonaAddOptions options = null)` | A player whose manifest is not known: QUEUED, a neutral figure while placeholders are on, until SonaAvatar.SetManifest gives it one. |
| `SonaAvatar AddItemPreview(string itemId, SonaPreviewOptions options = null)` | One item worn alone on a grey stand-in body, framed by its slot.<br>Calls [`sona_preview_defaults`](../reference.md#sona_preview_defaults), [`sona_item_preview_add`](../reference.md#sona_item_preview_add). |
| `static Native.sona_pixel_options PixelDefaults()` | size set, height 32, colours 16, flags SONA_PIXEL_OUTLINE, outline 0 (from the palette), alpha_cut 0.5, no palette.<br>Calls [`sona_pixel_defaults`](../reference.md#sona_pixel_defaults). |
| `SonaPicture PixelArt(SonaPicture picture, in Native.sona_pixel_options options, uint[] palette = null)` | Crisp pixel art from a straight RGBA8 picture.<br>Calls [`sona_pixel_art`](../reference.md#sona_pixel_art). |
| `uint[] PixelPalette(IReadOnlyList<SonaPicture> pictures, uint colours = 16)` | One palette (0xFFRRGGBB, darkest first) for several pictures.<br>Calls [`sona_pixel_palette`](../reference.md#sona_pixel_palette). |
| `static Native.sona_lod_options LodDefaults()` | The level-of-detail defaults, with sprites on at 48 px.<br>Calls [`sona_lod_defaults`](../reference.md#sona_lod_defaults). |
| `void SetLod()`<br>`void SetLod(in Native.sona_lod_options options)` | Turns on the default LOD steps and sprites (a context opens with no sprites, as 1.0 drew).<br>Calls [`sona_lod_set`](../reference.md#sona_lod_set). |
| `void SetSwayWorld(in Native.sona_sway_world world)` | The gravity and wind every swaying avatar of this context feels.<br>Calls [`sona_sway_world_set`](../reference.md#sona_sway_world_set). |
| `static Native.sona_sway_world SwayWorldDefaults()` | Gravity 0 -9.81 0, no wind, gust 0.35 with a period of 1.5 s.<br>Calls [`sona_sway_world_defaults`](../reference.md#sona_sway_world_defaults). |
| `Native.sona_lod_options GetLod()` | Copies the current options: before any sona_lod_set, thresholds 120 and 40 and no sprites (sprite_px 0).<br>Calls [`sona_lod_get`](../reference.md#sona_lod_get). |
| `Native.sona_lod_stats LodStats()` | The level-of-detail statistics: avatars in view at each step, those fading, the baked looks and the bakes of the last draw.<br>Calls [`sona_lod_stats_get`](../reference.md#sona_lod_stats_get). |
| `static Native.sona_placeholder_options PlaceholderDefaults()` | size set; delay_seconds 0 (never a hole), appear_seconds 0.2, reveal_seconds 0.4, failed_seconds 2, tint 0.16, 0.19, 0.25 (a cool grey), failed_tint 0.25, 0.15, 0.15 (a muted red), glow 0.5.<br>Calls [`sona_placeholder_defaults`](../reference.md#sona_placeholder_defaults). |
| `void SetPlaceholders()`<br>`void SetPlaceholders(in Native.sona_placeholder_options options)` | Loading avatars show a neutral figure until they are READY (off on a new context).<br>Calls [`sona_placeholder_set`](../reference.md#sona_placeholder_set). |
| `bool GetPlaceholders(out Native.sona_placeholder_options options)` | The options; false while placeholders are off.<br>Calls [`sona_placeholder_get`](../reference.md#sona_placeholder_get). |
| `void PlaceholdersOff()` | Figures shown now fade out over appear_seconds.<br>Calls [`sona_placeholder_off`](../reference.md#sona_placeholder_off). |
| `Native.sona_placeholder_stats PlaceholderStats()` | Figures in view at the last sona_update (by phase, and how many as sprites), how many were posed and the time that took, and the figure draws of the last sona_draw or sona_snapshot.<br>Calls [`sona_placeholder_stats_get`](../reference.md#sona_placeholder_stats_get). |
| `int AvatarCount` | How many avatars this context holds. |
| `Native.sona_frame_stats Update(double dtSeconds)`<br>`Native.sona_frame_stats Update(double dtSeconds, in SonaView view)` | Advances every avatar by dt_seconds (clamped to 0..0.1 s, as the web), runs build steps inside the build budget, culls against the view and poses what is due (the web's LOD rules).<br>Calls [`sona_update`](../reference.md#sona_update). |
| `bool PollEvent(out SonaEvent ev)` | True when an event was written to ev, false when there are none; call it until it is false.<br>Calls [`sona_poll_event`](../reference.md#sona_poll_event). |
| `Native.sona_scene_stats Stats()` | The scene statistics.<br>Calls [`sona_stats`](../reference.md#sona_stats). |
| `List<SonaClipInfo> Clips()` | How many clips the context knows.<br>Calls [`sona_clip_count`](../reference.md#sona_clip_count), [`sona_clip_get`](../reference.md#sona_clip_get). |
| `bool TryGetShading(out SonaShadingData shading)` | False until the data files have loaded (sona_shading_get returns PENDING).<br>Calls [`sona_shading_get`](../reference.md#sona_shading_get). |
| `SonaCreditImage GetCredit(uint scale = 1)` | The badge: scale 1 on screen; max(1, round(min(w, h) / 400)) for pictures, as the web.<br>Calls [`sona_credit_get`](../reference.md#sona_credit_get). |
| `byte[] EncodePng(byte[] rgba, uint width, uint height)` | PNG bytes with the web's three tEXt chunks.<br>Calls [`sona_png_encode`](../reference.md#sona_png_encode), [`sona_free`](../reference.md#sona_free). |
| `SonaView FitCrowd(SonaView view)` | Fits every ready avatar in view (the web's preset "crowd").<br>Calls [`sona_camera_fit_crowd`](../reference.md#sona_camera_fit_crowd). |
| `SonaRenderer CreateRenderer(in Native.sona_device_desc device)` | Makes a renderer on the host's device.<br>Calls [`sona_renderer_create`](../reference.md#sona_renderer_create). |
| `void Dispose()` | Closes a context.<br>Calls [`sona_close`](../reference.md#sona_close). |

### SonaInteraction

`sealed unsafe class SonaInteraction : IDisposable`: A running interaction (SonaContext.StartInteraction).

| Declaration | What it does |
|---|---|
| `IntPtr Handle` | The native handle this object owns, for a call the binding does not wrap. |
| `void End()` | Begins the end phase: letting go, standing up.<br>Calls [`sona_interaction_end`](../reference.md#sona_interaction_end). |
| `void Move(float x, float y, float z, float turnDeg)` | Moves the place (or the seat) while it runs.<br>Calls [`sona_interaction_move`](../reference.md#sona_interaction_move). |
| `Native.sona_interaction_status Status()` | Where an interaction is: its kind and phase, the time in the phase and how far through it, whether the contacts are together, the widest gap at a contact, the clearance between the two bodies (negative: into each other),<br>Calls [`sona_interaction_status_get`](../reference.md#sona_interaction_status_get). |
| `Native.sona_interaction_event[] Events()` | The events since the last call, oldest first.<br>Calls [`sona_interaction_events`](../reference.md#sona_interaction_events). |
| `void Dispose()` | Stops at once and frees it: its IK targets go, the avatars stay where they are and keep their clip.<br>Calls [`sona_interaction_remove`](../reference.md#sona_interaction_remove). |

### SonaAvatar

`sealed unsafe class SonaAvatar`: The C type sona_avatar.

| Declaration | What it does |
|---|---|
| `uint Id` | A number unique within the ctx. |
| `IntPtr Handle` | The native handle this object owns, for a call the binding does not wrap. |
| `SonaContext Context` | The C type sona_ctx. |
| `bool IsRemoved` | True once the avatar has been removed; its calls then throw. |
| `SonaAvatarState State` | The avatar's state.<br>Calls [`sona_avatar_state_of`](../reference.md#sona_avatar_state_of). |
| `byte[] SaveState(bool withLook = true)` | The whole state as a blob; null before READY.<br>Calls [`sona_avatar_save_state`](../reference.md#sona_avatar_save_state), [`sona_free`](../reference.md#sona_free). |
| `void LoadState(byte[] blob)` | Puts a saved state on at the next update, once READY and its clips are loaded.<br>Calls [`sona_avatar_load_state`](../reference.md#sona_avatar_load_state). |
| `void Puppet(bool on)` | A puppet's clocks stand still; only states put on it move it.<br>Calls [`sona_avatar_puppet`](../reference.md#sona_avatar_puppet). |
| `bool TryExport(SonaExportOptions options, out byte[] file, out SonaExportReport report)` | The avatar as a.vrm (1.0 or 0.x) or.glb file.<br>Calls [`sona_export_defaults`](../reference.md#sona_export_defaults), [`sona_export_avatar`](../reference.md#sona_export_avatar), [`sona_free`](../reference.md#sona_free). |
| `void Play(string clip, bool loop = true, float speed = 1, float from = 0)` | Before READY it is remembered and applied when the avatar appears.<br>Calls [`sona_avatar_play`](../reference.md#sona_avatar_play). |
| `void Stop()` | Holds the current pose.<br>Calls [`sona_avatar_stop`](../reference.md#sona_avatar_stop). |
| `void Move(SonaPlacement to, float overSeconds = 0)` | Moves the avatar to a new placement over over_seconds.<br>Calls [`sona_avatar_move`](../reference.md#sona_avatar_move). |
| `void SetVisible(bool visible)` | Shows or hides it.<br>Calls [`sona_avatar_set_visible`](../reference.md#sona_avatar_set_visible). |
| `void Bounds(out float cx, out float cy, out float cz, out float radius)` | A bounding sphere, in metres.<br>Calls [`sona_avatar_bounds`](../reference.md#sona_avatar_bounds). |
| `void Remove()` | Removes the avatar and frees what only it used.<br>Calls [`sona_avatar_remove`](../reference.md#sona_avatar_remove). |
| `bool TryGetPose(out SonaPose pose)` | False before READY.<br>Calls [`sona_pose`](../reference.md#sona_pose). |
| `void PoseVertices(uint mesh, bool worldSpace, float[] positions, float[] normals, int strideFloats = 3)` | CPU skinning of one mesh: positions (and normals when given), strideFloats apart (at least 3).<br>Calls [`sona_pose_vertices`](../reference.md#sona_pose_vertices). |
| `SonaView CameraPreset(SonaPreset preset, SonaView view)` | Sets view->eye and view->target to one of the console's framings on one ready avatar.<br>Calls [`sona_camera_preset`](../reference.md#sona_camera_preset). |
| `bool TryGetJointWorld(int joint, float[] out16)` | A joint's world matrix at the last Update: row-vector, metres, the placement applied.<br>Calls [`sona_joint_world`](../reference.md#sona_joint_world). |
| `void SetOverride(int joint, float x, float y, float z, float w, float weight = 1, SonaOverrideMode mode = SonaOverrideMode.Replace)` | A unit quaternion applied after the clip.<br>Calls [`sona_avatar_override`](../reference.md#sona_avatar_override). |
| `void ClearOverride(int joint)` | A rotation applied after the clip each frame, for look-at and aiming.<br>Calls [`sona_avatar_override`](../reference.md#sona_avatar_override). |
| `void ClearOverrides()` | Clears every override of the avatar.<br>Calls [`sona_avatar_clear_overrides`](../reference.md#sona_avatar_clear_overrides). |
| `void Crossfade(string clip, float seconds, bool loop = true, float speed = 1, float from = 0)` | Play, blending from the current pose over seconds (0: a cut).<br>Calls [`sona_avatar_crossfade`](../reference.md#sona_avatar_crossfade). |
| `void Queue(string clip, float fadeSeconds = 0, bool loop = true, float speed = 1, float from = 0)` | Plays clip when the current one ends.<br>Calls [`sona_avatar_queue`](../reference.md#sona_avatar_queue). |
| `int QueuedCount` | How many clips are waiting in the queue.<br>Calls [`sona_avatar_queued`](../reference.md#sona_avatar_queued). |
| `void PlayStock(uint clipId, float fadeSeconds = 0, bool? loop = null, float speed = 1, float from = 0)`<br>`void PlayStock(string clip, float fadeSeconds = 0, bool? loop = null, float speed = 1, float from = 0)` | A stock clip (SONA_STOCK_* id), the variant for this avatar's body; fadeSeconds > 0 crossfades.<br>Calls [`sona_avatar_play_stock`](../reference.md#sona_avatar_play_stock). |
| `void SetIdle(SonaIdleOptions options)` | The procedural idle: blinks, glances, weight shifts and breathing over any clip; null turns it off.<br>Calls [`sona_avatar_idle`](../reference.md#sona_avatar_idle). |
| `bool TryGetCapsule(out SonaCapsule capsule)` | A vertical capsule around the posed body, in world space.<br>Calls [`sona_avatar_capsule`](../reference.md#sona_avatar_capsule). |
| `void SetExpression(byte mouth, byte leftEyebrow = SonaMouth.Clip, byte rightEyebrow = SonaMouth.Clip, byte leftEye = SonaMouth.Clip, byte rightEye = SonaMouth.Clip)` | Each a shape index (0 neutral) or SonaMouth.Clip (255) to leave that part as the clip has it.<br>Calls [`sona_avatar_expression`](../reference.md#sona_avatar_expression). |
| `void ClearExpression()` | Hands the whole face back to the clip.<br>Calls [`sona_avatar_expression`](../reference.md#sona_avatar_expression). |
| `static Native.sona_prop_attach PropAttachDefaults()` | size set; position 0, rotation 0 0 0 1, scale 1, hand_weight 1, fade_seconds 0.2, speed 1.<br>Calls [`sona_prop_attach_defaults`](../reference.md#sona_prop_attach_defaults). |
| `uint AttachProp(SonaPropMesh mesh, Native.sona_prop_attach? options = null)` | Attaches a prop mesh; returns its id on this avatar.<br>Calls [`sona_avatar_prop_attach`](../reference.md#sona_avatar_prop_attach). |
| `void SetProp(uint id, in Native.sona_prop_attach options)` | New placement, flags or hand for an attached prop (each frame for one that moves on the joint).<br>Calls [`sona_avatar_prop_set`](../reference.md#sona_avatar_prop_set). |
| `void SwapProp(uint id, SonaPropMesh mesh)` | Another mesh in the same place: a sword for a stick, an item for a placeholder.<br>Calls [`sona_avatar_prop_swap`](../reference.md#sona_avatar_prop_swap). |
| `Native.sona_prop_attach GetProp(uint id)` | What the prop was attached with, and its mesh (either may be NULL).<br>Calls [`sona_avatar_prop_get`](../reference.md#sona_avatar_prop_get). |
| `void DetachProp(uint id)` | Takes the prop off at once (its hand's IK target eases off).<br>Calls [`sona_avatar_prop_detach`](../reference.md#sona_avatar_prop_detach). |
| `void DetachAllProps()` | Takes every prop off the avatar at once.<br>Calls [`sona_avatar_prop_detach_all`](../reference.md#sona_avatar_prop_detach_all). |
| `Native.sona_prop_frame PropFrame(uint id)` | One prop as the last update posed it; palette is valid until the next update.<br>Calls [`sona_avatar_prop_frame`](../reference.md#sona_avatar_prop_frame). |
| `void PropVertices(uint id, uint mesh, bool world, float[] positions, float[] normals = null)` | CPU skinning of one of the prop's meshes: vertex_count positions (and normals), 3 floats each.<br>Calls [`sona_avatar_prop_vertices`](../reference.md#sona_avatar_prop_vertices). |
| `static Native.sona_ik_target IkTargetDefaults()` | size set, no flags, position 0, rotation (0, 0, 0, 1), joint -1, weight 1, and the fade a default of 0.2 s.<br>Calls [`sona_ik_target_defaults`](../reference.md#sona_ik_target_defaults). |
| `static Native.sona_ik_feet IkFeetDefaults()` | SONA_IK_GROUND_PLANE with the plane y = 0, weight 1, hips offset at most 0.45 m, tilt at most 35 degrees, and the smoothing a default of 0.1 s.<br>Calls [`sona_ik_feet_defaults`](../reference.md#sona_ik_feet_defaults). |
| `static Native.sona_ik_look IkLookDefaults()` | Its defaults are head and eyes, weight 1, yaw 70, up 35, down 45 degrees, smoothing by default 0.15 s, a turn rate of 360 degrees a second, eyes past 10.<br>Calls [`sona_ik_look_defaults`](../reference.md#sona_ik_look_defaults). |
| `static Native.sona_ik_limits IkLimitsDefaults()` | Elbows 145, knees 150, wrists 75 swing and 80 twist, ankles 45 and 30 degrees, hips 120 forward, 25 behind, 45 out and 25 in, shoulders 45 behind (held level) and 50 across, reach easing from 0.97, a 0.02 m body margin,<br>Calls [`sona_ik_limits_defaults`](../reference.md#sona_ik_limits_defaults). |
| `void SetIkTarget(uint limb, in Native.sona_ik_target target)` | A hand or foot target (Native.SONA_IK_LEFT_HAND..<br>Calls [`sona_avatar_ik_target`](../reference.md#sona_avatar_ik_target). |
| `void ClearIkTarget(uint limb)` | A hand puts its palm (with SONA_IK_WRIST its wrist) at position; a foot its ankle.<br>Calls [`sona_avatar_ik_target`](../reference.md#sona_avatar_ik_target). |
| `void SetIkFeet(in Native.sona_ik_feet options, Native.IkGroundFn ground = null)` | Foot planting.<br>Calls [`sona_avatar_ik_feet`](../reference.md#sona_avatar_ik_feet). |
| `void ClearIkFeet()` | Plants the feet on the ground given by ground: SONA_IK_GROUND_PLANE (plane: n.x, n.y, n.z, d, world), SONA_IK_GROUND_POINTS (sona_avatar_ik_ground per foot) or SONA_IK_GROUND_CALLBACK (query, a downward ray<br>Calls [`sona_avatar_ik_feet`](../reference.md#sona_avatar_ik_feet). |
| `void SetIkGround(uint foot, float px, float py, float pz, float nx, float ny, float nz)` | SONA_IK_GROUND_POINTS: the ground under one foot this frame.<br>Calls [`sona_avatar_ik_ground`](../reference.md#sona_avatar_ik_ground). |
| `void SetIkLook(in Native.sona_ik_look options)` | Turns the chest, neck and head towards the world point target inside the limits, eased; the eyes take the rest through the face's look shapes when it has them.<br>Calls [`sona_avatar_ik_look`](../reference.md#sona_avatar_ik_look). |
| `void ClearIkLook()` | Turns the chest, neck and head towards the world point target inside the limits, eased; the eyes take the rest through the face's look shapes when it has them.<br>Calls [`sona_avatar_ik_look`](../reference.md#sona_avatar_ik_look). |
| `static Native.sona_style StyleDefaults()` | The original look, no outline, every parameter at its default.<br>Calls [`sona_style_defaults`](../reference.md#sona_style_defaults). |
| `void SetStyle(in Native.sona_style style)` | The avatar's own art style, from the next frame.<br>Calls [`sona_avatar_set_style`](../reference.md#sona_avatar_set_style). |
| `void ClearStyle()` | Back to the renderer's style.<br>Calls [`sona_avatar_set_style`](../reference.md#sona_avatar_set_style). |
| `void SetIkLimits(in Native.sona_ik_limits limits)` | The joint limits for this avatar's solves.<br>Calls [`sona_avatar_ik_limits`](../reference.md#sona_avatar_ik_limits). |
| `void ClearIk()` | Every target, the planting and the look-at off at once.<br>Calls [`sona_avatar_ik_clear`](../reference.md#sona_avatar_ik_clear). |
| `void SetPlaceholder(int mode)` | Its loading placeholder: -1 follows the context, 0 never, 1 always.<br>Calls [`sona_avatar_placeholder`](../reference.md#sona_avatar_placeholder). |
| `Native.sona_placeholder_info PlaceholderInfo()` | The avatar's figure at the last sona_update: its phase, opacity, height, which figure (male, female or neutral), whether it plays the avatar's clip, the seconds since the avatar was added and whether it is drawn as a s<br>Calls [`sona_avatar_placeholder_info`](../reference.md#sona_avatar_placeholder_info). |
| `void SetManifest(byte[] manifest)` | The manifest of an avatar added with AddWaiting, once.<br>Calls [`sona_avatar_set_manifest`](../reference.md#sona_avatar_set_manifest). |
| `void SetManifestBase64(string base64)` | sona_avatar_set_manifest with the manifest as base64 text.<br>Calls [`sona_avatar_set_manifest_base64`](../reference.md#sona_avatar_set_manifest_base64). |
| `bool TryGetIkStatus(out Native.sona_ik_status status)` | What the last pose did; false before the avatar was posed with IK on.<br>Calls [`sona_avatar_ik_status`](../reference.md#sona_avatar_ik_status). |
| `static Native.sona_ragdoll_options RagdollDefaults()` | size set; coverage 0.9.<br>Calls [`sona_ragdoll_defaults`](../reference.md#sona_ragdoll_defaults). |
| `Native.sona_ragdoll_body[] Ragdoll(in Native.sona_ragdoll_options options)`<br>`Native.sona_ragdoll_body[] Ragdoll()` | The bodies fitted to this avatar now: colliders, masses and the joints to their parents.<br>Calls [`sona_avatar_ragdoll`](../reference.md#sona_avatar_ragdoll). |
| `bool TryGetRagdollState(Native.sona_ragdoll_state[] bodies)` | The bodies at the last pose with their velocities; false before Ragdoll.<br>Calls [`sona_avatar_ragdoll_state`](../reference.md#sona_avatar_ragdoll_state). |
| `void RagdollDrive(Native.sona_ragdoll_state[] bodies, float weight = 1, uint flags = 0)` | The host's simulated bodies onto the avatar from the next pose; weight 0..1 blends from the clip.<br>Calls [`sona_avatar_ragdoll_drive`](../reference.md#sona_avatar_ragdoll_drive). |
| `void RagdollRelease(float blendSeconds)` | Back to the clip, blending from the last ragdoll pose over blendSeconds.<br>Calls [`sona_avatar_ragdoll_release`](../reference.md#sona_avatar_ragdoll_release). |
| `bool TryGetRagdollInfo(out Native.sona_ragdoll_info info)` | SONA_E_NOT_READY before the avatar has been posed since sona_avatar_ragdoll.<br>Calls [`sona_avatar_ragdoll_info`](../reference.md#sona_avatar_ragdoll_info). |
| `void RagdollClear()` | Off at once: no tracking, no drive, no blend.<br>Calls [`sona_avatar_ragdoll_clear`](../reference.md#sona_avatar_ragdoll_clear). |
| `static Native.sona_sway SwayDefaults()` | Parts SONA_SWAY_DEFAULT, medium quality, stiffness and damping 0.5, wind scale 1, 48 minimum pixels.<br>Calls [`sona_sway_defaults`](../reference.md#sona_sway_defaults). |
| `void SetSway(in Native.sona_sway options)` | Hair and cloth sway on, with these options; throws ARGUMENT for a value out of range.<br>Calls [`sona_avatar_sway`](../reference.md#sona_avatar_sway). |
| `void ClearSway()` | Turns sway on with these options, before or after READY (it applies to every later build too).<br>Calls [`sona_avatar_sway`](../reference.md#sona_avatar_sway). |
| `void ResetSway()` | Back to the modelled shape, at rest, at the next pose.<br>Calls [`sona_avatar_sway_reset`](../reference.md#sona_avatar_sway_reset). |
| `bool TryGetSwayInfo(out Native.sona_sway_info info)` | What sways and what the last pose did; false before READY.<br>Calls [`sona_avatar_sway_info`](../reference.md#sona_avatar_sway_info). |
| `uint SwayMeshParts(uint mesh)` | The SONA_SWAY_* kinds one of sona_pose's meshes sways with; 0 for one that does not, a bad index, or an avatar with sway off or not READY.<br>Calls [`sona_avatar_sway_mesh_parts`](../reference.md#sona_avatar_sway_mesh_parts). |
| `void SetMouth(byte shape)` | Only the mouth (a SonaMouth shape, or SonaMouth.Clip to hand it back); the same shape again does nothing.<br>Calls [`sona_avatar_mouth`](../reference.md#sona_avatar_mouth). |
| `void Voice(ref Native.sona_voice_mouth state, float level, float dt)` | Voice chat: this speaker's audio level (linear RMS) moves the mouth.<br>Calls [`sona_avatar_voice`](../reference.md#sona_avatar_voice). |
| `bool TryGetExpressionCounts(out int mouths, out int eyebrows, out int eyes)` | How many shapes this face has per part; 0 for a part it lacks.<br>Calls [`sona_avatar_expression_counts`](../reference.md#sona_avatar_expression_counts). |
| `int ReadClipEvents(List<SonaClipEvent> into)` | Adds every clip event since the last call, oldest first, to into; returns how many.<br>Calls [`sona_avatar_clip_events`](../reference.md#sona_avatar_clip_events). |
| `void Mark(float seconds, uint id)` | A Mark event with this id each time the current clip passes seconds; marks go when another clip starts.<br>Calls [`sona_avatar_mark`](../reference.md#sona_avatar_mark). |
| `void ClearMarks()` | Removes the avatar's marks.<br>Calls [`sona_avatar_clear_marks`](../reference.md#sona_avatar_clear_marks). |
| `void SetRootMotion(SonaRootMotion mode)` | What happens to the clip's sideways travel of the hips.<br>Calls [`sona_avatar_root_motion`](../reference.md#sona_avatar_root_motion). |
| `void TakeRootMotion(out float dx, out float dy, out float dz)` | The travel collected since the last call, in world metres; clears it.<br>Calls [`sona_avatar_take_root_motion`](../reference.md#sona_avatar_take_root_motion). |
| `void PlayLayer(int layer, string clip, SonaLayerOptions options = null)`<br>`void PlayLayer(int layer, SonaBlendSpace blend, SonaLayerOptions options = null)`<br>`void PlayLayer(int layer, SonaStateMachine machine, SonaLayerOptions options = null)` | Plays a clip key or raw clip id on a layer (0..7), over the avatar's own clip.<br>Calls [`sona_avatar_layer_play`](../reference.md#sona_avatar_layer_play), [`sona_avatar_layer_blend`](../reference.md#sona_avatar_layer_blend), [`sona_avatar_layer_machine`](../reference.md#sona_avatar_layer_machine). |
| `void SetLayerWeight(int layer, float weight, float overSeconds = 0)` | Moves the layer's weight linearly to weight (0..1) over over_seconds; 0 or less sets it at once.<br>Calls [`sona_avatar_layer_weight`](../reference.md#sona_avatar_layer_weight). |
| `void SetLayerMask(int layer, float[] mask)` | 72 weights 0..1, or null for every joint.<br>Calls [`sona_avatar_layer_mask`](../reference.md#sona_avatar_layer_mask). |
| `void StopLayer(int layer, float fadeSeconds = 0.2f)` | Fades the layer out over fade_seconds and then empties it (a STOPPED event); 0 empties it now.<br>Calls [`sona_avatar_layer_stop`](../reference.md#sona_avatar_layer_stop). |
| `void GotoState(int layer, int state, float fadeSeconds = 0.2f)` | Sends a machine layer to a state now, crossfading over fadeSeconds.<br>Calls [`sona_avatar_layer_goto`](../reference.md#sona_avatar_layer_goto). |
| `SonaLayerInfo LayerInfo(int layer)` | The layer now: kind, mode, state (machines, else -1), clip (the sona_clip_get index, -1 for a raw id), weight with fades, time and normalized through the clip or cycle, ready (its clips have loaded) and<br>Calls [`sona_avatar_layer_info`](../reference.md#sona_avatar_layer_info). |
| `int ReadLayerEvents(List<SonaLayerEvent> into)` | Adds every layer event since the last call, oldest first, to into; returns how many.<br>Calls [`sona_avatar_layer_events`](../reference.md#sona_avatar_layer_events). |
| `void SetParam(int param, float value)` | Sets one parameter on the avatar; read at the next sona_update.<br>Calls [`sona_avatar_set_param`](../reference.md#sona_avatar_set_param). |
| `void SetParams(int first, float[] values)` | Parameters first..<br>Calls [`sona_avatar_set_params`](../reference.md#sona_avatar_set_params). |
| `float Param(int param)` | A parameter's value; 0 when unset or unknown.<br>Calls [`sona_avatar_param`](../reference.md#sona_avatar_param). |
| `SonaLodStep Lod(out float fade)` | The LOD step at the last Update, and how far from mesh (0) to sprite (1).<br>Calls [`sona_avatar_lod`](../reference.md#sona_avatar_lod). |
| `SonaLodStep LodStep` | The level of detail it was drawn at last (sona_avatar_lod). |
| `bool TryGetPreviewBounds(float[] lo, float[] hi)` | The previewed item's world box.<br>Calls [`sona_item_preview_bounds`](../reference.md#sona_item_preview_bounds). |
| `bool TryGetPreviewView(uint width, uint height, out SonaView view)` | The framed camera for a width x height picture of this preview.<br>Calls [`sona_item_preview_view`](../reference.md#sona_item_preview_view). |

### SonaCapsule

`struct SonaCapsule`: A vertical capsule around the posed body, in world space, for collisions: the segment a..b and its radius. The C type sona_capsule.

| Declaration | What it does |
|---|---|
| `float AX` | The C field sona_capsule.a, one part (m (world units)). |
| `float AY` | The C field sona_capsule.a, one part (m (world units)). |
| `float AZ` | The C field sona_capsule.a, one part (m (world units)). |
| `float BX` | The C field sona_capsule.b, one part (m (world units)). |
| `float BY` | The C field sona_capsule.b, one part (m (world units)). |
| `float BZ` | The C field sona_capsule.b, one part (m (world units)). |
| `float Radius` | The C field sona_capsule.radius (m (world units)). |

### SonaClipEvent

`struct SonaClipEvent`: The C type sona_clip_event.

| Declaration | What it does |
|---|---|
| `SonaClipEventKind Kind` | The C field sona_clip_event.kind (one of the values named in the header). |
| `uint Mark` | The C field sona_clip_event.mark (index or id). |
| `int Clip` | The C field sona_clip_event.clip (index or id (-1: none)). |
| `float Time` | The C field sona_clip_event.time (s). |

### SonaJoints

`static unsafe class SonaJoints`: The value of SONA_JOINTS: palette slots; the avatar rig animates 71

| Declaration | What it does |
|---|---|
| `const int Count = Native.SONA_JOINT_COUNT - 1` | The joints the rig animates. |
| `static int Find(string name)` | "Hips", "Head", "PropRight", "shape_04" or "joint_33"; -1 when unknown.<br>Calls [`sona_joint_find`](../reference.md#sona_joint_find). |
| `static string Name(int joint)` | null past the last joint.<br>Calls [`sona_joint_name`](../reference.md#sona_joint_name). |

### SonaSkeletons

`static unsafe class SonaSkeletons`: The rig's joints under Unity Humanoid, VRM and Unreal mannequin bone names.

| Declaration | What it does |
|---|---|
| `static string Bone(SonaSkeleton skeleton, int joint)` | The bone a joint is in that skeleton; null for a joint it has none for.<br>Calls [`sona_skeleton_bone`](../reference.md#sona_skeleton_bone). |
| `static int Joint(SonaSkeleton skeleton, string bone)` | The joint a bone of that skeleton is; -1 when none.<br>Calls [`sona_skeleton_joint`](../reference.md#sona_skeleton_joint). |

### SonaExportOptions

`sealed class SonaExportOptions`: What sona_export_avatar writes.

| Declaration | What it does |
|---|---|
| `SonaExportFormat Format = SonaExportFormat.Vrm` | SONA_EXPORT_*; default SONA_EXPORT_VRM. The C field sona_export_options.format (one of the SONA_ values named). |
| `SonaExportFlags Flags` | SONA_EXPORT_* flags. The C field sona_export_options.flags (bit flags). |
| `SonaSkeleton BoneNames = SonaSkeleton.Unity` | The bones' node names, a sona_skeleton_kind (default UNITY); UE4 and UE5 add "root". The C field sona_export_options.bone_names (sona_skeleton_kind value). |
| `string Name` | The model's name; NULL: "Avatar". The C field sona_export_options.name (text (UTF-8), NULL: none). |
| `string Version` | NULL: none. The C field sona_export_options.version (text (UTF-8), NULL: none). |
| `string Authors` | One per line; NULL: "360sona". The C field sona_export_options.authors (text (UTF-8), NULL: none). |
| `string Copyright` | The C field sona_export_options.copyright (text (UTF-8), NULL: none). |
| `string Contact` | The C field sona_export_options.contact (text (UTF-8), NULL: none). |
| `string References` | One per line. The C field sona_export_options.references (text (UTF-8), NULL: none). |
| `string ThirdPartyLicences` | The C field sona_export_options.third_party_licences (text (UTF-8), NULL: none). |
| `string LicenceUrl` | NULL: the VRM Public License 1.0, https://vrm.dev/licenses/1.0/. The C field sona_export_options.licence_url (text (UTF-8), NULL: none). |
| `string OtherLicenceUrl` | The C field sona_export_options.other_licence_url (text (UTF-8), NULL: none). |
| `SonaVrmPermission AvatarPermission` | SONA_VRM_ONLY_AUTHOR (default), SEPARATELY_LICENSED, EVERYONE. The C field sona_export_options.avatar_permission (one of the SONA_ values named). |
| `SonaVrmCommercial CommercialUsage` | SONA_VRM_PERSONAL_NON_PROFIT (default), PERSONAL_PROFIT, CORPORATION. The C field sona_export_options.commercial_usage (one of the SONA_ values named). |
| `SonaVrmModification Modification` | SONA_VRM_MODIFY_PROHIBITED (default), ALLOWED, REDISTRIBUTION. The C field sona_export_options.modification (one of the SONA_ values named). |
| `SonaVrmAllow Allow` | SONA_VRM_ALLOW_* bits; 0: nothing allowed, credit required. The C field sona_export_options.allow (one of the SONA_ values named). |
| `byte[] ThumbnailPng` | A square PNG for the meta (sona_snapshot + sona_png_encode); NULL: none. The C field sona_export_options.thumbnail_png (pointer). |

### SonaExportReport

`struct SonaExportReport`: The C type sona_export_report.

| Declaration | What it does |
|---|---|
| `uint Meshes` | Degenerate triangles left out. The C field sona_export_report.meshes (count). |
| `uint Primitives` | Degenerate triangles left out. The C field sona_export_report.primitives (count). |
| `uint Vertices` | Degenerate triangles left out. The C field sona_export_report.vertices (count). |
| `uint Triangles` | Degenerate triangles left out. The C field sona_export_report.triangles (count). |
| `uint Degenerate` | Degenerate triangles left out. The C field sona_export_report.degenerate (count). |
| `uint Textures` | The C field sona_export_report.textures (count). |
| `uint Expressions` | The C field sona_export_report.expressions (count). |
| `uint AtlasCells` | The C field sona_export_report.atlas_cells (count). |
| `uint Baked` | Materials whose albedo chain was flattened into a new picture. The C field sona_export_report.baked (count). |
| `float BakeError` | The worst of those, in 0..255 levels (glb.js bakeError). The C field sona_export_report.bake_error (colour levels, 0 to 255). |
| `float Ms` | The C field sona_export_report.ms (ms). |

### SonaPreviewOptions

`sealed class SonaPreviewOptions`: The C type sona_preview_options.

| Declaration | What it does |
|---|---|
| `uint Gender` | 1 male, 2 female; 0: the body the item was made for (male when either). The C field sona_preview_options.gender (one of the values named in the header). |
| `uint Slot` | The category mask to frame by (0x40 hat, 0x38 costume,...); 0: from the item. The C field sona_preview_options.slot (index or id). |
| `SonaPreviewFlags Flags` | SONA_PREVIEW_*. The C field sona_preview_options.flags (bit flags). |
| `uint Skin` | 0xAARRGGBB; 0: the stand-in grey 0xff9a9a9a. The C field sona_preview_options.skin (colour, 0xAARRGGBB). |
| `uint[] Colours = new uint[3]` | 0xAARRGGBB primary, secondary, tertiary, with SONA_PREVIEW_COLOURS. The C field sona_preview_options.colours (colour, 0xAARRGGBB). |
| `int Priority` | Build order, as sona_add_options.priority. The C field sona_preview_options.priority (order (higher first)). |
| `float Time = -1` | Props: seconds into the clip to hold (or start at); negative: its fullest frame. The C field sona_preview_options.time (s). |
| `float Margin = 1.36f` | Room around the item: 1 touches the edges; 0: 1.36, as the web's item renders. The C field sona_preview_options.margin (factor (unitless)). |

### SonaPose

`readonly unsafe struct SonaPose`: The avatar's pose data, valid until the next sona_update.

| Declaration | What it does |
|---|---|
| `bool IsValid` | True until the next Update; a pose read after that throws. |
| `IntPtr Raw` | The native pointer this value wraps, for a call through Native that the friendly layer does not cover. |
| `uint BuildVersion` | Bumps when meshes, materials or textures change. The C field sona_pose_data.build_version (version number). |
| `float World(int i)` | W = scale * rotateY(turn) * translate(position), row-vector. The C field sona_pose_data.world (4x4 matrix, row-vector). |
| `void CopyWorld(float[] out16)` | Copies the avatar's 4x4 world matrix (sona_pose_data.world) into a float[16]. |
| `ReadOnlySpan<float> Palette` | 864 floats: per joint 3 float4, columns 0..2 of the row-vector skin matrix, in avatar space. |
| `IntPtr PalettePtr` | 864 floats: per joint 3 float4 = columns 0..2 of the row-vector skin matrix, in avatar space (view = identity). The C field sona_pose_data.palette (pointer). |
| `ReadOnlySpan<float> ViewJoints` | 72 * 3 floats: each joint's translation before W. The C field sona_pose_data.view_joints (pointer). |
| `int MeshCount` | The C field sona_pose_data.mesh_count (count). |
| `int MaterialCount` | The C field sona_pose_data.material_count (count). |
| `int TextureCount` | The C field sona_pose_data.texture_count (count). |
| `int PropCount` | Held props (up to 4), then one per swaying mesh with sway on (3.34):. The C field sona_pose_data.prop_count (count). |
| `byte Expression(int i)` | Mouth, left eyebrow, right eyebrow, left eye, right eye. The C field sona_pose_data.expression (expression index per face part). |
| `SonaMeshData Mesh(int i)` | The runtime vertex, 76 bytes, in host byte order: +0 float3 position (bind pose, avatar space) +12 uint8 x4 joint index * 3 (the palette's float4 row) +16 uint8 x4 weight (sum 255) +20 uint8 x4 normal, (n * 0.5 + 0.5) *  The C type sona_mesh. |
| `SonaMaterialData Material(int i)` | Address modes: bit 0 set = U wraps, bit 1 set = V wraps; clear = clamp. The C type sona_material. |
| `SonaTextureData Texture(int i)` | The C type sona_texture. |
| `SonaPropData Prop(int i)` | The i-th prop the avatar holds this frame (sona_pose_data.props). |

### SonaMeshData

`readonly unsafe struct SonaMeshData`: The runtime vertex, 76 bytes, in host byte order: +0 float3 position (bind pose, avatar space) +12 uint8 x4 joint index * 3 (the palette's float4 row) +16 uint8 x4 weight (sum 255) +20 uint8 x4 normal, (n * 0.5 + 0.5) *  The C type sona_mesh.

| Declaration | What it does |
|---|---|
| `string Item` | The item it came from. The C field sona_mesh.item (text (UTF-8)). |
| `uint Mask` | The item's AssetMask. The C field sona_mesh.mask (bit flags). |
| `uint Batch` | The C field sona_mesh.batch (count). |
| `int Material` | Index into sona_pose_data.materials. The C field sona_mesh.material (index or id). |
| `SonaPass Pass` | The C field sona_mesh.pass (sona_pass value). |
| `int Palette` | -1: the body palette; else an index into props. The C field sona_mesh.palette (index or id). |
| `int VertexCount` | The C field sona_mesh.vertex_count (count). |
| `int IndexCount` | The C field sona_mesh.index_count (count). |
| `uint Key` | Stable while the geometry lives; shared by avatars wearing the same item. The C field sona_mesh.key (index or id). |
| `IntPtr VerticesPtr` | Vertex_count * 76 bytes. The C field sona_mesh.vertices (pointer). |
| `IntPtr IndicesPtr` | Triangle list. The C field sona_mesh.indices (pointer). |
| `ReadOnlySpan<byte> Vertices` | VertexCount * 76 bytes, the runtime vertex of sona.h. |
| `ReadOnlySpan<ushort> Indices` | Triangle list. The C field sona_mesh.indices (pointer). |

### SonaMaterialData

`readonly unsafe struct SonaMaterialData`: Address modes: bit 0 set = U wraps, bit 1 set = V wraps; clear = clamp. The C type sona_material.

| Declaration | What it does |
|---|---|
| `uint ShaderId` | The app's material family, 0..4. The C field sona_material.shader_id (index or id). |
| `SonaMaterialFlags Flags` | SONA_MAT_*. The C field sona_material.flags (bit flags). |
| `float Param(int i)` | One of the material's 40 shader constants (sona_material.params). |
| `float Transparency` | The C field sona_material.transparency (factor (unitless)). |
| `int ColorTex` | Index into sona_pose_data.textures; -1: neutral white. The C field sona_material.color_tex (index or id (-1: neutral white)). |
| `int IntensityTex` | -1: neutral (0,0,0,255). The C field sona_material.intensity_tex (factor (unitless)). |
| `int DecalTex` | -1: neutral (0,0,0,255); the matcap for reflective materials. The C field sona_material.decal_tex (index or id (-1: none)). |
| `int ColorAddr` | The C field sona_material.color_addr (address mode bits (bit 0: U wraps, bit 1: V wraps)). |
| `int IntensityAddr` | The C field sona_material.intensity_addr (address mode bits (bit 0: U wraps, bit 1: V wraps)). |
| `int DecalAddr` | The C field sona_material.decal_addr (address mode bits (bit 0: U wraps, bit 1: V wraps)). |

### SonaTextureData

`readonly unsafe struct SonaTextureData`: The C type sona_texture.

| Declaration | What it does |
|---|---|
| `uint Key` | Stable while the texture lives; use it to cache uploads. The C field sona_texture.key (index or id). |
| `uint Version` | Bumps when the pixels change (the face sheet). The C field sona_texture.version (version number). |
| `SonaTexFormat Format` | The C field sona_texture.format (sona_tex_format value). |
| `int Width` | The C field sona_texture.width (px). |
| `int Height` | The C field sona_texture.height (px). |
| `IntPtr DataPtr` | Width * height * 4 bytes for RGBA8. The C field sona_texture.data (pointer). |
| `int Bytes` | The C field sona_texture.bytes (bytes). |
| `ReadOnlySpan<byte> Data` | Width * height * 4 bytes for RGBA8. The C field sona_texture.data (pointer). |

### SonaPropData

`readonly unsafe struct SonaPropData`: The meshes in the data API's own form (3.11), for hosts that draw props themselves: 76-byte vertices whose joint bytes index sona_prop_frame.palette (a host mesh uses joint 0 only), materials and textures. The C type sona_prop_data.

| Declaration | What it does |
|---|---|
| `string Item` | The id of the item the prop shows (sona_prop_palette.item). |
| `bool Playing` | True while the prop is drawn; false hides its meshes (sona_prop_palette.playing). |
| `IntPtr PalettePtr` | The C type sona_prop_palette. |
| `ReadOnlySpan<float> Palette` | The C type sona_prop_palette. |

### SonaRenderer

`sealed unsafe class SonaRenderer : IDisposable`: The C type sona_renderer.

| Declaration | What it does |
|---|---|
| `ulong FrameIndex` | The index of the last frame recorded (0 before the first).<br>Calls [`sona_renderer_frame_index`](../reference.md#sona_renderer_frame_index). |
| `void FrameDone(ulong completedFrame)` | Vulkan, D3D12 and Metal: every frame up to and including completed_frame has finished on the GPU.<br>Calls [`sona_renderer_frame_done`](../reference.md#sona_renderer_frame_done). |
| `void Lost()` | After a device loss: forget every GPU object.<br>Calls [`sona_renderer_lost`](../reference.md#sona_renderer_lost). |
| `SonaResult Reset(in Native.sona_device_desc device)` | Starts the renderer again on a new device of the same backend, after sona_renderer_lost.<br>Calls [`sona_renderer_reset`](../reference.md#sona_renderer_reset). |
| `SonaResult Draw(in SonaView view, in Native.sona_target target, SonaDrawFlags flags = SonaDrawFlags.None, SonaCorner creditCorner = SonaCorner.BottomRight)` | Returns PENDING (no throw) when frames_in_flight frames are outstanding.<br>Calls [`sona_draw`](../reference.md#sona_draw). |
| `byte[] Snapshot(in SonaView view, uint width, uint height, SonaDrawFlags flags = SonaDrawFlags.None)` | Straight RGBA8, row 0 at the top.<br>Calls [`sona_snapshot`](../reference.md#sona_snapshot). |
| `static Native.sona_quality QualityDefaults()` | The web SDK's defaults: msaa = SONA_MSAA_AUTO, flags = SONA_QUALITY_MIPS \| SONA_QUALITY_CUTOUT_MIPS.<br>Calls [`sona_quality_defaults`](../reference.md#sona_quality_defaults). |
| `bool TryGetStyle(out Native.sona_style style)` | False when this renderer's backend draws no art styles (then style is the defaults).<br>Calls [`sona_renderer_style`](../reference.md#sona_renderer_style). |
| `void SetStyle(in Native.sona_style style)` | The art style of every avatar without its own (with SONA_STYLE_OVERRIDE, of every avatar), from the next draw.<br>Calls [`sona_renderer_set_style`](../reference.md#sona_renderer_set_style). |
| `void ClearStyle()` | The style of every avatar this renderer draws that has none of its own (with SONA_STYLE_OVERRIDE, of every avatar), from the next sona_draw or sona_snapshot.<br>Calls [`sona_renderer_set_style`](../reference.md#sona_renderer_set_style). |
| `void SetQuality()`<br>`void SetQuality(in Native.sona_quality quality)` | The web SDK's: SONA_MSAA_AUTO, Mips \| CutoutMips.<br>Calls [`sona_renderer_set_quality`](../reference.md#sona_renderer_set_quality). |
| `static Native.sona_lighting LightingDefaults()` | sona_lighting_defaults: a key and fill switched off, the built-in environment, a fitted shadow map.<br>Calls [`sona_lighting_defaults`](../reference.md#sona_lighting_defaults). |
| `void SetLighting(in Native.sona_lighting lighting)` | The host's lights from the next draw.<br>Calls [`sona_renderer_set_lighting`](../reference.md#sona_renderer_set_lighting). |
| `void ClearLighting()` | No lighting: the original look again, byte for byte.<br>Calls [`sona_renderer_set_lighting`](../reference.md#sona_renderer_set_lighting). |
| `void SetEnvironmentSh(float[] sh9, float skinRed = 1.2f)` | The lit avatars' environment as 9 RGB spherical harmonics of radiance; null: the built-in cube.<br>Calls [`sona_renderer_set_environment`](../reference.md#sona_renderer_set_environment), [`sona_environment_defaults`](../reference.md#sona_environment_defaults). |
| `void SetHostShadow(in Native.sona_host_shadow shadow)` | The host's own shadow map on the lit avatars from the next draw: its depth texture (u.vk, u.gl, u.d3d11 or u.d3d12) and the matrix from a world point to (u, v, depth, w).<br>Calls [`sona_renderer_set_host_shadow`](../reference.md#sona_renderer_set_host_shadow). |
| `void ClearHostShadow()` | No host map: the lit avatars take only their own.<br>Calls [`sona_renderer_set_host_shadow`](../reference.md#sona_renderer_set_host_shadow). |
| `SonaResult DrawPreview(SonaAvatar preview, in Native.sona_target target, SonaDrawFlags flags = SonaDrawFlags.None, SonaCorner creditCorner = SonaCorner.BottomRight)`<br>`SonaResult DrawPreview(SonaAvatar preview, in SonaView view, in Native.sona_target target, SonaDrawFlags flags = SonaDrawFlags.None, SonaCorner creditCorner = SonaCorner.BottomRight)` | Draws only this preview, framed for the target's size.<br>Calls [`sona_item_preview_draw`](../reference.md#sona_item_preview_draw). |
| `byte[] SnapshotPreview(SonaAvatar preview, uint width, uint height, SonaDrawFlags flags = SonaDrawFlags.None)` | Straight RGBA8 of only this preview, framed by its slot, row 0 at the top.<br>Calls [`sona_item_preview_snapshot`](../reference.md#sona_item_preview_snapshot). |
| `static Native.sona_sticker_options StickerDefaults()` | size set, pixels 512, time -1, framing SONA_PRESET_FULL, outline_px 10, outline 0xffffffff, shadow 0x59000000 (off while shadow_px is 0), padding 8.<br>Calls [`sona_sticker_defaults`](../reference.md#sona_sticker_defaults). |
| `static Native.sona_sheet_options SheetDefaults()` | size set, 8 frames, 8 directions, px_per_metre 64, padding 2, max_page 4096, draw_flags SONA_DRAW_NO_BLOOM; every other field 0 (the whole clip, facing the camera first, side on, orthographic, packed and trim<br>Calls [`sona_sheet_defaults`](../reference.md#sona_sheet_defaults). |
| `SonaPicture Sticker(SonaAvatar avatar, in Native.sona_sticker_options options, string clip = null)` | A transparent, outlined cut-out.<br>Calls [`sona_sticker`](../reference.md#sona_sticker). |
| `SonaSheet RenderSheet(SonaAvatar avatar, in Native.sona_sheet_options options, string clip = null, string name = null, Native.sona_pixel_options? pixel = null)` | A sprite sheet of the clip at frames x directions.<br>Calls [`sona_sheet_render`](../reference.md#sona_sheet_render). |
| `void Dispose()` | Frees the renderer and its GPU objects.<br>Calls [`sona_renderer_destroy`](../reference.md#sona_renderer_destroy). |

### SonaPicture

`sealed class SonaPicture`: A straight RGBA8 picture, row 0 at the top.

| Declaration | What it does |
|---|---|
| `byte[] Rgba` | Straight RGBA8, row 0 at the top; free with sona_free unless a call says otherwise. The C field sona_picture.rgba (pointer). |
| `uint Width` | The C field sona_picture.width (px). |
| `uint Height` | The C field sona_picture.height (px). |

### SonaSheet

`sealed unsafe class SonaSheet : IDisposable`: A rendered sprite sheet: pages, frames and their atlases.

| Declaration | What it does |
|---|---|
| `uint PageCount` | The number of pages; 0 for NULL.<br>Calls [`sona_sheet_page_count`](../reference.md#sona_sheet_page_count). |
| `uint FrameCount` | frames * directions; 0 for NULL.<br>Calls [`sona_sheet_frame_count`](../reference.md#sona_sheet_frame_count). |
| `SonaPicture Page(uint page)` | A copy of one page's pixels.<br>Calls [`sona_sheet_page`](../reference.md#sona_sheet_page). |
| `Native.sona_sheet_frame Frame(uint index)` | One frame (index = direction * frames + frame): its page and rectangle, where the rectangle sits in the full cell (trim_x, trim_y), the cell's size, the pivot (the avatar's feet) in the cell, its direction, facing, t<br>Calls [`sona_sheet_frame_get`](../reference.md#sona_sheet_frame_get). |
| `string Atlas(uint format, uint page, string image)` | The atlas JSON: Native.SONA_ATLAS_ASEPRITE or _TEXTUREPACKER, one page (or SONA_ATLAS_ALL_PAGES with TexturePacker); image names the page file ("{n}" becomes the page number).<br>Calls [`sona_sheet_atlas`](../reference.md#sona_sheet_atlas), [`sona_free`](../reference.md#sona_free). |
| `void Dispose()` | Frees the sheet, its pages and frames.<br>Calls [`sona_sheet_free`](../reference.md#sona_sheet_free). |

### SonaItem

`sealed class SonaItem`: One catalogue item: its id, name, slot and flags (sona_item_info).

| Declaration | What it does |
|---|---|
| `Native.sona_guid Guid` | The C field sona_item_info.guid (a sona_guid (see its fields)). |
| `string Id` | Lowercase text form. The C field sona_item_info.id (text (UTF-8)). |
| `SonaItemKind Kind` | SONA_ITEM_KIND_*. The C field sona_item_info.kind (one of the SONA_ values named). |
| `int Gender` | 1 male, 2 female, 3 both, 0 not stated. The C field sona_item_info.gender (one of the values named in the header). |
| `SonaSection Section` | Sona_section. The C field sona_item_info.section (sona_section value). |
| `uint Mask` | AssetMask: the slot bits. The C field sona_item_info.mask (bit flags). |
| `SonaItemFlags Flags` | SONA_ITEM_*. The C field sona_item_info.flags (bit flags). |
| `SonaRoute Route` | Where sona_manifest_wear puts it, as sona_slot_of. The C field sona_item_info.route (sona_route value). |
| `uint ColourSet` | The palette it tints from; 0 when not SONA_ITEM_COLOURABLE. The C field sona_item_info.colour_set (one of the SONA_ values named). |
| `string Name` | The C field sona_item_info.name (text (UTF-8), NULL: none). |
| `string Game` | The game or source it comes from. The C field sona_item_info.game (text (UTF-8), NULL: none). |
| `string Type` | "Shirt/Hoodie". The C field sona_item_info.type (text (UTF-8), NULL: none). |
| `string Family` | "Shirt". The C field sona_item_info.family (text (UTF-8), NULL: none). |
| `string Description` | How an award is earned. The C field sona_item_info.description (text (UTF-8), NULL: none). |
| `int Subcategory` | The type as a number; 0 when none. The C field sona_item_info.subcategory (one of the values named in the header). |
| `int ColourChoices` | Colourways in its own colour table; 0 when not stated. The C field sona_item_info.colour_choices (count). |
| `int TextureType` | 255 when not stated. The C field sona_item_info.texture_type (one of the values named in the header). |
| `int ShapeType` | 255 when not stated. The C field sona_item_info.shape_type (one of the values named in the header). |

### SonaCatalogueQuery

`sealed class SonaCatalogueQuery`: The C type sona_catalogue_query.

| Declaration | What it does |
|---|---|
| `string Text` | words that must all be in the name, game or type (ASCII case folded); "in quotes" matches the whole name. The C field sona_catalogue_query.text (text (UTF-8), NULL: none). |
| `string Game` | That game only (ASCII case folded); NULL: any. The C field sona_catalogue_query.game (text (UTF-8), NULL: none). |
| `uint Slots` | AssetMask bits: items with any of them; 0: any. The C field sona_catalogue_query.slots (bit flags). |
| `SonaSection Section` | Sona_section; 0: any. The C field sona_catalogue_query.section (one of the values named in the header). |
| `uint Gender` | 1 or 2: what the editor offers that body; 0: any. The C field sona_catalogue_query.gender (one of the values named in the header). |
| `SonaItemFlags Require` | SONA_ITEM_* that must all be set. The C field sona_catalogue_query.require (one of the SONA_ values named). |
| `SonaItemFlags Exclude` | SONA_ITEM_* that must all be clear. The C field sona_catalogue_query.exclude (one of the SONA_ values named). |
| `uint Offset` | Skip this many matches, for paging. The C field sona_catalogue_query.offset (m (world units)). |

### SonaCatalogue

`sealed unsafe class SonaCatalogue : IDisposable`: sona-catalogue.bin: every item id with its name, slots, game and source.

| Declaration | What it does |
|---|---|
| `static SonaCatalogue Load(string path, SonaContext ctx = null)` | ctx may be null: then malloc is used and an error carries only its code.<br>Calls [`sona_catalogue_load`](../reference.md#sona_catalogue_load). |
| `static SonaCatalogue LoadMemory(byte[] bytes, SonaContext ctx = null)` | The same from bytes in memory.<br>Calls [`sona_catalogue_load_memory`](../reference.md#sona_catalogue_load_memory). |
| `IntPtr Handle` | The native handle this object owns, for a call the binding does not wrap. |
| `bool IsDisposed` | True once Dispose has run; every other call then throws. |
| `int Count` | Items, sorted by id.<br>Calls [`sona_catalogue_count`](../reference.md#sona_catalogue_count). |
| `string Generated` | When its data was made, ISO 8601.<br>Calls [`sona_catalogue_generated`](../reference.md#sona_catalogue_generated). |
| `SonaItem Get(int index)` | One item.<br>Calls [`sona_catalogue_get`](../reference.md#sona_catalogue_get). |
| `int Find(string id)`<br>`int Find(in Native.sona_guid id)` | 32 hex digits, with or without dashes, braces or spaces, any case.<br>Calls [`sona_catalogue_find`](../reference.md#sona_catalogue_find), [`sona_catalogue_find_guid`](../reference.md#sona_catalogue_find_guid). |
| `int[] Search(SonaCatalogueQuery query, int max, out int total)`<br>`int[] Search(SonaCatalogueQuery query, int max = int.MaxValue)` | Matching indexes in id order, up to max, after query.Offset; total is every match.<br>Calls [`sona_catalogue_search`](../reference.md#sona_catalogue_search). |
| `int GameCount` | The games items come from, sorted by name.<br>Calls [`sona_catalogue_game_count`](../reference.md#sona_catalogue_game_count). |
| `string Game(int index, out int items)` | One game, sorted by name, and its item count.<br>Calls [`sona_catalogue_game`](../reference.md#sona_catalogue_game). |
| `static string SectionName(SonaSection section)` | "shirt", "facialHair",...; null past the last section.<br>Calls [`sona_catalogue_section_name`](../reference.md#sona_catalogue_section_name). |
| `void Dispose()` | Frees it and every string it handed out.<br>Calls [`sona_catalogue_free`](../reference.md#sona_catalogue_free). |

### SonaFilterChange

`sealed class SonaFilterChange`: The C type sona_filter_change.

| Declaration | What it does |
|---|---|
| `Native.sona_guid From` | The denied item. The C field sona_filter_change.from (a sona_guid (see its fields)). |
| `Native.sona_guid To` | What took its place (zero when HIDDEN, or for the head's own shape). The C field sona_filter_change.to (a sona_guid (see its fields)). |
| `bool Replaced` | True when the item was swapped for another; false when it was hidden. |
| `uint Reason` | SONA_CONTENT_BY_*. The C field sona_filter_change.reason (one of the SONA_ values named). |
| `string Tag` | As sona_filter_verdict.tag. The C field sona_filter_change.tag (index or id (-1: none)). |
| `SonaSection Section` | The denied item's. The C field sona_filter_change.section (one of the values named in the header). |

### SonaFilter

`sealed unsafe class SonaFilter : IDisposable`: Which items a game allows: by section, slot, game, tag, source or id.

| Declaration | What it does |
|---|---|
| `static SonaFilter Create(SonaCatalogue cat, SonaContext ctx = null)` | cat may be null: then only id, slot, section and source rules can match.<br>Calls [`sona_filter_create`](../reference.md#sona_filter_create). |
| `IntPtr Handle` | The native handle this object owns, for a call the binding does not wrap. |
| `int AllowedCount` | Catalogue items allowed.<br>Calls [`sona_filter_allowed_count`](../reference.md#sona_filter_allowed_count). |
| `void Reset()` | Every rule goes; tags stay.<br>Calls [`sona_filter_reset`](../reference.md#sona_filter_reset). |
| `void Preset(SonaContentPreset preset)` | Adds a preset's rules (SONA_FILTER_PRESET_*).<br>Calls [`sona_filter_preset`](../reference.md#sona_filter_preset). |
| `void Sections(bool allow, uint sectionBits)` | Adds a rule on sections: bits (1u << sona_section).<br>Calls [`sona_filter_sections`](../reference.md#sona_filter_sections). |
| `void Slots(bool allow, uint slots)` | Adds a rule on slots (AssetMask bits): an item matches when it covers any of them.<br>Calls [`sona_filter_slots`](../reference.md#sona_filter_slots). |
| `void Sources(bool allow, uint sources)` | Adds a rule on where items come from (SONA_CONTENT_STOCK and the other source bits).<br>Calls [`sona_filter_sources`](../reference.md#sona_filter_sources). |
| `void Game(bool allow, string game)` | A game as sona_catalogue_game names it (ASCII case folded).<br>Calls [`sona_filter_game`](../reference.md#sona_filter_game). |
| `void Tag(bool allow, string tag)` | A tag by name ("weapon", "logo", or one the host defined).<br>Calls [`sona_filter_tag`](../reference.md#sona_filter_tag). |
| `void Item(bool allow, Native.sona_guid id)` | Adds a rule on one item by id.<br>Calls [`sona_filter_item`](../reference.md#sona_filter_item). |
| `void Load(string json)` | Rules from JSON ([Content filters](../guides/filters.md)); all or nothing.<br>Calls [`sona_filter_load`](../reference.md#sona_filter_load). |
| `int TagCount` | How many tags the filter knows, built-in and host-defined.<br>Calls [`sona_filter_tag_count`](../reference.md#sona_filter_tag_count). |
| `string TagName(int tag)` | NULL past the last.<br>Calls [`sona_filter_tag_name`](../reference.md#sona_filter_tag_name). |
| `int TagItems(int tag)` | How many catalogue items carry a tag.<br>Calls [`sona_filter_tag_items`](../reference.md#sona_filter_tag_items). |
| `int TagFind(string name)` | -1 when unknown.<br>Calls [`sona_filter_tag_find`](../reference.md#sona_filter_tag_find). |
| `int TagDefine(string name)` | A new tag (a name of 1 to 31 bytes of a-z, 0-9 and '-'), or the index of the one of that name.<br>Calls [`sona_filter_tag_define`](../reference.md#sona_filter_tag_define). |
| `void TagSet(Native.sona_guid id, int tag, bool on)` | Puts a tag on an item (on 1) or takes it off (0), for ids in the catalogue or not.<br>Calls [`sona_filter_tag_set`](../reference.md#sona_filter_tag_set). |
| `ulong ItemTags(Native.sona_guid id)` | The bits of an item's tags (bit n is tag n).<br>Calls [`sona_filter_item_tags`](../reference.md#sona_filter_item_tags). |
| `bool Allows(Native.sona_guid id)` | 1 when the item is allowed; a NULL filter allows everything.<br>Calls [`sona_filter_allows`](../reference.md#sona_filter_allows). |
| `Native.sona_filter_verdict Check(Native.sona_guid id)` | Whether the item is allowed, and if not, which rule denied it (SONA_CONTENT_BY_*) and the item's tags.<br>Calls [`sona_filter_check`](../reference.md#sona_filter_check). |
| `int[] Search(SonaCatalogue cat, SonaSection section, int max, out int total)` | sona_catalogue_search, allowed items only.<br>Calls [`sona_filter_search`](../reference.md#sona_filter_search). |
| `List<SonaFilterChange> FilterManifest(byte[] manifest)` | The 1000 manifest bytes through the filter, in place; the changes it made.<br>Calls [`sona_filter_manifest_bytes`](../reference.md#sona_filter_manifest_bytes). |
| `static void SetOn(SonaContext ctx, SonaFilter f)` | Gives ctx a copy: every avatar it reads from then on goes through it.<br>Calls [`sona_ctx_set_filter`](../reference.md#sona_ctx_set_filter). |
| `static List<SonaFilterChange> ReportOf(SonaAvatar a)` | What the ctx's filter changed on an avatar; null before its manifest is read or with no filter then.<br>Calls [`sona_avatar_filter_report`](../reference.md#sona_avatar_filter_report). |
| `void Dispose()` | Frees the filter.<br>Calls [`sona_filter_free`](../reference.md#sona_filter_free). |

### SonaCamera

`static unsafe class SonaCamera`: Camera helpers: the preset views of an avatar (full, upper, bust, face), an orbit and a crowd fit (sona_camera_preset, sona_camera_orbit, sona_camera_fit_crowd).

| Declaration | What it does |
|---|---|
| `static SonaView Orbit(SonaView view, double tx, double ty, double tz, double yawDeg, double pitchDeg, double distance)` | Places the eye on an orbit around target.<br>Calls [`sona_camera_orbit`](../reference.md#sona_camera_orbit). |
| `static void ViewMatrices(in SonaView view, float[] viewM, float[] projM)` | Row-vector view and projection (D3D depth 0..1), 16 floats each.<br>Calls [`sona_view_matrices`](../reference.md#sona_view_matrices). |
| `static byte[] ShaderSource(SonaShaderLang lang, SonaProgram program, int stage)` | Text, or SPIR-V bytes; null when that language is not in this build.<br>Calls [`sona_shader_source`](../reference.md#sona_shader_source). |

### SonaStockClip

`sealed class SonaStockClip`: The C type sona_stock_clip.

| Declaration | What it does |
|---|---|
| `uint Id` | SONA_STOCK_*. The C field sona_stock_clip.id (one of the SONA_ values named). |
| `string Name` | "wave", "laugh_female": unique, lower case. The C field sona_stock_clip.name (text (UTF-8), NULL: none). |
| `string Family` | "laugh": one action across its body variants and copies. The C field sona_stock_clip.family (text (UTF-8), NULL: none). |
| `string AssetId` | "00400000-0007-0003-c1c8-f109a19cb2e0", for sona_avatar_play. The C field sona_stock_clip.asset_id (text (UTF-8), NULL: none). |
| `string Caption` | A short description. The C field sona_stock_clip.caption (text (UTF-8), NULL: none). |
| `SonaClipTags Tags` | SONA_CLIP_TAG_*. The C field sona_stock_clip.tags (one of the SONA_ values named). |
| `int Body` | 1 male, 2 female, 3 both. The C field sona_stock_clip.body (one of the values named in the header). |
| `uint Frames` | The C field sona_stock_clip.frames (count). |
| `float Fps` | The C field sona_stock_clip.fps (frames per second). |
| `float Seconds` | Frames / fps. The C field sona_stock_clip.seconds (s). |
| `uint SameAs` | The clip this one copies (SONA_CLIP_TAG_COPY), else 0. The C field sona_stock_clip.same_as (one of the SONA_ values named). |
| `override string ToString()` | A readable line for logs. |

### SonaIdleOptions

`sealed class SonaIdleOptions`: The C type sona_idle_options.

| Declaration | What it does |
|---|---|
| `SonaIdleParts Parts = SonaIdleParts.All` | SONA_IDLE_*; default SONA_IDLE_ALL. The C field sona_idle_options.parts (one of the SONA_ values named). |
| `uint Seed` | 0: from the ctx seed and the avatar id. The C field sona_idle_options.seed (index or id). |
| `float Amount = 1` | Scales every motion, 0 to 2; default 1. The C field sona_idle_options.amount (factor (unitless)). |
| `float FacePx = 240` | Default 240. The C field sona_idle_options.face_px (px). |

### SonaIdleState

`struct SonaIdleState`: The C type sona_idle_state.

| Declaration | What it does |
|---|---|
| `float Blink` | 0 open to 1 shut. The C field sona_idle_state.blink (factor (unitless)). |
| `float GazeLeft` | Where the idle's glance looks, in degrees to the avatar's left (sona_idle_state.gaze[0]). |
| `float GazeUp` | Where the idle's glance looks, in degrees up (sona_idle_state.gaze[1]). |
| `float Shift` | -1 the weight on the left foot to 1 on the right. The C field sona_idle_state.shift (factor (unitless)). |
| `float Breath` | 0 breathed out to 1 in. The C field sona_idle_state.breath (factor (unitless)). |

### SonaClips

`static unsafe class SonaClips`: The stock clips: lists and looks them up (sona_stock_clip_count, sona_stock_clip_at, sona_stock_clip_find, sona_stock_clips_tagged).

| Declaration | What it does |
|---|---|
| `static int Count` | The clips in the library: 100 (SONA_STOCK_CLIP_COUNT).<br>Calls [`sona_stock_clip_count`](../reference.md#sona_stock_clip_count). |
| `static SonaStockClip At(int index)` | The clip at index, in id order.<br>Calls [`sona_stock_clip_at`](../reference.md#sona_stock_clip_at). |
| `static SonaStockClip Get(uint id)` | The clip with this id (SONA_STOCK_*: bytes 4 to 7 of its asset id).<br>Calls [`sona_stock_clip_get`](../reference.md#sona_stock_clip_get). |
| `static uint Find(string name)` | By name ("wave"), asset id or a legacy key ("GenericWave"); 0 when none.<br>Calls [`sona_stock_clip_find`](../reference.md#sona_stock_clip_find). |
| `static uint ForBody(uint id, int body)` | The clip of id's family made for body (1 male, 2 female): its own variant, else one for both, else id itself.<br>Calls [`sona_stock_clip_for_body`](../reference.md#sona_stock_clip_for_body). |
| `static List<SonaStockClip> Tagged(SonaClipTags all = SonaClipTags.None, SonaClipTags without = SonaClipTags.None, int body = 0)` | Every clip with all of the tags and none of without that suits body (0 any, 1 male, 2 female), by id.<br>Calls [`sona_stock_clips_tagged`](../reference.md#sona_stock_clips_tagged). |
| `static string TagName(SonaClipTags tag)` | The name of one tag bit ("idle", "travel",...); NULL for 0, several bits or an unknown bit.<br>Calls [`sona_clip_tag_name`](../reference.md#sona_clip_tag_name). |
| `static SonaClipTags TagFind(string name)` | The bit for a tag name; 0 when none.<br>Calls [`sona_clip_tag_find`](../reference.md#sona_clip_tag_find). |
| `static SonaIdleOptions IdleDefaults()` | size set, parts SONA_IDLE_ALL, seed 0, amount 1, face_px 240.<br>Calls [`sona_idle_defaults`](../reference.md#sona_idle_defaults). |
| `static SonaIdleState IdleSample(double seconds, uint seed, SonaIdleParts parts = SonaIdleParts.All)` | The idle's channels at seconds for a seed and parts, before amount.<br>Calls [`sona_idle_sample`](../reference.md#sona_idle_sample). |

### SonaManifests

`static unsafe class SonaManifests`: Manifest helpers: parse and write, wear and take off, colours, gender and shape (sona_manifest_parse, sona_manifest_write, sona_manifest_wear and the rest).

| Declaration | What it does |
|---|---|
| `static Native.sona_manifest Parse(byte[] bytes)` | Reads 1000 bytes into a sona_manifest.<br>Calls [`sona_manifest_parse`](../reference.md#sona_manifest_parse). |
| `static byte[] Write(in Native.sona_manifest m)` | Byte-exact: Write(Parse(x)) equals x.<br>Calls [`sona_manifest_write`](../reference.md#sona_manifest_write). |
| `static byte[] Base64Decode(string text)` | The bytes the base64 text holds.<br>Calls [`sona_base64_decode`](../reference.md#sona_base64_decode). |
| `static Native.sona_guid ParseGuid(string text)` | Parses the 36-character text form.<br>Calls [`sona_guid_parse`](../reference.md#sona_guid_parse). |
| `static string FormatGuid(in Native.sona_guid id)` | The id in its lowercase 36-character form.<br>Calls [`sona_guid_format`](../reference.md#sona_guid_format). |
| `static SonaRoute SlotOf(in Native.sona_guid id, out uint mask)` | Where an item id goes, and its slot mask in mask.<br>Calls [`sona_slot_of`](../reference.md#sona_slot_of). |
| `static SonaResult Wear(ref Native.sona_manifest m, in Native.sona_guid item, uint primary, uint secondary, uint tertiary, SonaEditFlags flags = SonaEditFlags.None)` | Edit verbs: each changes m in place, or returns ARGUMENT with m unchanged where the JS fails.<br>Calls [`sona_manifest_wear`](../reference.md#sona_manifest_wear). |
| `static SonaResult Unwear(ref Native.sona_manifest m, uint slotMask, SonaEditFlags flags = SonaEditFlags.None)` | Takes off what is in the slots of slot_mask.<br>Calls [`sona_manifest_unwear`](../reference.md#sona_manifest_unwear). |
| `static SonaResult UndressAll(ref Native.sona_manifest m)` | Takes everything off.<br>Calls [`sona_manifest_undress_all`](../reference.md#sona_manifest_undress_all). |
| `static SonaResult SetColour(ref Native.sona_manifest m, uint colourSlot, uint argb)` | Sets one of the nine body colours, by its index in colours.<br>Calls [`sona_manifest_set_colour`](../reference.md#sona_manifest_set_colour). |
| `static SonaResult SetGender(ref Native.sona_manifest m, uint gender, SonaEditFlags flags = SonaEditFlags.None)` | Sets the gender: 1 male, 2 female.<br>Calls [`sona_manifest_set_gender`](../reference.md#sona_manifest_set_gender). |
| `static SonaResult SetShape(ref Native.sona_manifest m, float weight, float height)` | Sets the weight and height.<br>Calls [`sona_manifest_set_shape`](../reference.md#sona_manifest_set_shape). |
| `static bool ReadyForXbox(in Native.sona_manifest m)` | 1 when the body (and so the gender) is known and the editor's Xbox clean-up would change nothing: the manifest can be saved to Xbox as it is.<br>Calls [`sona_manifest_ready_for_xbox`](../reference.md#sona_manifest_ready_for_xbox). |

### SonaLayerOptions

`sealed class SonaLayerOptions`: The C type sona_layer_options.

| Declaration | What it does |
|---|---|
| `SonaLayerMode Mode = SonaLayerMode.Override` | SONA_LAYER_OVERRIDE (default) or SONA_LAYER_ADDITIVE. The C field sona_layer_options.mode (one of the SONA_ values named). |
| `bool OneShot` | A clip that does not loop fades the layer out by its end, then stops it. |
| `bool Loop = true` | Default 1; for a machine, its states say. The C field sona_layer_options.loop (flag (0 or 1)). |
| `float Weight = 1` | 0..1; default 1. The C field sona_layer_options.weight (factor (unitless)). |
| `float FadeSeconds = 0.2f` | From what the layer showed before (or from nothing); default 0.2; 0: a cut. The C field sona_layer_options.fade_seconds (s). |
| `float Speed = 1` | Default 1. The C field sona_layer_options.speed (factor (1: as made)). |
| `float From` | Seconds into a clip, or 0..1 through a blend space's cycle; default 0. The C field sona_layer_options.from (s). |
| `float AdditiveRef` | ADDITIVE: seconds into each clip of the frame it is measured from; default 0. The C field sona_layer_options.additive_ref (s). |
| `float[] Mask` | SONA_JOINT_COUNT weights 0..1, copied; NULL keeps the layer's mask (every joint at first). The C field sona_layer_options.mask (pointer). |

### SonaLayerInfo

`struct SonaLayerInfo`: The C type sona_layer_info.

| Declaration | What it does |
|---|---|
| `SonaLayerKind Kind` | SONA_LAYER_EMPTY, _CLIP, _BLEND, _MACHINE. The C field sona_layer_info.kind (one of the SONA_ values named). |
| `SonaLayerMode Mode` | The C field sona_layer_info.mode (count). |
| `int State` | MACHINE: the current state; else -1. The C field sona_layer_info.state (one of the values named in the header). |
| `int Clip` | CLIP: the sona_clip_get index, -1 for a raw id. The C field sona_layer_info.clip (count). |
| `float Weight` | The layer's weight now, fades included. The C field sona_layer_info.weight (factor (unitless)). |
| `float Time` | Seconds into the clip; BLEND and MACHINE: into the current motion's leading clip. The C field sona_layer_info.time (s). |
| `float Normalized` | 0..1 through the clip or cycle. The C field sona_layer_info.normalized (factor (unitless)). |
| `bool Ready` | 1 once every clip it plays has loaded; until then it shows nothing. The C field sona_layer_info.ready (flag (0 or 1)). |
| `bool Fading` | 1 while it crossfades (a new clip, a transition). The C field sona_layer_info.fading (flag (0 or 1)). |

### SonaLayerEvent

`struct SonaLayerEvent`: The C type sona_layer_event.

| Declaration | What it does |
|---|---|
| `SonaLayerEventKind Kind` | The C field sona_layer_event.kind (one of the values named in the header). |
| `int Layer` | The C field sona_layer_event.layer (index or id). |
| `int State` | The C field sona_layer_event.state (one of the values named in the header). |
| `int FromState` | The C field sona_layer_event.from_state (one of the values named in the header). |
| `float Time` | The C field sona_layer_event.time (s). |

### SonaBlendSample

`struct SonaBlendSample`: The C type sona_blend_sample.

| Declaration | What it does |
|---|---|
| `string Clip` | A clip key or raw clip id. The C field sona_blend_sample.clip (text (UTF-8), NULL: none). |
| `float X` | Where it sits (y: 2D only). The C field sona_blend_sample.x (the blend space's own axis units (the parameter the host drives)). |
| `float Y` | Where it sits (y: 2D only). The C field sona_blend_sample.y (the blend space's own axis units (the parameter the host drives)). |
| `float Speed` | Its playback rate; 0: 1. The C field sona_blend_sample.speed (factor (1: as made)). |
| `SonaBlendSample(string clip, float x, float y = 0, float speed = 1)` | The C type sona_blend_sample. |

### SonaState

`sealed class SonaState`: The C type sona_state_desc.

| Declaration | What it does |
|---|---|
| `string Name` | Unique in the machine, at most 31 bytes. The C field sona_state_desc.name (text (UTF-8), NULL: none). |
| `string Clip` | A clip key or raw clip id; or NULL with blend. The C field sona_state_desc.clip (text (UTF-8), NULL: none). |
| `SonaBlendSpace Blend` | The C field sona_state_desc.blend (pointer to sona_blend_space). |
| `bool Loop = true` | 1 loops; 0 holds the last frame. The C field sona_state_desc.loop (flag (0 or 1)). |
| `float Speed = 1` | 0: 1. The C field sona_state_desc.speed (factor (1: as made)). |

### SonaConditionSpec

`struct SonaConditionSpec`: The C type sona_condition.

| Declaration | What it does |
|---|---|
| `string Param` | The C field sona_condition.param (text (UTF-8), NULL: none). |
| `SonaCondition Op` | The C field sona_condition.op (one of the values named in the header). |
| `float Value` | The C field sona_condition.value (the parameter's own units). |
| `SonaConditionSpec(string param, SonaCondition op, float value = 0)` | The C type sona_condition. |

### SonaTransition

`sealed class SonaTransition`: The C type sona_transition_desc.

| Declaration | What it does |
|---|---|
| `string From` | A state name, or NULL for any state but to. The C field sona_transition_desc.from (text (UTF-8), NULL: none). |
| `string To` | The C field sona_transition_desc.to (text (UTF-8), NULL: none). |
| `float FadeSeconds = 0.2f` | The C field sona_transition_desc.fade_seconds (s). |
| `float ExitTime = -1` | Negative: whenever; else not before the state is this far (0..1) through its cycle. The C field sona_transition_desc.exit_time (s). |
| `SonaConditionSpec[] Conditions` | The C field sona_transition_desc.conditions (a sona_condition (see its fields)). |

### SonaPropMesh

`sealed unsafe class SonaPropMesh : IDisposable`: A prop mesh of one context.

| Declaration | What it does |
|---|---|
| `SonaResult State` | Ok, Pending, or why it failed.<br>Calls [`sona_prop_mesh_state`](../reference.md#sona_prop_mesh_state). |
| `Native.sona_prop_mesh_info Info()` | SONA_PENDING (only kind and item set) until the mesh is ready.<br>Calls [`sona_prop_mesh_info_get`](../reference.md#sona_prop_mesh_info_get). |
| `Native.sona_prop_data Data()` | The meshes in the data API's form, valid while the mesh lives.<br>Calls [`sona_prop_mesh_data`](../reference.md#sona_prop_mesh_data). |
| `void Dispose()` | The host's reference goes; avatars it is attached to keep it until they detach it.<br>Calls [`sona_prop_mesh_release`](../reference.md#sona_prop_mesh_release). |

### SonaBlendSpace

`sealed unsafe class SonaBlendSpace : IDisposable`: A blend space of one context.

| Declaration | What it does |
|---|---|
| `float[] Weights(float x, float y = 0)` | Each sample's weight at (x, y).<br>Calls [`sona_blend_space_weights`](../reference.md#sona_blend_space_weights). |
| `void Dispose()` | Lets go of the host's handle.<br>Calls [`sona_blend_space_destroy`](../reference.md#sona_blend_space_destroy). |

### SonaStateMachine

`sealed unsafe class SonaStateMachine : IDisposable`: A state machine of one context.

| Declaration | What it does |
|---|---|
| `int Find(string state)` | A state's index by name; -1 if unknown.<br>Calls [`sona_state_machine_find`](../reference.md#sona_state_machine_find). |
| `string StateName(int state)` | A state's name, NULL past the last.<br>Calls [`sona_state_machine_state_name`](../reference.md#sona_state_machine_state_name). |
| `void Dispose()` | As sona_blend_space_destroy.<br>Calls [`sona_state_machine_destroy`](../reference.md#sona_state_machine_destroy). |

### SonaMasks

`static unsafe class SonaMasks`: The joint masks layers play on: the presets (upper body, arms, head and the rest) and a branch from a joint (sona_mask_preset, sona_mask_branch).

| Declaration | What it does |
|---|---|
| `static float[] Preset(SonaMask preset)` | Fills a mask: SONA_MASK_NONE, _FULL, _UPPER_BODY (Spine and below it), _LOWER_BODY (the hips and legs), _HEAD (from the Neck), _LEFT_ARM, _RIGHT_ARM, _ARMS (from the shoulders).<br>Calls [`sona_mask_preset`](../reference.md#sona_mask_preset). |
| `static void Branch(float[] mask, int joint, float weight)` | Sets joint and every joint below it to weight.<br>Calls [`sona_mask_branch`](../reference.md#sona_mask_branch). |

### SonaLipSync

`sealed unsafe class SonaLipSync : IDisposable`: Audio in, mouths out: PCM in any chunks, a frame every 10 ms.

| Declaration | What it does |
|---|---|
| `SonaLipSync(int sampleRate, int channels = 1)` | NULL options: the defaults.<br>Calls [`sona_lipsync_defaults`](../reference.md#sona_lipsync_defaults), [`sona_lipsync_create`](../reference.md#sona_lipsync_create). |
| `void Feed(float[] pcm, int frames = -1)` | Interleaved floats, -1..1; length is a whole number of frames.<br>Calls [`sona_lipsync_feed`](../reference.md#sona_lipsync_feed). |
| `byte Mouth(out float open)` | The newest mouth and how open it is.<br>Calls [`sona_lipsync_current`](../reference.md#sona_lipsync_current). |
| `Native.sona_lipsync_frame[] Read()` | The frames made since the last call, oldest first (the newest SONA_LIPSYNC_QUEUE are kept).<br>Calls [`sona_lipsync_read`](../reference.md#sona_lipsync_read). |
| `double Latency` | Seconds from a sample being fed to the first frame that hears it.<br>Calls [`sona_lipsync_latency`](../reference.md#sona_lipsync_latency). |
| `void Reset()` | Back to time 0: hints and frames waiting to be read are dropped.<br>Calls [`sona_lipsync_reset`](../reference.md#sona_lipsync_reset). |
| `void Hint(string symbol, float start, float end)` | Phonemes the host's TTS reported, on the fed audio's clock.<br>Calls [`sona_lipsync_hint`](../reference.md#sona_lipsync_hint). |
| `static byte PhonemeMouth(string symbol)` | The mouth for a phoneme symbol (ARPAbet, IPA, viseme names or ids); 255 when unknown.<br>Calls [`sona_phoneme_mouth`](../reference.md#sona_phoneme_mouth). |
| `static SonaMouthKey[] FromText(string text, float[] pcm = null, int sampleRate = 48000)` | Text to mouth keys; with audio (mono floats at sampleRate) aligned to it, else at an even pace.<br>Calls [`sona_lipsync_defaults`](../reference.md#sona_lipsync_defaults), [`sona_lipsync_text`](../reference.md#sona_lipsync_text). |
| `static byte Sample(SonaMouthKey[] keys, double t, out float open)` | The mouth at time t of a key list.<br>Calls [`sona_mouth_keys_sample`](../reference.md#sona_mouth_keys_sample). |
| `static Native.sona_voice_mouth VoiceState(uint seed)` | A fresh voice-chat state for one speaker (sona_voice_mouth_init).<br>Calls [`sona_voice_mouth_init`](../reference.md#sona_voice_mouth_init). |
| `void Dispose()` | Frees the analyser.<br>Calls [`sona_lipsync_destroy`](../reference.md#sona_lipsync_destroy). |

### SonaRenderOptions

`sealed class SonaRenderOptions`: What one headless picture looks like.

| Declaration | What it does |
|---|---|
| `uint Width = Width` | Pixels, 1 to 8192; default 256 x 256. The C field sona_render_options.width (px). |
| `SonaPreset Preset = SonaPreset.Full` | The framing; default SONA_PRESET_FULL. The C field sona_render_options.preset (sona_preset value). |
| `float YawDeg` | The camera moved around the preset's target; default 0, 0. The C field sona_render_options.yaw_deg (degrees). |
| `float PitchDeg` | The camera moved around the preset's target; default 0, 0. The C field sona_render_options.pitch_deg (degrees). |
| `float Zoom` | The preset's distance divided by this; default 1. The C field sona_render_options.zoom (factor (unitless)). |
| `float[] Clear` | The background, premultiplied RGBA from 0 to 1 (sona_render_options.clear). |
| `SonaDrawFlags Flags` | 0. The C field sona_render_options.flags (bit flags). |
| `string Clip` | A clip key or id; NULL: an avatar the headless call adds stands still (Stand0), one of yours keeps its own clip and time. The C field sona_render_options.clip (text (UTF-8), NULL: none). |

### SonaHeadlessDevice

`sealed class SonaHeadlessDevice`: The C type sona_headless_info.

| Declaration | What it does |
|---|---|
| `SonaBackend Backend` | The C field sona_headless_info.backend (sona_backend value). |
| `bool Software` | 1: a CPU rasteriser. The C field sona_headless_info.software (flag (0 or 1)). |
| `uint Type` | Vulkan: VkPhysicalDeviceType (1 integrated, 2 discrete, 3 virtual, 4 CPU); GL: 0. The C field sona_headless_info.type (count). |
| `uint VendorId` | The C field sona_headless_info.vendor_id (index or id). |
| `uint DeviceId` | The C field sona_headless_info.device_id (index or id). |
| `string Name` | "Intel(R) Arc(tm) Graphics (MTL)", "llvmpipe (LLVM 19.1.7, 256 bits)". The C field sona_headless_info.name (text (UTF-8)). |
| `string Driver` | The API and driver versions. The C field sona_headless_info.driver (text (UTF-8)). |

### SonaHeadless

`sealed unsafe class SonaHeadless : IDisposable`: A renderer on the library's own device (the best GPU, or lavapipe or llvmpipe): no window, no display.

| Declaration | What it does |
|---|---|
| `SonaHeadless(SonaContext ctx, SonaDeviceKind device = SonaDeviceKind.Auto, SonaBackend backend = 0, int adapter = -1, uint batchInFlight = 8, float waitSeconds = 60)` | Makes the device and a renderer on it, waiting up to wait_seconds for the ctx's shading data.<br>Calls [`sona_headless_open`](../reference.md#sona_headless_open). |
| `static List<SonaHeadlessDevice> Devices(SonaBackend backend = 0)` | Every device a headless renderer can open: Vulkan devices, then EGL devices.<br>Calls [`sona_headless_devices`](../reference.md#sona_headless_devices). |
| `SonaRenderer Renderer` | The device's renderer, for its lighting, environment, shadow maps, style and quality.<br>Calls [`sona_headless_renderer`](../reference.md#sona_headless_renderer). |
| `void Dispose()` | Frees the renderer and the device.<br>Calls [`sona_headless_close`](../reference.md#sona_headless_close). |
| `byte[] Render(SonaAvatar avatar, SonaRenderOptions options = null)` | One picture of an avatar of the ctx, alone, after waiting for it to be READY.<br>Calls [`sona_headless_render`](../reference.md#sona_headless_render). |
| `byte[] RenderManifest(byte[] manifest, SonaRenderOptions options = null)` | Adds the avatar (hidden, standing still or playing clip from time), draws it and removes it.<br>Calls [`sona_headless_render_manifest`](../reference.md#sona_headless_render_manifest). |
| `List<KeyValuePair<SonaResult, byte[]>> Batch(IList<byte[]> manifests, SonaRenderOptions options = null)` | One (result, pixels or null) per manifest, in order; a bad manifest gives its code.<br>Calls [`sona_headless_batch`](../reference.md#sona_headless_batch). |
| `List<byte[]> Sequence(SonaAvatar avatar, SonaRenderOptions options = null, uint frames = 0, float fps = 30, float turnDeg = 0, bool orbit = false)` | Frames at a fixed frame rate: frame i at the clip's start + i / fps, turned turnDeg * i / frames.<br>Calls [`sona_headless_sequence`](../reference.md#sona_headless_sequence). |
| `void Record(SonaAvatar avatar, SonaVideo video, SonaRenderOptions options = null, uint frames = 0, float fps = 30, float turnDeg = 0, bool orbit = false)` | sona_headless_sequence into a video.<br>Calls [`sona_headless_record`](../reference.md#sona_headless_record). |

### SonaVideo

`sealed unsafe class SonaVideo : IDisposable`: A PNG sequence, GIF, MP4 or WebM.

| Declaration | What it does |
|---|---|
| `uint Width` | Every frame's size. The C field sona_video_options.width (px). |
| `uint Height` | Every frame's size. The C field sona_video_options.height (px). |
| `SonaVideo(SonaContext ctx, string path, uint width, uint height, SonaVideoFormat format = SonaVideoFormat.Auto, float fps = 30, uint loops = 0, uint quality = 0, uint background = 0xff000000u, SonaVideoFlags flags = SonaVideoFlags.None, uint colours = 0, string ffmpeg = null)` | Starts a PNG sequence (the path holds one %d, %u or %0Nd), a GIF, or an MP4 or WebM through ffmpeg (started here).<br>Calls [`sona_video_defaults`](../reference.md#sona_video_defaults), [`sona_video_open`](../reference.md#sona_video_open). |
| `static List<SonaVideoFormat> Formats(string ffmpeg = null)` | The formats this machine can write.<br>Calls [`sona_video_formats`](../reference.md#sona_video_formats). |
| `void Frame(byte[] rgba)` | One frame of width * height straight RGBA8, row 0 at the top.<br>Calls [`sona_video_frame`](../reference.md#sona_video_frame). |
| `byte[] Finish()` | Ends the file; the bytes of an in-memory video, else null.<br>Calls [`sona_video_finish`](../reference.md#sona_video_finish), [`sona_free`](../reference.md#sona_free). |
| `void Dispose()` | Ends the file and frees v, also on error.<br>Calls [`sona_video_finish`](../reference.md#sona_video_finish). |

### SonaPlayerLook

`sealed class SonaPlayerLook`: The C type sona_player_look.

| Declaration | What it does |
|---|---|
| `SonaPlayerState State` | The C field sona_player_look.state (sona_player_state value). |
| `SonaResult Error` | Why the last check failed: SONA_E_IO offline, SONA_E_LIMIT, SONA_E_GATE (the server failed), SONA_E_APP (client unknown to the lookup), SONA_E_CORRUPT; or OK. The C field sona_player_look.error (sona_result value). |
| `bool Placeholder` | 1: manifest is the placeholder. The C field sona_player_look.placeholder (flag (0 or 1)). |
| `byte[] Manifest` | The C field sona_player_look.manifest (bytes). |
| `string Version` | The look's version: 32 hex digits of its SHA-256; "" for the placeholder. The C field sona_player_look.version (text (UTF-8)). |
| `string Name` | The gamertag as Xbox spells it, or the slot's name; "" when there is none. The C field sona_player_look.name (text (UTF-8)). |
| `double FetchedAt` | Clock seconds this look arrived; 0: never. The C field sona_player_look.fetched_at (s). |
| `double CheckedAt` | Clock seconds the server last answered for it; 0: never. The C field sona_player_look.checked_at (s). |
| `double NextCheck` | Clock seconds of the next request; 0: none planned (not watched, or final). The C field sona_player_look.next_check (s). |

### SonaPlayerEvent

`struct SonaPlayerEvent`: The C type sona_player_event.

| Declaration | What it does |
|---|---|
| `SonaPlayerEventType Type` | The C field sona_player_event.type (sona_player_event_type value). |
| `SonaResult Code` | The C field sona_player_event.code (sona_result value). |
| `string Id` | The id as it was last watched. The C field sona_player_event.id (text (UTF-8)). |

### SonaPlayersOptions

`sealed class SonaPlayersOptions`: The C type sona_players_config.

| Declaration | What it does |
|---|---|
| `string Host` | NULL: "https://360sona.com". The C field sona_players_config.host (text (UTF-8), NULL: none). |
| `string Client` | The app id the gamertag lookup knows; NULL: the app id stamped into this build. The C field sona_players_config.client (text (UTF-8), NULL: none). |
| `string CacheDir` | NULL: memory only; else a folder this app owns, made when missing. The C field sona_players_config.cache_dir (text (UTF-8), NULL: none). |
| `byte[] Placeholder` | SONA_MANIFEST_BYTES shown while nothing is known; NULL: sona_players_placeholder. The C field sona_players_config.placeholder (pointer). |
| `uint MaxPlayers` | looks kept, in memory and on disk; 0: 2048. The C field sona_players_config.max_players (count). |
| `uint RefreshSeconds` | How often a watched player's look is checked again, in seconds (sona_players_config.refresh_seconds). |
| `uint PerHour` | Requests in any hour; 0: 60, the lookup's limit per address. The C field sona_players_config.per_hour (count (requests an hour)). |
| `uint InFlight` | Requests at once; 0: 4, at most 16. The C field sona_players_config.in_flight (count). |
| `uint TimeoutMs` | 0: 15000. The C field sona_players_config.timeout_ms (ms). |

### SonaPlayers

`sealed unsafe class SonaPlayers : IDisposable`: Friends, lobby members and leaderboard rows by id: a gamertag, "a:<account>/<slot>" or "w:<case key>".

| Declaration | What it does |
|---|---|
| `SonaPlayers(SonaPlayersOptions o = null)` | Reads the cache file when cache_dir is set (a file that does not decode is ignored).<br>Calls [`sona_players_defaults`](../reference.md#sona_players_defaults), [`sona_players_open`](../reference.md#sona_players_open). |
| `SonaResult Watch(string[] ids, int priority = 0)` | Ok, or the first problem (Argument for a string that is not an id, Limit); the rest are watched.<br>Calls [`sona_players_watch`](../reference.md#sona_players_watch). |
| `void Unwatch(string[] ids = null)` | null: every id.<br>Calls [`sona_players_unwatch`](../reference.md#sona_players_unwatch). |
| `SonaResult Refresh(string[] ids = null)` | null: every watched id.<br>Calls [`sona_players_refresh`](../reference.md#sona_players_refresh). |
| `uint Update()` | Each frame: takes answers, sends due requests, writes the cache file (at most every 2 s).<br>Calls [`sona_players_update`](../reference.md#sona_players_update). |
| `List<SonaPlayerEvent> Poll()` | Every event waiting, oldest first; an empty list when there are none.<br>Calls [`sona_players_poll`](../reference.md#sona_players_poll). |
| `SonaPlayerLook Look(string id)` | Always a look to draw (the placeholder when nothing is known).<br>Calls [`sona_players_look`](../reference.md#sona_players_look). |
| `bool Forget(string id)` | Drops the id's look from memory and, at the next write, from the cache file, and stops watching it.<br>Calls [`sona_players_forget`](../reference.md#sona_players_forget). |
| `Native.sona_players_stats Stats()` | Looks kept, ids watched, requests in flight and due, and counts since open: requests, changed, the same, 304s, gone, failed, read from disk, disk writes, waits for per_hour; paused_until.<br>Calls [`sona_players_stats_get`](../reference.md#sona_players_stats_get). |
| `static byte[] PlaceholderLook()` | The built-in placeholder: the site's faceless grey mannequin, nothing worn.<br>Calls [`sona_players_placeholder`](../reference.md#sona_players_placeholder). |
| `void Dispose()` | Writes the cache file when it changed; answers still in flight are dropped.<br>Calls [`sona_players_close`](../reference.md#sona_players_close). |

### SonaRandomOptions

`sealed class SonaRandomOptions`: The C type sona_random_options.

| Declaration | What it does |
|---|---|
| `uint Body` | 0: the seed picks (or the base's body); 1 male; 2 female. The C field sona_random_options.body (one of the values named in the header). |
| `uint Style` | SONA_STYLE_*. The C field sona_random_options.style (one of the SONA_ values named). |
| `uint Palette` | SONA_PALETTE_*. The C field sona_random_options.palette (one of the SONA_ values named). |
| `uint Flags` | SONA_RANDOM_*. The C field sona_random_options.flags (bit flags). |
| `SonaItemFlags Require` | SONA_ITEM_* every picked item has / lacks, on top of OFFERED and not HIDDEN. The C field sona_random_options.require (one of the SONA_ values named). |
| `SonaItemFlags Exclude` | SONA_ITEM_* every picked item has / lacks, on top of OFFERED and not HIDDEN. The C field sona_random_options.exclude (one of the SONA_ values named). |
| `uint SkipSections` | Bit (1u << sona_section) per section left as the base has it. The C field sona_random_options.skip_sections (bit flags). |
| `string Game` | Clothes from this game only (a franchise; ASCII case folded); NULL: any. The C field sona_random_options.game (text (UTF-8), NULL: none). |
| `string Tag` | A tag the random clothes must have; null: any (sona_random_options.tag). |
| `byte[] Base` | SONA_MANIFEST_BYTES to start from; NULL: a new avatar. The C field sona_random_options.base (pointer). |
| `uint[] Skin` | ARGB colours of the host's in place of the palette's; NULL: the palette's. The C field sona_random_options.skin (pointer). |
| `uint[] Hair` | ARGB colours of the host's in place of the palette's; NULL: the palette's. The C field sona_random_options.hair (pointer). |
| `uint[] Eyes` | ARGB colours of the host's in place of the palette's; NULL: the palette's. The C field sona_random_options.eyes (pointer). |
| `Func<string, bool> Available` | 0: the host cannot draw it, never pick it; NULL: all. The C field sona_random_options.available (a function (NULL: none)). |

### SonaRandomResult

`sealed class SonaRandomResult`: What sona_make_random picked: the set worn, the item per section and the candidates (sona_random_report).

| Declaration | What it does |
|---|---|
| `byte[] Manifest` | The C type sona_manifest. |
| `uint Body` | 0: the seed picks (or the base's body); 1 male; 2 female. The C field sona_random_options.body (one of the values named in the header). |
| `int Set` | The matched set worn, or -1. The C field sona_random_report.set (index or id (-1: none)). |
| `int[] Picked = new int[Native.SONA_SECTION_COUNT]` | Per sona_section: the catalogue index worn, or -1. The C field sona_random_report.picked (count). |
| `uint[] Candidates = new uint[Native.SONA_SECTION_COUNT]` | Per sona_section: the items that passed every filter. The C field sona_random_report.candidates (count). |

### SonaLikeItem

`sealed class SonaLikeItem`: The C type sona_like_item.

| Declaration | What it does |
|---|---|
| `string From` | The C field sona_like_item.from (a sona_guid (see its fields)). |
| `string To` | The C field sona_like_item.to (a sona_guid (see its fields)). |
| `string Outcome` | The C field sona_like_item.outcome (one of the values named in the header). |
| `uint Section` | The C field sona_like_item.section (one of the values named in the header). |

### SonaLikeResult

`sealed class SonaLikeResult`: What sona_make_dress_like kept, varied, swapped and dropped (sona_like_report).

| Declaration | What it does |
|---|---|
| `byte[] Manifest` | The C type sona_manifest. |
| `List<SonaLikeItem> Items = new List<SonaLikeItem>()` | Each item copied: from, what this body wears for it, SONA_RESOLVED_*. The C field sona_like_report.items (a sona_like_item (see its fields)). |
| `uint Kept` | The C field sona_like_report.kept (count). |
| `uint Variants` | The C field sona_like_report.variants (count). |
| `uint Similar` | The C field sona_like_report.similar (count). |
| `uint Substitutes` | The C field sona_like_report.substitutes (count). |
| `uint Dropped` | The C field sona_like_report.dropped (count). |
| `uint Covered` | The C field sona_like_report.covered (count). |

### SonaOutfitSet

`sealed class SonaOutfitSet`: The C type sona_outfit_set.

| Declaration | What it does |
|---|---|
| `int Index` | The set's index in the catalogue's list of matched sets. |
| `string Name` | The words its items' names share, or the game; lives as long as the maker. The C field sona_outfit_set.name (text (UTF-8), NULL: none). |
| `string Game` | The game it comes from; "" when none. The C field sona_outfit_set.game (text (UTF-8), NULL: none). |
| `uint Title` | The id tail its items share (the last four bytes, big-endian). The C field sona_outfit_set.title (bytes). |
| `uint Count` | Items. The C field sona_outfit_set.count (count). |
| `uint Bodies` | Who wears two or more of its sections: 1 a male body, 2 a female one, 3 both. The C field sona_outfit_set.bodies (one of the values named in the header). |
| `uint Sections` | Bit (1u << sona_section) per section it has items in. The C field sona_outfit_set.sections (bit flags). |
| `uint Slots` | Every slot its items cover. The C field sona_outfit_set.slots (bit flags). |

### SonaOutfitIssue

`sealed class SonaOutfitIssue`: The C type sona_outfit_issue.

| Declaration | What it does |
|---|---|
| `string Kind` | SONA_ISSUE_*. The C field sona_outfit_issue.kind (one of the SONA_ values named). |
| `string Severity` | SONA_SEVERITY_*. The C field sona_outfit_issue.severity (one of the SONA_ values named). |
| `uint Slots` | The slots concerned. The C field sona_outfit_issue.slots (bit flags). |
| `uint Field` | SONA_FIELD_* of item. The C field sona_outfit_issue.field (one of the SONA_ values named). |
| `string Item` | The items concerned; zero when none. The C field sona_outfit_issue.item (a sona_guid (see its fields)). |
| `string Other` | The items concerned; zero when none. The C field sona_outfit_issue.other (a sona_guid (see its fields)). |

### SonaOutfitReport

`sealed class SonaOutfitReport`: The C type sona_outfit_report.

| Declaration | What it does |
|---|---|
| `bool Valid` | 1: no errors (the manifest is valid and nothing clashes). The C field sona_outfit_report.valid (flag (0 or 1)). |
| `uint Issues` | Issues found (more than cap may be), and of them errors and warnings. The C field sona_outfit_report.issues (count). |
| `uint Errors` | Issues found (more than cap may be), and of them errors and warnings. The C field sona_outfit_report.errors (count). |
| `uint Warnings` | Issues found (more than cap may be), and of them errors and warnings. The C field sona_outfit_report.warnings (count). |
| `uint Body` | 1, 2, or 0 when not known. The C field sona_outfit_report.body (one of the values named in the header). |
| `uint Slots` | Every slot the worn items cover. The C field sona_outfit_report.slots (count). |
| `uint SetItems` | Worn items of the matched set (sona_outfit_report.set_items). |
| `int Set` | The matched set most worn items come from (two or more), or -1. The C field sona_outfit_report.set (index or id (-1: none)). |
| `List<SonaOutfitIssue> List = new List<SonaOutfitIssue>()` | The issues found, each with its slots and words (sona_outfit_issue). |

### SonaMaker

`sealed unsafe class SonaMaker : IDisposable`: A catalogue's outfit rules, indexed once: seeded random avatars, dress like, clashes, matched sets and the outfit check.

| Declaration | What it does |
|---|---|
| `SonaMaker(SonaCatalogue catalogue, SonaContext ctx = null)` | Indexes a catalogue's outfit rules once: candidate items per body and section, gender variants and matched sets.<br>Calls [`sona_maker_create`](../reference.md#sona_maker_create). |
| `SonaRandomResult Random(uint seed, SonaRandomOptions options = null)` | size set and everything else zero: the seed picks the body, any game, a new avatar, the palette's colours and every item available.<br>Calls [`sona_random_defaults`](../reference.md#sona_random_defaults), [`sona_make_random`](../reference.md#sona_make_random). |
| `SonaLikeResult DressLike(byte[] body, byte[] like, uint parts = 0, uint match = Native.SONA_MATCH_SIMILAR, bool layer = false, Func<string, bool> available = null)` | body wearing like's parts (Native.SONA_LIKE_*; 0: clothes and props), each item resolved for body's gender.<br>Calls [`sona_like_defaults`](../reference.md#sona_like_defaults), [`sona_make_dress_like`](../reference.md#sona_make_dress_like). |
| `string Variant(string item, uint body, uint match, out string variant)` | What body (1 or 2) wears for item: the outcome name and the id (null when dropped).<br>Calls [`sona_make_variant`](../reference.md#sona_make_variant). |
| `uint Clash(string a, string b, out uint slots)`<br>`static uint Clash(SonaMaker maker, string a, string b, out uint slots)` | Native.SONA_CLASH_* bits for two item ids; maker may be null (the ids alone).<br>Calls [`sona_outfit_clash`](../reference.md#sona_outfit_clash). |
| `List<string> Conflicts(byte[] manifest, string item)` | The ids wearing item would take off manifest.<br>Calls [`sona_outfit_conflicts`](../reference.md#sona_outfit_conflicts). |
| `int SetCount` | How many matched sets (outfits sold as one) the maker knows.<br>Calls [`sona_outfit_set_count`](../reference.md#sona_outfit_set_count). |
| `SonaOutfitSet Set(int index)` | Set set: its item count, which bodies wear it, the sections it has items in and the slots it covers.<br>Calls [`sona_outfit_set_get`](../reference.md#sona_outfit_set_get). |
| `int SetOf(string item)` | The matched set an item belongs to, or -1 when it is in none.<br>Calls [`sona_outfit_set_of`](../reference.md#sona_outfit_set_of). |
| `uint[] SetItems(int set, uint body = 0)` | Catalogue indexes of a set's items a body wears (0: every item).<br>Calls [`sona_outfit_set_items`](../reference.md#sona_outfit_set_items). |
| `SonaOutfitReport Check(byte[] manifest)`<br>`static SonaOutfitReport Check(SonaMaker maker, byte[] manifest)` | Every issue of a manifest, errors first; maker may be null (the catalogue's checks are left out).<br>Calls [`sona_outfit_check`](../reference.md#sona_outfit_check), [`sona_outfit_issue_name`](../reference.md#sona_outfit_issue_name). |
| `SonaOutfitReport Fix(byte[] manifest)`<br>`static SonaOutfitReport Fix(SonaMaker maker, byte[] manifest)` | Mends every error but no body in place; the report is the check after.<br>Calls [`sona_outfit_fix`](../reference.md#sona_outfit_fix). |
| `void Dispose()` | Frees the maker.<br>Calls [`sona_maker_free`](../reference.md#sona_maker_free). |

### EditorNative

`static unsafe class EditorNative`: The P/Invoke declarations of sona_editor.h, one to one.

| Declaration | What it does |
|---|---|
| `const string Lib = "__Internal"`<br>`const string Lib = "sona_editor"` | The library name the P/Invoke calls load ("__Internal" where the library is linked in, as on iOS). |
| `static List<string> CheckLayout(out int checkedRows)` | Every mirrored struct size, and every offset the library lists, that differs from the library's.<br>Calls [`sona_editor_struct_size`](../reference.md#sona_editor_struct_size), [`sona_editor_struct_offset`](../reference.md#sona_editor_struct_offset). |

### sona_editor_options

`struct sona_editor_options`: The C type sona_editor_options, field for field.

| Declaration | What it does |
|---|---|
| `uint size` | Sizeof(sona_editor_options), set by sona_editor_defaults. The C field sona_editor_options.size (bytes (sizeof the struct)). |
| `uint mode` | SONA_EDITOR_MODE_*. The C field sona_editor_options.mode (one of the SONA_ values named). |
| `uint width` | The target in pixels; default 1280 x 720 (sona_editor_resize changes it). The C field sona_editor_options.width (px). |
| `uint height` | The target in pixels; default 1280 x 720 (sona_editor_resize changes it). The C field sona_editor_options.height (px). |
| `uint flags` | SONA_EDITOR_*. The C field sona_editor_options.flags (bit flags). |
| `IntPtr start` | SONA_MANIFEST_BYTES to edit; NULL: a blank figure (MODE_WARDROBE needs one). The C field sona_editor_options.start (pointer). |
| `IntPtr catalogue` | Required: names, sections and what can be worn; must outlive the editor. The C field sona_editor_options.catalogue (pointer to sona_catalogue). |
| `ulong seed` | The generated looks; 0: 1. The C field sona_editor_options.seed (index or id). |
| `IntPtr title` | The heading; NULL: "Create your avatar" (or "Choose an outfit"). The C field sona_editor_options.title (text (UTF-8), NULL: none). |
| `IntPtr filter` | The C field sona_editor_options.filter (a function (NULL: none)). |
| `IntPtr filter_user` | The C field sona_editor_options.filter_user (pointer). |
| `IntPtr look` | The C field sona_editor_options.look (a function (NULL: none)). |
| `IntPtr look_user` | The C field sona_editor_options.look_user (pointer). |
| `IntPtr sound` | The C field sona_editor_options.sound (a function (NULL: none)). |
| `IntPtr sound_user` | The C field sona_editor_options.sound_user (pointer). |

### sona_editor_theme

`struct sona_editor_theme`: Colours are 0xAARRGGBB, straight alpha. The C type sona_editor_theme, field for field.

| Declaration | What it does |
|---|---|
| `uint size` | Sizeof(sona_editor_theme), set by sona_editor_theme_defaults. The C field sona_editor_theme.size (bytes (sizeof the struct)). |
| `uint background` | Behind the avatar (the avatar layer's clear). The C field sona_editor_theme.background (colour, 0xAARRGGBB). |
| `uint panel` | The panels. The C field sona_editor_theme.panel (colour, 0xAARRGGBB). |
| `uint raised` | Cells, buttons and rows on a panel. The C field sona_editor_theme.raised (colour, 0xAARRGGBB). |
| `uint text` | The C field sona_editor_theme.text (colour, 0xAARRGGBB). |
| `uint text_dim` | The C field sona_editor_theme.text_dim (colour, 0xAARRGGBB). |
| `uint accent` | The current tab, the selected cell, slider fill. The C field sona_editor_theme.accent (colour, 0xAARRGGBB). |
| `uint accent_text` | Text on accent. The C field sona_editor_theme.accent_text (colour, 0xAARRGGBB). |
| `uint focus` | The focus ring. The C field sona_editor_theme.focus (colour, 0xAARRGGBB). |
| `uint shade` | The dialog's screen dim. The C field sona_editor_theme.shade (colour, 0xAARRGGBB). |
| `float corner_radius` | Default 8. The C field sona_editor_theme.corner_radius (layout units (a 1280 x 720 screen)). |
| `float scale` | Every size; 0: the shorter side / 720, at least 0.5. The C field sona_editor_theme.scale (factor (unitless)). |
| `float font_px` | Body text; default 14 (titles are 1.5 times). The C field sona_editor_theme.font_px (px). |
| `IntPtr font` | TrueType or OpenType bytes, copied; NULL: the built-in font (Droid Sans). The C field sona_editor_theme.font (pointer). |
| `UIntPtr font_len` | The C field sona_editor_theme.font_len (bytes). |

### sona_editor_input

`struct sona_editor_input`: The C type sona_editor_input, field for field.

| Declaration | What it does |
|---|---|
| `uint size` | Sizeof(sona_editor_input). The C field sona_editor_input.size (bytes (sizeof the struct)). |
| `uint kind` | SONA_EDITOR_IN_*. The C field sona_editor_input.kind (one of the SONA_ values named). |
| `uint code` | The C field sona_editor_input.code (one of the values named in the header). |
| `int down` | The C field sona_editor_input.down (flag (0 or 1)). |
| `uint mods` | The C field sona_editor_input.mods (bit flags). |
| `uint pointer` | The C field sona_editor_input.pointer (index or id). |
| `float x` | The C field sona_editor_input.x (px). |
| `float y` | The C field sona_editor_input.y (px). |
| `float value` | The C field sona_editor_input.value (the control's own units (an axis: -1 to 1)). |

### sona_editor_control

`struct sona_editor_control`: The C type sona_editor_control, field for field.

| Declaration | What it does |
|---|---|
| `uint size` | Sizeof(sona_editor_control). The C field sona_editor_control.size (bytes (sizeof the struct)). |
| `uint id` | Stable while the control exists. The C field sona_editor_control.id (index or id). |
| `uint role` | SONA_EDITOR_ROLE_*. The C field sona_editor_control.role (one of the SONA_ values named). |
| `uint flags` | SONA_EDITOR_CTRL_*. The C field sona_editor_control.flags (bit flags). |
| `float value` | Sliders and spins. The C field sona_editor_control.value (the control's own units (between min and max)). |
| `float min` | Sliders and spins. The C field sona_editor_control.min (the control's own units). |
| `float max` | Sliders and spins. The C field sona_editor_control.max (the control's own units). |
| `uint index` | "index + 1 of count" in its group (0, 0 when none). The C field sona_editor_control.index (index or id). |
| `uint count` | "index + 1 of count" in its group (0, 0 when none). The C field sona_editor_control.count (count). |

### sona_editor_draw_data

`struct sona_editor_draw_data`: The C type sona_editor_draw_data, field for field.

| Declaration | What it does |
|---|---|
| `uint size` | Sizeof(sona_editor_draw_data). The C field sona_editor_draw_data.size (bytes (sizeof the struct)). |
| `uint width` | The C field sona_editor_draw_data.width (px). |
| `uint height` | The C field sona_editor_draw_data.height (px). |
| `uint revision` | Changes whenever the lists do. The C field sona_editor_draw_data.revision (revision number). |
| `uint vertex_count` | The C field sona_editor_draw_data.vertex_count (count). |
| `uint index_count` | Triangles. The C field sona_editor_draw_data.index_count (count). |
| `uint command_count` | The C field sona_editor_draw_data.command_count (count). |

### sona_editor_texture

`struct sona_editor_texture`: The C type sona_editor_texture, field for field.

| Declaration | What it does |
|---|---|
| `uint size` | Sizeof(sona_editor_texture). The C field sona_editor_texture.size (bytes (sizeof the struct)). |
| `uint id` | The C field sona_editor_texture.id (index or id). |
| `uint width` | The C field sona_editor_texture.width (px). |
| `uint height` | The C field sona_editor_texture.height (px). |
| `uint revision` | Upload again when it changes. The C field sona_editor_texture.revision (revision number). |
| `uint dirty_since` | A copy of dirty_since or later needs only dirty; an older one needs all of it. The C field sona_editor_texture.dirty_since (revision number). |

### SonaEditorControl

`struct SonaEditorControl`: One control on screen, for a screen reader.

| Declaration | What it does |
|---|---|
| `uint Id` | Stable while the control exists. The C field sona_editor_control.id (index or id). |
| `SonaEditorRole Role` | SONA_EDITOR_ROLE_*. The C field sona_editor_control.role (one of the SONA_ values named). |
| `bool Focused` | True for the control that has the focus. |
| `bool Selected` | True for the control that is selected (a tab, a list item). |
| `float X` | The control's left edge in px (sona_editor_control.rect[0]). |
| `float Y` | The control's top edge in px (sona_editor_control.rect[1]). |
| `float Width` | The control's width in px (sona_editor_control.rect[2]). |
| `float Height` | The control's height in px (sona_editor_control.rect[3]). |
| `float Value` | Sliders and spins. The C field sona_editor_control.value (the control's own units (between min and max)). |
| `uint Index` | "index + 1 of count" in its group (0, 0 when none). The C field sona_editor_control.index (index or id). |
| `uint Count` | "index + 1 of count" in its group (0, 0 when none). The C field sona_editor_control.count (count). |
| `string Label` | The control's label, as shown: "Blue Hoodie". The C field sona_editor_control.label. |
| `string ValueText` | "worn", "0.40", "Female". The C field sona_editor_control.value_text (text (UTF-8)). |
| `string Hint` | What pressing it does: "Wear it". The C field sona_editor_control.hint (text (UTF-8)). |

### SonaEditor

`sealed unsafe class SonaEditor : IDisposable`: The player-facing editor on a context of its own and a catalogue.

| Declaration | What it does |
|---|---|
| `SonaEditor(SonaContext ctx, SonaCatalogue catalogue, SonaEditorMode mode = SonaEditorMode.Full, byte[] start = null, bool light = false, uint width = 1280, uint height = 720, ulong seed = 1, SonaEditorFlags flags = SonaEditorFlags.None, Action<uint> sound = null)` | theme NULL: the light (site) theme.<br>Calls [`sona_editor_defaults`](../reference.md#sona_editor_defaults), [`sona_editor_theme_defaults`](../reference.md#sona_editor_theme_defaults), [`sona_editor_open`](../reference.md#sona_editor_open). |
| `void Dispose()` | Removes its avatars from the ctx.<br>Calls [`sona_editor_close`](../reference.md#sona_editor_close). |
| `void Button(SonaEditorPad b, bool down)` | A gamepad button pressed or let go (sona_editor_input). |
| `void Press(SonaEditorPad b, double dt = 1.0 / 60)` | A button pressed and let go, with an update between. |
| `void Axis(SonaEditorAxis a, float v)` | A gamepad axis moved, -1 to 1 (sona_editor_input). |
| `void Key(SonaEditorKey k, bool shift = false, bool ctrl = false)` | A key pressed, with shift and ctrl (sona_editor_input). |
| `void Text(string s)` | Typed text, for the search box (sona_editor_input). |
| `void Pointer(float x, float y, bool? down, uint pointer = 0)` | down: true pressed, false released, null moved. |
| `void Wheel(float lines, float x, float y)` | A mouse wheel turned at a point, in lines (sona_editor_input). |
| `SonaEditorStatus Update(double dt)` | Advances dt seconds: stick repeat, animations, avatar builds and (unless HOST_UPDATES) sona_update on the ctx.<br>Calls [`sona_editor_update`](../reference.md#sona_editor_update). |
| `SonaEditorStatus Status` | SONA_EDITOR_RUNNING, _DONE or _CANCELLED, as the last sona_editor_update returned.<br>Calls [`sona_editor_status`](../reference.md#sona_editor_status). |
| `bool Busy` | 1 while an avatar is still building (the shown one or a change on its way); thumbnails do not count.<br>Calls [`sona_editor_busy`](../reference.md#sona_editor_busy). |
| `uint BuildFailures` | How many avatar builds failed since open (the screen reader is told each time).<br>Calls [`sona_editor_build_failures`](../reference.md#sona_editor_build_failures). |
| `bool Undo(bool redo = false)` | Undoes the last change (redo 0) or redoes the last undone one (redo 1), for a host that draws the stage's own undo and redo buttons.<br>Calls [`sona_editor_undo`](../reference.md#sona_editor_undo). |
| `bool CanUndo(bool redo = false)` | 1 when sona_editor_undo with the same redo would step: use it to grey out the buttons.<br>Calls [`sona_editor_can_undo`](../reference.md#sona_editor_can_undo). |
| `double Zoom` | The stage's zoom: 1 is the editor's own framing, from 0.6 to 3.<br>Calls [`sona_editor_zoom`](../reference.md#sona_editor_zoom). |
| `void Turn(double degrees)` | Turns the avatar on the stage by degrees, as a drag across the stage does.<br>Calls [`sona_editor_turn`](../reference.md#sona_editor_turn). |
| `SonaEditorScreen[] Screens()` | The mode's screens in tab order.<br>Calls [`sona_editor_screens`](../reference.md#sona_editor_screens). |
| `byte[] Result()` | The avatar as it stands (at any time): SONA_MANIFEST_BYTES.<br>Calls [`sona_editor_result`](../reference.md#sona_editor_result). |
| `void SetSearch(string text)` | The search box of the wardrobe and the item screens, for hosts with an on-screen keyboard (UTF-8; NULL clears).<br>Calls [`sona_editor_set_search`](../reference.md#sona_editor_set_search). |
| `void Resize(uint width, uint height)` | The editor's size in pixels, the size of the target it is drawn into.<br>Calls [`sona_editor_resize`](../reference.md#sona_editor_resize). |
| `List<SonaEditorControl> Controls()` | Every control on screen, in reading order, and the focused one.<br>Calls [`sona_editor_control_count`](../reference.md#sona_editor_control_count), [`sona_editor_control_get`](../reference.md#sona_editor_control_get). |
| `SonaEditorControl? Focus()` | SONA_E_NOT_FOUND when nothing has focus (pointer-only use).<br>Calls [`sona_editor_focus_get`](../reference.md#sona_editor_focus_get). |
| `string Announcement()` | What a screen reader should say since the last call, or null.<br>Calls [`sona_editor_announcement`](../reference.md#sona_editor_announcement). |
| `byte[] RenderUi(uint width, uint height, byte[] under = null)` | The UI layer as straight RGBA (width x height of the editor).<br>Calls [`sona_editor_render_ui`](../reference.md#sona_editor_render_ui). |
| `EditorNative.sona_editor_draw_data DrawData()` | The triangle list for the host's own 2D pass; valid until the next Update.<br>Calls [`sona_editor_draw_data_get`](../reference.md#sona_editor_draw_data_get). |

### TrackNative

`static unsafe class TrackNative`: The P/Invoke declarations of sona_track.h, one to one.

| Declaration | What it does |
|---|---|
| `const string Lib = "__Internal"`<br>`const string Lib = "sona_track"` | The library name the P/Invoke calls load ("__Internal" where the library is linked in, as on iOS). |
| `const int SONA_TRACK_BLENDSHAPES = 52` | The value of SONA_TRACK_BLENDSHAPES. |
| `const uint SONA_TRACK_FOUND = SONA_TRACK_FOUND` | The value of SONA_TRACK_FOUND. |
| `static List<string> CheckLayout(out int checkedRows)` | Every mirrored struct's size and field offset that differs from the library's.<br>Calls [`sona_track_struct_offset`](../reference.md#sona_track_struct_offset), [`sona_track_struct_size`](../reference.md#sona_track_struct_size). |

### sona_track_options

`struct sona_track_options`: The C type sona_track_options, field for field.

| Declaration | What it does |
|---|---|
| `uint size` | Sizeof(sona_track_options). The C field sona_track_options.size (bytes (sizeof the struct)). |
| `uint flags` | SONA_TRACK_*. The C field sona_track_options.flags (bit flags). |
| `float face_min_cutoff` | The weights' One Euro filter: cutoff at rest in Hz; default 3. The C field sona_track_options.face_min_cutoff (Hz). |
| `float face_beta` | How fast the cutoff rises with speed; default 2. The C field sona_track_options.face_beta (factor (unitless)). |
| `float head_min_cutoff` | The head rotation's filter; default 1.2. The C field sona_track_options.head_min_cutoff (Hz). |
| `float head_beta` | Default 0.6 (per radian a second). The C field sona_track_options.head_beta (radians). |
| `float head_gain` | The head's rotation is scaled by this; default 1. The C field sona_track_options.head_gain (factor (unitless)). |
| `float neck_share` | Of the head's rotation, the part the Neck joint takes; default 0.35. The C field sona_track_options.neck_share (factor (unitless)). |
| `float sensitivity` | Above 1 a weaker expression reaches a shape; 0 (default): by layout, 1 for ARKit and 1.4 for MediaPipe, whose scores run lower. The C field sona_track_options.sensitivity (factor (unitless)). |
| `float lost_seconds` | The last face holds this long once the tracker loses it; default 0.5. The C field sona_track_options.lost_seconds (s). |
| `float return_seconds` | Then the head and face ease back to the clip over this; default 0.4. The C field sona_track_options.return_seconds (s). |
| `float sleep_seconds` | Eyes shut this long show the sleeping eyes instead of the blink; default 1.5, 0 never. The C field sona_track_options.sleep_seconds (s). |

### sona_track_face_input

`struct sona_track_face_input`: One frame of a face tracker. The C type sona_track_face_input, field for field.

| Declaration | What it does |
|---|---|
| `uint size` | Sizeof(sona_track_face_input). The C field sona_track_face_input.size (bytes (sizeof the struct)). |
| `uint flags` | SONA_TRACK_FOUND, SONA_TRACK_HAS_HEAD. The C field sona_track_face_input.flags (bit flags). |
| `double time` | Seconds, rising: the filters and holds run on it, not on calls. The C field sona_track_face_input.time (s). |
| `uint layout` | SONA_TRACK_LAYOUT_*. The C field sona_track_face_input.layout (one of the SONA_ values named). |
| `uint count` | Weights given: 52. The C field sona_track_face_input.count (count). |

### sona_track_face_state

`struct sona_track_face_state`: What the tracker makes of the frames so far. The C type sona_track_face_state, field for field.

| Declaration | What it does |
|---|---|
| `uint size` | Sizeof(sona_track_face_state). The C field sona_track_face_state.size (bytes (sizeof the struct)). |
| `uint tracking` | 1 while a face is followed or held after a loss; 0 once handed back. The C field sona_track_face_state.tracking (flag (0 or 1)). |
| `double time` | Of the last frame fed. The C field sona_track_face_state.time (s). |
| `float weight` | 0..1: how far the tracker drives the head (eases out after a loss, back in on a new face). The C field sona_track_face_state.weight (factor (unitless)). |
| `byte mood` | Sona_track_mood. The C field sona_track_face_state.mood (sona_track_mood value). |

### sona_track_calibration

`struct sona_track_calibration`: Neutral face. The C type sona_track_calibration, field for field.

| Declaration | What it does |
|---|---|
| `uint size` | Sizeof(sona_track_calibration). The C field sona_track_calibration.size (bytes (sizeof the struct)). |
| `uint frames` | Frames collected; 0: no calibration. The C field sona_track_calibration.frames (count). |

### SonaTrackState

`struct SonaTrackState`: What the tracker makes of the frames so far.

| Declaration | What it does |
|---|---|
| `bool Tracking` | 1 while a face is followed or held after a loss; 0 once handed back. The C field sona_track_face_state.tracking (flag (0 or 1)). |
| `double Time` | Of the last frame fed. The C field sona_track_face_state.time (s). |
| `float Weight` | 0..1: how far the tracker drives the head (eases out after a loss, back in on a new face). The C field sona_track_face_state.weight (factor (unitless)). |
| `byte[] Expression` | Mouth, left eyebrow, right eyebrow, left eye, right eye (255: left to the clip). |
| `SonaTrackMood Mood` | Sona_track_mood. The C field sona_track_face_state.mood (sona_track_mood value). |
| `float[] Head` | x, y, z, w in the avatar's body space. |
| `float[] Weights` | The filtered, calibrated weights in ARKit order. |

### SonaTracker

`sealed unsafe class SonaTracker : IDisposable`: Webcam face tracking onto one avatar.

| Declaration | What it does |
|---|---|
| `SonaTracker(SonaTrackFlags flags = SonaTrackFlags.None, float sensitivity = 0)` | NULL options: the defaults.<br>Calls [`sona_track_defaults`](../reference.md#sona_track_defaults), [`sona_track_create`](../reference.md#sona_track_create). |
| `static string BlendshapeName(int i)` | The name of blendshape index ("eyeBlinkLeft",...) as both trackers spell them; NULL past the last.<br>Calls [`sona_track_blendshape_name`](../reference.md#sona_track_blendshape_name). |
| `void Feed(double time, float[] scores, float[] head = null, SonaTrackLayout layout = SonaTrackLayout.MediaPipe)` | One frame: scores in the layout's order (null: no face this frame), the head (x, y, z, w) or null.<br>Calls [`sona_track_face_input_defaults`](../reference.md#sona_track_face_input_defaults), [`sona_track_face_feed`](../reference.md#sona_track_face_feed). |
| `SonaTrackState State()` | What the tracker makes of the frames so far: the filtered, calibrated weights in ARKit order (sides swapped under SONA_TRACK_MIRROR, so Left is the avatar's left) and the head.<br>Calls [`sona_track_face_get`](../reference.md#sona_track_face_get). |
| `void CalibrateBegin()` | Starts collecting a neutral face: every frame with a face from now on counts.<br>Calls [`sona_track_calibrate_begin`](../reference.md#sona_track_calibrate_begin). |
| `byte[] CalibrateEnd()` | Ends the calibration; the bytes go back to CalibrationSet in a later session.<br>Calls [`sona_track_calibrate_end`](../reference.md#sona_track_calibrate_end). |
| `void CalibrationSet(byte[] saved)` | A saved calibration, for the next session; NULL clears it.<br>Calls [`sona_track_calibration_set`](../reference.md#sona_track_calibration_set). |
| `void Reset()` | Forgets the filters, the shapes held and the tracking state; keeps the options and the calibration.<br>Calls [`sona_track_reset`](../reference.md#sona_track_reset). |
| `bool Apply(SonaAvatar avatar)` | The state on the avatar; false until it is ready and posed.<br>Calls [`sona_track_apply`](../reference.md#sona_track_apply). |
| `void Release(SonaAvatar avatar)` | Hands the face and the tracker's joints back to the clip; nothing when a is not the avatar it drives.<br>Calls [`sona_track_release`](../reference.md#sona_track_release). |
| `void Dispose()` | Frees the tracker.<br>Calls [`sona_track_destroy`](../reference.md#sona_track_destroy). |

### SonaPickOptions

`sealed class SonaPickOptions`: The C type sona_pick_options.

| Declaration | What it does |
|---|---|
| `uint Flags` | SONA_PICK_*. The C field sona_pick_options.flags (bit flags). |
| `float MaxDistance` | Metres along the ray; 0: no limit. The C field sona_pick_options.max_distance (m (world units)). |
| `SonaAvatar[] Ignore` | Avatars the ray passes through (the player's own, say). The C field sona_pick_options.ignore (pointer). |

### SonaPickHit

`struct SonaPickHit`: The C type sona_pick_hit.

| Declaration | What it does |
|---|---|
| `uint Source` | SONA_PICK_SOURCE_*: a triangle, the sprite's picture, or the sphere. The C field sona_pick_hit.source (one of the SONA_ values named). |
| `uint Flags` | SONA_PICK_HIT_*. The C field sona_pick_hit.flags (bit flags). |
| `uint AvatarId` | Sona_avatar_id. The C field sona_pick_hit.avatar_id (index or id). |
| `SonaAvatar Avatar` | The C field sona_pick_hit.avatar (pointer to sona_avatar). |
| `uint Part` | SONA_PICK_BODY, _ITEM or _PROP; 0 for a sphere hit. The C field sona_pick_hit.part (one of the SONA_ values named). |
| `uint Section` | Sona_section from the item's mask (the catalogue has the exact one). The C field sona_pick_hit.section (one of the values named in the header). |
| `uint Mask` | The item's AssetMask. The C field sona_pick_hit.mask (bit flags). |
| `string Item` | The item hit; "" for a sphere hit. The C field sona_pick_hit.item (text (UTF-8)). |
| `int Mesh` | Index into sona_pose_data.meshes; -1 for a sphere hit. The C field sona_pick_hit.mesh (index or id). |
| `int Prop` | Index into sona_pose_data.props for a held prop, else -1. The C field sona_pick_hit.prop (index or id). |
| `int Joint` | The named joint (sona_joint_name) that moves the point most; -1 for a prop. The C field sona_pick_hit.joint (index or id). |
| `uint Triangle` | the mesh's indices3 * triangle.. The C field sona_pick_hit.triangle (index or id). |
| `uint Region` | Sona_body_region of that joint. The C field sona_pick_hit.region (sona_body_region value). |
| `uint Lod` | SONA_LOD_* at the last sona_update. The C field sona_pick_hit.lod (one of the SONA_ values named). |
| `float Distance` | Metres from the ray's origin, along its unit direction. The C field sona_pick_hit.distance (m (world units)). |
| `float PointX` | World. The C field sona_pick_hit.point, one part (m (world units)). |
| `float PointY` | World. The C field sona_pick_hit.point, one part (m (world units)). |
| `float PointZ` | World. The C field sona_pick_hit.point, one part (m (world units)). |
| `float NormalX` | World, unit, toward the ray: the triangle's, or the sprite's for a picture. The C field sona_pick_hit.normal, one part (direction (unit vector)). |
| `float NormalY` | World, unit, toward the ray: the triangle's, or the sprite's for a picture. The C field sona_pick_hit.normal, one part (direction (unit vector)). |
| `float NormalZ` | World, unit, toward the ray: the triangle's, or the sprite's for a picture. The C field sona_pick_hit.normal, one part (direction (unit vector)). |
| `float BaryU` | Where on the triangle the ray met it: barycentric u (sona_pick_hit.bary[0]). |
| `float BaryV` | Where on the triangle the ray met it: barycentric v (sona_pick_hit.bary[1]). |
| `float U` | The texture coordinate there: u (sona_pick_hit.uv[0]). |
| `float V` | The texture coordinate there: v (sona_pick_hit.uv[1]). |
| `string RegionName` | "none", "head", "neck", "torso", "hips", "leftArm", "rightArm", "leftHand", "rightHand", "leftLeg", "rightLeg", "leftFoot", "rightFoot"; NULL past the last. |

### SonaPicking

`static unsafe class SonaPicking`: Picking: which avatar, mesh and triangle a ray or a pixel meets (sona_pick_ray, sona_pick_screen, sona_pick_gpu).

| Declaration | What it does |
|---|---|
| `static string RegionName(uint region)` | "none", "head", "neck", "torso", "hips", "leftArm", "rightArm", "leftHand", "rightHand", "leftLeg", "rightLeg", "leftFoot", "rightFoot"; NULL past the last.<br>Calls [`sona_region_name`](../reference.md#sona_region_name). |
| `static void ViewRay(in SonaView view, double x, double y, float[] origin, float[] dir)` | The ray through (x, y) of the view's picture, pixels from its top left; dir has length 1.<br>Calls [`sona_view_ray`](../reference.md#sona_view_ray). |
| `static bool PickRay(this SonaContext ctx, float[] origin, float[] dir, out SonaPickHit hit, SonaPickOptions options = null)` | The nearest hit along the ray; false when nothing is hit.<br>Calls [`sona_pick_ray`](../reference.md#sona_pick_ray). |
| `static bool PickScreen(this SonaContext ctx, in SonaView view, double x, double y, out SonaPickHit hit, SonaPickOptions options = null)` | The nearest hit under (x, y) of the view's picture, sprites facing that view.<br>Calls [`sona_pick_screen`](../reference.md#sona_pick_screen). |
| `static SonaPickHit[] PickRayAll(this SonaContext ctx, float[] origin, float[] dir, int max = 64, SonaPickOptions options = null)` | Every avatar the ray hits, its nearest hit each, nearest first (at most max).<br>Calls [`sona_pick_ray_all`](../reference.md#sona_pick_ray_all). |
| `static bool Pick(this SonaAvatar a, float[] origin, float[] dir, out SonaPickHit hit, SonaPickOptions options = null)` | The ray against this avatar alone; false when it misses.<br>Calls [`sona_avatar_pick`](../reference.md#sona_avatar_pick). |
| `static bool PickGpu(this SonaRenderer renderer, in SonaView view, double x, double y, out SonaPickHit hit, SonaPickOptions options = null)` | The pick through the GPU id buffer (Vulkan, GL, GLES); throws UNSUPPORTED on other backends.<br>Calls [`sona_pick_gpu`](../reference.md#sona_pick_gpu). |
| `static void PickGpuIds(this SonaRenderer renderer, in SonaView view, uint x, uint y, uint w, uint h, uint[] avatarIds, ushort[] meshes = null, SonaPickOptions options = null)` | The id buffer of a region of the view's picture: per pixel the avatar id (0: none), row 0 at the top; meshes, when given, gets the mesh index + 1.<br>Calls [`sona_pick_gpu_ids`](../reference.md#sona_pick_gpu_ids). |

### Types

| Declaration | What it does |
|---|---|
| `enum SonaContentPreset : uint` | The content filter presets: family, no logos, no licensed items (SONA_CONTENT_FAMILY, SONA_CONTENT_NO_LOGOS, SONA_CONTENT_NO_LICENSED). |
| `enum SonaClipTags : uint` | The tags of a stock clip (SONA_CLIP_TAG_*): idle, emote, walk and the rest. |
| `enum SonaIdleParts : uint` | Which parts of the idle play: blink, glance, shift, breathe (SONA_IDLE_*). |
| `struct SonaMouthKey` | A mouth from time on (sona_mouth_key). |
| `enum SonaPlayerState` | The C type sona_player_state. |
| `enum SonaPlayerEventType` | The C type sona_player_event_type. |
| `enum SonaEditorMode : uint` | The editor's modes: full, quick creator, wardrobe (SONA_EDITOR_MODE_*). |
| `enum SonaEditorStatus : uint` | SONA_EDITOR_RUNNING, _DONE or _CANCELLED, as the last sona_editor_update returned. |
| `enum SonaEditorScreen : uint` | The editor's screens (SONA_EDITOR_SCREEN_*): body, appearance and wardrobe in the full editor, looks and quick in the quick creator; face, hair and colours are deprecated. |
| `enum SonaEditorPad : uint` | Gamepad buttons the editor takes (SONA_EDITOR_PAD_*). |
| `enum SonaEditorAxis : uint` | Gamepad axes the editor takes (SONA_EDITOR_AXIS_*). |
| `enum SonaEditorKey : uint` | Keyboard keys the editor takes (SONA_EDITOR_KEY_*). |
| `enum SonaEditorRole : uint` | What a control is: button, tab, list item, option, slider, spin, search (SONA_EDITOR_ROLE_*). |
| `enum SonaEditorFlags : uint` | The editor's options: no thumbnails, no cancel, host updates, all items, garment colours (the sona_editor_options flags). |
| `struct sona_editor_vertex` | The C type sona_editor_vertex, field for field. |
| `struct sona_editor_command` | Blend with SRC_ALPHA, ONE_MINUS_SRC_ALPHA (straight alpha), no depth, the scissor at clip. The C type sona_editor_command, field for field. |
| `enum SonaTrackLayout : uint` | The blendshape layout of the face input: ARKit or MediaPipe (SONA_TRACK_LAYOUT_*). |
| `enum SonaTrackFlags : uint` | Face tracking options: mirror, no head, no face, no gaze (the sona_track_options flags). |
| `enum SonaTrackMood : byte` | The face's moods, the first seven shapes of every part of the avatar's face. The C type sona_track_mood. |

## Python

473 public names in `bindings/python/sona/__init__.py`, `bindings/python/sona/editor.py`, `bindings/python/sona/track.py`.

### Functions

| Declaration | What it does |
|---|---|
| `result_name(code)` | The name of a code ("licence", "gate",...): the same words as the web SDK's SonaError.code.<br>Calls [`sona_result_name`](../reference.md#sona_result_name). |
| `version()` | The library's version, "1.1.0".<br>Calls [`sona_version`](../reference.md#sona_version). |
| `platform()` | The binary platform id: "linux-x64", "windows-x64",...<br>Calls [`sona_platform`](../reference.md#sona_platform). |
| `check_layout()`<br>`check_layout(lib)` | The number of struct sizes and field offsets checked against the library (done once at import).<br>Calls [`sona_editor_struct_size`](../reference.md#sona_editor_struct_size), [`sona_editor_struct_offset`](../reference.md#sona_editor_struct_offset), [`sona_track_struct_size`](../reference.md#sona_track_struct_size), [`sona_track_struct_offset`](../reference.md#sona_track_struct_offset). |
| `skeleton_bone(skeleton, joint)` | The bone a joint is in a skeleton ("unity", "vrm", "vrm0", "ue4", "ue5"); None when it has none.<br>Calls [`sona_skeleton_bone`](../reference.md#sona_skeleton_bone). |
| `skeleton_joint(skeleton, bone)` | The joint a bone of that skeleton is; -1 when none.<br>Calls [`sona_skeleton_joint`](../reference.md#sona_skeleton_joint). |
| `vrm_expression_name(expression)` | The VRM 1.0 preset name of a sona_vrm_expression ("aa"...<br>Calls [`sona_vrm_expression_name`](../reference.md#sona_vrm_expression_name). |
| `joint_find(name)` | A joint by name: "Hips", "Head", "PropRight", "shape_04", "joint_33".<br>Calls [`sona_joint_find`](../reference.md#sona_joint_find). |
| `joint_name(joint)` | None past the last joint.<br>Calls [`sona_joint_name`](../reference.md#sona_joint_name). |
| `lod_defaults()` | The level-of-detail defaults, with sprites on at 48 px.<br>Calls [`sona_lod_defaults`](../reference.md#sona_lod_defaults). |
| `placeholder_defaults()` | size set; delay_seconds 0 (never a hole), appear_seconds 0.2, reveal_seconds 0.4, failed_seconds 2, tint 0.16, 0.19, 0.25 (a cool grey), failed_tint 0.25, 0.15, 0.15 (a muted red), glow 0.5.<br>Calls [`sona_placeholder_defaults`](../reference.md#sona_placeholder_defaults). |
| `preview_defaults()` | Fills the defaults above.<br>Calls [`sona_preview_defaults`](../reference.md#sona_preview_defaults). |
| `pixel_defaults()` | size set, height 32, colours 16, flags SONA_PIXEL_OUTLINE, outline 0 (from the palette), alpha_cut 0.5, no palette.<br>Calls [`sona_pixel_defaults`](../reference.md#sona_pixel_defaults). |
| `sticker_defaults()` | size set, pixels 512, time -1, framing SONA_PRESET_FULL, outline_px 10, outline 0xffffffff, shadow 0x59000000 (off while shadow_px is 0), padding 8.<br>Calls [`sona_sticker_defaults`](../reference.md#sona_sticker_defaults). |
| `sheet_defaults()` | size set, 8 frames, 8 directions, px_per_metre 64, padding 2, max_page 4096, draw_flags SONA_DRAW_NO_BLOOM; every other field 0 (the whole clip, facing the camera first, side on, orthographic, packed and trim<br>Calls [`sona_sheet_defaults`](../reference.md#sona_sheet_defaults). |
| `lighting_defaults()` | sona_lighting_defaults: a key and fill switched off, the built-in environment, a fitted shadow map.<br>Calls [`sona_lighting_defaults`](../reference.md#sona_lighting_defaults). |
| `environment_irradiance(sh9)` | The irradiance the lit shader evaluates for 9 RGB SH coefficients of radiance (27 floats).<br>Calls [`sona_environment_defaults`](../reference.md#sona_environment_defaults), [`sona_environment_irradiance`](../reference.md#sona_environment_irradiance). |
| `style_defaults(kind="original", outline=False, override=False, **fields)` | A sona_style: the defaults, then kind, the OUTLINE and OVERRIDE flags and fields (bands, shade, highlight, outline_px, outline_colour, colour).<br>Calls [`sona_style_defaults`](../reference.md#sona_style_defaults). |
| `quality_defaults()` | The web SDK's renderer quality: SONA_MSAA_AUTO with MIPS \| CUTOUT_MIPS.<br>Calls [`sona_quality_defaults`](../reference.md#sona_quality_defaults). |
| `section_name(section)` | "shirt", "facialHair",...; None past the last section.<br>Calls [`sona_catalogue_section_name`](../reference.md#sona_catalogue_section_name). |
| `stock_clip(clip)` | A stock clip by name ("wave"), asset id, legacy key ("GenericWave") or id; None when there is none.<br>Calls [`sona_stock_clip_get`](../reference.md#sona_stock_clip_get). |
| `stock_clips(tags=(), without=(), body=0)` | Every stock clip with all of tags and none of without that suits body (0 any, 1 male, 2 female), by id.<br>Calls [`sona_stock_clips_tagged`](../reference.md#sona_stock_clips_tagged). |
| `stock_clip_for_body(clip, body)` | The clip of this one's family made for body (1 male, 2 female).<br>Calls [`sona_stock_clip_for_body`](../reference.md#sona_stock_clip_for_body). |
| `clip_tag_name(bit)` | The name of one tag bit ("idle", "travel",...); NULL for 0, several bits or an unknown bit.<br>Calls [`sona_clip_tag_name`](../reference.md#sona_clip_tag_name). |
| `idle_defaults()` | size set, parts SONA_IDLE_ALL, seed 0, amount 1, face_px 240.<br>Calls [`sona_idle_defaults`](../reference.md#sona_idle_defaults). |
| `idle_sample(seconds, seed, parts=None)` | The idle's channels at seconds for a seed, before amount: IdleState(blink, gaze, shift, breath).<br>Calls [`sona_idle_sample`](../reference.md#sona_idle_sample). |
| `clear_filter(ctx)` | The ctx's filter: a copy of f (NULL takes it away), applied to an avatar when its manifest is read, whoever's it is (sona_avatar_add, headless renders); an avatar read before the change keeps what it wore until it is r<br>Calls [`sona_ctx_set_filter`](../reference.md#sona_ctx_set_filter). |
| `filter_report(avatar)` | What the ctx's filter changed on an avatar, or None before its manifest is read or when no filter was set.<br>Calls [`sona_avatar_filter_report`](../reference.md#sona_avatar_filter_report). |
| `view_defaults()` | The web's full-body framing, as a sona_view (fields eye, target, fov_deg, near_z, far_z, width, height).<br>Calls [`sona_view_defaults`](../reference.md#sona_view_defaults). |
| `camera_orbit(view, target, yaw_deg, pitch_deg, distance)` | Places the eye on an orbit around target.<br>Calls [`sona_camera_orbit`](../reference.md#sona_camera_orbit). |
| `view_matrices(view)` | (view, projection) as 16 floats each, row-vector, D3D depth 0..1.<br>Calls [`sona_view_matrices`](../reference.md#sona_view_matrices). |
| `guid_parse(text)` | Parses the 36-character text form.<br>Calls [`sona_guid_parse`](../reference.md#sona_guid_parse). |
| `guid_format(g)` | The id in its lowercase 36-character form.<br>Calls [`sona_guid_format`](../reference.md#sona_guid_format). |
| `slot_of(g)` | (route, mask): route "rejected", "worn", "bare" or "face".<br>Calls [`sona_slot_of`](../reference.md#sona_slot_of). |
| `base64_decode(text)` | The bytes the base64 text holds.<br>Calls [`sona_base64_decode`](../reference.md#sona_base64_decode). |
| `import_formats()` | The formats this build reads: a set of "gltf", "fbx", "bvh".<br>Calls [`sona_import_formats`](../reference.md#sona_import_formats). |
| `shader_source(lang, prog, stage)` | Text or SPIR-V bytes for one program and stage (0 vertex, 1 fragment); None when not in this build.<br>Calls [`sona_shader_source`](../reference.md#sona_shader_source). |
| `mask_preset(name)` | 72 weights: "none", "full", "upper_body", "lower_body", "head", "left_arm", "right_arm" or "arms".<br>Calls [`sona_mask_preset`](../reference.md#sona_mask_preset). |
| `mask_branch(mask, joint, weight)` | A copy of mask with joint and every joint below it set to weight.<br>Calls [`sona_mask_branch`](../reference.md#sona_mask_branch). |
| `phoneme_mouth(symbol)` | The mouth for a phoneme symbol (ARPAbet, IPA, viseme names or ids); None when it is none of them.<br>Calls [`sona_phoneme_mouth`](../reference.md#sona_phoneme_mouth). |
| `lipsync_phonemes(phonemes)` | (symbol, start, end) tuples to (time, mouth, open) keys.<br>Calls [`sona_lipsync_phonemes`](../reference.md#sona_lipsync_phonemes). |
| `lipsync_text(text, samples=None, sample_rate=48000, s16=False)` | Text to (time, mouth, open) keys, aligned to mono audio when given, else at an even pace.<br>Calls [`sona_lipsync_text`](../reference.md#sona_lipsync_text). |
| `mouth_keys_sample(keys, t)` | (mouth, open) at time t of (time, mouth, open) keys.<br>Calls [`sona_mouth_keys_sample`](../reference.md#sona_mouth_keys_sample). |
| `headless_devices(backend=None)` | Every device a headless renderer can open: dicts of backend, software, type, vendor_id, device_id, name, driver.<br>Calls [`sona_headless_devices`](../reference.md#sona_headless_devices). |
| `render_defaults()` | 256 x 256, SONA_PRESET_FULL, zoom 1, transparent, no clip.<br>Calls [`sona_render_defaults`](../reference.md#sona_render_defaults). |
| `sequence_defaults()` | The sequence options as sona_sequence_defaults sets them: frames 0 (the clip's length), the default frame rate, no turn.<br>Calls [`sona_sequence_defaults`](../reference.md#sona_sequence_defaults). |
| `video_defaults()` | The defaults are format from the path, a frame rate of 30 fps, opaque black background, every other field 0.<br>Calls [`sona_video_defaults`](../reference.md#sona_video_defaults). |
| `video_formats(ffmpeg=None)` | The formats this machine can write: a subset of {"png", "gif", "mp4", "webm"}.<br>Calls [`sona_video_formats`](../reference.md#sona_video_formats). |
| `players_placeholder()` | The built-in placeholder look: 1000 bytes.<br>Calls [`sona_players_placeholder`](../reference.md#sona_players_placeholder). |
| `outfit_check(manifest, maker=None)` | (report dict, OutfitIssue): every issue of a manifest; without a maker the catalogue's checks are left out.<br>Calls [`sona_outfit_check`](../reference.md#sona_outfit_check). |
| `outfit_fix(manifest, maker=None)` | (fixed manifest bytes, report dict after): every error but no_body mended.<br>Calls [`sona_outfit_fix`](../reference.md#sona_outfit_fix). |
| `outfit_clash(a, b, maker=None)` | (SONA_CLASH_* bits, shared slots) by the ids alone, or with a maker by the catalogue too.<br>Calls [`sona_outfit_clash`](../reference.md#sona_outfit_clash). |
| `state_info(blob)` | What a saved state holds, without a context: (info dict, manifest bytes or None).<br>Calls [`sona_state_info_get`](../reference.md#sona_state_info_get). |
| `region_name(region)` | "none", "head", "neck", "torso", "hips", "leftArm", "rightArm", "leftHand", "rightHand", "leftLeg", "rightLeg", "leftFoot", "rightFoot"; NULL past the last.<br>Calls [`sona_region_name`](../reference.md#sona_region_name). |
| `view_ray(view, x, y)` | The ray through (x, y) of the view's picture, pixels from its top left: (origin, unit direction).<br>Calls [`sona_view_ray`](../reference.md#sona_view_ray). |
| `pick_ray(ctx, origin, direction, flags=0, max_distance=0.0, ignore=())` | The nearest hit along the ray, or None.<br>Calls [`sona_pick_ray`](../reference.md#sona_pick_ray). |
| `pick_screen(ctx, view, x, y, flags=0, max_distance=0.0, ignore=())` | The nearest hit under (x, y) of the view's picture, or None.<br>Calls [`sona_pick_screen`](../reference.md#sona_pick_screen). |
| `pick_ray_all(ctx, origin, direction, cap=64, flags=0, max_distance=0.0, ignore=())` | Every avatar the ray hits, its nearest hit each, nearest first (at most cap).<br>Calls [`sona_pick_ray_all`](../reference.md#sona_pick_ray_all). |
| `avatar_pick(avatar, origin, direction, flags=0, max_distance=0.0)` | The ray against one avatar alone, or None.<br>Calls [`sona_avatar_pick`](../reference.md#sona_avatar_pick). |
| `pick_gpu(ctx, renderer, view, x, y, flags=0, max_distance=0.0, ignore=())` | The pick through the id buffer of a renderer (a Headless, or a raw sona_renderer pointer), or None.<br>Calls [`sona_pick_gpu`](../reference.md#sona_pick_gpu). |
| `pick_gpu_ids(ctx, renderer, view, x, y, w, h, flags=0)` | The id buffer of a region of the view's picture: (avatar ids, mesh index + 1) as arrays of w * h, row 0 on top.<br>Calls [`sona_pick_gpu_ids`](../reference.md#sona_pick_gpu_ids). |
| `prop_options(joint="auto", position=(0, 0, 0), rotation=(0, 0, 0, 1), scale=1.0, hidden=False, play=False, once=False, perform=False, body_scale=True, hand=None, hand_position=(0, 0, 0), hand_rotation=None, hand_pole=None, wrist=False, hand_weight=1.0, fade=0.2, speed=1.0, start=0.0)` | A sona_prop_attach.<br>Calls [`sona_prop_attach_defaults`](../reference.md#sona_prop_attach_defaults). |
| `prop_pets()` | The catalogue's pets (the site's pet mode list), as item ids.<br>Calls [`sona_prop_pet_count`](../reference.md#sona_prop_pet_count), [`sona_prop_pet`](../reference.md#sona_prop_pet). |
| `prop_is_pet(item_id)` | 1 when the item id is one of the pets.<br>Calls [`sona_prop_is_pet`](../reference.md#sona_prop_is_pet). |
| `abi()` | The loaded library's ABI: abi, oldest_abi (the oldest a caller may be built against), major, minor, patch.<br>Calls [`sona_abi_query`](../reference.md#sona_abi_query). |
| `emote_from_text(text)` | A sentence to stock clips and a face: dict of clips (SONA_STOCK_* id, weight), speed, confidence, expression (5 parts, 255 leaves one to the clip), and the raw struct for Avatar.emote.<br>Calls [`sona_emote_from_text`](../reference.md#sona_emote_from_text). |
| `tier_defaults()` | size set; target_fps 60, avatars 20.<br>Calls [`sona_tier_defaults`](../reference.md#sona_tier_defaults). |
| `load_library()` | Loads the sona library from SONA_LIB_DIR, then the system's library path. |
| `theme(which="dark", **overrides)` | A theme struct: "dark" or "light", then any field overridden (colours as 0xAARRGGBB).<br>Calls [`sona_editor_theme_defaults`](../reference.md#sona_editor_theme_defaults). |
| `N_error(r)` | Raises SonaError for a failed sona_result of the editor module. |
| `blendshape_name(i)` | The name of blendshape index ("eyeBlinkLeft",...) as both trackers spell them; NULL past the last.<br>Calls [`sona_track_blendshape_name`](../reference.md#sona_track_blendshape_name). |
| `blendshape_find(name)` | The index of a blendshape by name; -1 when unknown.<br>Calls [`sona_track_blendshape_find`](../reference.md#sona_track_blendshape_find). |
| `quat_from_matrix(rows)` | A 3x3 (or the upper left of a 4x4) as rows of floats to (x, y, z, w).<br>Calls [`sona_track_quat_from_matrix`](../reference.md#sona_track_quat_from_matrix). |
| `quat_from_euler(pitch_deg, yaw_deg, roll_deg)` | Degrees, right-handed about the camera axes: pitch about +X (nodding down is positive), yaw about +Y (turning towards the image's right, the subject's own left, is positive), roll about +Z; applied roll, then pitch, then<br>Calls [`sona_track_quat_from_euler`](../reference.md#sona_track_quat_from_euler). |

### SonaError

`class SonaError(Exception)`: code: the sona_result (negative); name: its word ("licence", "gate",...); message; fix.

| Declaration | What it does |
|---|---|
| `__init__(code, message="", fix="")` | Made by the binding when a call returns one; not made by hand. |

### Request

`class Request`: One read in flight.

| Declaration | What it does |
|---|---|
| `__init__(raw)` | Made by the binding when a call returns one; not made by hand. |
| `id()` | The read's id, as the source was given it. |
| `finish(status, data=b"")` | Finishes one read, exactly once, also after cancel; the request stays valid until then.<br>Calls [`sona_complete`](../reference.md#sona_complete). |
| `complete(data)` | Finishes one read, exactly once, also after cancel; the request stays valid until then. |
| `not_found()` | Answers the read: the source has no such file (SONA_E_NOT_FOUND). |
| `failed()` | Answers the read: the source failed and a retry may work (SONA_E_IO). |

### FrameStats

`class FrameStats`: The C type sona_frame_stats.

| Declaration | What it does |
|---|---|
| `__init__(s)` | Made by the binding when a call returns one; not made by hand. |

### SceneStats

`class SceneStats`: The C type sona_scene_stats.

| Declaration | What it does |
|---|---|
| `__init__(s)` | Made by the binding when a call returns one; not made by hand. |

### Event

`class Event`: The C type sona_event.

| Declaration | What it does |
|---|---|
| `__init__(e, avatar)` | Made by the binding when a call returns one; not made by hand. |

### Context

`class Context`: sona.Context(app_id=None, licence=path_or_bytes, sources=("dir", path),...).

| Declaration | What it does |
|---|---|
| `__init__(app_id=None, licence=None, sources=(), worker_threads=None, seed=None, max_avatars=None, build_budget_ms=None, face_size=None, flags=0, budget=None, check_host=None, log=None)` | Made by the binding when a call returns one; not made by hand.<br>Calls [`sona_config_defaults`](../reference.md#sona_config_defaults), [`sona_open`](../reference.md#sona_open). |
| `close()` | Closes a context.<br>Calls [`sona_close`](../reference.md#sona_close). |
| `__enter__()` | Opens a with block; the object is closed when the block ends. |
| `__exit__(*exc)` | Closes the object at the end of a with block. |
| `app_id()` | The app id this context runs as.<br>Calls [`sona_app_id`](../reference.md#sona_app_id). |
| `add(manifest, clip=None, **opts)` | Queues an avatar from its 1000 manifest bytes.<br>Calls [`sona_avatar_add`](../reference.md#sona_avatar_add). |
| `add_base64(text, clip=None, **opts)` | The same, from base64 text of at most 4096 characters, as the web.<br>Calls [`sona_avatar_add_base64`](../reference.md#sona_avatar_add_base64). |
| `add_state(blob, **opts)` | A new avatar with a saved state's look and state.<br>Calls [`sona_avatar_add_state`](../reference.md#sona_avatar_add_state). |
| `add_waiting(clip=None, **opts)` | An avatar whose manifest is not known: QUEUED, a neutral figure while placeholders are on, until Avatar.set_manifest gives it one.<br>Calls [`sona_avatar_add_waiting`](../reference.md#sona_avatar_add_waiting). |
| `update(dt, view=None)` | Advances every avatar by dt seconds, builds, culls and poses.<br>Calls [`sona_update`](../reference.md#sona_update). |
| `events()` | Every waiting event, oldest first.<br>Calls [`sona_poll_event`](../reference.md#sona_poll_event). |
| `clips()` | How many clips the context knows.<br>Calls [`sona_clip_count`](../reference.md#sona_clip_count), [`sona_clip_get`](../reference.md#sona_clip_get). |
| `stats()` | The scene statistics.<br>Calls [`sona_stats`](../reference.md#sona_stats). |
| `shading()` | The fixed shading inputs, or None until the data files load (update and ask again).<br>Calls [`sona_shading_get`](../reference.md#sona_shading_get). |
| `credit(scale=1)` | {"text", "url", "width", "height", "rgba"}: the badge, copied.<br>Calls [`sona_credit_get`](../reference.md#sona_credit_get). |
| `png_encode(rgba, width, height)` | PNG bytes with the web's three tEXt chunks.<br>Calls [`sona_png_encode`](../reference.md#sona_png_encode), [`sona_free`](../reference.md#sona_free). |
| `fit_crowd(view)` | Fits every ready avatar in view (the web's preset "crowd").<br>Calls [`sona_camera_fit_crowd`](../reference.md#sona_camera_fit_crowd). |
| `add_item_preview(item_id, gender=0, slot=0, play=False, colours=None, skin=0, priority=0, time=None, margin=None)` | One item worn alone on a grey stand-in body, framed by its slot.<br>Calls [`sona_item_preview_add`](../reference.md#sona_item_preview_add). |
| `import_clip(anim, key=None, take=None, flags=0, fps=0.0, start=0.0, end=0.0, root_scale=0.0, bone_map=None, tries=600)` | Retargets a take of an AnimFile onto the rig and keeps it here under key (default: the take's name), so avatar.play(key) plays it.<br>Calls [`sona_clip_import`](../reference.md#sona_clip_import). |
| `imported_clips()` | How many clips have been imported into the ctx.<br>Calls [`sona_clip_imported_count`](../reference.md#sona_clip_imported_count), [`sona_clip_imported_get`](../reference.md#sona_clip_imported_get). |
| `remove_imported_clip(key)` | Avatars playing it finish with their own reference; new plays of the key fail with SONA_E_ARGUMENT.<br>Calls [`sona_clip_imported_remove`](../reference.md#sona_clip_imported_remove). |
| `sway_world(gravity=(0, -9.81, 0), wind=(0, 0, 0), gust=0.35, gust_seconds=1.5)` | The gravity and wind every swaying avatar of this ctx feels.<br>Calls [`sona_sway_world_defaults`](../reference.md#sona_sway_world_defaults), [`sona_sway_world_set`](../reference.md#sona_sway_world_set). |
| `set_lod(options=None, **fields)` | Crowd LOD and sprites from the next update.<br>Calls [`sona_lod_set`](../reference.md#sona_lod_set). |
| `lod()` | The LOD options in use, as a sona_lod_options.<br>Calls [`sona_lod_get`](../reference.md#sona_lod_get). |
| `lod_stats()` | The level-of-detail statistics: avatars in view at each step, those fading, the baked looks and the bakes of the last draw.<br>Calls [`sona_lod_stats_get`](../reference.md#sona_lod_stats_get). |
| `set_placeholders(options=None, **fields)` | Loading avatars show a neutral figure until READY (off on a new ctx).<br>Calls [`sona_placeholder_set`](../reference.md#sona_placeholder_set). |
| `placeholders()` | The options in use, as a sona_placeholder_options; None while placeholders are off.<br>Calls [`sona_placeholder_get`](../reference.md#sona_placeholder_get). |
| `placeholders_off()` | Figures shown now fade out over appear_seconds.<br>Calls [`sona_placeholder_off`](../reference.md#sona_placeholder_off). |
| `placeholder_stats()` | Figures in view at the last sona_update (by phase, and how many as sprites), how many were posed and the time that took, and the figure draws of the last sona_draw or sona_snapshot.<br>Calls [`sona_placeholder_stats_get`](../reference.md#sona_placeholder_stats_get). |
| `param_id(name)` | The id of a parameter name, numbered from 0 in the order first asked for; -1 for a bad name or past 32.<br>Calls [`sona_param_id`](../reference.md#sona_param_id). |
| `prop_mesh(parts)` | A prop mesh from triangles.<br>Calls [`sona_prop_part_defaults`](../reference.md#sona_prop_part_defaults), [`sona_prop_mesh_create`](../reference.md#sona_prop_mesh_create). |
| `prop_mesh_load(data=None, path=None, scale=1.0, center=False, textures=True, scene=-1)` | A glTF 2.0 file as a prop mesh, from bytes (data) or a path.<br>Calls [`sona_prop_load_defaults`](../reference.md#sona_prop_load_defaults), [`sona_prop_mesh_open`](../reference.md#sona_prop_mesh_open), [`sona_prop_mesh_load`](../reference.md#sona_prop_mesh_load). |
| `prop_mesh_stock(item_id)` | A stock prop item (a carryable) of the catalogue; its state is "pending" until it has loaded.<br>Calls [`sona_prop_mesh_stock`](../reference.md#sona_prop_mesh_stock). |
| `interaction_layout(kind, a, b=None, **opts)` | Where an interaction would stand its avatars and where the contacts meet, as a dict; None while the avatars (or the stock sit clip) are still loading.<br>Calls [`sona_interaction_layout`](../reference.md#sona_interaction_layout). |
| `interaction(kind, a, b=None, **opts)` | Starts one: kind "hold_hands", "high_five", "handshake", "hug" or "sit" (b may be None).<br>Calls [`sona_interaction_start`](../reference.md#sona_interaction_start). |
| `blend_space(param_x, samples, param_y=None, unsynced=False, smooth_seconds=0.1)` | samples: (clip, x) or (clip, x, y) or (clip, x, y, speed).<br>Calls [`sona_blend_space_defaults`](../reference.md#sona_blend_space_defaults), [`sona_blend_space_create`](../reference.md#sona_blend_space_create). |
| `state_machine(states, transitions=(), initial=None)` | states: dicts with name, clip or blend (a BlendSpace), loop (default True), speed.<br>Calls [`sona_state_machine_defaults`](../reference.md#sona_state_machine_defaults), [`sona_state_machine_create`](../reference.md#sona_state_machine_create). |
| `pixel_art(rgba, width, height, size=32, colours=16, outline=True, thin=False, dither=False, keep_frame=False, outline_colour=0, alpha_cut=0.5, palette=None)` | Crisp pixel art from a straight RGBA8 picture, size pixels tall: (rgba bytes, width, height).<br>Calls [`sona_pixel_art`](../reference.md#sona_pixel_art), [`sona_free`](../reference.md#sona_free). |
| `pixel_palette(pictures, colours=16)` | One palette (0xFFRRGGBB, darkest first) for several (rgba, width, height) pictures.<br>Calls [`sona_pixel_palette`](../reference.md#sona_pixel_palette). |

### Interaction

`class Interaction`: A running interaction (Context.interaction).

| Declaration | What it does |
|---|---|
| `__init__(ctx, raw)` | Made by the binding when a call returns one; not made by hand. |
| `end()` | Begins the end phase: letting go, standing up.<br>Calls [`sona_interaction_end`](../reference.md#sona_interaction_end). |
| `move(position, turn_deg)` | Moves the place (or the seat) while it runs.<br>Calls [`sona_interaction_move`](../reference.md#sona_interaction_move). |
| `status()` | Where an interaction is: its kind and phase, the time in the phase and how far through it, whether the contacts are together, the widest gap at a contact, the clearance between the two bodies (negative: into each other),<br>Calls [`sona_interaction_status_get`](../reference.md#sona_interaction_status_get). |
| `events()` | (kind, phase, time, value) since the last call; kind "start", "contact", "hold", "shake", "release", "end" or "cancel".<br>Calls [`sona_interaction_events`](../reference.md#sona_interaction_events). |
| `remove()` | Stops at once and frees it: its IK targets go, the avatars stay where they are and keep their clip.<br>Calls [`sona_interaction_remove`](../reference.md#sona_interaction_remove). |

### Avatar

`class Avatar`: One avatar.

| Declaration | What it does |
|---|---|
| `__init__(ctx, raw)` | Made by the binding when a call returns one; not made by hand. |
| `id()` | A number unique within the ctx.<br>Calls [`sona_avatar_id`](../reference.md#sona_avatar_id). |
| `state()` | "queued", "loading", "ready", "failed" or "removed".<br>Calls [`sona_avatar_state_of`](../reference.md#sona_avatar_state_of). |
| `ready()` | True once the avatar is built and drawn (sona_avatar_state is READY). |
| `settled()` | True once the avatar is READY or FAILED: nothing more will load for it. |
| `play(clip, loop=True, speed=1.0, start=0.0)` | Plays a clip.<br>Calls [`sona_avatar_play`](../reference.md#sona_avatar_play). |
| `stop()` | Holds the current pose.<br>Calls [`sona_avatar_stop`](../reference.md#sona_avatar_stop). |
| `move(position=(0, 0, 0), turn_deg=0.0, scale=1.0, over_seconds=0.0)` | Moves the avatar to a new placement over over_seconds.<br>Calls [`sona_avatar_move`](../reference.md#sona_avatar_move). |
| `set_visible(visible)` | Shows or hides it.<br>Calls [`sona_avatar_set_visible`](../reference.md#sona_avatar_set_visible). |
| `bounds()` | (centre, radius)<br>Calls [`sona_avatar_bounds`](../reference.md#sona_avatar_bounds). |
| `export(format="vrm", bone_names="unity", name=None, authors=None, licence_url=None, flags=0, thumbnail_png=None)` | The avatar as a.vrm (format "vrm" or "vrm0") or "glb" file: (bytes, report dict).<br>Calls [`sona_export_defaults`](../reference.md#sona_export_defaults), [`sona_export_avatar`](../reference.md#sona_export_avatar), [`sona_free`](../reference.md#sona_free). |
| `save_state(look=True)` | The whole state as a blob (bytes); None before READY.<br>Calls [`sona_avatar_save_state`](../reference.md#sona_avatar_save_state), [`sona_free`](../reference.md#sona_free). |
| `load_state(blob)` | Puts a saved state on at the next update(s), once READY and its clips are loaded.<br>Calls [`sona_avatar_load_state`](../reference.md#sona_avatar_load_state). |
| `puppet(on=True)` | A puppet's clocks stand still: its clip, layers, fades, moves, IK smoothing and idle change only when a state is put on it.<br>Calls [`sona_avatar_puppet`](../reference.md#sona_avatar_puppet). |
| `state_status()` | {"mode": "live" \| "waiting" \| "puppet", "pending", "missing", "applied"}<br>Calls [`sona_avatar_state_status`](../reference.md#sona_avatar_state_status). |
| `remove()` | Removes the avatar and frees what only it used.<br>Calls [`sona_avatar_remove`](../reference.md#sona_avatar_remove). |
| `pose()` | The pose as of the last update; SonaError "not_ready" before READY.<br>Calls [`sona_pose`](../reference.md#sona_pose). |
| `pose_vertices(mesh, space="avatar", normals=False, stride=3)` | CPU skinning of one mesh: (positions, normals or None) as array('f') of vertex_count * stride.<br>Calls [`sona_pose_vertices`](../reference.md#sona_pose_vertices). |
| `camera_preset(preset, view=None)` | Sets the view's eye and target to "full", "upper", "bust" or "face" on this ready avatar.<br>Calls [`sona_camera_preset`](../reference.md#sona_camera_preset). |
| `joint_world(joint)` | A joint's world matrix (16 floats, row-vector, metres, placement applied) at the last update.<br>Calls [`sona_joint_world`](../reference.md#sona_joint_world). |
| `override(joint, rotation, weight=1.0, mode="replace")` | A unit quaternion (x, y, z, w) after the clip: "replace" from the rest orientation, "add" on top of the clip's.<br>Calls [`sona_avatar_override`](../reference.md#sona_avatar_override). |
| `clear_overrides()` | Clears every override of the avatar.<br>Calls [`sona_avatar_clear_overrides`](../reference.md#sona_avatar_clear_overrides). |
| `crossfade(clip, seconds, loop=True, speed=1.0, start=0.0)` | play, blending from the current pose over seconds (0: a cut).<br>Calls [`sona_avatar_crossfade`](../reference.md#sona_avatar_crossfade). |
| `queue(clip, fade=0.0, loop=True, speed=1.0, start=0.0)` | Plays clip when the current one ends.<br>Calls [`sona_avatar_queue`](../reference.md#sona_avatar_queue). |
| `queued()` | How many clips are waiting in the queue.<br>Calls [`sona_avatar_queued`](../reference.md#sona_avatar_queued). |
| `ik_target(limb, position=None, rotation=None, pole=None, joint=None, space="world", wrist=False, weight=1.0, fade=0.2)` | A hand or foot target.<br>Calls [`sona_avatar_ik_target`](../reference.md#sona_avatar_ik_target), [`sona_ik_target_defaults`](../reference.md#sona_ik_target_defaults). |
| `ik_feet(ground="plane", plane=(0, 1, 0, 0), query=None, weight=1.0, max_hips_offset=0.45, max_tilt_deg=35, smoothing=0.1)` | Foot planting.<br>Calls [`sona_avatar_ik_feet`](../reference.md#sona_avatar_ik_feet), [`sona_ik_feet_defaults`](../reference.md#sona_ik_feet_defaults). |
| `ik_ground(foot, point=None, normal=(0, 1, 0))` | POINTS: the ground under "left_foot" or "right_foot" (or 2, 3); point None: no ground there.<br>Calls [`sona_avatar_ik_ground`](../reference.md#sona_avatar_ik_ground). |
| `ik_look(target=None, head=True, eyes=True, weight=1.0, **limits)` | Look at a world point; target None eases back to the clip.<br>Calls [`sona_avatar_ik_look`](../reference.md#sona_avatar_ik_look), [`sona_ik_look_defaults`](../reference.md#sona_ik_look_defaults). |
| `style()` | The avatar's own art style (sona_style; the defaults when it has none).<br>Calls [`sona_avatar_style`](../reference.md#sona_avatar_style). |
| `set_style(kind=None, outline=False, **fields)` | Its own art style: kind "original", "toon", "flat", "silhouette" or "promo" (None: none, the renderer's applies); outline draws an outline; fields: bands, shade, highlight, outline_px, outline_colour, colour (0xAARRGGBB)<br>Calls [`sona_avatar_set_style`](../reference.md#sona_avatar_set_style). |
| `ik_limits(body=True, **fields)` | Joint limits (elbow_max_deg, knee_max_deg, wrist_swing_deg,...); no fields: the defaults.<br>Calls [`sona_ik_limits_defaults`](../reference.md#sona_ik_limits_defaults), [`sona_avatar_ik_limits`](../reference.md#sona_avatar_ik_limits). |
| `ik_clear()` | Every target, the planting and the look-at off at once.<br>Calls [`sona_avatar_ik_clear`](../reference.md#sona_avatar_ik_clear). |
| `set_placeholder(mode)` | Its loading placeholder: -1 follows the ctx, 0 never, 1 always.<br>Calls [`sona_avatar_placeholder`](../reference.md#sona_avatar_placeholder). |
| `placeholder()` | Its loading placeholder now, as a dict: phase, opacity, height, gender, clip, seconds, sprite.<br>Calls [`sona_avatar_placeholder_info`](../reference.md#sona_avatar_placeholder_info). |
| `set_manifest(manifest)` | The manifest of an avatar added with Context.add_waiting, once (1000 bytes or base64 text).<br>Calls [`sona_avatar_set_manifest_base64`](../reference.md#sona_avatar_set_manifest_base64), [`sona_avatar_set_manifest`](../reference.md#sona_avatar_set_manifest). |
| `ik_status()` | What the last pose did, as a dict; None before the avatar was posed with IK on.<br>Calls [`sona_avatar_ik_status`](../reference.md#sona_avatar_ik_status). |
| `prop_attach(mesh, **opts)` | Attaches a PropMesh; returns its id on this avatar.<br>Calls [`sona_avatar_prop_attach`](../reference.md#sona_avatar_prop_attach). |
| `prop_set(prop_id, **opts)` | New placement, flags or hand for an attached prop (each frame for one that moves on the joint).<br>Calls [`sona_avatar_prop_set`](../reference.md#sona_avatar_prop_set). |
| `prop_swap(prop_id, mesh)` | Another mesh in the same place: a sword for a stick, an item for a placeholder.<br>Calls [`sona_avatar_prop_swap`](../reference.md#sona_avatar_prop_swap). |
| `prop_detach(prop_id)` | Takes the prop off at once (its hand's IK target eases off).<br>Calls [`sona_avatar_prop_detach`](../reference.md#sona_avatar_prop_detach). |
| `prop_detach_all()` | Takes every prop off the avatar at once.<br>Calls [`sona_avatar_prop_detach_all`](../reference.md#sona_avatar_prop_detach_all). |
| `props()` | The ids of the avatar's props, in attach order.<br>Calls [`sona_avatar_prop_list`](../reference.md#sona_avatar_prop_list). |
| `prop_frame(prop_id)` | dict: flags ("posed", "ready", "drawn"), joint, time, world and avatar (16 floats, row-vector), hand_error, joints, palette (joints * 12 floats, avatar space).<br>Calls [`sona_avatar_prop_frame`](../reference.md#sona_avatar_prop_frame). |
| `ragdoll(all_capsules=False, rest_pose=False, total_mass=0.0, coverage=0.9, limits=None)` | The 16 bodies fitted to this avatar now, as dicts: joint, parent, shape, colliders, mass and the joint to the parent (frames and limits).<br>Calls [`sona_ragdoll_defaults`](../reference.md#sona_ragdoll_defaults), [`sona_ik_limits_defaults`](../reference.md#sona_ik_limits_defaults), [`sona_avatar_ragdoll`](../reference.md#sona_avatar_ragdoll). |
| `ragdoll_state()` | The bodies at the last pose: position, rotation, velocity and angular_velocity tuples; None before ragdoll.<br>Calls [`sona_avatar_ragdoll_state`](../reference.md#sona_avatar_ragdoll_state). |
| `ragdoll_drive(bodies, weight=1.0, keep_lengths=False)` | The host's bodies onto the avatar: 16 (position, rotation) pairs or ragdoll_state dicts; None stops.<br>Calls [`sona_avatar_ragdoll_drive`](../reference.md#sona_avatar_ragdoll_drive). |
| `ragdoll_release(blend_seconds=0.5)` | Back to the animation: the last drawn ragdoll pose stays where it is in the world and blends into the clip's pose over blend_seconds (smoothstep; 0: at once), turn by turn down the body, so limbs stay joined.<br>Calls [`sona_avatar_ragdoll_release`](../reference.md#sona_avatar_ragdoll_release). |
| `ragdoll_info()` | mode, weight, blend_left, face_up, hips, lowest, getup_position, getup_turn_deg; None before a pose.<br>Calls [`sona_avatar_ragdoll_info`](../reference.md#sona_avatar_ragdoll_info). |
| `ragdoll_clear()` | Off at once: no tracking, no drive, no blend.<br>Calls [`sona_avatar_ragdoll_clear`](../reference.md#sona_avatar_ragdoll_clear). |
| `sway(on=True, parts=None, quality="medium", **fields)` | Hair and cloth sway.<br>Calls [`sona_avatar_sway`](../reference.md#sona_avatar_sway), [`sona_sway_defaults`](../reference.md#sona_sway_defaults). |
| `sway_reset()` | Back to the modelled shape, at rest, at the next pose.<br>Calls [`sona_avatar_sway_reset`](../reference.md#sona_avatar_sway_reset). |
| `sway_info()` | What sways on this avatar and what the last pose did, as a dict; None before READY.<br>Calls [`sona_avatar_sway_info`](../reference.md#sona_avatar_sway_info). |
| `sway_mesh_parts(mesh)` | The SONA_SWAY_* kinds one of sona_pose's meshes sways with; 0 for one that does not, a bad index, or an avatar with sway off or not READY.<br>Calls [`sona_avatar_sway_mesh_parts`](../reference.md#sona_avatar_sway_mesh_parts). |
| `capsule()` | (a, b, radius): a vertical capsule around the posed body, in world space.<br>Calls [`sona_avatar_capsule`](../reference.md#sona_avatar_capsule). |
| `expression(values)` | mouth, left eyebrow, right eyebrow, left eye, right eye: shape indexes, None (or 255) for the clip's.<br>Calls [`sona_avatar_expression`](../reference.md#sona_avatar_expression). |
| `mouth(shape)` | Only the mouth: a SONA_MOUTH_* or shape index, or None (255) to hand it back to the clip.<br>Calls [`sona_avatar_mouth`](../reference.md#sona_avatar_mouth). |
| `voice(state, level, dt)` | Voice chat: a VoiceMouth state for this speaker, its audio level (linear RMS) and the time step.<br>Calls [`sona_avatar_voice`](../reference.md#sona_avatar_voice). |
| `expression_counts()` | (mouths, eyebrows, eyes): how many shapes this face has.<br>Calls [`sona_avatar_expression_counts`](../reference.md#sona_avatar_expression_counts). |
| `clip_events()` | Every clip event since the last call, oldest first.<br>Calls [`sona_avatar_clip_events`](../reference.md#sona_avatar_clip_events). |
| `mark(seconds, mark_id)` | A "mark" clip event with this id each time the current clip passes seconds.<br>Calls [`sona_avatar_mark`](../reference.md#sona_avatar_mark). |
| `clear_marks()` | Removes the avatar's marks.<br>Calls [`sona_avatar_clear_marks`](../reference.md#sona_avatar_clear_marks). |
| `root_motion(mode)` | "off", "extract" (collect the travel for take_root_motion) or "apply" (move the placement by it).<br>Calls [`sona_avatar_root_motion`](../reference.md#sona_avatar_root_motion). |
| `take_root_motion()` | (x, y, z): the travel since the last call, in world metres; clears it.<br>Calls [`sona_avatar_take_root_motion`](../reference.md#sona_avatar_take_root_motion). |
| `lod()` | (step, fade): "full", "sampled", "quarter" or "sprite" at the last update, and mesh (0) to sprite (1).<br>Calls [`sona_avatar_lod`](../reference.md#sona_avatar_lod). |
| `play_stock(clip, fade=0.0, loop=None, speed=1.0, start=0.0)` | A stock clip (a name, an id or a StockClip), the variant for this avatar's body; fade > 0 crossfades.<br>Calls [`sona_avatar_play_stock`](../reference.md#sona_avatar_play_stock). |
| `idle(on=True, parts=None, seed=0, amount=1.0, face_px=240.0)` | The procedural idle: blinks, glances, weight shifts and breathing over any clip.<br>Calls [`sona_avatar_idle`](../reference.md#sona_avatar_idle). |
| `idle_options()` | The idle's options in use (seed resolved); parts 0 when off.<br>Calls [`sona_avatar_idle_get`](../reference.md#sona_avatar_idle_get). |
| `idle_state()` | What the idle gave the last pose: IdleState(blink, gaze, shift, breath).<br>Calls [`sona_avatar_idle_state`](../reference.md#sona_avatar_idle_state). |
| `layer_play(layer, clip, **opts)` | Plays a clip on a layer (0..7).<br>Calls [`sona_avatar_layer_play`](../reference.md#sona_avatar_layer_play). |
| `layer_blend(layer, blend, **opts)` | Plays a blend space of the same ctx on the layer.<br>Calls [`sona_avatar_layer_blend`](../reference.md#sona_avatar_layer_blend). |
| `layer_machine(layer, machine, **opts)` | Runs a state machine of the same ctx on the layer from its initial state (a STATE event with from_state -1).<br>Calls [`sona_avatar_layer_machine`](../reference.md#sona_avatar_layer_machine). |
| `layer_goto(layer, state, fade_seconds=0.2)` | Sends a machine layer to state now, crossfading over fade_seconds.<br>Calls [`sona_avatar_layer_goto`](../reference.md#sona_avatar_layer_goto). |
| `layer_weight(layer, weight, over_seconds=0.0)` | Moves the layer's weight linearly to weight (0..1) over over_seconds; 0 or less sets it at once.<br>Calls [`sona_avatar_layer_weight`](../reference.md#sona_avatar_layer_weight). |
| `layer_mask(layer, mask)` | 72 weights 0..1, or None for every joint.<br>Calls [`sona_avatar_layer_mask`](../reference.md#sona_avatar_layer_mask). |
| `layer_stop(layer, fade_seconds=0.2)` | Fades the layer out over fade_seconds and then empties it (a STOPPED event); 0 empties it now.<br>Calls [`sona_avatar_layer_stop`](../reference.md#sona_avatar_layer_stop). |
| `layer_info(layer)` | The layer now: kind, mode, state (machines, else -1), clip (the sona_clip_get index, -1 for a raw id), weight with fades, time and normalized through the clip or cycle, ready (its clips have loaded) and<br>Calls [`sona_avatar_layer_info`](../reference.md#sona_avatar_layer_info). |
| `layer_events()` | Every layer event since the last call, oldest first.<br>Calls [`sona_avatar_layer_events`](../reference.md#sona_avatar_layer_events). |
| `set_param(param, value)` | Sets one parameter on the avatar; read at the next sona_update.<br>Calls [`sona_avatar_set_param`](../reference.md#sona_avatar_set_param). |
| `set_params(first, values)` | Parameters first..<br>Calls [`sona_avatar_set_params`](../reference.md#sona_avatar_set_params). |
| `param(param)` | A parameter's value; 0 when unset or unknown.<br>Calls [`sona_avatar_param`](../reference.md#sona_avatar_param). |
| `preview_bounds()` | (lo, hi): the item's world box.<br>Calls [`sona_item_preview_bounds`](../reference.md#sona_item_preview_bounds). |
| `preview_view(width, height)` | The framed camera for a width x height picture, as a sona_view.<br>Calls [`sona_item_preview_view`](../reference.md#sona_item_preview_view). |

### ClipEvent

`class ClipEvent`: kind: "started", "looped", "ended", "foot_left", "foot_right" or "mark"; mark: its id; clip: the clips index (-1 for a prop or raw clip); time: seconds into the clip.

| Declaration | What it does |
|---|---|
| `__init__(e)` | Made by the binding when a call returns one; not made by hand. |

### LodStats

`class LodStats`: The C type sona_lod_stats.

| Declaration | What it does |
|---|---|
| `__init__(s)` | Made by the binding when a call returns one; not made by hand. |

### StockClip

`class StockClip`: One stock clip, copied: id (its SONA_STOCK_* number), name, family, asset_id, caption, tags (names), body (1 male, 2 female, 3 both), frames, fps, seconds, same_as (an id or 0).

| Declaration | What it does |
|---|---|
| `__init__(c)` | Made by the binding when a call returns one; not made by hand. |

### IdleState

`class IdleState`: The C type sona_idle_state.

| Declaration | What it does |
|---|---|
| `__init__(s)` | Made by the binding when a call returns one; not made by hand. |

### Item

`class Item`: One catalogue item, copied: guid, id, kind, gender, section (a name), mask, flags, route, colour_set, name, game, type, family, description, subcategory, colour_choices, texture_type, shape_type.

| Declaration | What it does |
|---|---|
| `__init__(i)` | Made by the binding when a call returns one; not made by hand. |

### Catalogue

`class Catalogue`: sona-catalogue.bin, from a path or its bytes.

| Declaration | What it does |
|---|---|
| `__init__(source, ctx=None)` | Made by the binding when a call returns one; not made by hand.<br>Calls [`sona_catalogue_load_memory`](../reference.md#sona_catalogue_load_memory), [`sona_catalogue_load`](../reference.md#sona_catalogue_load). |
| `close()` | Frees it and every string it handed out.<br>Calls [`sona_catalogue_free`](../reference.md#sona_catalogue_free). |
| `__enter__()` | Opens a with block; the object is closed when the block ends. |
| `__exit__(*exc)` | Closes the object at the end of a with block. |
| `__len__()` | Items, sorted by id.<br>Calls [`sona_catalogue_count`](../reference.md#sona_catalogue_count). |
| `get(index)` | One item.<br>Calls [`sona_catalogue_get`](../reference.md#sona_catalogue_get). |
| `__getitem__(index)` | The item at an index (sona_catalogue_get). |
| `__iter__()` | Every item, in the catalogue's order. |
| `find(item)` | The index of an item id (text in any spelling, or a Guid), or -1.<br>Calls [`sona_catalogue_find`](../reference.md#sona_catalogue_find), [`sona_catalogue_find_guid`](../reference.md#sona_catalogue_find_guid). |
| `search(text=None, game=None, slots=0, section=0, gender=0, require=0, exclude=0, offset=0, limit=None)` | (indexes, total): matches in id order, up to limit (None: all) after offset; total counts every match.<br>Calls [`sona_catalogue_search`](../reference.md#sona_catalogue_search). |
| `games()` | (name, items) sorted by name: the games and sources items come from.<br>Calls [`sona_catalogue_game_count`](../reference.md#sona_catalogue_game_count), [`sona_catalogue_game`](../reference.md#sona_catalogue_game). |
| `generated()` | When its data was made, ISO 8601.<br>Calls [`sona_catalogue_generated`](../reference.md#sona_catalogue_generated). |

### FilterChange

`class FilterChange`: One change a filter made: from_id, to_id (None when hidden or for the head's own shape), action ("replaced" or "hidden"), reason (SONA_CONTENT_BY_*), tag (a name or None) and section (a name).

| Declaration | What it does |
|---|---|
| `__init__(c, tag_name)` | Made by the binding when a call returns one; not made by hand. |

### Filter

`class Filter`: Which items a game allows: by section, slot, game, tag, source or item id.

| Declaration | What it does |
|---|---|
| `__init__(catalogue=None, ctx=None)` | Made by the binding when a call returns one; not made by hand.<br>Calls [`sona_filter_create`](../reference.md#sona_filter_create). |
| `close()` | Frees the filter.<br>Calls [`sona_filter_free`](../reference.md#sona_filter_free). |
| `__enter__()` | Opens a with block; the object is closed when the block ends. |
| `__exit__(*exc)` | Closes the object at the end of a with block. |
| `preset(*names)` | "family", "no-logos", "no-licensed".<br>Calls [`sona_filter_preset`](../reference.md#sona_filter_preset). |
| `reset()` | Every rule goes; tags stay.<br>Calls [`sona_filter_reset`](../reference.md#sona_filter_reset). |
| `sections(*sections, allow=False)` | Adds a rule on sections: bits (1u << sona_section).<br>Calls [`sona_filter_sections`](../reference.md#sona_filter_sections). |
| `slots(mask, allow=False)` | Adds a rule on slots (AssetMask bits): an item matches when it covers any of them.<br>Calls [`sona_filter_slots`](../reference.md#sona_filter_slots). |
| `sources(bits, allow=False)` | Adds a rule on where items come from (SONA_CONTENT_STOCK and the other source bits).<br>Calls [`sona_filter_sources`](../reference.md#sona_filter_sources). |
| `game(name, allow=False)` | A game as sona_catalogue_game names it (ASCII case folded).<br>Calls [`sona_filter_game`](../reference.md#sona_filter_game). |
| `tag(name, allow=False)` | A tag by name ("weapon", "logo", or one the host defined).<br>Calls [`sona_filter_tag`](../reference.md#sona_filter_tag). |
| `item(item, allow=False)` | Adds a rule on one item by id.<br>Calls [`sona_filter_item`](../reference.md#sona_filter_item). |
| `load(json_text)` | Rules from JSON ([Content filters](../guides/filters.md)); all or nothing.<br>Calls [`sona_filter_load`](../reference.md#sona_filter_load). |
| `allowed_count()` | Catalogue items allowed.<br>Calls [`sona_filter_allowed_count`](../reference.md#sona_filter_allowed_count). |
| `tags()` | (name, catalogue items carrying it) for every tag.<br>Calls [`sona_filter_tag_name`](../reference.md#sona_filter_tag_name), [`sona_filter_tag_items`](../reference.md#sona_filter_tag_items), [`sona_filter_tag_count`](../reference.md#sona_filter_tag_count). |
| `tag_name(tag)` | NULL past the last.<br>Calls [`sona_filter_tag_name`](../reference.md#sona_filter_tag_name). |
| `define_tag(name)` | A new tag (a name of 1 to 31 bytes of a-z, 0-9 and '-'), or the index of the one of that name.<br>Calls [`sona_filter_tag_define`](../reference.md#sona_filter_tag_define). |
| `set_tag(item, tag, on=True)` | -1 when unknown.<br>Calls [`sona_filter_tag_find`](../reference.md#sona_filter_tag_find), [`sona_filter_tag_set`](../reference.md#sona_filter_tag_set). |
| `item_tags(item)` | The names of an item's tags.<br>Calls [`sona_filter_item_tags`](../reference.md#sona_filter_item_tags). |
| `allows(item)` | 1 when the item is allowed; a NULL filter allows everything.<br>Calls [`sona_filter_allows`](../reference.md#sona_filter_allows). |
| `check(item)` | The verdict: a sona_filter_verdict (allowed, reason, tag, index, section, source, tags).<br>Calls [`sona_filter_check`](../reference.md#sona_filter_check). |
| `search(catalogue, section=0, limit=None)` | (indexes, total) of allowed catalogue items, optionally of one section.<br>Calls [`sona_filter_search`](../reference.md#sona_filter_search). |
| `filter_manifest(manifest)` | (new 1000 bytes, FilterChange): the manifest through the filter; the same bytes when nothing is denied.<br>Calls [`sona_filter_manifest_bytes`](../reference.md#sona_filter_manifest_bytes). |
| `apply_to(ctx)` | Gives ctx a copy: every avatar it reads from then on goes through it.<br>Calls [`sona_ctx_set_filter`](../reference.md#sona_ctx_set_filter). |

### Mesh

`class Mesh`: The runtime vertex, 76 bytes, in host byte order: +0 float3 position (bind pose, avatar space) +12 uint8 x4 joint index * 3 (the palette's float4 row) +16 uint8 x4 weight (sum 255) +20 uint8 x4 normal, (n * 0.5 + 0.5) *  The C type sona_mesh.

| Declaration | What it does |
|---|---|
| `__init__(m)` | Made by the binding when a call returns one; not made by hand. |

### Material

`class Material`: Address modes: bit 0 set = U wraps, bit 1 set = V wraps; clear = clamp. The C type sona_material.

| Declaration | What it does |
|---|---|
| `__init__(m)` | Made by the binding when a call returns one; not made by hand. |

### Texture

`class Texture`: The C type sona_texture.

| Declaration | What it does |
|---|---|
| `__init__(t)` | Made by the binding when a call returns one; not made by hand. |

### Prop

`class Prop`: A prop the avatar holds this frame: its item, palette and whether it plays (sona_prop_palette).

| Declaration | What it does |
|---|---|
| `__init__(p)` | Made by the binding when a call returns one; not made by hand. |

### Pose

`class Pose`: Plain objects over sona_pose_data.

| Declaration | What it does |
|---|---|
| `__init__(ctx, p)` | Made by the binding when a call returns one; not made by hand. |
| `valid()` | False once an update, remove or close has happened since this pose was taken. |

### Manifest

`class Manifest`: An avatar's description (raw: the sona_manifest struct) and its edit verbs: wear, take off, colours, gender, body shape.

| Declaration | What it does |
|---|---|
| `__init__(data)` | Made by the binding when a call returns one; not made by hand.<br>Calls [`sona_manifest_parse`](../reference.md#sona_manifest_parse). |
| `to_bytes()` | The manifest as its 1,000 bytes.<br>Calls [`sona_manifest_write`](../reference.md#sona_manifest_write). |
| `gender()` | Derived: 1 male, 2 female, 0 unknown. The C field sona_manifest.gender (one of the values named in the header). |
| `valid()` | Derived: IsValid. The C field sona_manifest.valid (flag (0 or 1)). |
| `wear(item, colours=(0, 0, 0), flags=0)` | Puts an item on, with its three colours.<br>Calls [`sona_manifest_wear`](../reference.md#sona_manifest_wear). |
| `unwear(slot_mask, flags=0)` | Takes off what is in the slots of slot_mask.<br>Calls [`sona_manifest_unwear`](../reference.md#sona_manifest_unwear). |
| `undress_all()` | Takes everything off.<br>Calls [`sona_manifest_undress_all`](../reference.md#sona_manifest_undress_all). |
| `set_colour(slot, argb)` | Sets one of the nine body colours, by its index in colours.<br>Calls [`sona_manifest_set_colour`](../reference.md#sona_manifest_set_colour). |
| `set_gender(gender, flags=0)` | Sets the gender: 1 male, 2 female.<br>Calls [`sona_manifest_set_gender`](../reference.md#sona_manifest_set_gender). |
| `set_shape(weight, height)` | Sets the weight and height.<br>Calls [`sona_manifest_set_shape`](../reference.md#sona_manifest_set_shape). |
| `ready_for_xbox()` | 1 when the body (and so the gender) is known and the editor's Xbox clean-up would change nothing: the manifest can be saved to Xbox as it is.<br>Calls [`sona_manifest_ready_for_xbox`](../reference.md#sona_manifest_ready_for_xbox). |

### AnimFile

`class AnimFile`: A glTF, FBX or BVH clip file, parsed (no ctx).

| Declaration | What it does |
|---|---|
| `__init__(data=None, path=None, bone_map=None, flags=0, fmt=0)` | Made by the binding when a call returns one; not made by hand.<br>Calls [`sona_anim_file_open`](../reference.md#sona_anim_file_open), [`sona_anim_file_load`](../reference.md#sona_anim_file_load). |
| `takes()` | How many takes (animations) the file holds.<br>Calls [`sona_anim_file_takes`](../reference.md#sona_anim_file_takes), [`sona_anim_file_take`](../reference.md#sona_anim_file_take). |
| `bones()` | (name, parent index or -1, the avatar joint it drives or None) per bone.<br>Calls [`sona_anim_file_bones`](../reference.md#sona_anim_file_bones), [`sona_anim_file_bone`](../reference.md#sona_anim_file_bone). |
| `close()` | Imported clips do not need the file once sona_clip_import returned.<br>Calls [`sona_anim_file_free`](../reference.md#sona_anim_file_free). |

### BlendSpace

`class BlendSpace`: A blend space of one context (Context.blend_space).

| Declaration | What it does |
|---|---|
| `__init__(ctx, raw, n)` | Made by the binding when a call returns one; not made by hand. |
| `weights(x, y=0.0)` | Each sample's weight at (x, y), a list that sums to 1; y is ignored in 1D.<br>Calls [`sona_blend_space_weights`](../reference.md#sona_blend_space_weights). |
| `destroy()` | Lets go of the host's handle.<br>Calls [`sona_blend_space_destroy`](../reference.md#sona_blend_space_destroy). |

### StateMachine

`class StateMachine`: A state machine of one context (Context.state_machine).

| Declaration | What it does |
|---|---|
| `__init__(ctx, raw)` | Made by the binding when a call returns one; not made by hand. |
| `find(state)` | A state's index by name, -1 if unknown.<br>Calls [`sona_state_machine_find`](../reference.md#sona_state_machine_find). |
| `state_name(state)` | A state's name, NULL past the last.<br>Calls [`sona_state_machine_state_name`](../reference.md#sona_state_machine_state_name). |
| `destroy()` | As sona_blend_space_destroy.<br>Calls [`sona_state_machine_destroy`](../reference.md#sona_state_machine_destroy). |

### LayerInfo

`class LayerInfo`: kind: "empty", "clip", "blend" or "machine"; mode: "override" or "additive"; state (machines, else -1); clip; weight; time; normalized; ready; fading.

| Declaration | What it does |
|---|---|
| `__init__(i)` | Made by the binding when a call returns one; not made by hand. |

### LayerEvent

`class LayerEvent`: kind: "started", "looped", "ended", "state" or "stopped"; layer; state and from_state (machines); time.

| Declaration | What it does |
|---|---|
| `__init__(e)` | Made by the binding when a call returns one; not made by hand. |

### LipSyncFrame

`class LipSyncFrame`: One step of the lip sync analysis: time, mouth (SONA_MOUTH_*), open, level in dB, the shape weights, the two formants and flags (sona_lipsync_frame).

| Declaration | What it does |
|---|---|
| `__init__(f)` | Made by the binding when a call returns one; not made by hand. |

### LipSync

`class LipSync`: Audio in, mouths out: feed PCM in any chunks, a frame every 10 ms.

| Declaration | What it does |
|---|---|
| `__init__(sample_rate=48000, channels=1, s16=False)` | Made by the binding when a call returns one; not made by hand.<br>Calls [`sona_lipsync_create`](../reference.md#sona_lipsync_create). |
| `feed(samples)` | frames: samples per channel.<br>Calls [`sona_lipsync_feed`](../reference.md#sona_lipsync_feed). |
| `read()` | The frames made since the last read, oldest first.<br>Calls [`sona_lipsync_read`](../reference.md#sona_lipsync_read). |
| `current()` | The newest frame (a shut mouth before the first).<br>Calls [`sona_lipsync_current`](../reference.md#sona_lipsync_current). |
| `latency()` | Seconds from a sample being fed to the first frame that hears it.<br>Calls [`sona_lipsync_latency`](../reference.md#sona_lipsync_latency). |
| `hint(phonemes)` | (symbol, start, end) tuples a TTS reported, on the fed audio's clock.<br>Calls [`sona_lipsync_hint`](../reference.md#sona_lipsync_hint). |
| `reset()` | Back to time 0: hints and frames waiting to be read are dropped.<br>Calls [`sona_lipsync_reset`](../reference.md#sona_lipsync_reset). |
| `close()` | Frees the analyser.<br>Calls [`sona_lipsync_destroy`](../reference.md#sona_lipsync_destroy). |
| `__enter__()` | Opens a with block; the object is closed when the block ends. |
| `__exit__(*exc)` | Closes the object at the end of a with block. |

### VoiceMouth

`class VoiceMouth`: Voice chat: one speaker's mouth from its audio level alone.

| Declaration | What it does |
|---|---|
| `__init__(seed=0)` | Made by the binding when a call returns one; not made by hand.<br>Calls [`sona_voice_mouth_init`](../reference.md#sona_voice_mouth_init). |
| `step(level, dt)` | (mouth, open) after dt seconds at this level (linear RMS).<br>Calls [`sona_voice_mouth_step`](../reference.md#sona_voice_mouth_step). |

### Headless

`class Headless`: A renderer on the library's own device: the best GPU, or lavapipe or llvmpipe.

| Declaration | What it does |
|---|---|
| `__init__(ctx, device="auto", backend=None, adapter=-1, validation=False, batch_in_flight=8, wait_seconds=60)` | Made by the binding when a call returns one; not made by hand.<br>Calls [`sona_headless_open`](../reference.md#sona_headless_open). |
| `close()` | Frees the renderer and the device.<br>Calls [`sona_headless_close`](../reference.md#sona_headless_close). |
| `__enter__()` | Opens a with block; the object is closed when the block ends. |
| `__exit__(*exc)` | Closes the object at the end of a with block. |
| `style()` | The art style of every avatar without its own; None when the device's backend draws no styles.<br>Calls [`sona_renderer_style`](../reference.md#sona_renderer_style), [`sona_headless_renderer`](../reference.md#sona_headless_renderer). |
| `set_style(kind=None, outline=False, override=False, **fields)` | The art style of every avatar without its own (override: of every avatar); kind None clears it.<br>Calls [`sona_renderer_set_style`](../reference.md#sona_renderer_set_style), [`sona_headless_renderer`](../reference.md#sona_headless_renderer). |
| `info()` | The device it drew on.<br>Calls [`sona_headless_info_get`](../reference.md#sona_headless_info_get). |
| `set_lighting(lighting=None)` | The host's lights from the next picture (lighting_defaults to start from); None: the original look.<br>Calls [`sona_headless_renderer`](../reference.md#sona_headless_renderer), [`sona_renderer_set_lighting`](../reference.md#sona_renderer_set_lighting). |
| `set_environment_sh(sh9=None, skin_red=1.2)` | The lit avatars' environment as 9 RGB SH coefficients of radiance; None: the built-in cube.<br>Calls [`sona_headless_renderer`](../reference.md#sona_headless_renderer), [`sona_renderer_set_environment`](../reference.md#sona_renderer_set_environment), [`sona_environment_defaults`](../reference.md#sona_environment_defaults). |
| `shadow_map()` | The renderer's own shadow map after its last lit picture with shadows (sona_shadow_map), or None.<br>Calls [`sona_renderer_shadow_map`](../reference.md#sona_renderer_shadow_map), [`sona_headless_renderer`](../reference.md#sona_headless_renderer). |
| `render(avatar, **opts)` | One picture of an avatar of the context, alone.<br>Calls [`sona_headless_render`](../reference.md#sona_headless_render). |
| `render_manifest(manifest, **opts)` | Adds the avatar (hidden, standing still or playing clip from time), draws it and removes it.<br>Calls [`sona_headless_render_manifest`](../reference.md#sona_headless_render_manifest). |
| `batch(manifests, **opts)` | A list of (result, rgba bytes or None), one per manifest, in order.<br>Calls [`sona_headless_batch`](../reference.md#sona_headless_batch). |
| `sequence(avatar, frames=0, fps=30.0, turn_deg=0.0, orbit=False, **opts)` | Every frame as bytes: frame i at the clip's start + i / fps, turned turn_deg * i / frames.<br>Calls [`sona_headless_sequence`](../reference.md#sona_headless_sequence). |
| `record(avatar, video, frames=0, fps=30.0, turn_deg=0.0, orbit=False, **opts)` | sona_headless_sequence into a video.<br>Calls [`sona_headless_record`](../reference.md#sona_headless_record). |

### Video

`class Video`: A PNG sequence, GIF, MP4 or WebM.

| Declaration | What it does |
|---|---|
| `__init__(ctx, path, width, height, format="auto", fps=30.0, loops=0, quality=0, background=0xff000000, opaque=False, dither=True, colours=0, ffmpeg=None)` | Made by the binding when a call returns one; not made by hand.<br>Calls [`sona_video_open`](../reference.md#sona_video_open). |
| `frame(rgba)` | One frame of width * height straight RGBA8, row 0 at the top.<br>Calls [`sona_video_frame`](../reference.md#sona_video_frame). |
| `finish()` | Ends the file; the bytes of an in-memory video, else None.<br>Calls [`sona_video_finish`](../reference.md#sona_video_finish), [`sona_free`](../reference.md#sona_free). |

### PlayerLook

`class PlayerLook`: state ("waiting", "fresh", "stale", "private", "none"), manifest (bytes to add), placeholder, version, name, error (a sona_result word, "" when the last check worked), fetched_at, checked_at, next_check (clock seconds).

| Declaration | What it does |
|---|---|
| `__init__(raw)` | Made by the binding when a call returns one; not made by hand. |

### PlayerEvent

`class PlayerEvent`: kind ("look", "gone", "failed"), id (as watched), code (a sona_result word, "" for ok).

| Declaration | What it does |
|---|---|
| `__init__(raw)` | Made by the binding when a call returns one; not made by hand. |

### Players

`class Players`: Friends, lobby members and leaderboard rows by id (a gamertag, "a:<account>/<slot>", "w:<case key>").

| Declaration | What it does |
|---|---|
| `__init__(host=None, client=None, cache_dir=None, placeholder=None, max_players=0, refresh_s=0, per_hour=0, in_flight=0, timeout_ms=0)` | Made by the binding when a call returns one; not made by hand.<br>Calls [`sona_players_defaults`](../reference.md#sona_players_defaults), [`sona_players_open`](../reference.md#sona_players_open). |
| `watch(ids, priority=0)` | Returns "ok", or the word of the first problem ("argument" for a string that is not an id, "limit").<br>Calls [`sona_players_watch`](../reference.md#sona_players_watch). |
| `unwatch(ids=None)` | Stops asking; looks stay cached.<br>Calls [`sona_players_unwatch`](../reference.md#sona_players_unwatch). |
| `refresh(ids=None)` | Asks again now, inside the limits.<br>Calls [`sona_players_refresh`](../reference.md#sona_players_refresh). |
| `update()` | Each frame: takes answers, sends due requests, writes the cache file (at most every 2 s).<br>Calls [`sona_players_update`](../reference.md#sona_players_update). |
| `poll()` | Every event waiting, oldest first; an empty list when there are none.<br>Calls [`sona_players_poll`](../reference.md#sona_players_poll). |
| `look(player_id)` | Always fills out with a look to draw (the placeholder when nothing is known).<br>Calls [`sona_players_look`](../reference.md#sona_players_look). |
| `forget(player_id)` | Drops the id's look from memory and, at the next write, from the cache file, and stops watching it.<br>Calls [`sona_players_forget`](../reference.md#sona_players_forget). |
| `stats()` | Looks kept, ids watched, requests in flight and due, and counts since open: requests, changed, the same, 304s, gone, failed, read from disk, disk writes, waits for per_hour; paused_until.<br>Calls [`sona_players_stats_get`](../reference.md#sona_players_stats_get). |
| `close()` | Writes the cache file when it changed; answers still in flight are dropped.<br>Calls [`sona_players_close`](../reference.md#sona_players_close). |
| `__enter__()` | Opens a with block; the object is closed when the block ends. |
| `__exit__(*exc)` | Closes the object at the end of a with block. |

### OutfitIssue

`class OutfitIssue`: The C type sona_outfit_issue.

| Declaration | What it does |
|---|---|
| `__init__(i)` | Made by the binding when a call returns one; not made by hand.<br>Calls [`sona_outfit_issue_name`](../reference.md#sona_outfit_issue_name). |

### Maker

`class Maker`: A catalogue's outfit rules, indexed once: seeded random avatars, dress like, clashes, matched sets and the outfit check.

| Declaration | What it does |
|---|---|
| `__init__(catalogue, ctx=None)` | Made by the binding when a call returns one; not made by hand.<br>Calls [`sona_maker_create`](../reference.md#sona_maker_create). |
| `close()` | Frees the maker.<br>Calls [`sona_maker_free`](../reference.md#sona_maker_free). |
| `__enter__()` | Opens a with block; the object is closed when the block ends. |
| `__exit__(*exc)` | Closes the object at the end of a with block. |
| `random(seed, body=0, style="any", palette="natural", flags=0, require=0, exclude=0, skip_sections=0, game=None, tag=None, base=None, skin=None, hair=None, eyes=None, available=None)` | (manifest bytes, report dict): a seeded random avatar.<br>Calls [`sona_random_defaults`](../reference.md#sona_random_defaults), [`sona_make_random`](../reference.md#sona_make_random). |
| `dress_like(body, like, parts=0, match=N.SONA_MATCH_SIMILAR, layer=False, available=None)` | (manifest bytes, report dict): body wearing like's parts (SONA_LIKE_* bits; 0: clothes and props).<br>Calls [`sona_like_defaults`](../reference.md#sona_like_defaults), [`sona_make_dress_like`](../reference.md#sona_make_dress_like). |
| `variant(item, body, match=N.SONA_MATCH_SIMILAR)` | (outcome, item id or None): what body (1 or 2) wears for item.<br>Calls [`sona_make_variant`](../reference.md#sona_make_variant). |
| `clash(a, b)` | (SONA_CLASH_* bits, the slots they share). |
| `conflicts(manifest, item)` | The ids wearing item would take off manifest.<br>Calls [`sona_outfit_conflicts`](../reference.md#sona_outfit_conflicts). |
| `sets()` | Every matched set: dicts of index, name, game, title, count, bodies, sections, slots.<br>Calls [`sona_outfit_set_count`](../reference.md#sona_outfit_set_count), [`sona_outfit_set_get`](../reference.md#sona_outfit_set_get). |
| `set_of(item)` | The matched set an item is in, or -1.<br>Calls [`sona_outfit_set_of`](../reference.md#sona_outfit_set_of). |
| `set_items(index, body=0)` | Catalogue indexes of a set's items a body wears (0: all).<br>Calls [`sona_outfit_set_items`](../reference.md#sona_outfit_set_items). |
| `check(manifest)` | (report dict, OutfitIssue) errors first. |
| `fix(manifest)` | (fixed manifest bytes, report dict after). |

### NetSender

`class NetSender`: One avatar's stream to one receiver: write a packet each tick, ack what comes back.

| Declaration | What it does |
|---|---|
| `__init__(ctx, tick_hz=30, history=64, full_after=0)` | Made by the binding when a call returns one; not made by hand.<br>Calls [`sona_net_sender_create`](../reference.md#sona_net_sender_create). |
| `look(id=None)` | None: the avatar's manifest goes along; else this id (a gamertag, a player id).<br>Calls [`sona_net_sender_look`](../reference.md#sona_net_sender_look). |
| `write(avatar, tick)` | One packet of a's state at tick, coded against the newest acknowledged tick (or full).<br>Calls [`sona_net_write`](../reference.md#sona_net_write). |
| `ack(tick)` | The receiver holds tick.<br>Calls [`sona_net_ack`](../reference.md#sona_net_ack). |
| `stats()` | Packets and bytes written, those without a baseline (full), the last packet's size and the newest acknowledged tick.<br>Calls [`sona_net_sender_stats`](../reference.md#sona_net_sender_stats). |
| `close()` | Frees the sender.<br>Calls [`sona_net_sender_destroy`](../reference.md#sona_net_sender_destroy). |

### NetReceiver

`class NetReceiver`: The receiving end: read each packet (send back what it returns), drive a puppet at any tick.

| Declaration | What it does |
|---|---|
| `__init__(ctx, tick_hz=30, history=64, full_after=0)` | Made by the binding when a call returns one; not made by hand.<br>Calls [`sona_net_receiver_create`](../reference.md#sona_net_receiver_create). |
| `read(packet)` | The tick to acknowledge; raises SonaError ("not_found" when its baseline is no longer held).<br>Calls [`sona_net_read`](../reference.md#sona_net_read). |
| `look()` | None before a look arrived; else ("manifest", bytes) or ("id", str).<br>Calls [`sona_net_receiver_look`](../reference.md#sona_net_receiver_look). |
| `drive(avatar, tick)` | Shows tick on a, which becomes a puppet: a held tick as it is, a fraction between two held ticks as their blend, before the oldest the oldest, past the newest the newest.<br>Calls [`sona_net_drive`](../reference.md#sona_net_drive). |
| `stats()` | Packets and bytes read, packets refused for want of a baseline (full), the newest and oldest ticks held.<br>Calls [`sona_net_receiver_stats`](../reference.md#sona_net_receiver_stats). |
| `close()` | Frees the receiver.<br>Calls [`sona_net_receiver_destroy`](../reference.md#sona_net_receiver_destroy). |

### Recorder

`class Recorder`: Avatars' states each tick into one replay file; keep_seconds > 0 keeps only about the last seconds.

| Declaration | What it does |
|---|---|
| `__init__(ctx, tick_hz=30, keyframe_ticks=0, keep_seconds=0.0)` | Made by the binding when a call returns one; not made by hand.<br>Calls [`sona_record_defaults`](../reference.md#sona_record_defaults), [`sona_recorder_create`](../reference.md#sona_recorder_create). |
| `track(avatar, name=None)` | Records the avatar from the next capture on, under name if given; returns its track number.<br>Calls [`sona_recorder_track`](../reference.md#sona_recorder_track). |
| `capture(tick)` | Every track's state at tick (rising).<br>Calls [`sona_recorder_capture`](../reference.md#sona_recorder_capture). |
| `save()` | The file's bytes, freed with sona_free.<br>Calls [`sona_recorder_save`](../reference.md#sona_recorder_save), [`sona_free`](../reference.md#sona_free). |
| `close()` | Frees the recorder and what it captured.<br>Calls [`sona_recorder_destroy`](../reference.md#sona_recorder_destroy). |

### Replay

`class Replay`: A recording: drive(track, avatar, seconds) at any time, in any order.

| Declaration | What it does |
|---|---|
| `__init__(ctx, data)` | Made by the binding when a call returns one; not made by hand.<br>Calls [`sona_replay_open`](../reference.md#sona_replay_open). |
| `info()` | The replay's tracks, tick rate, first and last tick, the captures it holds and its length in seconds.<br>Calls [`sona_replay_info_get`](../reference.md#sona_replay_info_get). |
| `track(track)` | (manifest bytes, name, from seconds, to seconds)<br>Calls [`sona_replay_track`](../reference.md#sona_replay_track). |
| `drive(track, avatar, seconds)` | Shows the track at seconds from the replay's start on a, which becomes a puppet, blending the two frames around it.<br>Calls [`sona_replay_drive`](../reference.md#sona_replay_drive). |
| `close()` | Frees the replay.<br>Calls [`sona_replay_close`](../reference.md#sona_replay_close). |

### PickHit

`class PickHit`: One pick: the avatar (an Avatar of its context), the item, mesh and triangle, the joint and body region, where.

| Declaration | What it does |
|---|---|
| `__init__(h, ctx)` | Made by the binding when a call returns one; not made by hand.<br>Calls [`sona_region_name`](../reference.md#sona_region_name). |

### PropMesh

`class PropMesh`: A prop mesh of one context (Context.prop_mesh, prop_mesh_load, prop_mesh_stock).

| Declaration | What it does |
|---|---|
| `__init__(ctx, raw)` | Made by the binding when a call returns one; not made by hand. |
| `state()` | "ready", "pending", or the failure's code name.<br>Calls [`sona_prop_mesh_state`](../reference.md#sona_prop_mesh_state). |
| `info()` | dict: kind ("host" or "stock"), parts, vertices, triangles, textures, joints, hand, joint, lo, hi, seconds, item, pet, clip, untextured; None while pending.<br>Calls [`sona_prop_mesh_info_get`](../reference.md#sona_prop_mesh_info_get). |
| `meshes()` | The data API's Mesh objects of the prop (joint bytes index the prop frame's palette).<br>Calls [`sona_prop_mesh_data`](../reference.md#sona_prop_mesh_data). |
| `release()` | The host's reference goes; avatars it is attached to keep it until they detach it.<br>Calls [`sona_prop_mesh_release`](../reference.md#sona_prop_mesh_release). |

### Control

`class Control`: One control of the editor's screen: its role, place, text and value (sona_editor_control).

| Declaration | What it does |
|---|---|
| `__init__(c)` | Made by the binding when a call returns one; not made by hand. |

### Editor

`class Editor`: The C type sona_editor.

| Declaration | What it does |
|---|---|
| `__init__(ctx, catalogue, mode="full", start=None, theme_=None, theme="dark", width=1280, height=720, seed=1, flags=0, title=None, filter=None, look=None, sound=None)` | Made by the binding when a call returns one; not made by hand.<br>Calls [`sona_editor_defaults`](../reference.md#sona_editor_defaults), [`sona_editor_open`](../reference.md#sona_editor_open). |
| `close()` | Removes its avatars from the ctx.<br>Calls [`sona_editor_close`](../reference.md#sona_editor_close). |
| `button(code, down)` | A gamepad button pressed or let go (sona_editor_input). |
| `press(code, dt=1.0 / 60)` | Down, a frame, up, a frame. |
| `axis(code, value)` | A gamepad axis moved, -1 to 1 (sona_editor_input). |
| `key(code, mods=0)` | A key pressed, with modifier bits (sona_editor_input). |
| `text(s)` | Typed text, for the search box (sona_editor_input). |
| `pointer(x, y, down, pointer=0)` | down: True pressed, False released, None moved. |
| `wheel(lines, x, y)` | A mouse wheel turned at a point, in lines (sona_editor_input). |
| `update(dt)` | Advances dt seconds: stick repeat, animations, avatar builds and (unless HOST_UPDATES) sona_update on the ctx.<br>Calls [`sona_editor_update`](../reference.md#sona_editor_update). |
| `status()` | SONA_EDITOR_RUNNING, _DONE or _CANCELLED, as the last sona_editor_update returned.<br>Calls [`sona_editor_status`](../reference.md#sona_editor_status). |
| `result()` | The avatar as it stands (at any time): SONA_MANIFEST_BYTES.<br>Calls [`sona_editor_result`](../reference.md#sona_editor_result). |
| `busy()` | 1 while an avatar is still building (the shown one or a change on its way); thumbnails do not count.<br>Calls [`sona_editor_busy`](../reference.md#sona_editor_busy). |
| `build_failures()` | How many avatar builds failed since open (the screen reader is told each time).<br>Calls [`sona_editor_build_failures`](../reference.md#sona_editor_build_failures). |
| `undo(redo=False)` | Undoes the last change (redo 0) or redoes the last undone one (redo 1), for a host that draws the stage's own undo and redo buttons.<br>Calls [`sona_editor_undo`](../reference.md#sona_editor_undo). |
| `can_undo(redo=False)` | 1 when sona_editor_undo with the same redo would step: use it to grey out the buttons.<br>Calls [`sona_editor_can_undo`](../reference.md#sona_editor_can_undo). |
| `zoom(set=0.0)` | The stage's zoom: 1 is the editor's own framing, from 0.6 to 3.<br>Calls [`sona_editor_zoom`](../reference.md#sona_editor_zoom). |
| `turn(degrees)` | Turns the avatar on the stage by degrees, as a drag across the stage does.<br>Calls [`sona_editor_turn`](../reference.md#sona_editor_turn). |
| `screen()` | The screen shown now.<br>Calls [`sona_editor_screen_get`](../reference.md#sona_editor_screen_get). |
| `screens()` | The mode's screens in tab order, by name.<br>Calls [`sona_editor_screens`](../reference.md#sona_editor_screens). |
| `set_screen(name)` | Moves to a screen of the mode (a deprecated id to the screen that took its place).<br>Calls [`sona_editor_set_screen`](../reference.md#sona_editor_set_screen). |
| `set_search(text)` | The search box of the wardrobe and the item screens, for hosts with an on-screen keyboard (UTF-8; NULL clears).<br>Calls [`sona_editor_set_search`](../reference.md#sona_editor_set_search). |
| `set_theme(which="dark", **overrides)` | Changes the colours and sizes from the next frame.<br>Calls [`sona_editor_set_theme`](../reference.md#sona_editor_set_theme). |
| `resize(width, height)` | The editor's size in pixels, the size of the target it is drawn into.<br>Calls [`sona_editor_resize`](../reference.md#sona_editor_resize). |
| `controls()` | Every control on screen, in reading order, and the focused one.<br>Calls [`sona_editor_control_count`](../reference.md#sona_editor_control_count), [`sona_editor_control_get`](../reference.md#sona_editor_control_get). |
| `focus()` | SONA_E_NOT_FOUND when nothing has focus (pointer-only use).<br>Calls [`sona_editor_focus_get`](../reference.md#sona_editor_focus_get). |
| `announcement()` | What a screen reader should say since the last call ("Wardrobe, tab, 6 of 6"), or None.<br>Calls [`sona_editor_announcement`](../reference.md#sona_editor_announcement). |
| `draw_data()` | (vertices, indices, commands, avatar_rect): vertices as (x, y, u, v, (r, g, b, a)); commands as (texture, first_index, index_count, clip).<br>Calls [`sona_editor_draw_data_get`](../reference.md#sona_editor_draw_data_get). |
| `texture(which)` | (width, height, revision, rgba bytes) of TEXTURE_ATLAS or TEXTURE_THUMBS.<br>Calls [`sona_editor_texture_get`](../reference.md#sona_editor_texture_get). |
| `render_ui(width=None, height=None, under=None)` | The UI layer as RGBA bytes; under: RGBA bytes of the same size to draw it over (an avatar snapshot).<br>Calls [`sona_editor_draw_data_get`](../reference.md#sona_editor_draw_data_get), [`sona_editor_render_ui`](../reference.md#sona_editor_render_ui). |

### State

`class State`: The C type sona_state_desc.

| Declaration | What it does |
|---|---|
| `__init__(s)` | Made by the binding when a call returns one; not made by hand. |

### Tracker

`class Tracker`: The C type sona_tracker.

| Declaration | What it does |
|---|---|
| `__init__(mirror=False, no_head=False, no_face=False, no_gaze=False, **options)` | Made by the binding when a call returns one; not made by hand.<br>Calls [`sona_track_defaults`](../reference.md#sona_track_defaults), [`sona_track_create`](../reference.md#sona_track_create). |
| `close()` | Frees the tracker.<br>Calls [`sona_track_destroy`](../reference.md#sona_track_destroy). |
| `feed(time, scores=None, head=None, layout="mediapipe")` | scores: 52 floats in the layout's order, None when the camera saw no face.<br>Calls [`sona_track_face_input_defaults`](../reference.md#sona_track_face_input_defaults), [`sona_track_face_feed`](../reference.md#sona_track_face_feed). |
| `state()` | What the tracker makes of the frames so far: the filtered, calibrated weights in ARKit order (sides swapped under SONA_TRACK_MIRROR, so Left is the avatar's left) and the head.<br>Calls [`sona_track_face_get`](../reference.md#sona_track_face_get). |
| `calibrate_begin()` | Starts collecting a neutral face: every frame with a face from now on counts.<br>Calls [`sona_track_calibrate_begin`](../reference.md#sona_track_calibrate_begin). |
| `calibrate_end()` | The calibration as bytes, to save and hand back to calibration_set in a later session.<br>Calls [`sona_track_calibrate_end`](../reference.md#sona_track_calibrate_end). |
| `calibration_set(blob=None)` | A saved calibration, for the next session; NULL clears it.<br>Calls [`sona_track_calibration_set`](../reference.md#sona_track_calibration_set). |
| `reset()` | Forgets the filters, the shapes held and the tracking state; keeps the options and the calibration.<br>Calls [`sona_track_reset`](../reference.md#sona_track_reset). |
| `apply(avatar)` | Puts the state on a sona.Avatar; False until it is ready and posed.<br>Calls [`sona_track_apply`](../reference.md#sona_track_apply). |
| `release(avatar)` | Hands the face and the tracker's joints back to the clip; nothing when a is not the avatar it drives.<br>Calls [`sona_track_release`](../reference.md#sona_track_release). |

### Types

| Declaration | What it does |
|---|---|
| `class sona_editor_options(Structure)` | The C type sona_editor_options, field for field. |
| `class sona_editor_theme(Structure)` | Colours are 0xAARRGGBB, straight alpha. The C type sona_editor_theme, field for field. |
| `class sona_editor_input(Structure)` | The C type sona_editor_input, field for field. |
| `class sona_editor_control(Structure)` | The C type sona_editor_control, field for field. |
| `class sona_editor_vertex(Structure)` | The C type sona_editor_vertex, field for field. |
| `class sona_editor_command(Structure)` | Blend with SRC_ALPHA, ONE_MINUS_SRC_ALPHA (straight alpha), no depth, the scissor at clip. The C type sona_editor_command, field for field. |
| `class sona_editor_draw_data(Structure)` | The C type sona_editor_draw_data, field for field. |
| `class sona_editor_texture(Structure)` | The C type sona_editor_texture, field for field. |
| `class sona_track_options(Structure)` | The C type sona_track_options, field for field. |
| `class sona_track_face_input(Structure)` | One frame of a face tracker. The C type sona_track_face_input, field for field. |
| `class sona_track_face_state(Structure)` | What the tracker makes of the frames so far. The C type sona_track_face_state, field for field. |
| `class sona_track_calibration(Structure)` | Neutral face. The C type sona_track_calibration, field for field. |

## Rust

557 public names in `bindings/rust/sona/src/lib.rs`, `bindings/rust/sona-editor/src/lib.rs`.

### Functions and constants

| Declaration | What it does |
|---|---|
| `const MANIFEST_BYTES: usize = sys::SONA_MANIFEST_BYTES` | The value of SONA_MANIFEST_BYTES: an AvatarDescription |
| `const JOINTS: usize = sys::SONA_JOINTS` | The value of SONA_JOINTS: palette slots; the avatar rig animates 71 |
| `const PALETTE_FLOATS: usize = sys::SONA_PALETTE_FLOATS` | The value of SONA_PALETTE_FLOATS: 72 joints x 3 float4 |
| `const VERTEX_STRIDE: usize = sys::SONA_VERTEX_STRIDE` | The value of SONA_VERTEX_STRIDE: the runtime vertex, see sona_mesh |
| `fn version() -> &'static str` | The library's version, "1.1.0".<br>Calls [`sona_version`](../reference.md#sona_version). |
| `fn platform() -> &'static str` | The binary platform id compiled into the library: "linux-x64", "windows-x64",...<br>Calls [`sona_platform`](../reference.md#sona_platform). |
| `fn check_layout() -> Result<usize>` | Compares every struct size and field offset sona360-sys mirrors with the library's own tables. |
| `fn interaction_defaults(kind: u32) -> sys::sona_interaction_desc` | A desc for one kind (sona_sys::SONA_INTERACT_*) with its timings and a default seat.<br>Calls [`sona_interaction_defaults`](../reference.md#sona_interaction_defaults). |
| `fn seat_defaults(kind: u32) -> sys::sona_seat` | size set and a seat of that kind: height 0.45 (0 for GROUND), depth 0.45 (unlimited for GROUND), width 0.5 for a chair, 1.4 for a bench and unlimited on the ground.<br>Calls [`sona_seat_defaults`](../reference.md#sona_seat_defaults). |
| `fn interaction_layout(desc: &sys::sona_interaction_desc) -> Result<sys::sona_interaction_plan>` | Where the interaction would stand its avatars and where the contacts meet.<br>Calls [`sona_interaction_layout`](../reference.md#sona_interaction_layout). |
| `fn skeleton_bone(skeleton: Skeleton, joint: u32) -> Option<&'static str>` | The bone a joint is in that skeleton; None for a joint it has none for.<br>Calls [`sona_skeleton_bone`](../reference.md#sona_skeleton_bone). |
| `fn skeleton_joint(skeleton: Skeleton, bone: &str) -> Option<u32>` | The joint a bone of that skeleton is.<br>Calls [`sona_skeleton_joint`](../reference.md#sona_skeleton_joint). |
| `fn joint_find(name: &str) -> Option<u32>` | A joint by name: "Hips", "Head", "PropRight", "shape_04", "joint_33".<br>Calls [`sona_joint_find`](../reference.md#sona_joint_find). |
| `fn joint_name(joint: u32) -> Option<&'static str>` | None past the last joint.<br>Calls [`sona_joint_name`](../reference.md#sona_joint_name). |
| `fn ik_target_defaults() -> sys::sona_ik_target` | The defaults Context::set_lod uses for None.<br>Calls [`sona_ik_target_defaults`](../reference.md#sona_ik_target_defaults). |
| `fn ik_feet_defaults() -> sys::sona_ik_feet` | SONA_IK_GROUND_PLANE with the plane y = 0, weight 1, hips offset at most 0.45 m, tilt at most 35 degrees, and the smoothing a default of 0.1 s.<br>Calls [`sona_ik_feet_defaults`](../reference.md#sona_ik_feet_defaults). |
| `fn ik_look_defaults() -> sys::sona_ik_look` | Its defaults are head and eyes, weight 1, yaw 70, up 35, down 45 degrees, smoothing by default 0.15 s, a turn rate of 360 degrees a second, eyes past 10.<br>Calls [`sona_ik_look_defaults`](../reference.md#sona_ik_look_defaults). |
| `fn ik_limits_defaults() -> sys::sona_ik_limits` | Elbows 145, knees 150, wrists 75 swing and 80 twist, ankles 45 and 30 degrees, hips 120 forward, 25 behind, 45 out and 25 in, shoulders 45 behind (held level) and 50 across, reach easing from 0.97, a 0.02 m body margin,<br>Calls [`sona_ik_limits_defaults`](../reference.md#sona_ik_limits_defaults). |
| `fn ragdoll_defaults() -> sys::sona_ragdoll_options` | size set; coverage 0.9.<br>Calls [`sona_ragdoll_defaults`](../reference.md#sona_ragdoll_defaults). |
| `fn sway_defaults() -> sys::sona_sway` | Parts SONA_SWAY_DEFAULT, medium quality, stiffness and damping 0.5, wind scale 1, 48 minimum pixels.<br>Calls [`sona_sway_defaults`](../reference.md#sona_sway_defaults). |
| `fn sway_world_defaults() -> sys::sona_sway_world` | Gravity 0 -9.81 0, no wind, gust 0.35 with a period of 1.5 s.<br>Calls [`sona_sway_world_defaults`](../reference.md#sona_sway_world_defaults). |
| `fn lod_defaults() -> LodOptions` | The level-of-detail defaults, with sprites on at 48 px.<br>Calls [`sona_lod_defaults`](../reference.md#sona_lod_defaults). |
| `fn placeholder_defaults() -> sys::sona_placeholder_options` | The loading placeholders' defaults (sona.h 3.8d).<br>Calls [`sona_placeholder_defaults`](../reference.md#sona_placeholder_defaults). |
| `fn preview_defaults() -> PreviewOptions` | Fills the defaults above.<br>Calls [`sona_preview_defaults`](../reference.md#sona_preview_defaults). |
| `fn stock_clip_count() -> u32` | The clips in the library: 100 (SONA_STOCK_CLIP_COUNT).<br>Calls [`sona_stock_clip_count`](../reference.md#sona_stock_clip_count). |
| `fn stock_clip(id: u32) -> Option<StockClip>` | The clip with this id (SONA_STOCK_*: bytes 4 to 7 of its asset id).<br>Calls [`sona_stock_clip_get`](../reference.md#sona_stock_clip_get). |
| `fn stock_clip_at(index: u32) -> Option<StockClip>` | The clip at index, in id order.<br>Calls [`sona_stock_clip_at`](../reference.md#sona_stock_clip_at). |
| `fn stock_clip_find(name: &str) -> Option<u32>` | By name ("wave"), asset id or a key of Context::clips ("GenericWave").<br>Calls [`sona_stock_clip_find`](../reference.md#sona_stock_clip_find). |
| `fn stock_clip_for_body(id: u32, body: u32) -> u32` | The clip of id's family made for body (1 male, 2 female).<br>Calls [`sona_stock_clip_for_body`](../reference.md#sona_stock_clip_for_body). |
| `fn stock_clips_tagged(all: u32, none: u32, body: u32) -> Vec<StockClip>` | Clips with every tag of all and none of none that suit body (0 any, 1 male, 2 female), by id.<br>Calls [`sona_stock_clips_tagged`](../reference.md#sona_stock_clips_tagged). |
| `fn clip_tag_name(tag: u32) -> Option<&'static str>` | The name of one tag bit ("idle", "travel",...); NULL for 0, several bits or an unknown bit.<br>Calls [`sona_clip_tag_name`](../reference.md#sona_clip_tag_name). |
| `fn clip_tag_find(name: &str) -> u32` | The bit for a tag name; 0 when none.<br>Calls [`sona_clip_tag_find`](../reference.md#sona_clip_tag_find). |
| `fn idle_defaults() -> IdleOptions` | size set, parts SONA_IDLE_ALL, seed 0, amount 1, face_px 240.<br>Calls [`sona_idle_defaults`](../reference.md#sona_idle_defaults). |
| `fn idle_sample(o: &IdleOptions, seconds: f64) -> Result<IdleState>` | The idle's channels at seconds for o.seed and o.parts, before amount.<br>Calls [`sona_idle_sample`](../reference.md#sona_idle_sample). |
| `fn pixel_defaults() -> PixelOptions` | size set, height 32, colours 16, flags SONA_PIXEL_OUTLINE, outline 0 (from the palette), alpha_cut 0.5, no palette.<br>Calls [`sona_pixel_defaults`](../reference.md#sona_pixel_defaults). |
| `fn sticker_defaults() -> StickerOptions` | size set, pixels 512, time -1, framing SONA_PRESET_FULL, outline_px 10, outline 0xffffffff, shadow 0x59000000 (off while shadow_px is 0), padding 8.<br>Calls [`sona_sticker_defaults`](../reference.md#sona_sticker_defaults). |
| `fn sheet_defaults() -> SheetOptions` | size set, 8 frames, 8 directions, px_per_metre 64, padding 2, max_page 4096, draw_flags SONA_DRAW_NO_BLOOM; every other field 0 (the whole clip, facing the camera first, side on, orthographic, packed and trim<br>Calls [`sona_sheet_defaults`](../reference.md#sona_sheet_defaults). |
| `fn style_defaults() -> Style` | Style with its size set: the original look, no outline.<br>Calls [`sona_style_defaults`](../reference.md#sona_style_defaults). |
| `fn quality_defaults() -> Quality` | The web SDK's: automatic MSAA, MIPS \| CUTOUT_MIPS.<br>Calls [`sona_quality_defaults`](../reference.md#sona_quality_defaults). |
| `fn lighting_defaults() -> Lighting` | A key and fill switched off, the built-in environment, a fitted shadow map.<br>Calls [`sona_lighting_defaults`](../reference.md#sona_lighting_defaults). |
| `fn environment_defaults() -> sys::sona_environment` | size set; kind BUILTIN, skin_red 1.2 (the built-in's).<br>Calls [`sona_environment_defaults`](../reference.md#sona_environment_defaults). |
| `fn environment_irradiance(sh9: &[f32; 27]) -> Option<[f32; 27]>` | The irradiance the lit shader evaluates for 9 RGB SH coefficients of radiance. |
| `fn shader_source(lang: sys::sona_shader_lang, prog: sys::sona_program, stage: i32) -> Option<&'static [u8]>` | Text, or SPIR-V bytes; None when that language is not in this build.<br>Calls [`sona_shader_source`](../reference.md#sona_shader_source). |
| `fn view_defaults() -> View` | The web's full-body framing.<br>Calls [`sona_view_defaults`](../reference.md#sona_view_defaults). |
| `fn camera_orbit(view: &mut View, target: [f64; 3], yaw_deg: f64, pitch_deg: f64, distance: f64)` | Places the eye on an orbit around target. |
| `fn view_matrices(view: &View) -> ([f32; 16], [f32; 16])` | Row-vector (view, projection), D3D depth 0..1. |
| `fn guid_parse(text: &str) -> Result<Guid>` | Parses the 36-character text form.<br>Calls [`sona_guid_parse`](../reference.md#sona_guid_parse). |
| `fn guid_format(id: &Guid) -> String` | The id in its lowercase 36-character form.<br>Calls [`sona_guid_format`](../reference.md#sona_guid_format). |
| `fn slot_of(id: &Guid) -> (Route, u32)` | Where an item goes, and its slot mask.<br>Calls [`sona_slot_of`](../reference.md#sona_slot_of). |
| `fn base64_decode(text: &str) -> Result<Vec<u8>>` | The bytes the base64 text holds.<br>Calls [`sona_base64_decode`](../reference.md#sona_base64_decode). |
| `fn section_name(section: u32) -> Option<&'static str>` | "shirt", "facialHair",...; None past the last section.<br>Calls [`sona_catalogue_section_name`](../reference.md#sona_catalogue_section_name). |
| `fn prop_attach_defaults() -> sys::sona_prop_attach` | The defaults of a prop attachment (joint SONA_PROP_JOINT_AUTO, no offset, no second hand).<br>Calls [`sona_prop_attach_defaults`](../reference.md#sona_prop_attach_defaults). |
| `fn prop_part_defaults() -> sys::sona_prop_part` | size set; colour 0xffffffff.<br>Calls [`sona_prop_part_defaults`](../reference.md#sona_prop_part_defaults). |
| `fn prop_pets() -> Vec<String>` | The catalogue's pets, as the site's pet mode lists them.<br>Calls [`sona_prop_pet_count`](../reference.md#sona_prop_pet_count), [`sona_prop_pet`](../reference.md#sona_prop_pet), [`sona_guid_format`](../reference.md#sona_guid_format). |
| `fn prop_is_pet(item_id: &str) -> bool` | 1 when the item id is one of the pets.<br>Calls [`sona_prop_is_pet`](../reference.md#sona_prop_is_pet). |
| `fn mask_preset(preset: Mask) -> [f32; sys::SONA_JOINT_COUNT]` | Fills a mask: SONA_MASK_NONE, _FULL, _UPPER_BODY (Spine and below it), _LOWER_BODY (the hips and legs), _HEAD (from the Neck), _LEFT_ARM, _RIGHT_ARM, _ARMS (from the shoulders). |
| `fn mask_branch(mask: &mut [f32; sys::SONA_JOINT_COUNT], joint: u32, weight: f32) -> Result<()>` | Sets joint and every joint below it to weight. |
| `fn phoneme_mouth(symbol: &str) -> Option<u8>` | The mouth for a phoneme symbol (ARPAbet, IPA, viseme names or ids); None when it is none of them.<br>Calls [`sona_phoneme_mouth`](../reference.md#sona_phoneme_mouth). |
| `fn lipsync_phonemes(phonemes: &[(&str, f32, f32)]) -> Result<Vec<MouthKey>>` | Timed phonemes (symbol, start, end) to mouth keys.<br>Calls [`sona_lipsync_phonemes`](../reference.md#sona_lipsync_phonemes). |
| `fn lipsync_text(text: &str, pcm: Option<&[f32]>, sample_rate: u32) -> Result<Vec<MouthKey>>` | Text to mouth keys, aligned to mono float audio at sample_rate when given, else at an even pace.<br>Calls [`sona_lipsync_text`](../reference.md#sona_lipsync_text). |
| `fn mouth_keys_sample(keys: &[MouthKey], t: f64) -> LipSyncFrame` | The mouth at time t of a key list.<br>Calls [`sona_mouth_keys_sample`](../reference.md#sona_mouth_keys_sample). |
| `fn headless_devices(backend: sys::sona_backend) -> Vec<HeadlessDevice>` | Every device a headless renderer can open (backend 0: all of them).<br>Calls [`sona_headless_devices`](../reference.md#sona_headless_devices). |
| `fn video_formats(ffmpeg: Option<&str>) -> u32` | Bit 1 << SONA_VIDEO_* for each format this machine can write.<br>Calls [`sona_video_formats`](../reference.md#sona_video_formats). |
| `fn outfit_check(manifest: &[u8], maker: Option<&Maker<'_>>) -> Result<OutfitReport>` | Every issue of a manifest, errors first.<br>Calls [`sona_outfit_check`](../reference.md#sona_outfit_check). |
| `fn outfit_fix(manifest: &mut [u8], maker: Option<&Maker<'_>>) -> Result<OutfitReport>` | Mends every error but a missing body in place; the report is the check after.<br>Calls [`sona_outfit_fix`](../reference.md#sona_outfit_fix). |
| `fn outfit_clash(a: &Guid, b: &Guid, maker: Option<&Maker<'_>>) -> (u32, u32)` | sona_sys::SONA_CLASH_* bits and the slots two items share; without a maker by their ids alone.<br>Calls [`sona_outfit_clash`](../reference.md#sona_outfit_clash). |
| `fn region_name(region: u32) -> Option<&'static str>` | None past the last region.<br>Calls [`sona_region_name`](../reference.md#sona_region_name). |
| `fn view_ray(view: &View, x: f64, y: f64) -> Result<([f32; 3], [f32; 3])>` | The ray through (x, y) of the view's picture, pixels from its top left: (origin, unit direction). |
| `fn abi() -> Result<sys::sona_abi_info>` | The loaded library's ABI: abi, oldest_abi (the oldest a caller may be built against) and its version.<br>Calls [`sona_abi_query`](../reference.md#sona_abi_query). |
| `fn tier_defaults() -> sys::sona_tier_options` | size set; target_fps 60, avatars 20.<br>Calls [`sona_tier_defaults`](../reference.md#sona_tier_defaults). |
| `fn ik_foot_lock_defaults() -> sys::sona_ik_foot_lock` | size set; weight 1, max_slide 0.25, release_seconds 0.15.<br>Calls [`sona_ik_foot_lock_defaults`](../reference.md#sona_ik_foot_lock_defaults). |
| `fn ik_spine_defaults() -> sys::sona_ik_spine` | size set; weight 1, max_bend_deg 35, max_twist_deg 40, hips_share 0.2.<br>Calls [`sona_ik_spine_defaults`](../reference.md#sona_ik_spine_defaults). |
| `fn ik_fingers_defaults() -> sys::sona_ik_fingers` | size set; spread 0, weight 1, fade_seconds 0.15.<br>Calls [`sona_ik_fingers_defaults`](../reference.md#sona_ik_fingers_defaults). |
| `fn ik_eyes_defaults() -> sys::sona_ik_eyes` | size set; max_speed_deg 400, smoothing 0.05, lead_seconds 0.08.<br>Calls [`sona_ik_eyes_defaults`](../reference.md#sona_ik_eyes_defaults). |
| `fn emote_from_text(text: &str) -> Result<sys::sona_emote>` | A sentence to stock clips (with weights to blend), a speed and a face.<br>Calls [`sona_emote_from_text`](../reference.md#sona_emote_from_text). |

### Code

`struct Code(pub i32)`: A sona_result.

| Declaration | What it does |
|---|---|
| `fn name(self) -> &'static str` | The web SDK's word for it: "licence", "gate",...<br>Calls [`sona_result_name`](../reference.md#sona_result_name). |
| `fn is_error(self) -> bool` | True for a failed result (a negative sona_result). |

### Error

`struct Error`: An error: the code, what happened and what to do about it.

| Declaration | What it does |
|---|---|
| `fn new(code: Code, message: impl Into<String>, fix: impl Into<String>) -> Error` | An Error from a code, a message and a fix. |

### Request

`struct Request`: One read in flight.

| Declaration | What it does |
|---|---|
| `fn id(&self) -> RequestId` | The read's id, as the source was given it. |
| `fn complete(self, bytes: &[u8])` | The container bytes as stored (YTGR, raw STRB or an STFS package); the core copies them. |
| `fn not_found(self)` | This source does not have it; the next source is asked. |
| `fn failed(self)` | It failed; the core retries later. |
| `fn finish(self, status: Code, bytes: &[u8])` | Finishes one read, exactly once, also after cancel; the request stays valid until then.<br>Calls [`sona_complete`](../reference.md#sona_complete). |

### Config

`struct Config`: What Context::open needs.

| Declaration | What it does |
|---|---|
| `fn new() -> Config` | Sets abi and leaves everything else at its default.<br>Calls [`sona_config_defaults`](../reference.md#sona_config_defaults). |
| `fn app_id(mut self, id: &str) -> Self` | None (the default): the app id stamped into this build. |
| `fn licence(mut self, bytes: impl Into<Vec<u8>>) -> Self` | The bytes of sona-licence.json from your download. |
| `fn licence_file(self, path: impl AsRef<Path>) -> std::io::Result<Self>` | Reads the licence from a file into the config. |
| `fn dir(mut self, path: impl AsRef<Path>) -> Self` | A folder of item files you own, laid out as the gate serves them. |
| `fn console(mut self, content_root: impl AsRef<Path>) -> Self` | A console's Content root, or a PC folder holding a copy of one. |
| `fn gate(mut self, base: Option<&str>) -> Self` | The 360sona gate; None for https://360sona.com/g. |
| `fn source(mut self, s: impl Source + 'static) -> Self` | A host-written source. The C type sona_source. |
| `fn worker_threads(mut self, n: i32) -> Self` | -1: cores - 1 (default); 0: none, work runs inside update. |
| `fn seed(mut self, seed: u32) -> Self` | 0: from the clock. |
| `fn max_avatars(mut self, n: u32) -> Self` | Default 256, at most 16384. The C field sona_config.max_avatars (count). |
| `fn build_budget_ms(mut self, ms: f32) -> Self` | owner-thread loading work per sona_update (steps, commits; builds run on the workers); default 6. The C field sona_config.build_budget_ms (ms). |
| `fn face_size(mut self, px: u32) -> Self` | 0: auto; or 128, 256, 512. |
| `fn flags(mut self, flags: u32) -> Self` | sona_sys::SONA_CFG_* |
| `fn budget(mut self, b: Budget) -> Self` | The C field sona_config.budget (a sona_budget (see its fields)). |
| `fn check_host(mut self, host: &str) -> Self` | NULL: https://test.360sona.com, the devs site. The C field sona_config.check_host (text (UTF-8), NULL: none). |
| `fn log(mut self, f: impl Fn(LogLevel, &str) + Send + Sync + 'static) -> Self` | Called from any thread. |

### Context

`struct Context`: Owns a sona_ctx.

| Declaration | What it does |
|---|---|
| `fn open(cfg: Config) -> Result<Context>` | Checks the struct layout, then the licence.<br>Calls [`sona_open`](../reference.md#sona_open). |
| `fn raw(&self) -> *mut sys::sona_ctx` | The native pointer this value wraps, for a call through sona360-sys that the safe layer does not cover. |
| `fn app_id(&self) -> String` | The app id this context runs as.<br>Calls [`sona_app_id`](../reference.md#sona_app_id). |
| `fn last_error(&self) -> Option<Error>` | The last error on a ctx.<br>Calls [`sona_last_error`](../reference.md#sona_last_error). |
| `fn frame(&self) -> Result<Frame<'_>>` | The context's one frame: updating and posing. |
| `fn add(&self, manifest: &[u8], opts: &AddOptions) -> Result<Avatar<'_>>` | Queues an avatar from its 1000 manifest bytes.<br>Calls [`sona_avatar_add`](../reference.md#sona_avatar_add). |
| `fn add_manifest(&self, m: &Manifest, opts: &AddOptions) -> Result<Avatar<'_>>` | Adds an avatar from a Manifest (sona_avatar_add); it builds in the background. |
| `fn add_base64(&self, b64: &str, opts: &AddOptions) -> Result<Avatar<'_>>` | The same from base64 text (at most 4096 characters).<br>Calls [`sona_avatar_add_base64`](../reference.md#sona_avatar_add_base64). |
| `fn add_waiting(&self, opts: &AddOptions) -> Result<Avatar<'_>>` | An avatar whose manifest is not known: QUEUED, a neutral figure while placeholders are on, until Avatar::set_manifest gives it one.<br>Calls [`sona_avatar_add_waiting`](../reference.md#sona_avatar_add_waiting). |
| `fn poll_event(&self) -> Option<Event>` | The next event, or None when there are none; call it until it is None.<br>Calls [`sona_poll_event`](../reference.md#sona_poll_event), [`sona_avatar_id`](../reference.md#sona_avatar_id). |
| `fn clips(&self) -> Vec<ClipInfo>` | How many clips the context knows.<br>Calls [`sona_clip_count`](../reference.md#sona_clip_count), [`sona_clip_get`](../reference.md#sona_clip_get). |
| `fn stats(&self) -> SceneStats` | The scene statistics.<br>Calls [`sona_stats`](../reference.md#sona_stats). |
| `fn shading(&self) -> Result<Option<Shading>>` | None until the data files have loaded (SONA_PENDING).<br>Calls [`sona_shading_get`](../reference.md#sona_shading_get). |
| `fn credit(&self, scale: u32) -> Result<Credit>` | The badge and its words.<br>Calls [`sona_credit_get`](../reference.md#sona_credit_get). |
| `fn png_encode(&self, rgba: &[u8], width: u32, height: u32) -> Result<Vec<u8>>` | PNG bytes with the web's three tEXt chunks (Software, Source, Comment).<br>Calls [`sona_png_encode`](../reference.md#sona_png_encode), [`sona_free`](../reference.md#sona_free). |
| `fn fit_crowd(&self, view: &mut View)` | Fits every ready avatar (the web preset "crowd").<br>Calls [`sona_camera_fit_crowd`](../reference.md#sona_camera_fit_crowd). |
| `fn set_lod(&self, o: Option<&LodOptions>) -> Result<()>` | Level of detail and sprites from the next update.<br>Calls [`sona_lod_set`](../reference.md#sona_lod_set). |
| `fn set_sway_world(&self, w: Option<&sys::sona_sway_world>) -> Result<()>` | The gravity and wind every swaying avatar feels; None for the defaults.<br>Calls [`sona_sway_world_set`](../reference.md#sona_sway_world_set). |
| `fn lod(&self) -> Result<LodOptions>` | Copies the current options: before any sona_lod_set, thresholds 120 and 40 and no sprites (sprite_px 0).<br>Calls [`sona_lod_get`](../reference.md#sona_lod_get). |
| `fn lod_stats(&self) -> LodStats` | The level-of-detail statistics: avatars in view at each step, those fading, the baked looks and the bakes of the last draw.<br>Calls [`sona_lod_stats_get`](../reference.md#sona_lod_stats_get). |
| `fn set_placeholders(&self, o: Option<&sys::sona_placeholder_options>) -> Result<()>` | Loading placeholders from the next update; None: placeholder_defaults.<br>Calls [`sona_placeholder_set`](../reference.md#sona_placeholder_set). |
| `fn placeholders(&self) -> Result<Option<sys::sona_placeholder_options>>` | The options in use; None while placeholders are off.<br>Calls [`sona_placeholder_get`](../reference.md#sona_placeholder_get). |
| `fn placeholders_off(&self) -> Result<()>` | Figures shown now fade out over appear_seconds.<br>Calls [`sona_placeholder_off`](../reference.md#sona_placeholder_off). |
| `fn placeholder_stats(&self) -> sys::sona_placeholder_stats` | Figures in view at the last sona_update (by phase, and how many as sprites), how many were posed and the time that took, and the figure draws of the last sona_draw or sona_snapshot.<br>Calls [`sona_placeholder_stats_get`](../reference.md#sona_placeholder_stats_get). |
| `fn pixel_art(&self, rgba: &[u8], width: u32, height: u32, opts: &PixelOptions) -> Result<Picture>` | Crisp pixel art from a straight RGBA8 picture (sona.h 3.12d): opaque or clear pixels, a small palette.<br>Calls [`sona_pixel_art`](../reference.md#sona_pixel_art). |
| `fn pixel_palette(&self, pictures: &[(&[u8], u32, u32)], colours: u32) -> Result<Vec<u32>>` | One palette (0xFFRRGGBB, darkest first) for several (rgba, width, height) pictures.<br>Calls [`sona_pixel_palette`](../reference.md#sona_pixel_palette). |
| `fn add_item_preview(&self, item_id: &str, opts: &PreviewOptions) -> Result<Avatar<'_>>` | One item worn alone on a grey stand-in body, framed by its slot.<br>Calls [`sona_item_preview_add`](../reference.md#sona_item_preview_add). |
| `fn start_interaction(&self, desc: &sys::sona_interaction_desc) -> Result<Interaction<'_>>` | Starts an interaction; fill the desc from interaction_defaults and set a and b (or b null for SIT) from Avatar::raw.<br>Calls [`sona_interaction_start`](../reference.md#sona_interaction_start). |
| `fn param_id(&self, name: &str) -> Option<u32>` | The id of a parameter name, numbered from 0 in the order first asked for; None for a bad name or past 32.<br>Calls [`sona_param_id`](../reference.md#sona_param_id). |
| `fn blend_space(&self, param_x: &str, param_y: Option<&str>, samples: &[BlendSample<'_>], unsynced: bool, smooth_seconds: f32,) -> Result<BlendSpace<'_>>` | A blend space over param_x (and param_y when 2D); one serves every avatar of the context.<br>Calls [`sona_blend_space_defaults`](../reference.md#sona_blend_space_defaults), [`sona_blend_space_create`](../reference.md#sona_blend_space_create). |
| `fn state_machine(&self, states: &[StateSpec<'_>], transitions: &[TransitionSpec<'_>], initial: Option<&str>,) -> Result<StateMachine<'_>>` | A state machine; one serves every avatar of the context.<br>Calls [`sona_state_machine_defaults`](../reference.md#sona_state_machine_defaults), [`sona_state_machine_create`](../reference.md#sona_state_machine_create). |
| `fn prop_mesh(&self, parts: &[sys::sona_prop_part]) -> Result<PropMesh<'_>>` | A prop mesh from triangles; the parts' pointers need to live only for the call.<br>Calls [`sona_prop_mesh_create`](../reference.md#sona_prop_mesh_create). |
| `fn prop_mesh_load(&self, bytes: &[u8], options: Option<&sys::sona_prop_load_options>) -> Result<PropMesh<'_>>` | A glTF 2.0 file (.glb, or.gltf with embedded buffers) as a prop mesh.<br>Calls [`sona_prop_mesh_load`](../reference.md#sona_prop_mesh_load). |
| `fn prop_mesh_stock(&self, item_id: &str) -> Result<PropMesh<'_>>` | A stock prop item (a carryable) of the catalogue; its state is SONA_PENDING until it has loaded.<br>Calls [`sona_prop_mesh_stock`](../reference.md#sona_prop_mesh_stock). |
| `fn pick_ray(&self, origin: [f32; 3], dir: [f32; 3], o: &PickOptions) -> Result<Option<PickHit>>` | The nearest hit along the ray; None when nothing is hit. |
| `fn pick_screen(&self, view: &View, x: f64, y: f64, o: &PickOptions) -> Result<Option<PickHit>>` | The nearest hit under (x, y) of the view's picture, sprites facing that view.<br>Calls [`sona_pick_screen`](../reference.md#sona_pick_screen). |
| `fn pick_ray_all(&self, origin: [f32; 3], dir: [f32; 3], cap: usize, o: &PickOptions) -> Vec<PickHit>` | Every avatar the ray hits, its nearest hit each, nearest first (at most cap). |
| `fn tier_apply(&self, renderer: Option<*mut sys::sona_renderer>, o: Option<&sys::sona_tier_options>) -> Result<()>` | Quality for a class of device on the ctx and, with one, a renderer.<br>Calls [`sona_tier_apply`](../reference.md#sona_tier_apply). |
| `fn item_colourways(&self, item_id: &str) -> Result<Option<Vec<[u32; 3]>>>` | An item's colourways (0xFFRRGGBB primary, secondary, tertiary). |
| `fn custom_item_pack_mesh(&self, m: &MeshItem) -> Result<Option<Vec<u8>>>` | A.sonaitem (format 1.1) from your own skinned glTF binary.<br>Calls [`sona_mesh_item_spec_defaults`](../reference.md#sona_mesh_item_spec_defaults), [`sona_custom_item_pack_mesh`](../reference.md#sona_custom_item_pack_mesh), [`sona_free`](../reference.md#sona_free). |
| `fn award_define(&self, key: &str, title: &str, description: &str, item: &str, developer_key: &str) -> Result<u32>` | Defines an award item for the app (tools only: it takes the developer key).<br>Calls [`sona_award_def_defaults`](../reference.md#sona_award_def_defaults), [`sona_award_define`](../reference.md#sona_award_define). |
| `fn award_unlock(&self, player_token: &str, key: &str) -> Result<u32>` | Unlocks an award for a signed-in player.<br>Calls [`sona_award_unlock`](../reference.md#sona_award_unlock). |
| `fn award_poll(&self, ticket: u32) -> Result<bool>` | Ok(false) while it runs, then Ok(true) once, or how it failed.<br>Calls [`sona_award_poll`](../reference.md#sona_award_poll). |

### Interaction

`struct Interaction<'c>`: A running two-avatar interaction or seat.

| Declaration | What it does |
|---|---|
| `fn raw(&self) -> *mut sys::sona_interaction` | The native pointer this value wraps, for a call through sona360-sys that the safe layer does not cover. |
| `fn end(&mut self) -> Result<()>` | Begins the end phase: letting go, standing up.<br>Calls [`sona_interaction_end`](../reference.md#sona_interaction_end). |
| `fn move_to(&mut self, position: [f32; 3], turn_deg: f32) -> Result<()>` | Moves the place (or the seat) while it runs. |
| `fn status(&self) -> Result<sys::sona_interaction_status>` | Where an interaction is: its kind and phase, the time in the phase and how far through it, whether the contacts are together, the widest gap at a contact, the clearance between the two bodies (negative: into each other),<br>Calls [`sona_interaction_status_get`](../reference.md#sona_interaction_status_get). |
| `fn events(&mut self) -> Vec<sys::sona_interaction_event>` | The events since the last call, oldest first.<br>Calls [`sona_interaction_events`](../reference.md#sona_interaction_events). |

### Frame

`struct Frame<'c>`: Updating and posing.

| Declaration | What it does |
|---|---|
| `fn update(&mut self, dt_seconds: f64, view: Option<&View>) -> Result<FrameStats>` | Advances every avatar by dt (clamped to 0..0.1 s), builds inside the budget, culls and poses.<br>Calls [`sona_update`](../reference.md#sona_update). |
| `fn pose<'a>(&'a self, avatar: &'a mut Avatar<'c>) -> Result<Pose<'a>>` | The avatar's pose as of the last update.<br>Calls [`sona_pose`](../reference.md#sona_pose). |
| `fn pose_vertices(&self, avatar: &mut Avatar<'c>, mesh: u32, space: Space, positions: &mut [f32], normals: Option<&mut [f32]>, stride_floats: usize,) -> Result<()>` | CPU skinning of one mesh.<br>Calls [`sona_pose_vertices`](../reference.md#sona_pose_vertices). |

### AvatarState

`enum AvatarState`: The C type sona_avatar_state.

| Declaration | What it does |
|---|---|
| `fn settled(self) -> bool` | Ready or failed: nothing more will happen without a new clip or manifest. |

### AddOptions

`struct AddOptions`: The C type sona_add_options.

| Declaration | What it does |
|---|---|
| `fn clip(mut self, clip: &str) -> Self` | A clip key, a raw clip id, "prop", "idle" or "still"; NULL: "idle". The C field sona_add_options.clip (text (UTF-8), NULL: none). |
| `fn start_at(mut self, seconds: f32) -> Self` | Seconds; negative means random, to desynchronise a crowd. The C field sona_add_options.start_at (s). |

### Avatar

`struct Avatar<'c>`: One avatar in a context.

| Declaration | What it does |
|---|---|
| `fn raw(&self) -> *mut sys::sona_avatar` | The native pointer this value wraps, for a call through sona360-sys that the safe layer does not cover. |
| `fn id(&self) -> u32` | Unique within the context; events name avatars by it.<br>Calls [`sona_avatar_id`](../reference.md#sona_avatar_id). |
| `fn state(&self) -> AvatarState` | The avatar's state.<br>Calls [`sona_avatar_state_of`](../reference.md#sona_avatar_state_of). |
| `fn export(&self, opts: &ExportOptions) -> Result<(Vec<u8>, ExportReport)>` | The avatar as a.vrm (1.0 or 0.x) or.glb file, and what went into it.<br>Calls [`sona_export_defaults`](../reference.md#sona_export_defaults), [`sona_export_avatar`](../reference.md#sona_export_avatar), [`sona_free`](../reference.md#sona_free). |
| `fn play(&mut self, clip: &str, opts: &PlayOptions) -> Result<()>` | Before READY it is remembered and applied when the avatar appears.<br>Calls [`sona_avatar_play`](../reference.md#sona_avatar_play). |
| `fn stop(&mut self)` | Holds the current pose.<br>Calls [`sona_avatar_stop`](../reference.md#sona_avatar_stop). |
| `fn move_to(&mut self, to: &Placement, over_seconds: f32)` | Moves the avatar to a new placement over over_seconds.<br>Calls [`sona_avatar_move`](../reference.md#sona_avatar_move). |
| `fn set_visible(&mut self, visible: bool)` | Shows or hides it.<br>Calls [`sona_avatar_set_visible`](../reference.md#sona_avatar_set_visible). |
| `fn bounds(&self) -> ([f32; 3], f32)` | (centre, radius) |
| `fn camera_preset(&self, preset: Preset, view: &mut View) -> Result<()>` | Sets view.eye and view.target to one of the console's framings on this (ready) avatar.<br>Calls [`sona_camera_preset`](../reference.md#sona_camera_preset). |
| `fn remove(self)` | Frees what only it used. |
| `fn joint_world(&self, joint: u32) -> Result<[f32; 16]>` | A joint's world matrix at the last update: row-vector, metres, the placement applied. |
| `fn set_override(&mut self, joint: u32, rotation: Option<[f32; 4]>, weight: f32, mode: OverrideMode) -> Result<()>` | A pose override, applied after the clip each frame. |
| `fn clear_overrides(&mut self)` | Clears every override of the avatar.<br>Calls [`sona_avatar_clear_overrides`](../reference.md#sona_avatar_clear_overrides). |
| `fn crossfade(&mut self, clip: &str, opts: &PlayOptions, seconds: f32) -> Result<()>` | Avatar::play, blending from the current pose over seconds (0: a cut).<br>Calls [`sona_avatar_crossfade`](../reference.md#sona_avatar_crossfade). |
| `fn queue(&mut self, clip: &str, opts: &PlayOptions, fade_seconds: f32) -> Result<()>` | Plays clip when the current one ends.<br>Calls [`sona_avatar_queue`](../reference.md#sona_avatar_queue). |
| `fn queued(&self) -> u32` | How many clips are waiting in the queue.<br>Calls [`sona_avatar_queued`](../reference.md#sona_avatar_queued). |
| `fn capsule(&self) -> Result<Capsule>` | A vertical capsule around the posed body, in world space.<br>Calls [`sona_avatar_capsule`](../reference.md#sona_avatar_capsule). |
| `fn set_expression(&mut self, values: Option<[u8; 5]>) -> Result<()>` | mouth, left eyebrow, right eyebrow, left eye, right eye: a shape index, or 255 to leave that part to the clip. |
| `fn attach_prop(&mut self, mesh: &PropMesh<'_>, options: Option<&sys::sona_prop_attach>) -> Result<u32>` | Attaches a prop mesh; returns its id on this avatar.<br>Calls [`sona_avatar_prop_attach`](../reference.md#sona_avatar_prop_attach). |
| `fn set_prop(&mut self, id: u32, options: &sys::sona_prop_attach) -> Result<()>` | New placement, flags or hand for an attached prop (each frame for one that moves on the joint).<br>Calls [`sona_avatar_prop_set`](../reference.md#sona_avatar_prop_set). |
| `fn swap_prop(&mut self, id: u32, mesh: &PropMesh<'_>) -> Result<()>` | Another mesh in the same place: a sword for a stick, an item for a placeholder.<br>Calls [`sona_avatar_prop_swap`](../reference.md#sona_avatar_prop_swap). |
| `fn detach_prop(&mut self, id: u32) -> Result<()>` | Takes the prop off at once (its hand's IK target eases off).<br>Calls [`sona_avatar_prop_detach`](../reference.md#sona_avatar_prop_detach). |
| `fn detach_all_props(&mut self)` | Takes every prop off the avatar at once.<br>Calls [`sona_avatar_prop_detach_all`](../reference.md#sona_avatar_prop_detach_all). |
| `fn props(&self) -> Vec<u32>` | The ids of the avatar's props, in attach order.<br>Calls [`sona_avatar_prop_list`](../reference.md#sona_avatar_prop_list). |
| `fn prop_frame(&self, id: u32) -> Result<sys::sona_prop_frame>` | One prop as the last update posed it (its palette pointer is valid until the next update).<br>Calls [`sona_avatar_prop_frame`](../reference.md#sona_avatar_prop_frame). |
| `fn set_ik_target(&mut self, limb: u32, target: Option<&sys::sona_ik_target>) -> Result<()>` | A hand or foot target (sona_sys::SONA_IK_LEFT_HAND..<br>Calls [`sona_avatar_ik_target`](../reference.md#sona_avatar_ik_target). |
| `fn set_ik_feet(&mut self, feet: Option<&sys::sona_ik_feet>) -> Result<()>` | Foot planting; None turns it off.<br>Calls [`sona_avatar_ik_feet`](../reference.md#sona_avatar_ik_feet). |
| `fn set_ik_ground(&mut self, foot: u32, ground: Option<([f32; 3], [f32; 3])>) -> Result<()>` | SONA_IK_GROUND_POINTS: the ground under one foot; None for no ground there. |
| `fn set_style(&mut self, style: Option<&Style>) -> Result<()>` | The avatar's own art style; None clears it and the renderer's applies.<br>Calls [`sona_avatar_set_style`](../reference.md#sona_avatar_set_style). |
| `fn style(&self) -> Result<Style>` | The avatar's own art style (style_defaults when it has none).<br>Calls [`sona_avatar_style`](../reference.md#sona_avatar_style). |
| `fn set_ik_look(&mut self, look: Option<&sys::sona_ik_look>) -> Result<()>` | Look-at; None eases back to the clip.<br>Calls [`sona_avatar_ik_look`](../reference.md#sona_avatar_ik_look). |
| `fn set_ik_limits(&mut self, limits: Option<&sys::sona_ik_limits>) -> Result<()>` | Joint limits and the body checks; None for the defaults.<br>Calls [`sona_avatar_ik_limits`](../reference.md#sona_avatar_ik_limits). |
| `fn clear_ik(&mut self)` | Every target, the planting and the look-at off at once.<br>Calls [`sona_avatar_ik_clear`](../reference.md#sona_avatar_ik_clear). |
| `fn set_placeholder(&mut self, mode: i32) -> Result<()>` | Its loading placeholder: -1 follows the context, 0 never, 1 always.<br>Calls [`sona_avatar_placeholder`](../reference.md#sona_avatar_placeholder). |
| `fn placeholder(&self) -> Result<sys::sona_placeholder_info>` | The avatar's figure at the last sona_update: its phase, opacity, height, which figure (male, female or neutral), whether it plays the avatar's clip, the seconds since the avatar was added and whether it is drawn as a s<br>Calls [`sona_avatar_placeholder_info`](../reference.md#sona_avatar_placeholder_info). |
| `fn set_manifest(&mut self, manifest: &[u8]) -> Result<()>` | The manifest of an avatar added with Context::add_waiting, once.<br>Calls [`sona_avatar_set_manifest`](../reference.md#sona_avatar_set_manifest). |
| `fn set_manifest_base64(&mut self, b64: &str) -> Result<()>` | sona_avatar_set_manifest with the manifest as base64 text.<br>Calls [`sona_avatar_set_manifest_base64`](../reference.md#sona_avatar_set_manifest_base64). |
| `fn ik_status(&self) -> Result<sys::sona_ik_status>` | What the last pose did.<br>Calls [`sona_avatar_ik_status`](../reference.md#sona_avatar_ik_status). |
| `fn ragdoll(&mut self, options: Option<&sys::sona_ragdoll_options>) -> Result<Vec<sys::sona_ragdoll_body>>` | The ragdoll bodies fitted to this avatar now (colliders, masses, joints and limits), for any physics engine; starts the pose history ragdoll_state takes velocities from.<br>Calls [`sona_avatar_ragdoll`](../reference.md#sona_avatar_ragdoll). |
| `fn ragdoll_state(&self) -> Result<Vec<sys::sona_ragdoll_state>>` | The bodies at the last pose with their velocities.<br>Calls [`sona_avatar_ragdoll_state`](../reference.md#sona_avatar_ragdoll_state). |
| `fn ragdoll_drive(&mut self, bodies: Option<&[sys::sona_ragdoll_state]>, weight: f32, flags: u32) -> Result<()>` | The host's simulated bodies onto the avatar from the next pose; weight 0..1 blends from the clip; None stops.<br>Calls [`sona_avatar_ragdoll_drive`](../reference.md#sona_avatar_ragdoll_drive). |
| `fn ragdoll_release(&mut self, blend_seconds: f32) -> Result<()>` | Back to the clip, blending from the last ragdoll pose over blend_seconds.<br>Calls [`sona_avatar_ragdoll_release`](../reference.md#sona_avatar_ragdoll_release). |
| `fn ragdoll_info(&self) -> Result<sys::sona_ragdoll_info>` | The mode, the blend, where it lies and how to get up.<br>Calls [`sona_avatar_ragdoll_info`](../reference.md#sona_avatar_ragdoll_info). |
| `fn ragdoll_clear(&mut self)` | Off at once: no tracking, no drive, no blend.<br>Calls [`sona_avatar_ragdoll_clear`](../reference.md#sona_avatar_ragdoll_clear). |
| `fn set_sway(&mut self, o: Option<&sys::sona_sway>) -> Result<()>` | Hair and cloth sway; None turns it off.<br>Calls [`sona_avatar_sway`](../reference.md#sona_avatar_sway). |
| `fn reset_sway(&mut self)` | Back to the modelled shape at the next pose.<br>Calls [`sona_avatar_sway_reset`](../reference.md#sona_avatar_sway_reset). |
| `fn sway_info(&self) -> Result<sys::sona_sway_info>` | What sways and what the last pose did.<br>Calls [`sona_avatar_sway_info`](../reference.md#sona_avatar_sway_info). |
| `fn sway_mesh_parts(&self, mesh: u32) -> u32` | The SONA_SWAY_* kinds one of the pose's meshes sways with.<br>Calls [`sona_avatar_sway_mesh_parts`](../reference.md#sona_avatar_sway_mesh_parts). |
| `fn set_mouth(&mut self, shape: u8) -> Result<()>` | Only the mouth: a SONA_MOUTH_* or shape index, or 255 to hand it back to the clip.<br>Calls [`sona_avatar_mouth`](../reference.md#sona_avatar_mouth). |
| `fn voice(&mut self, state: &mut VoiceMouth, level: f32, dt: f32) -> Result<()>` | Voice chat: this speaker's audio level (linear RMS) moves the mouth.<br>Calls [`sona_avatar_voice`](../reference.md#sona_avatar_voice). |
| `fn expression_counts(&self) -> Result<[u32; 3]>` | Shapes this face has: mouths, eyebrows, eyes. |
| `fn clip_events(&mut self) -> Vec<ClipEvent>` | What happened on the clip since the last call, oldest first.<br>Calls [`sona_avatar_clip_events`](../reference.md#sona_avatar_clip_events). |
| `fn mark(&mut self, seconds: f32, id: u32) -> Result<()>` | A ClipEventKind::Mark with this id each time the current clip passes seconds.<br>Calls [`sona_avatar_mark`](../reference.md#sona_avatar_mark). |
| `fn clear_marks(&mut self)` | Removes the avatar's marks.<br>Calls [`sona_avatar_clear_marks`](../reference.md#sona_avatar_clear_marks). |
| `fn set_root_motion(&mut self, mode: RootMotion) -> Result<()>` | What happens to the clip's sideways travel of the hips.<br>Calls [`sona_avatar_root_motion`](../reference.md#sona_avatar_root_motion). |
| `fn take_root_motion(&mut self) -> Result<[f32; 3]>` | The travel collected since the last call, in world metres; clears it. |
| `fn lod(&self) -> (Lod, f32)` | The step at the last update, and how far it is from mesh (0) to sprite (1).<br>Calls [`sona_avatar_lod`](../reference.md#sona_avatar_lod). |
| `fn layer_play(&mut self, layer: u32, clip: &str, opts: &LayerOptions) -> Result<()>` | Plays a clip key or raw clip id on a layer (0..7), over the avatar's own clip.<br>Calls [`sona_avatar_layer_play`](../reference.md#sona_avatar_layer_play). |
| `fn layer_blend(&mut self, layer: u32, blend: &BlendSpace<'c>, opts: &LayerOptions) -> Result<()>` | Plays a blend space of the same ctx on the layer.<br>Calls [`sona_avatar_layer_blend`](../reference.md#sona_avatar_layer_blend). |
| `fn layer_machine(&mut self, layer: u32, machine: &StateMachine<'c>, opts: &LayerOptions) -> Result<()>` | Runs a state machine of the same ctx on the layer from its initial state (a STATE event with from_state -1).<br>Calls [`sona_avatar_layer_machine`](../reference.md#sona_avatar_layer_machine). |
| `fn layer_goto(&mut self, layer: u32, state: u32, fade_seconds: f32) -> Result<()>` | Sends a machine layer to a state now, crossfading over fade_seconds.<br>Calls [`sona_avatar_layer_goto`](../reference.md#sona_avatar_layer_goto). |
| `fn layer_weight(&mut self, layer: u32, weight: f32, over_seconds: f32) -> Result<()>` | Moves the layer's weight linearly to weight (0..1) over over_seconds; 0 or less sets it at once.<br>Calls [`sona_avatar_layer_weight`](../reference.md#sona_avatar_layer_weight). |
| `fn layer_mask(&mut self, layer: u32, mask: Option<&[f32; sys::SONA_JOINT_COUNT]>) -> Result<()>` | None: every joint. |
| `fn layer_stop(&mut self, layer: u32, fade_seconds: f32) -> Result<()>` | Fades the layer out over fade_seconds and then empties it (a STOPPED event); 0 empties it now.<br>Calls [`sona_avatar_layer_stop`](../reference.md#sona_avatar_layer_stop). |
| `fn layer_info(&self, layer: u32) -> Result<LayerInfo>` | The layer now: kind, mode, state (machines, else -1), clip (the sona_clip_get index, -1 for a raw id), weight with fades, time and normalized through the clip or cycle, ready (its clips have loaded) and<br>Calls [`sona_avatar_layer_info`](../reference.md#sona_avatar_layer_info). |
| `fn layer_events(&mut self) -> Vec<LayerEvent>` | What happened on the layers since the last call, oldest first.<br>Calls [`sona_avatar_layer_events`](../reference.md#sona_avatar_layer_events). |
| `fn set_param(&mut self, param: u32, value: f32) -> Result<()>` | Sets one parameter on the avatar; read at the next sona_update.<br>Calls [`sona_avatar_set_param`](../reference.md#sona_avatar_set_param). |
| `fn set_params(&mut self, first: u32, values: &[f32]) -> Result<()>` | Parameters first..<br>Calls [`sona_avatar_set_params`](../reference.md#sona_avatar_set_params). |
| `fn param(&self, param: u32) -> f32` | A parameter's value; 0 when unset or unknown.<br>Calls [`sona_avatar_param`](../reference.md#sona_avatar_param). |
| `fn preview_bounds(&mut self) -> Result<([f32; 3], [f32; 3])>` | The previewed item's world box (lo, hi). |
| `fn preview_view(&mut self, width: u32, height: u32) -> Result<View>` | The framed camera for a width x height picture of this preview.<br>Calls [`sona_item_preview_view`](../reference.md#sona_item_preview_view). |
| `fn play_stock(&mut self, id: u32, opts: Option<&PlayOptions>, fade_seconds: f32) -> Result<()>` | A stock clip (an id from stock_clip_find), the variant for this avatar's body; fade_seconds > 0 crossfades.<br>Calls [`sona_avatar_play_stock`](../reference.md#sona_avatar_play_stock). |
| `fn set_idle(&mut self, o: Option<&IdleOptions>) -> Result<()>` | The procedural idle (blinks, glances, weight shifts, breathing over any clip); None turns it off.<br>Calls [`sona_avatar_idle`](../reference.md#sona_avatar_idle). |
| `fn idle_options(&self) -> Result<IdleOptions>` | The idle's options in use, seed resolved; parts 0 when off.<br>Calls [`sona_avatar_idle_get`](../reference.md#sona_avatar_idle_get). |
| `fn idle_state(&self) -> Result<IdleState>` | What the idle gave the last pose.<br>Calls [`sona_avatar_idle_state`](../reference.md#sona_avatar_idle_state). |
| `fn pick(&self, origin: [f32; 3], dir: [f32; 3], o: &PickOptions) -> Result<Option<PickHit>>` | The ray against this avatar alone; None when it misses. |
| `fn ik_foot_lock(&mut self, o: Option<&sys::sona_ik_foot_lock>) -> Result<()>` | Foot locking: planted feet stay where they landed.<br>Calls [`sona_avatar_ik_foot_lock`](../reference.md#sona_avatar_ik_foot_lock). |
| `fn ik_spine(&mut self, o: Option<&sys::sona_ik_spine>) -> Result<()>` | Spine assist for hand targets past reach.<br>Calls [`sona_avatar_ik_spine`](../reference.md#sona_avatar_ik_spine). |
| `fn ik_fingers(&mut self, hand: u32, o: Option<&sys::sona_ik_fingers>) -> Result<()>` | Finger curl over the clip's, for SONA_IK_LEFT_HAND or SONA_IK_RIGHT_HAND.<br>Calls [`sona_avatar_ik_fingers`](../reference.md#sona_avatar_ik_fingers). |
| `fn ik_eyes(&mut self, o: Option<&sys::sona_ik_eyes>) -> Result<()>` | Eye turns under look-at.<br>Calls [`sona_avatar_ik_eyes`](../reference.md#sona_avatar_ik_eyes). |
| `fn ragdoll_motors(&self) -> Result<Vec<sys::sona_ragdoll_motor>>` | The joint motor targets of the last pose, in ragdoll's order.<br>Calls [`sona_avatar_ragdoll_motors`](../reference.md#sona_avatar_ragdoll_motors). |
| `fn emote(&mut self, e: &sys::sona_emote, fade_seconds: f32) -> Result<()>` | Plays an emote_from_text answer on the emote layers, faded in over fade_seconds.<br>Calls [`sona_avatar_emote`](../reference.md#sona_avatar_emote). |

### StockClip

`struct StockClip`: One stock clip.

| Declaration | What it does |
|---|---|
| `fn tag_names(&self) -> Vec<&'static str>` | The tag names, in bit order. |

### Pose

`struct Pose<'a>`: A view over sona_pose_data, valid until the next Frame::update.

| Declaration | What it does |
|---|---|
| `fn raw(&self) -> &'a sys::sona_pose_data` | The native pointer this value wraps, for a call through sona360-sys that the safe layer does not cover. |
| `fn build_version(&self) -> u32` | Bumps when meshes, materials or textures change. |
| `fn world(&self) -> &'a [f32; 16]` | W = scale * rotateY(turn) * translate(position), row-vector. |
| `fn palette(&self) -> &'a [f32]` | 864 floats: per joint 3 float4, columns 0..2 of the row-vector skin matrix, avatar space. |
| `fn view_joints(&self) -> &'a [f32]` | 72 * 3 floats: each joint's translation before W. |
| `fn meshes(&self) -> &'a [Mesh]` | In draw order. |
| `fn materials(&self) -> &'a [Material]` | The C field sona_pose_data.materials (pointer to sona_material). |
| `fn textures(&self) -> &'a [Texture]` | The face sheet is one of them (its material has SONA_MAT_FACE). The C field sona_pose_data.textures (pointer to sona_texture). |
| `fn props(&self) -> &'a [PropPalette]` | Size arrays by prop_count, which can pass 4. The C field sona_pose_data.props (pointer to sona_prop_palette). |
| `fn expression(&self) -> [u8; 5]` | mouth, left eyebrow, right eyebrow, left eye, right eye |

### Mesh

`struct Mesh(sys::sona_mesh)`: One mesh: 76-byte vertices in host byte order and a u16 triangle list.

| Declaration | What it does |
|---|---|
| `fn raw(&self) -> &sys::sona_mesh` | The native pointer this value wraps, for a call through sona360-sys that the safe layer does not cover. |
| `fn item(&self) -> &str` | The item it came from. The C field sona_mesh.item (text (UTF-8)). |
| `fn mask(&self) -> u32` | The item's AssetMask. The C field sona_mesh.mask (bit flags). |
| `fn batch(&self) -> u32` | The C field sona_mesh.batch (count). |
| `fn material(&self) -> u32` | Index into Pose::materials. |
| `fn pass(&self) -> Pass` | The C field sona_mesh.pass (sona_pass value). |
| `fn palette(&self) -> Option<usize>` | None: the body palette; else an index into Pose::props. |
| `fn vertex_count(&self) -> u32` | The C field sona_mesh.vertex_count (count). |
| `fn index_count(&self) -> u32` | The C field sona_mesh.index_count (count). |
| `fn vertices(&self) -> &[u8]` | Vertex_count * 76 bytes. The C field sona_mesh.vertices (pointer). |
| `fn indices(&self) -> &[u16]` | Triangle list. The C field sona_mesh.indices (pointer). |
| `fn key(&self) -> u32` | Stable while the geometry lives; shared by avatars wearing the same item. |

### Texture

`struct Texture(sys::sona_texture)`: The C type sona_texture.

| Declaration | What it does |
|---|---|
| `fn raw(&self) -> &sys::sona_texture` | The native pointer this value wraps, for a call through sona360-sys that the safe layer does not cover. |
| `fn key(&self) -> u32` | Stable while the texture lives; use it to cache uploads. |
| `fn version(&self) -> u32` | Bumps when the pixels change (the face sheet). |
| `fn format(&self) -> i32` | sona_sys::SONA_TEX_* |
| `fn width(&self) -> u32` | The C field sona_texture.width (px). |
| `fn height(&self) -> u32` | The C field sona_texture.height (px). |
| `fn data(&self) -> &[u8]` | Width * height * 4 bytes for RGBA8. The C field sona_texture.data (pointer). |

### PropPalette

`struct PropPalette(sys::sona_prop_palette)`: The C type sona_prop_palette.

| Declaration | What it does |
|---|---|
| `fn item(&self) -> &str` | The C field sona_prop_palette.item (text (UTF-8)). |
| `fn playing(&self) -> bool` | While the prop's own clip plays; when false its meshes are not drawn. |
| `fn palette(&self) -> &[f32]` | 864 floats. The C field sona_prop_palette.palette (pointer). |

### Manifest

`struct Manifest`: An avatar's description and its edit verbs: wear, take off, colours, gender, body shape.

| Declaration | What it does |
|---|---|
| `fn parse(bytes: &[u8]) -> Result<Manifest>` | Reads 1000 bytes into a sona_manifest.<br>Calls [`sona_manifest_parse`](../reference.md#sona_manifest_parse). |
| `fn from_base64(text: &str) -> Result<Manifest>` | A manifest from base64 text, as the web SDK and the lookup routes give them. |
| `fn to_bytes(&self) -> Result<Vec<u8>>` | Byte-exact: parse(x).to_bytes == x.<br>Calls [`sona_manifest_write`](../reference.md#sona_manifest_write). |
| `fn raw(&self) -> &sys::sona_manifest` | The native pointer this value wraps, for a call through sona360-sys that the safe layer does not cover. |
| `fn raw_mut(&mut self) -> &mut sys::sona_manifest` | The C struct sona_manifest, to change it field by field. |
| `fn gender(&self) -> u32` | 1 male, 2 female, 0 unknown. |
| `fn valid(&self) -> bool` | Derived: IsValid. The C field sona_manifest.valid (flag (0 or 1)). |
| `fn wear(&mut self, item: &Guid, colours: [u32; 3], flags: u32) -> Result<()>` | sona_sys::SONA_EDIT_* flags. |
| `fn unwear(&mut self, slot_mask: u32, flags: u32) -> Result<()>` | Takes off what is in the slots of slot_mask.<br>Calls [`sona_manifest_unwear`](../reference.md#sona_manifest_unwear). |
| `fn undress_all(&mut self) -> Result<()>` | Takes everything off.<br>Calls [`sona_manifest_undress_all`](../reference.md#sona_manifest_undress_all). |
| `fn set_colour(&mut self, colour_slot: u32, argb: u32) -> Result<()>` | Sets one of the nine body colours, by its index in colours.<br>Calls [`sona_manifest_set_colour`](../reference.md#sona_manifest_set_colour). |
| `fn set_gender(&mut self, gender: u32, flags: u32) -> Result<()>` | Sets the gender: 1 male, 2 female.<br>Calls [`sona_manifest_set_gender`](../reference.md#sona_manifest_set_gender). |
| `fn set_shape(&mut self, weight: f32, height: f32) -> Result<()>` | Sets the weight and height.<br>Calls [`sona_manifest_set_shape`](../reference.md#sona_manifest_set_shape). |
| `fn ready_for_xbox(&self) -> bool` | 1 when the body (and so the gender) is known and the editor's Xbox clean-up would change nothing: the manifest can be saved to Xbox as it is.<br>Calls [`sona_manifest_ready_for_xbox`](../reference.md#sona_manifest_ready_for_xbox). |

### Renderer

`struct Renderer<'c>`: Owns a sona_renderer over a device the host owns.

| Declaration | What it does |
|---|---|
| `unsafe fn new(ctx: &'c Context, dev: &sys::sona_device_desc) -> Result<Option<Renderer<'c>>>` | Ok(None) while the shading data has not arrived (SONA_PENDING): update and try again.<br>Calls [`sona_renderer_create`](../reference.md#sona_renderer_create). |
| `fn raw(&self) -> *mut sys::sona_renderer` | The native pointer this value wraps, for a call through sona360-sys that the safe layer does not cover. |
| `unsafe fn draw(&mut self, view: &View, target: &sys::sona_target, opts: Option<&DrawOptions>) -> Result<Code>` | Draws every visible ready avatar into the target.<br>Calls [`sona_draw`](../reference.md#sona_draw). |
| `fn snapshot(&mut self, view: &View, width: u32, height: u32, opts: Option<&DrawOptions>) -> Result<Vec<u8>>` | Straight RGBA8, row 0 at the top.<br>Calls [`sona_snapshot`](../reference.md#sona_snapshot). |
| `fn frame_index(&self) -> u64` | The index of the last frame recorded (0 before the first).<br>Calls [`sona_renderer_frame_index`](../reference.md#sona_renderer_frame_index). |
| `fn frame_done(&mut self, completed_frame: u64)` | Vulkan, D3D12 and Metal: every frame up to and including completed_frame has finished on the GPU.<br>Calls [`sona_renderer_frame_done`](../reference.md#sona_renderer_frame_done). |
| `fn lost(&mut self)` | After a device loss: forget every GPU object.<br>Calls [`sona_renderer_lost`](../reference.md#sona_renderer_lost). |
| `unsafe fn reset(&mut self, dev: &sys::sona_device_desc) -> Result<()>` | Makes the renderer's GPU objects again on a device after a loss; unsafe as Renderer::new is.<br>Calls [`sona_renderer_reset`](../reference.md#sona_renderer_reset). |
| `fn set_style(&mut self, style: Option<&Style>) -> Result<()>` | The art style of every avatar without its own (with SONA_STYLE_OVERRIDE, of every avatar); None clears it.<br>Calls [`sona_renderer_set_style`](../reference.md#sona_renderer_set_style). |
| `fn style(&self) -> Result<Style>` | The renderer's style; Err(SONA_E_UNSUPPORTED) when its backend draws no styles.<br>Calls [`sona_renderer_style`](../reference.md#sona_renderer_style). |
| `fn set_quality(&mut self, q: Option<&Quality>) -> Result<()>` | From the next draw or snapshot.<br>Calls [`sona_renderer_set_quality`](../reference.md#sona_renderer_set_quality). |
| `fn quality(&self) -> Result<Quality>` | What the renderer uses: msaa is the sample count this device draws with.<br>Calls [`sona_renderer_quality`](../reference.md#sona_renderer_quality). |
| `fn set_lighting(&mut self, l: Option<&Lighting>) -> Result<()>` | The host's lights from the next draw; None: the original look again.<br>Calls [`sona_renderer_set_lighting`](../reference.md#sona_renderer_set_lighting). |
| `fn lighting(&self) -> Result<Option<Lighting>>` | The lighting set, or None.<br>Calls [`sona_renderer_lighting`](../reference.md#sona_renderer_lighting). |
| `fn snapshot_lit(&mut self, view: &View, width: u32, height: u32, opts: Option<&DrawOptions>, l: &Lighting) -> Result<Vec<u8>>` | Renderer::snapshot with this lighting for one picture.<br>Calls [`sona_snapshot_lit`](../reference.md#sona_snapshot_lit). |
| `fn set_environment_sh(&mut self, sh9: Option<&[f32; 27]>, skin_red: f32) -> Result<()>` | The lit avatars' environment: 9 RGB SH coefficients of radiance; None: the built-in cube. |
| `unsafe fn set_host_shadow(&mut self, s: Option<&sys::sona_host_shadow>) -> Result<()>` | The host's shadow map, which the lit avatars receive; None: none.<br>Calls [`sona_renderer_set_host_shadow`](../reference.md#sona_renderer_set_host_shadow). |
| `fn shadow_map(&self) -> Result<Option<sys::sona_shadow_map>>` | The renderer's own shadow map after its last lit frame with shadows, or None before one.<br>Calls [`sona_renderer_shadow_map`](../reference.md#sona_renderer_shadow_map). |
| `unsafe fn preview_draw(&mut self, preview: &mut Avatar<'c>, view: Option<&View>, target: &sys::sona_target, opts: Option<&DrawOptions>,) -> Result<Code>` | Renderer::draw with only this preview in the frame.<br>Calls [`sona_item_preview_draw`](../reference.md#sona_item_preview_draw). |
| `fn preview_snapshot(&mut self, preview: &mut Avatar<'c>, width: u32, height: u32, opts: Option<&DrawOptions>,) -> Result<Vec<u8>>` | Straight RGBA8 of only this preview, framed for width x height, row 0 at the top.<br>Calls [`sona_item_preview_snapshot`](../reference.md#sona_item_preview_snapshot). |
| `fn sticker(&mut self, avatar: &mut Avatar<'c>, opts: &StickerOptions, clip: Option<&str>) -> Result<Option<Picture>>` | A transparent, outlined cut-out (sona.h 3.12d).<br>Calls [`sona_sticker`](../reference.md#sona_sticker). |
| `fn sheet(&mut self, avatar: &mut Avatar<'c>, opts: &SheetOptions, clip: Option<&str>, name: Option<&str>, pixel: Option<&PixelOptions>,) -> Result<Option<Sheet<'c>>>` | A sprite sheet of the clip at frames x directions (sona.h 3.12d).<br>Calls [`sona_sheet_render`](../reference.md#sona_sheet_render). |
| `fn pick_gpu(&mut self, view: &View, x: f64, y: f64, o: &PickOptions) -> Result<Option<PickHit>>` | The pick through the GPU id buffer (Vulkan, GL, GLES; UNSUPPORTED elsewhere).<br>Calls [`sona_pick_gpu`](../reference.md#sona_pick_gpu). |
| `fn pick_gpu_ids(&mut self, view: &View, x: u32, y: u32, w: u32, h: u32, o: &PickOptions) -> Result<(Vec<u32>, Vec<u16>)>` | The id buffer of a region of the view's picture: (avatar ids, mesh index + 1), w * h each, row 0 on top.<br>Calls [`sona_pick_gpu_ids`](../reference.md#sona_pick_gpu_ids). |

### Sheet

`struct Sheet<'c>`: A rendered sprite sheet: pages, frames and their atlases.

| Declaration | What it does |
|---|---|
| `fn raw(&self) -> *mut sys::sona_sheet` | The native pointer this value wraps, for a call through sona360-sys that the safe layer does not cover. |
| `fn page_count(&self) -> u32` | The number of pages; 0 for NULL.<br>Calls [`sona_sheet_page_count`](../reference.md#sona_sheet_page_count). |
| `fn page(&self, page: u32) -> Result<(&[u8], u32, u32)>` | One page's pixels (straight RGBA8), its width and height; owned by the sheet.<br>Calls [`sona_sheet_page`](../reference.md#sona_sheet_page). |
| `fn frame_count(&self) -> u32` | frames * directions; 0 for NULL.<br>Calls [`sona_sheet_frame_count`](../reference.md#sona_sheet_frame_count). |
| `fn frame(&self, index: u32) -> Result<SheetFrame>` | One frame (index = direction * frames + frame): its page and rectangle, where the rectangle sits in the full cell (trim_x, trim_y), the cell's size, the pivot (the avatar's feet) in the cell, its direction, facing, t<br>Calls [`sona_sheet_frame_get`](../reference.md#sona_sheet_frame_get). |
| `fn atlas(&self, format: u32, page: u32, image: &str) -> Result<String>` | The atlas JSON: sys::SONA_ATLAS_ASEPRITE or _TEXTUREPACKER, one page (or SONA_ATLAS_ALL_PAGES with TexturePacker); image names the page file ("{n}" becomes the page number).<br>Calls [`sona_sheet_atlas`](../reference.md#sona_sheet_atlas), [`sona_free`](../reference.md#sona_free). |

### Catalogue

`struct Catalogue`: sona-catalogue.bin, loaded: every item id with its name, slots, game and source.

| Declaration | What it does |
|---|---|
| `fn load(path: impl AsRef<Path>) -> Result<Catalogue>` | Errors come back as codes only (Catalogue::load_with gives messages). |
| `fn load_with(ctx: &Context, path: impl AsRef<Path>) -> Result<Catalogue>` | With the context's allocator; errors carry its message and fix. |
| `fn from_bytes(bytes: &[u8]) -> Result<Catalogue>` | A copy of the file's bytes; the catalogue keeps its own.<br>Calls [`sona_catalogue_load_memory`](../reference.md#sona_catalogue_load_memory). |
| `fn raw(&self) -> *mut sys::sona_catalogue` | The native pointer this value wraps, for a call through sona360-sys that the safe layer does not cover. |
| `fn len(&self) -> u32` | Items, sorted by id.<br>Calls [`sona_catalogue_count`](../reference.md#sona_catalogue_count). |
| `fn is_empty(&self) -> bool` | True when the catalogue holds no item. |
| `fn get(&self, index: u32) -> Option<Item<'_>>` | One item.<br>Calls [`sona_catalogue_get`](../reference.md#sona_catalogue_get). |
| `fn iter(&self) -> impl Iterator<Item = Item<'_>> + '_` | Every item, in the catalogue's order. |
| `fn find(&self, id: &str) -> Option<u32>` | 32 hex digits, with or without dashes, braces or spaces, any case.<br>Calls [`sona_catalogue_find`](../reference.md#sona_catalogue_find). |
| `fn find_guid(&self, id: &Guid) -> Option<u32>` | The same from a parsed GUID.<br>Calls [`sona_catalogue_find_guid`](../reference.md#sona_catalogue_find_guid). |
| `fn search(&self, q: &Query, max: u32) -> Result<(Vec<u32>, u32)>` | Up to max matching indexes in id order, after q.offset, and the count of every match.<br>Calls [`sona_catalogue_search`](../reference.md#sona_catalogue_search). |
| `fn games(&self) -> Vec<(&str, u32)>` | The games items come from, sorted by name, each with its item count.<br>Calls [`sona_catalogue_game_count`](../reference.md#sona_catalogue_game_count), [`sona_catalogue_game`](../reference.md#sona_catalogue_game). |
| `fn generated(&self) -> &str` | When its data was made, ISO 8601.<br>Calls [`sona_catalogue_generated`](../reference.md#sona_catalogue_generated). |
| `fn languages(&self) -> Vec<&str>` | The BCP 47 tags of every language item names come in, sorted; "en" is always one.<br>Calls [`sona_catalogue_language_count`](../reference.md#sona_catalogue_language_count), [`sona_catalogue_language`](../reference.md#sona_catalogue_language). |
| `fn item_name(&self, index: u32, lang: &str) -> Result<Option<&str>>` | An item's name in lang; None when it has none there (show Item::name).<br>Calls [`sona_catalogue_item_name`](../reference.md#sona_catalogue_item_name). |

### PropMesh

`struct PropMesh<'c>`: A prop mesh of one context.

| Declaration | What it does |
|---|---|
| `fn raw(&self) -> *mut sys::sona_prop_mesh` | The native pointer this value wraps, for a call through sona360-sys that the safe layer does not cover. |
| `fn state(&self) -> c_int` | SONA_OK, SONA_PENDING (a stock prop still loading), or why it failed.<br>Calls [`sona_prop_mesh_state`](../reference.md#sona_prop_mesh_state). |
| `fn info(&self) -> Option<sys::sona_prop_mesh_info>` | None while it loads.<br>Calls [`sona_prop_mesh_info_get`](../reference.md#sona_prop_mesh_info_get). |
| `fn data(&self) -> Option<sys::sona_prop_data>` | The meshes in the data API's form, valid while the mesh lives; None while it loads.<br>Calls [`sona_prop_mesh_data`](../reference.md#sona_prop_mesh_data). |

### BlendSpace

`struct BlendSpace<'c>`: A blend space of one context.

| Declaration | What it does |
|---|---|
| `fn raw(&self) -> *mut sys::sona_blend_space` | The native pointer this value wraps, for a call through sona360-sys that the safe layer does not cover. |
| `fn weights(&self, x: f32, y: f32) -> Vec<f32>` | Each sample's weight at (x, y).<br>Calls [`sona_blend_space_weights`](../reference.md#sona_blend_space_weights). |

### StateMachine

`struct StateMachine<'c>`: A state machine of one context.

| Declaration | What it does |
|---|---|
| `fn raw(&self) -> *mut sys::sona_state_machine` | The native pointer this value wraps, for a call through sona360-sys that the safe layer does not cover. |
| `fn find(&self, state: &str) -> Option<u32>` | A state's index by name, -1 if unknown.<br>Calls [`sona_state_machine_find`](../reference.md#sona_state_machine_find). |
| `fn state_name(&self, state: u32) -> Option<String>` | A state's name, NULL past the last.<br>Calls [`sona_state_machine_state_name`](../reference.md#sona_state_machine_state_name). |

### LipSync

`struct LipSync`: Audio in, mouths out: PCM in any chunks, a frame every 10 ms, the same frames however it is chunked.

| Declaration | What it does |
|---|---|
| `fn new(sample_rate: u32, channels: u32) -> Result<LipSync>` | Float samples in -1..1 (interleaved when channels > 1). |
| `fn with_format(sample_rate: u32, channels: u32, s16: bool) -> Result<LipSync>` | s16: 16-bit samples, for LipSync::feed_i16.<br>Calls [`sona_lipsync_create`](../reference.md#sona_lipsync_create). |
| `fn feed(&mut self, pcm: &[f32]) -> Result<()>` | frames: samples per channel.<br>Calls [`sona_lipsync_feed`](../reference.md#sona_lipsync_feed). |
| `fn feed_i16(&mut self, pcm: &[i16]) -> Result<()>` | For an analyser made with s16.<br>Calls [`sona_lipsync_feed`](../reference.md#sona_lipsync_feed). |
| `fn read(&mut self) -> Vec<LipSyncFrame>` | The frames made since the last read, oldest first.<br>Calls [`sona_lipsync_read`](../reference.md#sona_lipsync_read). |
| `fn current(&self) -> LipSyncFrame` | The newest frame.<br>Calls [`sona_lipsync_current`](../reference.md#sona_lipsync_current). |
| `fn latency(&self) -> f64` | Seconds from a sample being fed to the first frame that hears it.<br>Calls [`sona_lipsync_latency`](../reference.md#sona_lipsync_latency). |
| `fn reset(&mut self)` | Back to time 0: hints and frames waiting to be read are dropped.<br>Calls [`sona_lipsync_reset`](../reference.md#sona_lipsync_reset). |
| `fn hint(&mut self, phonemes: &[(&str, f32, f32)]) -> Result<()>` | Phonemes the host's TTS reported (symbol, start, end), on the fed audio's clock.<br>Calls [`sona_lipsync_hint`](../reference.md#sona_lipsync_hint). |

### VoiceMouth

`struct VoiceMouth(pub sys::sona_voice_mouth)`: Voice chat: one speaker's mouth from its audio level alone.

| Declaration | What it does |
|---|---|
| `fn new(seed: u32) -> VoiceMouth` | Sets size and starts the state from seed.<br>Calls [`sona_voice_mouth_init`](../reference.md#sona_voice_mouth_init). |
| `fn step(&mut self, level: f32, dt: f32) -> (u8, f32)` | (mouth, open) after dt seconds at this level (linear RMS).<br>Calls [`sona_voice_mouth_step`](../reference.md#sona_voice_mouth_step). |

### HeadlessOptions

`struct HeadlessOptions(pub sys::sona_headless_options)`: How to open a headless renderer; Default is sona_headless_defaults.

| Declaration | What it does |
|---|---|
| `fn device(mut self, kind: sys::sona_device_kind) -> Self` | SONA_DEVICE_AUTO, _GPU or _SOFTWARE. |
| `fn backend(mut self, b: sys::sona_backend) -> Self` | 0 (Vulkan, then GL), SONA_BACKEND_VULKAN or SONA_BACKEND_GL. |
| `fn batch_in_flight(mut self, n: u32) -> Self` | Avatars a batch builds ahead; 0: 8, at most 32. The C field sona_headless_options.batch_in_flight (count). |

### SequenceOptions

`struct SequenceOptions(pub sys::sona_sequence_options)`: Frames of a clip at a fixed rate; its Default is what sona_sequence_defaults sets (frames 0: the clip's length).

| Declaration | What it does |
|---|---|
| `fn turntable(frames: u32) -> Self` | A turntable: frames pictures over one turn. |

### Headless

`struct Headless<'c>`: A renderer on the library's own device: the best GPU, or lavapipe or llvmpipe.

| Declaration | What it does |
|---|---|
| `fn open(ctx: &'c Context, o: &HeadlessOptions) -> Result<Headless<'c>>` | Makes the device and a renderer on it, waiting up to wait_seconds for the ctx's shading data.<br>Calls [`sona_headless_open`](../reference.md#sona_headless_open). |
| `fn raw(&self) -> *mut sys::sona_headless` | The native pointer this value wraps, for a call through sona360-sys that the safe layer does not cover. |
| `fn info(&self) -> HeadlessDevice` | The device it drew on.<br>Calls [`sona_headless_info_get`](../reference.md#sona_headless_info_get). |
| `fn render(&self, a: &Avatar<'c>, o: &RenderOptions) -> Result<Vec<u8>>` | One picture of an avatar of the context, alone.<br>Calls [`sona_headless_render`](../reference.md#sona_headless_render). |
| `fn render_manifest(&self, manifest: &[u8], o: &RenderOptions) -> Result<Vec<u8>>` | Adds the avatar (hidden, standing still or playing clip from time), draws it and removes it.<br>Calls [`sona_headless_render_manifest`](../reference.md#sona_headless_render_manifest). |
| `fn batch(&self, manifests: &[&[u8]], o: &RenderOptions) -> Result<Vec<(Code, Option<Vec<u8>>)>>` | One (result, pixels) per manifest, in order; a bad manifest gives its code and no pixels.<br>Calls [`sona_headless_batch`](../reference.md#sona_headless_batch). |
| `fn sequence(&self, a: &Avatar<'c>, o: &RenderOptions, s: &SequenceOptions) -> Result<Vec<Vec<u8>>>` | Every frame: frame i at the clip's start + i / fps, turned turn_deg * i / frames.<br>Calls [`sona_headless_sequence`](../reference.md#sona_headless_sequence). |
| `fn record(&self, a: &Avatar<'c>, o: &RenderOptions, s: &SequenceOptions, v: &mut Video<'c>) -> Result<()>` | sona_headless_sequence into a video.<br>Calls [`sona_headless_record`](../reference.md#sona_headless_record). |
| `fn tier_detect(&self) -> Result<u32>` | The tier (SONA_TIER_LOW..<br>Calls [`sona_tier_detect`](../reference.md#sona_tier_detect), [`sona_headless_renderer`](../reference.md#sona_headless_renderer). |

### Video

`struct Video<'c>`: A PNG sequence, GIF, MP4 or WebM.

| Declaration | What it does |
|---|---|
| `fn open(ctx: &'c Context, path: Option<&Path>, o: &sys::sona_video_options, ffmpeg: Option<&str>) -> Result<Video<'c>>` | o: sona_video_defaults with width and height set (and anything else).<br>Calls [`sona_video_open`](../reference.md#sona_video_open). |
| `fn defaults(width: u32, height: u32) -> sys::sona_video_options` | sona_video_defaults at this size.<br>Calls [`sona_video_defaults`](../reference.md#sona_video_defaults). |
| `fn frame(&mut self, rgba: &[u8]) -> Result<()>` | One frame of width * height straight RGBA8, row 0 at the top.<br>Calls [`sona_video_frame`](../reference.md#sona_video_frame). |
| `fn finish(mut self) -> Result<Option<Vec<u8>>>` | Ends the file: the bytes of an in-memory video, else None.<br>Calls [`sona_video_finish`](../reference.md#sona_video_finish), [`sona_free`](../reference.md#sona_free). |

### Players

`struct Players`: Friends, lobby members and leaderboard rows by id: a gamertag, "a:<account>/<slot>" or "w:<case key>".

| Declaration | What it does |
|---|---|
| `fn open(o: &PlayersOptions) -> Result<Players>` | Zeroes the config and sets size; zero fields take the defaults (2048 looks, an interval of 600 s, 60 an hour, 4 at once, a timeout of 15 s).<br>Calls [`sona_players_defaults`](../reference.md#sona_players_defaults), [`sona_players_open`](../reference.md#sona_players_open). |
| `fn watch(&mut self, ids: &[&str], priority: i32) -> Result<()>` | Ok, or the first problem (an id that is not an id, over max_players); the others are watched all the same.<br>Calls [`sona_players_watch`](../reference.md#sona_players_watch). |
| `fn unwatch(&mut self, ids: Option<&[&str]>) -> Result<()>` | None: every id.<br>Calls [`sona_players_unwatch`](../reference.md#sona_players_unwatch). |
| `fn refresh(&mut self, ids: Option<&[&str]>) -> Result<()>` | None: every watched id.<br>Calls [`sona_players_refresh`](../reference.md#sona_players_refresh). |
| `fn update(&mut self) -> u32` | Each frame.<br>Calls [`sona_players_update`](../reference.md#sona_players_update). |
| `fn poll(&mut self) -> Vec<PlayerEvent>` | Every event waiting, oldest first; an empty list when there are none.<br>Calls [`sona_players_poll`](../reference.md#sona_players_poll). |
| `fn look(&mut self, id: &str) -> (PlayerLook, Result<()>)` | Always a look to draw; Err(NOT_FOUND) for an id never watched nor cached, Err(ARGUMENT) for one that is not an id.<br>Calls [`sona_players_look`](../reference.md#sona_players_look). |
| `fn forget(&mut self, id: &str) -> Result<()>` | Drops the id's look from memory and, at the next write, from the cache file, and stops watching it.<br>Calls [`sona_players_forget`](../reference.md#sona_players_forget). |
| `fn stats(&self) -> sys::sona_players_stats` | Looks kept, ids watched, requests in flight and due, and counts since open: requests, changed, the same, 304s, gone, failed, read from disk, disk writes, waits for per_hour; paused_until.<br>Calls [`sona_players_stats_get`](../reference.md#sona_players_stats_get). |
| `fn placeholder() -> Vec<u8>` | The built-in placeholder look.<br>Calls [`sona_players_placeholder`](../reference.md#sona_players_placeholder). |

### Maker

`struct Maker<'a>`: A catalogue's outfit rules, indexed once: seeded random avatars, dress like, clashes, matched sets and the outfit check.

| Declaration | What it does |
|---|---|
| `fn new(catalogue: &'a Catalogue) -> Result<Maker<'a>>` | Indexes a catalogue's outfit rules once: candidate items per body and section, gender variants and matched sets.<br>Calls [`sona_maker_create`](../reference.md#sona_maker_create). |
| `fn raw(&self) -> *const sys::sona_maker` | The native pointer this value wraps, for a call through sona360-sys that the safe layer does not cover. |
| `fn random(&self, seed: u32, o: &RandomOptions<'_>) -> Result<RandomAvatar>` | A seeded random avatar: the same seed and options give the same bytes.<br>Calls [`sona_random_defaults`](../reference.md#sona_random_defaults), [`sona_make_random`](../reference.md#sona_make_random). |
| `fn dress_like(&self, body: &[u8], like: &[u8], parts: u32, match_: u32, layer: bool) -> Result<DressedLike>` | body wearing like's parts (sona_sys::SONA_LIKE_*; 0: clothes and props), each item resolved for body.<br>Calls [`sona_like_defaults`](../reference.md#sona_like_defaults), [`sona_make_dress_like`](../reference.md#sona_make_dress_like). |
| `fn variant(&self, item: &Guid, body: u32, match_: u32) -> (u32, Option<Guid>)` | What body (1 or 2) wears for item: sona_sys::SONA_RESOLVED_* and the item, None when dropped.<br>Calls [`sona_make_variant`](../reference.md#sona_make_variant). |
| `fn conflicts(&self, manifest: &[u8], item: &Guid) -> Result<Vec<Guid>>` | The ids wearing item would take off manifest.<br>Calls [`sona_outfit_conflicts`](../reference.md#sona_outfit_conflicts). |
| `fn set_count(&self) -> u32` | How many matched sets (outfits sold as one) the maker knows.<br>Calls [`sona_outfit_set_count`](../reference.md#sona_outfit_set_count). |
| `fn set(&self, index: u32) -> Option<OutfitSet<'_>>` | Set set: its item count, which bodies wear it, the sections it has items in and the slots it covers.<br>Calls [`sona_outfit_set_get`](../reference.md#sona_outfit_set_get). |
| `fn set_of(&self, item: &Guid) -> Option<u32>` | The matched set an item belongs to, or -1 when it is in none.<br>Calls [`sona_outfit_set_of`](../reference.md#sona_outfit_set_of). |
| `fn set_items(&self, set: u32, body: u32) -> Vec<u32>` | Catalogue indexes of a set's items a body wears (0: every item).<br>Calls [`sona_outfit_set_items`](../reference.md#sona_outfit_set_items). |
| `fn check(&self, manifest: &[u8]) -> Result<OutfitReport>` | Checks a manifest's outfit for clashes and missing pieces (sona_outfit_check). |
| `fn fix(&self, manifest: &mut [u8]) -> Result<OutfitReport>` | As outfit_fix with this maker: repairs the manifest in place and reports what it changed. |

### PickHit

`struct PickHit`: One pick: the avatar (by id and handle), the item, mesh and triangle, the joint and body region, and where.

| Declaration | What it does |
|---|---|
| `fn avatar_id(&self) -> u32` | Sona_avatar_id. The C field sona_pick_hit.avatar_id (index or id). |
| `fn avatar(&self) -> *mut sys::sona_avatar` | The native handle, to compare with Avatar::raw. |
| `fn item(&self) -> String` | The item's id ("" for a bounds hit). |
| `fn mesh(&self) -> Option<u32>` | Index into sona_pose_data.meshes; -1 for a sphere hit. The C field sona_pick_hit.mesh (index or id). |
| `fn joint(&self) -> Option<u32>` | The named joint (sona_joint_name) that moves the point most; -1 for a prop. The C field sona_pick_hit.joint (index or id). |
| `fn region(&self) -> &'static str` | Sona_body_region of that joint. The C field sona_pick_hit.region (sona_body_region value). |
| `fn distance(&self) -> f32` | Metres from the ray's origin, along its unit direction. The C field sona_pick_hit.distance (m (world units)). |
| `fn point(&self) -> [f32; 3]` | World. The C field sona_pick_hit.point (m (world units)). |
| `fn normal(&self) -> [f32; 3]` | World, unit, toward the ray: the triangle's, or the sprite's for a picture. The C field sona_pick_hit.normal (direction (unit vector)). |

### Theme

`struct Theme<'a>`: The game's colours (0xAARRGGBB), corner radius, scale and font.

| Declaration | What it does |
|---|---|
| `fn dark() -> Theme<'static>` | The console slate. |
| `fn light() -> Theme<'static>` | 360sona.com's editor. |

### Control

`struct Control`: One control on screen, for a screen reader or the host's own hit tests.

| Declaration | What it does |
|---|---|
| `fn focused(&self) -> bool` | The control has the focus. |
| `fn selected(&self) -> bool` | The control is the chosen one: a worn item, the current tab. |

### Editor

`struct Editor<'c>`: The player editor.

| Declaration | What it does |
|---|---|
| `fn open(ctx: &'c Context, cat: &'c Catalogue, o: &Options, theme: Option<&Theme>) -> Result<Editor<'c>>` | theme None: the light theme.<br>Calls [`sona_editor_defaults`](../reference.md#sona_editor_defaults), [`sona_editor_open`](../reference.md#sona_editor_open). |
| `fn raw(&self) -> *mut sys::sona_editor` | The native pointer, for a sona-editor-sys call this crate does not wrap. |
| `fn feed(&mut self, input: &sys::sona_editor_input) -> Result<()>` | One input event as sona_editor.h has it; the calls below make them.<br>Calls [`sona_editor_feed`](../reference.md#sona_editor_feed). |
| `fn button(&mut self, b: Pad, down: bool) -> Result<()>` | A gamepad button pressed (down true) or released. |
| `fn press(&mut self, b: Pad, dt: f64) -> Result<Status>` | Down, an update, up, an update. |
| `fn axis(&mut self, a: Axis, value: f32) -> Result<()>` | A stick's or a trigger's position. |
| `fn key(&mut self, k: Key, down: bool, mods: u32) -> Result<()>` | mods: sys::SONA_EDITOR_MOD_*. |
| `fn text(&mut self, s: &str) -> Result<()>` | Typed text, for the search box. |
| `fn pointer(&mut self, x: f32, y: f32, down: Option<bool>, id: u32) -> Result<()>` | x, y in the editor's pixels; down Some(true) pressed, Some(false) released, None moved; id a touch or 0. |
| `fn wheel(&mut self, x: f32, y: f32, lines: f32) -> Result<()>` | lines: + is up. |
| `fn update(&mut self, dt: f64) -> Status` | Advances dt seconds (and, unless HOST_UPDATES, updates the context).<br>Calls [`sona_editor_update`](../reference.md#sona_editor_update). |
| `fn status(&self) -> Status` | SONA_EDITOR_RUNNING, _DONE or _CANCELLED, as the last sona_editor_update returned.<br>Calls [`sona_editor_status`](../reference.md#sona_editor_status). |
| `fn result(&self) -> Result<[u8; MANIFEST_BYTES]>` | The avatar as it stands; after Cancelled, the start manifest. |
| `fn screen(&self) -> Screen` | The screen shown now.<br>Calls [`sona_editor_screen_get`](../reference.md#sona_editor_screen_get). |
| `fn set_screen(&mut self, s: Screen) -> Result<()>` | Refused (ARGUMENT) for a screen the mode does not have.<br>Calls [`sona_editor_set_screen`](../reference.md#sona_editor_set_screen). |
| `fn screens(&self) -> Vec<Screen>` | The mode's screens in tab order.<br>Calls [`sona_editor_screens`](../reference.md#sona_editor_screens). |
| `fn set_search(&mut self, text: Option<&str>) -> Result<()>` | The search box, for a host with its own on-screen keyboard; None clears it.<br>Calls [`sona_editor_set_search`](../reference.md#sona_editor_set_search). |
| `fn set_theme(&mut self, t: &Theme) -> Result<()>` | Changes the colours and sizes from the next frame.<br>Calls [`sona_editor_set_theme`](../reference.md#sona_editor_set_theme). |
| `fn resize(&mut self, width: u32, height: u32) -> Result<()>` | The editor's size in pixels, the size of the target it is drawn into.<br>Calls [`sona_editor_resize`](../reference.md#sona_editor_resize). |
| `fn size(&self) -> (u32, u32)` | The editor's size in pixels. |
| `fn busy(&self) -> bool` | True while an avatar is still building.<br>Calls [`sona_editor_busy`](../reference.md#sona_editor_busy). |
| `fn build_failures(&self) -> u32` | How many avatar builds failed since open (the screen reader is told each time).<br>Calls [`sona_editor_build_failures`](../reference.md#sona_editor_build_failures). |
| `fn undo(&mut self, redo: bool) -> bool` | Undo (or redo) one step; false when there is none.<br>Calls [`sona_editor_undo`](../reference.md#sona_editor_undo). |
| `fn can_undo(&self, redo: bool) -> bool` | 1 when sona_editor_undo with the same redo would step: use it to grey out the buttons.<br>Calls [`sona_editor_can_undo`](../reference.md#sona_editor_can_undo). |
| `fn zoom(&self) -> f64` | 1 is the editor's framing.<br>Calls [`sona_editor_zoom`](../reference.md#sona_editor_zoom). |
| `fn set_zoom(&mut self, zoom: f64) -> f64` | 0.6 to 3.<br>Calls [`sona_editor_zoom`](../reference.md#sona_editor_zoom). |
| `fn turn(&mut self, degrees: f64)` | Positive turns the avatar to its left.<br>Calls [`sona_editor_turn`](../reference.md#sona_editor_turn). |
| `fn view(&self) -> Result<View>` | The camera the avatar layer is drawn with.<br>Calls [`sona_editor_view`](../reference.md#sona_editor_view). |
| `unsafe fn draw(&mut self, r: &mut Renderer<'_>, target: &sona_sys::sona_target, opts: Option<&DrawOptions>) -> Result<Code>` | The whole editor into the target: the avatar with the renderer, the UI over it.<br>Calls [`sona_editor_draw`](../reference.md#sona_editor_draw). |
| `unsafe fn draw_avatar(&mut self, r: &mut Renderer<'_>, target: &sona_sys::sona_target, opts: Option<&DrawOptions>) -> Result<Code>` | The avatar layer alone, for a host that draws the UI with its own 2D pass (Editor::draw_data).<br>Calls [`sona_editor_draw_avatar`](../reference.md#sona_editor_draw_avatar). |
| `fn thumbnails(&mut self, r: &mut Renderer<'_>, budget: u32) -> u32` | Renders up to budget pending item pictures, for a host that draws the avatar with its own sona_draw.<br>Calls [`sona_editor_thumbnails`](../reference.md#sona_editor_thumbnails). |
| `fn snapshot(&mut self, r: &mut Renderer<'_>) -> Result<Vec<u8>>` | The whole picture at the editor's size, straight RGBA8.<br>Calls [`sona_editor_snapshot`](../reference.md#sona_editor_snapshot). |
| `fn render_ui(&mut self, width: u32, height: u32) -> Result<Vec<u8>>` | The UI layer on the CPU, straight RGBA8 on a transparent clear.<br>Calls [`sona_editor_render_ui`](../reference.md#sona_editor_render_ui). |
| `fn render_ui_over(&mut self, rgba: &mut [u8], width: u32, height: u32) -> Result<()>` | The UI layer blended over a picture of the avatar layer (width x height straight RGBA8).<br>Calls [`sona_editor_render_ui`](../reference.md#sona_editor_render_ui). |
| `fn draw_data(&mut self) -> Result<DrawData<'_>>` | The UI layer's triangles; they borrow the editor until the next update.<br>Calls [`sona_editor_draw_data_get`](../reference.md#sona_editor_draw_data_get). |
| `fn texture(&mut self, id: u32) -> Result<Texture<'_>>` | A texture the draw data names by id, with its pixels (straight RGBA8, owned by the editor) and the rectangle that changed since an older revision, for a host that draws the UI layer itself.<br>Calls [`sona_editor_texture_get`](../reference.md#sona_editor_texture_get). |
| `fn controls(&self) -> Vec<Control>` | Every control on screen, in reading order.<br>Calls [`sona_editor_control_count`](../reference.md#sona_editor_control_count), [`sona_editor_control_get`](../reference.md#sona_editor_control_get). |
| `fn focus(&self) -> Option<Control>` | None when nothing has focus (pointer-only use).<br>Calls [`sona_editor_focus_get`](../reference.md#sona_editor_focus_get). |
| `fn announcement(&mut self) -> Option<String>` | What a screen reader should say since the last call; None when nothing changed.<br>Calls [`sona_editor_announcement`](../reference.md#sona_editor_announcement). |

### Types

| Declaration | What it does |
|---|---|
| `type Result<T> = std::result::Result<T, Error>` | The C type sona_result. |
| `enum ReadKind` | The C type sona_read_kind. |
| `struct RequestId(usize)` | Identifies one read, so cancel can match it. |
| `trait Source: Send` | A host-written source. |
| `enum LogLevel` | How serious a log line is: debug, info, warn, error (SONA_LOG_*). |
| `type Budget = sys::sona_budget` | Memory budget in bytes. The C type sona_budget. |
| `struct Placement` | The C type sona_placement. |
| `struct PlayOptions` | The C type sona_play_options. |
| `enum Preset` | The C type sona_preset. |
| `enum Space` | Which space a pose or target is given in: world or the avatar's own (SONA_SPACE_*). |
| `enum OverrideMode` | How a joint override applies: replace the clip's rotation or add to it (SONA_OVERRIDE_*). |
| `enum RootMotion` | What happens to a clip's root motion: off, extract or apply (SONA_ROOT_MOTION_*). |
| `enum Lod` | The level of detail an avatar was drawn at: full, sampled, quarter, sprite (SONA_LOD_*). |
| `enum ClipEventKind` | The C type sona_clip_event_kind. |
| `struct ClipEvent` | The C type sona_clip_event. |
| `enum Skeleton` | The skeletons the rig's joints map onto. |
| `struct ExportOptions` | What Avatar::export writes. |
| `type ExportReport = sys::sona_export_report` | The C type sona_export_report. |
| `type IdleOptions = sys::sona_idle_options` | The C type sona_idle_options. |
| `type IdleState = sys::sona_idle_state` | The C type sona_idle_state. |
| `struct Picture` | A straight RGBA8 picture, row 0 at the top. |
| `type Style = sys::sona_style` | An art style: the original look, no outline, every parameter at its default; set kind and flags after. |
| `enum EventKind` | What an event says: ready, failed, an error, the licence checked (SONA_EVENT_*). |
| `struct Event` | The C type sona_event. |
| `struct ClipInfo` | The C type sona_clip_info. |
| `type FrameStats = sys::sona_frame_stats` | The C type sona_frame_stats. |
| `type SceneStats = sys::sona_scene_stats` | The C type sona_scene_stats. |
| `type View = sys::sona_view` | The C struct sona_view under its Rust name: A camera: the eye, the target, the vertical field of view in degrees, near and far, and the target size in pixels, kept in doubles. |
| `type Material = sys::sona_material` | Address modes: bit 0 set = U wraps, bit 1 set = V wraps; clear = clamp. The C type sona_material. |
| `type DrawOptions = sys::sona_draw_options` | The C type sona_draw_options. |
| `type Guid = sys::sona_guid` | The C type sona_guid. |
| `type Capsule = sys::sona_capsule` | A vertical capsule around the posed body, in world space, for collisions: the segment a..b and its radius. The C type sona_capsule. |
| `type LodOptions = sys::sona_lod_options` | Each sona_update gives every avatar in view a step by its height on screen in pixels: FULL (posed every frame), SAMPLED (posed when the clip reaches a new frame), QUARTER (also at most every 4th frame) and SPRITE (a pict The C type sona_lod_options. |
| `type LodStats = sys::sona_lod_stats` | The C type sona_lod_stats. |
| `type PreviewOptions = sys::sona_preview_options` | The C type sona_preview_options. |
| `type Quality = sys::sona_quality` | The C type sona_quality. |
| `type Lighting = sys::sona_lighting` | sona.h 3.12e: the host's lights and shadows. |
| `type PixelOptions = sys::sona_pixel_options` | The C type sona_pixel_options. |
| `type StickerOptions = sys::sona_sticker_options` | The C type sona_sticker_options. |
| `type SheetOptions = sys::sona_sheet_options` | The C type sona_sheet_options. |
| `type SheetFrame = sys::sona_sheet_frame` | One frame of a sheet. The C type sona_sheet_frame. |
| `struct Shading` | The fixed shading inputs, for hosts that rebuild our look in their own shaders. The C type sona_shading. |
| `struct Credit` | The C type sona_credit. |
| `enum Pass` | The C type sona_pass. |
| `enum Route` | The C type sona_route. |
| `struct Query` | What Catalogue::search matches. |
| `struct Item<'a>` | One item. |
| `enum LayerKind` | What a layer plays: a clip, a blend space or a state machine. |
| `struct LayerOptions` | What a layer plays and how: Avatar::layer_play, Avatar::layer_blend, Avatar::layer_machine. |
| `struct LayerInfo` | The C type sona_layer_info. |
| `enum LayerEventKind` | The C type sona_layer_event_kind. |
| `struct LayerEvent` | The C type sona_layer_event. |
| `struct BlendSample<'a>` | The C type sona_blend_sample. |
| `enum Motion<'a>` | What a state plays: a clip by key or a blend space. |
| `struct StateSpec<'a>` | One state of a state machine: its name, what it plays, its loop and speed (sona_state_desc). |
| `enum Cond` | A transition's condition on a parameter: greater, less, equal, or a trigger (sona_condition). |
| `struct TransitionSpec<'a>` | A transition between states: where to, its fade, its exit time and conditions (sona_transition_desc). |
| `enum Mask` | The joint masks layers play on: a preset or a branch from a joint (sona_mask_preset, sona_mask_branch). |
| `type LipSyncFrame = sys::sona_lipsync_frame` | One step of the lip sync analysis of a LipSync: time, mouth, open, level and the shape weights (sona_lipsync_frame). |
| `type MouthKey = sys::sona_mouth_key` | A mouth from time on. |
| `struct HeadlessDevice` | One device a headless renderer can open. |
| `struct RenderOptions` | What one picture looks like. |
| `enum PlayerState` | Where an id's look stands. |
| `struct PlayerLook` | The look to draw for an id: the player's, or the placeholder. |
| `enum PlayerEvent` | What changed for an id since the last poll. |
| `struct PlayersOptions` | The options of Players::open; zero fields take the library's defaults. |
| `struct RandomOptions<'f>` | The options of Maker::random. |
| `struct RandomAvatar` | What Maker::random made. |
| `struct LikeItem` | One item Maker::dress_like copied: from, what this body wears for it, and how it came across. |
| `struct DressedLike` | What sona_make_dress_like kept, varied, swapped and dropped (sona_like_report). |
| `struct OutfitSet<'a>` | One matched set. |
| `struct OutfitIssue` | One issue of outfit_check. |
| `struct OutfitReport` | The C type sona_outfit_report. |
| `struct PickOptions` | Which avatars a pick considers and how far it looks. |
| `struct MeshItem` | A custom item of your own skinned mesh (format 1.1): what Context::custom_item_pack_mesh takes. |
| `enum Mode` | Which editor opens: the full one, the quick creator or the wardrobe picker. |
| `enum Status` | What the editor answers each update; Done and Cancelled stay. |
| `enum Screen` | A screen of the editor. |
| `enum Pad` | A gamepad button. |
| `enum Axis` | A stick axis (-1 to 1, +y down) or a trigger (0 to 1). |
| `enum Key` | A keyboard key the editor takes (text for the search box comes through Editor::text). |
| `struct Options<'a>` | How the editor opens. |
| `struct DrawData<'e>` | The UI layer as triangles for the host's own 2D pass, as of the last update. |

## WebAssembly (JavaScript)

138 public names in `bindings/wasm/sona-core.mjs`.

### Functions and constants

| Declaration | What it does |
|---|---|
| `const RESULT = Object.freeze({` | The result codes by name: OK, PENDING and the errors, the values of sona_result. |
| `const STATES = Object.freeze(['queued', 'loading', 'ready', 'failed', 'removed'])` | The avatar states by number: queued, loading, ready, failed, removed. |
| `const EVENTS = Object.freeze(['none', 'ready', 'failed', 'error', 'licence-ok'])` | The event kinds by number: none, ready, failed, error, licence-ok. |
| `const READ_KINDS = Object.freeze(['asset', 'data'])` | What a source read is for: an asset or a data file. |
| `const SOURCE_KINDS = Object.freeze({ custom: 0, gate: 1, dir: 2, console: 3 })` | The source kinds: custom, gate, dir, console. |
| `const PASSES = Object.freeze(['opaque', 'transparent'])` | The draw passes: opaque and transparent. |
| `const MAT = Object.freeze({ SKIN: 1, REFLECTIVE: 2, FACE: 4, TRANSPARENT: 8, CARRYABLE: 16 })` | Material flags: skin, reflective, face, transparent, carryable. |
| `const CFG = Object.freeze({ STILL_FACES: 1, APP_BEHAVIOUR: 2, NO_CPU_SKIN: 4 })` | Config flags: still faces, the app's behaviour, no CPU skinning. |
| `const DRAW = Object.freeze({ SHADOW: 1, NO_BLOOM: 2, EDITOR_AO: 8, NO_CREDIT: 16 })` | Draw flags: SHADOW, NO_BLOOM, EDITOR_AO, NO_CREDIT, the values of SONA_DRAW_*. |
| `const PRESETS = Object.freeze({ full: 0, upper: 1, bust: 2, face: 3 })` | The camera presets: full, upper, bust, face. |
| `const JOINT_COUNT = 72` | The number of palette slots, 72: the value of SONA_JOINTS. |
| `const QUEUE_MAX = 8` | How many clips an avatar's queue holds, 8: the value of SONA_QUEUE_MAX. |
| `const OVERRIDE = Object.freeze({ replace: 0, add: 1 })` | How a joint override applies: replace or add. |
| `const ROOT_MOTION = Object.freeze({ off: 0, extract: 1, apply: 2 })` | What happens to a clip's root motion: off, extract, apply. |
| `const LOD_STEPS = Object.freeze(['full', 'sampled', 'quarter', 'sprite'])` | The levels of detail by number: full, sampled, quarter, sprite. |
| `const CLIP_EVENTS = Object.freeze([null, 'started', 'looped', 'ended', 'foot-left', 'foot-right', 'mark'])` | Clip events by number: started, looped, ended, a foot down, a mark. |
| `const MOUTH = Object.freeze({ NEUTRAL: 0, O: 7, AI: 8, EE: 9, FV: 10, W: 11, L: 12, DTH: 13 })` | The mouth shapes lip sync uses, by number. |
| `const PREVIEW = Object.freeze({ PLAY: 1, COLOURS: 2 })` | Item preview flags: play its clip, show its colours. |
| `const QUALITY = Object.freeze({ MSAA_AUTO: 0, MIPS: 1, CUTOUT_MIPS: 2 })` | Quality values: MSAA_AUTO, and the flags MIPS and CUTOUT_MIPS. |
| `const ITEM = Object.freeze({ OFFERED: 1, NAMED: 2, STOCK: 4, AWARD: 8, MARKETPLACE: 16, HIDDEN: 32,` | Item flags: offered, named, stock, award, marketplace, hidden and the rest. |
| `const ITEM_KINDS = Object.freeze(['unknown', 'model', 'texture', 'shape-override', 'animation'])` | What an item's file holds: a model, a texture, a shape override, an animation. |
| `const ROUTES = Object.freeze(['rejected', 'worn', 'bare', 'face'])` | How an outfit check placed an item: rejected, worn, bare, face. |
| `async function loadSonaCore(moduleArgs = {})` | Loads the WebAssembly module and returns a SonaCore on it. |

### SonaCore

`class SonaCore`: The loaded WASM core: opens contexts and reads and writes the core's memory.

| Declaration | What it does |
|---|---|
| `get u8()` | Reads an unsigned byte from the core's memory. |
| `u32(p)` | Reads an unsigned 32-bit number from the core's memory. |
| `i32(p)` | Reads a signed 32-bit number from the core's memory. |
| `f32(p)` | Reads a 32-bit float from the core's memory. |
| `f64(p)` | Reads a 64-bit float from the core's memory. |
| `setU32(p, v)` | Writes an unsigned 32-bit number into the core's memory. |
| `setI32(p, v)` | Writes a signed 32-bit number into the core's memory. |
| `setF32(p, v)` | Writes a 32-bit float into the core's memory. |
| `setF64(p, v)` | Writes a 64-bit float into the core's memory. |
| `str(p)` | Reads a UTF-8 string from the core's memory (null for a NULL pointer). |
| `view(Type, p, n)` | A typed array of n elements over the core's memory at p, not copied: valid until the memory next grows. |
| `copy(Type, p, n)` | Copies bytes out of the core's memory into a new typed array. |
| `alloc(n)` | Allocates core memory; throws SonaCoreError when it cannot. |
| `free(p)` | Frees memory the library handed out (sona_png_encode), through the ctx's allocator. |
| `cstr(s)` | Copies a string into core memory as UTF-8 with its zero. |
| `bytes(b)` | Copies bytes into core memory. |
| `off(name)` | sona_struct_offset, cached; throws when the core does not know the field (an ABI mismatch).<br>Calls [`sona_struct_offset`](../reference.md#sona_struct_offset). |
| `size(name)` | sizeof a public struct of the core, by its name ("sona_config",...); 0 if unknown.<br>Calls [`sona_struct_size`](../reference.md#sona_struct_size). |
| `resultName(r)` | The name of a code ("licence", "gate",...): the same words as the web SDK's SonaError.code.<br>Calls [`sona_result_name`](../reference.md#sona_result_name). |
| `error(r, message, fix)` | A SonaCoreError for a sona_result. |
| `httpPlatform()` | NULL in this build: gate reads go through the web bridge (bridge-source.mjs).<br>Calls [`sona_http_platform`](../reference.md#sona_http_platform). |
| `complete(req, v)` | Completes a request: bytes (OK), null (not found), or { status: 'ok' \| 'not_found' \| 'io', bytes }.<br>Calls [`sona_complete`](../reference.md#sona_complete). |
| `open(cfg = {})` | cfg: { sources: { read(kind, name) } \| { kind: 'gate' \| 'dir' \| 'console', location }, appId, seed, maxAvatars, buildBudgetMs, faceSize, flags, budget: { total, assets, clips, faces, sourceCache, gpuIdle }, log(level, me<br>Calls [`sona_open`](../reference.md#sona_open). |
| `viewDefaults()` | The default view as an object: the full-body framing of sona_view_defaults.<br>Calls [`sona_view_defaults`](../reference.md#sona_view_defaults). |
| `readView(p)` | Reads a sona_view from core memory. |
| `writeView(p, v)` | Writes a sona_view into core memory. |
| `viewMatrices(v)` | Row-vector view and projection (D3D depth), as sona_view_matrices.<br>Calls [`sona_view_matrices`](../reference.md#sona_view_matrices). |
| `cameraOrbit(v, target, yawDeg, pitchDeg, distance)` | Places the eye on an orbit around target.<br>Calls [`sona_camera_orbit`](../reference.md#sona_camera_orbit). |
| `readFields(p, struct, rows)` | Reads a struct into { jsName: value } by jsName, cField, 'u' \| 'i' \| 'f' rows. |
| `writeFields(p, struct, rows, v)` | Writes an options struct's fields into core memory, by the core's own field offsets. |
| `jointFind(name)` | A joint by name ("Hips", "Head", "PropRight", "shape_04", "joint_33"); -1 when unknown.<br>Calls [`sona_joint_find`](../reference.md#sona_joint_find). |
| `jointName(joint)` | null past the last joint.<br>Calls [`sona_joint_name`](../reference.md#sona_joint_name). |
| `lodDefaults()` | The level-of-detail defaults, with sprites on at 48 px.<br>Calls [`sona_lod_defaults`](../reference.md#sona_lod_defaults). |
| `previewDefaults()` | Fills the defaults above.<br>Calls [`sona_preview_defaults`](../reference.md#sona_preview_defaults). |
| `writePreview(p, opts)` | Fills the defaults above.<br>Calls [`sona_preview_defaults`](../reference.md#sona_preview_defaults). |
| `qualityDefaults()` | The web SDK's: { msaa: 0 (auto), flags: MIPS \| CUTOUT_MIPS }.<br>Calls [`sona_quality_defaults`](../reference.md#sona_quality_defaults). |
| `sectionName(section)` | "shirt", "facialHair",...; null past the last section.<br>Calls [`sona_catalogue_section_name`](../reference.md#sona_catalogue_section_name). |
| `loadCatalogue(bytes)` | sona-catalogue.bin as bytes; the catalogue keeps its own copy.<br>Calls [`sona_catalogue_load_memory`](../reference.md#sona_catalogue_load_memory). |
| `checkItem(bytes)` | The shallow check (rules 1 to 11), no network: { ok, rule, why, info }.<br>Calls [`sona_custom_item_check`](../reference.md#sona_custom_item_check). |
| `isCustomId(id)` | 1 when the id is a custom item's id, 0 for a stock item's.<br>Calls [`sona_guid_is_custom`](../reference.md#sona_guid_is_custom). |
| `pairOf(id)` | The other body's id, or null for body 3 and for real ids.<br>Calls [`sona_guid_pair`](../reference.md#sona_guid_pair). |
| `newItemId(templateId)` | A fresh id for a template (a real worn id of a 1.0 slot, body 1, 2 or 3).<br>Calls [`sona_custom_item_new_id`](../reference.md#sona_custom_item_new_id). |
| `get debug()` | Decoded assets and clips as plain objects, for comparing against another implementation. |

### SonaCtx

`class SonaCtx`: The C type sona_ctx.

| Declaration | What it does |
|---|---|
| `get appId()` | The app id this context runs as.<br>Calls [`sona_app_id`](../reference.md#sona_app_id). |
| `lastError()` | The last error on a ctx.<br>Calls [`sona_last_error`](../reference.md#sona_last_error). |
| `close()` | Closes a context.<br>Calls [`sona_close`](../reference.md#sona_close). |
| `update(dt, view = null)` | Advances by dt seconds; view (or null) culls and picks LOD.<br>Calls [`sona_update`](../reference.md#sona_update). |
| `add(manifest, opts = {})` | manifest: 1000 bytes or base64 text.<br>Calls [`sona_add_defaults`](../reference.md#sona_add_defaults), [`sona_avatar_add_base64`](../reference.md#sona_avatar_add_base64), [`sona_avatar_add`](../reference.md#sona_avatar_add). |
| `pose(avatar)` | The data API for one avatar (avatar.pose): views valid until the next update; null before READY. |
| `events()` | Every pending event: { type, avatar, code, codeName, message, fix }.<br>Calls [`sona_poll_event`](../reference.md#sona_poll_event). |
| `stats()` | The scene statistics.<br>Calls [`sona_stats`](../reference.md#sona_stats). |
| `clips()` | How many clips the context knows.<br>Calls [`sona_clip_count`](../reference.md#sona_clip_count), [`sona_clip_get`](../reference.md#sona_clip_get). |
| `shading()` | The fixed shading inputs (PENDING until the data files load: returns null then).<br>Calls [`sona_shading_get`](../reference.md#sona_shading_get). |
| `credit(scale = 1)` | The credit text, link and badge.<br>Calls [`sona_credit_get`](../reference.md#sona_credit_get). |
| `pngEncode(rgba, width, height)` | PNG bytes (a copy) with the web's credit tEXt chunks.<br>Calls [`sona_png_encode`](../reference.md#sona_png_encode), [`sona_free`](../reference.md#sona_free). |
| `get items()` | Custom items in this ctx: add(bytes) -> info, remove(id), get(id), list, pack(spec).<br>Calls [`sona_custom_item_add`](../reference.md#sona_custom_item_add), [`sona_custom_item_find`](../reference.md#sona_custom_item_find), [`sona_custom_item_remove`](../reference.md#sona_custom_item_remove), [`sona_custom_item_count`](../reference.md#sona_custom_item_count) and 3 more. |
| `fitCrowd(view)` | Fits every ready avatar in view (the web's preset "crowd").<br>Calls [`sona_camera_fit_crowd`](../reference.md#sona_camera_fit_crowd). |
| `setLod(opts = null)` | LOD and sprites from the next update: { fullPx, quarterPx, spritePx, fadeSeconds, spriteAngles, spriteHeight, maxLooks, bakeMs }; missing fields take lodDefaults.<br>Calls [`sona_lod_defaults`](../reference.md#sona_lod_defaults), [`sona_lod_set`](../reference.md#sona_lod_set). |
| `lod()` | Copies the current options: before any sona_lod_set, thresholds 120 and 40 and no sprites (sprite_px 0).<br>Calls [`sona_lod_get`](../reference.md#sona_lod_get). |
| `lodStats()` | The level-of-detail statistics: avatars in view at each step, those fading, the baked looks and the bakes of the last draw.<br>Calls [`sona_lod_stats_get`](../reference.md#sona_lod_stats_get). |
| `addItemPreview(itemId, opts = {})` | One item worn alone on a grey stand-in body.<br>Calls [`sona_item_preview_add`](../reference.md#sona_item_preview_add). |
| `createRenderer({ canvas = '#canvas', alpha = true, antialias = false, framesInFlight = 0 } = {})` | WebGL2 on a canvas (CSS selector): { result, renderer }; PENDING until the shading data has loaded.<br>Calls [`sona_renderer_create`](../reference.md#sona_renderer_create). |

### SonaAvatar

`class SonaAvatar`: The C type sona_avatar.

| Declaration | What it does |
|---|---|
| `get state()` | The avatar's state.<br>Calls [`sona_avatar_state_of`](../reference.md#sona_avatar_state_of). |
| `play(clip, opts = null)` | Plays a clip.<br>Calls [`sona_avatar_play`](../reference.md#sona_avatar_play). |
| `crossfade(clip, seconds, opts = null)` | play, blending from the current pose over seconds (0: a cut).<br>Calls [`sona_avatar_crossfade`](../reference.md#sona_avatar_crossfade). |
| `queue(clip, fadeSeconds = 0, opts = null)` | Plays clip when the current one ends; LIMIT past QUEUE_MAX.<br>Calls [`sona_avatar_queue`](../reference.md#sona_avatar_queue). |
| `get queued()` | How many clips are waiting in the queue.<br>Calls [`sona_avatar_queued`](../reference.md#sona_avatar_queued). |
| `jointWorld(joint)` | A joint's world matrix at the last update (row-vector, metres), a copy; null before READY and posed.<br>Calls [`sona_joint_world`](../reference.md#sona_joint_world). |
| `setOverride(joint, rotation, weight = 1, mode = 'replace')` | rotation: a unit quaternion x, y, z, w, or null to clear the joint.<br>Calls [`sona_avatar_override`](../reference.md#sona_avatar_override). |
| `clearOverrides()` | Clears every override of the avatar.<br>Calls [`sona_avatar_clear_overrides`](../reference.md#sona_avatar_clear_overrides). |
| `capsule()` | { a: x, y, z, b: x, y, z, radius } in world metres; null before READY.<br>Calls [`sona_avatar_capsule`](../reference.md#sona_avatar_capsule). |
| `setExpression(values)` | values: mouth, left eyebrow, right eyebrow, left eye, right eye, 255 leaves that part to the clip; null hands the face back to the clip.<br>Calls [`sona_avatar_expression`](../reference.md#sona_avatar_expression). |
| `expressionCounts()` | { mouth, eyebrows, eyes }: the shapes this face has; null before READY.<br>Calls [`sona_avatar_expression_counts`](../reference.md#sona_avatar_expression_counts). |
| `clipEvents()` | { kind: 'started' \| 'looped' \| 'ended' \| 'foot-left' \| 'foot-right' \| 'mark', mark, clip, time } since the last call, oldest first.<br>Calls [`sona_avatar_clip_events`](../reference.md#sona_avatar_clip_events). |
| `mark(seconds, id)` | A 'mark' event with this id each time the current clip passes seconds.<br>Calls [`sona_avatar_mark`](../reference.md#sona_avatar_mark). |
| `clearMarks()` | Removes the avatar's marks.<br>Calls [`sona_avatar_clear_marks`](../reference.md#sona_avatar_clear_marks). |
| `setRootMotion(mode)` | 'off', 'extract' (collect the hips' travel for takeRootMotion) or 'apply' (move the placement by it).<br>Calls [`sona_avatar_root_motion`](../reference.md#sona_avatar_root_motion). |
| `takeRootMotion()` | dx, dy, dz in world metres since the last call; clears it.<br>Calls [`sona_avatar_take_root_motion`](../reference.md#sona_avatar_take_root_motion). |
| `lod()` | { step: 'full' \| 'sampled' \| 'quarter' \| 'sprite', fade } at the last update.<br>Calls [`sona_avatar_lod`](../reference.md#sona_avatar_lod). |
| `previewBounds()` | A preview's item box in the world: { lo, hi }; null before READY.<br>Calls [`sona_item_preview_bounds`](../reference.md#sona_item_preview_bounds). |
| `previewView(width, height)` | The framed camera for a width x height picture of this preview; null before READY.<br>Calls [`sona_item_preview_view`](../reference.md#sona_item_preview_view). |
| `stop()` | Holds the current pose.<br>Calls [`sona_avatar_stop`](../reference.md#sona_avatar_stop). |
| `move(to, overSeconds = 0)` | Moves the avatar to a new placement over over_seconds.<br>Calls [`sona_avatar_move`](../reference.md#sona_avatar_move). |
| `setVisible(v)` | Shows or hides it.<br>Calls [`sona_avatar_set_visible`](../reference.md#sona_avatar_set_visible). |
| `bounds()` | A bounding sphere, in metres.<br>Calls [`sona_avatar_bounds`](../reference.md#sona_avatar_bounds). |
| `missingItems()` | Custom ids this avatar wears that no loaded item supplied, as last built.<br>Calls [`sona_avatar_missing_items`](../reference.md#sona_avatar_missing_items). |
| `remove()` | Removes the avatar and frees what only it used.<br>Calls [`sona_avatar_remove`](../reference.md#sona_avatar_remove). |
| `cameraPreset(preset = 'full', view = null)` | Sets view->eye and view->target to one of the console's framings on one ready avatar.<br>Calls [`sona_camera_preset`](../reference.md#sona_camera_preset). |
| `pose()` | The data API: views into WASM memory, valid until the next update.<br>Calls [`sona_pose`](../reference.md#sona_pose). |
| `vertices(mesh, space = 'avatar', normals = true)` | CPU-skinned positions (and normals) of one mesh, copied out: { positions, normals } as Float32Array x3.<br>Calls [`sona_pose_vertices`](../reference.md#sona_pose_vertices). |

### SonaRenderer

`class SonaRenderer`: The C type sona_renderer.

| Declaration | What it does |
|---|---|
| `draw(view, target = {}, opts = {})` | Draws every visible ready avatar, as posed by the last sona_update, folding each palette with this view.<br>Calls [`sona_draw`](../reference.md#sona_draw). |
| `snapshot(view, width, height, opts = {})` | Straight RGBA8, row 0 at the top (a copy).<br>Calls [`sona_snapshot`](../reference.md#sona_snapshot). |
| `previewDraw(preview, view, target = {}, opts = {})` | draw with only this preview in the frame; view null: avatar.previewView for the target's size.<br>Calls [`sona_item_preview_draw`](../reference.md#sona_item_preview_draw). |
| `previewSnapshot(preview, width, height, opts = {})` | Only this preview, framed for width x height: straight RGBA8, row 0 at the top (a copy).<br>Calls [`sona_item_preview_snapshot`](../reference.md#sona_item_preview_snapshot). |
| `setQuality(q = null)` | { msaa, flags } from the next draw; null: qualityDefaults.<br>Calls [`sona_quality_defaults`](../reference.md#sona_quality_defaults), [`sona_renderer_set_quality`](../reference.md#sona_renderer_set_quality). |
| `quality()` | What the renderer uses: msaa is the sample count this device draws with.<br>Calls [`sona_renderer_quality`](../reference.md#sona_renderer_quality). |
| `get frameIndex()` | The index of the last frame recorded (0 before the first).<br>Calls [`sona_renderer_frame_index`](../reference.md#sona_renderer_frame_index). |
| `destroy()` | Frees the renderer and its GPU objects.<br>Calls [`sona_renderer_destroy`](../reference.md#sona_renderer_destroy). |

### SonaCatalogue

`class SonaCatalogue`: The offline catalogue (core.loadCatalogue(bytes)).

| Declaration | What it does |
|---|---|
| `get count()` | Items, sorted by id.<br>Calls [`sona_catalogue_count`](../reference.md#sona_catalogue_count). |
| `get generated()` | When its data was made, ISO 8601.<br>Calls [`sona_catalogue_generated`](../reference.md#sona_catalogue_generated). |
| `get(index)` | { guid, id, kind, gender, section, sectionName, mask, flags, route, colourSet, name, game, type, family, description, subcategory, colourChoices, textureType, shapeType }; null past the end.<br>Calls [`sona_catalogue_get`](../reference.md#sona_catalogue_get). |
| `find(id)` | The index of an item id (any case, dashes or not), or -1.<br>Calls [`sona_catalogue_find`](../reference.md#sona_catalogue_find). |
| `findGuid(guid)` | The same by the 16 wire-order bytes of a sona_guid.<br>Calls [`sona_catalogue_find_guid`](../reference.md#sona_catalogue_find_guid). |
| `search(q = {}, max = 100)` | q: { text, game, slots, section, gender, require, exclude, offset }.<br>Calls [`sona_catalogue_search`](../reference.md#sona_catalogue_search). |
| `games()` | { name, items }, sorted by name.<br>Calls [`sona_catalogue_game_count`](../reference.md#sona_catalogue_game_count), [`sona_catalogue_game`](../reference.md#sona_catalogue_game). |
| `free()` | Frees it and every string it handed out.<br>Calls [`sona_catalogue_free`](../reference.md#sona_catalogue_free). |

### Debug

`class Debug`: Debug helpers for tests: the core's counters and checks.

| Declaration | What it does |
|---|---|
| `decodeAsset(bytes, id)` | sona_decode_asset: { result, asset } with every array copied out. |
| `decodeClip(bytes, wantJoints)` | sona_decode_clip: { result, clip } where clip keeps its handle until clip.free. |

### Types

| Declaration | What it does |
|---|---|
| `class SonaCoreError extends Error` | What a call throws when it fails: code, name, message and fix. |
