Version

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

Initializing the project

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'

Cette page a-t-elle été utile ?

Besoin d'aide ?

Des questions ? Des problèmes ? Besoin de plus d'informations ? Contactez-nous, nous pouvons vous aider !

Visitez notre page d'Aide

Décrivez-nous de votre projet. Nous sommes là pour vous aider.

Enregistrez votre projet et nous vous aiderons à démarrer sans aucune obligation !

Partir du bon pied avec Wwise