バージョン

menu_open
Wwise SDK 2023.1.2
JavaScript, Node.js - WAMP

プロジェクトの初期化

注釈: この例では、最新のNode.js LTSをインストールしておく必要があります。

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

npm install

プロジェクトコード

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

var ak = require('../../../../include/AK/WwiseAuthoringAPI/js/waapi.js').ak;
var autobahn = require('autobahn');
// Create the WAMP connection
var connection = new autobahn.Connection({
url: 'ws://127.0.0.1:8080/waapi',
realm: 'realm1',
protocols: ['wamp.2.json']
});
// Setup handler for connection opened
connection.onopen = function (session) {
// Call getInfo
session.call(ak.wwise.core.getInfo, [], {}).then(
function (res) {
console.log(`Hello ${res.kwargs.displayName} ${res.kwargs.version.displayName}!`);
},
function (error) {
console.log(`Error: ${error}`);
}
).then(
function() {
connection.close();
}
);
};
connection.onclose = function (reason, details) {
if (reason !== 'lost') {
console.log("Connection closed. Reason: " + reason);
}
process.exit();
};
// Open the connection
connection.open();

注釈: var ak = require('../../../../include/AK/WwiseAuthoringAPI/js/waapi.js').ak 行はAPI パスの宣言をインポートします。

それは<Wwise installation path>/SDK/include/AK/WwiseAuthoringAPI/jsにあります。

サンプルの場合、このファイルへのパスはサンプルの相対位置になります。

プロジェクトの実行

サンプルのディレクトリで次のコマンドを実行します:

node index.js

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

Hello Wwise 20??.?.?

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

サポートは必要ですか?

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

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

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

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

Wwiseからはじめよう