arduino-audio-tools
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
MozziStream Class Reference

Stream that provides audio information that was generated using the Mozzi API using the updateControl() and updateAudio() methods. More...

#include <MozziStream.h>

Inheritance diagram for MozziStream:
AudioStream VolumeSupport BaseStream AudioInfoSupport AudioInfoSource Stream Print

Public Member Functions

 MozziStream (Stream &in)
 
virtual void addNotifyAudioChange (AudioInfoSupport &bi)
 Adds target to be notified about audio changes.
 
AudioInfo audioInfo ()
 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 audioRate ()
 
virtual int available () override
 
virtual int availableForWrite () override
 
bool begin ()
 
bool begin (MozziConfig cfg)
 
virtual void clearNotifyAudioChange ()
 Deletes all change notify subscriptions.
 
MozziConfig defaultConfig ()
 
void end ()
 
virtual void flush () override
 
int getAudioInput ()
 
bool isNotifyActive ()
 Checks if the automatic AudioInfo update is active.
 
virtual operator bool ()
 
size_t readBytes (uint8_t *data, size_t len)
 Provides the data filled by calling updateAudio()
 
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 setInput (Stream &in)
 
void setNotifyActive (bool flag)
 Deactivate/Reactivate automatic AudioInfo updates: (default is active)
 
virtual bool setVolume (float volume)
 define the actual volume in the range of 0.0f to 1.0f
 
bool setVolume (int16_t vol)
 Defines the multiplication factor to scale the Mozzi value range to int16_t.
 
virtual float volume ()
 provides the actual volume in the range of 0.0f to 1.0f
 
size_t write (const uint8_t *data, size_t len)
 Write data to buffer so that we can access them by calling getAudioInput()
 
virtual size_t write (uint8_t ch) override
 
virtual void writeSilence (size_t len)
 Writes len bytes of silence (=0).
 

Protected Member Functions

int16_t avg (int16_t *values)
 
int16_t nextSample ()
 
virtual int not_supported (int out, const char *msg="")
 
void notifyAudioChange (AudioInfo info)
 
void refillReadBuffer ()
 

Protected Attributes

int _timeout = 10
 
bool active = false
 
RingBuffer< uint8_tbuffer {0}
 
MozziConfig cfg
 
int control_counter
 
int control_counter_max
 
AudioInfo info
 
int input_max = -32768
 
int input_min = 32767
 
bool is_notify_active = true
 
Vector< AudioInfoSupport * > notify_vector
 
Streamp_input = nullptr
 
RingBuffer< uint8_ttmp_in {0}
 
RingBuffer< uint8_ttmp_out {0}
 
float volume_value = 1.0f
 

Detailed Description

Stream that provides audio information that was generated using the Mozzi API using the updateControl() and updateAudio() methods.

Author
Phil Schatzmann

Member Function Documentation

◆ addNotifyAudioChange()

virtual void addNotifyAudioChange ( AudioInfoSupport bi)
inlinevirtualinherited

◆ audioInfo()

AudioInfo audioInfo ( )
inlinevirtual

provides the actual input AudioInfo

Reimplemented from AudioStream.

◆ audioInfoOut()

virtual AudioInfo audioInfoOut ( )
inlinevirtualinherited

◆ available()

virtual int available ( )
inlineoverridevirtualinherited

◆ availableForWrite()

virtual int availableForWrite ( )
inlineoverridevirtualinherited

◆ begin()

bool begin ( )
inlinevirtual

Reimplemented from BaseStream.

◆ end()

void end ( )
inlinevirtual

Reimplemented from BaseStream.

◆ flush()

virtual void flush ( )
inlineoverridevirtualinherited

Reimplemented from Print.

Reimplemented in ResampleStream, ICYStreamBuffered, BufferedTaskStream, and BufferedStream.

◆ getAudioInput()

int getAudioInput ( )
inline

Gets the next audio value either from the assigned Input Stream or the buffer that was filled by write(). The data range is defined in MozziConfig

◆ operator bool()

virtual operator bool ( )
inlinevirtualinherited

Reimplemented in A2DPStream, Pipeline, I2SStream, and MemoryStream.

◆ readBytes()

size_t readBytes ( uint8_t data,
size_t  len 
)
inlinevirtual

Provides the data filled by calling updateAudio()

Reimplemented from AudioStream.

◆ setAudioInfo()

void setAudioInfo ( AudioInfo  info)
inlinevirtual

Defines the input AudioInfo.

Reimplemented from AudioStream.

◆ setVolume()

virtual bool setVolume ( float  volume)
inlinevirtualinherited

define the actual volume in the range of 0.0f to 1.0f

Reimplemented in Maximilian, I2SCodecStream, VS1053Stream, VolumeStream, A2DPStream, and AudioPlayer.

◆ volume()

virtual float volume ( )
inlinevirtualinherited

provides the actual volume in the range of 0.0f to 1.0f

Reimplemented in I2SCodecStream, VS1053Stream, AudioPlayer, and VolumeStream.

◆ write() [1/2]

size_t write ( const uint8_t data,
size_t  len 
)
inlinevirtual

Write data to buffer so that we can access them by calling getAudioInput()

Reimplemented from AudioStream.

◆ write() [2/2]

virtual size_t write ( uint8_t  ch)
inlineoverridevirtualinherited

Reimplemented in BufferedTaskStream, and BufferedStream.


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