[FM] Add FM_TUNER audio source to support L version FM radio app
1.MediaRecorder.java: Add FM_TUNER audio source type for FM record.
2.AudioRecord.java: For FM output to the other device,
(except the headset case), record the FM tuner signal to a track
and playback the recorded signal by a track.
3.AudioAttributes.java: Thus we use AudioRecord, need to modify
setCapturePreset to support MediaRecorder.AudioSource.FM_TUNER.
Review: https://partner-android-review.git.corp.google.com/#/c/182071
Signed-off-by: Benson Huang <benson.huang@mediatek.com>
Change-Id: If068d0bbbffb4848887004396a8a8d9bcba1334e
This commit is contained in:
@@ -518,14 +518,15 @@ public final class AudioAttributes implements Parcelable {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @hide
|
* @hide
|
||||||
* Same as {@link #setCapturePreset(int)} but authorizes the use of HOTWORD and
|
* Same as {@link #setCapturePreset(int)} but authorizes the use of HOTWORD,
|
||||||
* REMOTE_SUBMIX.
|
* REMOTE_SUBMIX and FM_TUNER.
|
||||||
* @param preset
|
* @param preset
|
||||||
* @return the same Builder instance.
|
* @return the same Builder instance.
|
||||||
*/
|
*/
|
||||||
public Builder setInternalCapturePreset(int preset) {
|
public Builder setInternalCapturePreset(int preset) {
|
||||||
if ((preset == MediaRecorder.AudioSource.HOTWORD)
|
if ((preset == MediaRecorder.AudioSource.HOTWORD)
|
||||||
|| (preset == MediaRecorder.AudioSource.REMOTE_SUBMIX)) {
|
|| (preset == MediaRecorder.AudioSource.REMOTE_SUBMIX)
|
||||||
|
|| (preset == MediaRecorder.AudioSource.FM_TUNER)) {
|
||||||
mSource = preset;
|
mSource = preset;
|
||||||
} else {
|
} else {
|
||||||
setCapturePreset(preset);
|
setCapturePreset(preset);
|
||||||
|
|||||||
@@ -351,6 +351,7 @@ public class AudioRecord
|
|||||||
// audio source
|
// audio source
|
||||||
if ( (audioSource < MediaRecorder.AudioSource.DEFAULT) ||
|
if ( (audioSource < MediaRecorder.AudioSource.DEFAULT) ||
|
||||||
((audioSource > MediaRecorder.getAudioSourceMax()) &&
|
((audioSource > MediaRecorder.getAudioSourceMax()) &&
|
||||||
|
(audioSource != MediaRecorder.AudioSource.FM_TUNER) &&
|
||||||
(audioSource != MediaRecorder.AudioSource.HOTWORD)) ) {
|
(audioSource != MediaRecorder.AudioSource.HOTWORD)) ) {
|
||||||
throw new IllegalArgumentException("Invalid audio source.");
|
throw new IllegalArgumentException("Invalid audio source.");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -221,6 +221,14 @@ public class MediaRecorder
|
|||||||
*/
|
*/
|
||||||
public static final int REMOTE_SUBMIX = 8;
|
public static final int REMOTE_SUBMIX = 8;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Audio source for FM, which is used to capture current FM tuner output by FMRadio app.
|
||||||
|
* There are two use cases, one is for record FM stream for later listening, another is
|
||||||
|
* for FM indirect mode(the routing except FM to headset(headphone) device routing).
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
public static final int FM_TUNER = 1998;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Audio source for preemptible, low-priority software hotword detection
|
* Audio source for preemptible, low-priority software hotword detection
|
||||||
* It presents the same gain and pre processing tuning as {@link #VOICE_RECOGNITION}.
|
* It presents the same gain and pre processing tuning as {@link #VOICE_RECOGNITION}.
|
||||||
|
|||||||
Reference in New Issue
Block a user