[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:
Benson Huang
2014-09-17 17:21:02 +08:00
committed by Leo Wang
parent 937d6a6476
commit ce4483cb83
3 changed files with 13 additions and 3 deletions

View File

@@ -518,14 +518,15 @@ public final class AudioAttributes implements Parcelable {
/**
* @hide
* Same as {@link #setCapturePreset(int)} but authorizes the use of HOTWORD and
* REMOTE_SUBMIX.
* Same as {@link #setCapturePreset(int)} but authorizes the use of HOTWORD,
* REMOTE_SUBMIX and FM_TUNER.
* @param preset
* @return the same Builder instance.
*/
public Builder setInternalCapturePreset(int preset) {
if ((preset == MediaRecorder.AudioSource.HOTWORD)
|| (preset == MediaRecorder.AudioSource.REMOTE_SUBMIX)) {
|| (preset == MediaRecorder.AudioSource.REMOTE_SUBMIX)
|| (preset == MediaRecorder.AudioSource.FM_TUNER)) {
mSource = preset;
} else {
setCapturePreset(preset);

View File

@@ -351,6 +351,7 @@ public class AudioRecord
// audio source
if ( (audioSource < MediaRecorder.AudioSource.DEFAULT) ||
((audioSource > MediaRecorder.getAudioSourceMax()) &&
(audioSource != MediaRecorder.AudioSource.FM_TUNER) &&
(audioSource != MediaRecorder.AudioSource.HOTWORD)) ) {
throw new IllegalArgumentException("Invalid audio source.");
}

View File

@@ -221,6 +221,14 @@ public class MediaRecorder
*/
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
* It presents the same gain and pre processing tuning as {@link #VOICE_RECOGNITION}.