版本
menu_open

Terminate the Different Modules of the Sound Engine

Introduction

Once your game is ready to exit and does not require audio anymore, it's time to terminate all the modules that were initialized earlier. Our sample program uses the following function to regroup all of the termination code:

void TermSoundEngine()
{
    ... Termination will be done here ...
}

Termination will be done in the reverse order compared to initialization.

Terminating Communication Module

If it has been initialized, let's start by terminating the communication module:

void TermSoundEngine()
{
#ifndef AK_OPTIMIZED
    //
    // Terminate Communication Services
    //
    AK::Comm::Term();
#endif // AK_OPTIMIZED

    (...)
}
Caution.gif
Caution: It is important to terminate the communication modules before the other modules.

Terminating the Music Engine

If it has been initialized, the music engine should be terminated before the sound engine.

void TermSoundEngine()
{
    (...)
    
    //
    // Terminate the music engine
    //
    
    AK::MusicEngine::Term();
    
    (...)
}

Terminating the Sound Engine

Then move on to the sound engine itself:

void TermSoundEngine()
{
    (...)
    
    //
    // Terminate the sound engine
    //
    
    AK::SoundEngine::Term();
    
    (...)
}

Terminating the Streaming Manager

Next we terminate the Streaming Manager and Low-Level I/O:

void TermSoundEngine()
{
    (...)
    
    // Terminate the streaming device and streaming manager
    
    // CAkFilePackageLowLevelIOBlocking::Term() destroys its associated streaming device 
    // that lives in the Stream Manager, and unregisters itself as the File Location Resolver.
    g_lowLevelIO.Term();
    
    if ( AK::IAkStreamMgr::Get() )
        AK::IAkStreamMgr::Get()->Destroy();
    
    (...)
}

Terminating the Memory Manager

Finally, now that all the clients of the Memory Manager have been terminated, it's time for the Memory Manager itself to go as well:

void TermSoundEngine()
{
    (...)
    
    // Terminate the Memory Manager
    AK::MemoryMgr::Term();
}

Everything related to the sound engine has now been cleaned-up, and we are ready to exit the program. Next, you should move on to Integrate Wwise Elements into Your Game.


此页面对您是否有帮助?

需要技术支持?

仍有疑问?或者问题?需要更多信息?欢迎联系我们,我们可以提供帮助!

查看我们的“技术支持”页面

介绍一下自己的项目。我们会竭力为您提供帮助。

来注册自己的项目,我们帮您快速入门,不带任何附加条件!

开始 Wwise 之旅