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

0 votes

Hi, I'm evaluating Wwise for use in a new indie game project, but it consistently crashes on initialization. What am I doing wrong?

My Code:

#include <iostream>

#include <AK/SoundEngine/Common/AkMemoryMgr.h>
#include <AK/SoundEngine/Common/AkModule.h>
#include <AK/SoundEngine/Common/AkSoundEngine.h>
#include <AK/SoundEngine/Common/IAkStreamMgr.h>
#include <AK/MusicEngine/Common/AkMusicEngine.h>
#include <AK/Tools/Common/AkPlatformFuncs.h>
#include <AK/IBytes.h>

#ifndef AK_OPTIMIZED
#include <AK/Comm/AkCommunication.h>
#endif

#include <AkFilePackageLowLevelIOBlocking.h>

namespace AK
{
    void * AllocHook(size_t in_size)
    {
        void *ptr = malloc(in_size);
        std::cout << "Allocate " << in_size << " bytes @ " << ptr << "\n";
        return ptr;
    }

    void FreeHook(void * in_ptr)
    {
        std::cout << "Free " << in_ptr << "\n";
        free(in_ptr);
    }
}

static CAkFilePackageLowLevelIOBlocking g_lowlevel_io;

int main()
{
    // Init Memory
    std::cout << "Init Memory\n";
    AkMemSettings mem_settings;
    mem_settings.uMaxNumPools = 20;

    if (AK::MemoryMgr::Init(&mem_settings) != AK_Success) {
        return 1;
    }

    // Init Streaming
    std::cout << "Init Streaming\n";
    AkStreamMgrSettings stream_settings;
    AK::StreamMgr::GetDefaultSettings(stream_settings);

    if (!AK::StreamMgr::Create(stream_settings)) {
        return 1;
    }

    AkDeviceSettings device_settings;
    AK::StreamMgr::GetDefaultDeviceSettings(device_settings);

    if (g_lowlevel_io.Init(device_settings) != AK_Success) {
        return 1;
    }

    // Init Music
    std::cout << "Init Music\n";
    AkMusicSettings music_settings;
    AK::MusicEngine::GetDefaultInitSettings(music_settings);
    if (AK::MusicEngine::Init(&music_settings) != AK_Success) {
        return 1;
    }

    // Init Comms
    #ifndef AK_OPTIMIZED
    std::cout << "Init Comms\n";
    AkCommSettings comm_settings;
    AK::Comm::GetDefaultInitSettings(comm_settings);
    if (AK::Comm::Init(comm_settings) != AK_Success) {
        return 1;
    }
    #endif
}

Compiler Invocation:

clang++ \
        -I/Users/me/Wwise/Wwise_v2015.1.2_build_5457/SDK/include \
        -L/Users/me/Wwise/Wwise_v2015.1.2_build_5457/SDK/Mac/Debug/lib \
            -lAkSoundEngine \
            -lAkMemoryMgr \
            -lAkStreamMgr \
            -lAkMusicEngine \
            -lAkVorbisDecoder \
            -lCommunicationCentral \
            -framework AudioToolbox \
            -framework AudioUnit \
            -framework CoreAudio \
            -framework CoreFoundation \
            -g \
            main.cc \
            -I/Users/me/Wwise/Wwise_v2015.1.2_build_5457/SDK/Samples/SoundEngine/POSIX \
            /Users/me/Wwise/Wwise_v2015.1.2_build_5457/SDK/Samples/SoundEngine/Common/*.cpp \
            /Users/me/Wwise/Wwise_v2015.1.2_build_5457/SDK/Samples/SoundEngine/POSIX/*.cpp

Output:

$ ./a.out
Init Memory
Allocate 4640 bytes @ 0x7f902b807200
Init Streaming
Allocate 65536 bytes @ 0x7f902b808600
Allocate 2097664 bytes @ 0x103677000
Init Music
/Volumes/Data/Jenkins/workspace/MAC_2015.1/Wwise/SDK/source/SoundEngine/AkMusicEngine/Common/AkMusicRenderer.cpp:133 failed assertion `g_DefaultPoolId != AK_INVALID_POOL_ID'
Trace/BPT trap: 5

Stack Trace:

$ lldb a.out
(lldb) target create "a.out"
Current executable set to 'a.out' (x86_64).
(lldb) process launch
Process 2178 launched: '/Users/me/Projects/WwiseTest/a.out' (x86_64)
Init Memory
Allocate 4640 bytes @ 0x102001000
Init Streaming
Allocate 65536 bytes @ 0x102002400
Allocate 2097664 bytes @ 0x10132e000
Init Music
/Volumes/Data/Jenkins/workspace/MAC_2015.1/Wwise/SDK/source/SoundEngine/AkMusicEngine/Common/AkMusicRenderer.cpp:133 failed assertion `g_DefaultPoolId != AK_INVALID_POOL_ID'
Process 2178 stopped
* thread #1: tid = 0x62379a, 0x00007fff96a9f0ae libsystem_kernel.dylib`__pthread_kill + 10, queue = 'com.apple.main-thread', stop reason = signal SIGTRAP
    frame #0: 0x00007fff96a9f0ae libsystem_kernel.dylib`__pthread_kill + 10
libsystem_kernel.dylib`__pthread_kill:
->  0x7fff96a9f0ae <+10>: jae    0x7fff96a9f0b8            ; <+20>
    0x7fff96a9f0b0 <+12>: movq   %rax, %rdi
    0x7fff96a9f0b3 <+15>: jmp    0x7fff96a9a3ef            ; cerror_nocancel
    0x7fff96a9f0b8 <+20>: retq   
(lldb) bt
* thread #1: tid = 0x62379a, 0x00007fff96a9f0ae libsystem_kernel.dylib`__pthread_kill + 10, queue = 'com.apple.main-thread', stop reason = signal SIGTRAP
  * frame #0: 0x00007fff96a9f0ae libsystem_kernel.dylib`__pthread_kill + 10
    frame #1: 0x00007fff92147500 libsystem_pthread.dylib`pthread_kill + 90
    frame #2: 0x000000010001fb14 a.out`_AkAssertHook(in_pszExpression=0x0000000100209db4, in_pszFileName=0x0000000100209d43, in_lineNumber=133) + 68 at AkAudioLib.cpp:131
    frame #3: 0x00000001001bd1ed a.out`CAkMusicRenderer::Create(in_pSettings=0x00007fff5fbff8f8) + 125 at AkMusicRenderer.cpp:133
    frame #4: 0x00000001001bd105 a.out`AK::MusicEngine::Init(in_pSettings=0x00007fff5fbff8f8) + 21 at AkMusicRenderer.cpp:58
    frame #5: 0x00000001001ef9ef a.out`main + 271 at main.cc:66
    frame #6: 0x00007fff89f035ad libdyld.dylib`start + 1

Compiler Version:

$ clang++ -v
Apple LLVM version 6.1.0 (clang-602.0.49) (based on LLVM 3.6.0svn)
Target: x86_64-apple-darwin15.0.0
Thread model: posix
 
in General Discussion by Robin A. (100 points)

Please sign-in or register to answer this question.

...