Hello
I have a music (sequencer/synth) app in Android Market. One of its strengths is that it uses very little resources and plays smoothly even on the oldest and cheapest devices and only requires Android version 1.6. However, since the arrival of ICS, I get more and more complaints about stuttering playback and a sluggish interface, mainly on Galaxy Nexus. The app hasn't changed and still works fine on earlier versions of Android. I wonder what may have changed. My app does the audio processing in native code and I suspect the way data are passed between java and native might be the problem (I still use AudioTrack to maintain 1.6 compatibility and because it always worked fine): public class PlayThread extends Thread { public void run() { ByteBuffer byteBuffer = ByteBuffer.allocateDirect(minSize); byte[] byteArray = new byte[minSize]; android.os.Process.setThreadPriority(android.os.Process.THREAD_PRIORITY_URGENT_AUDIO); int minSize =AudioTrack.getMinBufferSize( 44100, AudioFormat.CHANNEL_CONFIGURATION_STEREO, AudioFormat.ENCODING_PCM_16BIT ); myTrack = new AudioTrack( AudioManager.STREAM_MUSIC, 44100, AudioFormat.CHANNEL_CONFIGURATION_STEREO, AudioFormat.ENCODING_PCM_16BIT, minSize, AudioTrack.MODE_STREAM); myTrack.play(); while(1) { byteBuffer.position(0); processNativeAudio(byteBuffer, minSize); byteBuffer.position(0); byteBuffer.get(byteArray, 0, minSize); myTrack.write( puff, 0, minSize ); } } } In the main activity, a new PlayThread is created on startup. The native function looks like this: void Java_com_myapp_ processNativeAudio( JNIEnv * env, jobject this, jobject buffer , jint buflng) { jbyte *jbuffer = (*env)->GetDirectBufferAddress(env, buffer); short *shortBuffer= (short*)(jbuffer); // processing audio here and writing to shortBuffer } Anyone has similar problems or even knows a workaround? Thank you. -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en