arduino-audio-tools
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
MeasuringStream Class Reference

Class which measures the thruput. More...

#include <AudioStreams.h>

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

Public Member Functions

 MeasuringStream (int count=10, Print *logOut=nullptr)
 
 MeasuringStream (Print &print, int count=10, Print *logOut=nullptr)
 
 MeasuringStream (Stream &stream, int count=10, Print *logOut=nullptr)
 
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 ()
 
bool begin (AudioInfo info)
 
int bytesPerSecond ()
 Returns the actual thrughput in bytes per second.
 
virtual void clearNotifyAudioChange ()
 Deletes all change notify subscriptions.
 
virtual void end ()
 
virtual void flush () override
 
bool isNotifyActive ()
 Checks if the automatic AudioInfo update is active.
 
virtual operator bool ()
 
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)
 Defines the input AudioInfo.
 
void setFrameSize (int size)
 
void setNotifyActive (bool flag)
 Deactivate/Reactivate automatic AudioInfo updates: (default is active)
 
void setOutput (Print &out) override
 Defines/Changes the output target.
 
void setReportBytes (bool flag)
 Report in bytes instead of samples.
 
void setStream (Stream &io) override
 Defines/Changes the input & output.
 
uint32_t startTime ()
 Provides the time when the last measurement was started.
 
virtual size_t write (const uint8_t *data, size_t len) 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 measure (size_t len)
 
virtual int not_supported (int out, const char *msg="")
 
void notifyAudioChange (AudioInfo info)
 
void printResult ()
 
void refillReadBuffer ()
 

Protected Attributes

int _timeout = 10
 
int bytes_per_second = 0
 
int count =0
 
int frame_size = 0
 
AudioInfo info
 
bool is_notify_active = true
 
int max_count =0
 
Vector< AudioInfoSupport * > notify_vector
 
NullStream null
 
Printp_logout =nullptr
 
Printp_print =nullptr
 
Streamp_stream =nullptr
 
bool report_bytes = false
 
uint32_t start_time
 
RingBuffer< uint8_t > tmp_in {0}
 
RingBuffer< uint8_t > tmp_out {0}
 
int total_bytes = 0
 

Detailed Description

Class which measures the thruput.

Author
Phil Schatzmann

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