Answered
0
0

I’m using the NDK on VS2015’s new cross platform project for Android and am very close to geting fmod hooked up.

  • I’ve extended the NativeActivity into a class

    package com.MotoWheelie;

    import android.os.Bundle;

    public class NativeActivityLibLoader extends android.app.NativeActivity {

    package com.MotoWheelie;
    import android.os.Bundle;
    
    public class NativeActivityLibLoader extends android.app.NativeActivity {
    
        @Override
        protected void onCreate(Bundle savedInstanceState)
        {
            super.onCreate(savedInstanceState);
            org.fmod.FMOD.init(this);
        }
    
    
        @Override
        protected void onDestroy()
        {
            org.fmod.FMOD.close();
    
            super.onDestroy();
        }
    
        static {
            System.loadLibrary("fmodL");
            System.loadLibrary("fmodstudioL");
            System.loadLibrary("MotoWheelie");
        }  
    }
    
  • I’ve made sure fmod.jar is being included in classes.dex, etc.

  • FMOD::studio::system::create return FMOD_OK

However when I call fmodsystem->create, I get a crash. Logcat revealed this..
[LOG] System::create : Header version = 1.07.03. Current version = 1.07.03.
[ERR] FMOD_OS_Output_GetDefault : JavaVM::GetEnv returned -2.
[LOG] SystemI::init : FMOD Studio Version: 00010703 (69975)
[LOG] SystemI::init : maxchannels = 32, flags = 00020000, extradriverdata = 0x0
[LOG] SystemI::close :
[LOG] SystemI::close : Stop all sounds
[LOG] SystemI::close : Remove miscllaneous DSP stuff.
[LOG] SystemI::close : done.

[LOG] FMOD_OS_Init : Detected Neon instruction support, will use Neon optimized mixing and resampling.
[ERR] AndroidAssetFile::registerLib : JavaVM::GetEnv returned -2.
[ERR] FMOD_OS_Output_GetDefault : JavaVM::GetEnv returned -2.
[ERR] assert : assertion: ‘mOutput’ failed

What am I doing wrong. Any ideas on what I’m missing?
Thanks,
– Shammi

  • You must to post comments
Best Answer
0
0

Found the answer in the following post..

http://www.fmod.org/questions/question/fmod-studio-lowlevel-api-android-system-getnumdrivers-failing/

Turns out the Java portion of the API runs on the main thread and NativeActivity runs on another and FMOD native calls will fail across threads and we have to attach to the main thread before making an FMOD call.

It would be very helpful if FMOD updated its documentation and examples based on this. What would have really been helpful is a working jni project with all the java code and native code using NDK’s native activity template.

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.