Loading audio/aidl/TEST_MAPPING +3 −0 Original line number Diff line number Diff line Loading @@ -14,6 +14,9 @@ }, { "name": "VtsHalLoudnessEnhancerTargetTest" }, { "name": "VtsHalVisualizerTargetTest" } ] } audio/aidl/default/audio_effects_config.xml +4 −1 Original line number Diff line number Diff line Loading @@ -61,7 +61,10 @@ --> <effects> <effect name="bassboost" library="bassboostsw" uuid="fa8181f2-588b-11ed-9b6a-0242ac120002"/> <effectProxy name="bassboost" uuid="14804144-a5ee-4d24-aa88-0002a5d5c51b"> <libsw library="bassboostsw" uuid="fa8181f2-588b-11ed-9b6a-0242ac120002"/> <libsw library="bundle" uuid="8631f300-72e2-11df-b57e-0002a5d5c51b"/> </effectProxy> <effect name="dynamics_processing" library="dynamics_processingsw" uuid="fa818d78-588b-11ed-9b6a-0242ac120002"/> <effect name="haptic_generator" library="haptic_generatorsw" uuid="fa819110-588b-11ed-9b6a-0242ac120002"/> <effect name="loudness_enhancer" library="loudness_enhancersw" uuid="fa819610-588b-11ed-9b6a-0242ac120002"/> Loading audio/aidl/default/bassboost/BassBoostSw.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -66,7 +66,7 @@ const BassBoost::Capability BassBoostSw::kCapability = {.strengthSupported = kSt const Descriptor BassBoostSw::kDescriptor = { .common = {.id = {.type = kBassBoostTypeUUID, .uuid = kBassBoostSwImplUUID, .proxy = std::nullopt}, .proxy = kBassBoostProxyUUID}, .flags = {.type = Flags::Type::INSERT, .insert = Flags::Insert::FIRST, .volume = Flags::Volume::CTRL}, Loading audio/aidl/default/include/effect-impl/EffectUUID.h +12 −0 Original line number Diff line number Diff line Loading @@ -45,6 +45,18 @@ static const AudioUuid kBassBoostSwImplUUID = {static_cast<int32_t>(0xfa8181f2), 0x11ed, 0x9b6a, {0x02, 0x42, 0xac, 0x12, 0x00, 0x02}}; // 8631f300-72e2-11df-b57e-0002a5d5c51b static const AudioUuid kBassBoostBundleImplUUID = {static_cast<int32_t>(0x8631f300), 0x72e2, 0x11df, 0xb57e, {0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}}; // 14804144-a5ee-4d24-aa88-0002a5d5c51b static const AudioUuid kBassBoostProxyUUID = {static_cast<int32_t>(0x14804144), 0xa5ee, 0x4d24, 0xaa88, {0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}}; // fa81862a-588b-11ed-9b6a-0242ac120002 static const AudioUuid kDownmixTypeUUID = {static_cast<int32_t>(0xfa81862a), 0x588b, Loading audio/aidl/default/visualizer/VisualizerSw.cpp +121 −9 Original line number Diff line number Diff line Loading @@ -14,14 +14,9 @@ * limitations under the License. */ #include <cstddef> #define LOG_TAG "AHAL_VisualizerSw" #include <Utils.h> #include <algorithm> #include <unordered_set> #include <android-base/logging.h> #include <fmq/AidlMessageQueue.h> #include "VisualizerSw.h" Loading Loading @@ -60,7 +55,10 @@ extern "C" binder_exception_t queryEffect(const AudioUuid* in_impl_uuid, Descrip namespace aidl::android::hardware::audio::effect { const std::string VisualizerSw::kEffectName = "VisualizerSw"; const Visualizer::Capability VisualizerSw::kCapability; /* capabilities */ const Visualizer::CaptureSizeRange mCaptureSizeRange = {MIN_CAPTURE_SIZE, MAX_CAPTURE_SIZE}; const Visualizer::Capability VisualizerSw::kCapability = {.maxLatencyMs = MAX_LATENCY, .captureSizeRange = mCaptureSizeRange}; const Descriptor VisualizerSw::kDescriptor = { .common = {.id = {.type = kVisualizerTypeUUID, .uuid = kVisualizerSwImplUUID, Loading @@ -82,8 +80,53 @@ ndk::ScopedAStatus VisualizerSw::setParameterSpecific(const Parameter::Specific& RETURN_IF(Parameter::Specific::visualizer != specific.getTag(), EX_ILLEGAL_ARGUMENT, "EffectNotSupported"); mSpecificParam = specific.get<Parameter::Specific::visualizer>(); LOG(DEBUG) << __func__ << " success with: " << specific.toString(); auto& vsParam = specific.get<Parameter::Specific::visualizer>(); auto tag = vsParam.getTag(); switch (tag) { case Visualizer::captureSizeBytes: { RETURN_IF(mContext->setVsCaptureSize(vsParam.get<Visualizer::captureSizeBytes>()) != RetCode::SUCCESS, EX_ILLEGAL_ARGUMENT, "captureSizeNotSupported"); return ndk::ScopedAStatus::ok(); } case Visualizer::scalingMode: { RETURN_IF(mContext->setVsScalingMode(vsParam.get<Visualizer::scalingMode>()) != RetCode::SUCCESS, EX_ILLEGAL_ARGUMENT, "scalingModeNotSupported"); return ndk::ScopedAStatus::ok(); } case Visualizer::measurementMode: { RETURN_IF(mContext->setVsMeasurementMode(vsParam.get<Visualizer::measurementMode>()) != RetCode::SUCCESS, EX_ILLEGAL_ARGUMENT, "measurementModeNotSupported"); return ndk::ScopedAStatus::ok(); } case Visualizer::setOnlyParameters: { return setSetOnlyParameterVisualizer(vsParam.get<Visualizer::setOnlyParameters>()); } case Visualizer::getOnlyParameters: { LOG(ERROR) << __func__ << " unsupported settable getOnlyParam"; return ndk::ScopedAStatus::fromExceptionCodeWithMessage( EX_ILLEGAL_ARGUMENT, "SetofGetOnlyParamsNotSupported"); } default: { LOG(ERROR) << __func__ << " unsupported tag: " << toString(tag); return ndk::ScopedAStatus::fromExceptionCodeWithMessage(EX_ILLEGAL_ARGUMENT, "VisualizerTagNotSupported"); } } } ndk::ScopedAStatus VisualizerSw::setSetOnlyParameterVisualizer( Visualizer::SetOnlyParameters setOnlyParam) { auto tag = setOnlyParam.getTag(); RETURN_IF(Visualizer::SetOnlyParameters::latencyMs != tag, EX_ILLEGAL_ARGUMENT, "SetOnlyParametersTagNotSupported"); RETURN_IF( mContext->setVsLatency(setOnlyParam.get<Visualizer::SetOnlyParameters::latencyMs>()) != RetCode::SUCCESS, EX_ILLEGAL_ARGUMENT, "latencyNotSupported"); return ndk::ScopedAStatus::ok(); } Loading @@ -91,7 +134,76 @@ ndk::ScopedAStatus VisualizerSw::getParameterSpecific(const Parameter::Id& id, Parameter::Specific* specific) { auto tag = id.getTag(); RETURN_IF(Parameter::Id::visualizerTag != tag, EX_ILLEGAL_ARGUMENT, "wrongIdTag"); specific->set<Parameter::Specific::visualizer>(mSpecificParam); auto vsId = id.get<Parameter::Id::visualizerTag>(); auto vsIdTag = vsId.getTag(); switch (vsIdTag) { case Visualizer::Id::commonTag: return getParameterVisualizer(vsId.get<Visualizer::Id::commonTag>(), specific); case Visualizer::Id::getOnlyParamTag: return getGetOnlyParameterVisualizer(vsId.get<Visualizer::Id::getOnlyParamTag>(), specific); case Visualizer::Id::setOnlyParamTag: { LOG(ERROR) << __func__ << " unsupported gettable setOnlyParam"; return ndk::ScopedAStatus::fromExceptionCodeWithMessage( EX_ILLEGAL_ARGUMENT, "GetofSetOnlyParamsNotSupported"); } default: LOG(ERROR) << __func__ << " unsupported tag: " << toString(tag); return ndk::ScopedAStatus::fromExceptionCodeWithMessage(EX_ILLEGAL_ARGUMENT, "VisualizerTagNotSupported"); } } ndk::ScopedAStatus VisualizerSw::getParameterVisualizer(const Visualizer::Tag& tag, Parameter::Specific* specific) { RETURN_IF(!mContext, EX_NULL_POINTER, "nullContext"); Visualizer vsParam; switch (tag) { case Visualizer::captureSizeBytes: { vsParam.set<Visualizer::captureSizeBytes>(mContext->getVsCaptureSize()); break; } case Visualizer::scalingMode: { vsParam.set<Visualizer::scalingMode>(mContext->getVsScalingMode()); break; } case Visualizer::measurementMode: { vsParam.set<Visualizer::measurementMode>(mContext->getVsMeasurementMode()); break; } default: { LOG(ERROR) << __func__ << " unsupported tag: " << toString(tag); return ndk::ScopedAStatus::fromExceptionCodeWithMessage(EX_ILLEGAL_ARGUMENT, "VisualizerTagNotSupported"); } } specific->set<Parameter::Specific::visualizer>(vsParam); return ndk::ScopedAStatus::ok(); } ndk::ScopedAStatus VisualizerSw::getGetOnlyParameterVisualizer( const Visualizer::GetOnlyParameters::Tag& tag, Parameter::Specific* specific) { Visualizer::GetOnlyParameters getOnlyParam; switch (tag) { case Visualizer::GetOnlyParameters::measurement: { getOnlyParam.set<Visualizer::GetOnlyParameters::measurement>( mContext->getVsMeasurement()); break; } case Visualizer::GetOnlyParameters::captureBytes: { getOnlyParam.set<Visualizer::GetOnlyParameters::captureBytes>( mContext->getVsCaptureBytes()); break; } default: { LOG(ERROR) << __func__ << " unsupported tag: " << toString(tag); return ndk::ScopedAStatus::fromExceptionCodeWithMessage( EX_ILLEGAL_ARGUMENT, "GetOnlyParameterTagNotSupported"); } } Visualizer vsParam; vsParam.set<Visualizer::getOnlyParameters>(getOnlyParam); specific->set<Parameter::Specific::visualizer>(vsParam); return ndk::ScopedAStatus::ok(); } Loading Loading
audio/aidl/TEST_MAPPING +3 −0 Original line number Diff line number Diff line Loading @@ -14,6 +14,9 @@ }, { "name": "VtsHalLoudnessEnhancerTargetTest" }, { "name": "VtsHalVisualizerTargetTest" } ] }
audio/aidl/default/audio_effects_config.xml +4 −1 Original line number Diff line number Diff line Loading @@ -61,7 +61,10 @@ --> <effects> <effect name="bassboost" library="bassboostsw" uuid="fa8181f2-588b-11ed-9b6a-0242ac120002"/> <effectProxy name="bassboost" uuid="14804144-a5ee-4d24-aa88-0002a5d5c51b"> <libsw library="bassboostsw" uuid="fa8181f2-588b-11ed-9b6a-0242ac120002"/> <libsw library="bundle" uuid="8631f300-72e2-11df-b57e-0002a5d5c51b"/> </effectProxy> <effect name="dynamics_processing" library="dynamics_processingsw" uuid="fa818d78-588b-11ed-9b6a-0242ac120002"/> <effect name="haptic_generator" library="haptic_generatorsw" uuid="fa819110-588b-11ed-9b6a-0242ac120002"/> <effect name="loudness_enhancer" library="loudness_enhancersw" uuid="fa819610-588b-11ed-9b6a-0242ac120002"/> Loading
audio/aidl/default/bassboost/BassBoostSw.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -66,7 +66,7 @@ const BassBoost::Capability BassBoostSw::kCapability = {.strengthSupported = kSt const Descriptor BassBoostSw::kDescriptor = { .common = {.id = {.type = kBassBoostTypeUUID, .uuid = kBassBoostSwImplUUID, .proxy = std::nullopt}, .proxy = kBassBoostProxyUUID}, .flags = {.type = Flags::Type::INSERT, .insert = Flags::Insert::FIRST, .volume = Flags::Volume::CTRL}, Loading
audio/aidl/default/include/effect-impl/EffectUUID.h +12 −0 Original line number Diff line number Diff line Loading @@ -45,6 +45,18 @@ static const AudioUuid kBassBoostSwImplUUID = {static_cast<int32_t>(0xfa8181f2), 0x11ed, 0x9b6a, {0x02, 0x42, 0xac, 0x12, 0x00, 0x02}}; // 8631f300-72e2-11df-b57e-0002a5d5c51b static const AudioUuid kBassBoostBundleImplUUID = {static_cast<int32_t>(0x8631f300), 0x72e2, 0x11df, 0xb57e, {0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}}; // 14804144-a5ee-4d24-aa88-0002a5d5c51b static const AudioUuid kBassBoostProxyUUID = {static_cast<int32_t>(0x14804144), 0xa5ee, 0x4d24, 0xaa88, {0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}}; // fa81862a-588b-11ed-9b6a-0242ac120002 static const AudioUuid kDownmixTypeUUID = {static_cast<int32_t>(0xfa81862a), 0x588b, Loading
audio/aidl/default/visualizer/VisualizerSw.cpp +121 −9 Original line number Diff line number Diff line Loading @@ -14,14 +14,9 @@ * limitations under the License. */ #include <cstddef> #define LOG_TAG "AHAL_VisualizerSw" #include <Utils.h> #include <algorithm> #include <unordered_set> #include <android-base/logging.h> #include <fmq/AidlMessageQueue.h> #include "VisualizerSw.h" Loading Loading @@ -60,7 +55,10 @@ extern "C" binder_exception_t queryEffect(const AudioUuid* in_impl_uuid, Descrip namespace aidl::android::hardware::audio::effect { const std::string VisualizerSw::kEffectName = "VisualizerSw"; const Visualizer::Capability VisualizerSw::kCapability; /* capabilities */ const Visualizer::CaptureSizeRange mCaptureSizeRange = {MIN_CAPTURE_SIZE, MAX_CAPTURE_SIZE}; const Visualizer::Capability VisualizerSw::kCapability = {.maxLatencyMs = MAX_LATENCY, .captureSizeRange = mCaptureSizeRange}; const Descriptor VisualizerSw::kDescriptor = { .common = {.id = {.type = kVisualizerTypeUUID, .uuid = kVisualizerSwImplUUID, Loading @@ -82,8 +80,53 @@ ndk::ScopedAStatus VisualizerSw::setParameterSpecific(const Parameter::Specific& RETURN_IF(Parameter::Specific::visualizer != specific.getTag(), EX_ILLEGAL_ARGUMENT, "EffectNotSupported"); mSpecificParam = specific.get<Parameter::Specific::visualizer>(); LOG(DEBUG) << __func__ << " success with: " << specific.toString(); auto& vsParam = specific.get<Parameter::Specific::visualizer>(); auto tag = vsParam.getTag(); switch (tag) { case Visualizer::captureSizeBytes: { RETURN_IF(mContext->setVsCaptureSize(vsParam.get<Visualizer::captureSizeBytes>()) != RetCode::SUCCESS, EX_ILLEGAL_ARGUMENT, "captureSizeNotSupported"); return ndk::ScopedAStatus::ok(); } case Visualizer::scalingMode: { RETURN_IF(mContext->setVsScalingMode(vsParam.get<Visualizer::scalingMode>()) != RetCode::SUCCESS, EX_ILLEGAL_ARGUMENT, "scalingModeNotSupported"); return ndk::ScopedAStatus::ok(); } case Visualizer::measurementMode: { RETURN_IF(mContext->setVsMeasurementMode(vsParam.get<Visualizer::measurementMode>()) != RetCode::SUCCESS, EX_ILLEGAL_ARGUMENT, "measurementModeNotSupported"); return ndk::ScopedAStatus::ok(); } case Visualizer::setOnlyParameters: { return setSetOnlyParameterVisualizer(vsParam.get<Visualizer::setOnlyParameters>()); } case Visualizer::getOnlyParameters: { LOG(ERROR) << __func__ << " unsupported settable getOnlyParam"; return ndk::ScopedAStatus::fromExceptionCodeWithMessage( EX_ILLEGAL_ARGUMENT, "SetofGetOnlyParamsNotSupported"); } default: { LOG(ERROR) << __func__ << " unsupported tag: " << toString(tag); return ndk::ScopedAStatus::fromExceptionCodeWithMessage(EX_ILLEGAL_ARGUMENT, "VisualizerTagNotSupported"); } } } ndk::ScopedAStatus VisualizerSw::setSetOnlyParameterVisualizer( Visualizer::SetOnlyParameters setOnlyParam) { auto tag = setOnlyParam.getTag(); RETURN_IF(Visualizer::SetOnlyParameters::latencyMs != tag, EX_ILLEGAL_ARGUMENT, "SetOnlyParametersTagNotSupported"); RETURN_IF( mContext->setVsLatency(setOnlyParam.get<Visualizer::SetOnlyParameters::latencyMs>()) != RetCode::SUCCESS, EX_ILLEGAL_ARGUMENT, "latencyNotSupported"); return ndk::ScopedAStatus::ok(); } Loading @@ -91,7 +134,76 @@ ndk::ScopedAStatus VisualizerSw::getParameterSpecific(const Parameter::Id& id, Parameter::Specific* specific) { auto tag = id.getTag(); RETURN_IF(Parameter::Id::visualizerTag != tag, EX_ILLEGAL_ARGUMENT, "wrongIdTag"); specific->set<Parameter::Specific::visualizer>(mSpecificParam); auto vsId = id.get<Parameter::Id::visualizerTag>(); auto vsIdTag = vsId.getTag(); switch (vsIdTag) { case Visualizer::Id::commonTag: return getParameterVisualizer(vsId.get<Visualizer::Id::commonTag>(), specific); case Visualizer::Id::getOnlyParamTag: return getGetOnlyParameterVisualizer(vsId.get<Visualizer::Id::getOnlyParamTag>(), specific); case Visualizer::Id::setOnlyParamTag: { LOG(ERROR) << __func__ << " unsupported gettable setOnlyParam"; return ndk::ScopedAStatus::fromExceptionCodeWithMessage( EX_ILLEGAL_ARGUMENT, "GetofSetOnlyParamsNotSupported"); } default: LOG(ERROR) << __func__ << " unsupported tag: " << toString(tag); return ndk::ScopedAStatus::fromExceptionCodeWithMessage(EX_ILLEGAL_ARGUMENT, "VisualizerTagNotSupported"); } } ndk::ScopedAStatus VisualizerSw::getParameterVisualizer(const Visualizer::Tag& tag, Parameter::Specific* specific) { RETURN_IF(!mContext, EX_NULL_POINTER, "nullContext"); Visualizer vsParam; switch (tag) { case Visualizer::captureSizeBytes: { vsParam.set<Visualizer::captureSizeBytes>(mContext->getVsCaptureSize()); break; } case Visualizer::scalingMode: { vsParam.set<Visualizer::scalingMode>(mContext->getVsScalingMode()); break; } case Visualizer::measurementMode: { vsParam.set<Visualizer::measurementMode>(mContext->getVsMeasurementMode()); break; } default: { LOG(ERROR) << __func__ << " unsupported tag: " << toString(tag); return ndk::ScopedAStatus::fromExceptionCodeWithMessage(EX_ILLEGAL_ARGUMENT, "VisualizerTagNotSupported"); } } specific->set<Parameter::Specific::visualizer>(vsParam); return ndk::ScopedAStatus::ok(); } ndk::ScopedAStatus VisualizerSw::getGetOnlyParameterVisualizer( const Visualizer::GetOnlyParameters::Tag& tag, Parameter::Specific* specific) { Visualizer::GetOnlyParameters getOnlyParam; switch (tag) { case Visualizer::GetOnlyParameters::measurement: { getOnlyParam.set<Visualizer::GetOnlyParameters::measurement>( mContext->getVsMeasurement()); break; } case Visualizer::GetOnlyParameters::captureBytes: { getOnlyParam.set<Visualizer::GetOnlyParameters::captureBytes>( mContext->getVsCaptureBytes()); break; } default: { LOG(ERROR) << __func__ << " unsupported tag: " << toString(tag); return ndk::ScopedAStatus::fromExceptionCodeWithMessage( EX_ILLEGAL_ARGUMENT, "GetOnlyParameterTagNotSupported"); } } Visualizer vsParam; vsParam.set<Visualizer::getOnlyParameters>(getOnlyParam); specific->set<Parameter::Specific::visualizer>(vsParam); return ndk::ScopedAStatus::ok(); } Loading