버전
menu_open

Method 4: Preparing Action Events

This method will apply if:

  • A very small level of granularity is required for media to keep the memory usage low.

  • You do not want to worry about managing which media assets must be assigned which bank.

What exactly is a prepared action event? When calling the PrepareEvent function, the system analyses the action event and makes sure that all the structure and media related to this event are loaded into memory. If they are not, the system will automatically stream from disk the missing information. An event is prepared until it is explicitly unprepared.

[Note] Note

Only action events can be prepared in advance. The “PrepareEvent” method does not work with dialogue events.

This method requires that you create at least one bank, however the structure part can be in either the same bank as the events, or in a completely separate bank.

When building banks that will use the PrepareEvent mechanism, the criteria is that every required event and structure must be found in at least one bank, and the loose media assets must be accessible by the file system. Remember though, that it is possible to manage your memory more efficiently by splitting structure into multiple banks.

Prior to preparing an action event, the event itself must have been loaded into memory from one bank (using LoadBank()). This is required because the event contains information about the dependencies required to prepare the event.

[Note] Note

It is also possible to prepare events in combination with AK::SoundEngine::PrepareBank. The main advantage of using the PrepareBank mechanism is that it removes the need to split the banks into "Event banks" and "Media banks". Under this method, all content is contained in the same bank, but when AK::SoundEngine::PrepareBank is called, only the metadata content of the bank is loaded into memory. When the media is required by your game, you can load it using PrepareEvent.

To setup your banks in Wwise when preparing events:

  1. Create a bank called “Events” and load it into the SoundBank Editor.

  2. Add some of the action events in your project to the “Event” bank, or simply add the event work units.

  3. Deselect the “Media” check box, leaving only the “Events” and "Structures" check box selected. When using prepare event, the media must not reside in a bank, but be loaded directly off disk.

    [Note] Note

    For the purposes of this example, all the events and structures are contained in one bank. Although this is acceptable for small projects, you will most likely want to split up your content into several banks. It is also possible to create a separate “Structures” bank that does not need to be explicitly loaded nor prepared from the SDK command because each event includes references to the other banks that need to be loaded.

  4. Generate the banks and copy the generated bank folder to the game application.

    [Note] Note

    The structure data contained within a single bank can't be split at run time. Therefore, if you are using AK::SoundEngine::PrepareEvent, and the structure data from a separate bank is required, all the structures within that bank will be loaded at once. For this reason, you may want to split the structure content in your project into multiple banks, to minimize the amount of unnecessary information that is loaded into memory.

To prepare events in game:

  1. In the game, load the events bank at the beginning of your game and then prepare the events when they are required in game. The corresponding structures and media will be loaded automatically.

    The following sample of code gives you an idea how to prepare events in game.

Additional Notes on this Method

Keep in mind that calls to AK::SoundEngine::PrepareEvent must be considered as I/O functions calls. In the previous example, we used blocking functions. You can use other overloads of the function AK::SoundEngine::PrepareEvent to make them non blocking calls, and then revive the completion notification through a separate callback.

The following table lists the pros and cons of the “All-in-one” bank method.

Pros

Cons

Bank generation process is simple.

Level of granularity for media is very small.

Maintain a low overall memory usage.

Easy to automate the process.

Potentially increases the number of reads and seeks on the disk as the media assets will be loaded one by one.

Less control over the total amount of memory used.

Not ideal for interactive music.


이 페이지가 도움이 되었나요?

지원이 필요하신가요?

질문이 있으신가요? 문제를 겪고 계신가요? 더 많은 정보가 필요하신가요? 저희에게 문의해주시면 도와드리겠습니다!

지원 페이지를 방문해 주세요

작업하는 프로젝트에 대해 알려주세요. 언제든지 도와드릴 준비가 되어 있습니다.

프로젝트를 등록하세요. 아무런 조건이나 의무 사항 없이 빠른 시작을 도와드리겠습니다.

Wwise를 시작해 보세요