Merge "EnvironmentalReverbTest: Add Tests to Validate Environmental Reverb Effect" into main am: 56e050362d
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/3088945 Change-Id: I0273c55317a36a8b359f49b9a92e1a695f4962fe Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
commit
53e8ea6f82
3 changed files with 334 additions and 413 deletions
|
@ -77,7 +77,6 @@
|
||||||
<effect name="dynamics_processing" library="dynamics_processing" uuid="e0e6539b-1781-7261-676f-6d7573696340"/>
|
<effect name="dynamics_processing" library="dynamics_processing" uuid="e0e6539b-1781-7261-676f-6d7573696340"/>
|
||||||
<effect name="haptic_generator" library="haptic_generator" uuid="97c4acd1-8b82-4f2f-832e-c2fe5d7a9931"/>
|
<effect name="haptic_generator" library="haptic_generator" uuid="97c4acd1-8b82-4f2f-832e-c2fe5d7a9931"/>
|
||||||
<effect name="loudness_enhancer" library="loudness_enhancer" uuid="fa415329-2034-4bea-b5dc-5b381c8d1e2c"/>
|
<effect name="loudness_enhancer" library="loudness_enhancer" uuid="fa415329-2034-4bea-b5dc-5b381c8d1e2c"/>
|
||||||
<effect name="env_reverb" library="env_reverbsw" uuid="fa819886-588b-11ed-9b6a-0242ac120002"/>
|
|
||||||
<effect name="reverb_env_aux" library="reverb" uuid="4a387fc0-8ab3-11df-8bad-0002a5d5c51b"/>
|
<effect name="reverb_env_aux" library="reverb" uuid="4a387fc0-8ab3-11df-8bad-0002a5d5c51b"/>
|
||||||
<effect name="reverb_env_ins" library="reverb" uuid="c7a511a0-a3bb-11df-860e-0002a5d5c51b"/>
|
<effect name="reverb_env_ins" library="reverb" uuid="c7a511a0-a3bb-11df-860e-0002a5d5c51b"/>
|
||||||
<effect name="reverb_pre_aux" library="reverb" uuid="f29a1400-a3bb-11df-8ddc-0002a5d5c51b"/>
|
<effect name="reverb_pre_aux" library="reverb" uuid="f29a1400-a3bb-11df-8ddc-0002a5d5c51b"/>
|
||||||
|
|
|
@ -121,6 +121,9 @@ cc_test {
|
||||||
name: "VtsHalEnvironmentalReverbTargetTest",
|
name: "VtsHalEnvironmentalReverbTargetTest",
|
||||||
defaults: ["VtsHalAudioEffectTargetTestDefaults"],
|
defaults: ["VtsHalAudioEffectTargetTestDefaults"],
|
||||||
srcs: ["VtsHalEnvironmentalReverbTargetTest.cpp"],
|
srcs: ["VtsHalEnvironmentalReverbTargetTest.cpp"],
|
||||||
|
shared_libs: [
|
||||||
|
"libaudioutils",
|
||||||
|
],
|
||||||
}
|
}
|
||||||
|
|
||||||
cc_test {
|
cc_test {
|
||||||
|
|
|
@ -16,28 +16,132 @@
|
||||||
|
|
||||||
#define LOG_TAG "VtsHalEnvironmentalReverbTest"
|
#define LOG_TAG "VtsHalEnvironmentalReverbTest"
|
||||||
#include <android-base/logging.h>
|
#include <android-base/logging.h>
|
||||||
|
#include <audio_utils/power.h>
|
||||||
|
#include <system/audio.h>
|
||||||
|
|
||||||
#include "EffectHelper.h"
|
#include "EffectHelper.h"
|
||||||
|
|
||||||
using namespace android;
|
using namespace android;
|
||||||
|
using namespace aidl::android::hardware::audio::effect;
|
||||||
using aidl::android::hardware::audio::effect::Descriptor;
|
using aidl::android::hardware::audio::common::getChannelCount;
|
||||||
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::Parameter;
|
|
||||||
using android::hardware::audio::common::testing::detail::TestExecutionTracer;
|
using android::hardware::audio::common::testing::detail::TestExecutionTracer;
|
||||||
|
using TagVectorPair = std::pair<EnvironmentalReverb::Tag, std::vector<int>>;
|
||||||
|
using TagValuePair = std::pair<EnvironmentalReverb::Tag, int>;
|
||||||
|
|
||||||
|
static constexpr int kMaxRoomLevel = 0;
|
||||||
|
static constexpr int kMinRoomLevel = -6000;
|
||||||
|
static constexpr int kMinRoomHfLevel = -4000;
|
||||||
|
static constexpr int kMinDecayTime = 0;
|
||||||
|
static constexpr int kMinHfRatio = 100;
|
||||||
|
static constexpr int kMinLevel = -6000;
|
||||||
|
static constexpr int kMinDensity = 0;
|
||||||
|
static constexpr int kMinDiffusion = 0;
|
||||||
|
static constexpr int kMinDelay = 0;
|
||||||
|
|
||||||
|
static const std::vector<TagVectorPair> kParamsIncreasingVector = {
|
||||||
|
|
||||||
|
{EnvironmentalReverb::roomLevelMb, {-3500, -2800, -2100, -1400, -700, 0}},
|
||||||
|
{EnvironmentalReverb::roomHfLevelMb, {-4000, -3200, -2400, -1600, -800, 0}},
|
||||||
|
{EnvironmentalReverb::decayTimeMs, {800, 1600, 2400, 3200, 4000}},
|
||||||
|
{EnvironmentalReverb::decayHfRatioPm, {100, 600, 1100, 1600, 2000}},
|
||||||
|
{EnvironmentalReverb::levelMb, {-3500, -2800, -2100, -1400, -700, 0}},
|
||||||
|
};
|
||||||
|
|
||||||
|
static const std::vector<TagValuePair> kParamsMinimumValue = {
|
||||||
|
{EnvironmentalReverb::roomLevelMb, kMinRoomLevel},
|
||||||
|
{EnvironmentalReverb::decayTimeMs, kMinDecayTime},
|
||||||
|
{EnvironmentalReverb::levelMb, kMinLevel}};
|
||||||
|
|
||||||
|
std::vector<std::pair<std::shared_ptr<IFactory>, Descriptor>> kDescPair;
|
||||||
|
|
||||||
|
using Maker = std::set<int> (*)();
|
||||||
|
static const std::array<Maker, static_cast<int>(EnvironmentalReverb::bypass) + 1>
|
||||||
|
kTestValueSetMaker = {
|
||||||
|
nullptr,
|
||||||
|
[]() -> std::set<int> {
|
||||||
|
return EffectHelper::getTestValueSet<EnvironmentalReverb, int,
|
||||||
|
Range::environmentalReverb,
|
||||||
|
EnvironmentalReverb::roomLevelMb>(
|
||||||
|
kDescPair, EffectHelper::expandTestValueBasic<int>);
|
||||||
|
},
|
||||||
|
[]() -> std::set<int> {
|
||||||
|
return EffectHelper::getTestValueSet<EnvironmentalReverb, int,
|
||||||
|
Range::environmentalReverb,
|
||||||
|
EnvironmentalReverb::roomHfLevelMb>(
|
||||||
|
kDescPair, EffectHelper::expandTestValueBasic<int>);
|
||||||
|
},
|
||||||
|
[]() -> std::set<int> {
|
||||||
|
return EffectHelper::getTestValueSet<EnvironmentalReverb, int,
|
||||||
|
Range::environmentalReverb,
|
||||||
|
EnvironmentalReverb::decayTimeMs>(
|
||||||
|
kDescPair, EffectHelper::expandTestValueBasic<int>);
|
||||||
|
},
|
||||||
|
[]() -> std::set<int> {
|
||||||
|
return EffectHelper::getTestValueSet<EnvironmentalReverb, int,
|
||||||
|
Range::environmentalReverb,
|
||||||
|
EnvironmentalReverb::decayHfRatioPm>(
|
||||||
|
kDescPair, EffectHelper::expandTestValueBasic<int>);
|
||||||
|
},
|
||||||
|
nullptr,
|
||||||
|
nullptr,
|
||||||
|
[]() -> std::set<int> {
|
||||||
|
return EffectHelper::getTestValueSet<EnvironmentalReverb, int,
|
||||||
|
Range::environmentalReverb,
|
||||||
|
EnvironmentalReverb::levelMb>(
|
||||||
|
kDescPair, EffectHelper::expandTestValueBasic<int>);
|
||||||
|
},
|
||||||
|
[]() -> std::set<int> {
|
||||||
|
return EffectHelper::getTestValueSet<EnvironmentalReverb, int,
|
||||||
|
Range::environmentalReverb,
|
||||||
|
EnvironmentalReverb::delayMs>(
|
||||||
|
kDescPair, EffectHelper::expandTestValueBasic<int>);
|
||||||
|
},
|
||||||
|
[]() -> std::set<int> {
|
||||||
|
return EffectHelper::getTestValueSet<EnvironmentalReverb, int,
|
||||||
|
Range::environmentalReverb,
|
||||||
|
EnvironmentalReverb::diffusionPm>(
|
||||||
|
kDescPair, EffectHelper::expandTestValueBasic<int>);
|
||||||
|
},
|
||||||
|
[]() -> std::set<int> {
|
||||||
|
return EffectHelper::getTestValueSet<EnvironmentalReverb, int,
|
||||||
|
Range::environmentalReverb,
|
||||||
|
EnvironmentalReverb::densityPm>(
|
||||||
|
kDescPair, EffectHelper::expandTestValueBasic<int>);
|
||||||
|
},
|
||||||
|
[]() -> std::set<int> {
|
||||||
|
return EffectHelper::getTestValueSet<EnvironmentalReverb, int,
|
||||||
|
Range::environmentalReverb,
|
||||||
|
EnvironmentalReverb::bypass>(
|
||||||
|
kDescPair, EffectHelper::expandTestValueBasic<int>);
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
static std::vector<TagValuePair> buildSetAndGetTestParams() {
|
||||||
|
std::vector<TagValuePair> valueTag;
|
||||||
|
for (EnvironmentalReverb::Tag tag : ndk::enum_range<EnvironmentalReverb::Tag>()) {
|
||||||
|
std::set<int> values;
|
||||||
|
int intTag = static_cast<int>(tag);
|
||||||
|
if (intTag <= static_cast<int>(EnvironmentalReverb::bypass) &&
|
||||||
|
kTestValueSetMaker[intTag] != nullptr) {
|
||||||
|
values = kTestValueSetMaker[intTag]();
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const auto& value : values) {
|
||||||
|
valueTag.push_back(std::make_pair(tag, value));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return valueTag;
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Here we focus on specific parameter checking, general IEffect interfaces testing performed in
|
* Tests do the following:
|
||||||
* VtsAudioEffectTargetTest.
|
* - Testing parameter range supported by the effect. Range is verified with IEffect.getDescriptor()
|
||||||
* Testing parameter range, assuming the parameter supported by effect is in this range.
|
* and range defined in the documentation.
|
||||||
* This range is verified with IEffect.getDescriptor() and range defined in the documentation, for
|
* - Validating the effect by comparing the outputs of the supported parameters.
|
||||||
* any index supported value test expects EX_NONE from IEffect.setParameter(), otherwise expects
|
|
||||||
* EX_ILLEGAL_ARGUMENT.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
enum ParamName { DESCRIPTOR_INDEX, TAG_VALUE_PAIR };
|
||||||
|
|
||||||
class EnvironmentalReverbHelper : public EffectHelper {
|
class EnvironmentalReverbHelper : public EffectHelper {
|
||||||
public:
|
public:
|
||||||
EnvironmentalReverbHelper(std::pair<std::shared_ptr<IFactory>, Descriptor> pair) {
|
EnvironmentalReverbHelper(std::pair<std::shared_ptr<IFactory>, Descriptor> pair) {
|
||||||
|
@ -51,8 +155,7 @@ class EnvironmentalReverbHelper : public EffectHelper {
|
||||||
Parameter::Specific specific = getDefaultParamSpecific();
|
Parameter::Specific specific = getDefaultParamSpecific();
|
||||||
Parameter::Common common = createParamCommon(
|
Parameter::Common common = createParamCommon(
|
||||||
0 /* session */, 1 /* ioHandle */, 44100 /* iSampleRate */, 44100 /* oSampleRate */,
|
0 /* session */, 1 /* ioHandle */, 44100 /* iSampleRate */, 44100 /* oSampleRate */,
|
||||||
kInputFrameCount /* iFrameCount */, kOutputFrameCount /* oFrameCount */);
|
mFrameCount /* iFrameCount */, mFrameCount /* oFrameCount */);
|
||||||
IEffect::OpenEffectReturn ret;
|
|
||||||
ASSERT_NO_FATAL_FAILURE(open(mEffect, common, specific, &ret, EX_NONE));
|
ASSERT_NO_FATAL_FAILURE(open(mEffect, common, specific, &ret, EX_NONE));
|
||||||
ASSERT_NE(nullptr, mEffect);
|
ASSERT_NE(nullptr, mEffect);
|
||||||
}
|
}
|
||||||
|
@ -63,475 +166,291 @@ class EnvironmentalReverbHelper : public EffectHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
Parameter::Specific getDefaultParamSpecific() {
|
Parameter::Specific getDefaultParamSpecific() {
|
||||||
EnvironmentalReverb er = EnvironmentalReverb::make<EnvironmentalReverb::roomLevelMb>(-6000);
|
EnvironmentalReverb er =
|
||||||
|
EnvironmentalReverb::make<EnvironmentalReverb::roomLevelMb>(kMaxRoomLevel);
|
||||||
Parameter::Specific specific =
|
Parameter::Specific specific =
|
||||||
Parameter::Specific::make<Parameter::Specific::environmentalReverb>(er);
|
Parameter::Specific::make<Parameter::Specific::environmentalReverb>(er);
|
||||||
return specific;
|
return specific;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const long kInputFrameCount = 0x100, kOutputFrameCount = 0x100;
|
bool isParamValid(EnvironmentalReverb env) {
|
||||||
std::shared_ptr<IFactory> mFactory;
|
return isParameterValid<EnvironmentalReverb, Range::environmentalReverb>(env, mDescriptor);
|
||||||
std::shared_ptr<IEffect> mEffect;
|
}
|
||||||
Descriptor mDescriptor;
|
|
||||||
int mRoomLevel = -6000;
|
|
||||||
int mRoomHfLevel = 0;
|
|
||||||
int mDecayTime = 1000;
|
|
||||||
int mDecayHfRatio = 500;
|
|
||||||
int mLevel = -6000;
|
|
||||||
int mDelay = 40;
|
|
||||||
int mDiffusion = 1000;
|
|
||||||
int mDensity = 1000;
|
|
||||||
bool mBypass = false;
|
|
||||||
|
|
||||||
void SetAndGetReverbParameters() {
|
Parameter createParam(EnvironmentalReverb env) {
|
||||||
for (auto& it : mTags) {
|
return Parameter::make<Parameter::specific>(
|
||||||
auto& tag = it.first;
|
Parameter::Specific::make<Parameter::Specific::environmentalReverb>(env));
|
||||||
auto& er = it.second;
|
}
|
||||||
|
|
||||||
// validate parameter
|
void setAndVerifyParam(binder_exception_t expected, EnvironmentalReverb env,
|
||||||
Descriptor desc;
|
EnvironmentalReverb::Tag tag) {
|
||||||
ASSERT_STATUS(EX_NONE, mEffect->getDescriptor(&desc));
|
auto expectedParam = createParam(env);
|
||||||
const bool valid = isParameterValid<EnvironmentalReverb, Range::environmentalReverb>(
|
|
||||||
it.second, desc);
|
|
||||||
const binder_exception_t expected = valid ? EX_NONE : EX_ILLEGAL_ARGUMENT;
|
|
||||||
|
|
||||||
// set
|
EXPECT_STATUS(expected, mEffect->setParameter(expectedParam)) << expectedParam.toString();
|
||||||
Parameter expectParam;
|
|
||||||
Parameter::Specific specific;
|
|
||||||
specific.set<Parameter::Specific::environmentalReverb>(er);
|
|
||||||
expectParam.set<Parameter::specific>(specific);
|
|
||||||
EXPECT_STATUS(expected, mEffect->setParameter(expectParam)) << expectParam.toString();
|
|
||||||
|
|
||||||
// only get if parameter in range and set success
|
if (expected == EX_NONE) {
|
||||||
if (expected == EX_NONE) {
|
auto erId = EnvironmentalReverb::Id::make<EnvironmentalReverb::Id::commonTag>(
|
||||||
Parameter getParam;
|
EnvironmentalReverb::Tag(tag));
|
||||||
Parameter::Id id;
|
|
||||||
EnvironmentalReverb::Id erId;
|
auto id = Parameter::Id::make<Parameter::Id::environmentalReverbTag>(erId);
|
||||||
erId.set<EnvironmentalReverb::Id::commonTag>(tag);
|
|
||||||
id.set<Parameter::Id::environmentalReverbTag>(erId);
|
// get parameter
|
||||||
// if set success, then get should match
|
Parameter getParam;
|
||||||
EXPECT_STATUS(expected, mEffect->getParameter(id, &getParam));
|
EXPECT_STATUS(EX_NONE, mEffect->getParameter(id, &getParam));
|
||||||
EXPECT_EQ(expectParam, getParam);
|
EXPECT_EQ(expectedParam, getParam) << "\nexpectedParam:" << expectedParam.toString()
|
||||||
}
|
<< "\ngetParam:" << getParam.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void addRoomLevelParam() {
|
bool isAuxiliary() {
|
||||||
EnvironmentalReverb er;
|
return mDescriptor.common.flags.type ==
|
||||||
er.set<EnvironmentalReverb::roomLevelMb>(mRoomLevel);
|
aidl::android::hardware::audio::effect::Flags::Type::AUXILIARY;
|
||||||
mTags.push_back({EnvironmentalReverb::roomLevelMb, er});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void addRoomHfLevelParam(int roomHfLevel) {
|
float computeOutputEnergy(const std::vector<float>& input, std::vector<float> output) {
|
||||||
EnvironmentalReverb er;
|
if (!isAuxiliary()) {
|
||||||
er.set<EnvironmentalReverb::roomHfLevelMb>(roomHfLevel);
|
// Extract auxiliary output
|
||||||
mTags.push_back({EnvironmentalReverb::roomHfLevelMb, er});
|
for (size_t i = 0; i < output.size(); i++) {
|
||||||
|
output[i] -= input[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return audio_utils_compute_energy_mono(output.data(), AUDIO_FORMAT_PCM_FLOAT,
|
||||||
|
output.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
void addDecayTimeParam(int decayTime) {
|
void generateSineWaveInput(std::vector<float>& input) {
|
||||||
EnvironmentalReverb er;
|
int frequency = 1000;
|
||||||
er.set<EnvironmentalReverb::decayTimeMs>(decayTime);
|
size_t kSamplingFrequency = 44100;
|
||||||
mTags.push_back({EnvironmentalReverb::decayTimeMs, er});
|
for (size_t i = 0; i < input.size(); i++) {
|
||||||
|
input[i] = sin(2 * M_PI * frequency * i / kSamplingFrequency);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
using Maker = EnvironmentalReverb (*)(int);
|
||||||
|
|
||||||
|
static constexpr std::array<Maker, static_cast<int>(EnvironmentalReverb::bypass) + 1>
|
||||||
|
kEnvironmentalReverbParamMaker = {
|
||||||
|
nullptr,
|
||||||
|
[](int value) -> EnvironmentalReverb {
|
||||||
|
return EnvironmentalReverb::make<EnvironmentalReverb::roomLevelMb>(value);
|
||||||
|
},
|
||||||
|
[](int value) -> EnvironmentalReverb {
|
||||||
|
return EnvironmentalReverb::make<EnvironmentalReverb::roomHfLevelMb>(value);
|
||||||
|
},
|
||||||
|
[](int value) -> EnvironmentalReverb {
|
||||||
|
return EnvironmentalReverb::make<EnvironmentalReverb::decayTimeMs>(value);
|
||||||
|
},
|
||||||
|
[](int value) -> EnvironmentalReverb {
|
||||||
|
return EnvironmentalReverb::make<EnvironmentalReverb::decayHfRatioPm>(
|
||||||
|
value);
|
||||||
|
},
|
||||||
|
nullptr,
|
||||||
|
nullptr,
|
||||||
|
[](int value) -> EnvironmentalReverb {
|
||||||
|
return EnvironmentalReverb::make<EnvironmentalReverb::levelMb>(value);
|
||||||
|
},
|
||||||
|
[](int value) -> EnvironmentalReverb {
|
||||||
|
return EnvironmentalReverb::make<EnvironmentalReverb::delayMs>(value);
|
||||||
|
},
|
||||||
|
[](int value) -> EnvironmentalReverb {
|
||||||
|
return EnvironmentalReverb::make<EnvironmentalReverb::diffusionPm>(value);
|
||||||
|
},
|
||||||
|
[](int value) -> EnvironmentalReverb {
|
||||||
|
return EnvironmentalReverb::make<EnvironmentalReverb::densityPm>(value);
|
||||||
|
},
|
||||||
|
[](int value) -> EnvironmentalReverb {
|
||||||
|
return EnvironmentalReverb::make<EnvironmentalReverb::bypass>(value);
|
||||||
|
}};
|
||||||
|
|
||||||
|
void createEnvParam(EnvironmentalReverb::Tag tag, int paramValue) {
|
||||||
|
int intTag = static_cast<int>(tag);
|
||||||
|
if (intTag <= static_cast<int>(EnvironmentalReverb::bypass) &&
|
||||||
|
kEnvironmentalReverbParamMaker[intTag] != NULL) {
|
||||||
|
mEnvParam = kEnvironmentalReverbParamMaker[intTag](paramValue);
|
||||||
|
} else {
|
||||||
|
GTEST_SKIP() << "Invalid parameter, skipping the test\n";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void addDecayHfRatioParam(int decayHfRatio) {
|
void setParameterAndProcess(std::vector<float>& input, std::vector<float>& output, int val,
|
||||||
EnvironmentalReverb er;
|
EnvironmentalReverb::Tag tag) {
|
||||||
er.set<EnvironmentalReverb::decayHfRatioPm>(decayHfRatio);
|
createEnvParam(tag, val);
|
||||||
mTags.push_back({EnvironmentalReverb::decayHfRatioPm, er});
|
if (isParamValid(mEnvParam)) {
|
||||||
|
ASSERT_NO_FATAL_FAILURE(setAndVerifyParam(EX_NONE, mEnvParam, tag));
|
||||||
|
ASSERT_NO_FATAL_FAILURE(processAndWriteToOutput(input, output, mEffect, &ret));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void addLevelParam(int level) {
|
static constexpr int kSamplingFrequency = 44100;
|
||||||
EnvironmentalReverb er;
|
static constexpr int kDurationMilliSec = 500;
|
||||||
er.set<EnvironmentalReverb::levelMb>(level);
|
static constexpr int kBufferSize = kSamplingFrequency * kDurationMilliSec / 1000;
|
||||||
mTags.push_back({EnvironmentalReverb::levelMb, er});
|
|
||||||
}
|
|
||||||
|
|
||||||
void addDelayParam(int delay) {
|
int mStereoChannelCount =
|
||||||
EnvironmentalReverb er;
|
getChannelCount(AudioChannelLayout::make<AudioChannelLayout::layoutMask>(
|
||||||
er.set<EnvironmentalReverb::delayMs>(delay);
|
AudioChannelLayout::LAYOUT_STEREO));
|
||||||
mTags.push_back({EnvironmentalReverb::delayMs, er});
|
int mFrameCount = kBufferSize / mStereoChannelCount;
|
||||||
}
|
|
||||||
|
|
||||||
void addDiffusionParam(int diffusion) {
|
std::shared_ptr<IFactory> mFactory;
|
||||||
EnvironmentalReverb er;
|
std::shared_ptr<IEffect> mEffect;
|
||||||
er.set<EnvironmentalReverb::diffusionPm>(diffusion);
|
IEffect::OpenEffectReturn ret;
|
||||||
mTags.push_back({EnvironmentalReverb::diffusionPm, er});
|
Descriptor mDescriptor;
|
||||||
}
|
EnvironmentalReverb mEnvParam;
|
||||||
|
|
||||||
void addDensityParam(int density) {
|
|
||||||
EnvironmentalReverb er;
|
|
||||||
er.set<EnvironmentalReverb::densityPm>(density);
|
|
||||||
mTags.push_back({EnvironmentalReverb::densityPm, er});
|
|
||||||
}
|
|
||||||
|
|
||||||
void addBypassParam(bool bypass) {
|
|
||||||
EnvironmentalReverb er;
|
|
||||||
er.set<EnvironmentalReverb::bypass>(bypass);
|
|
||||||
mTags.push_back({EnvironmentalReverb::bypass, er});
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
std::vector<std::pair<EnvironmentalReverb::Tag, EnvironmentalReverb>> mTags;
|
|
||||||
void CleanUp() { mTags.clear(); }
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class EnvironmentalReverbRoomLevelTest
|
class EnvironmentalReverbParamTest
|
||||||
: public ::testing::TestWithParam<
|
: public ::testing::TestWithParam<
|
||||||
std::tuple<std::pair<std::shared_ptr<IFactory>, Descriptor>, int>>,
|
std::tuple<std::pair<std::shared_ptr<IFactory>, Descriptor>, TagValuePair>>,
|
||||||
public EnvironmentalReverbHelper {
|
public EnvironmentalReverbHelper {
|
||||||
public:
|
public:
|
||||||
EnvironmentalReverbRoomLevelTest() : EnvironmentalReverbHelper(std::get<0>(GetParam())) {
|
EnvironmentalReverbParamTest()
|
||||||
mRoomLevel = std::get<1>(GetParam());
|
: EnvironmentalReverbHelper(std::get<DESCRIPTOR_INDEX>(GetParam())) {
|
||||||
|
std::tie(mTag, mParamValue) = std::get<TAG_VALUE_PAIR>(GetParam());
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetUp() override { SetUpReverb(); }
|
void SetUp() override { SetUpReverb(); }
|
||||||
|
|
||||||
void TearDown() override { TearDownReverb(); }
|
void TearDown() override { TearDownReverb(); }
|
||||||
|
|
||||||
|
EnvironmentalReverb::Tag mTag;
|
||||||
|
int mParamValue;
|
||||||
};
|
};
|
||||||
|
|
||||||
TEST_P(EnvironmentalReverbRoomLevelTest, SetAndGetRoomLevel) {
|
TEST_P(EnvironmentalReverbParamTest, SetAndGetParameter) {
|
||||||
EXPECT_NO_FATAL_FAILURE(addRoomLevelParam());
|
createEnvParam(mTag, mParamValue);
|
||||||
SetAndGetReverbParameters();
|
ASSERT_NO_FATAL_FAILURE(setAndVerifyParam(
|
||||||
|
isParamValid(mEnvParam) ? EX_NONE : EX_ILLEGAL_ARGUMENT, mEnvParam, mTag));
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<std::pair<std::shared_ptr<IFactory>, Descriptor>> kDescPair;
|
|
||||||
|
|
||||||
INSTANTIATE_TEST_SUITE_P(
|
INSTANTIATE_TEST_SUITE_P(
|
||||||
EnvironmentalReverbTest, EnvironmentalReverbRoomLevelTest,
|
EnvironmentalReverbTest, EnvironmentalReverbParamTest,
|
||||||
::testing::Combine(
|
::testing::Combine(
|
||||||
testing::ValuesIn(kDescPair = EffectFactoryHelper::getAllEffectDescriptors(
|
testing::ValuesIn(kDescPair = EffectFactoryHelper::getAllEffectDescriptors(
|
||||||
IFactory::descriptor, getEffectTypeUuidEnvReverb())),
|
IFactory::descriptor, getEffectTypeUuidEnvReverb())),
|
||||||
testing::ValuesIn(EffectHelper::getTestValueSet<EnvironmentalReverb, int,
|
testing::ValuesIn(buildSetAndGetTestParams())),
|
||||||
Range::environmentalReverb,
|
[](const testing::TestParamInfo<EnvironmentalReverbParamTest::ParamType>& info) {
|
||||||
EnvironmentalReverb::roomLevelMb>(
|
auto descriptor = std::get<DESCRIPTOR_INDEX>(info.param).second;
|
||||||
kDescPair, EffectHelper::expandTestValueBasic<int>))),
|
auto tag = std::get<TAG_VALUE_PAIR>(info.param).first;
|
||||||
[](const testing::TestParamInfo<EnvironmentalReverbRoomLevelTest::ParamType>& info) {
|
auto val = std::get<TAG_VALUE_PAIR>(info.param).second;
|
||||||
auto descriptor = std::get<0>(info.param).second;
|
std::string name =
|
||||||
std::string roomLevel = std::to_string(std::get<1>(info.param));
|
getPrefix(descriptor) + "_Tag_" + toString(tag) + std::to_string(val);
|
||||||
|
|
||||||
std::string name = getPrefix(descriptor) + "_roomLevel" + roomLevel;
|
|
||||||
std::replace_if(
|
std::replace_if(
|
||||||
name.begin(), name.end(), [](const char c) { return !std::isalnum(c); }, '_');
|
name.begin(), name.end(), [](const char c) { return !std::isalnum(c); }, '_');
|
||||||
return name;
|
return name;
|
||||||
});
|
});
|
||||||
GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(EnvironmentalReverbRoomLevelTest);
|
GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(EnvironmentalReverbParamTest);
|
||||||
|
|
||||||
class EnvironmentalReverbRoomHfLevelTest
|
class EnvironmentalReverbDataTest
|
||||||
: public ::testing::TestWithParam<
|
: public ::testing::TestWithParam<
|
||||||
std::tuple<std::pair<std::shared_ptr<IFactory>, Descriptor>, int>>,
|
std::tuple<std::pair<std::shared_ptr<IFactory>, Descriptor>, TagVectorPair>>,
|
||||||
public EnvironmentalReverbHelper {
|
public EnvironmentalReverbHelper {
|
||||||
public:
|
public:
|
||||||
EnvironmentalReverbRoomHfLevelTest() : EnvironmentalReverbHelper(std::get<0>(GetParam())) {
|
EnvironmentalReverbDataTest()
|
||||||
mRoomHfLevel = std::get<1>(GetParam());
|
: EnvironmentalReverbHelper(std::get<DESCRIPTOR_INDEX>(GetParam())) {
|
||||||
|
std::tie(mTag, mParamValues) = std::get<TAG_VALUE_PAIR>(GetParam());
|
||||||
|
mInput.resize(kBufferSize);
|
||||||
|
generateSineWaveInput(mInput);
|
||||||
|
}
|
||||||
|
void SetUp() override { SetUpReverb(); }
|
||||||
|
void TearDown() override { TearDownReverb(); }
|
||||||
|
|
||||||
|
void assertEnergyIncreasingWithParameter(bool bypass) {
|
||||||
|
createEnvParam(EnvironmentalReverb::bypass, bypass);
|
||||||
|
ASSERT_NO_FATAL_FAILURE(setAndVerifyParam(EX_NONE, mEnvParam, EnvironmentalReverb::bypass));
|
||||||
|
float baseEnergy = 0;
|
||||||
|
for (int val : mParamValues) {
|
||||||
|
std::vector<float> output(kBufferSize);
|
||||||
|
setParameterAndProcess(mInput, output, val, mTag);
|
||||||
|
float energy = computeOutputEnergy(mInput, output);
|
||||||
|
ASSERT_GT(energy, baseEnergy);
|
||||||
|
baseEnergy = energy;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetUp() override { SetUpReverb(); }
|
void assertZeroEnergyWithBypass(bool bypass) {
|
||||||
|
createEnvParam(EnvironmentalReverb::bypass, bypass);
|
||||||
|
ASSERT_NO_FATAL_FAILURE(setAndVerifyParam(EX_NONE, mEnvParam, EnvironmentalReverb::bypass));
|
||||||
|
for (int val : mParamValues) {
|
||||||
|
std::vector<float> output(kBufferSize);
|
||||||
|
setParameterAndProcess(mInput, output, val, mTag);
|
||||||
|
float energy = computeOutputEnergy(mInput, output);
|
||||||
|
ASSERT_EQ(energy, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void TearDown() override { TearDownReverb(); }
|
EnvironmentalReverb::Tag mTag;
|
||||||
|
std::vector<int> mParamValues;
|
||||||
|
std::vector<float> mInput;
|
||||||
};
|
};
|
||||||
|
|
||||||
TEST_P(EnvironmentalReverbRoomHfLevelTest, SetAndGetRoomHfLevel) {
|
TEST_P(EnvironmentalReverbDataTest, IncreasingParamValue) {
|
||||||
EXPECT_NO_FATAL_FAILURE(addRoomHfLevelParam(mRoomHfLevel));
|
assertEnergyIncreasingWithParameter(false);
|
||||||
SetAndGetReverbParameters();
|
}
|
||||||
|
|
||||||
|
TEST_P(EnvironmentalReverbDataTest, WithBypassEnabled) {
|
||||||
|
assertZeroEnergyWithBypass(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
INSTANTIATE_TEST_SUITE_P(
|
INSTANTIATE_TEST_SUITE_P(
|
||||||
EnvironmentalReverbTest, EnvironmentalReverbRoomHfLevelTest,
|
EnvironmentalReverbTest, EnvironmentalReverbDataTest,
|
||||||
::testing::Combine(testing::ValuesIn(EffectFactoryHelper::getAllEffectDescriptors(
|
::testing::Combine(
|
||||||
IFactory::descriptor, getEffectTypeUuidEnvReverb())),
|
testing::ValuesIn(kDescPair = EffectFactoryHelper::getAllEffectDescriptors(
|
||||||
testing::ValuesIn(EffectHelper::getTestValueSet<
|
IFactory::descriptor, getEffectTypeUuidEnvReverb())),
|
||||||
EnvironmentalReverb, int, Range::environmentalReverb,
|
testing::ValuesIn(kParamsIncreasingVector)),
|
||||||
EnvironmentalReverb::roomHfLevelMb>(
|
[](const testing::TestParamInfo<EnvironmentalReverbDataTest::ParamType>& info) {
|
||||||
kDescPair, EffectHelper::expandTestValueBasic<int>))),
|
auto descriptor = std::get<DESCRIPTOR_INDEX>(info.param).second;
|
||||||
[](const testing::TestParamInfo<EnvironmentalReverbRoomHfLevelTest::ParamType>& info) {
|
auto tag = std::get<TAG_VALUE_PAIR>(info.param).first;
|
||||||
auto descriptor = std::get<0>(info.param).second;
|
std::string name = getPrefix(descriptor) + "_Tag_" + toString(tag);
|
||||||
std::string roomHfLevel = std::to_string(std::get<1>(info.param));
|
|
||||||
|
|
||||||
std::string name = "Implementor_" + descriptor.common.implementor + "_name_" +
|
|
||||||
descriptor.common.name + "_UUID_" +
|
|
||||||
toString(descriptor.common.id.uuid) + "_roomHfLevel" + roomHfLevel;
|
|
||||||
std::replace_if(
|
|
||||||
name.begin(), name.end(), [](const char c) { return !std::isalnum(c); }, '_');
|
|
||||||
return name;
|
return name;
|
||||||
});
|
});
|
||||||
GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(EnvironmentalReverbRoomHfLevelTest);
|
|
||||||
|
|
||||||
class EnvironmentalReverbDecayTimeTest
|
GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(EnvironmentalReverbDataTest);
|
||||||
|
|
||||||
|
class EnvironmentalReverbMinimumParamTest
|
||||||
: public ::testing::TestWithParam<
|
: public ::testing::TestWithParam<
|
||||||
std::tuple<std::pair<std::shared_ptr<IFactory>, Descriptor>, int>>,
|
std::tuple<std::pair<std::shared_ptr<IFactory>, Descriptor>, TagValuePair>>,
|
||||||
public EnvironmentalReverbHelper {
|
public EnvironmentalReverbHelper {
|
||||||
public:
|
public:
|
||||||
EnvironmentalReverbDecayTimeTest() : EnvironmentalReverbHelper(std::get<0>(GetParam())) {
|
EnvironmentalReverbMinimumParamTest()
|
||||||
mDecayTime = std::get<1>(GetParam());
|
: EnvironmentalReverbHelper(std::get<DESCRIPTOR_INDEX>(GetParam())) {
|
||||||
|
std::tie(mTag, mValue) = std::get<TAG_VALUE_PAIR>(GetParam());
|
||||||
|
}
|
||||||
|
void SetUp() override {
|
||||||
|
SetUpReverb();
|
||||||
|
createEnvParam(EnvironmentalReverb::roomLevelMb, kMinRoomLevel);
|
||||||
|
ASSERT_NO_FATAL_FAILURE(
|
||||||
|
setAndVerifyParam(EX_NONE, mEnvParam, EnvironmentalReverb::roomLevelMb));
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetUp() override { SetUpReverb(); }
|
|
||||||
|
|
||||||
void TearDown() override { TearDownReverb(); }
|
void TearDown() override { TearDownReverb(); }
|
||||||
|
|
||||||
|
EnvironmentalReverb::Tag mTag;
|
||||||
|
int mValue;
|
||||||
};
|
};
|
||||||
|
|
||||||
TEST_P(EnvironmentalReverbDecayTimeTest, SetAndGetDecayTime) {
|
TEST_P(EnvironmentalReverbMinimumParamTest, MinimumValueTest) {
|
||||||
EXPECT_NO_FATAL_FAILURE(addDecayTimeParam(mDecayTime));
|
std::vector<float> input(kBufferSize);
|
||||||
SetAndGetReverbParameters();
|
generateSineWaveInput(input);
|
||||||
|
std::vector<float> output(kBufferSize);
|
||||||
|
setParameterAndProcess(input, output, mValue, mTag);
|
||||||
|
float energy = computeOutputEnergy(input, output);
|
||||||
|
// No Auxiliary output for minimum param values
|
||||||
|
ASSERT_EQ(energy, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
INSTANTIATE_TEST_SUITE_P(
|
INSTANTIATE_TEST_SUITE_P(
|
||||||
EnvironmentalReverbTest, EnvironmentalReverbDecayTimeTest,
|
EnvironmentalReverbTest, EnvironmentalReverbMinimumParamTest,
|
||||||
::testing::Combine(testing::ValuesIn(EffectFactoryHelper::getAllEffectDescriptors(
|
::testing::Combine(
|
||||||
IFactory::descriptor, getEffectTypeUuidEnvReverb())),
|
testing::ValuesIn(kDescPair = EffectFactoryHelper::getAllEffectDescriptors(
|
||||||
testing::ValuesIn(EffectHelper::getTestValueSet<
|
IFactory::descriptor, getEffectTypeUuidEnvReverb())),
|
||||||
EnvironmentalReverb, int, Range::environmentalReverb,
|
testing::ValuesIn(kParamsMinimumValue)),
|
||||||
EnvironmentalReverb::decayTimeMs>(
|
[](const testing::TestParamInfo<EnvironmentalReverbMinimumParamTest::ParamType>& info) {
|
||||||
kDescPair, EffectHelper::expandTestValueBasic<int>))),
|
auto descriptor = std::get<DESCRIPTOR_INDEX>(info.param).second;
|
||||||
[](const testing::TestParamInfo<EnvironmentalReverbDecayTimeTest::ParamType>& info) {
|
auto tag = std::get<TAG_VALUE_PAIR>(info.param).first;
|
||||||
auto descriptor = std::get<0>(info.param).second;
|
auto val = std::get<TAG_VALUE_PAIR>(info.param).second;
|
||||||
std::string decayTime = std::to_string(std::get<1>(info.param));
|
std::string name =
|
||||||
|
getPrefix(descriptor) + "_Tag_" + toString(tag) + std::to_string(val);
|
||||||
std::string name = "Implementor_" + descriptor.common.implementor + "_name_" +
|
|
||||||
descriptor.common.name + "_UUID_" +
|
|
||||||
toString(descriptor.common.id.uuid) + "_decayTime" + decayTime;
|
|
||||||
std::replace_if(
|
std::replace_if(
|
||||||
name.begin(), name.end(), [](const char c) { return !std::isalnum(c); }, '_');
|
name.begin(), name.end(), [](const char c) { return !std::isalnum(c); }, '_');
|
||||||
return name;
|
return name;
|
||||||
});
|
});
|
||||||
GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(EnvironmentalReverbDecayTimeTest);
|
|
||||||
|
|
||||||
class EnvironmentalReverbDecayHfRatioTest
|
GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(EnvironmentalReverbMinimumParamTest);
|
||||||
: public ::testing::TestWithParam<
|
|
||||||
std::tuple<std::pair<std::shared_ptr<IFactory>, Descriptor>, int>>,
|
|
||||||
public EnvironmentalReverbHelper {
|
|
||||||
public:
|
|
||||||
EnvironmentalReverbDecayHfRatioTest() : EnvironmentalReverbHelper(std::get<0>(GetParam())) {
|
|
||||||
mDecayHfRatio = std::get<1>(GetParam());
|
|
||||||
}
|
|
||||||
|
|
||||||
void SetUp() override { SetUpReverb(); }
|
|
||||||
|
|
||||||
void TearDown() override { TearDownReverb(); }
|
|
||||||
};
|
|
||||||
|
|
||||||
TEST_P(EnvironmentalReverbDecayHfRatioTest, SetAndGetDecayHfRatio) {
|
|
||||||
EXPECT_NO_FATAL_FAILURE(addDecayHfRatioParam(mDecayHfRatio));
|
|
||||||
SetAndGetReverbParameters();
|
|
||||||
}
|
|
||||||
|
|
||||||
INSTANTIATE_TEST_SUITE_P(
|
|
||||||
EnvironmentalReverbTest, EnvironmentalReverbDecayHfRatioTest,
|
|
||||||
::testing::Combine(testing::ValuesIn(EffectFactoryHelper::getAllEffectDescriptors(
|
|
||||||
IFactory::descriptor, getEffectTypeUuidEnvReverb())),
|
|
||||||
testing::ValuesIn(EffectHelper::getTestValueSet<
|
|
||||||
EnvironmentalReverb, int, Range::environmentalReverb,
|
|
||||||
EnvironmentalReverb::decayHfRatioPm>(
|
|
||||||
kDescPair, EffectHelper::expandTestValueBasic<int>))),
|
|
||||||
[](const testing::TestParamInfo<EnvironmentalReverbDecayHfRatioTest::ParamType>& info) {
|
|
||||||
auto descriptor = std::get<0>(info.param).second;
|
|
||||||
std::string decayHfRatio = std::to_string(std::get<1>(info.param));
|
|
||||||
|
|
||||||
std::string name = "Implementor_" + descriptor.common.implementor + "_name_" +
|
|
||||||
descriptor.common.name + "_UUID_" +
|
|
||||||
toString(descriptor.common.id.uuid) + "_decayHfRatio" + decayHfRatio;
|
|
||||||
std::replace_if(
|
|
||||||
name.begin(), name.end(), [](const char c) { return !std::isalnum(c); }, '_');
|
|
||||||
return name;
|
|
||||||
});
|
|
||||||
GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(EnvironmentalReverbDecayHfRatioTest);
|
|
||||||
|
|
||||||
class EnvironmentalReverbLevelTest
|
|
||||||
: public ::testing::TestWithParam<
|
|
||||||
std::tuple<std::pair<std::shared_ptr<IFactory>, Descriptor>, int>>,
|
|
||||||
public EnvironmentalReverbHelper {
|
|
||||||
public:
|
|
||||||
EnvironmentalReverbLevelTest() : EnvironmentalReverbHelper(std::get<0>(GetParam())) {
|
|
||||||
mLevel = std::get<1>(GetParam());
|
|
||||||
}
|
|
||||||
|
|
||||||
void SetUp() override { SetUpReverb(); }
|
|
||||||
|
|
||||||
void TearDown() override { TearDownReverb(); }
|
|
||||||
};
|
|
||||||
|
|
||||||
TEST_P(EnvironmentalReverbLevelTest, SetAndGetLevel) {
|
|
||||||
EXPECT_NO_FATAL_FAILURE(addLevelParam(mLevel));
|
|
||||||
SetAndGetReverbParameters();
|
|
||||||
}
|
|
||||||
|
|
||||||
INSTANTIATE_TEST_SUITE_P(
|
|
||||||
EnvironmentalReverbTest, EnvironmentalReverbLevelTest,
|
|
||||||
::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));
|
|
||||||
|
|
||||||
std::string name = "Implementor_" + descriptor.common.implementor + "_name_" +
|
|
||||||
descriptor.common.name + "_UUID_" +
|
|
||||||
toString(descriptor.common.id.uuid) + "_level" + level;
|
|
||||||
std::replace_if(
|
|
||||||
name.begin(), name.end(), [](const char c) { return !std::isalnum(c); }, '_');
|
|
||||||
return name;
|
|
||||||
});
|
|
||||||
GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(EnvironmentalReverbLevelTest);
|
|
||||||
|
|
||||||
class EnvironmentalReverbDelayTest
|
|
||||||
: public ::testing::TestWithParam<
|
|
||||||
std::tuple<std::pair<std::shared_ptr<IFactory>, Descriptor>, int>>,
|
|
||||||
public EnvironmentalReverbHelper {
|
|
||||||
public:
|
|
||||||
EnvironmentalReverbDelayTest() : EnvironmentalReverbHelper(std::get<0>(GetParam())) {
|
|
||||||
mDelay = std::get<1>(GetParam());
|
|
||||||
}
|
|
||||||
|
|
||||||
void SetUp() override { SetUpReverb(); }
|
|
||||||
|
|
||||||
void TearDown() override { TearDownReverb(); }
|
|
||||||
};
|
|
||||||
|
|
||||||
TEST_P(EnvironmentalReverbDelayTest, SetAndGetDelay) {
|
|
||||||
EXPECT_NO_FATAL_FAILURE(addDelayParam(mDelay));
|
|
||||||
SetAndGetReverbParameters();
|
|
||||||
}
|
|
||||||
|
|
||||||
INSTANTIATE_TEST_SUITE_P(
|
|
||||||
EnvironmentalReverbTest, EnvironmentalReverbDelayTest,
|
|
||||||
::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));
|
|
||||||
|
|
||||||
std::string name = "Implementor_" + descriptor.common.implementor + "_name_" +
|
|
||||||
descriptor.common.name + "_UUID_" +
|
|
||||||
toString(descriptor.common.id.uuid) + "_delay" + delay;
|
|
||||||
std::replace_if(
|
|
||||||
name.begin(), name.end(), [](const char c) { return !std::isalnum(c); }, '_');
|
|
||||||
return name;
|
|
||||||
});
|
|
||||||
GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(EnvironmentalReverbDelayTest);
|
|
||||||
|
|
||||||
class EnvironmentalReverbDiffusionTest
|
|
||||||
: public ::testing::TestWithParam<
|
|
||||||
std::tuple<std::pair<std::shared_ptr<IFactory>, Descriptor>, int>>,
|
|
||||||
public EnvironmentalReverbHelper {
|
|
||||||
public:
|
|
||||||
EnvironmentalReverbDiffusionTest() : EnvironmentalReverbHelper(std::get<0>(GetParam())) {
|
|
||||||
mDiffusion = std::get<1>(GetParam());
|
|
||||||
}
|
|
||||||
|
|
||||||
void SetUp() override { SetUpReverb(); }
|
|
||||||
|
|
||||||
void TearDown() override { TearDownReverb(); }
|
|
||||||
};
|
|
||||||
|
|
||||||
TEST_P(EnvironmentalReverbDiffusionTest, SetAndGetDiffusion) {
|
|
||||||
EXPECT_NO_FATAL_FAILURE(addDiffusionParam(mDiffusion));
|
|
||||||
SetAndGetReverbParameters();
|
|
||||||
}
|
|
||||||
|
|
||||||
INSTANTIATE_TEST_SUITE_P(
|
|
||||||
EnvironmentalReverbTest, EnvironmentalReverbDiffusionTest,
|
|
||||||
::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));
|
|
||||||
|
|
||||||
std::string name = "Implementor_" + descriptor.common.implementor + "_name_" +
|
|
||||||
descriptor.common.name + "_UUID_" +
|
|
||||||
toString(descriptor.common.id.uuid) + "_diffusion" + diffusion;
|
|
||||||
std::replace_if(
|
|
||||||
name.begin(), name.end(), [](const char c) { return !std::isalnum(c); }, '_');
|
|
||||||
return name;
|
|
||||||
});
|
|
||||||
GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(EnvironmentalReverbDiffusionTest);
|
|
||||||
|
|
||||||
class EnvironmentalReverbDensityTest
|
|
||||||
: public ::testing::TestWithParam<
|
|
||||||
std::tuple<std::pair<std::shared_ptr<IFactory>, Descriptor>, int>>,
|
|
||||||
public EnvironmentalReverbHelper {
|
|
||||||
public:
|
|
||||||
EnvironmentalReverbDensityTest() : EnvironmentalReverbHelper(std::get<0>(GetParam())) {
|
|
||||||
mDensity = std::get<1>(GetParam());
|
|
||||||
}
|
|
||||||
|
|
||||||
void SetUp() override { SetUpReverb(); }
|
|
||||||
|
|
||||||
void TearDown() override { TearDownReverb(); }
|
|
||||||
};
|
|
||||||
|
|
||||||
TEST_P(EnvironmentalReverbDensityTest, SetAndGetDensity) {
|
|
||||||
EXPECT_NO_FATAL_FAILURE(addDensityParam(mDensity));
|
|
||||||
SetAndGetReverbParameters();
|
|
||||||
}
|
|
||||||
|
|
||||||
INSTANTIATE_TEST_SUITE_P(
|
|
||||||
EnvironmentalReverbTest, EnvironmentalReverbDensityTest,
|
|
||||||
::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));
|
|
||||||
|
|
||||||
std::string name = "Implementor_" + descriptor.common.implementor + "_name_" +
|
|
||||||
descriptor.common.name + "_UUID_" +
|
|
||||||
toString(descriptor.common.id.uuid) + "_density" + density;
|
|
||||||
std::replace_if(
|
|
||||||
name.begin(), name.end(), [](const char c) { return !std::isalnum(c); }, '_');
|
|
||||||
return name;
|
|
||||||
});
|
|
||||||
GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(EnvironmentalReverbDensityTest);
|
|
||||||
|
|
||||||
class EnvironmentalReverbBypassTest
|
|
||||||
: public ::testing::TestWithParam<
|
|
||||||
std::tuple<std::pair<std::shared_ptr<IFactory>, Descriptor>, bool>>,
|
|
||||||
public EnvironmentalReverbHelper {
|
|
||||||
public:
|
|
||||||
EnvironmentalReverbBypassTest() : EnvironmentalReverbHelper(std::get<0>(GetParam())) {
|
|
||||||
mBypass = std::get<1>(GetParam());
|
|
||||||
}
|
|
||||||
|
|
||||||
void SetUp() override { SetUpReverb(); }
|
|
||||||
|
|
||||||
void TearDown() override { TearDownReverb(); }
|
|
||||||
};
|
|
||||||
|
|
||||||
TEST_P(EnvironmentalReverbBypassTest, SetAndGetBypass) {
|
|
||||||
EXPECT_NO_FATAL_FAILURE(addBypassParam(mBypass));
|
|
||||||
SetAndGetReverbParameters();
|
|
||||||
}
|
|
||||||
|
|
||||||
INSTANTIATE_TEST_SUITE_P(
|
|
||||||
EnvironmentalReverbTest, EnvironmentalReverbBypassTest,
|
|
||||||
::testing::Combine(testing::ValuesIn(EffectFactoryHelper::getAllEffectDescriptors(
|
|
||||||
IFactory::descriptor, getEffectTypeUuidEnvReverb())),
|
|
||||||
testing::Bool()),
|
|
||||||
[](const testing::TestParamInfo<EnvironmentalReverbBypassTest::ParamType>& info) {
|
|
||||||
auto descriptor = std::get<0>(info.param).second;
|
|
||||||
std::string bypass = std::to_string(std::get<1>(info.param));
|
|
||||||
|
|
||||||
std::string name = "Implementor_" + descriptor.common.implementor + "_name_" +
|
|
||||||
descriptor.common.name + "_UUID_" +
|
|
||||||
toString(descriptor.common.id.uuid) + "_bypass" + bypass;
|
|
||||||
std::replace_if(
|
|
||||||
name.begin(), name.end(), [](const char c) { return !std::isalnum(c); }, '_');
|
|
||||||
return name;
|
|
||||||
});
|
|
||||||
GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(EnvironmentalReverbBypassTest);
|
|
||||||
|
|
||||||
int main(int argc, char** argv) {
|
int main(int argc, char** argv) {
|
||||||
::testing::InitGoogleTest(&argc, argv);
|
::testing::InitGoogleTest(&argc, argv);
|
||||||
|
|
Loading…
Reference in a new issue