バージョン
menu
WwiseでどのようにSoundBankを作成して中身を追加し生成するのかを学ぶ前に、SoundBankの情報をゲームがロードして管理するさまざまな方法を理解することが大切です。最適な方式は開発するゲームの種類、それを実行するプラットフォーム、プロジェクトチームが設定する制限など、いくつもの条件に基づいて決まります。
できるだけ柔軟に対応して、ほとんどの種類のゲームの要件を満たせるように、Wwiseには、ゲームにオーディオやモーションをロードするた方式がいくつかあり、以下がその一部です:
従来のSoundBankロード方式はEventデータ、構造データ、メディアが混在するSoundBankを使いました。これらSoundBankのコンテンツ(中身)をそのまま、特定のタイミングでゲームにロードしたりアンロードしたりして、イベントデータや関連するメディアが、トリガーされた時に再生できるように準備しておきます。
従来からあるこの方式で、2つのSoundBankを作成して、プレイヤーがゲーム中にレベル1からレベル2に移る時に、それぞれのSoundBankをプラットフォームメモリに対してロード(Load)したりアンロード(Unload)したりする様子を、下図に示します。
![]() |
ここでは、SoundBankにある全てのデータやメディアを、一度にメモリにロードするので、必要な時に備えてどのデータやメディアも再生できる状態になるだけでなく、ゲームプレイ中に実行するディスクシークが非常に少ないため、他のディスク負荷の高いタスクを行うディスクスペースを確保できます。
この方式の主な欠点は、SoundBankがロードされている状態では、これらのSoundBankが終始、かなりのメモリスペースをとるため、規模が大きく洗練されたゲームの場合は、柔軟に対応しづらくなることです。また、この方式では、SoundBankの中のメディアファイルのうち、既にメモリにロードされているものがあるかを確認しないまま、コンテンツ(中身)を全てロードします。つまり1つのメディアファイルが、メモリに何回もロードされてしまう可能性があります。しかし、欠点があるものの、この従来の方式はピンボールゲームのように、常に全てのデータやメディアを使用可能な状態にしなくてはならない場合には、適しています。
LoadBank()メカニズムの欠点を一部、解消するために、バンクをロードせずに、AkBankContent_All()を使って、SoundBankをプリペア(Prepare / 用意)できます。この方式ではSoundBankにすべてのコンテンツタイプ(Event、構造データ、メディアファイル)が入っていても、メディアファイルをそのままロードするのではなく、すべてのメディアをPrepareEvent()メカニズムを使用してメモリにロードします。このメカニズムでメディアをロードする時、Wwiseはまず、各メディアファイルが既にメモリに存在するかどうかを調べてから、ロードします。メモリに同じメディアファイルがロードされることを防ぎ、メモリ使用率を最小限に抑えます。
この方式を使うとメモリを節約できるほか、ディスクアクセスが必ず順番に行われます。PrepareEvent()を使ってイベントを1つずつプリペア(用意)すると、ランダムなディスクシークが発生する可能性が高くなりますが、これを回避できます。
「バンクの準備(全コンテンツ)」のメカニズムを使って、プラットフォームメモリにメタデータやコンテンツをロードする様子を、下図に示します。
![]() |
SoundBankに、Vorbisエンコード、またはWEM Opusエンコードのメディアをロードするときに、 Preparation typeを Preparation_LoadAndDecodeにし、メディアファイルを圧縮なしのPCM ファイルにデコードすることが可能です。その結果SoundBankのサイズが大きくなりますが、イベントがメディアをコールした時に解凍せずにすぐに利用できます。
The PrepareEvent() method dynamically loads media when it is required. To use method, the Action Event metadata must be in a loaded SoundBank and the associated media files must be accessible in the file system. The corresponding structure metadata can be included in the same SoundBank as Events or placed in a separate SoundBank, either user-defined or auto-defined. It can therefore simplify Event and SoundBank management because you can prepare multiple Events without the need to remember which SoundBanks contain the necessary media: the Wwise sound engine automatically retrieves the required files, wherever they are.
This method ensures that after a PostEvent call, the Action Event audio is played immediately (on the same frame) because there is no need to load the media. However, it uses more memory than other methods because the media and metadata are loaded and remain in memory.
![]() | 注釈 |
|---|---|
|
To use this method, call the LoadBank() method to load the SoundBank that contains the Action Event metadata and keeps it in memory. When PrepareEvent() is called, the sound engine then "prepares" the Action Events before the game calls PostEvent(). To prepare an Event, the sound engine loads all non-streaming, referenced media files from the file system and all referenced structure metadata from a SoundBank, if it is not already loaded. When the Action Event is no longer required, unload it with Preparation_Unload so the corresponding media files are purged from memory.
イベントを事前にプリペア(用意)することで、必要なメディアファイルだけがメモリにロードされる様子を、下図に示します。
![]() |
When the metadata (also referred to as structure data) is not stored in the same SoundBank as the Events, Wwise includes references to the corresponding content stored in other SoundBanks. 他のSoundBankを参照するには、名前またはIDを使います。サウンドエンジンでSoundBank名を使用する場合は、Project SettingsダイアログのSoundBanksタブでUse SoundBank Namesオプションを選択する必要があります。To use IDs, clear the option. For more information, see 「SoundBanksタブ」.
Media that a SoundBank references must be stored as loose files on disk or be resolvable by the low-level IO (such as in a File Package).
This method uses memory efficiently but performs more disk seeking than other methods, which might not be appropriate in situations when many files are already being streamed from the disk. Also, if the game uses States and Switches, media files could be loaded into memory unnecessarily. For example, if there are different sounds for the different moods or energy levels of a crowd in your game, they are all loaded into memory even if only some of the Switch sounds are valid within a particular zone of the game. To avoid this problem, you can prepare specific States or Switches that only load the media files associated with the prepared States or Switches.
The following illustration shows how you can prepare Switches in advance to limit the amount of media that is loaded into memory at any particular point in the game.
![]() |
ゲームシンクを事前にプリペア(用意)することでメモリ使用を最適化できますが、同時に、メモリにメディアをロードする速さが遅くなるので、注意が必要です。Read times are longer when the sound engine needs to search the disk to find the sounds that correspond to the prepared game syncs.
By dynamically loading only the required audio files, The second method provides flexibility to handle situations where you have either large zones or levels with many sounds, or limited amounts of memory available to store Event data, structure data, and media.
![]() | 注釈 |
|---|---|
ここで紹介した、LoadBank、AkBankContent_All、PrepareEvent、PrepareGameSyncs、AkBankContent_StructureOnly の各種機能は、Wwise APIを通して使用できます。For more information on loading SoundBanks and preparing Events and game syncs, see the Integrating Banks section of the Wwise SDK. |
For a detailed overview of the different methods you can use to manage your SoundBanks, see 「SoundBank管理の戦略」.