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/DynamicsProcessing.cpp b/media/libeffects/dynamicsproc/aidl/DynamicsProcessing.cpp
index 63cb48d..85ea53a 100644
--- a/media/libeffects/dynamicsproc/aidl/DynamicsProcessing.cpp
+++ b/media/libeffects/dynamicsproc/aidl/DynamicsProcessing.cpp
@@ -105,14 +105,14 @@
DynamicsProcessing::EqBandConfig({.channel = 0,
.band = 0,
.enable = false,
- .cutoffFrequencyHz = 20,
+ .cutoffFrequencyHz = 0,
.gainDb = -200});
static const DynamicsProcessing::EqBandConfig kEqBandConfigMax =
DynamicsProcessing::EqBandConfig({.channel = std::numeric_limits<int>::max(),
.band = std::numeric_limits<int>::max(),
.enable = true,
- .cutoffFrequencyHz = 20000.1,
+ .cutoffFrequencyHz = 192000,
.gainDb = 200});
static const Range::DynamicsProcessingRange kPreEqBandConfigRange = {
@@ -129,7 +129,7 @@
{.channel = 0,
.band = 0,
.enable = false,
- .cutoffFrequencyHz = 20,
+ .cutoffFrequencyHz = 0,
.attackTimeMs = 0,
.releaseTimeMs = 0,
.ratio = 1,
@@ -144,7 +144,7 @@
{.channel = std::numeric_limits<int>::max(),
.band = std::numeric_limits<int>::max(),
.enable = true,
- .cutoffFrequencyHz = 20000.1,
+ .cutoffFrequencyHz = 192000,
.attackTimeMs = 60000,
.releaseTimeMs = 60000,
.ratio = 50,
@@ -443,7 +443,7 @@
IEffect::Status DynamicsProcessingImpl::effectProcessImpl(float* in, float* out, int samples) {
IEffect::Status status = {EX_NULL_POINTER, 0, 0};
RETURN_VALUE_IF(!mContext, status, "nullContext");
- return mContext->lvmProcess(in, out, samples);
+ return mContext->dpeProcess(in, out, samples);
}
} // namespace aidl::android::hardware::audio::effect
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)) {
diff --git a/media/libeffects/dynamicsproc/aidl/DynamicsProcessingContext.h b/media/libeffects/dynamicsproc/aidl/DynamicsProcessingContext.h
index b8539f6..ced7f19 100644
--- a/media/libeffects/dynamicsproc/aidl/DynamicsProcessingContext.h
+++ b/media/libeffects/dynamicsproc/aidl/DynamicsProcessingContext.h
@@ -45,6 +45,8 @@
// override EffectContext::setCommon to update mChannelCount
RetCode setCommon(const Parameter::Common& common) override;
+ RetCode setVolumeStereo(const Parameter::VolumeStereo& volumeStereo) override;
+ Parameter::VolumeStereo getVolumeStereo() override;
RetCode setEngineArchitecture(const DynamicsProcessing::EngineArchitecture& engineArchitecture);
RetCode setPreEq(const std::vector<DynamicsProcessing::ChannelConfig>& eqChannels);
@@ -66,7 +68,7 @@
std::vector<DynamicsProcessing::LimiterConfig> getLimiter();
std::vector<DynamicsProcessing::InputGain> getInputGain();
- IEffect::Status lvmProcess(float* in, float* out, int samples);
+ IEffect::Status dpeProcess(float* in, float* out, int samples);
private:
static constexpr float kPreferredProcessingDurationMs = 10.0f;
diff --git a/media/libeffects/lvm/wrapper/Aidl/BundleContext.h b/media/libeffects/lvm/wrapper/Aidl/BundleContext.h
index 62bb6e4..3f31b8b 100644
--- a/media/libeffects/lvm/wrapper/Aidl/BundleContext.h
+++ b/media/libeffects/lvm/wrapper/Aidl/BundleContext.h
@@ -98,7 +98,7 @@
const Virtualizer::SpeakerAnglesPayload payload);
RetCode setVolumeStereo(const Parameter::VolumeStereo& volumeStereo) override;
- Parameter::VolumeStereo getVolumeStereo() override { return mVolumeStereo; }
+ Parameter::VolumeStereo getVolumeStereo() override { return {1.0f, 1.0f}; }
IEffect::Status lvmProcess(float* in, float* out, int samples);