Loading media/libaudioclient/aidl/android/media/ISoundDose.aidl +5 −0 Original line number Diff line number Diff line Loading @@ -62,6 +62,11 @@ interface ISoundDose { float getOutputRs2UpperBound(); /** Get the current CSD from audioserver. */ float getCsd(); /** * Returns true if the HAL supports the ISoundDose interface. Can be either * as part of IModule or standalon sound dose HAL. */ boolean isSoundDoseHalSupported(); /** Enables/Disables MEL computations from framework. */ oneway void forceUseFrameworkMel(boolean useFrameworkMel); /** Enables/Disables the computation of CSD on all devices. */ Loading services/audioflinger/sounddose/SoundDoseManager.cpp +23 −0 Original line number Diff line number Diff line Loading @@ -334,6 +334,16 @@ binder::Status SoundDoseManager::SoundDose::forceComputeCsdOnAllDevices( return binder::Status::ok(); } binder::Status SoundDoseManager::SoundDose::isSoundDoseHalSupported(bool* value) { ALOGV("%s", __func__); *value = false; auto soundDoseManager = mSoundDoseManager.promote(); if (soundDoseManager != nullptr) { *value = soundDoseManager->isSoundDoseHalSupported(); } return binder::Status::ok(); } void SoundDoseManager::updateAttenuation(float attenuationDB, audio_devices_t deviceType) { std::lock_guard _l(mLock); ALOGV("%s: updating MEL processor attenuation for device type %d to %f", Loading Loading @@ -397,6 +407,19 @@ bool SoundDoseManager::forceComputeCsdOnAllDevices() const { return mComputeCsdOnAllDevices; } bool SoundDoseManager::isSoundDoseHalSupported() const { if (mDisableCsd) { return false; } std::shared_ptr<ISoundDose> halSoundDose; getHalSoundDose(&halSoundDose); if (mHalSoundDose == nullptr) { return false; } return true; } void SoundDoseManager::getHalSoundDose(std::shared_ptr<ISoundDose>* halSoundDose) const { std::lock_guard _l(mLock); *halSoundDose = mHalSoundDose; Loading services/audioflinger/sounddose/SoundDoseManager.h +2 −0 Original line number Diff line number Diff line Loading @@ -142,6 +142,7 @@ private: binder::Status getCsd(float* value) override; binder::Status forceUseFrameworkMel(bool useFrameworkMel) override; binder::Status forceComputeCsdOnAllDevices(bool computeCsdOnAllDevices) override; binder::Status isSoundDoseHalSupported(bool* value) override; wp<SoundDoseManager> mSoundDoseManager; const sp<media::ISoundDoseCallback> mSoundDoseCallback; Loading Loading @@ -172,6 +173,7 @@ private: void disableCsd(); void setUseFrameworkMel(bool useFrameworkMel); void setComputeCsdOnAllDevices(bool computeCsdOnAllDevices); bool isSoundDoseHalSupported() const; /** Returns the HAL sound dose interface or null if internal MEL computation is used. */ void getHalSoundDose(std::shared_ptr<ISoundDose>* halSoundDose) const; Loading Loading
media/libaudioclient/aidl/android/media/ISoundDose.aidl +5 −0 Original line number Diff line number Diff line Loading @@ -62,6 +62,11 @@ interface ISoundDose { float getOutputRs2UpperBound(); /** Get the current CSD from audioserver. */ float getCsd(); /** * Returns true if the HAL supports the ISoundDose interface. Can be either * as part of IModule or standalon sound dose HAL. */ boolean isSoundDoseHalSupported(); /** Enables/Disables MEL computations from framework. */ oneway void forceUseFrameworkMel(boolean useFrameworkMel); /** Enables/Disables the computation of CSD on all devices. */ Loading
services/audioflinger/sounddose/SoundDoseManager.cpp +23 −0 Original line number Diff line number Diff line Loading @@ -334,6 +334,16 @@ binder::Status SoundDoseManager::SoundDose::forceComputeCsdOnAllDevices( return binder::Status::ok(); } binder::Status SoundDoseManager::SoundDose::isSoundDoseHalSupported(bool* value) { ALOGV("%s", __func__); *value = false; auto soundDoseManager = mSoundDoseManager.promote(); if (soundDoseManager != nullptr) { *value = soundDoseManager->isSoundDoseHalSupported(); } return binder::Status::ok(); } void SoundDoseManager::updateAttenuation(float attenuationDB, audio_devices_t deviceType) { std::lock_guard _l(mLock); ALOGV("%s: updating MEL processor attenuation for device type %d to %f", Loading Loading @@ -397,6 +407,19 @@ bool SoundDoseManager::forceComputeCsdOnAllDevices() const { return mComputeCsdOnAllDevices; } bool SoundDoseManager::isSoundDoseHalSupported() const { if (mDisableCsd) { return false; } std::shared_ptr<ISoundDose> halSoundDose; getHalSoundDose(&halSoundDose); if (mHalSoundDose == nullptr) { return false; } return true; } void SoundDoseManager::getHalSoundDose(std::shared_ptr<ISoundDose>* halSoundDose) const { std::lock_guard _l(mLock); *halSoundDose = mHalSoundDose; Loading
services/audioflinger/sounddose/SoundDoseManager.h +2 −0 Original line number Diff line number Diff line Loading @@ -142,6 +142,7 @@ private: binder::Status getCsd(float* value) override; binder::Status forceUseFrameworkMel(bool useFrameworkMel) override; binder::Status forceComputeCsdOnAllDevices(bool computeCsdOnAllDevices) override; binder::Status isSoundDoseHalSupported(bool* value) override; wp<SoundDoseManager> mSoundDoseManager; const sp<media::ISoundDoseCallback> mSoundDoseCallback; Loading Loading @@ -172,6 +173,7 @@ private: void disableCsd(); void setUseFrameworkMel(bool useFrameworkMel); void setComputeCsdOnAllDevices(bool computeCsdOnAllDevices); bool isSoundDoseHalSupported() const; /** Returns the HAL sound dose interface or null if internal MEL computation is used. */ void getHalSoundDose(std::shared_ptr<ISoundDose>* halSoundDose) const; Loading