Waapi GDExtension Interface - alessandrofama/wwise-godot-integration GitHub Wiki
Methods
Return value | Signature |
---|---|
bool | connect_client(uri: String, port: unsigned int) |
bool | is_client_connected() |
void | disconnect_client() |
Dictionary | subscribe(uri: String, options: String) |
Dictionary | subscribe_with_timeout(uri: String, options: String, timeout_ms: int) |
Dictionary | unsubscribe(subscription_id: int) |
Dictionary | unsubscribe_with_timeout(subscription_id: int, timeout_ms: int) |
Dictionary | client_call(uri: String, args: String, options: String) |
Dictionary | client_call_with_timeout(uri: String, args: String, options: String, timeout_ms: int) |
String | get_last_string() |
Method Descriptions
- connect_client(uri: String, port: unsigned int) -> bool
Connects the Waapi client at the given uri
and port
. The Wwise authoring application should be open and available at the given location and port in order for this call to succeed. Example:
var connectResult = Waapi.connect_client("127.0.0.1", 8080)
if connectResult:
# Do something...
Returns true
if connection succeeded.
- is_client_connected() -> bool
Checks the connection status of the Waapi client.
Returns true
if the client is connected, false
otherwise.
- disconnect_client()
Disconnects the client.
- subscribe(uri: String, options: String) -> Dictionary
Subscribes the Waapi client to changes to e.g. the Wwise project in the authoring app.
In order to get the data
dictionary with keys subscription_id
, subscribe_result
and result_string
. The signal wamp_event
should be connected in GDScripts, e.g.
Waapi.connect("wamp_event", Callable(self, "_on_wamp_event"))
func _on_wamp_event(data):
print(data)
Returns a Dictionary with keys subscription_id
, subscribe_result
and result_string
- subscribe_with_timeout(uri: String, options: String, timeout_ms: int) -> Dictionary
Subscribes the Waapi client to changes to e.g. the Wwise project in the authoring app and returns after some timeout in milliseconds has passed. Works similarly to subscribe but with a timeout.
Returns a Dictionary with keys subscription_id
, subscribe_result
and result_string
- unsubscribe(subscription_id: int) -> Dictionary
Unsubscribes the Waapi client to changes to e.g. the Wwise project in the authoring app, given a subscription ID.
Returns a Dictionary with keys unsubscribe_result
, result_string
- unsubscribe_with_timeout(subscription_id: int, timeout_ms: int) -> Dictionary
Unsubscribes the Waapi client to changes to e.g. the Wwise project in the authoring app with a timeout in milliseconds. Works similarly to unsubscribe but adding a timeout.
Returns a Dictionary with keys unsubscribe_result
, result_string
- client_call(uri: String, args: String, options: String) -> Dictionary
Calls the Waapi client with a given uri
, arguments and options. Example of usage:
var json: JSON = JSON.new()
var connectResult = Waapi.connect_client("127.0.0.1", 8080)
if connectResult:
var args = {"from": {"ofType": ["Project", "Bus", "Switch", "State", "Event", "SoundBank"]}}
var options = {"return": ["name", "type", "workunit", "path", "shortId"]}
var dict = Waapi.client_call("ak.wwise.core.object.get", JSON.stringify(args), JSON.stringify(options))
var json_document = json.parse(dict["result_string"])
if json_document == OK:
if json.data.has("return"):
print(json.data["return"])
if Waapi.is_client_connected():
Waapi.disconnect_client()
Returns a Dictionary with keys call_result
, result_string
.
- client_call_with_timeout(uri: String, args: String, options: String, timeout_ms: int) -> Dictionary
Calls the Waapi with a given uri
, arguments and options, specifying a timeout in milliseconds.
Returns a Dictionary with keys call_result
, result_string
- get_last_string() -> String
Gets the last string result from subscribe
, unsubscribe
or call
. Useful for debugging.
Returns a result
String