Code example for AudioTrack

Methods: write

0
        else 
        { 
            //if( Globals.AudioBufferConfig == 0 ) // Gives too much spam to logcat, makes things worse 
            //     mAudio.flush(); 
 
            mAudio.write( mAudioBuffer, 0, mVirtualBufSize );
        } 
 
        return 1; 
    } 
 
    public int initAudio(int rate, int channels, int encoding, int bufSize)
    { 
        if( mAudio == null )
        { 
            channels = ( channels == 1 ) ? AudioFormat.CHANNEL_CONFIGURATION_MONO : 
                AudioFormat.CHANNEL_CONFIGURATION_STEREO;
            encoding = ( encoding == 1 ) ? AudioFormat.ENCODING_PCM_16BIT :
                AudioFormat.ENCODING_PCM_8BIT;
 
            mVirtualBufSize = bufSize;