mirror of https://github.com/probonopd/MiniDexed
parent
2a272801d3
commit
f9f6f71835
@ -0,0 +1,11 @@ |
||||
*:../../CMSIS_5/* |
||||
toomanyconfigs:* |
||||
noExplicitConstructor:* |
||||
unusedFunction:* |
||||
missingIncludeSystem:* |
||||
unmatchedSuppression:* |
||||
|
||||
// unexplained exceptions |
||||
syntaxError:beta.cpp:52 |
||||
syntaxError:test_fx_mixing_console.cpp:207 |
||||
internalAstError:test_cpp_performance.cpp:22 |
Binary file not shown.
@ -1,67 +0,0 @@ |
||||
#include <gtest/gtest.h> |
||||
|
||||
#include "../fx_components.h" |
||||
|
||||
int nb = 0; |
||||
|
||||
int NbIteration() { |
||||
nb++; |
||||
return 3; |
||||
} |
||||
|
||||
TEST(Cpp, NbCallsInUpperBoudariesInForLoop) |
||||
{ |
||||
for(int i = 0; i < NbIteration(); ++i) |
||||
{ |
||||
// Does something
|
||||
} |
||||
EXPECT_EQ(nb, 4); |
||||
} |
||||
|
||||
#define CLASS_INIT(clazz) clazz::StaticInit() |
||||
class StaticCtorTest |
||||
{ |
||||
private: |
||||
static int n_; |
||||
|
||||
public: |
||||
int i_; |
||||
|
||||
static int StaticInit() |
||||
{ |
||||
static int i = 0; |
||||
i++; |
||||
|
||||
StaticCtorTest::n_ = 2; |
||||
|
||||
return i; |
||||
} |
||||
|
||||
StaticCtorTest() : i_(0) |
||||
{ |
||||
static int init = CLASS_INIT(StaticCtorTest); |
||||
static int NB = 0; |
||||
EXPECT_EQ(init, 1); |
||||
|
||||
this->i_ = ++NB; |
||||
|
||||
EXPECT_EQ(StaticCtorTest::n_, 2); |
||||
} |
||||
|
||||
~StaticCtorTest() |
||||
{ |
||||
} |
||||
}; |
||||
|
||||
int StaticCtorTest::n_ = 0; |
||||
|
||||
TEST(Cpp, StaticCtorTest) |
||||
{ |
||||
StaticCtorTest obj1; |
||||
StaticCtorTest obj2; |
||||
StaticCtorTest obj3; |
||||
|
||||
EXPECT_EQ(obj1.i_, 1); |
||||
EXPECT_EQ(obj2.i_, 2); |
||||
EXPECT_EQ(obj3.i_, 3); |
||||
} |
@ -0,0 +1,275 @@ |
||||
#include "test_fx_helper.h" |
||||
|
||||
#include "../fx_tube.h" |
||||
#include "../fx_chorus.h" |
||||
#include "../fx_flanger.h" |
||||
#include "../fx_orbitone.h" |
||||
#include "../fx_phaser.h" |
||||
#include "../fx_delay.h" |
||||
#include "../effect_platervbstereo.h" |
||||
#include "../fx_shimmer_reverb.h" |
||||
|
||||
TEST(LevelTuning, Tube) |
||||
{ |
||||
Tube fx(SAMPLING_FREQUENCY); |
||||
fx.reset(); |
||||
fx.setOverdrive(0.75f); |
||||
|
||||
PREPARE_AUDIO_TEST(size, inSamples, outSamples, full_test_name); |
||||
float32_t sumIn = 0.0f; |
||||
float32_t sumOut = 0.0f; |
||||
size_t nb_errors = 0; |
||||
AUDIO_LOOP(inSamples, outSamples, size, inL, inR, outL, outR, |
||||
sumIn += inL * inL; |
||||
|
||||
fx.processSample(inL, inR, outL, outR); |
||||
|
||||
sumOut += outL * outL; |
||||
|
||||
nb_errors += std::abs(outL) > 1.0f ? 1 : 0; |
||||
nb_errors += std::abs(outR) > 1.0f ? 1 : 0; |
||||
); |
||||
|
||||
CLEANUP_AUDIO_TEST(inSamples, outSamples); |
||||
|
||||
float32_t ratio = std::sqrt(sumOut / sumIn); |
||||
|
||||
ASSERT_EQ(nb_errors, 0) << "Sample value error for Tube"; |
||||
EXPECT_GE(ratio, 0.9f); |
||||
EXPECT_LE(1.0f / ratio, 1.1f); |
||||
} |
||||
|
||||
TEST(LevelTuning, Chorus) |
||||
{ |
||||
Chorus fx(SAMPLING_FREQUENCY); |
||||
fx.reset(); |
||||
fx.setRate(0.4f); |
||||
fx.setDepth(0.5f); |
||||
|
||||
PREPARE_AUDIO_TEST(size, inSamples, outSamples, full_test_name); |
||||
float32_t sumIn = 0.0f; |
||||
float32_t sumOut = 0.0f; |
||||
size_t nb_errors = 0; |
||||
AUDIO_LOOP(inSamples, outSamples, size, inL, inR, outL, outR, |
||||
sumIn += inL * inL; |
||||
|
||||
fx.processSample(inL, inR, outL, outR); |
||||
|
||||
sumOut += outL * outL; |
||||
|
||||
nb_errors += std::abs(outL) > 1.0f ? 1 : 0; |
||||
nb_errors += std::abs(outR) > 1.0f ? 1 : 0; |
||||
); |
||||
|
||||
CLEANUP_AUDIO_TEST(inSamples, outSamples); |
||||
|
||||
float32_t ratio = std::sqrt(sumOut / sumIn); |
||||
|
||||
ASSERT_EQ(nb_errors, 0) << "Sample value error for Chorus"; |
||||
EXPECT_LE(ratio, 1.0f); |
||||
EXPECT_GE(ratio, 0.9f); |
||||
EXPECT_LE(1.0f / ratio, 1.1f); |
||||
} |
||||
|
||||
TEST(LevelTuning, Flanger) |
||||
{ |
||||
Flanger fx(SAMPLING_FREQUENCY); |
||||
fx.reset(); |
||||
fx.setRate(0.03f); |
||||
fx.setDepth(0.75f); |
||||
fx.setFeedback(0.5f); |
||||
|
||||
PREPARE_AUDIO_TEST(size, inSamples, outSamples, full_test_name); |
||||
float32_t sumIn = 0.0f; |
||||
float32_t sumOut = 0.0f; |
||||
size_t nb_errors = 0; |
||||
AUDIO_LOOP(inSamples, outSamples, size, inL, inR, outL, outR, |
||||
sumIn += inL * inL; |
||||
|
||||
fx.processSample(inL, inR, outL, outR); |
||||
|
||||
sumOut += outL * outL; |
||||
|
||||
nb_errors += std::abs(outL) > 1.0f ? 1 : 0; |
||||
nb_errors += std::abs(outR) > 1.0f ? 1 : 0; |
||||
); |
||||
|
||||
CLEANUP_AUDIO_TEST(inSamples, outSamples); |
||||
|
||||
float32_t ratio = std::sqrt(sumOut / sumIn); |
||||
|
||||
ASSERT_EQ(nb_errors, 0) << "Sample value error for Flanger"; |
||||
EXPECT_LE(ratio, 1.0f); |
||||
EXPECT_GE(ratio, 0.9f); |
||||
EXPECT_LE(1.0f / ratio, 1.1f); |
||||
} |
||||
|
||||
TEST(LevelTuning, Orbitone) |
||||
{ |
||||
Orbitone fx(SAMPLING_FREQUENCY); |
||||
fx.reset(); |
||||
fx.setRate(0.4f); |
||||
fx.setDepth(0.5f); |
||||
|
||||
PREPARE_AUDIO_TEST(size, inSamples, outSamples, full_test_name); |
||||
float32_t sumIn = 0.0f; |
||||
float32_t sumOut = 0.0f; |
||||
size_t nb_errors = 0; |
||||
AUDIO_LOOP(inSamples, outSamples, size, inL, inR, outL, outR, |
||||
sumIn += inL * inL; |
||||
|
||||
fx.processSample(inL, inR, outL, outR); |
||||
|
||||
sumOut += outL * outL; |
||||
|
||||
nb_errors += std::abs(outL) > 1.0f ? 1 : 0; |
||||
nb_errors += std::abs(outR) > 1.0f ? 1 : 0; |
||||
); |
||||
|
||||
CLEANUP_AUDIO_TEST(inSamples, outSamples); |
||||
|
||||
float32_t ratio = std::sqrt(sumOut / sumIn); |
||||
|
||||
ASSERT_EQ(nb_errors, 0) << "Sample value error for Orbitone"; |
||||
EXPECT_LE(ratio, 1.0f); |
||||
EXPECT_GE(ratio, 0.9f); |
||||
EXPECT_LE(1.0f / ratio, 1.1f); |
||||
} |
||||
|
||||
TEST(LevelTuning, Phaser) |
||||
{ |
||||
Phaser fx(SAMPLING_FREQUENCY); |
||||
fx.reset(); |
||||
fx.setRate(0.1f); |
||||
fx.setDepth(1.0f); |
||||
fx.setFeedback(0.5f); |
||||
fx.setNbStages(12); |
||||
|
||||
PREPARE_AUDIO_TEST(size, inSamples, outSamples, full_test_name); |
||||
float32_t sumIn = 0.0f; |
||||
float32_t sumOut = 0.0f; |
||||
size_t nb_errors = 0; |
||||
AUDIO_LOOP(inSamples, outSamples, size, inL, inR, outL, outR, |
||||
sumIn += inL * inL; |
||||
|
||||
fx.processSample(inL, inR, outL, outR); |
||||
|
||||
sumOut += outL * outL; |
||||
|
||||
nb_errors += std::abs(outL) > 1.0f ? 1 : 0; |
||||
nb_errors += std::abs(outR) > 1.0f ? 1 : 0; |
||||
); |
||||
|
||||
CLEANUP_AUDIO_TEST(inSamples, outSamples); |
||||
|
||||
float32_t ratio = std::sqrt(sumOut / sumIn); |
||||
|
||||
ASSERT_EQ(nb_errors, 0) << "Sample value error for Phaser"; |
||||
EXPECT_LE(ratio, 1.0f); |
||||
EXPECT_GE(ratio, 0.9f); |
||||
EXPECT_LE(1.0f / ratio, 1.1f); |
||||
} |
||||
|
||||
TEST(LevelTuning, Delay) |
||||
{ |
||||
Delay fx(SAMPLING_FREQUENCY); |
||||
fx.reset(); |
||||
fx.setLeftDelayTime(0.15f); |
||||
fx.setLeftDelayTime(0.2f); |
||||
fx.setFeedback(0.35f); |
||||
fx.setFlutterRate(0.0f); |
||||
fx.setFlutterAmount(0.0f); |
||||
|
||||
PREPARE_AUDIO_TEST(size, inSamples, outSamples, full_test_name); |
||||
float32_t sumIn = 0.0f; |
||||
float32_t sumOut = 0.0f; |
||||
size_t nb_errors = 0; |
||||
AUDIO_LOOP(inSamples, outSamples, size, inL, inR, outL, outR, |
||||
sumIn += inL * inL; |
||||
|
||||
fx.processSample(inL, inR, outL, outR); |
||||
|
||||
sumOut += outL * outL; |
||||
|
||||
nb_errors += std::abs(outL) > 1.0f ? 1 : 0; |
||||
nb_errors += std::abs(outR) > 1.0f ? 1 : 0; |
||||
); |
||||
|
||||
CLEANUP_AUDIO_TEST(inSamples, outSamples); |
||||
|
||||
float32_t ratio = std::sqrt(sumOut / sumIn); |
||||
|
||||
ASSERT_EQ(nb_errors, 0) << "Sample value error for Delay"; |
||||
EXPECT_LE(ratio, 1.0f); |
||||
EXPECT_GE(ratio, 0.9f); |
||||
EXPECT_LE(1.0f / ratio, 1.1f); |
||||
} |
||||
|
||||
TEST(LevelTuning, PlateReverb) |
||||
{ |
||||
AudioEffectPlateReverb fx(SAMPLING_FREQUENCY); |
||||
fx.reset(); |
||||
fx.set_bypass(false); |
||||
fx.size(0.7f); |
||||
fx.hidamp(0.5f); |
||||
fx.lodamp(0.5f); |
||||
fx.lowpass(0.3f); |
||||
fx.diffusion(0.65f); |
||||
fx.level(1.0f); |
||||
|
||||
PREPARE_AUDIO_TEST(size, inSamples, outSamples, full_test_name); |
||||
float32_t sumIn = 0.0f; |
||||
float32_t sumOut = 0.0f; |
||||
size_t nb_errors = 0; |
||||
AUDIO_LOOP(inSamples, outSamples, size, inL, inR, outL, outR, |
||||
sumIn += inL * inL; |
||||
|
||||
fx.processSample(inL, inR, outL, outR); |
||||
|
||||
sumOut += outL * outL; |
||||
|
||||
nb_errors += std::abs(outL) > 1.0f ? 1 : 0; |
||||
nb_errors += std::abs(outR) > 1.0f ? 1 : 0; |
||||
); |
||||
|
||||
CLEANUP_AUDIO_TEST(inSamples, outSamples); |
||||
|
||||
float32_t ratio = std::sqrt(sumOut / sumIn); |
||||
|
||||
ASSERT_EQ(nb_errors, 0) << "Sample value error for PlateReverb"; |
||||
EXPECT_GE(ratio, 0.9f); |
||||
EXPECT_LE(1.0f / ratio, 1.1f); |
||||
} |
||||
|
||||
TEST(LevelTuning, ShimmerReverb) |
||||
{ |
||||
ShimmerReverb fx(SAMPLING_FREQUENCY); |
||||
fx.reset(); |
||||
fx.setInputGain(0.35f); |
||||
fx.setTime(0.89f); |
||||
fx.setDiffusion(0.75f); |
||||
fx.setLP(0.8f); |
||||
|
||||
PREPARE_AUDIO_TEST(size, inSamples, outSamples, full_test_name); |
||||
float32_t sumIn = 0.0f; |
||||
float32_t sumOut = 0.0f; |
||||
size_t nb_errors = 0; |
||||
AUDIO_LOOP(inSamples, outSamples, size, inL, inR, outL, outR, |
||||
sumIn += inL * inL; |
||||
|
||||
fx.processSample(inL, inR, outL, outR); |
||||
|
||||
sumOut += outL * outL; |
||||
|
||||
nb_errors += std::abs(outL) > 1.0f ? 1 : 0; |
||||
nb_errors += std::abs(outR) > 1.0f ? 1 : 0; |
||||
); |
||||
|
||||
CLEANUP_AUDIO_TEST(inSamples, outSamples); |
||||
|
||||
float32_t ratio = std::sqrt(sumOut / sumIn); |
||||
|
||||
ASSERT_EQ(nb_errors, 0) << "Sample value error for ShimmerReverb"; |
||||
EXPECT_GE(ratio, 0.9f); |
||||
EXPECT_LE(1.0f / ratio, 1.1f); |
||||
} |
@ -0,0 +1,130 @@ |
||||
#include "test_fx_helper.h" |
||||
|
||||
#include "../fx_dry.h" |
||||
#include "../fx_tube.h" |
||||
#include "../fx_chorus.h" |
||||
#include "../fx_flanger.h" |
||||
#include "../fx_orbitone.h" |
||||
#include "../fx_phaser.h" |
||||
#include "../fx_delay.h" |
||||
#include "../effect_platervbstereo.h" |
||||
#include "../fx_shimmer_reverb.h" |
||||
|
||||
TEST(UnitFXTuning, Dry) |
||||
{ |
||||
Dry fx(SAMPLING_FREQUENCY); |
||||
|
||||
PREPARE_AUDIO_TEST(size, inSamples, outSamples, full_test_name); |
||||
SIMPLE_AUDIO_LOOP(inSamples, outSamples, size, inL, inR, outL, outR, fx); |
||||
SAVE_AUDIO_RESULTS(full_test_name, outSamples, size); |
||||
CLEANUP_AUDIO_TEST(inSamples, outSamples); |
||||
} |
||||
|
||||
TEST(UnitFXTuning, Tube) |
||||
{ |
||||
Tube fx(SAMPLING_FREQUENCY); |
||||
fx.setOverdrive(0.5f); |
||||
|
||||
PREPARE_AUDIO_TEST(size, inSamples, outSamples, full_test_name); |
||||
SIMPLE_AUDIO_LOOP(inSamples, outSamples, size, inL, inR, outL, outR, fx); |
||||
SAVE_AUDIO_RESULTS(full_test_name, outSamples, size); |
||||
CLEANUP_AUDIO_TEST(inSamples, outSamples); |
||||
} |
||||
|
||||
TEST(UnitFXTuning, Chorus) |
||||
{ |
||||
Chorus fx(SAMPLING_FREQUENCY); |
||||
fx.setRate(0.4f); |
||||
fx.setDepth(0.7f); |
||||
|
||||
PREPARE_AUDIO_TEST(size, inSamples, outSamples, full_test_name); |
||||
SIMPLE_AUDIO_LOOP(inSamples, outSamples, size, inL, inR, outL, outR, fx); |
||||
SAVE_AUDIO_RESULTS(full_test_name, outSamples, size); |
||||
CLEANUP_AUDIO_TEST(inSamples, outSamples); |
||||
} |
||||
|
||||
TEST(UnitFXTuning, Flanger) |
||||
{ |
||||
Flanger fx(SAMPLING_FREQUENCY); |
||||
fx.setRate(0.03f); |
||||
fx.setDepth(0.75f); |
||||
fx.setFeedback(0.5f); |
||||
|
||||
PREPARE_AUDIO_TEST(size, inSamples, outSamples, full_test_name); |
||||
SIMPLE_AUDIO_LOOP(inSamples, outSamples, size, inL, inR, outL, outR, fx); |
||||
SAVE_AUDIO_RESULTS(full_test_name, outSamples, size); |
||||
CLEANUP_AUDIO_TEST(inSamples, outSamples); |
||||
} |
||||
|
||||
TEST(UnitFXTuning, Orbitone) |
||||
{ |
||||
Orbitone fx(SAMPLING_FREQUENCY); |
||||
fx.setRate(0.4f); |
||||
fx.setDepth(0.7f); |
||||
|
||||
PREPARE_AUDIO_TEST(size, inSamples, outSamples, full_test_name); |
||||
SIMPLE_AUDIO_LOOP(inSamples, outSamples, size, inL, inR, outL, outR, fx); |
||||
SAVE_AUDIO_RESULTS(full_test_name, outSamples, size); |
||||
CLEANUP_AUDIO_TEST(inSamples, outSamples); |
||||
} |
||||
|
||||
TEST(UnitFXTuning, Phaser) |
||||
{ |
||||
Phaser fx(SAMPLING_FREQUENCY); |
||||
fx.setRate(0.1f); |
||||
fx.setDepth(1.0f); |
||||
fx.setFeedback(0.5f); |
||||
fx.setNbStages(12); |
||||
|
||||
PREPARE_AUDIO_TEST(size, inSamples, outSamples, full_test_name); |
||||
SIMPLE_AUDIO_LOOP(inSamples, outSamples, size, inL, inR, outL, outR, fx); |
||||
SAVE_AUDIO_RESULTS(full_test_name, outSamples, size); |
||||
CLEANUP_AUDIO_TEST(inSamples, outSamples); |
||||
} |
||||
|
||||
TEST(UnitFXTuning, Delay) |
||||
{ |
||||
Delay fx(SAMPLING_FREQUENCY); |
||||
fx.setLeftDelayTime(0.25f); |
||||
fx.setLeftDelayTime(0.40f); |
||||
fx.setFeedback(0.55f); |
||||
fx.setFlutterRate(0.01f); |
||||
fx.setFlutterAmount(0.05f); |
||||
|
||||
PREPARE_AUDIO_TEST(size, inSamples, outSamples, full_test_name); |
||||
SIMPLE_AUDIO_LOOP(inSamples, outSamples, size, inL, inR, outL, outR, fx); |
||||
SAVE_AUDIO_RESULTS(full_test_name, outSamples, size); |
||||
CLEANUP_AUDIO_TEST(inSamples, outSamples); |
||||
} |
||||
|
||||
TEST(UnitFXTuning, PlateReverb) |
||||
{ |
||||
AudioEffectPlateReverb fx(SAMPLING_FREQUENCY); |
||||
fx.set_bypass(false); |
||||
fx.size(0.7f); |
||||
fx.hidamp(0.5f); |
||||
fx.lodamp(0.5f); |
||||
fx.lowpass(0.3f); |
||||
fx.diffusion(0.65f); |
||||
fx.level(1.0f); |
||||
|
||||
PREPARE_AUDIO_TEST(size, inSamples, outSamples, full_test_name); |
||||
SIMPLE_AUDIO_LOOP(inSamples, outSamples, size, inL, inR, outL, outR, fx); |
||||
SAVE_AUDIO_RESULTS(full_test_name, outSamples, size); |
||||
CLEANUP_AUDIO_TEST(inSamples, outSamples); |
||||
} |
||||
|
||||
TEST(UnitFXTuning, ShimmerReverb) |
||||
{ |
||||
ShimmerReverb fx(SAMPLING_FREQUENCY); |
||||
fx.setInputGain(0.65f); |
||||
fx.setTime(0.89f); |
||||
fx.setDiffusion(0.75f); |
||||
fx.setLP(0.8f); |
||||
|
||||
PREPARE_AUDIO_TEST(size, inSamples, outSamples, full_test_name); |
||||
SIMPLE_AUDIO_LOOP(inSamples, outSamples, size, inL, inR, outL, outR, fx); |
||||
SAVE_AUDIO_RESULTS(full_test_name, outSamples, size); |
||||
CLEANUP_AUDIO_TEST(inSamples, outSamples); |
||||
} |
||||
|
Loading…
Reference in new issue