arduino-audio-tools
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
SawToothGenerator< T > Class Template Reference

SawToothGenerator. More...

#include <SoundGenerator.h>

Inheritance diagram for SawToothGenerator< T >:
SineWaveGenerator< T > SoundGenerator< T >

Public Member Functions

 SawToothGenerator (float amplitude=32767.0, float phase=0.0)
 
virtual AudioInfo audioInfo ()
 Provides the AudioInfo.
 
bool begin () override
 
bool begin (AudioInfo info) override
 
bool begin (AudioInfo info, float frequency)
 
bool begin (int channels, int sample_rate, float frequency)
 
virtual AudioInfo defaultConfig () override
 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.
 
virtual T readSample () override
 Provides a single sample.
 
void setAmplitude (float amp)
 
virtual void setAudioInfo (AudioInfo info) override
 Defines/updates the AudioInfo.
 
void setFrequency (float frequency) override
 Defines the frequency - after the processing has been started.
 
void setPlayTime (uint32_t playMs, uint8_t upPercent=20, uint8_t downPercent=30)
 

Protected Member Functions

T applyRamp (T sample)
 
void logStatus ()
 
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)
 
void recalculatePlayTime ()
 
float saw (float t)
 sine approximation.
 

Protected Attributes

bool active = false
 
bool activeWarningIssued = false
 
uint32_t currentSample = 0
 
const float double_Pi = 2.0f * PI
 
uint8_t downPercent = 40
 
float factor = 1.0f
 
AudioInfo info
 
float m_amplitude = 1.0f
 
float m_cycles = 0.0f
 
float m_deltaTime = 0.0f
 
volatile float m_frequency = 0.0f
 
float m_phase = 0.0f
 
uint32_t playMs = 0
 
uint32_t playSamples = 0
 
float rampDownDec = 0.0
 
uint32_t rampDownSamples = 0
 
float rampUpInc = 0.0
 
RingBuffer< uint8_tring_buffer {0}
 
uint8_t upPercent = 5
 
uint32_t upSamples = 0
 

Detailed Description

template<class T = int16_t>
class audio_tools::SawToothGenerator< T >

SawToothGenerator.

Author
Phil Schatzmann
Template Parameters
T

Constructor & Destructor Documentation

◆ SawToothGenerator()

template<class T = int16_t>
SawToothGenerator ( float  amplitude = 32767.0,
float  phase = 0.0 
)
inline

Member Function Documentation

◆ applyRamp()

template<class T = int16_t>
T applyRamp ( T  sample)
inlineprotectedinherited

◆ audioInfo()

template<class T = int16_t>
virtual AudioInfo audioInfo ( )
inlinevirtualinherited

Provides the AudioInfo.

◆ begin() [1/4]

template<class T = int16_t>
bool begin ( )
inlineoverridevirtualinherited

Reimplemented from SoundGenerator< T >.

◆ begin() [2/4]

template<class T = int16_t>
bool begin ( AudioInfo  info)
inlineoverridevirtualinherited

Reimplemented from SoundGenerator< T >.

◆ begin() [3/4]

template<class T = int16_t>
bool begin ( AudioInfo  info,
float  frequency 
)
inlineinherited

◆ begin() [4/4]

template<class T = int16_t>
bool begin ( int  channels,
int  sample_rate,
float  frequency 
)
inlineinherited

◆ defaultConfig()

template<class T = int16_t>
virtual AudioInfo defaultConfig ( )
inlineoverridevirtualinherited

Provides the default configuration.

Reimplemented from SoundGenerator< T >.

◆ end()

template<class T = int16_t>
virtual void end ( )
inlinevirtualinherited

ends the processing

Reimplemented in GeneratorFromArray< T >.

◆ isActive()

template<class T = int16_t>
virtual bool isActive ( )
inlinevirtualinherited

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

◆ logStatus()

template<class T = int16_t>
void logStatus ( )
inlineprotectedinherited

◆ readBytes()

template<class T = int16_t>
virtual size_t readBytes ( uint8_t data,
size_t  len 
)
inlinevirtualinherited

Provides the data as byte array with the requested number of channels.

◆ readBytesFrames()

template<class T = int16_t>
size_t readBytesFrames ( uint8_t buffer,
size_t  lengthBytes,
int  frames,
int  channels 
)
inlineprotectedinherited

◆ readBytesFromBuffer()

template<class T = int16_t>
size_t readBytesFromBuffer ( uint8_t buffer,
size_t  lengthBytes,
int  frame_size,
int  channels 
)
inlineprotectedinherited

◆ readSample()

template<class T = int16_t>
virtual T readSample ( )
inlineoverridevirtual

Provides a single sample.

Reimplemented from SineWaveGenerator< T >.

◆ recalculatePlayTime()

template<class T = int16_t>
void recalculatePlayTime ( )
inlineprotectedinherited

◆ saw()

template<class T = int16_t>
float saw ( float  t)
inlineprotected

sine approximation.

◆ setAmplitude()

template<class T = int16_t>
void setAmplitude ( float  amp)
inlineinherited

◆ setAudioInfo()

template<class T = int16_t>
virtual void setAudioInfo ( AudioInfo  info)
inlineoverridevirtualinherited

Defines/updates the AudioInfo.

Reimplemented from SoundGenerator< T >.

◆ setFrequency()

template<class T = int16_t>
void setFrequency ( float  frequency)
inlineoverridevirtualinherited

Defines the frequency - after the processing has been started.

Reimplemented from SoundGenerator< T >.

◆ setPlayTime()

template<class T = int16_t>
void setPlayTime ( uint32_t  playMs,
uint8_t  upPercent = 20,
uint8_t  downPercent = 30 
)
inlineinherited

Member Data Documentation

◆ active

template<class T = int16_t>
bool active = false
protectedinherited

◆ activeWarningIssued

template<class T = int16_t>
bool activeWarningIssued = false
protectedinherited

◆ currentSample

template<class T = int16_t>
uint32_t currentSample = 0
protectedinherited

◆ double_Pi

template<class T = int16_t>
const float double_Pi = 2.0f * PI
protectedinherited

◆ downPercent

template<class T = int16_t>
uint8_t downPercent = 40
protectedinherited

◆ factor

template<class T = int16_t>
float factor = 1.0f
protectedinherited

◆ info

template<class T = int16_t>
AudioInfo info
protectedinherited

◆ m_amplitude

template<class T = int16_t>
float m_amplitude = 1.0f
protectedinherited

◆ m_cycles

template<class T = int16_t>
float m_cycles = 0.0f
protectedinherited

◆ m_deltaTime

template<class T = int16_t>
float m_deltaTime = 0.0f
protectedinherited

◆ m_frequency

template<class T = int16_t>
volatile float m_frequency = 0.0f
protectedinherited

◆ m_phase

template<class T = int16_t>
float m_phase = 0.0f
protectedinherited

◆ playMs

template<class T = int16_t>
uint32_t playMs = 0
protectedinherited

◆ playSamples

template<class T = int16_t>
uint32_t playSamples = 0
protectedinherited

◆ rampDownDec

template<class T = int16_t>
float rampDownDec = 0.0
protectedinherited

◆ rampDownSamples

template<class T = int16_t>
uint32_t rampDownSamples = 0
protectedinherited

◆ rampUpInc

template<class T = int16_t>
float rampUpInc = 0.0
protectedinherited

◆ ring_buffer

template<class T = int16_t>
RingBuffer<uint8_t> ring_buffer {0}
protectedinherited

◆ upPercent

template<class T = int16_t>
uint8_t upPercent = 5
protectedinherited

◆ upSamples

template<class T = int16_t>
uint32_t upSamples = 0
protectedinherited

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