|
|
|
@ -6,16 +6,27 @@ |
|
|
|
|
|
|
|
|
|
#include "../mixing_console.hpp" |
|
|
|
|
|
|
|
|
|
void normalizedValueInspector(const std::string& el, size_t idx, const float32_t value) |
|
|
|
|
size_t nanValueInspector(const std::string& el, size_t idx, const float32_t value) |
|
|
|
|
{ |
|
|
|
|
if(std::isnan(value)) |
|
|
|
|
{ |
|
|
|
|
std::cout << "NAN - " << el << " " << idx << " = " << value << std::endl; |
|
|
|
|
return 1u; |
|
|
|
|
} |
|
|
|
|
else if(value != constrain(value, -1.0f, 1.0f)) |
|
|
|
|
|
|
|
|
|
return 0u; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
size_t normalizedValueInspector(const std::string& el, size_t idx, const float32_t value) |
|
|
|
|
{ |
|
|
|
|
if(!std::isnan(value)) |
|
|
|
|
{ |
|
|
|
|
std::cout << "OoB - " << el << " " << idx << " = " << value << std::endl; |
|
|
|
|
if(value != constrain(value, -1.0f, 1.0f)) |
|
|
|
|
{ |
|
|
|
|
return 1u; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return 0u; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
class MixingConsoleScenarioTest : public testing::TestWithParam<MixerOutput> {}; |
|
|
|
@ -34,29 +45,36 @@ typedef MixingConsole<8> Mixer; |
|
|
|
|
|
|
|
|
|
void setupMixingConsoleFX(Mixer* mixer) |
|
|
|
|
{ |
|
|
|
|
mixer->getTube()->setMute(false); |
|
|
|
|
mixer->getTube()->setOverdrive(0.25f); |
|
|
|
|
|
|
|
|
|
mixer->getChorus()->setMute(false); |
|
|
|
|
mixer->getChorus()->setRate(0.4f); |
|
|
|
|
mixer->getChorus()->setDepth(0.5f); |
|
|
|
|
|
|
|
|
|
mixer->getPhaser()->setRate(0.1f); |
|
|
|
|
mixer->getPhaser()->setDepth(1.0f); |
|
|
|
|
mixer->getPhaser()->setFeedback(0.5f); |
|
|
|
|
mixer->getPhaser()->setNbStages(12); |
|
|
|
|
mixer->getFlanger()->setMute(false); |
|
|
|
|
mixer->getFlanger()->setRate(0.03f); |
|
|
|
|
mixer->getFlanger()->setDepth(0.75f); |
|
|
|
|
mixer->getFlanger()->setFeedback(0.5f); |
|
|
|
|
|
|
|
|
|
mixer->getOrbitone()->setMute(false); |
|
|
|
|
mixer->getOrbitone()->setRate(0.4f); |
|
|
|
|
mixer->getOrbitone()->setDepth(0.5f); |
|
|
|
|
|
|
|
|
|
mixer->getFlanger()->setRate(0.03f); |
|
|
|
|
mixer->getFlanger()->setDepth(0.75f); |
|
|
|
|
mixer->getFlanger()->setFeedback(0.5f); |
|
|
|
|
mixer->getPhaser()->setMute(false); |
|
|
|
|
mixer->getPhaser()->setRate(0.1f); |
|
|
|
|
mixer->getPhaser()->setDepth(1.0f); |
|
|
|
|
mixer->getPhaser()->setFeedback(0.5f); |
|
|
|
|
mixer->getPhaser()->setNbStages(12); |
|
|
|
|
|
|
|
|
|
mixer->getDelay()->setMute(false); |
|
|
|
|
mixer->getDelay()->setLeftDelayTime(0.5f); |
|
|
|
|
mixer->getDelay()->setLeftDelayTime(0.7f); |
|
|
|
|
mixer->getDelay()->setFeedback(0.7f); |
|
|
|
|
mixer->getDelay()->setFlutterRate(0.7f); |
|
|
|
|
mixer->getDelay()->setFlutterAmount(0.7f); |
|
|
|
|
|
|
|
|
|
mixer->getPlateReverb()->setMute(false); |
|
|
|
|
mixer->getPlateReverb()->set_bypass(false); |
|
|
|
|
mixer->getPlateReverb()->size(0.7f); |
|
|
|
|
mixer->getPlateReverb()->hidamp(0.5f); |
|
|
|
@ -65,6 +83,7 @@ void setupMixingConsoleFX(Mixer* mixer) |
|
|
|
|
mixer->getPlateReverb()->diffusion(0.65f); |
|
|
|
|
mixer->getPlateReverb()->level(1.0f); |
|
|
|
|
|
|
|
|
|
mixer->getShimmerReverb()->setMute(false); |
|
|
|
|
mixer->getShimmerReverb()->setInputGain(0.65f); |
|
|
|
|
mixer->getShimmerReverb()->setTime(0.89f); |
|
|
|
|
mixer->getShimmerReverb()->setDiffusion(0.75f); |
|
|
|
@ -96,20 +115,23 @@ TEST(MixingConsole, DryProcessing) |
|
|
|
|
mixer->setChannelLevel(0, 1.0f); |
|
|
|
|
mixer->setPan(0, 0.5f); |
|
|
|
|
mixer->setSendLevel(0, MixerOutput::MainOutput, 1.0f); |
|
|
|
|
DUMP2(mixer, std::cout, "Post setup"); |
|
|
|
|
EXPECT_EQ(0, INSPECT(mixer, nanValueInspector)); |
|
|
|
|
EXPECT_EQ(0, INSPECT(mixer, normalizedValueInspector)); |
|
|
|
|
|
|
|
|
|
float32_t in[length] = {0.1, 0.2}; |
|
|
|
|
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); |
|
|
|
|
DUMP2(mixer, std::cout, "Post input injection"); |
|
|
|
|
EXPECT_EQ(0, INSPECT(mixer, nanValueInspector)); |
|
|
|
|
EXPECT_EQ(0, INSPECT(mixer, normalizedValueInspector)); |
|
|
|
|
|
|
|
|
|
mixer->process( |
|
|
|
|
out[StereoChannels::Left ], |
|
|
|
|
out[StereoChannels::Right] |
|
|
|
|
); |
|
|
|
|
DUMP2(mixer, std::cout, "Post processing"); |
|
|
|
|
EXPECT_EQ(0, INSPECT(mixer, nanValueInspector)); |
|
|
|
|
EXPECT_EQ(0, INSPECT(mixer, normalizedValueInspector)); |
|
|
|
|
|
|
|
|
|
EXPECT_EQ(out[StereoChannels::Left ][0], out[StereoChannels::Right][0]); |
|
|
|
|
EXPECT_EQ(out[StereoChannels::Left ][1], out[StereoChannels::Right][1]); |
|
|
|
@ -132,27 +154,40 @@ TEST(MixingConsole, ShimmerProcessing) |
|
|
|
|
mixer->setReturnLevel(MixerOutput::FX_ShimmerReverb, MixerOutput::MainOutput, 1.0f); |
|
|
|
|
mixer->setChannelLevel(0, 1.0f); |
|
|
|
|
mixer->setPan(0, 0.5f); |
|
|
|
|
EXPECT_EQ(0, INSPECT(mixer, nanValueInspector)); |
|
|
|
|
EXPECT_EQ(0, INSPECT(mixer, normalizedValueInspector)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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); |
|
|
|
|
EXPECT_EQ(0, INSPECT(mixer, nanValueInspector)); |
|
|
|
|
EXPECT_EQ(0, INSPECT(mixer, normalizedValueInspector)); |
|
|
|
|
|
|
|
|
|
mixer->process( |
|
|
|
|
out1[StereoChannels::Left ], |
|
|
|
|
out1[StereoChannels::Right] |
|
|
|
|
); |
|
|
|
|
EXPECT_EQ(0, INSPECT(mixer, nanValueInspector)); |
|
|
|
|
EXPECT_EQ(0, INSPECT(mixer, normalizedValueInspector)); |
|
|
|
|
|
|
|
|
|
mixer->reset(); |
|
|
|
|
EXPECT_EQ(0, INSPECT(mixer, nanValueInspector)); |
|
|
|
|
EXPECT_EQ(0, INSPECT(mixer, normalizedValueInspector)); |
|
|
|
|
|
|
|
|
|
float32_t out2[StereoChannels::kNumChannels][length]; |
|
|
|
|
mixer->setInputSampleBuffer(0, in); |
|
|
|
|
EXPECT_EQ(0, INSPECT(mixer, nanValueInspector)); |
|
|
|
|
EXPECT_EQ(0, INSPECT(mixer, normalizedValueInspector)); |
|
|
|
|
|
|
|
|
|
mixer->process( |
|
|
|
|
out2[StereoChannels::Left ], |
|
|
|
|
out2[StereoChannels::Right] |
|
|
|
|
); |
|
|
|
|
EXPECT_EQ(0, INSPECT(mixer, nanValueInspector)); |
|
|
|
|
EXPECT_EQ(0, INSPECT(mixer, normalizedValueInspector)); |
|
|
|
|
|
|
|
|
|
EXPECT_EQ(out1[StereoChannels::Left ][0], out2[StereoChannels::Left ][0]); |
|
|
|
|
EXPECT_EQ(out1[StereoChannels::Right][0], out2[StereoChannels::Right][0]); |
|
|
|
@ -174,7 +209,8 @@ TEST(MixingConsole, ShimmerNoiseProcessing) |
|
|
|
|
mixer->setReturnLevel(MixerOutput::FX_ShimmerReverb, MixerOutput::MainOutput, 1.0f); |
|
|
|
|
mixer->setChannelLevel(0, 1.0f); |
|
|
|
|
mixer->setPan(0, 0.5f); |
|
|
|
|
INSPECT(mixer, normalizedValueInspector); |
|
|
|
|
EXPECT_EQ(0, INSPECT(mixer, nanValueInspector)); |
|
|
|
|
EXPECT_EQ(0, INSPECT(mixer, normalizedValueInspector)); |
|
|
|
|
|
|
|
|
|
float32_t in[length]; |
|
|
|
|
for(size_t i = 0; i < length; ++i) in[i] = getRandomValue(); |
|
|
|
@ -183,20 +219,22 @@ TEST(MixingConsole, ShimmerNoiseProcessing) |
|
|
|
|
for(size_t i = 0; i < StereoChannels::kNumChannels; ++i) memset(out[i], 0, length * sizeof(float32_t)); |
|
|
|
|
|
|
|
|
|
mixer->setInputSampleBuffer(0, in); |
|
|
|
|
INSPECT(mixer, normalizedValueInspector); |
|
|
|
|
EXPECT_EQ(0, INSPECT(mixer, nanValueInspector)); |
|
|
|
|
EXPECT_EQ(0, INSPECT(mixer, normalizedValueInspector)); |
|
|
|
|
|
|
|
|
|
mixer->process( |
|
|
|
|
out[StereoChannels::Left ], |
|
|
|
|
out[StereoChannels::Right] |
|
|
|
|
); |
|
|
|
|
INSPECT(mixer, normalizedValueInspector); |
|
|
|
|
EXPECT_EQ(0, INSPECT(mixer, nanValueInspector)); |
|
|
|
|
EXPECT_EQ(0, INSPECT(mixer, normalizedValueInspector)); |
|
|
|
|
|
|
|
|
|
delete mixer; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
TEST(MixingConsole, SimpleProcessing) |
|
|
|
|
{ |
|
|
|
|
const unsigned nbRepeats = 4; |
|
|
|
|
const unsigned nbRepeats = 2; |
|
|
|
|
unsigned size; |
|
|
|
|
float32_t** samples = readWaveFile(AUDIO_SOURCE_FILE, size); |
|
|
|
|
float32_t* sampleOutL = new float32_t[size * nbRepeats]; |
|
|
|
@ -228,6 +266,8 @@ TEST(MixingConsole, SimpleProcessing) |
|
|
|
|
{ |
|
|
|
|
mixer->setInputSampleBuffer(0, samples[0], samples[1]); |
|
|
|
|
mixer->process(sampleOutL + j * size, sampleOutR + j * size); |
|
|
|
|
EXPECT_EQ(0, INSPECT(mixer, nanValueInspector)); |
|
|
|
|
EXPECT_EQ(0, INSPECT(mixer, normalizedValueInspector)); |
|
|
|
|
} |
|
|
|
|
saveWaveFile(getResultFile("result-mixing-console.wav"), sampleOutL, sampleOutR, nbRepeats * size, static_cast<unsigned>(SAMPLING_FREQUENCY), 16);
|
|
|
|
|
|
|
|
|
|