バージョン

menu_open

Wwise プラグインでWwise Authoring APIを使用する

リモート・プロシージャの呼び出し

Wwise Authoring API は、AK::Wwise::IAudioPlugin::WaapiCall() メソッドを使用して、Wwiseプラグインからリモート・プロシージャ・コールを発行するために使用できます。

Note.gif
Note: AK::Wwise::IAudioPlugin::WaapiCall()メソッドへの呼び出しは常にブロックされます。

ユーティリティクラスが提供されていますので、呼び出し側がメモリ割り当ての方策を提供できるようになります。AK::Wwise::Mallocator は、mallocfree を使ってデフォルト実装を提供していますが、カスタム実装はAK::IAkPluginMemAlloc を実装するクラスを定義することで、簡単に提供することができます。最後に、タイプセーフと自動メモリ管理を確かにするために、ラッパークラスAK::Wwise::SafeAllocatorを使用します。

例:

#include <AK/Tools/Common/AkAllocator.h>
#include <rapidjson/document.h>

// Use the default allocation strategy for results and errors
AK::Wwise::Mallocator alloc;

AK::Wwise::SafeAllocator<char> szResults(&alloc);
AK::Wwise::SafeAllocator<char> szError(&alloc);

// Issue a remote procedure call to the Wwise Authoring API
m_pPSet->WaapiCall("ak.wwise.core.getInfo", NULL, NULL, &alloc, szResults, szError);
if (!szError)
{
    // Parse the results JSON string
    rapidjson::Document results;
    results.Parse(szResults);

    // ...
}
#include <AK/Tools/Common/AkAllocator.h>
#include <rapidjson/document.h>
#include <rapidjson/stringbuffer.h>
#include <rapidjson/writer.h>

// Use the default allocation strategy for results and errors
AK::Wwise::Mallocator alloc;

AK::Wwise::SafeAllocator<char> szResults(&alloc);
AK::Wwise::SafeAllocator<char> szError(&alloc);

// Build a JSON object that contains the procedure's parameters
rapidjson::Document args;
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_pPSet->WaapiCall("ak.wwise.core.plugin.getProperty", buffer.GetString(), NULL, &alloc, szResults, szError);
if (!szError)
{
    // Parse the results JSON string
    rapidjson::Document results;
    results.Parse(szResults);

    // ...
}
Note.gif
Note: ここでは、RapidJSON はデモンストレーション目的でのみ使用されており、決して必須ではありません。JSONを操作するのにあなたの選択したライブラリを使うことができます。

Wwiseプラグインに関する詳細は、Wwise プラグイン DLL の作成方法 をご覧ください。


このページはお役に立ちましたか?

サポートは必要ですか?

ご質問や問題、ご不明点はございますか?お気軽にお問い合わせください。

サポートページをご確認ください

あなたのプロジェクトについて教えてください。ご不明な点はありませんか。

プロジェクトを登録していただくことで、ご利用開始のサポートをいたします。

Wwiseからはじめよう