|
|
|
@ -1,10 +1,23 @@ |
|
|
|
|
#include <gtest/gtest.h> |
|
|
|
|
#include <cmath> |
|
|
|
|
|
|
|
|
|
#include "test_fx_helper.h" |
|
|
|
|
#include "wave.h" |
|
|
|
|
|
|
|
|
|
#include "../mixing_console.hpp" |
|
|
|
|
|
|
|
|
|
void normalizedValueInspector(const std::string& el, size_t idx, const float32_t value) |
|
|
|
|
{ |
|
|
|
|
if(std::isnan(value)) |
|
|
|
|
{ |
|
|
|
|
std::cout << "NAN - " << el << " " << idx << " = " << value << std::endl; |
|
|
|
|
} |
|
|
|
|
else if(value != constrain(value, -1.0f, 1.0f)) |
|
|
|
|
{ |
|
|
|
|
std::cout << "OoB - " << el << " " << idx << " = " << value << std::endl; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
TEST(MixerOutputTest, toStringForTube) |
|
|
|
|
{ |
|
|
|
|
auto v = toString(MixerOutput::FX_Tube); |
|
|
|
@ -203,33 +216,27 @@ TEST(MixingConsole, ShimmerProcessing) |
|
|
|
|
mixer->setReturnLevel(MixerOutput::FX_ShimmerReverb, MixerOutput::MainOutput, 1.0f); |
|
|
|
|
mixer->setChannelLevel(0, 1.0f); |
|
|
|
|
mixer->setPan(0, 0.5f); |
|
|
|
|
DUMP2(mixer, std::cout, "Post setup"); |
|
|
|
|
|
|
|
|
|
float32_t in[length] = {0.1, 0.2}; |
|
|
|
|
float32_t out1[StereoChannels::kNumChannels][length]; |
|
|
|
|
for(size_t i = 0; i < StereoChannels::kNumChannels; ++i) memset(out1[i], 0, length * sizeof(float32_t)); |
|
|
|
|
|
|
|
|
|
mixer->setInputSampleBuffer(0, in); |
|
|
|
|
DUMP2(mixer, std::cout, "Post input injection #1"); |
|
|
|
|
|
|
|
|
|
mixer->process( |
|
|
|
|
out1[StereoChannels::Left ], |
|
|
|
|
out1[StereoChannels::Right] |
|
|
|
|
); |
|
|
|
|
DUMP2(mixer, std::cout, "Post processing #1"); |
|
|
|
|
|
|
|
|
|
mixer->reset(); |
|
|
|
|
DUMP2(mixer, std::cout, "Post reset"); |
|
|
|
|
|
|
|
|
|
float32_t out2[StereoChannels::kNumChannels][length]; |
|
|
|
|
mixer->setInputSampleBuffer(0, in); |
|
|
|
|
DUMP2(mixer, std::cout, "Post input injection #2"); |
|
|
|
|
|
|
|
|
|
mixer->process( |
|
|
|
|
out2[StereoChannels::Left ], |
|
|
|
|
out2[StereoChannels::Right] |
|
|
|
|
); |
|
|
|
|
DUMP2(mixer, std::cout, "Post processing #2"); |
|
|
|
|
|
|
|
|
|
EXPECT_EQ(out1[StereoChannels::Left ][0], out2[StereoChannels::Left ][0]); |
|
|
|
|
EXPECT_EQ(out1[StereoChannels::Right][0], out2[StereoChannels::Right][0]); |
|
|
|
@ -239,6 +246,38 @@ TEST(MixingConsole, ShimmerProcessing) |
|
|
|
|
delete mixer; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
TEST(MixingConsole, ShimmerNoiseProcessing) |
|
|
|
|
{ |
|
|
|
|
constexpr size_t length = 1024; |
|
|
|
|
|
|
|
|
|
Mixer* mixer = new Mixer(SAMPLING_FREQUENCY, length); |
|
|
|
|
mixer->reset(); |
|
|
|
|
|
|
|
|
|
mixer->setSendLevel(0, MixerOutput::MainOutput, 0.0f); |
|
|
|
|
mixer->setSendLevel(0, MixerOutput::FX_ShimmerReverb, 1.0f); |
|
|
|
|
mixer->setReturnLevel(MixerOutput::FX_ShimmerReverb, MixerOutput::MainOutput, 1.0f); |
|
|
|
|
mixer->setChannelLevel(0, 1.0f); |
|
|
|
|
mixer->setPan(0, 0.5f); |
|
|
|
|
INSPECT(mixer, normalizedValueInspector); |
|
|
|
|
|
|
|
|
|
float32_t in[length]; |
|
|
|
|
for(size_t i = 0; i < length; ++i) in[i] = getRandomValue(); |
|
|
|
|
|
|
|
|
|
float32_t out[StereoChannels::kNumChannels][length]; |
|
|
|
|
for(size_t i = 0; i < StereoChannels::kNumChannels; ++i) memset(out[i], 0, length * sizeof(float32_t)); |
|
|
|
|
|
|
|
|
|
mixer->setInputSampleBuffer(0, in); |
|
|
|
|
INSPECT(mixer, normalizedValueInspector); |
|
|
|
|
|
|
|
|
|
mixer->process( |
|
|
|
|
out[StereoChannels::Left ], |
|
|
|
|
out[StereoChannels::Right] |
|
|
|
|
); |
|
|
|
|
INSPECT(mixer, normalizedValueInspector); |
|
|
|
|
|
|
|
|
|
delete mixer; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
TEST(MixingConsole, SimpleProcessing) |
|
|
|
|
{ |
|
|
|
|
const unsigned nbRepeats = 4; |
|
|
|
|