am 3b12261c: Merge "android.media.AudioRecord.Builder: no "capture preset"" into mnc-dev
* commit '3b12261c50851deedef64974a05a8cbff2b4c2ea': android.media.AudioRecord.Builder: no "capture preset"
This commit is contained in:
@@ -15029,8 +15029,8 @@ package android.media {
|
||||
ctor public AudioRecord.Builder();
|
||||
method public android.media.AudioRecord build() throws java.lang.UnsupportedOperationException;
|
||||
method public android.media.AudioRecord.Builder setAudioFormat(android.media.AudioFormat) throws java.lang.IllegalArgumentException;
|
||||
method public android.media.AudioRecord.Builder setAudioSource(int) throws java.lang.IllegalArgumentException;
|
||||
method public android.media.AudioRecord.Builder setBufferSizeInBytes(int) throws java.lang.IllegalArgumentException;
|
||||
method public android.media.AudioRecord.Builder setCapturePreset(int) throws java.lang.IllegalArgumentException;
|
||||
}
|
||||
|
||||
public static abstract interface AudioRecord.OnRecordPositionUpdateListener {
|
||||
|
||||
@@ -16250,8 +16250,8 @@ package android.media {
|
||||
method public android.media.AudioRecord build() throws java.lang.UnsupportedOperationException;
|
||||
method public android.media.AudioRecord.Builder setAudioAttributes(android.media.AudioAttributes) throws java.lang.IllegalArgumentException;
|
||||
method public android.media.AudioRecord.Builder setAudioFormat(android.media.AudioFormat) throws java.lang.IllegalArgumentException;
|
||||
method public android.media.AudioRecord.Builder setAudioSource(int) throws java.lang.IllegalArgumentException;
|
||||
method public android.media.AudioRecord.Builder setBufferSizeInBytes(int) throws java.lang.IllegalArgumentException;
|
||||
method public android.media.AudioRecord.Builder setCapturePreset(int) throws java.lang.IllegalArgumentException;
|
||||
method public android.media.AudioRecord.Builder setSessionId(int) throws java.lang.IllegalArgumentException;
|
||||
}
|
||||
|
||||
|
||||
@@ -246,8 +246,8 @@ public class AudioRecord
|
||||
* Though some invalid parameters will result in an {@link IllegalArgumentException} exception,
|
||||
* other errors do not. Thus you should call {@link #getState()} immediately after construction
|
||||
* to confirm that the object is usable.
|
||||
* @param audioSource the recording source (also referred to as capture preset).
|
||||
* See {@link MediaRecorder.AudioSource} for the capture preset definitions.
|
||||
* @param audioSource the recording source.
|
||||
* See {@link MediaRecorder.AudioSource} for the recording source definitions.
|
||||
* @param sampleRateInHz the sample rate expressed in Hertz. 44100Hz is currently the only
|
||||
* rate that is guaranteed to work on all devices, but other rates such as 22050,
|
||||
* 16000, and 11025 may work on some devices.
|
||||
@@ -285,8 +285,8 @@ public class AudioRecord
|
||||
* @hide
|
||||
* Class constructor with {@link AudioAttributes} and {@link AudioFormat}.
|
||||
* @param attributes a non-null {@link AudioAttributes} instance. Use
|
||||
* {@link AudioAttributes.Builder#setCapturePreset(int)} for configuring the capture
|
||||
* preset for this instance.
|
||||
* {@link AudioAttributes.Builder#setAudioSource(int)} for configuring the audio
|
||||
* source for this instance.
|
||||
* @param format a non-null {@link AudioFormat} instance describing the format of the data
|
||||
* that will be recorded through this AudioRecord. See {@link AudioFormat.Builder} for
|
||||
* configuring the audio format parameters such as encoding, channel mask and sample rate.
|
||||
@@ -394,14 +394,14 @@ public class AudioRecord
|
||||
/**
|
||||
* Builder class for {@link AudioRecord} objects.
|
||||
* Use this class to configure and create an <code>AudioRecord</code> instance. By setting the
|
||||
* recording preset (a.k.a. recording source) and audio format parameters, you indicate which of
|
||||
* those vary from the default behavior on the device.
|
||||
* recording source and audio format parameters, you indicate which of
|
||||
* those vary from the default behavior on the device.
|
||||
* <p> Here is an example where <code>Builder</code> is used to specify all {@link AudioFormat}
|
||||
* parameters, to be used by a new <code>AudioRecord</code> instance:
|
||||
*
|
||||
* <pre class="prettyprint">
|
||||
* AudioRecord recorder = new AudioRecord.Builder()
|
||||
* .setCapturePreset(MediaRecorder.AudioSource.VOICE_COMMUNICATION)
|
||||
* .setAudioSource(MediaRecorder.AudioSource.VOICE_COMMUNICATION)
|
||||
* .setAudioFormat(new AudioFormat.Builder()
|
||||
* .setEncoding(AudioFormat.ENCODING_PCM_16BIT)
|
||||
* .setSampleRate(32000)
|
||||
@@ -411,7 +411,7 @@ public class AudioRecord
|
||||
* .build();
|
||||
* </pre>
|
||||
* <p>
|
||||
* If the capture preset is not set with {@link #setCapturePreset(int)},
|
||||
* If the audio source is not set with {@link #setAudioSource(int)},
|
||||
* {@link MediaRecorder.AudioSource#DEFAULT} is used.
|
||||
* <br>If the audio format is not specified or is incomplete, its sample rate will be the
|
||||
* default output sample rate of the device (see
|
||||
@@ -433,18 +433,18 @@ public class AudioRecord
|
||||
}
|
||||
|
||||
/**
|
||||
* @param preset the capture preset (also referred to as the recording source).
|
||||
* See {@link MediaRecorder.AudioSource} for the supported capture preset definitions.
|
||||
* @param source the audio source.
|
||||
* See {@link MediaRecorder.AudioSource} for the supported audio source definitions.
|
||||
* @return the same Builder instance.
|
||||
* @throws IllegalArgumentException
|
||||
*/
|
||||
public Builder setCapturePreset(int preset) throws IllegalArgumentException {
|
||||
if ( (preset < MediaRecorder.AudioSource.DEFAULT) ||
|
||||
(preset > MediaRecorder.getAudioSourceMax()) ) {
|
||||
throw new IllegalArgumentException("Invalid audio source " + preset);
|
||||
public Builder setAudioSource(int source) throws IllegalArgumentException {
|
||||
if ( (source < MediaRecorder.AudioSource.DEFAULT) ||
|
||||
(source > MediaRecorder.getAudioSourceMax()) ) {
|
||||
throw new IllegalArgumentException("Invalid audio source " + source);
|
||||
}
|
||||
mAttributes = new AudioAttributes.Builder()
|
||||
.setInternalCapturePreset(preset)
|
||||
.setInternalCapturePreset(source)
|
||||
.build();
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -185,9 +185,9 @@ public class MediaRecorder
|
||||
/**
|
||||
* Defines the audio source.
|
||||
* An audio source defines both a default physical source of audio signal, and a recording
|
||||
* configuration; it's also known as a capture preset. These constants are for instance used
|
||||
* configuration. These constants are for instance used
|
||||
* in {@link MediaRecorder#setAudioSource(int)} or
|
||||
* {@link AudioRecord.Builder#setCapturePreset(int)}.
|
||||
* {@link AudioRecord.Builder#setAudioSource(int)}.
|
||||
*/
|
||||
public final class AudioSource {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user