Simple Output Class which uses the AudioTools to build an output chain with volume control and a resampler. More...
#include <SnapOutput.h>
Public Member Functions | |
AudioInfo | audioInfo () |
size_t | audioWrite (const void *src, size_t size) |
virtual bool | begin () |
virtual void | end (void) |
Ends the processing and releases the memory. | |
AudioDecoder & | getDecoder () |
uint64_t | getLastWriteTime () |
AudioOutput & | getOutput () |
bool | isActive (uint16_t timeout=1000) |
checks if the audio is still playing | |
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. | |
SnapTimeSync & | snapTimeSync () |
bool | synchronizePlayback () |
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 () |
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) |
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 |
SnapTimeSync * | p_snap_time_sync = nullptr |
ResampleStream | resample |
SnapTime & | snap_time = SnapTime::instance() |
const char * | TAG = "SnapOutput" |
uint64_t | time_last_write = 0 |
float | vol = 1.0 |
float | vol_factor = 1.0 |
VolumeStream | vol_stream |
Simple Output Class which uses the AudioTools to build an output chain with volume control and a resampler.
|
inlinevirtual |
Starts the processing which is also starting the the dsp_i2s_task_handler task
|
inline |
start to play audio only in valid server time: return false if to be ignored - update playback speed