Skip to content

Instantly share code, notes, and snippets.

@decasteljau
Last active November 24, 2017 13:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save decasteljau/00aa842b6985aefc2e3772c7aad00ce8 to your computer and use it in GitHub Desktop.
Save decasteljau/00aa842b6985aefc2e3772c7aad00ce8 to your computer and use it in GitHub Desktop.
using namespace AK::WwiseAuthoringAPI;
void PrintApiError(const char* in_functionName, AkJson in_json)
{
std::cout << "Failed to call '" << in_functionName << "' with error: " << std::string(RapidJsonUtils::GetAkJsonString(in_json)) << std::endl;
}
void HelloWorld()
{
Client client;
// Connect to Wwise Authoring on localhost.
if (!client.Connect("127.0.0.1", 8080))
{
std::cout << "Could not connect to Wwise Authoring on localhost." << std::endl;
return;
}
AkJson selectedResult;
if (!client.Call(ak::wwise::ui::getSelectedObjects, AkJson::Map{}, AkJson::Map{}, selectedResult))
{
PrintApiError(ak::wwise::ui::getSelectedObjects, selectedResult);
return;
}
if (selectedResult["objects"].GetArray().size() >= 1)
{
AkJson args(AkJson::Map
{
{ "command", AkVariant("FindInProjectExplorerNoSyncGroup") },
{ "objects", AkJson::Array{
selectedResult["objects"].GetArray()[0]["id"] } }
});
AkJson executeResult;
if (!client.Call(ak::wwise::ui::commands::execute, args, AkJson(AkJson::Map()), executeResult))
{
PrintApiError(ak::wwise::ui::commands::execute, executeResult);
return;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment