Community Q&A

Where Wwise users help each other out!

Audiokinetic's Community Q&A is the forum where Wwise users ask and answer questions within the Wwise community. If you would like to get an answer from Audiokinetic's Technical support team, make sure you use the Support Tickets page.

WWise Libs within SDK not working in x64 DEBUG. Serializer class undefined.

0 votes
So, I'm building a game, custom engine based on c++ 11, Directx 11, Physx, Cal3D and some other irrelevant stuff. I want to use Wwise for the sound, I downloaded the SDK, put It on my project, follow the Help and I'm stuck at the very beggining. That's the code I have

#include <AK/SoundEngine/Common/AkMemoryMgr.h>
bool CWwiseManager::initSoundEngine()
{
    memSettings.uMaxNumPools = 20;
   if (AK::MemoryMgr::Init(&memSettings) != AKRESULT::AK_Success)
    {
        assert(!"Could not create the memory manager.");
        return false;
    }

    return true;
}

That's the error

Error    12    error LNK2019: unresolved external symbol "enum AKRESULT __cdecl AK::MemoryMgr::Init(struct AkMemSettings *)" (?Init@MemoryMgr@AK@@YA?AW4AKRESULT@@PEAUAkMemSettings@@@Z) referenced in function "public: bool __cdecl CWwiseManager::initSoundEngine(void)" (?initSoundEngine@CWwiseManager@@QEAA_NXZ)

 

Thing is I can't find any solution. I tried to compile the SDK but It says Unsupported platform (Windows x64). I can't find any clue that tells me what I'm doing wrong, apart for the Help file, wich I don't know If it's updated or not.

Also the defined hooks in the help file doesn't work, so I did a workaround. I don't know If it is the best way, so, If your eyes bleed with that code, feel free to give advice

#include "AK/SoundEngine/Common/AkMemoryMgr.h"

/************************************************************************/
/* Every project that links with the Wwise sound engine must define     */
/* several hooks. These can then be used to monitor calls to memory     */
/* access methods.                                                      */
/************************************************************************/
namespace AK
{
#ifdef WIN32
    void* AKSOUNDENGINE_CALL AllocHook(size_t in_size)
    {
        return malloc(in_size);
    }

    void AKSOUNDENGINE_CALL FreeHook(void * in_ptr)
    {
        free(in_ptr);
    }

    // Note: VirtualAllocHook() may be used by I/O pools of the default implementation
    // of the Stream Manager, to allow "true" unbuffered I/O (using FILE_FLAG_NO_BUFFERING
    // - refer to the Windows SDK documentation for more details). This is NOT mandatory;
    // you may implement it with a simple malloc().
    AKSOUNDENGINE_API void* AKSOUNDENGINE_CALL VirtualAllocHook(
        void * in_pMemAddress,
        size_t in_size,
        DWORD in_dwAllocationType,
        DWORD in_dwProtect
        )
    {
        return VirtualAlloc(in_pMemAddress, in_size, in_dwAllocationType, in_dwProtect);
    }

    AKSOUNDENGINE_API void AKSOUNDENGINE_CALL VirtualFreeHook(
        void * in_pMemAddress,
        size_t in_size,
        DWORD in_dwFreeType
        )
    {
        VirtualFree(in_pMemAddress, in_size, in_dwFreeType);
    }
#endif
}

BTW, I'm using Visual 2013 and last stable Wwise Version.

Thanks a lot readers. People who answer anything will be rewarded with a cookie.

 

 

UPDATE 1:
Aparently the web instaler did a bad install of the SDK, so I was missing .libs (no need to compile the SDK anymore). I included all those "new" libs in my proyect and the definition of memory hooks works just like the help shows, but ONLY IN DEBUG. Yep, If I use it on Release:

error C2373: 'AK::AllocHook' : redefinition; different type modifiers

error C2373: 'AK::FreeHook' : redefinition; different type modifiers

error C2373: 'AK::VirtualAllocHook' : redefinition; different type modifiers

error C2373: 'AK::VirtualFreeHook' : redefinition; different type modifiers

Now I have this problem plus the exactly same problem that is posted here (also I commented there to know if there is a fix)
https://www.audiokinetic.com/qa/1534/linker-error-visual-studio-2013

 

UPDATE 2:

I can make It compile on Release by changing the definitions this way, but Debug is still not working because problems with the Serializer class.

namespace AK
{
#ifdef WIN32
    void * AKSOUNDENGINE_CALL AllocHook(size_t in_size)
    {
        return malloc(in_size);
    }
    void AKSOUNDENGINE_CALL FreeHook(void * in_ptr)
    {
        free(in_ptr);
    }
    // Note: VirtualAllocHook() may be used by I/O pools of the default implementation
    // of the Stream Manager, to allow "true" unbuffered I/O (using FILE_FLAG_NO_BUFFERING
    // - refer to the Windows SDK documentation for more details). This is NOT mandatory;
    // you may implement it with a simple malloc().
    AKSOUNDENGINE_API void* AKSOUNDENGINE_CALL VirtualAllocHook(
        void * in_pMemAddress,
        size_t in_size,
        DWORD in_dwAllocationType,
        DWORD in_dwProtect
        )
    {
        return VirtualAlloc(in_pMemAddress, in_size, in_dwAllocationType, in_dwProtect);
    }
    AKSOUNDENGINE_API void AKSOUNDENGINE_CALL  VirtualFreeHook(
        void * in_pMemAddress,
        size_t in_size,
        DWORD in_dwFreeType
        )
    {
        VirtualFree(in_pMemAddress, in_size, in_dwFreeType);
    }
#endif
}
#endif
asked Jul 14, 2015 in General Discussion by M.Bruno R. (300 points)
edited Jul 14, 2015 by M.Bruno R.

1 Answer

0 votes
I solved the problems until this point in the tutorial within the help file.

First, I was missing a .lib called CommunicationCentral.lib on DEBUG.
Second, It only seems to work If I devine the hooks this way

// Custom alloc/free functions. These are declared as "extern" in AkMemoryMgr.h
// and MUST be defined by the game developer.
namespace AK
{
#ifdef WIN32
    #ifdef DEBUG
        void * AllocHook(size_t in_size)
        {
            return malloc(in_size);
        }
        void FreeHook(void * in_ptr)
        {
            free(in_ptr);
        }
        // Note: VirtualAllocHook() may be used by I/O pools of the default implementation
        // of the Stream Manager, to allow "true" unbuffered I/O (using FILE_FLAG_NO_BUFFERING
        // - refer to the Windows SDK documentation for more details). This is NOT mandatory;
        // you may implement it with a simple malloc().
        void* VirtualAllocHook(
            void * in_pMemAddress,
            size_t in_size,
            DWORD in_dwAllocationType,
            DWORD in_dwProtect
            )
        {
            return VirtualAlloc(in_pMemAddress, in_size, in_dwAllocationType, in_dwProtect);
        }
        void VirtualFreeHook(
            void * in_pMemAddress,
            size_t in_size,
            DWORD in_dwFreeType
            )
        {
            VirtualFree(in_pMemAddress, in_size, in_dwFreeType);
        }
    #else

        void * AKSOUNDENGINE_CALL AllocHook(size_t in_size)
        {
            return malloc(in_size);
        }
        void AKSOUNDENGINE_CALL FreeHook(void * in_ptr)
        {
            free(in_ptr);
        }
        // Note: VirtualAllocHook() may be used by I/O pools of the default implementation
        // of the Stream Manager, to allow "true" unbuffered I/O (using FILE_FLAG_NO_BUFFERING
        // - refer to the Windows SDK documentation for more details). This is NOT mandatory;
        // you may implement it with a simple malloc().
        AKSOUNDENGINE_API void* AKSOUNDENGINE_CALL VirtualAllocHook(
            void * in_pMemAddress,
            size_t in_size,
            DWORD in_dwAllocationType,
            DWORD in_dwProtect
            )
        {
            return VirtualAlloc(in_pMemAddress, in_size, in_dwAllocationType, in_dwProtect);
        }
        AKSOUNDENGINE_API void AKSOUNDENGINE_CALL  VirtualFreeHook(
            void * in_pMemAddress,
            size_t in_size,
            DWORD in_dwFreeType
            )
        {
            VirtualFree(in_pMemAddress, in_size, in_dwFreeType);
        }
    #endif
#endif
}
answered Jul 15, 2015 by M.Bruno R. (300 points)
...