arduino-audio-tools
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
CsvOutput< T > Class Template Reference

Stream Wrapper which can be used to print the values as readable ASCII to the screen to be analyzed in the Serial Plotter The frames are separated by a new line. The channels in one frame are separated by a ,. More...

#include <AudioOutput.h>

Inheritance diagram for CsvOutput< T >:
AudioOutput Print AudioInfoSupport AudioInfoSource

Public Member Functions

 CsvOutput (int buffer_size=DEFAULT_BUFFER_SIZE, bool active=true)
 
 CsvOutput (Print &out, int channels=2, int buffer_size=DEFAULT_BUFFER_SIZE, bool active=true)
 Constructor.
 
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 availableForWrite () override
 
bool begin () override
 (Re)start (e.g. if channels is set in constructor)
 
bool begin (AudioInfo info) override
 Starts the processing with the defined number of channels.
 
bool begin (int channels)
 Starts the processing with the defined number of channels.
 
virtual void clearNotifyAudioChange ()
 Deletes all change notify subscriptions.
 
AudioInfo defaultConfig ()
 Provides the default configuration.
 
AudioInfo defaultConfig (RxTxMode mode)
 
const char * delimiter ()
 Provides the current column delimiter.
 
virtual void end ()
 
virtual void flush () override
 
virtual bool isDeletable ()
 If true we need to release the related memory in the destructor.
 
bool isNotifyActive ()
 Checks if the automatic AudioInfo update is active.
 
 operator bool ()
 
virtual bool removeNotifyAudioChange (AudioInfoSupport &bi)
 Removes a target in order not to be notified about audio changes.
 
virtual void setAudioInfo (AudioInfo info) override
 defines the number of channels
 
void setDelimiter (const char *del)
 Defines an alternative (column) delimiter. The default is ,.
 
void setNotifyActive (bool flag)
 Deactivate/Reactivate automatic AudioInfo updates: (default is active)
 
virtual size_t write (const uint8_t *data, size_t len) override
 Writes the data - formatted as CSV - to the output stream.
 
virtual size_t write (uint8_t ch) override
 
virtual void writeSilence (size_t len)
 

Protected Member Functions

void notifyAudioChange (AudioInfo info)
 
void writeFrames (T *data_ptr, int frameCount)
 

Protected Attributes

int _timeout = 10
 
AudioInfo cfg
 
int channel = 0
 
T * data_ptr
 
const char * delimiter_str = ","
 
bool is_active = false
 
bool is_notify_active = true
 
Vector< AudioInfoSupport * > notify_vector
 
Printout_ptr = &Serial
 
SingleBuffer< uint8_t > tmp {MAX_SINGLE_CHARS}
 
int tmpPos = 0
 

Detailed Description

template<typename T>
class audio_tools::CsvOutput< T >

Stream Wrapper which can be used to print the values as readable ASCII to the screen to be analyzed in the Serial Plotter The frames are separated by a new line. The channels in one frame are separated by a ,.

Template Parameters
T
Author
Phil Schatzmann

Member Function Documentation

◆ writeSilence()

virtual void writeSilence ( size_t  len)
inlinevirtualinherited

Writes n 0 values (= silence)

Parameters
len

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