Accessing somekind of audio device from JNI?

by Possan » Wed, 12 Aug 2009 01:35:42 GMT


Sponsored Links
 Hi

Is it possible to access some audio-device or getting some lower level
access to the media framework from within a JNI library, for
generating lower latency audio? perhaps using something like alsa?
couldn't find any audio/media references in the NDK..

--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. "No such file or directory" when storing a file in sdcard.

Hi,
I want to store a file from internal storage to external storage
(sdcard) however, i'm facing a problem: here is the log message:
04-12 03:08:59.084: DEBUG/IOException(2059): No such file or directory

What's the problem?
Thank you for your help.


public void transfer(){
                try {
        File sdCard = Environment.getExternalStorageDirectory();
        boolean mExternalStorageAvailable = false;
        boolean mExternalStorageWriteable = false;
        String state = Environment.getExternalStorageState();

        if (Environment.MEDIA_MOUNTED.equals(state)) {
            // We can read and write the media
                Log.d("Carburant", "Sdcard can read/write !!" );
            mExternalStorageAvailable = mExternalStorageWriteable = true;

            try{
                final SharedPreferences preferences = PreferenceManager
                        .getDefaultSharedPreferences(context);
        String fileName =
context.getResources().getString(R.string.fileName);
        String fileDir = "" + preferences.getString("login", "") + "."+
preferences.getString("marque", "") + ".";

        File f2 = new File(context.getFilesDir(), fileDir+fileName);
    String y= f2.getAbsolutePath();
        Log.d("HI Export",y);
        InputStream in = new FileInputStream(f2);


        String destination = sdCard.getAbsolutePath()+"/Carburant/" +fileDir
+fileName;
    File fileCon = new File(destination);
    if( ! fileCon.exists() ){
            fileCon.createNewFile();
        }
            OutputStream out = new FileOutputStream(fileCon);




              byte[] buf = new byte[1024];
              int len;
              while ((len = in.read(buf)) != -1){
                out.write(buf, 0, len);
              }
              //out.flush();
              in.close();
              out.close();
              Toast.makeText(context, "Export effectu",
Toast.LENGTH_SHORT).show();
            }

            catch(FileNotFoundException ex){
                Toast.makeText(context, "File Not found",
Toast.LENGTH_SHORT).show();
                String x=ex.getMessage();
                Log.d("Carburant", x);
            }
            catch(IOException e){
                Toast.makeText(context, "Echec", Toast.LENGTH_SHORT).show();
                Log.d("IOException", e.getMessage());
            }
          }


        else if (Environment.MEDIA_MOUNTED_READ_ONLY.equals(state)) {
            // We can only read the media
                Log.d("Carburant", "Sdcard only read !!" );
            mExternalStorageAvailable = true;
            mExternalStorageWriteable = false;
        } else {
            // Something else is wrong. It may be one of many other states,
but all we need
            //  to know is we can neither read nor write
            mExternalStorageAvailable = mExternalStorageWriteable = false;
        }
                }
        catch (Exception e) {
        Log.d("CARBURANT", e.getMessage());
        }

}
        }

-- 

2. FATAL EXCEPTION

**
*Hi, All*
**
I have some FATAL EXCEPTION which i could not figure it out. Can any one
help me. here is the log cat. will be very thankful to you.




04-12 12:05:17.069: DEBUG/AndroidRuntime(296): >>>>>>>>>>>>>> AndroidRuntime
START <<<<<<<<<<<<<<
04-12 12:05:17.079: DEBUG/AndroidRuntime(296): CheckJNI is ON
04-12 12:05:17.459: DEBUG/AndroidRuntime(296): --- registering native
functions ---
04-12 12:05:18.559: DEBUG/AndroidRuntime(296): Shutting down VM
04-12 12:05:18.569: DEBUG/dalvikvm(296): De{*filter*} has detached; object
registry had 1 entries
04-12 12:05:18.599: INFO/AndroidRuntime(296): NOTE: attach of thread 'Binder
Thread #3' failed
04-12 12:05:19.269: DEBUG/AndroidRuntime(306): >>>>>>>>>>>>>> AndroidRuntime
START <<<<<<<<<<<<<<
04-12 12:05:19.269: DEBUG/AndroidRuntime(306): CheckJNI is ON
04-12 12:05:19.519: DEBUG/AndroidRuntime(306): --- registering native
functions ---
04-12 12:05:20.579: INFO/ActivityManager(58): Starting activity: Intent {
act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER]
flg=0x10000000 cmp=com.SpinnerDemo/org.me.sfBackendClient.SpinnerDemo }
04-12 12:05:20.659: DEBUG/AndroidRuntime(306): Shutting down VM
04-12 12:05:20.669: DEBUG/dalvikvm(306): De{*filter*} has detached; object
registry had 1 entries
04-12 12:05:20.709: INFO/AndroidRuntime(306): NOTE: attach of thread 'Binder
Thread #3' failed
04-12 12:05:20.749: INFO/ActivityManager(58): Start proc com.SpinnerDemo for
activity com.SpinnerDemo/org.me.sfBackendClient.SpinnerDemo: pid=312
uid=10048 gids={3003, 1015}
04-12 12:05:21.639: DEBUG/AndroidRuntime(312): Shutting down VM
04-12 12:05:21.639: WARN/dalvikvm(312): threadid=1: thread exiting with
uncaught exception (group=0x4001d800)
04-12 12:05:21.669: ERROR/AndroidRuntime(312): FATAL EXCEPTION: main
04-12 12:05:21.669: ERROR/AndroidRuntime(312): java.lang.RuntimeException:
Unable to instantiate activity
ComponentInfo{com.SpinnerDemo/org.me.sfBackendClient.SpinnerDemo}:
java.lang.ClassNotFoundException: org.me.sfBackendClient.SpinnerDemo in
loader dalvik.system.PathClassLoader[/data/app/com.SpinnerDemo-2.apk]
04-12 12:05:21.669: ERROR/AndroidRuntime(312):     at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2585)
04-12 12:05:21.669: ERROR/AndroidRuntime(312):     at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
04-12 12:05:21.669: ERROR/AndroidRuntime(312):     at
android.app.ActivityThread.access$2300(ActivityThread.java:125)
04-12 12:05:21.669: ERROR/AndroidRuntime(312):     at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
04-12 12:05:21.669: ERROR/AndroidRuntime(312):     at
android.os.Handler.dispatchMessage(Handler.java:99)
04-12 12:05:21.669: ERROR/AndroidRuntime(312):     at
android.os.Looper.loop(Looper.java:123)
04-12 12:05:21.669: ERROR/AndroidRuntime(312):     at
android.app.ActivityThread.main(ActivityThread.java:4627)
04-12 12:05:21.669: ERROR/AndroidRuntime(312):     at
java.lang.reflect.Method.invokeNative(Native Method)
04-12 12:05:21.669: ERROR/AndroidRuntime(312):     at
java.lang.reflect.Method.invoke(Method.java:521)
04-12 12:05:21.669: ERROR/AndroidRuntime(312):     at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
04-12 12:05:21.669: ERROR/AndroidRuntime(312):     at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
04-12 12:05:21.669: ERROR/AndroidRuntime(312):     at
dalvik.system.NativeStart.main(Native Method)
04-12 12:05:21.669: ERROR/AndroidRuntime(312): Caused by:
java.lang.ClassNotFoundException: org.me.sfBackendClient.SpinnerDemo in
loader dalvik.system.PathClassLoader[/data/app/com.SpinnerDemo-2.apk]
04-12 12:05:21.669: ERROR/AndroidRuntime(312):     at
dalvik.system.PathClassLoader.findClass(PathClassLoader.java:243)
04-12 12:05:21.669: ERROR/AndroidRuntime(312):     at
java.lang.ClassLoader.loadClass(ClassLoader.java:573)
04-12 12:05:21.669: ERROR/AndroidRuntime(312):     at
java.lang.ClassLoader.loadClass(ClassLoader.java:532)
04-12 12:05:21.669: ERROR/AndroidRuntime(312):     at
android.app.Instrumentation.newActivity(Instrumentation.java:1021)
04-12 12:05:21.669: ERROR/AndroidRuntime(312):     at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2577)
04-12 12:05:21.669: ERROR/AndroidRuntime(312):     ... 11 more
04-12 12:05:21.689: WARN/ActivityManager(58):   Force finishing activity
com.SpinnerDemo/org.me.sfBackendClient.SpinnerDemo
04-12 12:05:22.212: WARN/ActivityManager(58): Activity pause timeout for
HistoryRecord{440603a8 com.SpinnerDemo/org.me.sfBackendClient.SpinnerDemo}
04-12 12:05:32.754: WARN/ActivityManager(58): Activity destroy timeout for
HistoryRecord{440603a8 com.SpinnerDemo/org.me.sfBackendClient.SpinnerDemo}
04-12 12:06:57.368: DEBUG/SntpClient(58): request time failed:
java.net.SocketException: Address family not supported by protocol
04-12 12:07:00.248: DEBUG/dalvikvm(58): GC_FOR_MALLOC freed 10659 objects /
550192 bytes in 162ms
04-12 12:10:21.770: INFO/Process(312): Sending signal. PID: 312 SIG: 9
04-12 12:10:21.818: INFO/ActivityManager(58): Process com.SpinnerDemo (pid
312) has died.
04-12 12:11:57.369: DEBUG/SntpClient(58): request time failed:
java.net.SocketException: Address family not supported by protocol

-- 

3. Getting a delay between starting current activity after returning from startActivityForResult()

4. is there any idea that files are only used by application those are stored on media card?

5. 3D Image

6. implementing bluetooth printer

7. Kik and Whatsup