38 using namespace Nsound;
43 using std::setprecision;
71 b_length_(copy.b_length_),
72 a_length_(copy.a_length_),
160 sum += std::fabs(
b_[i]);
165 sum += std::fabs(
a_[i]);
176 #define FORMAT setw(12) << setprecision(9) << std::setiosflags(std::ios::fixed)
180 out <<
"b[" << i <<
"] = " <<
FORMAT << rhs.
b_[i];
184 out <<
" a[" << i <<
"] = " <<
FORMAT << rhs.
a_[i];
200 b_[i] = rng.
get(min, max);
205 a_[i] = rng.
get(min, max);
std::ostream & operator<<(std::ostream &out, const Buffer &rhs_buffer)
void ga_interleave()
Genitic Algorithm Helper Function: interleave B coefs with A.
Kernel & operator=(const Kernel &rhs)
float64 getB(uint32 i)
Returns kernel 'b[i]' coef.
void setB(const float64 *b)
Copy getBLength() values from the array a into the Kernel. Use setLength() to set the number of value...
float64 * getB()
Returns kernel 'b' array, the length is returned by getBLegnth()
boolean operator<(const Kernel &rhs) const
uint32 getLength() const
Returns the number of samples in the Buffer.
void ga_swap_ab(Kernel &rhs)
Genitic Algorithm Helper Function: swaps the A & B coefs.
void setLength(uint32 b_length, uint32 a_length)
void randomize(const float64 &min=-1.0, const float64 &max=1.0)
Sets all coefs to random float64 values between min & max.
Kernel(uint32 b_length, uint32 a_length, int32 f1=0, int32 f2=0, int32 f3=0, int32 f4=0)
A Buffer for storing audio samples.
void swap_(float64 &a, float64 &b)
uint32 get()
Get a random number.
float64 * getA()
Returns Kernel 'a' array, the length is returned by getALegnth()
float64 getA(uint32 i)
Returns kernel 'a[i]' coef.
void setA(const float64 *a)
Copy getALength() values from the array a into the Kernel. Use setLength() to set the number of value...