arduino-audio-tools
All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends Modules Pages
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
WhiteNoiseGenerator< T > Class Template Reference

Generates a random noise sound with the help of rand() function. More...

#include <SoundGenerator.h>

Inheritance diagram for WhiteNoiseGenerator< T >:
SoundGenerator< T >

Public Member Functions

 WhiteNoiseGenerator (T amplitude=32767)
 the scale defines the max value which is generated
 
virtual AudioInfo audioInfo ()
 Provides the AudioInfo.
 
virtual bool begin ()
 
virtual bool begin (AudioInfo info)
 
virtual AudioInfo defaultConfig ()
 Provides the default configuration.
 
virtual void end ()
 ends the processing
 
virtual bool isActive ()
 
virtual size_t readBytes (uint8_t *data, size_t len)
 Provides the data as byte array with the requested number of channels.
 
readSample ()
 Provides a single sample.
 
virtual void setAudioInfo (AudioInfo info)
 Defines/updates the AudioInfo.
 
virtual void setFrequency (float frequency)
 Abstract method: not implemented! Just provides an error message...
 

Protected Member Functions

int random (int min, int max)
 
size_t readBytesFrames (uint8_t *buffer, size_t lengthBytes, int frames, int channels)
 
size_t readBytesFromBuffer (uint8_t *buffer, size_t lengthBytes, int frame_size, int channels)
 

Protected Attributes

bool active = false
 
bool activeWarningIssued = false
 
amplitude
 
AudioInfo info
 
RingBuffer< uint8_t > ring_buffer {0}
 

Detailed Description

template<class T>
class audio_tools::WhiteNoiseGenerator< T >

Generates a random noise sound with the help of rand() function.

Author
Phil Schatzmann

Member Function Documentation

◆ begin() [1/2]

template<class T >
virtual bool begin ( )
inlinevirtualinherited

◆ begin() [2/2]

template<class T >
virtual bool begin ( AudioInfo  info)
inlinevirtualinherited

◆ defaultConfig()

template<class T >
virtual AudioInfo defaultConfig ( )
inlinevirtualinherited

◆ end()

template<class T >
virtual void end ( )
inlinevirtualinherited

ends the processing

Reimplemented in GeneratorFromArray< T >.

◆ isActive()

template<class T >
virtual bool isActive ( )
inlinevirtualinherited

Checks if the begin method has been called - after end() isActive returns false

◆ readSample()

template<class T >
T readSample ( )
inlinevirtual

Provides a single sample.

Implements SoundGenerator< T >.

◆ setAudioInfo()

template<class T >
virtual void setAudioInfo ( AudioInfo  info)
inlinevirtualinherited

Defines/updates the AudioInfo.

Reimplemented in SineWaveGenerator< T >, and SineWaveGenerator< int16_t >.

◆ setFrequency()

template<class T >
virtual void setFrequency ( float  frequency)
inlinevirtualinherited

Abstract method: not implemented! Just provides an error message...

Reimplemented in SineFromTable< T >, SineWaveGenerator< T >, and SineWaveGenerator< int16_t >.


The documentation for this class was generated from the following file: