summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMingming Yin <mingming@codeaurora.org>2012-12-28 01:42:23 (GMT)
committerMingming Yin <mingming@codeaurora.org>2013-01-03 23:29:30 (GMT)
commitf3dd373034e8ddd5e80180b5a4d2f05479eabd4c (patch)
treeaab146da731377b7cbc7da6b5baaef3ae876c77e
parent70c1fc84836c18ec3956a5da5c9ef2b20de3142b (diff)
audio: add support for FM feature
-Add set_fm_volume() to set handle fm volume Change-Id: I2a2c6a60b9855d9360ff8fb90849517e77e5faab
-rw-r--r--audio/AudioPolicyCompatClient.cpp7
-rw-r--r--audio/AudioPolicyCompatClient.h2
-rw-r--r--audio/AudioPolicyManagerBase.cpp9
-rw-r--r--include/hardware_legacy/AudioHardwareInterface.h4
-rw-r--r--include/hardware_legacy/AudioPolicyInterface.h4
-rw-r--r--include/hardware_legacy/AudioSystemLegacy.h47
6 files changed, 57 insertions, 16 deletions
diff --git a/audio/AudioPolicyCompatClient.cpp b/audio/AudioPolicyCompatClient.cpp
index 4c80428..ec3f3a1 100644
--- a/audio/AudioPolicyCompatClient.cpp
+++ b/audio/AudioPolicyCompatClient.cpp
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2011 The Android Open Source Project
+ * Copyright (c) 2013, The Linux Foundation. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -127,6 +128,12 @@ status_t AudioPolicyCompatClient::setStreamVolume(
volume, output, delayMs);
}
+status_t AudioPolicyCompatClient::setFmVolume(float volume,
+ int delayMs)
+{
+ return mServiceOps->set_fm_volume(mService, volume, delayMs);
+}
+
status_t AudioPolicyCompatClient::startTone(ToneGenerator::tone_type tone,
AudioSystem::stream_type stream)
{
diff --git a/audio/AudioPolicyCompatClient.h b/audio/AudioPolicyCompatClient.h
index 5399c8c..22a91a2 100644
--- a/audio/AudioPolicyCompatClient.h
+++ b/audio/AudioPolicyCompatClient.h
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2011 The Android Open Source Project
+ * Copyright (c) 2013, The Linux Foundation. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -68,6 +69,7 @@ public:
float volume,
audio_io_handle_t output,
int delayMs = 0);
+ virtual status_t setFmVolume(float volume, int delayMs = 0);
virtual status_t startTone(ToneGenerator::tone_type tone, AudioSystem::stream_type stream);
virtual status_t stopTone();
virtual status_t setVoiceVolume(float volume, int delayMs = 0);
diff --git a/audio/AudioPolicyManagerBase.cpp b/audio/AudioPolicyManagerBase.cpp
index 11f629b..f0044d2 100644
--- a/audio/AudioPolicyManagerBase.cpp
+++ b/audio/AudioPolicyManagerBase.cpp
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2009 The Android Open Source Project
+ * Copyright (c) 2013, The Linux Foundation. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -2051,6 +2052,7 @@ AudioPolicyManagerBase::routing_strategy AudioPolicyManagerBase::getStrategy(
// while key clicks are played produces a poor result
case AudioSystem::TTS:
case AudioSystem::MUSIC:
+ case AudioSystem::FM:
return STRATEGY_MEDIA;
case AudioSystem::ENFORCED_AUDIBLE:
return STRATEGY_ENFORCED_AUDIBLE;
@@ -2530,6 +2532,7 @@ AudioPolicyManagerBase::device_category AudioPolicyManagerBase::getDeviceCategor
case AUDIO_DEVICE_OUT_BLUETOOTH_SCO_HEADSET:
case AUDIO_DEVICE_OUT_BLUETOOTH_A2DP:
case AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_HEADPHONES:
+ case AUDIO_DEVICE_OUT_FM:
return DEVICE_CATEGORY_HEADSET;
case AUDIO_DEVICE_OUT_SPEAKER:
case AUDIO_DEVICE_OUT_BLUETOOTH_SCO_CARKIT:
@@ -2686,6 +2689,12 @@ const AudioPolicyManagerBase::VolumeCurvePoint
sSpeakerMediaVolumeCurve, // DEVICE_CATEGORY_SPEAKER
sDefaultMediaVolumeCurve // DEVICE_CATEGORY_EARPIECE
},
+ { // AUDIO_STREAM_FM
+ sDefaultMediaVolumeCurve, // DEVICE_CATEGORY_HEADSET
+ sSpeakerMediaVolumeCurve, // DEVICE_CATEGORY_SPEAKER
+ sDefaultMediaVolumeCurve // DEVICE_CATEGORY_EARPIECE
+ },
+
};
void AudioPolicyManagerBase::initializeVolumeCurves()
diff --git a/include/hardware_legacy/AudioHardwareInterface.h b/include/hardware_legacy/AudioHardwareInterface.h
index 5a2d314..14847e2 100644
--- a/include/hardware_legacy/AudioHardwareInterface.h
+++ b/include/hardware_legacy/AudioHardwareInterface.h
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2007 The Android Open Source Project
+ * Copyright (c) 2011-2013, The Linux Foundation. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -219,6 +220,9 @@ public:
/** set the audio volume of a voice call. Range is between 0.0 and 1.0 */
virtual status_t setVoiceVolume(float volume) = 0;
+ /** set the fm volume. Range is between 0.0 and 1.0 */
+ virtual status_t setFmVolume(float volume) { return 0; }
+
/**
* set the audio volume for all audio activities other than voice call.
* Range between 0.0 and 1.0. If any value other than NO_ERROR is returned,
diff --git a/include/hardware_legacy/AudioPolicyInterface.h b/include/hardware_legacy/AudioPolicyInterface.h
index 51f4822..01f0d67 100644
--- a/include/hardware_legacy/AudioPolicyInterface.h
+++ b/include/hardware_legacy/AudioPolicyInterface.h
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2009 The Android Open Source Project
+ * Copyright (c) 2011-2013, The Linux Foundation. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -245,6 +246,9 @@ public:
audio_io_handle_t srcOutput,
audio_io_handle_t dstOutput) = 0;
+ // set FM volume.
+ virtual status_t setFmVolume(float volume, int delayMs = 0) { return 0; }
+
};
extern "C" AudioPolicyInterface* createAudioPolicyManager(AudioPolicyClientInterface *clientInterface);
diff --git a/include/hardware_legacy/AudioSystemLegacy.h b/include/hardware_legacy/AudioSystemLegacy.h
index 46d5cc9..181e1b1 100644
--- a/include/hardware_legacy/AudioSystemLegacy.h
+++ b/include/hardware_legacy/AudioSystemLegacy.h
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2008 The Android Open Source Project
+ * Copyright (c) 2011-2013, The Linux Foundation. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -61,7 +62,10 @@ enum audio_source {
AUDIO_SOURCE_CAMCORDER = 5,
AUDIO_SOURCE_VOICE_RECOGNITION = 6,
AUDIO_SOURCE_VOICE_COMMUNICATION = 7,
- AUDIO_SOURCE_MAX = AUDIO_SOURCE_VOICE_COMMUNICATION,
+ AUDIO_SOURCE_REMOTE_SUBMIX = 8,
+ AUDIO_SOURCE_FM_RX = 9,
+ AUDIO_SOURCE_FM_RX_A2DP = 10,
+ AUDIO_SOURCE_MAX = AUDIO_SOURCE_FM_RX_A2DP,
AUDIO_SOURCE_LIST_END // must be last - used to validate audio source type
};
@@ -81,6 +85,7 @@ public:
ENFORCED_AUDIBLE = 7, // Sounds that cannot be muted by user and must be routed to speaker
DTMF = 8,
TTS = 9,
+ FM = 10,
NUM_STREAM_TYPES
};
@@ -243,38 +248,48 @@ public:
DEVICE_OUT_AUX_DIGITAL = 0x400,
DEVICE_OUT_ANLG_DOCK_HEADSET = 0x800,
DEVICE_OUT_DGTL_DOCK_HEADSET = 0x1000,
- DEVICE_OUT_ANC_HEADSET = 0x2000,
- DEVICE_OUT_ANC_HEADPHONE = 0x4000,
- DEVICE_OUT_PROXY = 0x8000,
+ DEVICE_OUT_USB_ACCESSORY = 0x2000,
+ DEVICE_OUT_USB_DEVICE = 0x4000,
+ DEVICE_OUT_FM = 0x8000,
+ DEVICE_OUT_FM_TX = 0x10000,
+ DEVICE_OUT_ANC_HEADSET = 0x20000,
+ DEVICE_OUT_ANC_HEADPHONE = 0x40000,
+ DEVICE_OUT_PROXY = 0x80000,
DEVICE_OUT_DEFAULT = DEVICE_OUT_SPEAKER,
DEVICE_OUT_ALL = (DEVICE_OUT_EARPIECE | DEVICE_OUT_SPEAKER | DEVICE_OUT_WIRED_HEADSET |
DEVICE_OUT_WIRED_HEADPHONE | DEVICE_OUT_BLUETOOTH_SCO | DEVICE_OUT_BLUETOOTH_SCO_HEADSET |
DEVICE_OUT_BLUETOOTH_SCO_CARKIT | DEVICE_OUT_BLUETOOTH_A2DP | DEVICE_OUT_BLUETOOTH_A2DP_HEADPHONES |
DEVICE_OUT_BLUETOOTH_A2DP_SPEAKER | DEVICE_OUT_AUX_DIGITAL |
DEVICE_OUT_ANLG_DOCK_HEADSET | DEVICE_OUT_DGTL_DOCK_HEADSET |
+ DEVICE_OUT_USB_ACCESSORY | DEVICE_OUT_USB_DEVICE |
DEVICE_OUT_ANC_HEADSET | DEVICE_OUT_ANC_HEADPHONE |
+ DEVICE_OUT_FM | DEVICE_OUT_FM_TX |
DEVICE_OUT_PROXY | DEVICE_OUT_DEFAULT),
DEVICE_OUT_ALL_A2DP = (DEVICE_OUT_BLUETOOTH_A2DP | DEVICE_OUT_BLUETOOTH_A2DP_HEADPHONES |
DEVICE_OUT_BLUETOOTH_A2DP_SPEAKER),
+ DEVICE_OUT_ALL_USB = (DEVICE_OUT_USB_ACCESSORY | DEVICE_OUT_USB_DEVICE),
// input devices
- DEVICE_IN_COMMUNICATION = 0x10000,
- DEVICE_IN_AMBIENT = 0x20000,
- DEVICE_IN_BUILTIN_MIC = 0x40000,
- DEVICE_IN_BLUETOOTH_SCO_HEADSET = 0x80000,
- DEVICE_IN_WIRED_HEADSET = 0x100000,
- DEVICE_IN_AUX_DIGITAL = 0x200000,
- DEVICE_IN_VOICE_CALL = 0x400000,
- DEVICE_IN_BACK_MIC = 0x800000,
+ DEVICE_IN_COMMUNICATION = 0x100000,
+ DEVICE_IN_AMBIENT = 0x200000,
+ DEVICE_IN_BUILTIN_MIC = 0x400000,
+ DEVICE_IN_BLUETOOTH_SCO_HEADSET = 0x800000,
+ DEVICE_IN_WIRED_HEADSET = 0x1000000,
+ DEVICE_IN_AUX_DIGITAL = 0x2000000,
+ DEVICE_IN_VOICE_CALL = 0x4000000,
+ DEVICE_IN_BACK_MIC = 0x8000000,
DEVICE_IN_ANC_HEADSET = 0x10000000,
- DEVICE_IN_PROXY = 0x20000000,
- DEVICE_IN_ANLG_DOCK_HEADSET = 0x40000000,
- DEVICE_IN_DEFAULT = 0x80000000,
+ DEVICE_IN_FM_RX = 0x20000000,
+ DEVICE_IN_FM_RX_A2DP = 0x40000000,
+ DEVICE_IN_DEFAULT = DEVICE_IN_BUILTIN_MIC,
+ DEVICE_IN_ANLG_DOCK_HEADSET = 0x80000000,
+ DEVICE_IN_PROXY = DEVICE_IN_ANLG_DOCK_HEADSET,
DEVICE_IN_ALL = (DEVICE_IN_COMMUNICATION | DEVICE_IN_AMBIENT | DEVICE_IN_BUILTIN_MIC |
DEVICE_IN_BLUETOOTH_SCO_HEADSET | DEVICE_IN_WIRED_HEADSET | DEVICE_IN_AUX_DIGITAL |
DEVICE_IN_VOICE_CALL | DEVICE_IN_BACK_MIC | DEVICE_IN_ANC_HEADSET |
- DEVICE_IN_PROXY | DEVICE_IN_ANLG_DOCK_HEADSET | DEVICE_IN_DEFAULT)
+ DEVICE_IN_FM_RX | DEVICE_IN_FM_RX_A2DP | DEVICE_IN_DEFAULT |
+ DEVICE_IN_ANLG_DOCK_HEADSET | DEVICE_IN_PROXY)
};
// request to open a direct output with getOutput() (by opposition to sharing an output with other AudioTracks)