Example usage for android.media AudioRecord ERROR

List of usage examples for android.media AudioRecord ERROR

Introduction

In this page you can find the example usage for android.media AudioRecord ERROR.

Prototype

int ERROR

To view the source code for android.media AudioRecord ERROR.

Click Source Link

Document

Denotes a generic operation failure.

Usage

From source file:com.ece420.lab3.MainActivity.java

private void queryNativeAudioParameters() {
    AudioManager myAudioMgr = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
    nativeSampleRate = myAudioMgr.getProperty(AudioManager.PROPERTY_OUTPUT_SAMPLE_RATE);
    nativeSampleBufSize = myAudioMgr.getProperty(AudioManager.PROPERTY_OUTPUT_FRAMES_PER_BUFFER);
    int recBufSize = AudioRecord.getMinBufferSize(Integer.parseInt(nativeSampleRate),
            AudioFormat.CHANNEL_IN_MONO, AudioFormat.ENCODING_PCM_16BIT);
    supportRecording = true;/*from w w w. j av  a2 s .com*/
    if (recBufSize == AudioRecord.ERROR || recBufSize == AudioRecord.ERROR_BAD_VALUE) {
        supportRecording = false;
    }
}