Audio in nt working on Samsung Galaxy tab


#1

Hi Jules,

Following my previous post in the now locked thread, I’ve made some test
and the crash is definitely related to audio input.
If I modify the Juce demo in order to not open audio input by default, it works fine
but as soon as I toggle the active input channels in the “Audio device setup” page, it crashes


#2

Ok, but where does it crash? I can’t really help unless I know that.


#3
12-12 14:57:49.002: E/AudioRecord(30587): AudioFlinger could not create record track, status: -1
12-12 14:57:49.002: E/AudioRecord-JNI(30587): Error creating AudioRecord instance: initialization check failed.
12-12 14:57:49.002: E/AudioRecord-Java(30587): [ android.media.AudioRecord ] Error code -20 when initializing native AudioRecord object.
12-12 14:57:49.012: D/AndroidRuntime(30587): Shutting down VM
12-12 14:57:49.012: W/dalvikvm(30587): threadid=1: thread exiting with uncaught exception (group=0x400a6760)
12-12 14:57:49.032: E/AndroidRuntime(30587): FATAL EXCEPTION: main
12-12 14:57:49.032: E/AndroidRuntime(30587): java.lang.IllegalStateException: startRecording() called on an uninitialized AudioRecord.
12-12 14:57:49.032: E/AndroidRuntime(30587): 	at android.media.AudioRecord.startRecording(AudioRecord.java:509)
12-12 14:57:49.032: E/AndroidRuntime(30587): 	at com.juce.JuceAppActivity.deliverMessage(Native Method)
12-12 14:57:49.032: E/AndroidRuntime(30587): 	at com.juce.JuceAppActivity$MessageCallback.run(JuceAppActivity.java:110)
12-12 14:57:49.032: E/AndroidRuntime(30587): 	at android.os.Handler.handleCallback(Handler.java:587)
12-12 14:57:49.032: E/AndroidRuntime(30587): 	at android.os.Handler.dispatchMessage(Handler.java:92)
12-12 14:57:49.032: E/AndroidRuntime(30587): 	at android.os.Looper.loop(Looper.java:132)
12-12 14:57:49.032: E/AndroidRuntime(30587): 	at android.app.ActivityThread.main(ActivityThread.java:4028)
12-12 14:57:49.032: E/AndroidRuntime(30587): 	at java.lang.reflect.Method.invokeNative(Native Method)
12-12 14:57:49.032: E/AndroidRuntime(30587): 	at java.lang.reflect.Method.invoke(Method.java:491)
12-12 14:57:49.032: E/AndroidRuntime(30587): 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:844)
12-12 14:57:49.032: E/AndroidRuntime(30587): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:602)
12-12 14:57:49.032: E/AndroidRuntime(30587): 	at dalvik.system.NativeStart.main(Native Method)

Don’t know much how I can debug further the JNI code

Just wondering, do you compile the JNI code with eclipse as well ?

I’ve found this
http://www.doc.ic.ac.uk/~cb908/Android%20NDK%20Debugging.pdf
http://www.eclipse.org/sequoyah/documentation/native_debug.php


#4

Well, clearly the device is failing when it gets created, and then throwing an exception when we try to start it… I’ll add some code to avoid the crash, but have no idea why it’s failing to open correctly. Perhaps you need to add something to your manifest to say that your app requires audio input?

You can do, though it’s a bit hit-and-miss. I tend to use the command-line.


#5

Indeed

fix the crash :slight_smile:

Thanks,


#6

Thanks.

(I’ve also updated the code now, so it should no longer crash if it fails).


#7

you’d better add this to AndroidManifest.xml of the Juce Demo as well if you didn’t already.

Thanks


#8

Well, I should make it an option.


#9

There is a series of articles on how to develop a talking pet on Android.
Information on the voice recording can be found in this article. There are sources.