arduino-audio-tools
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_t > buffer {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_t > tmp_in {0}
 
RingBuffer< uint8_t > tmp_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

◆ 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


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