Code example for AudioRecord

Methods: read

0
        StampedAudio stampedAudio = null;
 
        if (_mic != null) {
            int timestamp = getOutboundTimestamp();
            // read is blocking. 
            int bufferRead = _mic.read(_micFramebuff, 0, _micFramebuff.length);
            Log.verb( 
                    this.getClass().getSimpleName()
                    + ".readMic(): length=" + _micFramebuff.length
                    + ", bufferRead=" + bufferRead);
 
            short[] sframe = _micFramebuff;
            //short[] seframe = effectIn(sframe); 
            byte[] tbuff = _encoder.encode_frame(sframe);
 
            if (tbuff != null) {
                stampedAudio = _audio.getCleanStampedAudio();
                stampedAudio.setStampAndBytes(tbuff, 0, tbuff.length,
                        timestamp);
                _audio.saveReadStampedAudio(stampedAudio);