VtsHalTargetTest: Configure channel layout and generate input data
correctly
This commit includes multiple changes:
- Updated generateSineWave function to generate both mono and stereo data
- Moved the calculateMagnitude function to a common location, the EffectHelper
class and added support for both mono and stereo data
- Modified the createParamCommon function
- Moved some constants to a common location, EffectHelper.h
- Updated some test functions to add support for both mono and stereo
- Added a function in EffectHelper to validate pffft input size
- Added checks in calculateMagnitudeMono() function to validate
input and output buffer size
Bug: 305866207
Test: atest hardware/interfaces/audio/aidl/vts/
Change-Id: Ia68108ad79349559b5b12bd6574da79fb1e117f3
diff --git a/audio/aidl/vts/VtsHalLoudnessEnhancerTargetTest.cpp b/audio/aidl/vts/VtsHalLoudnessEnhancerTargetTest.cpp
index 4c868a9..ace0597 100644
--- a/audio/aidl/vts/VtsHalLoudnessEnhancerTargetTest.cpp
+++ b/audio/aidl/vts/VtsHalLoudnessEnhancerTargetTest.cpp
@@ -153,9 +153,8 @@
public:
LoudnessEnhancerDataTest() {
std::tie(mFactory, mDescriptor) = GetParam();
- size_t channelCount =
- getChannelCount(AudioChannelLayout::make<AudioChannelLayout::layoutMask>(
- AudioChannelLayout::LAYOUT_STEREO));
+ size_t channelCount = getChannelCount(
+ AudioChannelLayout::make<AudioChannelLayout::layoutMask>(kDefaultChannelLayout));
mBufferSizeInFrames = kFrameCount * channelCount;
mInputBuffer.resize(mBufferSizeInFrames);
generateInputBuffer(mInputBuffer, 0, true, channelCount, kMaxAudioSampleValue);