Version

menu_open
Wwise SDK 2024.1.0
Advanced Sound Engine Integration

Sound Engine Initialization

Note: Before initializing the sound engine itself, the memory manager and streaming manager must be initialized. Please refer to the section Initializing Sound Engine Modules for more information about global initialization.

Initializing the sound engine itself is done by calling the AK::SoundEngine::Init function. The default initialization shown in Initializing the sound engine is copied here for your convenience.

#include <AK/SoundEngine/Common/AkSoundEngine.h> // Sound Engine
(...)
bool InitSoundEngine()
{
(...)
//
// Initialize the sound engine
// Using default initialization parameters
//
{
assert( ! "Could not initialize the Sound Engine." );
return false;
}
return true;
}

The AK::SoundEngine::Init function takes 2 parameters.

First parameter : AkInitSettings * in_pSettings

  • This structure contains platform-independent information to initialize the sound engine.

Second parameter : AkPlatformInitSettings * in_pPlatformSettings

  • This structure contains information specific to each platform to initialize the sound engine.
Caution: Both parameters are considered optional, but we recommend you customize these values to the needs of the game, because some of the default values may cause unnecessarily high memory usage. Refer to the section Fixed-size allocations for more information.

Customizing the Creation Parameters

The AkInitSettings and AkPlatformInitSettings structures must be initialized using the AK::SoundEngine::GetDefaultInitSettings and AK::SoundEngine::GetDefaultPlatformInitSettings functions.

Initializing the structure using these two functions fills the structures with the default parameters. This is useful because:

  • Once initialized, the parameters that need to be modified can easily be changed to fit the needs of the game.
  • Using default parameters ensures code backward compatibility, since later versions of the SDK may add more initialization parameters to the structures.

The following sample code demonstrates how to initialize the sound engine with default parameters, while customizing a single parameter value.

#include <AK/SoundEngine/Common/AkSoundEngine.h> // Sound Engine
(...)
bool InitSoundEngine()
{
(...)
//
// Create the Sound Engine
// Using modified initialization parameters
//
AkInitSettings initSettings;
AkPlatformInitSettings platformInitSettings;
initSettings.uMaxNumPaths = 16;
if ( AK::SoundEngine::Init( &initSettings, &platformInitSettings ) != AK_Success )
{
return false;
}
return true;
}

For more information on adjusting memory sizes, refer to Fixed-size allocations.

AKSOUNDENGINE_API AKRESULT Init(AkInitSettings *in_pSettings, AkPlatformInitSettings *in_pPlatformSettings)
AkUInt32 uMaxNumPaths
Maximum number of paths for positioning.
#define NULL
Definition: AkTypes.h:46
@ AK_Success
The operation was successful.
Definition: AkTypes.h:136
AKSOUNDENGINE_API void GetDefaultInitSettings(AkInitSettings &out_settings)
AKSOUNDENGINE_API void GetDefaultPlatformInitSettings(AkPlatformInitSettings &out_platformSettings)

Was this page helpful?

Need Support?

Questions? Problems? Need more info? Contact us, and we can help!

Visit our Support page

Tell us about your project. We're here to help.

Register your project and we'll help you get started with no strings attached!

Get started with Wwise