Compare commits

..

No commits in common. "main" and "v0.1.0" have entirely different histories.
main ... v0.1.0

3 changed files with 0 additions and 32 deletions

View File

@ -1,6 +1,4 @@
#include <cmath>
#include <random>
#include "common.h"
#include "generators.h"
#include "wave.h"
@ -86,18 +84,3 @@ sample_table_t gen_isaw()
return isaw_vals;
}
sample_table_t gen_noise()
{
// setup RNG for floats in [-1, 1]
std::default_random_engine generator;
std::uniform_real_distribution<float_t> distribution(-1, 1);
sample_table_t noise_vals = {};
// Set first and last value to 0
noise_vals[0] = 0;
noise_vals[DEFAULT_N_SAMPLES - 1] = 0;
for (uint16_t i = 1; i < DEFAULT_N_SAMPLES - 1; i++) {
noise_vals[i] = distribution(generator);
}
return noise_vals;
}

View File

@ -31,9 +31,4 @@ sample_table_t gen_isaw();
*/
sample_table_t gen_tri();
/*! Generate noise wave data
@return a table of values
*/
sample_table_t gen_noise();
#endif // GENERATORS_H_

View File

@ -33,13 +33,3 @@ TEST(Generator, InverseSawWave) {
// Starts at 1
EXPECT_EQ(t[0], 1);
}
TEST(Generator, NoiseWave)
{
sample_table_t t = gen_noise();
// Always start and end at 0
EXPECT_EQ(t[0], 0);
EXPECT_EQ(t[DEFAULT_N_SAMPLES - 1], 0);
// Check second value, probably not equal to 0
EXPECT_NE(t[1], 0);
}