menu
 
Version
2021.1.14.8108

2024.1.5.8803

2023.1.13.8732

2022.1.19.8584

2021.1.14.8108

2019.2.15.7667

2019.1.11.7296

2018.1.11.6987

2017.2.10.6745

2017.1.9.6501

2016.2.6.6153

2015.1.9.5624


menu_open
Wwise SDK 2021.1.14
Python (Waapi-Client) - Subscription

Initializing the project

info Note: The Python Waapi-Client is intended for use with Python 3.6+.

Run the following command from any directory to install dependencies:

py -3 -m pip install waapi-client

Project Code

This file contains the following code, which allows you to connect to the Wwise Authoring API.

#!/usr/bin/env python3
from waapi import WaapiClient, CannotConnectToWaapiException
from pprint import pprint
try:
# Connecting to Waapi using default URL
client = WaapiClient()
# NOTE: the client must be manually disconnected when instantiated in the global scope
except CannotConnectToWaapiException:
print("Could not connect to Waapi: Is Wwise running and Wwise Authoring API enabled?")
else:
# Callback function with a matching signature.
# Signature (*args, **kwargs) matches anything, with results being in kwargs.
def on_name_changed(*args, **kwargs):
obj_type = kwargs.get("object", {}).get("type")
old_name = kwargs.get("oldName")
new_name = kwargs.get("newName")
print("Object '{}' (of type '{}') was renamed to '{}'\n".format(old_name, obj_type, new_name))
client.disconnect()
handler = client.subscribe("ak.wwise.core.object.nameChanged", on_name_changed, {"return": ["type"]})
print("Subscribed 'ak.wwise.core.object.nameChanged', rename an object in Wwise")

Running the project

With a project open in Wwise, run the script in a terminal with the following command:

py subscribe.py

You should observe in the output something like:

Getting Wwise instance information:
Subscribed 'ak.wwise.core.object.nameChanged', rename an object in Wwise

Proceed to rename an object in Wwise. You should then observe something like:

Object 'MySound' (of type 'Sound') was renamed to 'MyOtherSound'

Was this page helpful?

Need Support?

Questions? Problems? Need more info? Contact us, and we can help!

Visit our Support page

Tell us about your project. We're here to help.

Register your project and we'll help you get started with no strings attached!

Get started with Wwise