Code example for AudioTrack

Methods: playreloadStaticDatasetNotificationMarkerPositionwrite

0
    	minSize = AudioTrack.getMinBufferSize( 44100, AudioFormat.CHANNEL_CONFIGURATION_STEREO, AudioFormat.ENCODING_PCM_16BIT );        
         
        track = new AudioTrack(AudioManager.STREAM_MUSIC,
        		44100, AudioFormat.CHANNEL_CONFIGURATION_STEREO,
                AudioFormat.ENCODING_PCM_16BIT,minSize,
                AudioTrack.MODE_STREAM);
        track.reloadStaticData();
    	track.play();
        Process.setThreadPriority(Process.THREAD_PRIORITY_AUDIO);
/* 
        track.setPlaybackPositionUpdateListener( 
                new AudioTrack.OnPlaybackPositionUpdateListener() { 
                    public void onPeriodicNotification(AudioTrack track) { 
                    } 
                    // �Đ��������̃R�[���o�b�N 
                    public void onMarkerReached(AudioTrack track) { 
                    	if (stopSound!=0) return; 
                    	switch (bufferNo) { 
                    	case 0: 
                            track.setNotificationMarkerPosition(audioData2.length/2); 
                            track.write(audioData2, 0, audioData2.length); 
                            track.play(); 
                    		fillSoundBuffer(audioData1,audioData1.length); 
                    		bufferNo ++; 
                    		break; 
                    	case 1: 
                            track.setNotificationMarkerPosition(audioData1.length/2); 
                            track.write(audioData1, 0, audioData1.length); 
                            track.play(); 
                    		fillSoundBuffer(audioData2,audioData2.length); 
                    		bufferNo = 0; 
                    		break; 
                    	} 
//                    	idle(); 
                    } 
                } 
            ); 
*/ 
    	audioData1 = new short[minSize/2];
    	audioData2 = new short[minSize/2];
		fillSoundBuffer(audioData1,audioData1.length);
		fillSoundBuffer(audioData2,audioData2.length);
        track.write(audioData1, 0, audioData1.length);
        track.setNotificationMarkerPosition(audioData1.length/2);
/*         
        while (stopSound==0) { 
        	idle(); 
        } 
*/