Code example for AudioRecord

Methods: getSampleRate, getNotificationMarkerPosition, getPositionNotificationPeriod

0
        // + AudioRecord 
        // .getNativeInputSampleRate(AudioManager.STREAM_VOICE_CALL)); 
 
        final int recBufSize = minRecBufSize; // 3200; // 100 ms buffer
        try { 
            _ar = new AudioRecord(
                            MediaRecorder.AudioSource.MIC,
                            16000, 
                            AudioFormat.CHANNEL_CONFIGURATION_MONO,
                            AudioFormat.ENCODING_PCM_16BIT,
                            recBufSize);
        } catch (Exception e) {
            WebrtcLog(e.getMessage());
        } 
 
        // Log some info (non-static) 
        WebrtcLog("Notification marker pos = " 
                        + _ar.getNotificationMarkerPosition());
        // WebrtcLog("Play head pos = " + _ar.getRecordHeadPosition()); 
        WebrtcLog("Pos notification dt rec= " 
                        + _ar.getPositionNotificationPeriod());
        // WebrtcLog("Playback rate = " + _ar.getRecordRate()); 
        // WebrtcLog("Playback rate = " + _ar.getPlaybackRate()); 
        WebrtcLog("Sample rate = " + _ar.getSampleRate());
        // WebrtcLog("Playback rate = " + _ar.getPlaybackRate()); 
        // WebrtcLog("Playback rate = " + _ar.getPlaybackRate()); 
 
        _isRunningRec = true;