32 lines
527 B
C++
32 lines
527 B
C++
#ifndef muz_NOISE_HPP
|
|
#define muz_NOISE_HPP
|
|
|
|
#include <random>
|
|
#include <chrono>
|
|
|
|
#include "commons.hpp"
|
|
#include "AudioConf.hpp"
|
|
#include "Signal.hpp"
|
|
|
|
namespace muz
|
|
{
|
|
/**
|
|
* White noise signal.
|
|
* @see Signal
|
|
**/
|
|
class Noise: public Signal
|
|
{
|
|
public:
|
|
explicit Noise(AudioConf const& conf);
|
|
virtual ~Noise();
|
|
|
|
void next(std::vector<float>& out) override;
|
|
private:
|
|
AudioConf m_conf;
|
|
std::mt19937 m_rand;
|
|
std::uniform_real_distribution<float> m_distribution {-0.5f, 0.5f};
|
|
};
|
|
}
|
|
|
|
#endif
|