버전

menu_open
Wwise SDK 2023.1.3
SoundBank Integration Samples

The following sections contain sample integrations of various SoundBank management strategies. These strategies are described in Strategies for Managing SoundBanks in the Wwise help.

참고: PrepareEvent는 메모리 내 데이터를 사용하여 LoadBank와 호환되지 않습니다.


The All-in-one SoundBank

With this strategy, all event content, sound structure data, and media files are stored in one SoundBank. For a discussion of this strategy and its implementation in Wwise Authoring, see The All-in-one SoundBank in the Wwise Help.

Since there is only one SoundBank for this game, load it when initializing the game. As always, the sound engine must be initialized first.

...
// 여기에서 사운드 엔진을 초기화하세요.
...
// Load the Init bank and the all-in-one bank.
AkBankID bankID; // 이 예제에서는 사용되지 않습니다.
AKRESULT eResult = AK::SoundEngine::LoadBank( L"Init.bnk", bankID );
if( eResult == AK_Success )
{
eResult = AK::SoundEngine::LoadBank( L"MyAllInOneBank.bnk", bankID );
}
...

Multiple Complete SoundBanks

This strategy works well for single player games, where all possible sounds depend on the location of the player in the game. For a discussion of this strategy and its implementation in Wwise Authoring, see Multiple Complete SoundBanks in the Wwise Help.

In the game, load the correct bank at the correct time. 예를 들어 게임 초반에 일반 뱅크를 불러오고 플레이어의 실제 위치에 따라서 다른 적절한 뱅크를 불러올 수 있습니다. Note that some games will need to have enough memory to load more than one "level" at a time to allow for transitions between levels.

As an alternative to LoadBank(), you could prepare your SoundBanks using AkBankContent_All. This has the advantage of avoiding duplicating media in memory. See 뱅크 준비.

...
// 여기에서 사운드 엔진을 초기화하세요.
...
// Init 뱅크와 Common 뱅크를 불러옵니다.
AkBankID bankID; // 이 예제에서는 사용되지 않습니다.
AKRESULT eResult = AK::SoundEngine::LoadBank( L"Init.bnk", bankID );
if( eResult == AK_Success )
{
eResult = AK::SoundEngine::LoadBank( L"CommonEvents.bnk", bankID );
}
...
// 실제 필요에 따라 코드 내 원하는 위치에서 다음 내용을 입력합니다.
eResult = AK::SoundEngine::LoadBank( L"Level_1.bnk", bankID );
...
eResult = AK::SoundEngine::LoadBank( L"Level_2.bnk", bankID );
...
eResult = AK::SoundEngine::LoadBank( L"Level_3.bnk", bankID );
...
eResult = AK::SoundEngine::UnloadBank( L"Level_1.bnk", NULL );
...
eResult = AK::SoundEngine::UnloadBank( L"Level_2.bnk", NULL );
...
eResult = AK::SoundEngine::UnloadBank( L"Level_3.bnk", NULL );

Micromanaging Media

Consider this strategy for complex games with many assets. For a discussion of this strategy and its implementation in Wwise Authoring, see Micromanaging Media in the Wwise Help.

In the game, load the common SoundBanks at the beginning of your game then load the other SoundBanks when they are required. For example, the game could load the Event SoundBank and the common footsteps SoundBank at the beginning, then load the other SoundBanks based on the player's location in the game.

// Init과 EventBank를 불러옵니다
AkBankID bankID; // 이 예제에서는 사용되지 않습니다.
AKRESULT eResult = AK::SoundEngine::LoadBank( L"Init.bnk", bankID );
if( eResult == AK_Success )
{
eResult = AK::SoundEngine::LoadBank( L"EventBank.bnk", bankID );
}
if( eResult == AK_Success )
{
eResult = AK::SoundEngine::LoadBank( L"Common_Footstep_bank.bnk", bankID );
}
...
// 적절한 위치에 따라 다음 내용을 코드 내 원하는 곳에 입력합니다.
eResult = AK::SoundEngine::LoadBank( L"Winter_Footstep_bank.bnk", bankID );
...
eResult = AK::SoundEngine::LoadBank( L"Desert_Footstep_bank.bnk", bankID );
...
eResult = AK::SoundEngine::UnloadBank( L"Winter_Footstep_bank.bnk", NULL );
...
eResult = AK::SoundEngine::UnloadBank( L"Desert_Footstep_bank.bnk", NULL );

Preparing Action Events

Consider this strategy if you require a high level of media granularity to keep memory usage low and do not want to manage the structure and media related to Events. For a discussion of this strategy and its implementation in Wwise Authoring, see Preparing Action Events in the Wwise Help.

In the game, load the Events' SoundBank at the beginning of the game, then prepare the Events when they are required in game. The corresponding structures and media will be loaded automatically.

// 사운드 엔진을 초기화합니다.
AkInitSettings initSettings;
AkPlatformInitSettings platformInitSettings;
// 필요한 사항을 설정합니다.
...
// PrepareEvent와 관련된 사항을 설정합니다
initSettings.bEnableGameSyncPreparation = false; // 현재 예제에서는 사용되지 않습니다.
AKRESULT eResult = AK::SoundEngine::Init( initSettings, platformInitSettings );
if( eResult != AK_Success )
{
// 처리 오류
}
// Init 뱅크와 이벤트/구조체 뱅크를 불러옵니다.
AkBankID bankID; // 이 예제에서는 사용되지 않습니다.
AKRESULT eResult = AK::SoundEngine::LoadBank( L"Init.bnk", bankID );
if( eResult == AK_Success )
{
eResult = AK::SoundEngine::LoadBank( L"Events.bnk", bankID );
}
...
// 그런 다음, 코드 내 원하는 위치에서 다음과 같이 입력합니다.
const char * pEventsNameArray[1] = { "My_Event_Name" };
// 이벤트를 준비합니다:
eResult = AK::SoundEngine::PrepareEvent( Preparation_Load, pEventsNameArray, 1 ); // 1은 배열 크기임
// 이벤트 준비를 해제합니다:
eResult = AK::SoundEngine::PrepareEvent( Preparation_Unload, pEventsNameArray, 1 ); // 1은 배열 크기임

Preparing Events and Game Syncs (Switches and States)

This strategy is like Preparing Action Events, but with more control over the media that gets loaded when Events are prepared. For a discussion of this strategy and its implementation in Wwise Authoring, see Preparing Events and Game Syncs (Switches and States) in the Wwise Help.

The order in which you call AK::SoundEngine::PrepareEvent and AK::SoundEngine::PrepareGameSync is not important. Each time the state changes, the media pool is updated by crossmatching the Events and the game syncs.

// 사운드 엔진을 초기화합니다.
AkInitSettings initSettings;
AkPlatformInitSettings platformInitSettings;
// 필요한 사항을 설정합니다.
...
// PrepareEvent와 관련된 사항을 설정합니다.
////////////////////////////////////////////////////////////////
// bEnableGameSyncPreparation 플래그가 true로 설정되고
// 게임 싱크 매커니즘을 활성화합니다. false로 설정되면,
// 모든 게임 싱크에 연결된 미디어를 불러오며
// AK::SoundEngine:PrepareGameSyncs를 호출하지 않아도 됩니다.
//
// true로 설정되면, AK::SoundEngine:PrepareGameSyncs 호출로 게임 싱크가 활성화된 경우를 제외하고는
// 게임 싱크에 의존하는 미디어가 로드되지 않습니다.
////////////////////////////////////////////////////////////////
initSettings.bEnableGameSyncPreparation = true;
AKRESULT eResult = AK.SoundEngine.Init( initSettings, platformInitSettings );
if( eResult != AK_Success )
{
// 처리 오류
}
// Init 뱅크과 이벤트/구조체 뱅크를 불러옵니다.
AkBankID bankID; // 이 예제에서는 사용되지 않습니다.
AKRESULT eResult = AK::SoundEngine::LoadBank( L"Init.bnk", bankID );
if( eResult == AK_Success )
{
eResult = AK::SoundEngine::LoadBank( L"Events.bnk", bankID );
}
// ... 이 시점에서는,
// 두 이벤트가 로드되어있지만 준비되지는 않았습니다. 현재 불러온 미디어가 없습니다.
const char * pNameArray[1];
// 주요 캐릭터 발자국 소리 이벤트를 준비합니다.
pNameArray[0] = "Play_Maincharacter_FootSteps";
eResult = AK::SoundEngine::PrepareEvent( Preparation_Load, pNameArray, 1 ); // 1은 배열 크기임
// ... 이 시점에서는,
// 한 이벤트가 준비됐지만 아직 미디어는 불러오지 않았습니다.
// 이제 콘크리트 지표면은 게임에서 항상 사용 가능하기 때문에 다음을 처리합니다.
pNameArray[0] = "Concrete";
eResult = AK::SoundEngine::PrepareGameSyncs( Preparation_Load, in_eType, "GroundTexture", pNameArray, 1 );
// ... 이 시점에서는,
// 3개의 사운드 Sound_Concrete_main_1과 Sound_Concrete_main_2, Sound_Concrete_main_3가 로드됐습니다.
// 이제 주요 캐릭터가 눈이 덮인 지표면으로 들어간다고 가정합시다.
pNameArray[0] = "Snow";
eResult = AK::SoundEngine::PrepareGameSyncs( Preparation_Load, in_eType, "GroundTexture", pNameArray, 1 );
// ... 이 시점에서,
// 3개의 사운드, Sound_Snow_main_1, Sound_Snow_main_2 and Sound_Snow_main_3가 방금 로드됐습니다.
// 그런 다음 갑자기 Monster가 나타난다고 가정합시다.
pNameArray[0] = "Play_Monster_Footsteps";
eResult = AK::SoundEngine::PrepareEvent( Preparation_Load, pEventsNameArray, 1 ); // 1은 배열 크기임
// ... 이 시점에서,
// 6개의 사운드( Sound_Concrete_Monster_1.2.3 과 Sound_Snow_Monster_1.2.3 )가 방금 로드됐습니다.
// 그런 다음 플레이어가 몬스터로부터 달아나기 시작하고, 몬스터는 그 플레이어를 뒤쫓습니다.
// 플레이어와 몬스터는 멀리 달려가 더 이상 눈이 없는 곳까지 가게 됩니다.
pNameArray[0] = "Snow";
eResult = AK::SoundEngine::PrepareGameSyncs( Preparation_Unload, in_eType, "GroundTexture", pNameArray, 1 );
// ... 이 시점에서,
// 눈과 관련된 6개의 사운드( Sound_Snow_Monster_1.2.3 and Sound_Snow_main_1.2.3 )가 메모리에서 언로드됩니다.
...
참고
AKSOUNDENGINE_API AKRESULT PrepareEvent(PreparationType in_PreparationType, const char **in_ppszString, AkUInt32 in_uNumEvent)
Audiokinetic namespace
AKSOUNDENGINE_API AKRESULT PrepareGameSyncs(PreparationType in_PreparationType, AkGroupType in_eGameSyncType, const char *in_pszGroupName, const char **in_ppszGameSyncName, AkUInt32 in_uNumGameSyncs)
AKSOUNDENGINE_API AKRESULT Init(AkInitSettings *in_pSettings, AkPlatformInitSettings *in_pPlatformSettings)
AkUInt32 AkBankID
Run time bank ID
Definition: AkTypes.h:157
AKRESULT
Standard function call result.
Definition: AkTypes.h:213
AKSOUNDENGINE_API AKRESULT LoadBank(const char *in_pszString, AkBankID &out_bankID, AkBankType in_bankType=AkBankType_User)
@ Preparation_Unload
PrepareEvent() will unload required information to play the specified event.
#define NULL
Definition: AkTypes.h:46
@ AK_Success
The operation was successful.
Definition: AkTypes.h:215
AKSOUNDENGINE_API void GetDefaultInitSettings(AkInitSettings &out_settings)
@ Preparation_Load
PrepareEvent() will load required information to play the specified event.
AKSOUNDENGINE_API AKRESULT UnloadBank(const char *in_pszString, const void *in_pInMemoryBankPtr, AkBankType in_bankType=AkBankType_User)
AKSOUNDENGINE_API void GetDefaultPlatformInitSettings(AkPlatformInitSettings &out_platformSettings)

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

지원이 필요하신가요?

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

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

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

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

Wwise를 시작해 보세요