android - Cannot access AudioRecorder -


i trying take small recordings find sound pressure level service android wont give me access hardware. following errors in logcat:

alt text

the error comes following code:

audiorecord recordinstance = null;      // we're important...     android.os.process             .setthreadpriority(android.os.process.thread_priority_urgent_audio);      short buffersize = 4096;// 2048;       recordinstance = new audiorecord(mediarecorder.audiosource.mic, //line 167             .getfrequency(), this.getchannelconfiguration(),             .getaudioencoding(), buffersize); //object not created      tempbuffer = new short[buffersize];     recordinstance.startrecording(); 

what happens recordinstance never created , when gets end , calls recordinstance.startrecording(), recordinstance still null. android rejects programs request @ definition. know errno's indicate? couldn't find list online.

audiorecord docs

thanks

check 3 things:

  1. your permissions (you need give permission record_audio)

  2. have run once , not called recordinstance.release()? if may have tied audio resources , not work until restart phone. have found in experience anyway.

3.the buffer size. there static method audiorecord.getminbuffersize()


Comments

Popular posts from this blog

400 Bad Request on Apache/PHP AddHandler wrapper -

Add email recipient to all new Trac tickets -

php - Change action and image src url's with jQuery -