arduino-snapclient
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
SnapOutput Class Reference

Simple Output Class which uses the AudioTools to build an output chain with volume control and a resampler. More...

#include <SnapOutput.h>

Inheritance diagram for SnapOutput:

Public Member Functions

AudioInfo audioInfo ()
 
virtual bool begin ()
 
virtual void end (void)
 Ends the processing and releases the memory.
 
AudioDecoder & getDecoder ()
 
AudioOutput & getOutput ()
 
bool isMute ()
 checks if volume is mute
 
bool isStarted ()
 
void setAudioInfo (AudioInfo info)
 setup of all audio objects
 
void setDecoder (AudioDecoder &dec)
 Defines the decoder class.
 
void setMute (bool mute)
 mute / unmute
 
void setOutput (AudioOutput &output)
 Defines the audio output chain to the final output.
 
void setSnapTimeSync (SnapTimeSync &timeSync)
 Defines the time synchronization logic.
 
void setVolume (float vol)
 Adjust the volume.
 
void setVolumeFactor (float fact)
 Adjust volume by factor e.g. 1.5.
 
SnapTimeSyncsnapTimeSync ()
 
float volume ()
 provides the actual volume
 
virtual size_t write (const uint8_t *data, size_t size)
 Writes audio data to the queue.
 
virtual bool writeHeader (SnapAudioHeader &header)
 Provides info about the audio data.
 

Protected Member Functions

bool audioBegin ()
 setup of all audio objects
 
void audioEnd ()
 
size_t audioWrite (const void *src, size_t size)
 
void audioWriteSilence ()
 
int getDelayMs ()
 Calculate the delay in ms.
 
float playbackFactor ()
 determine actual playback speed
 
void setPlaybackFactor (float fact)
 to speed up or slow down playback
 
bool synchronizeOnStart (int delay_ms)
 
bool synchronizePlayback ()
 

Protected Attributes

AudioInfo audio_info
 
EncodedAudioStream decoder_stream
 
SnapAudioHeader header
 
bool is_audio_begin_called = false
 
bool is_mute = false
 
bool is_sync_started = false
 
AudioOutput * out = nullptr
 
SnapTimeSyncp_snap_time_sync = &time_sync_default
 
ResampleStream resample
 
SnapTimesnap_time = SnapTime::instance()
 
const char * TAG = "SnapOutput"
 
SnapTimeSyncDynamic time_sync_default
 
TimedStream timed_stream
 
float vol = 1.0
 
float vol_factor = 1.0
 
VolumeStream vol_stream
 

Detailed Description

Simple Output Class which uses the AudioTools to build an output chain with volume control and a resampler.

Author
Phil Schatzmann
Version
0.1
Date
2023-10-28

Member Function Documentation

◆ begin()

virtual bool begin ( )
inlinevirtual

Starts the processing which is also starting the the dsp_i2s_task_handler task

◆ synchronizePlayback()

bool synchronizePlayback ( )
inlineprotected

start to play audio only in valid server time: return false if to be ignored - update playback speed


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