Community Q&A

Welcome to Audiokinetic’s community-driven Q&A forum. This is the place where Wwise and Strata users help each other out. For direct help from our team, please use the Support Tickets page. To report a bug, use the Bug Report option in the Audiokinetic Launcher. (Note that Bug Reports submitted to the Q&A forum will be rejected. Using our dedicated Bug Report system ensures your report is seen by the right people and has the best chance of being fixed.)

To get the best answers quickly, follow these tips when posting a question:

  • Be Specific: What are you trying to achieve, or what specific issue are you running into?
  • Include Key Details: Include details like your Wwise and game engine versions, operating system, etc.
  • Explain What You've Tried: Let others know what troubleshooting steps you've already taken.
  • Focus on the Facts: Describe the technical facts of your issue. Focusing on the problem helps others find a solution quickly.

0 votes

Hello,

We're currently in the process of trying to upgrade from 2016.1.1 to the latest 2019.1.1 release, but are running into a failure when attempting to initialize the sound engine. This is with a mixed Java/C++ game, not a native NDK activity based app. 

The following code is used for sound engine initialization, the Java VM is obtained from the initial JNI_OnLoad(JavaVM * vm, void *reserved) call which happens when our library is loaded. This works fine in 2016.1.1 but fails under 2019.1.1 for some reason. I'm unable to debug this further as I lack the source code to the SoundEngine. 

 AkInitSettings initSettings;
 AkPlatformInitSettings platformInitSettings;
 AK::SoundEngine::GetDefaultInitSettings( initSettings );
 AK::SoundEngine::GetDefaultPlatformInitSettings( platformInitSettings );
 platformInitSettings.pJavaVM = OurCustomLib->GetJavaVM();
 if ( AK::SoundEngine::Init( &initSettings, &platformInitSettings ) != AK_Success ) -> Failure: AKDEBUG: Java VM not initialized or not provided in AkInitSettings.

Please advise.

Thanks

in General Discussion by Gregg W. (100 points)

1 Answer

0 votes

你好,大神,我也遇到这个问题

AkPlatformInitSettings platformInitSettings;
JavaVM* jvm = cocos2d::JniHelper::getJavaVM();
platformInitSettings.pJavaVM = jvm;


JNIEnv* env = cocos2d::JniHelper::getEnv();
jclass classID=env->FindClass("org/cocos2dx/javascript/AppActivity");
jmethodID methodID = env->GetStaticMethodID(classID, "getInstance", "()Ljava/lang/Object;");
platformInitSettings.jActivity = env->CallStaticObjectMethod(classID, methodID);

AKRESULT res0 = m_pLowLevelIO->Init(platformInitSettings.pJavaVM,platformInitSettings.jActivity);

 

AKRESULT res1 = AK::SoundEngine::Init(&initSettings, &platformInitSettings);//Java VM not initialized or not provided in AkInitSettings.
by afd d. (310 points)
...