0
0

I have fmod integrated into my android project, and I am able to successfully initialize the system without problems. However, when I attempt to record audio, I get a crash. I’ve linked against fmodexL for more info. This is what I get (skip to the bottom, I included the whole log just in case it’s relevant):

[code:2p37s726]
11-24 03:58:35.936: D/dalvikvm(16027): Trying to load lib /data/data/org.cocos2dx.application/lib/libfmodexL.so 0x4051cb90
11-24 03:58:35.946: D/dalvikvm(16027): Added shared lib /data/data/org.cocos2dx.application/lib/libfmodexL.so 0x4051cb90
11-24 03:58:35.946: D/dalvikvm(16027): No JNI_OnLoad found in /data/data/org.cocos2dx.application/lib/libfmodexL.so 0x4051cb90, skipping init
11-24 03:58:35.946: D/dalvikvm(16027): Trying to load lib /data/data/org.cocos2dx.application/lib/libhelloworld.so 0x4051cb90
11-24 03:58:35.966: D/dalvikvm(16027): Added shared lib /data/data/org.cocos2dx.application/lib/libhelloworld.so 0x4051cb90
11-24 03:58:35.986: V/SoundPool-JNI(16027): android_media_SoundPool_native_setup
11-24 03:58:35.986: V/SoundPool(16027): SoundPool constructor: maxChannels=5, streamType=3, srcQuality=5
11-24 03:58:35.986: V/SoundPoolThread(16027): beginThread
11-24 03:58:35.986: V/SoundPoolThread(16027): run
11-24 03:58:35.996: W/apk path(16027): /data/app/org.cocos2dx.application-2.apk
11-24 03:58:36.006: I/[POST_RESELECT](16027): [spanChange] (o, oldStart, newStart, oldEnd, newEnd)=(android.text.Selection$START@4013d118,-1,0,-1,0)
11-24 03:58:36.016: I/[POST_RESELECT](16027): [spanChange] (o, oldStart, newStart, oldEnd, newEnd)=(android.text.Selection$END@4013f120,-1,0,-1,0)
11-24 03:58:36.036: D/ATRecorder(16027): com.htc.autotest.dlib.RecordEngine in loader dalvik.system.DexClassLoader@40539318
11-24 03:58:36.136: D/libEGL(16027): loaded /system/lib/egl/libGLES_android.so
11-24 03:58:36.146: D/libEGL(16027): loaded /system/lib/egl/libEGL_adreno200.so
11-24 03:58:36.166: D/libEGL(16027): loaded /system/lib/egl/libGLESv1_CM_adreno200.so
11-24 03:58:36.166: D/libEGL(16027): loaded /system/lib/egl/libGLESv2_adreno200.so
11-24 03:58:36.427: I/fmod(16027): FMOD: SystemI::init : FMOD Ex Version: 00044000
11-24 03:58:36.437: I/fmod(16027): FMOD: SystemI::init : maxchannels = 32, flags = 00000000, extradriverdata = 0x0
11-24 03:58:36.437: I/fmod(16027): FMOD: SystemI::close :
11-24 03:58:36.437: I/fmod(16027): FMOD: SystemI::close : Stop all sounds
11-24 03:58:36.437: I/fmod(16027): FMOD: SystemI::close : Remove miscllaneous DSP stuff.
11-24 03:58:36.437: I/fmod(16027): FMOD: SystemI::close : done.
11-24 03:58:36.437: I/fmod(16027): FMOD: FMOD_OS_Output_Register : Detected VFP instruction support, will use VFP optimized mixing and resampling.
11-24 03:58:36.437: I/fmod(16027): FMOD: OutputOpenSL::init : Initializing...
11-24 03:58:36.447: V/ExtendedExtractor(16027): Failed to open MM_PARSER_LIB, dlerror = Cannot load library: load_library[1105]: Library ‘libmmparser.so’ not found
11-24 03:58:36.447: V/ExtendedExtractor(16027): Failed to open MM_PARSER_LITE_LIB, dlerror = Cannot load library: load_library[1105]: Library ‘libmmparser_lite.so’ not found
11-24 03:58:36.447: I/AudioSystem(16027): getting audio flinger
11-24 03:58:36.477: I/AudioSystem(16027): returning new audio session id
11-24 03:58:36.477: I/fmod(16027): FMOD: OutputOpenSL::init : Done.
11-24 03:58:36.477: I/fmod(16027): FMOD: SystemI::init : Set up software engine
11-24 03:58:36.477: I/fmod(16027): FMOD: OutputOpenSL::start : Starting...
11-24 03:58:36.487: I/fmod(16027): FMOD: OutputOpenSL::start : Done.
11-24 03:58:36.487: I/fmod(16027): FMOD: Thread::initThread : Initializing FMOD mixer thread. priority 3
11-24 03:58:36.487: I/fmod(16027): FMOD: Thread::initThread : – Stacksize 49152. Stack pointer 0x0 : usesemaphore = 0 : sleeptime = 3
11-24 03:58:36.497: I/fmod(16027): FMOD: Thread::initThread : done.
11-24 03:58:36.497: I/fmod(16027): FMOD: SystemI::init : Set up emulated output
11-24 03:58:36.497: I/fmod(16027): FMOD: SystemI::init : create the channel pool
11-24 03:58:36.497: I/fmod(16027): FMOD: SystemI::init : Set up streamer
11-24 03:58:36.497: I/fmod(16027): FMOD: Thread::initThread : Initializing FMOD stream thread. priority 2
11-24 03:58:36.497: I/fmod(16027): FMOD: Thread::initThread : – Stacksize 49152. Stack pointer 0x0 : usesemaphore = 0 : sleeptime = 10
11-24 03:58:36.497: I/fmod(16027): FMOD: Thread::callback : * FMOD mixer thread started
11-24 03:58:36.497: I/fmod(16027): FMOD: Thread::callback : * FMOD stream thread started
11-24 03:58:36.497: I/fmod(16027): FMOD: Thread::initThread : done.
11-24 03:58:36.497: I/fmod(16027): FMOD: SystemI::init : done
11-24 04:00:52.319: I/fmod(16027): FMOD: SystemI::createSoundInternal : filename = : mode 0000044a
11-24 04:00:52.319: I/fmod(16027): FMOD: SystemI::createSoundInternal : exinfo->cbsize = 136
11-24 04:00:52.319: I/fmod(16027): FMOD: SystemI::createSoundInternal : exinfo->length = 441000
11-24 04:00:52.319: I/fmod(16027): FMOD: SystemI::createSoundInternal : exinfo->numchannels = 1
11-24 04:00:52.319: I/fmod(16027): FMOD: SystemI::createSoundInternal : exinfo->defaultfrequency = 44100
11-24 04:00:52.319: I/fmod(16027): FMOD: SystemI::createSoundInternal : exinfo->format = 2
11-24 04:00:52.319: I/fmod(16027): FMOD: SystemI::createSoundInternal : 17 codecs found. Scan all until one succeeds
11-24 04:00:52.319: I/fmod(16027): FMOD: CodecUser::openInternal : attempting to open user codec..
11-24 04:00:52.319: I/fmod(16027): FMOD: CodecUser::openInternal : Done. format = 2, channels 1, frequency 44100, lengthpcm 220500, blockalign 2.
11-24 04:00:52.319: I/fmod(16027): FMOD: SystemI::createSoundInternal : Format has 0 subsounds.
11-24 04:00:52.319: I/fmod(16027): FMOD: SystemI::createSoundInternal : Create as FMOD_CREATESAMPLE
11-24 04:00:52.319: I/fmod(16027): FMOD: SystemI::createSoundInternal : creating subsound 0/0
11-24 04:00:52.319: I/fmod(16027): FMOD: SystemI::createSample : mode 0000044a length 220500 samples, lengthbytes 0
11-24 04:00:52.319: I/fmod(16027): FMOD: SystemI::createSample : subsamples = 1, channels = 1
11-24 04:00:52.319: I/fmod(16027): FMOD: SystemI::createSample : subsample 0. output = 0x3ce508
11-24 04:00:52.319: I/fmod(16027): FMOD: SystemI::createSample : mSoftware = 0x3ce508
11-24 04:00:52.319: I/fmod(16027): FMOD: OutputSoftware::createSample : lengthpcm 220500, lengthbytes 0, channels 1, format 2, freq 44100, mode 0000044a
11-24 04:00:52.329: I/fmod(16027): FMOD: OutputSoftware::createSample : done
11-24 04:00:52.329: I/fmod(16027): FMOD: SystemI::createSample : done
11-24 04:00:52.339: I/fmod(16027): FMOD: SystemI::createSoundInternal : No name found in file, use filename.
11-24 04:00:52.339: I/fmod(16027): FMOD: SystemI::createSoundInternal : done. OpenState now = FMOD_OPENSTATE_READY.
11-24 04:00:52.349: E/AudioRecord(16027): AudioFlinger could not create record track, status: -1
11-24 04:00:52.349: E/libOpenSLES(16027): android_audioRecorder_realize(0x450b48) error creating AudioRecord object
11-24 04:00:52.349: I/fmod(16027): FMOD: OutputOpenSL::recordStart : Cannot realize audio recorder object. Result = 0x9.
11-24 04:00:52.349: D/cocos2d-x debug info(16027): FMOD error! (33) An error occured that wasn’t supposed to. Contact support.
[/code:2p37s726]

Any ideas on what might be wrong here?

  • You must to post comments
0
0

I’m not sure if this is useful or not, but here is the code around my call to System::recordStart

[code:v7o2zliw]
FMOD_RESULT result;
SoftwareFormatParams SoftwareFormat;
GetSoftwareFormat( &SoftwareFormat );

//-----------------------
// Create a sound to record to.
FMOD_CREATESOUNDEXINFO exinfo;
memset(&exinfo, 0, sizeof(FMOD_CREATESOUNDEXINFO));

exinfo.cbsize           = sizeof(FMOD_CREATESOUNDEXINFO);
exinfo.numchannels      = 1;
exinfo.format           = FMOD_SOUND_FORMAT_PCM16;
exinfo.defaultfrequency = SoftwareFormat._iSampleRate;
exinfo.length           = exinfo.defaultfrequency * sizeof(short) * exinfo.numchannels * 5;

result = _pFmodSystem->createSound
(
    0, 
    FMOD_2D | FMOD_SOFTWARE | FMOD_LOOP_NORMAL | FMOD_OPENUSER, 
    &exinfo, 
    &_pSoundForSpectrumAnalysis
);

ERRCHECK(result);


//-----------------------
// start recording
// in the PC sample, a driver is selected.  in the iOS sample, it's just 0.  
_iRecordDriverForSpectrumAnalysis = 0; 
result = _pFmodSystem->recordStart( _iRecordDriverForSpectrumAnalysis, _pSoundForSpectrumAnalysis, true );
ERRCHECK(result);

[/code:v7o2zliw]

hmmm….now that I look at this, I’m wondering if using 0 as the record driver is a bad assumption on android. I’ll look into that.

  • You must to post comments
0
0

Like your previous issue with network permissions, I think your issue here is recording permissions, make sure you have the following in your AndroidManifest.xml

[code:em79v7ah]<uses-permission android:name="android.permission.RECORD_AUDIO"></uses-permission>[/code:em79v7ah]

See our recording example for reference.

  • You must to post comments
0
0

Yup, that was the problem, thanks!

Suggestion: it might be worthwhile to add a bit about the AndroidManifest.xml, (and what options are required for which features) to the "Geting started with FMOD for Android.pdf". I was pretty much lost with this one – didn’t even think about the manifest permissions. Had there been a section on this, I probably(?) would have figured it out on my own.

Anyway, thanks again!

  • You must to post comments
0
0

I’m glad it’s working for you.

I’ll look into adding something to the getting started, and perhaps catch the internal error so I can report the access denied as an FMOD error.

  • You must to post comments
Showing 4 results
Your Answer

Please first to submit.