AudioRecord getChannelConfiguration - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for AudioRecord getChannelConfiguration method.

This code example shows how to use the following methods:getAudioFormat, getChannelConfiguration, getSampleRate
		// TODO Auto-generated constructor stub 
		this.recorder = recorder;
		AudioRecord audioRecord = recorder.getAudioRecord();
 
		int bitsPerSample = 0;
		if (audioRecord.getAudioFormat() == AudioFormat.ENCODING_PCM_16BIT){
			bitsPerSample = 16;
		} 
		else if (audioRecord.getAudioFormat() == AudioFormat.ENCODING_PCM_8BIT){
			bitsPerSample = 8;
		} 
 
		int channel = 0;
		// whistle detection only supports mono channel 
		if (audioRecord.getChannelConfiguration() == AudioFormat.CHANNEL_CONFIGURATION_MONO){
			channel = 1;
		} 
		 
		// TODO: added detection init 
		waveHeader = new WaveHeader();

5
CodeRank
This code example shows how to use the following methods:getAudioFormat, getChannelConfiguration, getSampleRate
		AudioRecord audioRecord = recorder.getAudioRecord();
 
		this.alarmhandler = alarmhandler;
 
		int bitsPerSample = 0;
		if (audioRecord.getAudioFormat() == AudioFormat.ENCODING_PCM_16BIT) {
			bitsPerSample = 16;
		} else if (audioRecord.getAudioFormat() == AudioFormat.ENCODING_PCM_8BIT) {
			bitsPerSample = 8;
		} 
 
		int channel = 0;
		// whistle detection only supports mono channel 
		if (audioRecord.getChannelConfiguration() == AudioFormat.CHANNEL_CONFIGURATION_MONO) {
			channel = 1;
		} 
 
		// TODO: added detection init 
		waveHeader = new WaveHeader();
		waveHeader.setChannels(channel);

5
CodeRank
This code example shows how to use the following methods:getAudioFormat, getChannelConfiguration, getSampleRate
	public DetectorThread(RecorderThread recorder){
		this.recorder = recorder;
		AudioRecord audioRecord = recorder.getAudioRecord();
		 
		int bitsPerSample = 0;
		if (audioRecord.getAudioFormat() == AudioFormat.ENCODING_PCM_16BIT){
			bitsPerSample = 16;
		} 
		else if (audioRecord.getAudioFormat() == AudioFormat.ENCODING_PCM_8BIT){
			bitsPerSample = 8;
		} 
		 
		int channel = 0;
		// whistle detection only supports mono channel 
		if (audioRecord.getChannelConfiguration() == AudioFormat.CHANNEL_CONFIGURATION_MONO){
			channel = 1;
		} 
 
		waveHeader = new WaveHeader();
		waveHeader.setChannels(channel);

5
CodeRank
This code example shows how to use the following methods:getAudioFormat, getChannelConfiguration, getSampleRate
     * 
     * @return minimum size of the buffer 
     */ 
    protected int getMinBufferSize() { 
        final int minBufferSize = AudioRecord.getMinBufferSize(
                mAudioRecord.getSampleRate(), mAudioRecord.getChannelConfiguration(), mAudioRecord.getAudioFormat());
        if (minBufferSize < 0) {
            throw new IllegalStateException("Invalid audio recorder - cannot compute minimum buffer size");
        } 
        return minBufferSize;
    } 
 
    protected abstract void onRecordingStarted(); 
 
    protected abstract void onSampleRead(byte[] buffer, int size);
 
    protected abstract void onRecordingFinished(); 
 
    /** 
     * Starts audio recorder. 
5
CodeRank
getChannelConfiguration Method Overview
Returns the configured channel configuration.
See Code Examples for other Android AudioRecord Methods: