버전

menu_open

Integration Details - Triggers

Introduction

Like all game syncs, a trigger is a Wwise element that is first called by the game, then defines a specific response in Wwise to accommodate the game action that required it to be called. More specifically, in interactive music a trigger responds to a spontaneous occurrence in the game and launches a stinger. The stinger (a brief musical phrase) is mixed with the currently-playing music, as a musical reaction to an in-game event. For example, when a ninja draws his weapon, you might want to insert a musical sforzando-type progression over the music to add even more impact to the scene. The game would call the trigger which in turn would launch the stinger and your music clip would play over the ongoing score.

Example: Trigger

Let's say that you have created a stealth-based game in which your main character is a well-known spy figure. At several points in the game, your character goes into a mode in which he fights his enemies. When your character lands a powerful blow, you might want to place a music clip that will intensify the auditory impact of that scene.

To build your music for these sequences, you will need to create a trigger, perhaps named 'Headshot', to be called in such situations. In addition, you will need to define the short music segment that will provide the quick blast of brass emphasizing the game action.

For an example of how triggers are integrated, continue reading Trigger Example.

Calling Triggers

There are two options to call a trigger: the SDK's AK::SoundEngine::PostTrigger() method and the "Trigger" action generated in Wwise events.

Warning.gif
Warning: Combining trigger calls through the SDK and through actions in events can be problematic. For example, if sound designers introduce trigger actions inside the events they create while audio developers call triggers using the SDK AK::SoundEngine::PostTrigger() command, the triggers may become difficult to control. We strongly recommend that sound designers and audio developers decide how triggers will be called in their project.

Calling Triggers with AK::SoundEngine::PostTrigger()

There are two ways to call a trigger from the SDK: using strings (Unicode and Ansi), or using IDs.

Using strings makes code more readable and is suitable during development time, or when working in an environment that normally uses strings. Using IDs avoids Wwise from having to hash the names at runtime.

Calling a trigger from the SDK is done as follows:

AK::SoundEngine::PostTrigger(
    L"TriggerName",
    myGameObject1
);

or

AK::SoundEngine::PostTrigger(
    AK::TRIGGERS::TRIGGER_NAME,
    myGameObject1
);

Enabling ID Usage

To work with IDs, the banks must be generated with the "Generate header file" option in the Generate SoundBanks dialog box in Wwise. The definition file, named Wwise_IDs.h, contains all the required IDs. It is updated at each bank generation.

The second parameter of the PostTrigger() function is the ID of the game object on which the trigger will be applied. Passing AK_INVALID_GAME_OBJECT as game object ID to AK::SoundEngine::PostTrigger() will force all registered game objects that define a behavior for the specified trigger to handle this trigger.

See also:

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

지원이 필요하신가요?

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

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

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

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

Wwise를 시작해 보세요