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

Commit 9dea4710 authored by Shunkai Yao's avatar Shunkai Yao Committed by Automerger Merge Worker
Browse files

Merge "Audio Effects : Use base implementation of commandImpl method" into main am: ee898b7d

parents f2b9493d ee898b7d
Loading
Loading
Loading
Loading
+0 −5
Original line number Diff line number Diff line
@@ -100,11 +100,6 @@ RetCode DownmixContext::disable() {
    return RetCode::SUCCESS;
}

void DownmixContext::reset() {
    disable();
    resetBuffer();
}

IEffect::Status DownmixContext::downmixProcess(float* in, float* out, int samples) {
    IEffect::Status status = {EX_ILLEGAL_ARGUMENT, 0, 0};

+2 −3
Original line number Diff line number Diff line
@@ -32,9 +32,8 @@ class DownmixContext final : public EffectContext {
  public:
    DownmixContext(int statusDepth, const Parameter::Common& common);
    ~DownmixContext();
    RetCode enable();
    RetCode disable();
    void reset();
    RetCode enable() override;
    RetCode disable() override;

    RetCode setDmType(Downmix::Type type) {
        mType = type;
+0 −20
Original line number Diff line number Diff line
@@ -71,26 +71,6 @@ ndk::ScopedAStatus DownmixImpl::getDescriptor(Descriptor* _aidl_return) {
    return ndk::ScopedAStatus::ok();
}

ndk::ScopedAStatus DownmixImpl::commandImpl(CommandId command) {
    RETURN_IF(!mContext, EX_NULL_POINTER, "nullContext");
    switch (command) {
        case CommandId::START:
            mContext->enable();
            break;
        case CommandId::STOP:
            mContext->disable();
            break;
        case CommandId::RESET:
            mContext->reset();
            break;
        default:
            LOG(ERROR) << __func__ << " commandId " << toString(command) << " not supported";
            return ndk::ScopedAStatus::fromExceptionCodeWithMessage(EX_ILLEGAL_ARGUMENT,
                                                                    "commandIdNotSupported");
    }
    return ndk::ScopedAStatus::ok();
}

ndk::ScopedAStatus DownmixImpl::setParameterSpecific(const Parameter::Specific& specific) {
    RETURN_IF(Parameter::Specific::downmix != specific.getTag(), EX_ILLEGAL_ARGUMENT,
              "EffectNotSupported");
+0 −1
Original line number Diff line number Diff line
@@ -31,7 +31,6 @@ class DownmixImpl final : public EffectImpl {
    DownmixImpl() = default;
    ~DownmixImpl() { cleanUp(); }

    ndk::ScopedAStatus commandImpl(CommandId command) REQUIRES(mImplMutex) override;
    ndk::ScopedAStatus getDescriptor(Descriptor* _aidl_return) override;
    ndk::ScopedAStatus setParameterSpecific(const Parameter::Specific& specific)
            REQUIRES(mImplMutex) override;
+0 −21
Original line number Diff line number Diff line
@@ -244,27 +244,6 @@ ndk::ScopedAStatus DynamicsProcessingImpl::getDescriptor(Descriptor* _aidl_retur
    return ndk::ScopedAStatus::ok();
}

ndk::ScopedAStatus DynamicsProcessingImpl::commandImpl(CommandId command) {
    RETURN_IF(!mContext, EX_NULL_POINTER, "nullContext");
    switch (command) {
        case CommandId::START:
            mContext->enable();
            return ndk::ScopedAStatus::ok();
        case CommandId::STOP:
            mContext->disable();
            return ndk::ScopedAStatus::ok();
        case CommandId::RESET:
            mContext->disable();
            mContext->resetBuffer();
            return ndk::ScopedAStatus::ok();
        default:
            // Need this default handling for vendor extendable CommandId::VENDOR_COMMAND_*
            LOG(ERROR) << __func__ << " commandId " << toString(command) << " not supported";
            return ndk::ScopedAStatus::fromExceptionCodeWithMessage(EX_ILLEGAL_ARGUMENT,
                                                                    "commandIdNotSupported");
    }
}

bool DynamicsProcessingImpl::isParamInRange(const Parameter::Specific& specific) {
    auto& dp = specific.get<Parameter::Specific::dynamicsProcessing>();
    return DynamicsProcessingRanges::isParamInRange(dp, kRanges);
Loading