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

Commit 759c9cb2 authored by Shunkai Yao's avatar Shunkai Yao
Browse files

Spatializer: return supportedChannelLayout as part of parameter

Bug: 307368176
Test: atest EffectsFactoryHalInterfaceTest
Change-Id: I1a2a445b5c94cbd02acb4160c7f54d6733bff6aa
parent e00f10e0
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -65,8 +65,6 @@ namespace aidl::android::hardware::audio::effect {
const std::string SpatializerSw::kEffectName = "SpatializerSw";

const std::vector<Range::SpatializerRange> SpatializerSw::kRanges = {
        MAKE_RANGE(Spatializer, supportedChannelLayout, std::vector<AudioChannelLayout>{},
                   std::vector<AudioChannelLayout>{}),
        MAKE_RANGE(Spatializer, spatializationLevel, Spatialization::Level::NONE,
                   Spatialization::Level::BED_PLUS_OBJECTS),
        MAKE_RANGE(Spatializer, spatializationMode, Spatialization::Mode::BINAURAL,
@@ -175,11 +173,19 @@ std::optional<Spatializer> SpatializerSwContext::getParam(TAG tag) {
    if (mParamsMap.find(tag) != mParamsMap.end()) {
        return mParamsMap.at(tag);
    }
    if (tag == Spatializer::supportedChannelLayout) {
        return Spatializer::make<Spatializer::supportedChannelLayout>(
                {AudioChannelLayout::make<AudioChannelLayout::layoutMask>(
                        AudioChannelLayout::LAYOUT_5POINT1)});
    }
    return std::nullopt;
}

template <typename TAG>
ndk::ScopedAStatus SpatializerSwContext::setParam(TAG tag, Spatializer spatializer) {
    RETURN_IF(tag == Spatializer::supportedChannelLayout, EX_ILLEGAL_ARGUMENT,
              "supportedChannelLayoutGetOnly");

    mParamsMap[tag] = spatializer;
    return ndk::ScopedAStatus::ok();
}