waapi-rs
English | 中文
A Rust client for the Wwise Authoring API (WAAPI), based on WAMP over WebSocket, supporting both async and sync usage.
Features
- Async client
WaapiClient: async connect, RPC calls, topic subscriptions; shareable across tasks - Sync client
WaapiClientSync: internally manages a tokio runtime, blocking calls; ideal for scripts or non-async code - RPC calls:
call(uri, args, options)to invoke WAAPI methods, returningResult<Option<Value>, Error>whereValueisserde_json::Value - URI constants:
waapi_rs::akprovides nested modules and constants matching WAAPI URI paths (e.g.ak::wwise::core::GET_INFO,ak::wwise::waapi::GET_TOPICS), avoiding hand-written strings - Topic subscriptions:
subscribe(topic, options, callback)binds a callback|kwargs: Option<Value>|for receiving events; cancel viaSubscriptionHandle/SubscriptionHandleSync; auto-cleaned on drop - Resource cleanup: connections and subscriptions auto-disconnect/cancel on
Drop; explicitdisconnect/unsubscribealso available
Prerequisites
- Wwise: installed and running, with Authoring API enabled in the project (Project > User Preferences > Enable Wwise Authoring API)
- Rust: 1.70+ recommended, with
tokioand async support
Installation
Add the dependency to Cargo.toml:
[]
= "0.2"
= { = "1", = ["full"] }
From a local path:
= { = "../waapi-rs" }
Quick Example
Import waapi_rs::ak and write paths from ak:: (consistent with C++ WAAPI URI style). call returns Option<Value>:
use ;
async
URI Constants (uris)
Import with use waapi_rs::ak, then write paths from ak::, matching the WAAPI/C++ URI hierarchy (e.g. ak.wwise.core.getInfo → ak::wwise::core::GET_INFO):
ak::soundengine::*— runtime interfaces (e.g.POST_EVENT,SET_STATE)ak::wwise::core::*— core interfaces (e.g.GET_INFO,OBJECT_GET) and topics (e.g.OBJECT_CREATED,PROJECT_LOADED)ak::wwise::debug::*,ak::wwise::ui::*,ak::wwise::waapi::*— debug, UI, WAAPI meta-info
Examples: client.call(ak::wwise::core::GET_INFO, None, None), client.call(ak::wwise::waapi::GET_TOPICS, None, None), subscribe with ak::wwise::ui::SELECTION_CHANGED.
call Return Values
call(uri, args, options)returnsResult<Option<Value>, Error>: on success, WAAPI kwargs are returned asserde_json::Value;Nonewhen there's no result.argsandoptionsareOption<serde_json::Value>(e.g.Some(json!({...}))orNone).
Examples and Tests
- Get Wwise version:
cargo run --example get_info - Subscribe to selection changes (callback):
cargo run --example subscribe - Run tests:
cargo test(some tests require a local WAAPI, otherwise they skip)
Docs and Design
- Generate and open API docs:
cargo doc --open - Development design and architecture: DESIGN.md
References
- Wwise Authoring API official docs
- waapi-client-python (API usage reference)