34 #ifndef _NSOUND_GENERATOR_H_
35 #define _NSOUND_GENERATOR_H_
45 class RandomNumberGenerator;
63 Generator(
const std::string & wave_filename);
104 const Buffer & n_harmonics,
150 const boolean & normalize =
true)
const;
163 const float64 & pass_band_percent = 0.01)
const;
177 const float64 & amplitude_start,
178 const float64 & amplitude_finish)
const;
230 const Buffer & frequency);
501 const Buffer & frequencies);
534 const Buffer & frequencies,
547 const Buffer & frequencies,
609 const Buffer & wavetable);
float64 sample_rate_
Used to determine when to create a sync sample.
RandomNumberGenerator * rng_
The waveform to ossicialate.
Buffer drawSine2(const float64 &duration, const float64 &frequency, const float64 &phase)
This method draws a static sine wave.
float64 tell() const
Returns the current position pointer, values are between 0.0 to 1.0.
Buffer drawWindowKaiser(const float64 &duration, const float64 &beta=5.0) const
Draws a Kaiser window.
Buffer drawWindowRectangular(const float64 &duration) const
Draws a rectangular window.
Buffer drawFatGaussian(const float64 &duration, const float64 &pass_band_percent=0.01) const
This method draws a standard Gaussian curve over duration seconds, with a specified pass band...
Nsound::Generator & operator=(const Nsound::Generator &rhs)
Assignment operator.
Buffer drawWindowBlackman(const float64 &duration) const
Draws a Blackman window.
virtual void ctor(const float64 &sample_rate)
DOXME.
std::vector< float64 > chorus_position_
void setRealtime(bool flag)
Sets realtime mode, disables automatic reset() if set.
uint32 buzz_max_harmonics_
The random number generator.
std::vector< float64 > buzz_position_
Buffer tanh(const float64 &duration) const
This method draws the tanh function accross duration samples.
std::set< Generator * > sync_slaves_
Stores sample counts when synced.
Buffer drawWindowHamming(const float64 &duration) const
Draws a Hamming window.
Buffer drawGaussian(const float64 &duration, const float64 &mu, const float64 &sigma, const boolean &normalize=true) const
This method draws a Gaussian curve over duration seconds.
float64 position_
Used for phase offset adjustment.
Buffer drawWindow(const float64 &duration, WindowType type) const
Draws a window of the specified type.
Buffer drawWindowBartlett(const float64 &duration) const
Draws a Bartlett window.
float64 sync_pos_
The number of samples into the wavefrom.
Buffer drawSine(const float64 &duration, const float64 &frequency)
This method draws a static sine wave.
Buffer drawWindowHanning(const float64 &duration) const
Draws a Hanning window.
Buffer drawParabola(const float64 &duration, const float64 &y1, const float64 &x2, const float64 &y2, const float64 &y3) const
This method draws a parabola between three points, intersecting the middle point. ...
void addSlaveSync(Generator &slave)
Adds a generator as a slave to this instance for syncing.
Buffer silence(const float64 &duration) const
This method generates silence.
float64 t_
The time step between samples in seconds.
boolean sync_is_slave_
Indicates if this generator is the master.
void buzzInit(const uint32 &max_harmonics)
Initaializes Buzz settings for real-time calls.
Buffer drawWindowParzen(const float64 &duration) const
Draws a Parzen window.
virtual float64 generate(const float64 &frequency)
This is a real-time method for the wavetable oscillator.
Buffer drawDecay(const float64 &duration, const float64 &alpha=2.0 *M_PI) const
This method draws an exponential curve that decays from 1.0 to 0.0 over the duration.
void setChorus(const uint32 n_voices, const float64 &sigma=0.02)
Chorus or Unison.
Buffer * waveform_
The current time (for real time draw functions.)
float64 buzz(const float64 &frequency, const float64 &n_harmonics, const float64 &delay)
Returns sample from a set of harmonics. Based on the Csound buzz opcode.
std::vector< float64 > chorus_factor_
virtual ~Generator()
Deletes the baseclass part of the object.
virtual void reset()
Resets the position pointer back to the begging of the waveform.
Buffer gaussianNoise(const float64 &duration, const float64 &mu, const float64 &sigma) const
This method generates noise from a Gaussian distribution.
float64 sample_time_
The number of samples per second to generate.
Buffer drawWindowBlackmanHarris(const float64 &duration) const
Draws a Blackman-Harris window.
A Buffer for storing audio samples.
std::vector< uint32 > sync_vector_
Indicates the number of samples since reset.
Buffer whiteNoise(const float64 &duration) const
This method generates noise from a uniform distribution.
uint32 sync_count_
Indicates if this generator is a slave.
Buffer drawLine(const float64 &duration, const float64 &litude_start, const float64 &litude_finish) const
This method draws a linear line beteween 2 points.
Buffer drawWindowNuttall(const float64 &duration) const
Draws a Nuttall window.
void setSeed(const uint32 seed)
Sets the seed for the Generator's random number generator (rng).
RandomNumberGenerator & getRandomNumberGenerator()
Base class for random number generators.
A class the provides draw utilities and a wavetable oscillator.
void removeSlaveSync(Generator &slave)
Removes the generator from the sync list.
virtual float64 generate2(const float64 &frequency, const float64 &phase)
This is a real-time method for the wavetable oscillator.