1 #ifndef AUDIOGRAPHER_TESTS_UTILS_H
2 #define AUDIOGRAPHER_TESTS_UTILS_H
8 #include <cppunit/extensions/HelperMacros.h>
40 if (array[i] ==
static_cast<T
> (0.0)) {
50 unsigned int const granularity = 4096;
51 float * data =
new float[samples];
52 srand (std::time (NULL));
56 int biased_int = (rand() % granularity) - (granularity / 2);
57 data[i] = (range * biased_int) / granularity;
58 }
while (data[i] == 0.0 || data[i] == 1.0 || data[i] == -1.0);
samplecnt_t total_samples
void process(AudioGrapher::ProcessContext< T > const &c)
T const * data() const
data points to the array of data to process
samplecnt_t const & samples() const
samples tells how many samples the array pointed by data contains
virtual void process(ProcessContext< T > const &context)=0
std::list< AudioGrapher::ProcessContext< T > > ContextList
void process(AudioGrapher::ProcessContext< T > const &c)
void process(AudioGrapher::ProcessContext< T > const &)
void process(AudioGrapher::ProcessContext< T > &c)
std::vector< T > const & get_data() const
virtual void process(AudioGrapher::ProcessContext< T > const &c)
T const * get_array() const
Temporal::samplecnt_t samplecnt_t
static bool array_filled(T const *array, samplecnt_t samples)
static float * init_random_data(samplecnt_t samples, float range=1.0)
Generate random data, all samples guaranteed not to be 0.0, 1.0 or -1.0.
static bool array_equals(T const *a, T const *b, samplecnt_t samples)