Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 91f3ec3c authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Ignore EQ level range if no capability defined by effect implementation" into udc-qpr-dev

parents e5490631 27c1d59d
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -161,6 +161,9 @@ status_t AidlConversionEq::getParameter(EffectParamWriter& param) {
            return param.writeToValue(&bands);
        }
        case EQ_PARAM_LEVEL_RANGE: {
            if (mDesc.capability.range.getTag() != Range::equalizer) {
                return OK;
            }
            const auto& ranges = mDesc.capability.range.get<Range::equalizer>();
            for (const auto& r : ranges) {
                if (r.min.getTag() == Equalizer::bandLevels &&
+8 −6
Original line number Diff line number Diff line
@@ -15,6 +15,7 @@
 */

#include <cstddef>
#include <cstdio>

#define LOG_TAG "BundleContext"
#include <android-base/logging.h>
@@ -441,8 +442,8 @@ RetCode BundleContext::setEqualizerPreset(const std::size_t presetIdx) {
    std::vector<Equalizer::BandLevel> bandLevels;
    bandLevels.reserve(lvm::MAX_NUM_BANDS);
    for (std::size_t i = 0; i < lvm::MAX_NUM_BANDS; i++) {
        bandLevels.emplace_back(
                Equalizer::BandLevel{static_cast<int32_t>(i), lvm::kSoftPresets[presetIdx][i]});
        bandLevels.emplace_back(Equalizer::BandLevel{static_cast<int32_t>(i),
                                                     lvm::kSoftPresets[presetIdx][i] * 100});
    }

    RetCode ret = updateControlParameter(bandLevels);
@@ -472,7 +473,8 @@ std::vector<Equalizer::BandLevel> BundleContext::getEqualizerBandLevels() const
    std::vector<Equalizer::BandLevel> bandLevels;
    bandLevels.reserve(lvm::MAX_NUM_BANDS);
    for (std::size_t i = 0; i < lvm::MAX_NUM_BANDS; i++) {
        bandLevels.emplace_back(Equalizer::BandLevel{static_cast<int32_t>(i), mBandGaindB[i]});
        bandLevels.emplace_back(
                Equalizer::BandLevel{static_cast<int32_t>(i), mBandGaindB[i] * 100});
    }
    return bandLevels;
}
@@ -506,9 +508,9 @@ RetCode BundleContext::updateControlParameter(const std::vector<Equalizer::BandL
    RETURN_VALUE_IF(!isBandLevelIndexInRange(bandLevels), RetCode::ERROR_ILLEGAL_PARAMETER,
                    "indexOutOfRange");

    std::array<int, lvm::MAX_NUM_BANDS> tempLevel;
    std::array<int, lvm::MAX_NUM_BANDS> tempLevel(mBandGaindB);
    for (const auto& it : bandLevels) {
        tempLevel[it.index] = it.levelMb;
        tempLevel[it.index] = it.levelMb > 0 ? (it.levelMb + 50) / 100 : (it.levelMb - 50) / 100;
    }

    LVM_ControlParams_t params;
@@ -527,7 +529,7 @@ RetCode BundleContext::updateControlParameter(const std::vector<Equalizer::BandL
                        RetCode::ERROR_EFFECT_LIB_ERROR, " setControlParamFailed");
    }
    mBandGaindB = tempLevel;
    LOG(INFO) << __func__ << " update bandGain to " << ::android::internal::ToString(mBandGaindB);
    LOG(DEBUG) << __func__ << " update bandGain to " << ::android::internal::ToString(mBandGaindB);

    return RetCode::SUCCESS;
}
+2 −2
Original line number Diff line number Diff line
@@ -73,9 +73,9 @@ const std::vector<Range::EqualizerRange> kEqRanges = {
        MAKE_RANGE(Equalizer, preset, 0, MAX_NUM_PRESETS - 1),
        MAKE_RANGE(Equalizer, bandLevels,
                   std::vector<Equalizer::BandLevel>{
                           Equalizer::BandLevel({.index = 0, .levelMb = -15})},
                           Equalizer::BandLevel({.index = 0, .levelMb = -1500})},
                   std::vector<Equalizer::BandLevel>{
                           Equalizer::BandLevel({.index = MAX_NUM_BANDS - 1, .levelMb = 15})}),
                           Equalizer::BandLevel({.index = MAX_NUM_BANDS - 1, .levelMb = 1500})}),
        /* capability definition */
        MAKE_RANGE(Equalizer, bandFrequencies, kEqBandFrequency, kEqBandFrequency),
        MAKE_RANGE(Equalizer, presets, kEqPresets, kEqPresets),