バージョン
-
Wwiseヘルプ
-
-
-
-
-
Wwise SDK 2023.1.3
|
You can use Motion plug-ins to control the haptic feedback of a control interface. With Wwise, you can use the same set of tools to manage motion and audio in your application. Internally, motion data is no different than audio data, and all the features available for audio are also available for motion. Two types of haptic feedback are available through the motion feature: you can transform any audio signals in your project and into motion, or generate dedicated motion signals with the Motion source. You can test motion directly in Wwise Authoring on Windows with a supported controller.
Motion uses the Wwise Sound Engine plug-in system to work in an application, and can be subdivided into two modules: the audio source called Motion and the Audio Device called Wwise Motion. Although the Motion audio source is optional, it remains a powerful tool to create accurate and flexible motion designs.
The Wwise Motion audio device plug-in links the sound engine to motion-ready devices. Just like any audio device plug-in, it receives data from a set of Listeners and "presents" this data to a device. This plug-in is inside a separate library and needs to be included in both Wwise Authoring and the application. 詳細は、 ファイルロケーションの解決 のセクションを参照してください。
You can use the Motion source plug-in to design the behavior of haptic feedback effects. Just like any audio source, you can add a Motion source plug-in to a Sound SFX node in your Wwise project. Make sure that the Sound SFX nodes have Output Busses set to motion-ready busses. See Motion for more information.
To use motion in your application, you need to properly set up each component. All the concepts applicable to the audio workflow are also applicable to motion. 同じバス、リスナー、エミッタを利用します( リスナーの統合 を参照)。
サウンドデータやモーションデータをデバイスに送信するには、ライセンス取得済みのWwise Motion Audio Deviceを、あなたのWwiseプロジェクトの、Project ExplorerのAudioタブにあるAudio Deviceフォルダに追加します。Wwise Motion Audio Deviceは、サウンドエンジンがモーション対応デバイスとのインターフェースとして利用するプラグインです。Wwise Motion Audio Deviceを最上位のAudio Busにアサインすることも、重要です。The term motion bus denotes a top-level Audio Bus with a Wwise Motion Audio Device assigned to it. It is good practice to use a single motion bus hierarchy in your project for easier troubleshooting and monitoring. You can then set the Output Bus of any Sound SFX to a motion bus to create haptic feedback. Usually the Sound SFX elements that use a motion bus also use a Motion source. オーディオとモーションを同時に使うには、サウンドSFXに少なくともモーションバスが1つと、アウトプットバスまたはAuxバスのオーディオバスが1つ、必要です。
On the game side, link with the separate library called AkMotionSink
. このライブラリは、対応プラットフォームの標準コントローラのサポートを提供します。You also need to include the AkMotionSinkFactory.h file, located under SDK\include\AK\plugin
. It is important to include this file because it automatically registers the plug-in.
注釈: UnityとUnrealは、プラグインライブラリを自動的に管理します。マニュアルで AkMotionSink を追加する必要がありません。 |
対応するコントローラ一覧と追加要件については、下表を参照してください。
Platform | Device | Device Channel Config and Layout | Additional Requirements |
Android | Android device with vibration support | Anonymous 1-channel | |
iOS | iOS device with vibration support iOS-compatible Controllers | Anonymous 1-channel | CoreHaptics.framework GameController.framework |
Linux | Not supported. | ||
Mac | Mac-compatible Controllers | Anonymous 1-channel | CoreHaptics.framework GameController.framework |
PlayStation 4 | DUALSHOCK 4 PlayStation Move | Anonymous 2-channel: 左モーター、右モーター | |
PlayStation 5 | DualSense VR コントローラー | Stereo 2-channel: Left vibration, right vibration | |
Switch | Joy-Con | Anonymous 4-channel: 左低周波バイブレーション、左高周波バイブレーション、 右低周波バイブレーション、右高周波バイブレーション | |
Windows | XboxおよびXInput対応コントローラ DirectInput対応コントローラ | Anonymous 2-channel: 左モーター、右モーター | XInput.lib Dinput8.lib Winmm.lib |
Xbox One Xbox Series X | Xboxコントローラ | Anonymous 4-channel: 左モーター、右モーター 左トリガー、右トリガー |
If your application uses motion with one or more devices, you must add a dedicated output for each device. For example, a split-screen game with four players connected needs four different outputs for the controllers to receive haptic feedback. To add an output device, use the Wwise API's AK::SoundEngine::AddOutput
function and specify the ShareSet name (as defined in your Wwise project) in the AkOutputSettings
parameter. Additionally, because multiple devices can be connected, you need to provide a device ID. The following table contains more information about device IDs.
Platform | Device | Information |
Android | Android device with vibration support | Use 0. |
iOS | iOS device with vibration support and iOS-compatible Controllers | To vibrate the device, use 0. To vibrate a connected controller, first assign a player index to the desired GCController instance using the GameController.framework API. Then, retrieve the DeviceID of that player index by calling AK::SoundEngine::GetDeviceIDFromPlayerIndex. |
Linux | Not supported. | - |
Mac | Mac-compatible Controllers | First, assign a player index to the desired GCController instance using the GameController.framework API. Then, retrieve the DeviceID of that player index by calling AK::SoundEngine::GetDeviceIDFromPlayerIndex. |
PlayStation 4 | DUALSHOCK 4 and PlayStation Move | Use the handle of the device returned by scePadOpen or scePadGetHandle. |
PlayStation 5 | DualSenseコントローラ、VRコントローラ | scePadOpenまたはscePadGetHandleで返されたデバイスのハンドルを使用。For PSVR2, create only one output device, using the handle of either the left or right VR controller, to have vibrations on both VR controllers. If you specify a device ID of 0, the system is only initialized for the wireless controller, not the VR controllers. The Advanced vibration control mode, which is required for haptic feedback, is enabled in the System Software by default for DualSense and VR Controllers on PlayStation 5. If your code calls scePadSetVibrationMode, ensure that you do not use any behavior that disables Advanced vibration control mode, such as setting a vibration mode of SCE_PAD_VIBRATION_MODE_COMPATIBLE. |
Switch | Joy-Con | Use nn::hid::NpadId with the desired index. |
Windows | XboxおよびXInput対応コントローラ | 0から3までのプレイヤーインデックスを使用。 |
Windows | DirectInput対応コントローラ | DIDEVICEINSTANCEに格納のguidProductを使用。guidProductをハッシュするには、 AK::FNVHash32を使います。 |
Xbox One (XDK) | Xbox Controllers | Use the ID stored in a IGamepad object. |
Xbox One (GDK) Xbox Series X | Xboxコントローラ | AK::SoundEngine::GetGameInputDeviceID を呼び出して、ゲームパッドのDeviceIDを取得。 |
注釈: On all platforms except Windows, a device ID of "0" targets the first available device that supports motion. |
Remember that game controllers can be disconnected either physically or due to communication problems. Disconnection does not have any adverse effects on the sound engine other than needlessly using resources. If you think a device has been disconnected for a long time, call AK::SoundEngine::RemoveOutput
and provide the AkOutputDeviceID
returned by the corresponding AddOutput()
function call.
Motion outputs are like any other Secondary Outputs and therefore have the same restrictions and requirements. If you are making a single-player game, in which only one player controls the game locally, the Listener/Game Object setup is very simple. In normal cases, the new motion output re-uses the same default Listener as the main audio output. In other words, you rarely have to manage Listeners in a single-player setup.
For multiplayer games, you must create one Listener/Game Object for each motion output. This is necessary so that each player has their own mix of haptic feedback, depending on the situation in the game. デバイスに関連付けられたリスナーの初期化を、アウトプットが AK::SoundEngine::AddOutput()
で初期化されるのと同時に行う必要があります。特定のリスナーがあれば、サウンドやモーションのルーティングのレイヤが1つ増えます。特定のプレイヤーのListenerに限定して関連付けられているGame Objectに対してEventを再生する場合は、そのプレイヤーをターゲットとすることができます。To establish this association, you can call AK::SoundEngine::SetListeners
. You can also associate multiple listeners with the same game object, which has a "broadcast" effect on all listeners. リスナーやゲームオブジェクトの詳細は、 リスナーの統合 を参照してください。
注釈: A sound needs to be routed into the motion bus hierarchy even if the Emitter has a Listener set to a motion output. |
The following examples demonstrate how to set up your application to use motion. You can also refer to the Demo Motion example in the Integration Demo (DemoMotion.cpp) included in the SDK samples. 全ての対応プラットフォーム用に、それぞれ動かせるデモを提供しています。
First, as with any other plug-in, you need to include the corresponding file and link the library (for Wwise native development only, not required for Unity).
Next, add another output with the Wwise Motion Audio Device ShareSet name from the Wwise project, in this case "Wwise_Motion". The output ID is 0 to ensure that the first connected game controller is used.
Next, play an Event. In the Wwise project, the "Play_Explosion" Event is linked to a Sound SFX that is routed to a bus that has "Wwise_Motion" ShareSet assigned as its Audio Device.
This section describes how to set up motion for multiple players on the same console, not a networked multiplayer game. In multiplayer scenarios, the mix for motion, or any player-specific output, must be different to represent the player's perspective in the game world. Players therefore need their own Listeners.
Add an output for every player. You can use an Audio Device ShareSet multiple times, so you don't have to create multiple Audio Device ShareSets. You must provide a real device ID for every controller. これは、Windowsで、Xboxコントローラのレイです。それぞれのプラットフォームでデバイスIDを取得する方法については、 Game Setup の表を参照してください。
Next, play an Event. In the Wwise project, the "Play_GunFire" Event is linked to a Sound SFX that is routed to a bus that has "Wwise_Motion" assigned as its Audio Device ShareSet.
To play an Event that affects multiple devices, set up a new Game Object, and ensure that all player-specific Listeners listen to it.
For an example of multiplayer setup, refer to the DemoMotion
class in the IntegrationDemo sample.
For a specific device to receive motion with one device, you must:
AkMotionSink
library. Include AkMotionSinkFactory.h
and link with the AkMotionSink
library. 注釈: UnityとUnrealは、プラグインライブラリを自動的に管理します。This step is unnecessary. |
AK::SoundEngine::RegisterGameObj
.Ak::SoundEngine::AddOutput
with the Wwise Motion ShareSet and a device ID. For multiplayer, provide a Listener object for each.To add Motion to the Wwise project:
To troubleshoot problems, we recommend that you profile your application. In Wwise Authoring, you can profile your application as described in Profiling. 問題の根源を理解するために、役立つツールがいくつかあります。The Capture Log view lists error codes in red. Graphビューで、サウンドエンジンのパイプラインのイメージ図を確認できます。The motion devices appear at the end of the pipeline. If no motion devices are displayed, the sound engine could not find the device you specified. Finally, the Emitter/Listener tab displays all Emitter-Listener pairs. If the Motion Effect does not work, the Emitter might not be associated with the Listener you specified for your motion device.
Motionエフェクトをトリガーしても実行されない場合は、以下を行います:
AkMotionSinkFactory.h
and linked to the AkMotionSink
library.AddOutput
is called from the game.RegisterGameObj
, SetListeners
, and AddOutput
.For Android devices, add the permission in the application's AndroidManifest.xml file: