Version

menu_open
Wwise SDK 2023.1.4
Using the Wwise Authoring API in Wwise Plug-ins

Calling a remote procedure

The Wwise Authoring API can be used to issue remote procedure calls from within a Wwise plug-in using the AK::Wwise::Plugin::Host::WaapiCall() method. This method is provided by the Host component, which you can request by inheriting from AK::Wwise::Plugin::RequestHost.

Note: Calls to the AK::Wwise::Plugin::Host::WaapiCall() method are always blocking.

Utility classes are provided so that callers can provide a strategy for memory allocation. AK::Wwise::Mallocator offers a default implementation using functions from the C library, such as malloc, free and realloc. A custom strategy can easily be provided by defining a class that implements AK::IAkPluginMemAlloc. Finally, a wrapper class AK::Wwise::SafeAllocator is used to ensure type-safety and automatic memory management.

Examples:

#include <rapidjson/document.h>
// Use the default allocation strategy for results and errors
// Issue a remote procedure call to the Wwise Authoring API
m_host.WaapiCall("ak.wwise.core.getInfo", NULL, NULL, alloc, szResults, szError);
if (!szError)
{
// Parse the results JSON string
results.Parse(szResults);
// ...
}
#include <rapidjson/document.h>
#include <rapidjson/stringbuffer.h>
#include <rapidjson/writer.h>
// Use the default allocation strategy for results and errors
// Build a JSON object that contains the procedure's parameters
args.SetObject();
args.AddMember("classId", 8192003, args.GetAllocator());
args.AddMember("property", "ModDepth", args.GetAllocator());
// Stringify the JSON object
rapidjson::StringBuffer buffer;
rapidjson::Writer<rapidjson::StringBuffer> writer(buffer);
args.Accept(writer);
// Issue a remote procedure call to the Wwise Authoring API
m_host.WaapiCall("ak.wwise.core.plugin.getProperty", buffer.GetString(), NULL, alloc, szResults, szError);
if (!szError)
{
// Parse the results JSON string
results.Parse(szResults);
// ...
}
Note: Here, RapidJSON is only used for demonstration purposes and is in no way mandatory.

Refer to Authoring Plug-in Library Format for more information on Wwise plug-ins.

#define NULL
Definition: AkTypes.h:46

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