No Matches
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
audio_tools::PWMAudioStreamBase Class Referenceabstract

Common functionality for PWM output. More...

#include <PWMAudioBase.h>

Inheritance diagram for audio_tools::PWMAudioStreamBase:
audio_tools::AudioPrint Print audio_tools::AudioBaseInfoDependent audio_tools::AudioBaseInfoSource audio_tools::PWMAudioStreamAVR audio_tools::PWMAudioStreamESP32 audio_tools::PWMAudioStreamMBED audio_tools::PWMAudioStreamPico audio_tools::PWMAudioStreamSTM32

Public Member Functions

virtual int availableForWrite ()
bool begin ()
bool begin (PWMConfig config)
 starts the processing using Streams
bool begin (uint16_t sampleRate, uint8_t channels, PWMCallbackType cb)
PWMConfig config ()
virtual PWMConfig defaultConfig ()
virtual void end ()
uint32_t framesPerSecond ()
virtual void pwmWrite (int channel, int value)=0
virtual void setAudioInfo (AudioBaseInfo info)
 updates the sample rate dynamically More...
uint32_t underflowsPerSecond ()
virtual size_t write (const uint8_t *wrt_buffer, size_t size)
- Public Member Functions inherited from audio_tools::AudioPrint
virtual AudioBaseInfo audioInfo () override
virtual int availableForWrite ()
virtual bool doRelease ()
 If true we need to release the related memory. More...
void flush ()
virtual void setAudioInfo (AudioBaseInfo info) override
virtual void setNotifyAudioChange (AudioBaseInfoDependent &bi) override
virtual size_t write (const uint8_t *buffer, size_t size) override=0
virtual size_t write (uint8_t ch) override
- Public Member Functions inherited from Print
virtual int availableForWrite ()
void clearWriteError ()
virtual void flush ()
int getWriteError ()
size_t print (char)
size_t print (const __FlashStringHelper *)
size_t print (const char[])
size_t print (const Printable &)
size_t print (const String &)
size_t print (double, int=2)
size_t print (int, int=DEC)
size_t print (long long, int=DEC)
size_t print (long, int=DEC)
size_t print (unsigned char, int=DEC)
size_t print (unsigned int, int=DEC)
size_t print (unsigned long long, int=DEC)
size_t print (unsigned long, int=DEC)
size_t println (char)
size_t println (const __FlashStringHelper *)
size_t println (const char[])
size_t println (const Printable &)
size_t println (const String &s)
size_t println (double, int=2)
size_t println (int, int=DEC)
size_t println (long long, int=DEC)
size_t println (long, int=DEC)
size_t println (unsigned char, int=DEC)
size_t println (unsigned int, int=DEC)
size_t println (unsigned long long, int=DEC)
size_t println (unsigned long, int=DEC)
size_t println (void)
size_t write (const char *buffer, size_t size)
size_t write (const char *str)
virtual size_t write (const uint8_t *buffer, size_t size)
virtual size_t write (uint8_t)=0
- Public Member Functions inherited from audio_tools::AudioBaseInfoDependent
virtual AudioBaseInfo audioInfo ()=0
virtual void setAudioInfo (AudioBaseInfo info)=0
virtual bool validate (AudioBaseInfo &info)
virtual void setNotifyAudioChange (AudioBaseInfoDependent &bi)=0

Protected Member Functions

virtual int maxChannels ()=0
virtual int maxOutputValue ()=0
virtual int nextValue ()
 determines the next scaled value
void playNextFrame ()
void playNextFrameCallback ()
void playNextFrameStream ()
 writes the next frame to the output pins
virtual void setupPWM ()=0
virtual void setupTimer ()=0
virtual void startTimer ()
 when we get the first write -> we activate the timer to start with the output of data More...
void updateStatistics ()
- Protected Member Functions inherited from Print
void setWriteError (int err=1)

Protected Attributes

PWMConfig audio_config
NBuffer< uint8_t > * buffer = nullptr
uint32_t frame_count = 0
uint32_t frames_per_second = 0
bool is_timer_started = false
uint32_t time_1_sec
uint32_t underflow_count = 0
uint32_t underflow_per_second = 0
PWMCallbackType user_callback = nullptr
- Protected Attributes inherited from audio_tools::AudioPrint
AudioBaseInfo cfg
AudioBaseInfoDependentp_notify =nullptr
uint8_t tmp [MAX_SINGLE_CHARS]
int tmpPos =0

Detailed Description

Common functionality for PWM output.

Member Function Documentation

◆ availableForWrite()

virtual int audio_tools::PWMAudioStreamBase::availableForWrite ( )

Reimplemented from audio_tools::AudioPrint.

◆ end()

virtual void audio_tools::PWMAudioStreamBase::end ( )

◆ maxChannels()

virtual int audio_tools::PWMAudioStreamBase::maxChannels ( )
protectedpure virtual

◆ maxOutputValue()

virtual int audio_tools::PWMAudioStreamBase::maxOutputValue ( )
protectedpure virtual

◆ pwmWrite()

virtual void audio_tools::PWMAudioStreamBase::pwmWrite ( int  channel,
int  value 
pure virtual

◆ setAudioInfo()

virtual void audio_tools::PWMAudioStreamBase::setAudioInfo ( AudioBaseInfo  info)

updates the sample rate dynamically

Reimplemented from audio_tools::AudioPrint.

◆ setupPWM()

virtual void audio_tools::PWMAudioStreamBase::setupPWM ( )
protectedpure virtual

◆ setupTimer()

virtual void audio_tools::PWMAudioStreamBase::setupTimer ( )
protectedpure virtual

◆ startTimer()

virtual void audio_tools::PWMAudioStreamBase::startTimer ( )

when we get the first write -> we activate the timer to start with the output of data

Reimplemented in audio_tools::PWMAudioStreamESP32, audio_tools::PWMAudioStreamMBED, audio_tools::PWMAudioStreamPico, and audio_tools::PWMAudioStreamSTM32.

◆ write()

virtual size_t audio_tools::PWMAudioStreamBase::write ( const uint8_t *  wrt_buffer,
size_t  size 

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