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

We can build a input or an output chain: an input chain starts with setInput(); followed by add() an output chain consinsts of add() and ends with setOutput();. More...

#include <Pipeline.h>

Inheritance diagram for Pipeline:
AudioStream BaseStream AudioInfoSupport AudioInfoSource Stream Print

Classes

struct  ModifyingStreamAdapter
 Support for ModifyingOutput. More...
 

Public Member Functions

bool add (ModifyingOutput &out)
 adds a component
 
bool add (ModifyingStream &io)
 adds a component
 
void addNotifyAudioChange (AudioInfoSupport &bi) override
 Subscribes to notifications on last component of the chain.
 
virtual AudioInfo audioInfo () override
 provides the actual input AudioInfo
 
AudioInfo audioInfoOut () override
 Provides the resulting AudioInfo from the last node.
 
int available () override
 
int availableForWrite () override
 
bool begin () override
 Optional method: Calls begin on all components.
 
bool begin (AudioInfo info)
 
virtual void clearNotifyAudioChange ()
 Deletes all change notify subscriptions.
 
void end () override
 Calls end on all components.
 
virtual void flush () override
 
bool hasComponents ()
 Returns true if we have at least 1 component.
 
bool isActive ()
 Determines if the pipeline is active.
 
bool isNotifyActive ()
 Checks if the automatic AudioInfo update is active.
 
bool isOK ()
 Returns true if pipeline is correctly set up.
 
ModifyingStreamlast ()
 Provides the last component.
 
 operator bool ()
 Returns true if pipeline is correctly set up and is active.
 
ModifyingStreamoperator[] (int idx)
 Access to the components by index.
 
size_t readBytes (uint8_t *data, size_t len) override
 
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 setActive (bool flag)
 Activates/deactivates the pipeline (default is active)
 
void setAudioInfo (AudioInfo newInfo) override
 Defines the AudioInfo for the first node.
 
bool setInput (AudioStream &in)
 Defines the input for an input pipeline: must be first call before add()
 
bool setInput (Stream &in)
 Defines the input for an input pipeline: must be first call before add()
 
void setNotifyActive (bool flag)
 Activates/deactivates notifications.
 
bool setOutput (AudioOutput &out)
 Defines the output for an output pipeline: must be last call after add()
 
bool setOutput (AudioStream &out)
 Defines the output for an output pipeline: must be last call after add()
 
bool setOutput (Print &out)
 Defines the output for an output pipeline: must be last call after add()
 
int size ()
 Provides the number of components.
 
size_t write (const uint8_t *data, size_t len) override
 
virtual size_t write (uint8_t ch) override
 
virtual void writeSilence (size_t len)
 Writes len bytes of silence (=0).
 

Protected Member Functions

StreamgetInput ()
 
virtual int not_supported (int out, const char *msg="")
 
void notifyAudioChange (AudioInfo info)
 
void refillReadBuffer ()
 

Protected Attributes

int _timeout = 10
 
Vector< ModifyingStream * > cleanup {0}
 
Vector< ModifyingStream * > components {0}
 
bool has_input = false
 
bool has_output = false
 
AudioInfo info
 
bool is_active = true
 
bool is_notify_active = true
 
bool is_ok = true
 
Vector< AudioInfoSupport * > notify_vector
 
AudioStreamp_ai_input = nullptr
 
AudioInfoSourcep_ai_source = nullptr
 
AudioOutputp_out_print = nullptr
 
AudioStreamp_out_stream = nullptr
 
Printp_print = nullptr
 
Streamp_stream = nullptr
 
RingBuffer< uint8_t > tmp_in {0}
 
RingBuffer< uint8_t > tmp_out {0}
 

Detailed Description

We can build a input or an output chain: an input chain starts with setInput(); followed by add() an output chain consinsts of add() and ends with setOutput();.

Author
Phil Schatzmann

Member Function Documentation

◆ begin()

bool begin ( AudioInfo  info)
inline

Optional method: Calls begin on all components and setAudioInfo on first coponent to update the full chain

◆ getInput()

Stream* getInput ( )
inlineprotected

we read from the last node or the defined input: null if no input is available


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