Fix volume value and DPE range
- return 1.0 to the framework, since the effects take over volume
control
- fix the range of DPE, go/dpe-oob
- fix typo
Bug: 303565339
Test: manually test
Change-Id: If18d6115a6223f9f76e205f8128089d9af9d5a1d
Merged-In: If18d6115a6223f9f76e205f8128089d9af9d5a1d
diff --git a/media/libeffects/dynamicsproc/aidl/DynamicsProcessingContext.cpp b/media/libeffects/dynamicsproc/aidl/DynamicsProcessingContext.cpp
index 57c873b..e5e5368 100644
--- a/media/libeffects/dynamicsproc/aidl/DynamicsProcessingContext.cpp
+++ b/media/libeffects/dynamicsproc/aidl/DynamicsProcessingContext.cpp
@@ -19,6 +19,7 @@
#include "DynamicsProcessingContext.h"
#include "DynamicsProcessing.h"
+#include <audio_utils/power.h>
#include <sys/param.h>
#include <functional>
#include <unordered_set>
@@ -68,6 +69,23 @@
return RetCode::SUCCESS;
}
+RetCode DynamicsProcessingContext::setVolumeStereo(const Parameter::VolumeStereo& volumeStereo) {
+ std::lock_guard lg(mMutex);
+ dp_fx::DPChannel* leftChannel = mDpFreq->getChannel(0);
+ dp_fx::DPChannel* rightChannel = mDpFreq->getChannel(1);
+ if (leftChannel != nullptr) {
+ leftChannel->setOutputGain(audio_utils_power_from_amplitude(volumeStereo.left));
+ }
+ if (rightChannel != nullptr) {
+ rightChannel->setOutputGain(audio_utils_power_from_amplitude(volumeStereo.right));
+ }
+ return RetCode::SUCCESS;
+}
+
+Parameter::VolumeStereo DynamicsProcessingContext::getVolumeStereo() {
+ return {1.0f, 1.0f};
+}
+
void DynamicsProcessingContext::dpSetFreqDomainVariant_l(
const DynamicsProcessing::EngineArchitecture& engine) {
mDpFreq.reset(new dp_fx::DPFrequency());
@@ -273,7 +291,7 @@
return ret;
}
-IEffect::Status DynamicsProcessingContext::lvmProcess(float* in, float* out, int samples) {
+IEffect::Status DynamicsProcessingContext::dpeProcess(float* in, float* out, int samples) {
LOG(DEBUG) << __func__ << " in " << in << " out " << out << " sample " << samples;
IEffect::Status status = {EX_NULL_POINTER, 0, 0};
@@ -460,6 +478,11 @@
RetCode ret = RetCode::SUCCESS;
std::unordered_set<int> channelSet;
+ if (!stageInUse) {
+ LOG(WARNING) << __func__ << " not in use " << ::android::internal::ToString(channels);
+ return RetCode::SUCCESS;
+ }
+
RETURN_VALUE_IF(!stageInUse, RetCode::ERROR_ILLEGAL_PARAMETER, "stageNotInUse");
for (auto& it : channels) {
if (0 != channelSet.count(it.channel)) {