arduino-audio-tools
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
ProgressStream Class Referenceabstract

Generic calss to measure the the total bytes which were processed in order to calculate the progress as a percentage of the total size. More...

#include <AudioStreams.h>

Inheritance diagram for ProgressStream:
ModifyingStream AudioStream BaseStream AudioInfoSupport AudioInfoSource Stream Print

Public Member Functions

 ProgressStream (AudioStream &stream)
 
 ProgressStream (Print &print)
 
 ProgressStream (Stream &stream)
 
virtual void addNotifyAudioChange (AudioInfoSupport &bi)
 Adds target to be notified about audio changes.
 
virtual AudioInfo audioInfo () override
 provides the actual input AudioInfo
 
virtual AudioInfo audioInfoOut ()
 provides the actual output AudioInfo: this is usually the same as audioInfo() unless we use a transforming stream
 
int available () override
 
virtual int availableForWrite () override
 Provides the nubmer of bytes we can write.
 
bool begin () override
 
bool begin (ProgressStreamInfo info)
 
bool begin (size_t len)
 Updates the total size and restarts the percent calculation: Same as calling setSize()
 
virtual void clearNotifyAudioChange ()
 Deletes all change notify subscriptions.
 
ProgressStreamInfodefaultConfig ()
 
virtual void end ()
 
virtual void flush () override
 
bool isNotifyActive ()
 Checks if the automatic AudioInfo update is active.
 
 operator bool ()
 
float percentage ()
 Provides the processed percentage: If no size has been defined we return 0.
 
size_t processedBytes ()
 Provides the number of processed bytes.
 
size_t processedSecs ()
 Provides the number of processed seconds.
 
size_t readBytes (uint8_t *data, size_t len) override
 Provides the data from all streams mixed together.
 
virtual size_t readSilence (uint8_t *buffer, size_t length)
 Source to generate silence: just sets the buffer to 0.
 
virtual bool removeNotifyAudioChange (AudioInfoSupport &bi)
 Removes a target in order not to be notified about audio changes.
 
void setAudioInfo (AudioInfo info) override
 Defines the input AudioInfo.
 
void setNotifyActive (bool flag)
 Deactivate/Reactivate automatic AudioInfo updates: (default is active)
 
virtual void setOutput (Print &out)=0
 Defines/Changes the output target.
 
void setPrint (Print &print)
 
void setSize (size_t len)
 Updates the total size and restarts the percent calculation.
 
void setStream (Print &print)
 
void setStream (Stream &stream)
 Defines/Changes the input & output.
 
size_t size ()
 Provides the current total size (defined by setSize)
 
size_t totalBytes ()
 Provides the total_size provided in the configuration.
 
size_t totalSecs ()
 Converts the totalBytes() to seconds.
 
virtual size_t write (const uint8_t *buffer, size_t size) override
 Writes raw PCM audio data, which will be the input for the volume control.
 
virtual size_t write (uint8_t ch) override
 
virtual void writeSilence (size_t len)
 Writes len bytes of silence (=0).
 

Protected Member Functions

size_t byteRate ()
 
size_t measure (size_t len)
 
virtual int not_supported (int out, const char *msg="")
 
void notifyAudioChange (AudioInfo info)
 
void refillReadBuffer ()
 

Protected Attributes

int _timeout = 10
 
AudioInfo info
 
bool is_notify_active = true
 
Vector< AudioInfoSupport * > notify_vector
 
AudioInfoSupportp_info_from =nullptr
 
Printp_print =nullptr
 
Streamp_stream =nullptr
 
ProgressStreamInfo progress_info
 
RingBuffer< uint8_t > tmp_in {0}
 
RingBuffer< uint8_t > tmp_out {0}
 
size_t total_processed = 0
 

Detailed Description

Generic calss to measure the the total bytes which were processed in order to calculate the progress as a percentage of the total size.

Author
Phil Schatzmann

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