Code example for AudioTrack

Methods: getPlayStateplaywrite

0
	} 
 
 
    void playSound(byte[] buf, int size) {  
    	//Start the track if it isn't already playing 
    	if(track.getPlayState()!=AudioTrack.PLAYSTATE_PLAYING)
    		track.play();
    	 
    	//Write the buffer to the AudioTrack 
        track.write(buf, 0, size);
    } 
 
    //Native functions 
    private native void createEngine(); 
    private native void playURL(String file, byte[] array);
    public native void cancel(); 
     
    /** Load jni .so on initialization*/  
    static { 
   	     System.loadLibrary("avutil"); 
    	 System.loadLibrary("avcore");