Merge "Update EffectUUID initialization"

This commit is contained in:
Shunkai Yao 2023-03-18 23:36:42 +00:00 committed by Gerrit Code Review
commit b1b8b68316
59 changed files with 319 additions and 624 deletions

View file

@ -16,6 +16,7 @@
#define LOG_TAG "AHAL_EffectConfig"
#include <android-base/logging.h>
#include <system/audio_effects/effect_uuid.h>
#include "effectFactory-impl/EffectConfig.h"
@ -163,15 +164,53 @@ bool EffectConfig::parseLibraryUuid(const tinyxml2::XMLElement& xml,
libraryUuid.name = name;
}
const char* uuid = xml.Attribute("uuid");
RETURN_VALUE_IF(!uuid, false, "noUuidAttribute");
RETURN_VALUE_IF(!stringToUuid(uuid, &libraryUuid.uuid), false, "invalidUuidAttribute");
const char* uuidStr = xml.Attribute("uuid");
RETURN_VALUE_IF(!uuidStr, false, "noUuidAttribute");
libraryUuid.uuid = stringToUuid(uuidStr);
RETURN_VALUE_IF((libraryUuid.uuid == getEffectUuidZero()), false, "invalidUuidAttribute");
LOG(DEBUG) << __func__ << (isProxy ? " proxy " : libraryUuid.name) << " : "
<< libraryUuid.uuid.toString();
return true;
}
bool EffectConfig::findUuid(const std::string& xmlEffectName, AudioUuid* uuid) {
// Difference from EFFECT_TYPE_LIST_DEF, there could be multiple name mapping to same Effect Type
#define EFFECT_XML_TYPE_LIST_DEF(V) \
V("acoustic_echo_canceler", AcousticEchoCanceler) \
V("automatic_gain_control_v1", AutomaticGainControlV1) \
V("automatic_gain_control_v2", AutomaticGainControlV2) \
V("bassboost", BassBoost) \
V("downmix", Downmix) \
V("dynamics_processing", DynamicsProcessing) \
V("equalizer", Equalizer) \
V("haptic_generator", HapticGenerator) \
V("loudness_enhancer", LoudnessEnhancer) \
V("env_reverb", EnvReverb) \
V("reverb_env_aux", EnvReverb) \
V("reverb_env_ins", EnvReverb) \
V("preset_reverb", PresetReverb) \
V("reverb_pre_aux", PresetReverb) \
V("reverb_pre_ins", PresetReverb) \
V("noise_suppression", NoiseSuppression) \
V("spatializer", Spatializer) \
V("virtualizer", Virtualizer) \
V("visualizer", Visualizer) \
V("volume", Volume)
#define GENERATE_MAP_ENTRY_V(s, symbol) {s, &getEffectTypeUuid##symbol},
typedef const AudioUuid& (*UuidGetter)(void);
static const std::map<std::string, UuidGetter> uuidMap{
// std::make_pair("s", &getEffectTypeUuidExtension)};
{EFFECT_XML_TYPE_LIST_DEF(GENERATE_MAP_ENTRY_V)}};
if (auto it = uuidMap.find(xmlEffectName); it != uuidMap.end()) {
*uuid = (*it->second)();
return true;
}
return false;
}
const char* EffectConfig::dump(const tinyxml2::XMLElement& element,
tinyxml2::XMLPrinter&& printer) const {
element.Accept(&printer);

View file

@ -14,20 +14,19 @@
* limitations under the License.
*/
#include <dlfcn.h>
#include <iterator>
#include <memory>
#include <tuple>
#include "include/effect-impl/EffectTypes.h"
#define LOG_TAG "AHAL_EffectFactory"
#include <dlfcn.h>
#include <unordered_set>
#define LOG_TAG "AHAL_EffectFactory"
#include <android-base/logging.h>
#include <android/binder_ibinder_platform.h>
#include <system/audio_effects/effect_uuid.h>
#include <system/thread_defs.h>
#include "effect-impl/EffectTypes.h"
#include "effect-impl/EffectUUID.h"
#include "effectFactory-impl/EffectFactory.h"
using aidl::android::media::audio::common::AudioUuid;
@ -214,8 +213,8 @@ void Factory::createIdentityWithConfig(const EffectConfig::LibraryUuid& configLi
void Factory::loadEffectLibs() {
const auto& configEffectsMap = mConfig.getEffectsMap();
for (const auto& configEffects : configEffectsMap) {
if (auto typeUuid = kUuidNameTypeMap.find(configEffects.first /* effect name */);
typeUuid != kUuidNameTypeMap.end()) {
if (AudioUuid uuid;
EffectConfig::findUuid(configEffects.first /* xml effect name */, &uuid)) {
const auto& configLibs = configEffects.second;
std::optional<AudioUuid> proxyUuid;
if (configLibs.proxyLibrary.has_value()) {
@ -223,7 +222,7 @@ void Factory::loadEffectLibs() {
proxyUuid = proxyLib.uuid;
}
for (const auto& configLib : configLibs.libraries) {
createIdentityWithConfig(configLib, typeUuid->second, proxyUuid);
createIdentityWithConfig(configLib, uuid, proxyUuid);
}
} else {
LOG(ERROR) << __func__ << ": can not find type UUID for effect " << configEffects.first

View file

@ -40,7 +40,7 @@ namespace aidl::android::hardware::audio::effect {
ndk::ScopedAStatus EffectImpl::open(const Parameter::Common& common,
const std::optional<Parameter::Specific>& specific,
OpenEffectReturn* ret) {
LOG(DEBUG) << __func__;
LOG(DEBUG) << getEffectName() << __func__;
// effect only support 32bits float
RETURN_IF(common.input.base.format.pcm != common.output.base.format.pcm ||
common.input.base.format.pcm != PcmType::FLOAT_32_BIT,
@ -71,12 +71,12 @@ ndk::ScopedAStatus EffectImpl::close() {
RETURN_IF(releaseContext() != RetCode::SUCCESS, EX_UNSUPPORTED_OPERATION,
"FailedToCreateWorker");
LOG(DEBUG) << __func__;
LOG(DEBUG) << getEffectName() << __func__;
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus EffectImpl::setParameter(const Parameter& param) {
LOG(DEBUG) << __func__ << " with: " << param.toString();
LOG(DEBUG) << getEffectName() << __func__ << " with: " << param.toString();
const auto tag = param.getTag();
switch (tag) {
@ -91,7 +91,8 @@ ndk::ScopedAStatus EffectImpl::setParameter(const Parameter& param) {
return setParameterSpecific(param.get<Parameter::specific>());
}
default: {
LOG(ERROR) << __func__ << " unsupportedParameterTag " << toString(tag);
LOG(ERROR) << getEffectName() << __func__ << " unsupportedParameterTag "
<< toString(tag);
return ndk::ScopedAStatus::fromExceptionCodeWithMessage(EX_ILLEGAL_ARGUMENT,
"ParameterNotSupported");
}
@ -99,7 +100,7 @@ ndk::ScopedAStatus EffectImpl::setParameter(const Parameter& param) {
}
ndk::ScopedAStatus EffectImpl::getParameter(const Parameter::Id& id, Parameter* param) {
LOG(DEBUG) << __func__ << id.toString();
LOG(DEBUG) << getEffectName() << __func__ << id.toString();
auto tag = id.getTag();
switch (tag) {
case Parameter::Id::commonTag: {
@ -116,7 +117,7 @@ ndk::ScopedAStatus EffectImpl::getParameter(const Parameter::Id& id, Parameter*
break;
}
}
LOG(DEBUG) << __func__ << param->toString();
LOG(DEBUG) << getEffectName() << __func__ << param->toString();
return ndk::ScopedAStatus::ok();
}
@ -149,7 +150,8 @@ ndk::ScopedAStatus EffectImpl::setParameterCommon(const Parameter& param) {
EX_ILLEGAL_ARGUMENT, "setVolumeStereoFailed");
break;
default: {
LOG(ERROR) << __func__ << " unsupportedParameterTag " << toString(tag);
LOG(ERROR) << getEffectName() << __func__ << " unsupportedParameterTag "
<< toString(tag);
return ndk::ScopedAStatus::fromExceptionCodeWithMessage(EX_ILLEGAL_ARGUMENT,
"commonParamNotSupported");
}
@ -183,7 +185,7 @@ ndk::ScopedAStatus EffectImpl::getParameterCommon(const Parameter::Tag& tag, Par
break;
}
default: {
LOG(DEBUG) << __func__ << " unsupported tag " << toString(tag);
LOG(DEBUG) << getEffectName() << __func__ << " unsupported tag " << toString(tag);
return ndk::ScopedAStatus::fromExceptionCodeWithMessage(EX_ILLEGAL_ARGUMENT,
"tagNotSupported");
}
@ -198,8 +200,8 @@ ndk::ScopedAStatus EffectImpl::getState(State* state) {
ndk::ScopedAStatus EffectImpl::command(CommandId command) {
RETURN_IF(mState == State::INIT, EX_ILLEGAL_STATE, "CommandStateError");
LOG(DEBUG) << __func__ << ": receive command: " << toString(command) << " at state "
<< toString(mState);
LOG(DEBUG) << getEffectName() << __func__ << ": receive command: " << toString(command)
<< " at state " << toString(mState);
switch (command) {
case CommandId::START:
@ -217,11 +219,11 @@ ndk::ScopedAStatus EffectImpl::command(CommandId command) {
mState = State::IDLE;
break;
default:
LOG(ERROR) << __func__ << " instance still processing";
LOG(ERROR) << getEffectName() << __func__ << " instance still processing";
return ndk::ScopedAStatus::fromExceptionCodeWithMessage(EX_ILLEGAL_ARGUMENT,
"CommandIdNotSupported");
}
LOG(DEBUG) << __func__ << " transfer to state: " << toString(mState);
LOG(DEBUG) << getEffectName() << __func__ << " transfer to state: " << toString(mState);
return ndk::ScopedAStatus::ok();
}
@ -252,7 +254,7 @@ IEffect::Status EffectImpl::effectProcessImpl(float* in, float* out, int samples
for (int i = 0; i < samples; i++) {
*out++ = *in++;
}
LOG(DEBUG) << __func__ << " done processing " << samples << " samples";
LOG(DEBUG) << getEffectName() << __func__ << " done processing " << samples << " samples";
return {STATUS_OK, samples, samples};
}

View file

@ -36,7 +36,7 @@ EffectThread::~EffectThread() {
RetCode EffectThread::createThread(std::shared_ptr<EffectContext> context, const std::string& name,
int priority, int sleepUs /* kSleepTimeUs */) {
if (mThread.joinable()) {
LOG(WARNING) << __func__ << " thread already created, no-op";
LOG(WARNING) << "-" << mName << "-" << __func__ << " thread already created, no-op";
return RetCode::SUCCESS;
}
mName = name;
@ -47,7 +47,7 @@ RetCode EffectThread::createThread(std::shared_ptr<EffectContext> context, const
mThreadContext = std::move(context);
}
mThread = std::thread(&EffectThread::threadLoop, this);
LOG(DEBUG) << __func__ << " " << name << " priority " << mPriority << " done";
LOG(DEBUG) << "-" << mName << "-" << __func__ << " priority " << mPriority << " done";
return RetCode::SUCCESS;
}
@ -66,7 +66,7 @@ RetCode EffectThread::destroyThread() {
std::lock_guard lg(mThreadMutex);
mThreadContext.reset();
}
LOG(DEBUG) << __func__ << " done";
LOG(DEBUG) << "-" << mName << "-" << __func__ << " done";
return RetCode::SUCCESS;
}
@ -80,21 +80,23 @@ RetCode EffectThread::stopThread() {
RetCode EffectThread::handleStartStop(bool stop) {
if (!mThread.joinable()) {
LOG(ERROR) << __func__ << " thread already destroyed";
LOG(ERROR) << "-" << mName << "-" << __func__ << ": "
<< " thread already destroyed";
return RetCode::ERROR_THREAD;
}
{
std::lock_guard lg(mThreadMutex);
if (stop == mStop) {
LOG(WARNING) << __func__ << " already " << (stop ? "stop" : "start");
LOG(WARNING) << "-" << mName << "-" << __func__ << ": "
<< " already " << (stop ? "stop" : "start");
return RetCode::SUCCESS;
}
mStop = stop;
}
mCv.notify_one();
LOG(DEBUG) << (stop ? "stop done" : "start done");
LOG(DEBUG) << ": " << mName << (stop ? " stop done" : " start done");
return RetCode::SUCCESS;
}
@ -124,16 +126,18 @@ void EffectThread::process_l() {
auto readSamples = inputMQ->availableToRead(), writeSamples = outputMQ->availableToWrite();
if (readSamples && writeSamples) {
auto processSamples = std::min(readSamples, writeSamples);
LOG(DEBUG) << __func__ << " available to read " << readSamples << " available to write "
<< writeSamples << " process " << processSamples;
LOG(DEBUG) << "-" << mName << "-" << __func__ << ": "
<< " available to read " << readSamples << " available to write " << writeSamples
<< " process " << processSamples;
inputMQ->read(buffer, processSamples);
IEffect::Status status = effectProcessImpl(buffer, buffer, processSamples);
outputMQ->write(buffer, status.fmqProduced);
statusMQ->writeBlocking(&status, 1);
LOG(DEBUG) << __func__ << " done processing, effect consumed " << status.fmqConsumed
<< " produced " << status.fmqProduced;
LOG(DEBUG) << "-" << mName << "-" << __func__ << ": "
<< " done processing, effect consumed " << status.fmqConsumed << " produced "
<< status.fmqProduced;
} else {
usleep(mSleepTimeUs);
}

View file

@ -22,19 +22,21 @@
#define LOG_TAG "AHAL_AcousticEchoCancelerSw"
#include <android-base/logging.h>
#include <fmq/AidlMessageQueue.h>
#include <system/audio_effects/effect_uuid.h>
#include "AcousticEchoCancelerSw.h"
using aidl::android::hardware::audio::effect::AcousticEchoCancelerSw;
using aidl::android::hardware::audio::effect::Descriptor;
using aidl::android::hardware::audio::effect::getEffectImplUuidAcousticEchoCancelerSw;
using aidl::android::hardware::audio::effect::getEffectTypeUuidAcousticEchoCanceler;
using aidl::android::hardware::audio::effect::IEffect;
using aidl::android::hardware::audio::effect::kAcousticEchoCancelerSwImplUUID;
using aidl::android::hardware::audio::effect::Range;
using aidl::android::media::audio::common::AudioUuid;
extern "C" binder_exception_t createEffect(const AudioUuid* in_impl_uuid,
std::shared_ptr<IEffect>* instanceSpp) {
if (!in_impl_uuid || *in_impl_uuid != kAcousticEchoCancelerSwImplUUID) {
if (!in_impl_uuid || *in_impl_uuid != getEffectImplUuidAcousticEchoCancelerSw()) {
LOG(ERROR) << __func__ << "uuid not supported";
return EX_ILLEGAL_ARGUMENT;
}
@ -49,7 +51,7 @@ extern "C" binder_exception_t createEffect(const AudioUuid* in_impl_uuid,
}
extern "C" binder_exception_t queryEffect(const AudioUuid* in_impl_uuid, Descriptor* _aidl_return) {
if (!in_impl_uuid || *in_impl_uuid != kAcousticEchoCancelerSwImplUUID) {
if (!in_impl_uuid || *in_impl_uuid != getEffectImplUuidAcousticEchoCancelerSw()) {
LOG(ERROR) << __func__ << "uuid not supported";
return EX_ILLEGAL_ARGUMENT;
}
@ -69,8 +71,8 @@ const std::vector<Range::AcousticEchoCancelerRange> AcousticEchoCancelerSw::kRan
const Capability AcousticEchoCancelerSw::kCapability = {.range = AcousticEchoCancelerSw::kRanges};
const Descriptor AcousticEchoCancelerSw::kDescriptor = {
.common = {.id = {.type = kAcousticEchoCancelerTypeUUID,
.uuid = kAcousticEchoCancelerSwImplUUID,
.common = {.id = {.type = getEffectTypeUuidAcousticEchoCanceler(),
.uuid = getEffectImplUuidAcousticEchoCancelerSw(),
.proxy = std::nullopt},
.flags = {.type = Flags::Type::INSERT,
.insert = Flags::Insert::FIRST,

View file

@ -23,7 +23,6 @@
#include <memory>
#include "effect-impl/EffectImpl.h"
#include "effect-impl/EffectUUID.h"
namespace aidl::android::hardware::audio::effect {

View file

@ -17,18 +17,20 @@
#define LOG_TAG "AHAL_AutomaticGainControlV1Sw"
#include <android-base/logging.h>
#include <system/audio_effects/effect_uuid.h>
#include "AutomaticGainControlV1Sw.h"
using aidl::android::hardware::audio::effect::AutomaticGainControlV1Sw;
using aidl::android::hardware::audio::effect::Descriptor;
using aidl::android::hardware::audio::effect::getEffectImplUuidAutomaticGainControlV1Sw;
using aidl::android::hardware::audio::effect::getEffectTypeUuidAutomaticGainControlV1;
using aidl::android::hardware::audio::effect::IEffect;
using aidl::android::hardware::audio::effect::kAutomaticGainControlV1SwImplUUID;
using aidl::android::media::audio::common::AudioUuid;
extern "C" binder_exception_t createEffect(const AudioUuid* in_impl_uuid,
std::shared_ptr<IEffect>* instanceSpp) {
if (!in_impl_uuid || *in_impl_uuid != kAutomaticGainControlV1SwImplUUID) {
if (!in_impl_uuid || *in_impl_uuid != getEffectImplUuidAutomaticGainControlV1Sw()) {
LOG(ERROR) << __func__ << "uuid not supported";
return EX_ILLEGAL_ARGUMENT;
}
@ -43,7 +45,7 @@ extern "C" binder_exception_t createEffect(const AudioUuid* in_impl_uuid,
}
extern "C" binder_exception_t queryEffect(const AudioUuid* in_impl_uuid, Descriptor* _aidl_return) {
if (!in_impl_uuid || *in_impl_uuid != kAutomaticGainControlV1SwImplUUID) {
if (!in_impl_uuid || *in_impl_uuid != getEffectImplUuidAutomaticGainControlV1Sw()) {
LOG(ERROR) << __func__ << "uuid not supported";
return EX_ILLEGAL_ARGUMENT;
}
@ -63,8 +65,8 @@ const Capability AutomaticGainControlV1Sw::kCapability = {
.range = AutomaticGainControlV1Sw::kRanges};
const Descriptor AutomaticGainControlV1Sw::kDescriptor = {
.common = {.id = {.type = kAutomaticGainControlV1TypeUUID,
.uuid = kAutomaticGainControlV1SwImplUUID,
.common = {.id = {.type = getEffectTypeUuidAutomaticGainControlV1(),
.uuid = getEffectImplUuidAutomaticGainControlV1Sw(),
.proxy = std::nullopt},
.flags = {.type = Flags::Type::INSERT,
.insert = Flags::Insert::FIRST,

View file

@ -17,7 +17,6 @@
#pragma once
#include "effect-impl/EffectImpl.h"
#include "effect-impl/EffectUUID.h"
namespace aidl::android::hardware::audio::effect {

View file

@ -17,22 +17,24 @@
#include <algorithm>
#include <cstddef>
#include <memory>
#define LOG_TAG "AHAL_AutomaticGainControlV2Sw"
#include <android-base/logging.h>
#include <fmq/AidlMessageQueue.h>
#include <system/audio_effects/effect_uuid.h>
#include "AutomaticGainControlV2Sw.h"
using aidl::android::hardware::audio::effect::AutomaticGainControlV2Sw;
using aidl::android::hardware::audio::effect::Descriptor;
using aidl::android::hardware::audio::effect::getEffectImplUuidAutomaticGainControlV2Sw;
using aidl::android::hardware::audio::effect::getEffectTypeUuidAutomaticGainControlV2;
using aidl::android::hardware::audio::effect::IEffect;
using aidl::android::hardware::audio::effect::kAutomaticGainControlV2SwImplUUID;
using aidl::android::media::audio::common::AudioUuid;
extern "C" binder_exception_t createEffect(const AudioUuid* in_impl_uuid,
std::shared_ptr<IEffect>* instanceSpp) {
if (!in_impl_uuid || *in_impl_uuid != kAutomaticGainControlV2SwImplUUID) {
if (!in_impl_uuid || *in_impl_uuid != getEffectImplUuidAutomaticGainControlV2Sw()) {
LOG(ERROR) << __func__ << "uuid not supported";
return EX_ILLEGAL_ARGUMENT;
}
@ -47,7 +49,7 @@ extern "C" binder_exception_t createEffect(const AudioUuid* in_impl_uuid,
}
extern "C" binder_exception_t queryEffect(const AudioUuid* in_impl_uuid, Descriptor* _aidl_return) {
if (!in_impl_uuid || *in_impl_uuid != kAutomaticGainControlV2SwImplUUID) {
if (!in_impl_uuid || *in_impl_uuid != getEffectImplUuidAutomaticGainControlV2Sw()) {
LOG(ERROR) << __func__ << "uuid not supported";
return EX_ILLEGAL_ARGUMENT;
}
@ -67,8 +69,8 @@ const Capability AutomaticGainControlV2Sw::kCapability = {
.range = AutomaticGainControlV2Sw::kRanges};
const Descriptor AutomaticGainControlV2Sw::kDescriptor = {
.common = {.id = {.type = kAutomaticGainControlV2TypeUUID,
.uuid = kAutomaticGainControlV2SwImplUUID,
.common = {.id = {.type = getEffectTypeUuidAutomaticGainControlV2(),
.uuid = getEffectImplUuidAutomaticGainControlV2Sw(),
.proxy = std::nullopt},
.flags = {.type = Flags::Type::INSERT,
.insert = Flags::Insert::FIRST,

View file

@ -22,7 +22,6 @@
#include <memory>
#include "effect-impl/EffectImpl.h"
#include "effect-impl/EffectUUID.h"
namespace aidl::android::hardware::audio::effect {

View file

@ -21,19 +21,22 @@
#define LOG_TAG "AHAL_BassBoostSw"
#include <android-base/logging.h>
#include <fmq/AidlMessageQueue.h>
#include <system/audio_effects/effect_uuid.h>
#include "BassBoostSw.h"
using aidl::android::hardware::audio::effect::BassBoostSw;
using aidl::android::hardware::audio::effect::Descriptor;
using aidl::android::hardware::audio::effect::getEffectImplUuidBassBoostProxy;
using aidl::android::hardware::audio::effect::getEffectImplUuidBassBoostSw;
using aidl::android::hardware::audio::effect::getEffectTypeUuidBassBoost;
using aidl::android::hardware::audio::effect::IEffect;
using aidl::android::hardware::audio::effect::kBassBoostSwImplUUID;
using aidl::android::hardware::audio::effect::State;
using aidl::android::media::audio::common::AudioUuid;
extern "C" binder_exception_t createEffect(const AudioUuid* in_impl_uuid,
std::shared_ptr<IEffect>* instanceSpp) {
if (!in_impl_uuid || *in_impl_uuid != kBassBoostSwImplUUID) {
if (!in_impl_uuid || *in_impl_uuid != getEffectImplUuidBassBoostSw()) {
LOG(ERROR) << __func__ << "uuid not supported";
return EX_ILLEGAL_ARGUMENT;
}
@ -48,7 +51,7 @@ extern "C" binder_exception_t createEffect(const AudioUuid* in_impl_uuid,
}
extern "C" binder_exception_t queryEffect(const AudioUuid* in_impl_uuid, Descriptor* _aidl_return) {
if (!in_impl_uuid || *in_impl_uuid != kBassBoostSwImplUUID) {
if (!in_impl_uuid || *in_impl_uuid != getEffectImplUuidBassBoostSw()) {
LOG(ERROR) << __func__ << "uuid not supported";
return EX_ILLEGAL_ARGUMENT;
}
@ -64,9 +67,9 @@ const std::vector<Range::BassBoostRange> BassBoostSw::kRanges = {
MAKE_RANGE(BassBoost, strengthPm, 0, 1000)};
const Capability BassBoostSw::kCapability = {.range = {BassBoostSw::kRanges}};
const Descriptor BassBoostSw::kDescriptor = {
.common = {.id = {.type = kBassBoostTypeUUID,
.uuid = kBassBoostSwImplUUID,
.proxy = kBassBoostProxyUUID},
.common = {.id = {.type = getEffectTypeUuidBassBoost(),
.uuid = getEffectImplUuidBassBoostSw(),
.proxy = getEffectImplUuidBassBoostProxy()},
.flags = {.type = Flags::Type::INSERT,
.insert = Flags::Insert::FIRST,
.volume = Flags::Volume::CTRL},

View file

@ -22,7 +22,6 @@
#include <memory>
#include "effect-impl/EffectImpl.h"
#include "effect-impl/EffectUUID.h"
namespace aidl::android::hardware::audio::effect {

View file

@ -20,19 +20,21 @@
#define LOG_TAG "AHAL_DownmixSw"
#include <android-base/logging.h>
#include <fmq/AidlMessageQueue.h>
#include <system/audio_effects/effect_uuid.h>
#include "DownmixSw.h"
using aidl::android::hardware::audio::effect::Descriptor;
using aidl::android::hardware::audio::effect::DownmixSw;
using aidl::android::hardware::audio::effect::getEffectImplUuidDownmixSw;
using aidl::android::hardware::audio::effect::getEffectTypeUuidDownmix;
using aidl::android::hardware::audio::effect::IEffect;
using aidl::android::hardware::audio::effect::kDownmixSwImplUUID;
using aidl::android::hardware::audio::effect::State;
using aidl::android::media::audio::common::AudioUuid;
extern "C" binder_exception_t createEffect(const AudioUuid* in_impl_uuid,
std::shared_ptr<IEffect>* instanceSpp) {
if (!in_impl_uuid || *in_impl_uuid != kDownmixSwImplUUID) {
if (!in_impl_uuid || *in_impl_uuid != getEffectImplUuidDownmixSw()) {
LOG(ERROR) << __func__ << "uuid not supported";
return EX_ILLEGAL_ARGUMENT;
}
@ -47,7 +49,7 @@ extern "C" binder_exception_t createEffect(const AudioUuid* in_impl_uuid,
}
extern "C" binder_exception_t queryEffect(const AudioUuid* in_impl_uuid, Descriptor* _aidl_return) {
if (!in_impl_uuid || *in_impl_uuid != kDownmixSwImplUUID) {
if (!in_impl_uuid || *in_impl_uuid != getEffectImplUuidDownmixSw()) {
LOG(ERROR) << __func__ << "uuid not supported";
return EX_ILLEGAL_ARGUMENT;
}
@ -59,13 +61,14 @@ namespace aidl::android::hardware::audio::effect {
const std::string DownmixSw::kEffectName = "DownmixSw";
const Descriptor DownmixSw::kDescriptor = {
.common = {
.id = {.type = kDownmixTypeUUID, .uuid = kDownmixSwImplUUID, .proxy = std::nullopt},
.flags = {.type = Flags::Type::INSERT,
.insert = Flags::Insert::FIRST,
.volume = Flags::Volume::CTRL},
.name = kEffectName,
.implementor = "The Android Open Source Project"}};
.common = {.id = {.type = getEffectTypeUuidDownmix(),
.uuid = getEffectImplUuidDownmixSw(),
.proxy = std::nullopt},
.flags = {.type = Flags::Type::INSERT,
.insert = Flags::Insert::FIRST,
.volume = Flags::Volume::CTRL},
.name = kEffectName,
.implementor = "The Android Open Source Project"}};
ndk::ScopedAStatus DownmixSw::getDescriptor(Descriptor* _aidl_return) {
LOG(DEBUG) << __func__ << kDescriptor.toString();

View file

@ -22,7 +22,6 @@
#include <memory>
#include "effect-impl/EffectImpl.h"
#include "effect-impl/EffectUUID.h"
namespace aidl::android::hardware::audio::effect {

View file

@ -22,19 +22,21 @@
#define LOG_TAG "AHAL_DynamicsProcessingSw"
#include <android-base/logging.h>
#include <fmq/AidlMessageQueue.h>
#include <system/audio_effects/effect_uuid.h>
#include "DynamicsProcessingSw.h"
using aidl::android::hardware::audio::effect::Descriptor;
using aidl::android::hardware::audio::effect::DynamicsProcessingSw;
using aidl::android::hardware::audio::effect::getEffectImplUuidDynamicsProcessingSw;
using aidl::android::hardware::audio::effect::getEffectTypeUuidDynamicsProcessing;
using aidl::android::hardware::audio::effect::IEffect;
using aidl::android::hardware::audio::effect::kDynamicsProcessingSwImplUUID;
using aidl::android::hardware::audio::effect::State;
using aidl::android::media::audio::common::AudioUuid;
extern "C" binder_exception_t createEffect(const AudioUuid* in_impl_uuid,
std::shared_ptr<IEffect>* instanceSpp) {
if (!in_impl_uuid || *in_impl_uuid != kDynamicsProcessingSwImplUUID) {
if (!in_impl_uuid || *in_impl_uuid != getEffectImplUuidDynamicsProcessingSw()) {
LOG(ERROR) << __func__ << "uuid not supported";
return EX_ILLEGAL_ARGUMENT;
}
@ -49,7 +51,7 @@ extern "C" binder_exception_t createEffect(const AudioUuid* in_impl_uuid,
}
extern "C" binder_exception_t queryEffect(const AudioUuid* in_impl_uuid, Descriptor* _aidl_return) {
if (!in_impl_uuid || *in_impl_uuid != kDynamicsProcessingSwImplUUID) {
if (!in_impl_uuid || *in_impl_uuid != getEffectImplUuidDynamicsProcessingSw()) {
LOG(ERROR) << __func__ << "uuid not supported";
return EX_ILLEGAL_ARGUMENT;
}
@ -88,8 +90,8 @@ const std::vector<Range::DynamicsProcessingRange> DynamicsProcessingSw::kRanges
const Capability DynamicsProcessingSw::kCapability = {.range = DynamicsProcessingSw::kRanges};
const Descriptor DynamicsProcessingSw::kDescriptor = {
.common = {.id = {.type = kDynamicsProcessingTypeUUID,
.uuid = kDynamicsProcessingSwImplUUID,
.common = {.id = {.type = getEffectTypeUuidDynamicsProcessing(),
.uuid = getEffectImplUuidDynamicsProcessingSw(),
.proxy = std::nullopt},
.flags = {.type = Flags::Type::INSERT,
.insert = Flags::Insert::FIRST,

View file

@ -25,7 +25,6 @@
#include <fmq/AidlMessageQueue.h>
#include "effect-impl/EffectImpl.h"
#include "effect-impl/EffectUUID.h"
namespace aidl::android::hardware::audio::effect {

View file

@ -21,19 +21,21 @@
#define LOG_TAG "AHAL_EnvReverbSw"
#include <android-base/logging.h>
#include <fmq/AidlMessageQueue.h>
#include <system/audio_effects/effect_uuid.h>
#include "EnvReverbSw.h"
using aidl::android::hardware::audio::effect::Descriptor;
using aidl::android::hardware::audio::effect::EnvReverbSw;
using aidl::android::hardware::audio::effect::getEffectImplUuidEnvReverbSw;
using aidl::android::hardware::audio::effect::getEffectTypeUuidEnvReverb;
using aidl::android::hardware::audio::effect::IEffect;
using aidl::android::hardware::audio::effect::kEnvReverbSwImplUUID;
using aidl::android::hardware::audio::effect::State;
using aidl::android::media::audio::common::AudioUuid;
extern "C" binder_exception_t createEffect(const AudioUuid* in_impl_uuid,
std::shared_ptr<IEffect>* instanceSpp) {
if (!in_impl_uuid || *in_impl_uuid != kEnvReverbSwImplUUID) {
if (!in_impl_uuid || *in_impl_uuid != getEffectImplUuidEnvReverbSw()) {
LOG(ERROR) << __func__ << "uuid not supported";
return EX_ILLEGAL_ARGUMENT;
}
@ -48,7 +50,7 @@ extern "C" binder_exception_t createEffect(const AudioUuid* in_impl_uuid,
}
extern "C" binder_exception_t queryEffect(const AudioUuid* in_impl_uuid, Descriptor* _aidl_return) {
if (!in_impl_uuid || *in_impl_uuid != kEnvReverbSwImplUUID) {
if (!in_impl_uuid || *in_impl_uuid != getEffectImplUuidEnvReverbSw()) {
LOG(ERROR) << __func__ << "uuid not supported";
return EX_ILLEGAL_ARGUMENT;
}
@ -76,8 +78,8 @@ const Capability EnvReverbSw::kCapability = {
.range = Range::make<Range::environmentalReverb>(EnvReverbSw::kRanges)};
const Descriptor EnvReverbSw::kDescriptor = {
.common = {.id = {.type = kEnvReverbTypeUUID,
.uuid = kEnvReverbSwImplUUID,
.common = {.id = {.type = getEffectTypeUuidEnvReverb(),
.uuid = getEffectImplUuidEnvReverbSw(),
.proxy = std::nullopt},
.flags = {.type = Flags::Type::INSERT,
.insert = Flags::Insert::FIRST,

View file

@ -22,7 +22,6 @@
#include <memory>
#include "effect-impl/EffectImpl.h"
#include "effect-impl/EffectUUID.h"
namespace aidl::android::hardware::audio::effect {

View file

@ -20,19 +20,21 @@
#define LOG_TAG "AHAL_EqualizerSw"
#include <android-base/logging.h>
#include <fmq/AidlMessageQueue.h>
#include <system/audio_effects/effect_uuid.h>
#include "EqualizerSw.h"
using aidl::android::hardware::audio::effect::Descriptor;
using aidl::android::hardware::audio::effect::EqualizerSw;
using aidl::android::hardware::audio::effect::getEffectImplUuidEqualizerSw;
using aidl::android::hardware::audio::effect::getEffectTypeUuidEqualizer;
using aidl::android::hardware::audio::effect::IEffect;
using aidl::android::hardware::audio::effect::kEqualizerSwImplUUID;
using aidl::android::hardware::audio::effect::State;
using aidl::android::media::audio::common::AudioUuid;
extern "C" binder_exception_t createEffect(const AudioUuid* in_impl_uuid,
std::shared_ptr<IEffect>* instanceSpp) {
if (!in_impl_uuid || *in_impl_uuid != kEqualizerSwImplUUID) {
if (!in_impl_uuid || *in_impl_uuid != getEffectImplUuidEqualizerSw()) {
LOG(ERROR) << __func__ << "uuid not supported";
return EX_ILLEGAL_ARGUMENT;
}
@ -47,7 +49,7 @@ extern "C" binder_exception_t createEffect(const AudioUuid* in_impl_uuid,
}
extern "C" binder_exception_t queryEffect(const AudioUuid* in_impl_uuid, Descriptor* _aidl_return) {
if (!in_impl_uuid || *in_impl_uuid != kEqualizerSwImplUUID) {
if (!in_impl_uuid || *in_impl_uuid != getEffectImplUuidEqualizerSw()) {
LOG(ERROR) << __func__ << "uuid not supported";
return EX_ILLEGAL_ARGUMENT;
}
@ -86,15 +88,16 @@ const std::vector<Range::EqualizerRange> EqualizerSw::kRanges = {
MAKE_RANGE(Equalizer, centerFreqMh, std::vector<int>({1}), std::vector<int>({0}))};
const Capability EqualizerSw::kEqCap = {.range = EqualizerSw::kRanges};
const Descriptor EqualizerSw::kDesc = {.common = {.id = {.type = kEqualizerTypeUUID,
.uuid = kEqualizerSwImplUUID,
.proxy = kEqualizerProxyUUID},
.flags = {.type = Flags::Type::INSERT,
.insert = Flags::Insert::FIRST,
.volume = Flags::Volume::CTRL},
.name = EqualizerSw::kEffectName,
.implementor = "The Android Open Source Project"},
.capability = EqualizerSw::kEqCap};
const Descriptor EqualizerSw::kDesc = {
.common = {.id = {.type = getEffectTypeUuidEqualizer(),
.uuid = getEffectImplUuidEqualizerSw(),
.proxy = getEffectImplUuidEqualizerProxy()},
.flags = {.type = Flags::Type::INSERT,
.insert = Flags::Insert::FIRST,
.volume = Flags::Volume::CTRL},
.name = EqualizerSw::kEffectName,
.implementor = "The Android Open Source Project"},
.capability = EqualizerSw::kEqCap};
ndk::ScopedAStatus EqualizerSw::getDescriptor(Descriptor* _aidl_return) {
LOG(DEBUG) << __func__ << kDesc.toString();

View file

@ -22,7 +22,6 @@
#include <memory>
#include "effect-impl/EffectImpl.h"
#include "effect-impl/EffectUUID.h"
namespace aidl::android::hardware::audio::effect {

View file

@ -23,22 +23,23 @@
#define LOG_TAG "AHAL_ExtensionEffect"
#include <android-base/logging.h>
#include <fmq/AidlMessageQueue.h>
#include <system/audio_effects/effect_uuid.h>
#include "ExtensionEffect.h"
using aidl::android::hardware::audio::effect::DefaultExtension;
using aidl::android::hardware::audio::effect::Descriptor;
using aidl::android::hardware::audio::effect::ExtensionEffect;
using aidl::android::hardware::audio::effect::getEffectUuidExtensionImpl;
using aidl::android::hardware::audio::effect::getEffectUuidExtensionType;
using aidl::android::hardware::audio::effect::IEffect;
using aidl::android::hardware::audio::effect::kExtensionEffectImplUUID;
using aidl::android::hardware::audio::effect::kExtensionEffectTypeUUID;
using aidl::android::hardware::audio::effect::Range;
using aidl::android::hardware::audio::effect::VendorExtension;
using aidl::android::media::audio::common::AudioUuid;
extern "C" binder_exception_t createEffect(const AudioUuid* in_impl_uuid,
std::shared_ptr<IEffect>* instanceSpp) {
if (!in_impl_uuid || *in_impl_uuid != kExtensionEffectImplUUID) {
if (!in_impl_uuid || *in_impl_uuid != getEffectUuidExtensionImpl()) {
LOG(ERROR) << __func__ << "uuid not supported";
return EX_ILLEGAL_ARGUMENT;
}
@ -53,7 +54,7 @@ extern "C" binder_exception_t createEffect(const AudioUuid* in_impl_uuid,
}
extern "C" binder_exception_t queryEffect(const AudioUuid* in_impl_uuid, Descriptor* _aidl_return) {
if (!in_impl_uuid || *in_impl_uuid != kExtensionEffectImplUUID) {
if (!in_impl_uuid || *in_impl_uuid != getEffectUuidExtensionImpl()) {
LOG(ERROR) << __func__ << "uuid not supported";
return EX_ILLEGAL_ARGUMENT;
}
@ -66,8 +67,8 @@ namespace aidl::android::hardware::audio::effect {
const std::string ExtensionEffect::kEffectName = "ExtensionEffectExample";
const Descriptor ExtensionEffect::kDescriptor = {
.common = {.id = {.type = kExtensionEffectTypeUUID,
.uuid = kExtensionEffectImplUUID,
.common = {.id = {.type = getEffectUuidExtensionType(),
.uuid = getEffectUuidExtensionImpl(),
.proxy = std::nullopt},
.name = ExtensionEffect::kEffectName,
.implementor = "The Android Open Source Project"}};

View file

@ -22,7 +22,6 @@
#include <vector>
#include "effect-impl/EffectImpl.h"
#include "effect-impl/EffectUUID.h"
namespace aidl::android::hardware::audio::effect {

View file

@ -20,19 +20,21 @@
#define LOG_TAG "AHAL_HapticGeneratorSw"
#include <android-base/logging.h>
#include <fmq/AidlMessageQueue.h>
#include <system/audio_effects/effect_uuid.h>
#include "HapticGeneratorSw.h"
using aidl::android::hardware::audio::effect::Descriptor;
using aidl::android::hardware::audio::effect::getEffectImplUuidHapticGeneratorSw;
using aidl::android::hardware::audio::effect::getEffectTypeUuidHapticGenerator;
using aidl::android::hardware::audio::effect::HapticGeneratorSw;
using aidl::android::hardware::audio::effect::IEffect;
using aidl::android::hardware::audio::effect::kHapticGeneratorSwImplUUID;
using aidl::android::hardware::audio::effect::State;
using aidl::android::media::audio::common::AudioUuid;
extern "C" binder_exception_t createEffect(const AudioUuid* in_impl_uuid,
std::shared_ptr<IEffect>* instanceSpp) {
if (!in_impl_uuid || *in_impl_uuid != kHapticGeneratorSwImplUUID) {
if (!in_impl_uuid || *in_impl_uuid != getEffectImplUuidHapticGeneratorSw()) {
LOG(ERROR) << __func__ << "uuid not supported";
return EX_ILLEGAL_ARGUMENT;
}
@ -47,7 +49,7 @@ extern "C" binder_exception_t createEffect(const AudioUuid* in_impl_uuid,
}
extern "C" binder_exception_t queryEffect(const AudioUuid* in_impl_uuid, Descriptor* _aidl_return) {
if (!in_impl_uuid || *in_impl_uuid != kHapticGeneratorSwImplUUID) {
if (!in_impl_uuid || *in_impl_uuid != getEffectImplUuidHapticGeneratorSw()) {
LOG(ERROR) << __func__ << "uuid not supported";
return EX_ILLEGAL_ARGUMENT;
}
@ -60,8 +62,8 @@ namespace aidl::android::hardware::audio::effect {
const std::string HapticGeneratorSw::kEffectName = "HapticGeneratorSw";
/* Effect descriptor */
const Descriptor HapticGeneratorSw::kDescriptor = {
.common = {.id = {.type = kHapticGeneratorTypeUUID,
.uuid = kHapticGeneratorSwImplUUID,
.common = {.id = {.type = getEffectTypeUuidHapticGenerator(),
.uuid = getEffectImplUuidHapticGeneratorSw(),
.proxy = std::nullopt},
.flags = {.type = Flags::Type::INSERT,
.insert = Flags::Insert::FIRST,

View file

@ -16,13 +16,14 @@
#pragma once
#include <aidl/android/hardware/audio/effect/BnEffect.h>
#include <fmq/AidlMessageQueue.h>
#include <cstdlib>
#include <map>
#include <memory>
#include <aidl/android/hardware/audio/effect/BnEffect.h>
#include <fmq/AidlMessageQueue.h>
#include "effect-impl/EffectImpl.h"
#include "effect-impl/EffectUUID.h"
namespace aidl::android::hardware::audio::effect {

View file

@ -15,7 +15,6 @@
*/
#pragma once
#include <ostream>
#include <string>
#include <aidl/android/hardware/audio/effect/BnEffect.h>
@ -128,23 +127,4 @@ inline std::ostream& operator<<(std::ostream& out, const RetCode& code) {
#define MAKE_RANGE(T, Tag, l, r) \
{ .min = T::make<T::Tag>(l), .max = T::make<T::Tag>(r) }
static inline bool stringToUuid(const char* str,
::aidl::android::media::audio::common::AudioUuid* uuid) {
RETURN_VALUE_IF(!uuid || !str, false, "nullPtr");
uint32_t tmp[10];
if (sscanf(str, "%08x-%04x-%04x-%04x-%02x%02x%02x%02x%02x%02x", tmp, tmp + 1, tmp + 2, tmp + 3,
tmp + 4, tmp + 5, tmp + 6, tmp + 7, tmp + 8, tmp + 9) < 10) {
return false;
}
uuid->timeLow = (uint32_t)tmp[0];
uuid->timeMid = (uint16_t)tmp[1];
uuid->timeHiAndVersion = (uint16_t)tmp[2];
uuid->clockSeq = (uint16_t)tmp[3];
uuid->node.insert(uuid->node.end(), {(uint8_t)tmp[4], (uint8_t)tmp[5], (uint8_t)tmp[6],
(uint8_t)tmp[7], (uint8_t)tmp[8], (uint8_t)tmp[9]});
return true;
}
} // namespace aidl::android::hardware::audio::effect

View file

@ -1,354 +0,0 @@
/*
* Copyright (C) 2022 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <map>
#include <aidl/android/media/audio/common/AudioUuid.h>
namespace aidl::android::hardware::audio::effect {
using ::aidl::android::media::audio::common::AudioUuid;
// ec7178ec-e5e1-4432-a3f4-4657e6795210
static const AudioUuid kEffectNullUuid = {static_cast<int32_t>(0xec7178ec),
0xe5e1,
0x4432,
0xa3f4,
{0x46, 0x57, 0xe6, 0x79, 0x52, 0x10}};
// Zero UUID
static const AudioUuid kEffectZeroUuid = {
static_cast<int32_t>(0x0), 0x0, 0x0, 0x0, {0x0, 0x0, 0x0, 0x0, 0x0, 0x0}};
// 7b491460-8d4d-11e0-bd61-0002a5d5c51b.
static const AudioUuid kAcousticEchoCancelerTypeUUID = {static_cast<int32_t>(0x7b491460),
0x8d4d,
0x11e0,
0xbd61,
{0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}};
// bb392ec0-8d4d-11e0-a896-0002a5d5c51b
static const AudioUuid kAcousticEchoCancelerSwImplUUID = {static_cast<int32_t>(0xbb392ec0),
0x8d4d,
0x11e0,
0xa896,
{0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}};
// 0a8abfe0-654c-11e0-ba26-0002a5d5c51b
static const AudioUuid kAutomaticGainControlV1TypeUUID = {static_cast<int32_t>(0x0a8abfe0),
0x654c,
0x11e0,
0xba26,
{0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}};
// aa8130e0-66fc-11e0-bad0-0002a5d5c51b
static const AudioUuid kAutomaticGainControlV1SwImplUUID = {static_cast<int32_t>(0xaa8130e0),
0x66fc,
0x11e0,
0xbad0,
{0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}};
// ae3c653b-be18-4ab8-8938-418f0a7f06ac
static const AudioUuid kAutomaticGainControlV2TypeUUID = {static_cast<int32_t>(0xae3c653b),
0xbe18,
0x4ab8,
0x8938,
{0x41, 0x8f, 0x0a, 0x7f, 0x06, 0xac}};
// 89f38e65-d4d2-4d64-ad0e-2b3e799ea886
static const AudioUuid kAutomaticGainControlV2SwImplUUID = {static_cast<int32_t>(0x89f38e65),
0xd4d2,
0x4d64,
0xad0e,
{0x2b, 0x3e, 0x79, 0x9e, 0xa8, 0x86}};
// 0634f220-ddd4-11db-a0fc-0002a5d5c51b
static const AudioUuid kBassBoostTypeUUID = {static_cast<int32_t>(0x0634f220),
0xddd4,
0x11db,
0xa0fc,
{0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}};
// fa8181f2-588b-11ed-9b6a-0242ac120002
static const AudioUuid kBassBoostSwImplUUID = {static_cast<int32_t>(0xfa8181f2),
0x588b,
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}};
// 381e49cc-a858-4aa2-87f6-e8388e7601b2
static const AudioUuid kDownmixTypeUUID = {static_cast<int32_t>(0x381e49cc),
0xa858,
0x4aa2,
0x87f6,
{0xe8, 0x38, 0x8e, 0x76, 0x01, 0xb2}};
// fa8187ba-588b-11ed-9b6a-0242ac120002
static const AudioUuid kDownmixSwImplUUID = {static_cast<int32_t>(0xfa8187ba),
0x588b,
0x11ed,
0x9b6a,
{0x02, 0x42, 0xac, 0x12, 0x00, 0x02}};
// 93f04452-e4fe-41cc-91f9-e475b6d1d69f
static const AudioUuid kDownmixImplUUID = {static_cast<int32_t>(0x93f04452),
0xe4fe,
0x41cc,
0x91f9,
{0xe4, 0x75, 0xb6, 0xd1, 0xd6, 0x9f}};
// 0bed4300-ddd6-11db-8f34-0002a5d5c51b.
static const AudioUuid kEqualizerTypeUUID = {static_cast<int32_t>(0x0bed4300),
0xddd6,
0x11db,
0x8f34,
{0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}};
// 0bed4300-847d-11df-bb17-0002a5d5c51b
static const AudioUuid kEqualizerSwImplUUID = {static_cast<int32_t>(0x0bed4300),
0x847d,
0x11df,
0xbb17,
{0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}};
// ce772f20-847d-11df-bb17-0002a5d5c51b
static const AudioUuid kEqualizerBundleImplUUID = {static_cast<int32_t>(0xce772f20),
0x847d,
0x11df,
0xbb17,
{0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}};
// c8e70ecd-48ca-456e-8a4f-0002a5d5c51b
static const AudioUuid kEqualizerProxyUUID = {static_cast<int32_t>(0xc8e70ecd),
0x48ca,
0x456e,
0x8a4f,
{0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}};
// 7261676f-6d75-7369-6364-28e2fd3ac39e
static const AudioUuid kDynamicsProcessingTypeUUID = {static_cast<int32_t>(0x7261676f),
0x6d75,
0x7369,
0x6364,
{0x28, 0xe2, 0xfd, 0x3a, 0xc3, 0x9e}};
// fa818d78-588b-11ed-9b6a-0242ac120002
static const AudioUuid kDynamicsProcessingSwImplUUID = {static_cast<int32_t>(0xfa818d78),
0x588b,
0x11ed,
0x9b6a,
{0x02, 0x42, 0xac, 0x12, 0x00, 0x02}};
// e0e6539b-1781-7261-676f-6d7573696340
static const AudioUuid kDynamicsProcessingImplUUID = {static_cast<int32_t>(0xe0e6539b),
0x1781,
0x7261,
0x676f,
{0x6d, 0x75, 0x73, 0x69, 0x63, 0x40}};
// 1411e6d6-aecd-4021-a1cf-a6aceb0d71e5
static const AudioUuid kHapticGeneratorTypeUUID = {static_cast<int32_t>(0x1411e6d6),
0xaecd,
0x4021,
0xa1cf,
{0xa6, 0xac, 0xeb, 0x0d, 0x71, 0xe5}};
// fa819110-588b-11ed-9b6a-0242ac120002
static const AudioUuid kHapticGeneratorSwImplUUID = {static_cast<int32_t>(0xfa819110),
0x588b,
0x11ed,
0x9b6a,
{0x02, 0x42, 0xac, 0x12, 0x00, 0x02}};
// 97c4acd1-8b82-4f2f-832e-c2fe5d7a9931
static const AudioUuid kHapticGeneratorImplUUID = {static_cast<int32_t>(0x97c4acd1),
0x8b82,
0x4f2f,
0x832e,
{0xc2, 0xfe, 0x5d, 0x7a, 0x99, 0x31}};
// fe3199be-aed0-413f-87bb-11260eb63cf1
static const AudioUuid kLoudnessEnhancerTypeUUID = {static_cast<int32_t>(0xfe3199be),
0xaed0,
0x413f,
0x87bb,
{0x11, 0x26, 0x0e, 0xb6, 0x3c, 0xf1}};
// fa819610-588b-11ed-9b6a-0242ac120002
static const AudioUuid kLoudnessEnhancerSwImplUUID = {static_cast<int32_t>(0xfa819610),
0x588b,
0x11ed,
0x9b6a,
{0x02, 0x42, 0xac, 0x12, 0x00, 0x02}};
// fa415329-2034-4bea-b5dc-5b381c8d1e2c
static const AudioUuid kLoudnessEnhancerImplUUID = {static_cast<int32_t>(0xfa415329),
0x2034,
0x4bea,
0xb5dc,
{0x5b, 0x38, 0x1c, 0x8d, 0x1e, 0x2c}};
// c2e5d5f0-94bd-4763-9cac-4e234d06839e
static const AudioUuid kEnvReverbTypeUUID = {static_cast<int32_t>(0xc2e5d5f0),
0x94bd,
0x4763,
0x9cac,
{0x4e, 0x23, 0x4d, 0x06, 0x83, 0x9e}};
// fa819886-588b-11ed-9b6a-0242ac120002
static const AudioUuid kEnvReverbSwImplUUID = {static_cast<int32_t>(0xfa819886),
0x588b,
0x11ed,
0x9b6a,
{0x02, 0x42, 0xac, 0x12, 0x00, 0x02}};
// 4a387fc0-8ab3-11df-8bad-0002a5d5c51b
static const AudioUuid kAuxEnvReverbImplUUID = {static_cast<int32_t>(0x4a387fc0),
0x8ab3,
0x11df,
0x8bad,
{0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}};
// c7a511a0-a3bb-11df-860e-0002a5d5c51b
static const AudioUuid kInsertEnvReverbImplUUID = {static_cast<int32_t>(0xc7a511a0),
0xa3bb,
0x11df,
0x860e,
{0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}};
// 58b4b260-8e06-11e0-aa8e-0002a5d5c51b
static const AudioUuid kNoiseSuppressionTypeUUID = {static_cast<int32_t>(0x58b4b260),
0x8e06,
0x11e0,
0xaa8e,
{0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}};
// c06c8400-8e06-11e0-9cb6-0002a5d5c51b
static const AudioUuid kNoiseSuppressionSwImplUUID = {static_cast<int32_t>(0xc06c8400),
0x8e06,
0x11e0,
0x9cb6,
{0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}};
// 47382d60-ddd8-11db-bf3a-0002a5d5c51b
static const AudioUuid kPresetReverbTypeUUID = {static_cast<int32_t>(0x47382d60),
0xddd8,
0x11db,
0xbf3a,
{0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}};
// fa8199c6-588b-11ed-9b6a-0242ac120002
static const AudioUuid kPresetReverbSwImplUUID = {static_cast<int32_t>(0xfa8199c6),
0x588b,
0x11ed,
0x9b6a,
{0x02, 0x42, 0xac, 0x12, 0x00, 0x02}};
// f29a1400-a3bb-11df-8ddc-0002a5d5c51b
static const AudioUuid kAuxPresetReverbImplUUID = {static_cast<int32_t>(0xf29a1400),
0xa3bb,
0x11df,
0x8ddc,
{0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}};
// 172cdf00-a3bc-11df-a72f-0002a5d5c51b
static const AudioUuid kInsertPresetReverbImplUUID = {static_cast<int32_t>(0x172cdf00),
0xa3bc,
0x11df,
0xa72f,
{0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}};
// 37cc2c00-dddd-11db-8577-0002a5d5c51b
static const AudioUuid kVirtualizerTypeUUID = {static_cast<int32_t>(0x37cc2c00),
0xdddd,
0x11db,
0x8577,
{0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}};
// fa819d86-588b-11ed-9b6a-0242ac120002
static const AudioUuid kVirtualizerSwImplUUID = {static_cast<int32_t>(0xfa819d86),
0x588b,
0x11ed,
0x9b6a,
{0x02, 0x42, 0xac, 0x12, 0x00, 0x02}};
// 1d4033c0-8557-11df-9f2d-0002a5d5c51b
static const AudioUuid kVirtualizerBundleImplUUID = {static_cast<int32_t>(0x1d4033c0),
0x8557,
0x11df,
0x9f2d,
{0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}};
// d3467faa-acc7-4d34-acaf-0002a5d5c51b
static const AudioUuid kVirtualizerProxyUUID = {static_cast<int32_t>(0xd3467faa),
0xacc7,
0x4d34,
0xacaf,
{0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}};
// e46b26a0-dddd-11db-8afd-0002a5d5c51b
static const AudioUuid kVisualizerTypeUUID = {static_cast<int32_t>(0xe46b26a0),
0xdddd,
0x11db,
0x8afd,
{0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}};
// fa81a0f6-588b-11ed-9b6a-0242ac120002
static const AudioUuid kVisualizerSwImplUUID = {static_cast<int32_t>(0xfa81a0f6),
0x588b,
0x11ed,
0x9b6a,
{0x02, 0x42, 0xac, 0x12, 0x00, 0x02}};
// d069d9e0-8329-11df-9168-0002a5d5c51b
// {0xd069d9e0, 0x8329, 0x11df, 0x9168, {0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}},
static const AudioUuid kVisualizerImplUUID = {static_cast<int32_t>(0xd069d9e0),
0x8329,
0x11df,
0x9168,
{0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}};
// fa81a2b8-588b-11ed-9b6a-0242ac120002
static const AudioUuid kVolumeTypeUUID = {static_cast<int32_t>(0xfa81a2b8),
0x588b,
0x11ed,
0x9b6a,
{0x02, 0x42, 0xac, 0x12, 0x00, 0x02}};
// fa81a718-588b-11ed-9b6a-0242ac120002
static const AudioUuid kVolumeSwImplUUID = {static_cast<int32_t>(0xfa81a718),
0x588b,
0x11ed,
0x9b6a,
{0x02, 0x42, 0xac, 0x12, 0x00, 0x02}};
// 119341a0-8469-11df-81f9-0002a5d5c51b
static const AudioUuid kVolumeBundleImplUUID = {static_cast<int32_t>(0x119341a0),
0x8469,
0x11df,
0x81f9,
{0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}};
// fa81dbde-588b-11ed-9b6a-0242ac120002
static const AudioUuid kExtensionEffectTypeUUID = {static_cast<int32_t>(0xfa81dbde),
0x588b,
0x11ed,
0x9b6a,
{0x02, 0x42, 0xac, 0x12, 0x00, 0x02}};
// fa81dd00-588b-11ed-9b6a-0242ac120002
static const AudioUuid kExtensionEffectImplUUID = {static_cast<int32_t>(0xfa81dd00),
0x588b,
0x11ed,
0x9b6a,
{0x02, 0x42, 0xac, 0x12, 0x00, 0x02}};
/**
* @brief A map between effect name and effect type UUID.
* All <name> attribution in effect/effectProxy of audio_effects.xml should be listed in this map.
* We need this map is because existing audio_effects.xml don't have a type UUID defined.
*/
static const std::map<const std::string /* effect type */, const AudioUuid&> kUuidNameTypeMap = {
{"acoustic_echo_canceler", kAcousticEchoCancelerTypeUUID},
{"automatic_gain_control_v1", kAutomaticGainControlV1TypeUUID},
{"automatic_gain_control_v2", kAutomaticGainControlV2TypeUUID},
{"bassboost", kBassBoostTypeUUID},
{"downmix", kDownmixTypeUUID},
{"dynamics_processing", kDynamicsProcessingTypeUUID},
{"equalizer", kEqualizerTypeUUID},
{"extensioneffect", kExtensionEffectTypeUUID},
{"haptic_generator", kHapticGeneratorTypeUUID},
{"loudness_enhancer", kLoudnessEnhancerTypeUUID},
{"env_reverb", kEnvReverbTypeUUID},
{"noise_suppression", kNoiseSuppressionTypeUUID},
{"preset_reverb", kPresetReverbTypeUUID},
{"reverb_env_aux", kEnvReverbTypeUUID},
{"reverb_env_ins", kEnvReverbTypeUUID},
{"reverb_pre_aux", kPresetReverbTypeUUID},
{"reverb_pre_ins", kPresetReverbTypeUUID},
{"virtualizer", kVirtualizerTypeUUID},
{"visualizer", kVisualizerTypeUUID},
{"volume", kVolumeTypeUUID},
};
} // namespace aidl::android::hardware::audio::effect

View file

@ -17,6 +17,7 @@
#pragma once
#include <functional>
#include <map>
#include <memory>
#include <string>
#include <unordered_map>
@ -62,6 +63,9 @@ class EffectConfig {
return mProcessingMap;
}
static bool findUuid(const std::string& xmlEffectName,
::aidl::android::media::audio::common::AudioUuid* uuid);
private:
static constexpr const char* kEffectLibPath[] =
#ifdef __LP64__

View file

@ -105,7 +105,7 @@ class Factory : public BnFactory {
const std::string& path);
void createIdentityWithConfig(
const EffectConfig::LibraryUuid& configLib,
const ::aidl::android::media::audio::common::AudioUuid& typeUuid,
const ::aidl::android::media::audio::common::AudioUuid& typeUuidStr,
const std::optional<::aidl::android::media::audio::common::AudioUuid> proxyUuid);
void loadEffectLibs();
/* Get effect_dl_interface_s from library handle */

View file

@ -20,19 +20,21 @@
#define LOG_TAG "AHAL_LoudnessEnhancerSw"
#include <android-base/logging.h>
#include <fmq/AidlMessageQueue.h>
#include <system/audio_effects/effect_uuid.h>
#include "LoudnessEnhancerSw.h"
using aidl::android::hardware::audio::effect::Descriptor;
using aidl::android::hardware::audio::effect::getEffectImplUuidLoudnessEnhancerSw;
using aidl::android::hardware::audio::effect::getEffectTypeUuidLoudnessEnhancer;
using aidl::android::hardware::audio::effect::IEffect;
using aidl::android::hardware::audio::effect::kLoudnessEnhancerSwImplUUID;
using aidl::android::hardware::audio::effect::LoudnessEnhancerSw;
using aidl::android::hardware::audio::effect::State;
using aidl::android::media::audio::common::AudioUuid;
extern "C" binder_exception_t createEffect(const AudioUuid* in_impl_uuid,
std::shared_ptr<IEffect>* instanceSpp) {
if (!in_impl_uuid || *in_impl_uuid != kLoudnessEnhancerSwImplUUID) {
if (!in_impl_uuid || *in_impl_uuid != getEffectImplUuidLoudnessEnhancerSw()) {
LOG(ERROR) << __func__ << "uuid not supported";
return EX_ILLEGAL_ARGUMENT;
}
@ -47,7 +49,7 @@ extern "C" binder_exception_t createEffect(const AudioUuid* in_impl_uuid,
}
extern "C" binder_exception_t queryEffect(const AudioUuid* in_impl_uuid, Descriptor* _aidl_return) {
if (!in_impl_uuid || *in_impl_uuid != kLoudnessEnhancerSwImplUUID) {
if (!in_impl_uuid || *in_impl_uuid != getEffectImplUuidLoudnessEnhancerSw()) {
LOG(ERROR) << __func__ << "uuid not supported";
return EX_ILLEGAL_ARGUMENT;
}
@ -59,8 +61,8 @@ namespace aidl::android::hardware::audio::effect {
const std::string LoudnessEnhancerSw::kEffectName = "LoudnessEnhancerSw";
const Descriptor LoudnessEnhancerSw::kDescriptor = {
.common = {.id = {.type = kLoudnessEnhancerTypeUUID,
.uuid = kLoudnessEnhancerSwImplUUID,
.common = {.id = {.type = getEffectTypeUuidLoudnessEnhancer(),
.uuid = getEffectImplUuidLoudnessEnhancerSw(),
.proxy = std::nullopt},
.flags = {.type = Flags::Type::INSERT,
.insert = Flags::Insert::FIRST,

View file

@ -22,7 +22,6 @@
#include <memory>
#include "effect-impl/EffectImpl.h"
#include "effect-impl/EffectUUID.h"
namespace aidl::android::hardware::audio::effect {

View file

@ -17,22 +17,25 @@
#include <algorithm>
#include <cstddef>
#include <memory>
#define LOG_TAG "AHAL_NoiseSuppressionSw"
#define LOG_TAG "AHAL_NoiseSuppressionSw"
#include <android-base/logging.h>
#include <fmq/AidlMessageQueue.h>
#include <system/audio_effects/effect_uuid.h>
#include "NoiseSuppressionSw.h"
using aidl::android::hardware::audio::effect::Descriptor;
using aidl::android::hardware::audio::effect::getEffectImplUuidNoiseSuppressionSw;
using aidl::android::hardware::audio::effect::getEffectTypeUuidNoiseSuppression;
using aidl::android::hardware::audio::effect::IEffect;
using aidl::android::hardware::audio::effect::kNoiseSuppressionSwImplUUID;
using aidl::android::hardware::audio::effect::NoiseSuppressionSw;
using aidl::android::media::audio::common::AudioUuid;
extern "C" binder_exception_t createEffect(const AudioUuid* in_impl_uuid,
std::shared_ptr<IEffect>* instanceSpp) {
if (!in_impl_uuid || *in_impl_uuid != kNoiseSuppressionSwImplUUID) {
if (!in_impl_uuid || *in_impl_uuid != getEffectImplUuidNoiseSuppressionSw()) {
LOG(ERROR) << __func__ << "uuid not supported";
return EX_ILLEGAL_ARGUMENT;
}
@ -47,7 +50,7 @@ extern "C" binder_exception_t createEffect(const AudioUuid* in_impl_uuid,
}
extern "C" binder_exception_t queryEffect(const AudioUuid* in_impl_uuid, Descriptor* _aidl_return) {
if (!in_impl_uuid || *in_impl_uuid != kNoiseSuppressionSwImplUUID) {
if (!in_impl_uuid || *in_impl_uuid != getEffectImplUuidNoiseSuppressionSw()) {
LOG(ERROR) << __func__ << "uuid not supported";
return EX_ILLEGAL_ARGUMENT;
}
@ -59,8 +62,8 @@ namespace aidl::android::hardware::audio::effect {
const std::string NoiseSuppressionSw::kEffectName = "NoiseSuppressionSw";
const Descriptor NoiseSuppressionSw::kDescriptor = {
.common = {.id = {.type = kNoiseSuppressionTypeUUID,
.uuid = kNoiseSuppressionSwImplUUID,
.common = {.id = {.type = getEffectTypeUuidNoiseSuppression(),
.uuid = getEffectImplUuidNoiseSuppressionSw(),
.proxy = std::nullopt},
.flags = {.type = Flags::Type::INSERT,
.insert = Flags::Insert::FIRST,

View file

@ -16,13 +16,13 @@
#pragma once
#include <aidl/android/hardware/audio/effect/BnEffect.h>
#include <fmq/AidlMessageQueue.h>
#include <cstdlib>
#include <memory>
#include <aidl/android/hardware/audio/effect/BnEffect.h>
#include <fmq/AidlMessageQueue.h>
#include "effect-impl/EffectImpl.h"
#include "effect-impl/EffectUUID.h"
namespace aidl::android::hardware::audio::effect {

View file

@ -21,19 +21,21 @@
#include <android-base/logging.h>
#include <android/binder_enums.h>
#include <fmq/AidlMessageQueue.h>
#include <system/audio_effects/effect_uuid.h>
#include "PresetReverbSw.h"
using aidl::android::hardware::audio::effect::Descriptor;
using aidl::android::hardware::audio::effect::getEffectImplUuidPresetReverbSw;
using aidl::android::hardware::audio::effect::getEffectTypeUuidPresetReverb;
using aidl::android::hardware::audio::effect::IEffect;
using aidl::android::hardware::audio::effect::kPresetReverbSwImplUUID;
using aidl::android::hardware::audio::effect::PresetReverbSw;
using aidl::android::hardware::audio::effect::State;
using aidl::android::media::audio::common::AudioUuid;
extern "C" binder_exception_t createEffect(const AudioUuid* in_impl_uuid,
std::shared_ptr<IEffect>* instanceSpp) {
if (!in_impl_uuid || *in_impl_uuid != kPresetReverbSwImplUUID) {
if (!in_impl_uuid || *in_impl_uuid != getEffectImplUuidPresetReverbSw()) {
LOG(ERROR) << __func__ << "uuid not supported";
return EX_ILLEGAL_ARGUMENT;
}
@ -48,7 +50,7 @@ extern "C" binder_exception_t createEffect(const AudioUuid* in_impl_uuid,
}
extern "C" binder_exception_t queryEffect(const AudioUuid* in_impl_uuid, Descriptor* _aidl_return) {
if (!in_impl_uuid || *in_impl_uuid != kPresetReverbSwImplUUID) {
if (!in_impl_uuid || *in_impl_uuid != getEffectImplUuidPresetReverbSw()) {
LOG(ERROR) << __func__ << "uuid not supported";
return EX_ILLEGAL_ARGUMENT;
}
@ -72,8 +74,8 @@ const Capability PresetReverbSw::kCapability = {
.range = Range::make<Range::presetReverb>(PresetReverbSw::kRanges)};
const Descriptor PresetReverbSw::kDescriptor = {
.common = {.id = {.type = kPresetReverbTypeUUID,
.uuid = kPresetReverbSwImplUUID,
.common = {.id = {.type = getEffectTypeUuidPresetReverb(),
.uuid = getEffectImplUuidPresetReverbSw(),
.proxy = std::nullopt},
.flags = {.type = Flags::Type::INSERT,
.insert = Flags::Insert::FIRST,

View file

@ -22,7 +22,6 @@
#include <memory>
#include "effect-impl/EffectImpl.h"
#include "effect-impl/EffectUUID.h"
namespace aidl::android::hardware::audio::effect {

View file

@ -21,12 +21,14 @@
#include <Utils.h>
#include <android-base/logging.h>
#include <fmq/AidlMessageQueue.h>
#include <system/audio_effects/effect_uuid.h>
#include "VirtualizerSw.h"
using aidl::android::hardware::audio::effect::Descriptor;
using aidl::android::hardware::audio::effect::getEffectImplUuidVirtualizerSw;
using aidl::android::hardware::audio::effect::getEffectTypeUuidVirtualizer;
using aidl::android::hardware::audio::effect::IEffect;
using aidl::android::hardware::audio::effect::kVirtualizerSwImplUUID;
using aidl::android::hardware::audio::effect::State;
using aidl::android::hardware::audio::effect::VirtualizerSw;
using aidl::android::media::audio::common::AudioChannelLayout;
@ -36,7 +38,7 @@ using aidl::android::media::audio::common::AudioUuid;
extern "C" binder_exception_t createEffect(const AudioUuid* in_impl_uuid,
std::shared_ptr<IEffect>* instanceSpp) {
if (!in_impl_uuid || *in_impl_uuid != kVirtualizerSwImplUUID) {
if (!in_impl_uuid || *in_impl_uuid != getEffectImplUuidVirtualizerSw()) {
LOG(ERROR) << __func__ << "uuid not supported";
return EX_ILLEGAL_ARGUMENT;
}
@ -51,7 +53,7 @@ extern "C" binder_exception_t createEffect(const AudioUuid* in_impl_uuid,
}
extern "C" binder_exception_t queryEffect(const AudioUuid* in_impl_uuid, Descriptor* _aidl_return) {
if (!in_impl_uuid || *in_impl_uuid != kVirtualizerSwImplUUID) {
if (!in_impl_uuid || *in_impl_uuid != getEffectImplUuidVirtualizerSw()) {
LOG(ERROR) << __func__ << "uuid not supported";
return EX_ILLEGAL_ARGUMENT;
}
@ -73,9 +75,9 @@ const Capability VirtualizerSw::kCapability = {
.range = Range::make<Range::virtualizer>(VirtualizerSw::kRanges)};
const Descriptor VirtualizerSw::kDescriptor = {
.common = {.id = {.type = kVirtualizerTypeUUID,
.uuid = kVirtualizerSwImplUUID,
.proxy = kVirtualizerProxyUUID},
.common = {.id = {.type = getEffectTypeUuidVirtualizer(),
.uuid = getEffectImplUuidVirtualizerSw(),
.proxy = getEffectImplUuidVirtualizerProxy()},
.flags = {.type = Flags::Type::INSERT,
.insert = Flags::Insert::FIRST,
.volume = Flags::Volume::CTRL},

View file

@ -22,7 +22,6 @@
#include <memory>
#include "effect-impl/EffectImpl.h"
#include "effect-impl/EffectUUID.h"
namespace aidl::android::hardware::audio::effect {

View file

@ -17,19 +17,21 @@
#define LOG_TAG "AHAL_VisualizerSw"
#include <android-base/logging.h>
#include <system/audio_effects/effect_uuid.h>
#include "VisualizerSw.h"
using aidl::android::hardware::audio::effect::Descriptor;
using aidl::android::hardware::audio::effect::getEffectImplUuidVisualizerSw;
using aidl::android::hardware::audio::effect::getEffectTypeUuidVisualizer;
using aidl::android::hardware::audio::effect::IEffect;
using aidl::android::hardware::audio::effect::kVisualizerSwImplUUID;
using aidl::android::hardware::audio::effect::State;
using aidl::android::hardware::audio::effect::VisualizerSw;
using aidl::android::media::audio::common::AudioUuid;
extern "C" binder_exception_t createEffect(const AudioUuid* in_impl_uuid,
std::shared_ptr<IEffect>* instanceSpp) {
if (!in_impl_uuid || *in_impl_uuid != kVisualizerSwImplUUID) {
if (!in_impl_uuid || *in_impl_uuid != getEffectImplUuidVisualizerSw()) {
LOG(ERROR) << __func__ << "uuid not supported";
return EX_ILLEGAL_ARGUMENT;
}
@ -44,7 +46,7 @@ extern "C" binder_exception_t createEffect(const AudioUuid* in_impl_uuid,
}
extern "C" binder_exception_t queryEffect(const AudioUuid* in_impl_uuid, Descriptor* _aidl_return) {
if (!in_impl_uuid || *in_impl_uuid != kVisualizerSwImplUUID) {
if (!in_impl_uuid || *in_impl_uuid != getEffectImplUuidVisualizerSw()) {
LOG(ERROR) << __func__ << "uuid not supported";
return EX_ILLEGAL_ARGUMENT;
}
@ -66,8 +68,8 @@ const Capability VisualizerSw::kCapability = {
.range = Range::make<Range::visualizer>(VisualizerSw::kRanges)};
const Descriptor VisualizerSw::kDescriptor = {
.common = {.id = {.type = kVisualizerTypeUUID,
.uuid = kVisualizerSwImplUUID,
.common = {.id = {.type = getEffectTypeUuidVisualizer(),
.uuid = getEffectImplUuidVisualizerSw(),
.proxy = std::nullopt},
.flags = {.type = Flags::Type::INSERT,
.insert = Flags::Insert::FIRST,

View file

@ -16,11 +16,10 @@
#pragma once
#include <aidl/android/hardware/audio/effect/BnEffect.h>
#include <vector>
#include <aidl/android/hardware/audio/effect/BnEffect.h>
#include "effect-impl/EffectImpl.h"
#include "effect-impl/EffectUUID.h"
namespace aidl::android::hardware::audio::effect {

View file

@ -20,19 +20,21 @@
#define LOG_TAG "AHAL_VolumeSw"
#include <android-base/logging.h>
#include <fmq/AidlMessageQueue.h>
#include <system/audio_effects/effect_uuid.h>
#include "VolumeSw.h"
using aidl::android::hardware::audio::effect::Descriptor;
using aidl::android::hardware::audio::effect::getEffectImplUuidVolumeSw;
using aidl::android::hardware::audio::effect::getEffectTypeUuidVolume;
using aidl::android::hardware::audio::effect::IEffect;
using aidl::android::hardware::audio::effect::kVolumeSwImplUUID;
using aidl::android::hardware::audio::effect::State;
using aidl::android::hardware::audio::effect::VolumeSw;
using aidl::android::media::audio::common::AudioUuid;
extern "C" binder_exception_t createEffect(const AudioUuid* in_impl_uuid,
std::shared_ptr<IEffect>* instanceSpp) {
if (!in_impl_uuid || *in_impl_uuid != kVolumeSwImplUUID) {
if (!in_impl_uuid || *in_impl_uuid != getEffectImplUuidVolumeSw()) {
LOG(ERROR) << __func__ << "uuid not supported";
return EX_ILLEGAL_ARGUMENT;
}
@ -47,7 +49,7 @@ extern "C" binder_exception_t createEffect(const AudioUuid* in_impl_uuid,
}
extern "C" binder_exception_t queryEffect(const AudioUuid* in_impl_uuid, Descriptor* _aidl_return) {
if (!in_impl_uuid || *in_impl_uuid != kVolumeSwImplUUID) {
if (!in_impl_uuid || *in_impl_uuid != getEffectImplUuidVolumeSw()) {
LOG(ERROR) << __func__ << "uuid not supported";
return EX_ILLEGAL_ARGUMENT;
}
@ -64,8 +66,8 @@ const std::vector<Range::VolumeRange> VolumeSw::kRanges = {MAKE_RANGE(Volume, le
const Capability VolumeSw::kCapability = {.range = Range::make<Range::volume>(VolumeSw::kRanges)};
const Descriptor VolumeSw::kDescriptor = {
.common = {.id = {.type = kVolumeTypeUUID,
.uuid = kVolumeSwImplUUID,
.common = {.id = {.type = getEffectTypeUuidVolume(),
.uuid = getEffectImplUuidVolumeSw(),
.proxy = std::nullopt},
.flags = {.type = Flags::Type::INSERT,
.insert = Flags::Insert::FIRST,

View file

@ -22,7 +22,6 @@
#include <memory>
#include "effect-impl/EffectImpl.h"
#include "effect-impl/EffectUUID.h"
namespace aidl::android::hardware::audio::effect {

View file

@ -37,6 +37,7 @@ cc_defaults {
"general-tests",
"vts",
],
srcs: [":effectCommonFile"],
}
cc_test {

View file

@ -24,7 +24,6 @@
#include <android/binder_auto_utils.h>
#include "TestUtils.h"
#include "effect-impl/EffectUUID.h"
using namespace android;

View file

@ -31,6 +31,7 @@
#include <fmq/AidlMessageQueue.h>
#include <gtest/gtest.h>
#include <system/audio_effects/aidl_effects_utils.h>
#include <system/audio_effects/effect_uuid.h>
#include "AudioHalBinderServiceUtil.h"
#include "EffectFactoryHelper.h"

View file

@ -29,9 +29,9 @@ using namespace android;
using aidl::android::hardware::audio::effect::AcousticEchoCanceler;
using aidl::android::hardware::audio::effect::Descriptor;
using aidl::android::hardware::audio::effect::getEffectTypeUuidAcousticEchoCanceler;
using aidl::android::hardware::audio::effect::IEffect;
using aidl::android::hardware::audio::effect::IFactory;
using aidl::android::hardware::audio::effect::kAcousticEchoCancelerTypeUUID;
using aidl::android::hardware::audio::effect::Parameter;
using aidl::android::hardware::audio::effect::Range;
@ -148,7 +148,8 @@ INSTANTIATE_TEST_SUITE_P(
AECParamTest, AECParamTest,
::testing::Combine(
testing::ValuesIn(kDescPair = EffectFactoryHelper::getAllEffectDescriptors(
IFactory::descriptor, kAcousticEchoCancelerTypeUUID)),
IFactory::descriptor,
getEffectTypeUuidAcousticEchoCanceler())),
testing::ValuesIn(EffectHelper::getTestValueSet<AcousticEchoCanceler, int,
Range::acousticEchoCanceler,
AcousticEchoCanceler::echoDelayUs>(

View file

@ -24,9 +24,9 @@ using namespace android;
using aidl::android::hardware::audio::effect::AutomaticGainControlV1;
using aidl::android::hardware::audio::effect::Descriptor;
using aidl::android::hardware::audio::effect::getEffectTypeUuidAutomaticGainControlV1;
using aidl::android::hardware::audio::effect::IEffect;
using aidl::android::hardware::audio::effect::IFactory;
using aidl::android::hardware::audio::effect::kAutomaticGainControlV1TypeUUID;
using aidl::android::hardware::audio::effect::Parameter;
enum ParamName {
@ -158,7 +158,8 @@ INSTANTIATE_TEST_SUITE_P(
AGC1ParamTest, AGC1ParamTest,
::testing::Combine(
testing::ValuesIn(kDescPair = EffectFactoryHelper::getAllEffectDescriptors(
IFactory::descriptor, kAutomaticGainControlV1TypeUUID)),
IFactory::descriptor,
getEffectTypeUuidAutomaticGainControlV1())),
testing::ValuesIn(EffectHelper::getTestValueSet<
AutomaticGainControlV1, int, Range::automaticGainControlV1,
AutomaticGainControlV1::targetPeakLevelDbFs>(

View file

@ -25,9 +25,9 @@ using namespace android;
using aidl::android::hardware::audio::effect::AutomaticGainControlV2;
using aidl::android::hardware::audio::effect::Descriptor;
using aidl::android::hardware::audio::effect::getEffectTypeUuidAutomaticGainControlV2;
using aidl::android::hardware::audio::effect::IEffect;
using aidl::android::hardware::audio::effect::IFactory;
using aidl::android::hardware::audio::effect::kAutomaticGainControlV2TypeUUID;
using aidl::android::hardware::audio::effect::Parameter;
enum ParamName {
@ -164,7 +164,8 @@ INSTANTIATE_TEST_SUITE_P(
AGC2ParamTest, AGC2ParamTest,
::testing::Combine(
testing::ValuesIn(kDescPair = EffectFactoryHelper::getAllEffectDescriptors(
IFactory::descriptor, kAutomaticGainControlV2TypeUUID)),
IFactory::descriptor,
getEffectTypeUuidAutomaticGainControlV2())),
testing::ValuesIn(EffectHelper::getTestValueSet<
AutomaticGainControlV2, int, Range::automaticGainControlV2,
AutomaticGainControlV2::fixedDigitalGainMb>(

View file

@ -28,6 +28,7 @@
#include <android/binder_interface_utils.h>
#include <android/binder_manager.h>
#include <android/binder_process.h>
#include <system/audio_effects/effect_uuid.h>
#include <aidl/android/hardware/audio/effect/IFactory.h>
@ -38,10 +39,10 @@
using namespace android;
using aidl::android::hardware::audio::effect::Descriptor;
using aidl::android::hardware::audio::effect::getEffectUuidNull;
using aidl::android::hardware::audio::effect::getEffectUuidZero;
using aidl::android::hardware::audio::effect::IEffect;
using aidl::android::hardware::audio::effect::IFactory;
using aidl::android::hardware::audio::effect::kEffectNullUuid;
using aidl::android::hardware::audio::effect::kEffectZeroUuid;
using aidl::android::hardware::audio::effect::Processing;
using aidl::android::media::audio::common::AudioSource;
using aidl::android::media::audio::common::AudioStreamType;
@ -65,8 +66,8 @@ class EffectFactoryTest : public testing::TestWithParam<std::string> {
std::unique_ptr<EffectFactoryHelper> mFactoryHelper;
std::shared_ptr<IFactory> mEffectFactory;
std::vector<std::shared_ptr<IEffect>> mEffects;
const Descriptor::Identity kNullId = {.uuid = kEffectNullUuid};
const Descriptor::Identity kZeroId = {.uuid = kEffectZeroUuid};
const Descriptor::Identity kNullId = {.uuid = getEffectUuidNull()};
const Descriptor::Identity kZeroId = {.uuid = getEffectUuidZero()};
const Descriptor kNullDesc = {.common.id = kNullId};
const Descriptor kZeroDesc = {.common.id = kZeroId};
@ -132,13 +133,13 @@ TEST_P(EffectFactoryTest, CanBeRestarted) {
TEST_P(EffectFactoryTest, ExpectAllAospEffectTypes) {
std::vector<Descriptor> descs;
std::set<AudioUuid> typeUuidSet(
{aidl::android::hardware::audio::effect::kBassBoostTypeUUID,
aidl::android::hardware::audio::effect::kEqualizerTypeUUID,
aidl::android::hardware::audio::effect::kEnvReverbTypeUUID,
aidl::android::hardware::audio::effect::kPresetReverbTypeUUID,
aidl::android::hardware::audio::effect::kDynamicsProcessingTypeUUID,
aidl::android::hardware::audio::effect::kHapticGeneratorTypeUUID,
aidl::android::hardware::audio::effect::kVirtualizerTypeUUID});
{aidl::android::hardware::audio::effect::getEffectTypeUuidBassBoost(),
aidl::android::hardware::audio::effect::getEffectTypeUuidEqualizer(),
aidl::android::hardware::audio::effect::getEffectTypeUuidEnvReverb(),
aidl::android::hardware::audio::effect::getEffectTypeUuidPresetReverb(),
aidl::android::hardware::audio::effect::getEffectTypeUuidDynamicsProcessing(),
aidl::android::hardware::audio::effect::getEffectTypeUuidHapticGenerator(),
aidl::android::hardware::audio::effect::getEffectTypeUuidVirtualizer()});
EXPECT_IS_OK(mEffectFactory->queryEffects(std::nullopt, std::nullopt, std::nullopt, &descs));
EXPECT_TRUE(descs.size() >= typeUuidSet.size());
@ -155,19 +156,22 @@ TEST_P(EffectFactoryTest, ExpectAllAospEffectTypes) {
TEST_P(EffectFactoryTest, QueryNullTypeUuid) {
std::vector<Descriptor> descs;
EXPECT_IS_OK(mEffectFactory->queryEffects(kEffectNullUuid, std::nullopt, std::nullopt, &descs));
EXPECT_IS_OK(
mEffectFactory->queryEffects(getEffectUuidNull(), std::nullopt, std::nullopt, &descs));
EXPECT_EQ(descs.size(), 0UL);
}
TEST_P(EffectFactoryTest, QueriedNullImplUuid) {
std::vector<Descriptor> descs;
EXPECT_IS_OK(mEffectFactory->queryEffects(std::nullopt, kEffectNullUuid, std::nullopt, &descs));
EXPECT_IS_OK(
mEffectFactory->queryEffects(std::nullopt, getEffectUuidNull(), std::nullopt, &descs));
EXPECT_EQ(descs.size(), 0UL);
}
TEST_P(EffectFactoryTest, QueriedNullProxyUuid) {
std::vector<Descriptor> descs;
EXPECT_IS_OK(mEffectFactory->queryEffects(std::nullopt, std::nullopt, kEffectNullUuid, &descs));
EXPECT_IS_OK(
mEffectFactory->queryEffects(std::nullopt, std::nullopt, getEffectUuidNull(), &descs));
EXPECT_EQ(descs.size(), 0UL);
}

View file

@ -27,9 +27,9 @@ using namespace android;
using aidl::android::hardware::audio::effect::BassBoost;
using aidl::android::hardware::audio::effect::Capability;
using aidl::android::hardware::audio::effect::Descriptor;
using aidl::android::hardware::audio::effect::getEffectTypeUuidBassBoost;
using aidl::android::hardware::audio::effect::IEffect;
using aidl::android::hardware::audio::effect::IFactory;
using aidl::android::hardware::audio::effect::kBassBoostTypeUUID;
using aidl::android::hardware::audio::effect::Parameter;
using aidl::android::hardware::audio::effect::Range;
@ -138,7 +138,7 @@ INSTANTIATE_TEST_SUITE_P(
BassBoostTest, BassBoostParamTest,
::testing::Combine(
testing::ValuesIn(kDescPair = EffectFactoryHelper::getAllEffectDescriptors(
IFactory::descriptor, kBassBoostTypeUUID)),
IFactory::descriptor, getEffectTypeUuidBassBoost())),
testing::ValuesIn(EffectHelper::getTestValueSet<BassBoost, int, Range::bassBoost,
BassBoost::strengthPm>(
kDescPair, EffectHelper::expandTestValueBasic<int>))),

View file

@ -24,10 +24,9 @@ using namespace android;
using aidl::android::hardware::audio::effect::Descriptor;
using aidl::android::hardware::audio::effect::Downmix;
using aidl::android::hardware::audio::effect::getEffectTypeUuidDownmix;
using aidl::android::hardware::audio::effect::IEffect;
using aidl::android::hardware::audio::effect::IFactory;
using aidl::android::hardware::audio::effect::kDownmixTypeUUID;
using aidl::android::hardware::audio::effect::kEffectNullUuid;
using aidl::android::hardware::audio::effect::Parameter;
/**
@ -122,7 +121,7 @@ TEST_P(DownmixParamTest, SetAndGetType) {
INSTANTIATE_TEST_SUITE_P(
DownmixTest, DownmixParamTest,
::testing::Combine(testing::ValuesIn(EffectFactoryHelper::getAllEffectDescriptors(
IFactory::descriptor, kDownmixTypeUUID)),
IFactory::descriptor, getEffectTypeUuidDownmix())),
testing::ValuesIn(kTypeValues)),
[](const testing::TestParamInfo<DownmixParamTest::ParamType>& info) {
auto descriptor = std::get<PARAM_INSTANCE_NAME>(info.param).second;

View file

@ -30,9 +30,9 @@ using namespace android;
using aidl::android::hardware::audio::effect::Descriptor;
using aidl::android::hardware::audio::effect::DynamicsProcessing;
using aidl::android::hardware::audio::effect::getEffectTypeUuidDynamicsProcessing;
using aidl::android::hardware::audio::effect::IEffect;
using aidl::android::hardware::audio::effect::IFactory;
using aidl::android::hardware::audio::effect::kDynamicsProcessingTypeUUID;
using aidl::android::hardware::audio::effect::Parameter;
/**
@ -428,7 +428,7 @@ INSTANTIATE_TEST_SUITE_P(
DynamicsProcessingTest, DynamicsProcessingTestEngineArchitecture,
::testing::Combine(
testing::ValuesIn(EffectFactoryHelper::getAllEffectDescriptors(
IFactory::descriptor, kDynamicsProcessingTypeUUID)),
IFactory::descriptor, getEffectTypeUuidDynamicsProcessing())),
testing::Values(DynamicsProcessing::ResolutionPreference::FAVOR_TIME_RESOLUTION,
DynamicsProcessing::ResolutionPreference::
FAVOR_FREQUENCY_RESOLUTION), // variant
@ -480,7 +480,7 @@ TEST_P(DynamicsProcessingTestInputGain, SetAndGetInputGain) {
INSTANTIATE_TEST_SUITE_P(
DynamicsProcessingTest, DynamicsProcessingTestInputGain,
::testing::Combine(testing::ValuesIn(EffectFactoryHelper::getAllEffectDescriptors(
IFactory::descriptor, kDynamicsProcessingTypeUUID)),
IFactory::descriptor, getEffectTypeUuidDynamicsProcessing())),
testing::ValuesIn(DynamicsProcessingTestInputGain::kInputGainTestSet)),
[](const auto& info) {
auto descriptor = std::get<INPUT_GAIN_INSTANCE_NAME>(info.param).second;
@ -567,7 +567,7 @@ TEST_P(DynamicsProcessingTestLimiterConfig, SetAndGetLimiterConfig) {
INSTANTIATE_TEST_SUITE_P(
DynamicsProcessingTest, DynamicsProcessingTestLimiterConfig,
::testing::Combine(testing::ValuesIn(EffectFactoryHelper::getAllEffectDescriptors(
IFactory::descriptor, kDynamicsProcessingTypeUUID)),
IFactory::descriptor, getEffectTypeUuidDynamicsProcessing())),
testing::Values(-1, 0, 1, 2), // channel count
testing::Bool(), // enable
testing::Values(3), // link group
@ -642,7 +642,7 @@ INSTANTIATE_TEST_SUITE_P(
DynamicsProcessingTest, DynamicsProcessingTestChannelConfig,
::testing::Combine(
testing::ValuesIn(EffectFactoryHelper::getAllEffectDescriptors(
IFactory::descriptor, kDynamicsProcessingTypeUUID)),
IFactory::descriptor, getEffectTypeUuidDynamicsProcessing())),
testing::ValuesIn(
DynamicsProcessingTestHelper::kChannelConfigTestSet), // channel config
testing::Bool()), // Engine inUse
@ -778,7 +778,7 @@ INSTANTIATE_TEST_SUITE_P(
DynamicsProcessingTest, DynamicsProcessingTestEqBandConfig,
::testing::Combine(
testing::ValuesIn(EffectFactoryHelper::getAllEffectDescriptors(
IFactory::descriptor, kDynamicsProcessingTypeUUID)),
IFactory::descriptor, getEffectTypeUuidDynamicsProcessing())),
testing::Values(-1, 0, 10), // channel ID
testing::ValuesIn(
DynamicsProcessingTestHelper::kChannelConfigTestSet), // channel enable
@ -900,7 +900,7 @@ INSTANTIATE_TEST_SUITE_P(
DynamicsProcessingTest, DynamicsProcessingTestMbcBandConfig,
::testing::Combine(
testing::ValuesIn(EffectFactoryHelper::getAllEffectDescriptors(
IFactory::descriptor, kDynamicsProcessingTypeUUID)),
IFactory::descriptor, getEffectTypeUuidDynamicsProcessing())),
testing::Values(-1, 0, 10), // channel count
testing::ValuesIn(
DynamicsProcessingTestHelper::kChannelConfigTestSet), // channel config

View file

@ -24,9 +24,9 @@ using namespace android;
using aidl::android::hardware::audio::effect::Descriptor;
using aidl::android::hardware::audio::effect::EnvironmentalReverb;
using aidl::android::hardware::audio::effect::getEffectTypeUuidEnvReverb;
using aidl::android::hardware::audio::effect::IEffect;
using aidl::android::hardware::audio::effect::IFactory;
using aidl::android::hardware::audio::effect::kEnvReverbTypeUUID;
using aidl::android::hardware::audio::effect::Parameter;
/**
@ -200,7 +200,7 @@ INSTANTIATE_TEST_SUITE_P(
EnvironmentalReverbTest, EnvironmentalReverbRoomLevelTest,
::testing::Combine(
testing::ValuesIn(kDescPair = EffectFactoryHelper::getAllEffectDescriptors(
IFactory::descriptor, kEnvReverbTypeUUID)),
IFactory::descriptor, getEffectTypeUuidEnvReverb())),
testing::ValuesIn(EffectHelper::getTestValueSet<EnvironmentalReverb, int,
Range::environmentalReverb,
EnvironmentalReverb::roomLevelMb>(
@ -239,13 +239,12 @@ TEST_P(EnvironmentalReverbRoomHfLevelTest, SetAndGetRoomHfLevel) {
INSTANTIATE_TEST_SUITE_P(
EnvironmentalReverbTest, EnvironmentalReverbRoomHfLevelTest,
::testing::Combine(
testing::ValuesIn(EffectFactoryHelper::getAllEffectDescriptors(IFactory::descriptor,
kEnvReverbTypeUUID)),
testing::ValuesIn(EffectHelper::getTestValueSet<EnvironmentalReverb, int,
Range::environmentalReverb,
EnvironmentalReverb::roomHfLevelMb>(
kDescPair, EffectHelper::expandTestValueBasic<int>))),
::testing::Combine(testing::ValuesIn(EffectFactoryHelper::getAllEffectDescriptors(
IFactory::descriptor, getEffectTypeUuidEnvReverb())),
testing::ValuesIn(EffectHelper::getTestValueSet<
EnvironmentalReverb, int, Range::environmentalReverb,
EnvironmentalReverb::roomHfLevelMb>(
kDescPair, EffectHelper::expandTestValueBasic<int>))),
[](const testing::TestParamInfo<EnvironmentalReverbRoomHfLevelTest::ParamType>& info) {
auto descriptor = std::get<0>(info.param).second;
std::string roomHfLevel = std::to_string(std::get<1>(info.param));
@ -280,13 +279,12 @@ TEST_P(EnvironmentalReverbDecayTimeTest, SetAndGetDecayTime) {
INSTANTIATE_TEST_SUITE_P(
EnvironmentalReverbTest, EnvironmentalReverbDecayTimeTest,
::testing::Combine(
testing::ValuesIn(EffectFactoryHelper::getAllEffectDescriptors(IFactory::descriptor,
kEnvReverbTypeUUID)),
testing::ValuesIn(EffectHelper::getTestValueSet<EnvironmentalReverb, int,
Range::environmentalReverb,
EnvironmentalReverb::decayTimeMs>(
kDescPair, EffectHelper::expandTestValueBasic<int>))),
::testing::Combine(testing::ValuesIn(EffectFactoryHelper::getAllEffectDescriptors(
IFactory::descriptor, getEffectTypeUuidEnvReverb())),
testing::ValuesIn(EffectHelper::getTestValueSet<
EnvironmentalReverb, int, Range::environmentalReverb,
EnvironmentalReverb::decayTimeMs>(
kDescPair, EffectHelper::expandTestValueBasic<int>))),
[](const testing::TestParamInfo<EnvironmentalReverbDecayTimeTest::ParamType>& info) {
auto descriptor = std::get<0>(info.param).second;
std::string decayTime = std::to_string(std::get<1>(info.param));
@ -322,7 +320,7 @@ TEST_P(EnvironmentalReverbDecayHfRatioTest, SetAndGetDecayHfRatio) {
INSTANTIATE_TEST_SUITE_P(
EnvironmentalReverbTest, EnvironmentalReverbDecayHfRatioTest,
::testing::Combine(testing::ValuesIn(EffectFactoryHelper::getAllEffectDescriptors(
IFactory::descriptor, kEnvReverbTypeUUID)),
IFactory::descriptor, getEffectTypeUuidEnvReverb())),
testing::ValuesIn(EffectHelper::getTestValueSet<
EnvironmentalReverb, int, Range::environmentalReverb,
EnvironmentalReverb::decayHfRatioPm>(
@ -362,13 +360,12 @@ TEST_P(EnvironmentalReverbLevelTest, SetAndGetLevel) {
INSTANTIATE_TEST_SUITE_P(
EnvironmentalReverbTest, EnvironmentalReverbLevelTest,
::testing::Combine(
testing::ValuesIn(EffectFactoryHelper::getAllEffectDescriptors(IFactory::descriptor,
kEnvReverbTypeUUID)),
testing::ValuesIn(EffectHelper::getTestValueSet<EnvironmentalReverb, int,
Range::environmentalReverb,
EnvironmentalReverb::levelMb>(
kDescPair, EffectHelper::expandTestValueBasic<int>))),
::testing::Combine(testing::ValuesIn(EffectFactoryHelper::getAllEffectDescriptors(
IFactory::descriptor, getEffectTypeUuidEnvReverb())),
testing::ValuesIn(EffectHelper::getTestValueSet<
EnvironmentalReverb, int, Range::environmentalReverb,
EnvironmentalReverb::levelMb>(
kDescPair, EffectHelper::expandTestValueBasic<int>))),
[](const testing::TestParamInfo<EnvironmentalReverbDecayHfRatioTest::ParamType>& info) {
auto descriptor = std::get<0>(info.param).second;
std::string level = std::to_string(std::get<1>(info.param));
@ -403,13 +400,12 @@ TEST_P(EnvironmentalReverbDelayTest, SetAndGetDelay) {
INSTANTIATE_TEST_SUITE_P(
EnvironmentalReverbTest, EnvironmentalReverbDelayTest,
::testing::Combine(
testing::ValuesIn(EffectFactoryHelper::getAllEffectDescriptors(IFactory::descriptor,
kEnvReverbTypeUUID)),
testing::ValuesIn(EffectHelper::getTestValueSet<EnvironmentalReverb, int,
Range::environmentalReverb,
EnvironmentalReverb::delayMs>(
kDescPair, EffectHelper::expandTestValueBasic<int>))),
::testing::Combine(testing::ValuesIn(EffectFactoryHelper::getAllEffectDescriptors(
IFactory::descriptor, getEffectTypeUuidEnvReverb())),
testing::ValuesIn(EffectHelper::getTestValueSet<
EnvironmentalReverb, int, Range::environmentalReverb,
EnvironmentalReverb::delayMs>(
kDescPair, EffectHelper::expandTestValueBasic<int>))),
[](const testing::TestParamInfo<EnvironmentalReverbDelayTest::ParamType>& info) {
auto descriptor = std::get<0>(info.param).second;
std::string delay = std::to_string(std::get<1>(info.param));
@ -444,13 +440,12 @@ TEST_P(EnvironmentalReverbDiffusionTest, SetAndGetDiffusion) {
INSTANTIATE_TEST_SUITE_P(
EnvironmentalReverbTest, EnvironmentalReverbDiffusionTest,
::testing::Combine(
testing::ValuesIn(EffectFactoryHelper::getAllEffectDescriptors(IFactory::descriptor,
kEnvReverbTypeUUID)),
testing::ValuesIn(EffectHelper::getTestValueSet<EnvironmentalReverb, int,
Range::environmentalReverb,
EnvironmentalReverb::diffusionPm>(
kDescPair, EffectHelper::expandTestValueBasic<int>))),
::testing::Combine(testing::ValuesIn(EffectFactoryHelper::getAllEffectDescriptors(
IFactory::descriptor, getEffectTypeUuidEnvReverb())),
testing::ValuesIn(EffectHelper::getTestValueSet<
EnvironmentalReverb, int, Range::environmentalReverb,
EnvironmentalReverb::diffusionPm>(
kDescPair, EffectHelper::expandTestValueBasic<int>))),
[](const testing::TestParamInfo<EnvironmentalReverbDiffusionTest::ParamType>& info) {
auto descriptor = std::get<0>(info.param).second;
std::string diffusion = std::to_string(std::get<1>(info.param));
@ -485,13 +480,12 @@ TEST_P(EnvironmentalReverbDensityTest, SetAndGetDensity) {
INSTANTIATE_TEST_SUITE_P(
EnvironmentalReverbTest, EnvironmentalReverbDensityTest,
::testing::Combine(
testing::ValuesIn(EffectFactoryHelper::getAllEffectDescriptors(IFactory::descriptor,
kEnvReverbTypeUUID)),
testing::ValuesIn(EffectHelper::getTestValueSet<EnvironmentalReverb, int,
Range::environmentalReverb,
EnvironmentalReverb::densityPm>(
kDescPair, EffectHelper::expandTestValueBasic<int>))),
::testing::Combine(testing::ValuesIn(EffectFactoryHelper::getAllEffectDescriptors(
IFactory::descriptor, getEffectTypeUuidEnvReverb())),
testing::ValuesIn(EffectHelper::getTestValueSet<
EnvironmentalReverb, int, Range::environmentalReverb,
EnvironmentalReverb::densityPm>(
kDescPair, EffectHelper::expandTestValueBasic<int>))),
[](const testing::TestParamInfo<EnvironmentalReverbDensityTest::ParamType>& info) {
auto descriptor = std::get<0>(info.param).second;
std::string density = std::to_string(std::get<1>(info.param));
@ -527,7 +521,7 @@ TEST_P(EnvironmentalReverbBypassTest, SetAndGetBypass) {
INSTANTIATE_TEST_SUITE_P(
EnvironmentalReverbTest, EnvironmentalReverbBypassTest,
::testing::Combine(testing::ValuesIn(EffectFactoryHelper::getAllEffectDescriptors(
IFactory::descriptor, kEnvReverbTypeUUID)),
IFactory::descriptor, getEffectTypeUuidEnvReverb())),
testing::Bool()),
[](const testing::TestParamInfo<EnvironmentalReverbBypassTest::ParamType>& info) {
auto descriptor = std::get<0>(info.param).second;

View file

@ -37,15 +37,14 @@
#include "AudioHalBinderServiceUtil.h"
#include "EffectHelper.h"
#include "TestUtils.h"
#include "effect-impl/EffectUUID.h"
using namespace android;
using aidl::android::hardware::audio::effect::Descriptor;
using aidl::android::hardware::audio::effect::Equalizer;
using aidl::android::hardware::audio::effect::getEffectTypeUuidEqualizer;
using aidl::android::hardware::audio::effect::IEffect;
using aidl::android::hardware::audio::effect::IFactory;
using aidl::android::hardware::audio::effect::kEqualizerTypeUUID;
using aidl::android::hardware::audio::effect::Parameter;
/**
@ -195,7 +194,7 @@ INSTANTIATE_TEST_SUITE_P(
EqualizerTest, EqualizerTest,
::testing::Combine(
testing::ValuesIn(kDescPair = EffectFactoryHelper::getAllEffectDescriptors(
IFactory::descriptor, kEqualizerTypeUUID)),
IFactory::descriptor, getEffectTypeUuidEqualizer())),
testing::ValuesIn(EffectHelper::getTestValueSet<Equalizer, int, Range::equalizer,
Equalizer::preset>(
kDescPair, EffectHelper::expandTestValueBasic<int>)),

View file

@ -28,10 +28,10 @@
using namespace android;
using aidl::android::hardware::audio::effect::Descriptor;
using aidl::android::hardware::audio::effect::getEffectTypeUuidHapticGenerator;
using aidl::android::hardware::audio::effect::HapticGenerator;
using aidl::android::hardware::audio::effect::IEffect;
using aidl::android::hardware::audio::effect::IFactory;
using aidl::android::hardware::audio::effect::kHapticGeneratorTypeUUID;
using aidl::android::hardware::audio::effect::Parameter;
/**
@ -179,7 +179,7 @@ TEST_P(HapticGeneratorParamTest, SetAndGetVibratorInformation) {
INSTANTIATE_TEST_SUITE_P(
HapticGeneratorValidTest, HapticGeneratorParamTest,
::testing::Combine(testing::ValuesIn(EffectFactoryHelper::getAllEffectDescriptors(
IFactory::descriptor, kHapticGeneratorTypeUUID)),
IFactory::descriptor, getEffectTypeUuidHapticGenerator())),
testing::ValuesIn(kHapticScaleIdValues),
testing::ValuesIn(kVibratorScaleValues),
testing::ValuesIn(kResonantFrequencyValues),
@ -209,7 +209,7 @@ INSTANTIATE_TEST_SUITE_P(
INSTANTIATE_TEST_SUITE_P(
HapticGeneratorInvalidTest, HapticGeneratorParamTest,
::testing::Combine(testing::ValuesIn(EffectFactoryHelper::getAllEffectDescriptors(
IFactory::descriptor, kHapticGeneratorTypeUUID)),
IFactory::descriptor, getEffectTypeUuidHapticGenerator())),
testing::Values(MIN_ID - 1),
testing::Values(HapticGenerator::VibratorScale::NONE),
testing::Values(MIN_FLOAT), testing::Values(MIN_FLOAT),
@ -419,7 +419,7 @@ TEST_P(HapticGeneratorScalesTest, SetMultipleVectorRepeat) {
INSTANTIATE_TEST_SUITE_P(
HapticGeneratorScalesTest, HapticGeneratorScalesTest,
::testing::Combine(testing::ValuesIn(EffectFactoryHelper::getAllEffectDescriptors(
IFactory::descriptor, kHapticGeneratorTypeUUID))),
IFactory::descriptor, getEffectTypeUuidHapticGenerator()))),
[](const testing::TestParamInfo<HapticGeneratorScalesTest::ParamType>& info) {
auto descriptor = std::get<PARAM_INSTANCE_NAME>(info.param).second;
std::string name = "Implementor_" + descriptor.common.implementor + "_name_" +

View file

@ -25,9 +25,9 @@
using namespace android;
using aidl::android::hardware::audio::effect::Descriptor;
using aidl::android::hardware::audio::effect::getEffectTypeUuidLoudnessEnhancer;
using aidl::android::hardware::audio::effect::IEffect;
using aidl::android::hardware::audio::effect::IFactory;
using aidl::android::hardware::audio::effect::kLoudnessEnhancerTypeUUID;
using aidl::android::hardware::audio::effect::LoudnessEnhancer;
using aidl::android::hardware::audio::effect::Parameter;
@ -126,7 +126,7 @@ TEST_P(LoudnessEnhancerParamTest, SetAndGetGainMb) {
INSTANTIATE_TEST_SUITE_P(
LoudnessEnhancerTest, LoudnessEnhancerParamTest,
::testing::Combine(testing::ValuesIn(EffectFactoryHelper::getAllEffectDescriptors(
IFactory::descriptor, kLoudnessEnhancerTypeUUID)),
IFactory::descriptor, getEffectTypeUuidLoudnessEnhancer())),
testing::ValuesIn(kGainMbValues)),
[](const testing::TestParamInfo<LoudnessEnhancerParamTest::ParamType>& info) {
auto descriptor = std::get<PARAM_INSTANCE_NAME>(info.param).second;

View file

@ -27,9 +27,9 @@
using namespace android;
using aidl::android::hardware::audio::effect::Descriptor;
using aidl::android::hardware::audio::effect::getEffectTypeUuidNoiseSuppression;
using aidl::android::hardware::audio::effect::IEffect;
using aidl::android::hardware::audio::effect::IFactory;
using aidl::android::hardware::audio::effect::kNoiseSuppressionTypeUUID;
using aidl::android::hardware::audio::effect::NoiseSuppression;
using aidl::android::hardware::audio::effect::Parameter;
@ -146,7 +146,7 @@ TEST_P(NSParamTest, SetAndGetType) {
INSTANTIATE_TEST_SUITE_P(
NSParamTest, NSParamTest,
::testing::Combine(testing::ValuesIn(EffectFactoryHelper::getAllEffectDescriptors(
IFactory::descriptor, kNoiseSuppressionTypeUUID)),
IFactory::descriptor, getEffectTypeUuidNoiseSuppression())),
testing::ValuesIn(NSParamTest::getLevelValues()),
testing::ValuesIn(NSParamTest::getTypeValues())),
[](const testing::TestParamInfo<NSParamTest::ParamType>& info) {

View file

@ -24,10 +24,9 @@
using namespace android;
using aidl::android::hardware::audio::effect::Descriptor;
using aidl::android::hardware::audio::effect::getEffectTypeUuidPresetReverb;
using aidl::android::hardware::audio::effect::IEffect;
using aidl::android::hardware::audio::effect::IFactory;
using aidl::android::hardware::audio::effect::kEffectNullUuid;
using aidl::android::hardware::audio::effect::kPresetReverbTypeUUID;
using aidl::android::hardware::audio::effect::Parameter;
using aidl::android::hardware::audio::effect::PresetReverb;
@ -132,7 +131,7 @@ TEST_P(PresetReverbParamTest, SetAndGetPresets) {
INSTANTIATE_TEST_SUITE_P(
PresetReverbTest, PresetReverbParamTest,
::testing::Combine(testing::ValuesIn(EffectFactoryHelper::getAllEffectDescriptors(
IFactory::descriptor, kPresetReverbTypeUUID)),
IFactory::descriptor, getEffectTypeUuidPresetReverb())),
testing::ValuesIn(kPresetsValues)),
[](const testing::TestParamInfo<PresetReverbParamTest::ParamType>& info) {
auto descriptor = std::get<PARAM_INSTANCE_NAME>(info.param).second;

View file

@ -23,9 +23,9 @@
using namespace android;
using aidl::android::hardware::audio::effect::Descriptor;
using aidl::android::hardware::audio::effect::getEffectTypeUuidVirtualizer;
using aidl::android::hardware::audio::effect::IEffect;
using aidl::android::hardware::audio::effect::IFactory;
using aidl::android::hardware::audio::effect::kVirtualizerTypeUUID;
using aidl::android::hardware::audio::effect::Parameter;
using aidl::android::hardware::audio::effect::Virtualizer;
@ -134,7 +134,7 @@ INSTANTIATE_TEST_SUITE_P(
VirtualizerTest, VirtualizerParamTest,
::testing::Combine(
testing::ValuesIn(kDescPair = EffectFactoryHelper::getAllEffectDescriptors(
IFactory::descriptor, kVirtualizerTypeUUID)),
IFactory::descriptor, getEffectTypeUuidVirtualizer())),
testing::ValuesIn(EffectHelper::getTestValueSet<
Virtualizer, int, Range::virtualizer, Virtualizer::strengthPm>(
kDescPair, EffectHelper::expandTestValueBasic<int>))),

View file

@ -26,9 +26,9 @@
using namespace android;
using aidl::android::hardware::audio::effect::Descriptor;
using aidl::android::hardware::audio::effect::getEffectTypeUuidVisualizer;
using aidl::android::hardware::audio::effect::IEffect;
using aidl::android::hardware::audio::effect::IFactory;
using aidl::android::hardware::audio::effect::kVisualizerTypeUUID;
using aidl::android::hardware::audio::effect::Parameter;
using aidl::android::hardware::audio::effect::Visualizer;
@ -177,7 +177,7 @@ INSTANTIATE_TEST_SUITE_P(
VisualizerParamTest, VisualizerParamTest,
::testing::Combine(
testing::ValuesIn(kDescPair = EffectFactoryHelper::getAllEffectDescriptors(
IFactory::descriptor, kVisualizerTypeUUID)),
IFactory::descriptor, getEffectTypeUuidVisualizer())),
testing::ValuesIn(EffectHelper::getTestValueSet<Visualizer, int, Range::visualizer,
Visualizer::captureSamples>(
kDescPair, EffectHelper::expandTestValueBasic<int>)),

View file

@ -23,9 +23,9 @@
using namespace android;
using aidl::android::hardware::audio::effect::Descriptor;
using aidl::android::hardware::audio::effect::getEffectTypeUuidVolume;
using aidl::android::hardware::audio::effect::IEffect;
using aidl::android::hardware::audio::effect::IFactory;
using aidl::android::hardware::audio::effect::kVolumeTypeUUID;
using aidl::android::hardware::audio::effect::Parameter;
using aidl::android::hardware::audio::effect::Volume;
@ -140,7 +140,7 @@ INSTANTIATE_TEST_SUITE_P(
VolumeTest, VolumeParamTest,
::testing::Combine(
testing::ValuesIn(kDescPair = EffectFactoryHelper::getAllEffectDescriptors(
IFactory::descriptor, kVolumeTypeUUID)),
IFactory::descriptor, getEffectTypeUuidVolume())),
testing::ValuesIn(
EffectHelper::getTestValueSet<Volume, int, Range::volume, Volume::levelDb>(
kDescPair, EffectHelper::expandTestValueBasic<int>)),