バージョン

menu_open
Wwise SDK 2023.1.3
ルームやポータルのAPIコンフィギュレーション

ルームやポータルを作成する

あなたのマップやレベルのジオメトリをもとに、ルームやポータルを AK::SpatialAudio::SetRoomAK::SpatialAudio::SetPortal を使用して作成する必要があります。ルームやポータルの設定をランタイムに変更することが可能で、ランタイムに同じIDで関数をもう一度コールします。続いてゲームが各エミッタやリスナー用に AK::SpatialAudio::SetGameObjectInRoom をコールして、それらがどのルームにいるのかをSpatial Audioに伝えます。Spatial Audioはルームに決まった位置や形や大きさがあるとは、とらえていません。このため形状に制限はありませんが、オブジェクトがどのルームにあるのかを判断するコンテインメントテストの実行は、ゲーム側の責任です。

警告: ルームIDに注意してください。ゲームオブジェクトとスコープが同じなので、絶対にゲームオブジェクトで使われているIDを使用しないでください。
警告: 裏の仕組みとして、Spatial AudioはそれぞれのルームをゲームオブジェクトとしてWwiseに登録しています。ユーザーは、アンビエンスやルームのトーンサウンドのために、このゲームオブジェクトに対しイベントをポストすることができますが、 AK::SoundEngine へのコールの中で、オブジェクトのポジションやGame-defined sendsを修正しようとしないでください。

最も重要なルーム設定が AkRoomParams::ReverbAuxBus で、エミッタがそのルームにいるときにどのAuxバスにセンドするべきかを、Spatial Audioに知らせます。ほかの設定について、以下のセクションで説明します( WwiseでルームのAuxバスを設定するTransmission(透過) を参照)。

ポータルは、2つのルームの間の開口部を表します。ルームと違いポータルには位置や大きさがあるので、Spatial Audioが独自にコンテインメントテストを実行できます。ポータルの大きさは、ポータルの設定である AkPortalParams::Extentで決まります。WidthとHeight(XとY)はSpatial Audioで回折とスプレッドを計算するのに使われ、Depth(Z)はSpatial Audioで2つの隣接するRoomにおいて、Auxiliary sendレベル、Room Objectの配置、Spread(3D Spatializationで使用)を細かく調整してスムーズにトランジションを行う範囲を、定義します。詳細は、以下のセクション WwiseでルームのAuxバスを設定する音の伝播機能の概要 を参照してください。また、ポータルを有効にしたり(開いたり)、無効にしたり(閉じたり)するのに、 AkPortalParams::bEnabled ポータルの設定を使用します。

ルームゲームオブジェクトに対してイベントをポストする

ルームゲームオブジェクトに対してイベントをポストして、そのスペーシャリゼーション特性を活用することも可能です。 AK::SoundEngine::PostEvent をコールして、ルームIDをAkGameObjectIDとして渡せばいいだけです。 AkRoomID::AsGameObjectID をコールすれば、ルームIDを安全に AkGameObjectID にキャストできます。もしイベントをポストするためにルームを使うのであれば、このルームゲームオブジェクトを、使用中でないときも登録解除しないように、Spatial Audioに伝える必要があります。そのためには AkRoomParams::RoomGameObj_KeepRegistered をTrueに設定します。

また、ルームトーンを使う場合は、ゲームオブジェクトが自分自身のルームAuxバスにセンドするようにしておけば便利です。そのためには、ゼロより大きい値を AkRoomParams::RoomGameObj_AuxSendLevelToSelf に渡します。

ルームのジオメトリを設定する

Associating a Geometry Instance with a Room serves the following purposes:

  • It enables calculation of the Room's bounding box, which in turn is used to calculate the position and spread of the Room's transmission path.
  • It allows Spatial Audio to determine which Game Objects are in which Room. Alternatively, clients can use AK::SpatialAudio::SetGameObjectInRoom for this purpose, if desired.
  • It enables accurate specification of transmission loss values, according to the transmission loss coefficient of each individual surface.
  • It enables the display of the room inside the Game Object 3D Viewer.
  • Optionally, it enables reflection and diffraction simulation using the walls of a room, if AkGeometryInstanceParams::UseForReflectionAndDiffraction is set to true.

Setting up Room geometry is optional but recommended. Without Room geometry, the Room will not be visible in the Game Object 3D viewer, and Spatial Audio will estimate the extent of the Room (for Room transmission) by calculating a bounding box that encompasses all attached portals. For more information about Room transmission refer to Transmission of Room Tones and a Room's Diffuse Field.

Spatial Audio performs containment tests using Room geometry to determine which Room each Game Object is in. If a specific type of containment test is desired, this task can instead by performed by the client, using AK::SpatialAudio::SetGameObjectInRoom. However, geometry is mandatory for Rooms that are designated as Reverb Zones, so that Spatial Audio can determine whether a Game Object is inside the transition region of a the Reverb Zone. Refer to spatial_audio_roomsportals_reverbzones_transition_regions.

To associate geometry with a Room, first, pass the geometry to Wwise using AK::SpatialAudio::SetGeometry. It is then necessary to create a Geometry Instance to assign a position, scale and rotation to the geometry. Refer to AK::SpatialAudio::SetGeometryInstance. Lastly, populate the AkRoomParams::GeometryInstanceID field when calling AK::SpatialAudio::SetRoom, with the ID of the Geometry Instance representing the room. Spatial Audio assumes that there was, or will be, a corresponding call to AK::SpatialAudio::SetGeometryInstance, however, it does not matter in which order AK::SpatialAudio::SetRoom and AK::SpatialAudio::SetGeometryInstance are called.

注釈: If a geometry instance is to be used only by a Room, for purposes listed above, and not for reflection and diffraction calculation, then set AkGeometryInstanceParams::UseForReflectionAndDiffraction to false.

For information about how to define geometry in Spatial Audio, refer to Geometry.

注釈: ジオメトリセットを、ルームの概要を示すためだけに使い、反射や回折の計算に利用しないのであれば、必ず AkGeometryParams::EnableTriangles をFalseとしてください。
警告: AkRoomParams::GeometryInstanceID should not be confused with AkGeometryInstanceParams::RoomID. AkRoomParams::GeometryInstanceID is used as described above to define a room bounding box for transmission spread calculation and for visualization in the Game Object 3D Viewer. AkGeometryInstanceParams::RoomID is used solely as an optimization to limit the scope in which the geometry is visible/accessible, when performing ray traces inside of Spatial Audio.

マルチポジションを有するサウンドエミッタ

Spatial Audioは AK::SoundEngine::SetMultiplePositions を使うときに、APIに渡されるサウンドポジション1つ1つに関して、反射、回折、透過などの様々な計算を行います。

ゲームオブジェクトは、一度に1つのルームにしかアサインできないので( AK::SpatialAudio::SetGameObjectInRoom を使用)、ルームセンドを使うゲームオブジェクトに、 AK::SoundEngine::SetMultiplePositions を使用するときは、重要な注意事項がいくつかあります。全てのサウンドポジションが、サウンドエンジンの中で同じAuxセンドコンフィギュレーションにする必要があるために、このような制限事項があります。

あるエミッタのポジションを基に計算されるサウンドパスは、全てがリクエストされた(1つの)ルームに関して計算されます。このため、サウンドのポジションが AK::SpatialAudio::SetGameObjectInRoom で定義されたルームの(ゲームが定義する)境界線の外にある場合は、出されるサウンドパスがエラーとなる可能性が高くなります。

さらに、もしこのゲームオブジェクトがポータルを通って移動しているのであれば、Spatial Audioは AK::SoundEngine::SetMultiplePositions に渡される全てのサウンドポジションの平均を、2つのルームの間のクロスフェードの計算に使います。

このため、ゲーム側も平均サウンドポジションを使ってルームコンテインメントを引き出し、結果として出されるルームIDを AK::SpatialAudio::SetGameObjectInRoom に渡すことが、推奨されます。

ルームやポータルのインテグレーション例

このAPIの使い方を説明するデモページが、Integration Demoサンプル(場所はSDK/samples/IntegrationDemo)にあります。場所は、Demo Positioning > Spatial Audio: Portalsです。


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

サポートは必要ですか?

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

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

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

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

Wwiseからはじめよう