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

Commit 84c1787b authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge changes from topic "volume_effect_param" into main

* changes:
  Preserve previous control parameters with common AIDL parameter setting
  EffectBundle: update lvm control parameters with AIDL parameters
parents 46aff260 64265c82
Loading
Loading
Loading
Loading
+25 −1
Original line number Diff line number Diff line
@@ -90,6 +90,23 @@ void BundleContext::deInit() {
    }
}

RetCode BundleContext::setCommon(const Parameter::Common& common) {
    RetCode ret = EffectContext::setCommon(common);
    RETURN_VALUE_IF(ret != RetCode::SUCCESS, ret, " setCommonFailed");
    if (mInstance) {
        LVM_ControlParams_t params;
        RETURN_VALUE_IF(LVM_SUCCESS != LVM_GetControlParameters(mInstance, &params),
                        RetCode::ERROR_EFFECT_LIB_ERROR, "failGetControlParams");
        RETURN_VALUE_IF(RetCode::SUCCESS != applyCommonParameter(params),
                        RetCode::ERROR_EFFECT_LIB_ERROR, " applyCommonParameterFailed");
        RETURN_VALUE_IF(LVM_SUCCESS != LVM_SetControlParameters(mInstance, &params),
                        RetCode::ERROR_EFFECT_LIB_ERROR, "failSetControlParams");
    } else {
        RETURN_VALUE_IF(RetCode::SUCCESS != init(), RetCode::ERROR_EFFECT_LIB_ERROR, " initFailed");
    }
    return RetCode::SUCCESS;
}

RetCode BundleContext::enable() {
    if (mEnabled) return RetCode::ERROR_ILLEGAL_PARAMETER;
    // Bass boost or Virtualizer can be temporarily disabled if playing over device speaker due to
@@ -599,7 +616,7 @@ RetCode BundleContext::setForcedDevice(
    return ret;
}

RetCode BundleContext::initControlParameter(LVM_ControlParams_t& params) const {
RetCode BundleContext::applyCommonParameter(LVM_ControlParams_t& params) const {
    int outputChannelCount = ::aidl::android::hardware::audio::common::getChannelCount(
            mCommon.output.base.channelMask);
    auto outputChannelMaskConv = aidl2legacy_AudioChannelLayout_audio_channel_mask_t(
@@ -621,6 +638,13 @@ RetCode BundleContext::initControlParameter(LVM_ControlParams_t& params) const {
        params.SourceFormat = LVM_MULTICHANNEL;
    }

    return RetCode::SUCCESS;
}

RetCode BundleContext::initControlParameter(LVM_ControlParams_t& params) const {
    RETURN_VALUE_IF(RetCode::SUCCESS != applyCommonParameter(params),
                    RetCode::ERROR_EFFECT_LIB_ERROR, " applyCommonParameterFailed");

    /* General parameters */
    params.OperatingMode = LVM_MODE_ON;
    params.SpeakerType = LVM_HEADPHONES;
+3 −0
Original line number Diff line number Diff line
@@ -35,6 +35,8 @@ class BundleContext final : public EffectContext {
    void deInit();
    lvm::BundleEffectType getBundleType() const { return mType; }

    RetCode setCommon(const Parameter::Common& common) override;

    RetCode enable() override;
    RetCode enableOperatingMode();
    RetCode disable() override;
@@ -133,6 +135,7 @@ class BundleContext final : public EffectContext {
    bool isBandLevelIndexInRange(const std::vector<Equalizer::BandLevel>& bandLevels) const;
    static LVM_EQNB_BandDef_t* getDefaultEqualizerBandDefs();
    static LVM_HeadroomBandDef_t* getDefaultEqualizerHeadroomBanDefs();
    RetCode applyCommonParameter(LVM_ControlParams_t& params) const;
};

}  // namespace aidl::android::hardware::audio::effect