Loading media/libeffects/hapticgenerator/aidl/EffectHapticGenerator.cpp +15 −1 Original line number Diff line number Diff line Loading @@ -55,6 +55,17 @@ extern "C" binder_exception_t queryEffect(const AudioUuid* in_impl_uuid, Descrip namespace aidl::android::hardware::audio::effect { const std::vector<Range::HapticGeneratorRange> kHapticRange = { MAKE_RANGE(HapticGenerator, vibratorInfo, HapticGenerator::VibratorInformation( {.resonantFrequencyHz = 1, .qFactor = 1, .maxAmplitude = -1}), HapticGenerator::VibratorInformation( {.resonantFrequencyHz = std::numeric_limits<float>::max(), .qFactor = std::numeric_limits<float>::max(), .maxAmplitude = 1}))}; static const Capability kHapticCap = {.range = kHapticRange}; const std::string HapticGeneratorImpl::kEffectName = "Haptic Generator"; const Descriptor HapticGeneratorImpl::kDescriptor = { .common = {.id = {.type = getEffectTypeUuidHapticGenerator(), Loading @@ -62,7 +73,8 @@ const Descriptor HapticGeneratorImpl::kDescriptor = { .proxy = std::nullopt}, .flags = {.type = Flags::Type::INSERT, .insert = Flags::Insert::FIRST}, .name = HapticGeneratorImpl::kEffectName, .implementor = "The Android Open Source Project"}}; .implementor = "The Android Open Source Project"}, .capability = kHapticCap}; ndk::ScopedAStatus HapticGeneratorImpl::getDescriptor(Descriptor* _aidl_return) { RETURN_IF(!_aidl_return, EX_ILLEGAL_ARGUMENT, "Parameter:nullptr"); Loading @@ -76,6 +88,8 @@ ndk::ScopedAStatus HapticGeneratorImpl::setParameterSpecific(const Parameter::Sp RETURN_IF(!mContext, EX_NULL_POINTER, "nullContext"); auto& hgParam = specific.get<Parameter::Specific::hapticGenerator>(); RETURN_IF(!inRange(hgParam, kHapticRange), EX_ILLEGAL_ARGUMENT, "outOfRange"); auto tag = hgParam.getTag(); switch (tag) { Loading media/libeffects/hapticgenerator/aidl/HapticGeneratorContext.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -353,7 +353,7 @@ float* HapticGeneratorContext::runProcessingChain(float* buf1, float* buf2, size std::string HapticGeneratorContext::paramToString(const struct HapticGeneratorParam& param) const { std::stringstream ss; ss << "\t\ttHapticGenerator Parameters:\n"; ss << "\t\tHapticGenerator Parameters:\n"; ss << "\t\t- mHapticChannelCount: " << param.mHapticChannelCount << '\n'; ss << "\t\t- mAudioChannelCount: " << param.mAudioChannelCount << '\n'; ss << "\t\t- mHapticChannelSource: " << param.mHapticChannelSource[0] << ", " Loading @@ -378,7 +378,7 @@ std::string HapticGeneratorContext::contextToString() const { ss << "\t\t- distortion input gain: " << DEFAULT_DISTORTION_INPUT_GAIN << '\n'; ss << "\t\t- distortion cube threshold: " << DEFAULT_DISTORTION_CUBE_THRESHOLD << '\n'; ss << "\t\t- distortion output gain: " << getDistortionOutputGain() << '\n'; ss << "\t\tHapticGenerator Parameters:\n" << paramToString(mParams) << "\n"; ss << paramToString(mParams) << "\n"; return ss.str(); } Loading Loading
media/libeffects/hapticgenerator/aidl/EffectHapticGenerator.cpp +15 −1 Original line number Diff line number Diff line Loading @@ -55,6 +55,17 @@ extern "C" binder_exception_t queryEffect(const AudioUuid* in_impl_uuid, Descrip namespace aidl::android::hardware::audio::effect { const std::vector<Range::HapticGeneratorRange> kHapticRange = { MAKE_RANGE(HapticGenerator, vibratorInfo, HapticGenerator::VibratorInformation( {.resonantFrequencyHz = 1, .qFactor = 1, .maxAmplitude = -1}), HapticGenerator::VibratorInformation( {.resonantFrequencyHz = std::numeric_limits<float>::max(), .qFactor = std::numeric_limits<float>::max(), .maxAmplitude = 1}))}; static const Capability kHapticCap = {.range = kHapticRange}; const std::string HapticGeneratorImpl::kEffectName = "Haptic Generator"; const Descriptor HapticGeneratorImpl::kDescriptor = { .common = {.id = {.type = getEffectTypeUuidHapticGenerator(), Loading @@ -62,7 +73,8 @@ const Descriptor HapticGeneratorImpl::kDescriptor = { .proxy = std::nullopt}, .flags = {.type = Flags::Type::INSERT, .insert = Flags::Insert::FIRST}, .name = HapticGeneratorImpl::kEffectName, .implementor = "The Android Open Source Project"}}; .implementor = "The Android Open Source Project"}, .capability = kHapticCap}; ndk::ScopedAStatus HapticGeneratorImpl::getDescriptor(Descriptor* _aidl_return) { RETURN_IF(!_aidl_return, EX_ILLEGAL_ARGUMENT, "Parameter:nullptr"); Loading @@ -76,6 +88,8 @@ ndk::ScopedAStatus HapticGeneratorImpl::setParameterSpecific(const Parameter::Sp RETURN_IF(!mContext, EX_NULL_POINTER, "nullContext"); auto& hgParam = specific.get<Parameter::Specific::hapticGenerator>(); RETURN_IF(!inRange(hgParam, kHapticRange), EX_ILLEGAL_ARGUMENT, "outOfRange"); auto tag = hgParam.getTag(); switch (tag) { Loading
media/libeffects/hapticgenerator/aidl/HapticGeneratorContext.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -353,7 +353,7 @@ float* HapticGeneratorContext::runProcessingChain(float* buf1, float* buf2, size std::string HapticGeneratorContext::paramToString(const struct HapticGeneratorParam& param) const { std::stringstream ss; ss << "\t\ttHapticGenerator Parameters:\n"; ss << "\t\tHapticGenerator Parameters:\n"; ss << "\t\t- mHapticChannelCount: " << param.mHapticChannelCount << '\n'; ss << "\t\t- mAudioChannelCount: " << param.mAudioChannelCount << '\n'; ss << "\t\t- mHapticChannelSource: " << param.mHapticChannelSource[0] << ", " Loading @@ -378,7 +378,7 @@ std::string HapticGeneratorContext::contextToString() const { ss << "\t\t- distortion input gain: " << DEFAULT_DISTORTION_INPUT_GAIN << '\n'; ss << "\t\t- distortion cube threshold: " << DEFAULT_DISTORTION_CUBE_THRESHOLD << '\n'; ss << "\t\t- distortion output gain: " << getDistortionOutputGain() << '\n'; ss << "\t\tHapticGenerator Parameters:\n" << paramToString(mParams) << "\n"; ss << paramToString(mParams) << "\n"; return ss.str(); } Loading