From e7b58b249036231b667665fcd6c86ed6f73b16dc Mon Sep 17 00:00:00 2001 From: Mingming Yin Date: Thu, 27 Dec 2012 17:42:23 -0800 Subject: qcom-fm: audio: add support for FM feature -Add set_fm_volume() to set handle fm volume Change-Id: I2a2c6a60b9855d9360ff8fb90849517e77e5faab Conflicts: audio/AudioPolicyManagerBase.cpp include/hardware_legacy/AudioSystemLegacy.h --- audio/AudioPolicyCompatClient.cpp | 9 +++++++++ audio/AudioPolicyCompatClient.h | 4 ++++ audio/AudioPolicyManagerBase.cpp | 12 ++++++++++++ include/hardware_legacy/AudioHardwareInterface.h | 6 ++++++ include/hardware_legacy/AudioPolicyInterface.h | 6 ++++++ include/hardware_legacy/AudioSystemLegacy.h | 3 +++ 6 files changed, 40 insertions(+) diff --git a/audio/AudioPolicyCompatClient.cpp b/audio/AudioPolicyCompatClient.cpp index 4c80428..bb0059c 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,14 @@ status_t AudioPolicyCompatClient::setStreamVolume( volume, output, delayMs); } +#ifdef QCOM_FM_ENABLED +status_t AudioPolicyCompatClient::setFmVolume(float volume, + int delayMs) +{ + return mServiceOps->set_fm_volume(mService, volume, delayMs); +} +#endif + status_t AudioPolicyCompatClient::startTone(ToneGenerator::tone_type tone, AudioSystem::stream_type stream) { diff --git a/audio/AudioPolicyCompatClient.h b/audio/AudioPolicyCompatClient.h index 5399c8c..d468126 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,9 @@ public: float volume, audio_io_handle_t output, int delayMs = 0); +#ifdef QCOM_FM_ENABLED + virtual status_t setFmVolume(float volume, int delayMs = 0); +#endif 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 4ea127e..673a5ee 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. @@ -2084,6 +2085,9 @@ AudioPolicyManagerBase::routing_strategy AudioPolicyManagerBase::getStrategy( // while key clicks are played produces a poor result case AudioSystem::TTS: case AudioSystem::MUSIC: +#ifdef QCOM_FM_ENABLED + case AudioSystem::FM: +#endif return STRATEGY_MEDIA; case AudioSystem::ENFORCED_AUDIBLE: return STRATEGY_ENFORCED_AUDIBLE; @@ -2722,6 +2726,14 @@ const AudioPolicyManagerBase::VolumeCurvePoint sSpeakerMediaVolumeCurve, // DEVICE_CATEGORY_SPEAKER sDefaultMediaVolumeCurve // DEVICE_CATEGORY_EARPIECE }, +#ifdef QCOM_FM_ENABLED + { // AUDIO_STREAM_FM + sDefaultMediaVolumeCurve, // DEVICE_CATEGORY_HEADSET + sSpeakerMediaVolumeCurve, // DEVICE_CATEGORY_SPEAKER + sDefaultMediaVolumeCurve // DEVICE_CATEGORY_EARPIECE + }, +#endif + }; void AudioPolicyManagerBase::initializeVolumeCurves() diff --git a/include/hardware_legacy/AudioHardwareInterface.h b/include/hardware_legacy/AudioHardwareInterface.h index 82fc633..a456baf 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. @@ -223,6 +224,11 @@ public: /** set the audio volume of a voice call. Range is between 0.0 and 1.0 */ virtual status_t setVoiceVolume(float volume) = 0; +#ifdef QCOM_FM_ENABLED + /** set the fm volume. Range is between 0.0 and 1.0 */ + virtual status_t setFmVolume(float volume) { return 0; } +#endif + /** * 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..b0f4c39 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,11 @@ public: audio_io_handle_t srcOutput, audio_io_handle_t dstOutput) = 0; +#ifdef QCOM_FM_ENABLED + // set FM volume. + virtual status_t setFmVolume(float volume, int delayMs = 0) { return 0; } +#endif + }; extern "C" AudioPolicyInterface* createAudioPolicyManager(AudioPolicyClientInterface *clientInterface); diff --git a/include/hardware_legacy/AudioSystemLegacy.h b/include/hardware_legacy/AudioSystemLegacy.h index 971a633..762b6be 100644 --- a/include/hardware_legacy/AudioSystemLegacy.h +++ b/include/hardware_legacy/AudioSystemLegacy.h @@ -87,6 +87,9 @@ public: ENFORCED_AUDIBLE = 7, // Sounds that cannot be muted by user and must be routed to speaker DTMF = 8, TTS = 9, +#ifdef QCOM_FM_ENABLED + FM = 10, +#endif NUM_STREAM_TYPES }; -- cgit v1.1