バージョン

menu_open
Wwise SDK 2021.1.14
JavaScript, ブラウザ内 - WAMP

プロジェクトの初期化

注釈: この例では、npmをインストール(最新Node.js LTSとともにインストール)しておく必要があり、BowerパッケージをインストールするためにGitが必要です。サポートされているブラウザは、Google Chrome、Mozilla Firefox、Operaです。

依存関係をインストールするには、サンプルディレクトリ <Wwise installation path>/SDK/samples/WwiseAuthoringAPI/js/hello-wwise-web-wampから次のコマンドを実行します。

npm install -g bower
bower install autobahn

プロジェクトコード

hello-wwise-web-wamp サンプルディレクトリ内のサンプルファイル index.js を使用すると、Wwise Authoring APIに接続できます。

var showMessage = function(message){
document.getElementById("message").innerHTML = message;
}
function onBodyLoad() {
// Create the WAMP connection
var connection = new autobahn.Connection({
url: 'ws://localhost:8080/waapi',
realm: 'realm1',
protocols: ['wamp.2.json']
});
// Setup handler for connection closed
connection.onclose = function (reason, details) {
showMessage('wamp connection closed');
return true;
};
// Setup handler for connection opened
connection.onopen = function (session) {
showMessage('wamp connection opened');
// Call getInfo
session.call(ak.wwise.core.getInfo, [], {}).then(
function (res) {
showMessage(`Hello ${res.kwargs.displayName} ${res.kwargs.version.displayName}`);
},
function (error) {
showMessage(`error: ${error}`);
}
);
};
// Open the connection
connection.open();
}

hello-wwise-web-wamp サンプルディレクトリのサンプルファイル index.html は、前のスクリプトを使用してWwise Authoring APIに接続する簡単なWebページです。 出力メッセージをレンダリングします。

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Hello Wwise</title>
<script src="node_modules/autobahn-browser/autobahn.min.js"></script>
<script src="../../../../include/AK/WwiseAuthoringAPI/js/waapi.js"></script>
<script src="index.js"></script>
</head>
<body onload="onBodyLoad()">
<div id="message">
Not connected.
</div>
</body>
</html>

プロジェクトの実行

プロジェクトの初期化 の "supported"ブラウザで開くには、index.htmlをダブルクリックしてください。

Wwise Authoring APIがWwiseに正常に接続すると、次の出力が表示されます:

Hello Wwise 20??.?.?

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

サポートは必要ですか?

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

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

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

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

Wwiseからはじめよう