arduino-snapclient
All Classes Namespaces Functions Pages
Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | List of all members
SnapProcessorBuffered Class Reference

Processor for which the encoded output is buffered in a ringbuffer in order to prevent any buffer underruns. More...

#include <SnapProcessorBuffered.h>

Inheritance diagram for SnapProcessorBuffered:
SnapProcessor

Public Member Functions

 SnapProcessorBuffered (int buffer_size, int activationAtPercent=75)
 Default constructor.
 
bool begin () override
 Sets up the output and the client.
 
const char * clientName ()
 
bool doLoop ()
 Call via SnapClient in Arduino Loop!
 
virtual bool doLoop1 ()
 Usually not used!
 
virtual void end ()
 
tv_t getLatency ()
 
const char * hostName ()
 
virtual void processExt ()
 Decode from buffer.
 
void setAudioInfo (AudioInfo info)
 
void setClient (Client &client)
 Defines an alternative client to the WiFiClient.
 
void setClientName (const char *name)
 Defines the client name (default "libsnapcast")
 
void setDecoder (AudioDecoder &dec)
 Defines the decoder class.
 
void setFastLoop (bool flag)
 
void setHostName (const char *name)
 Defines the host name (default CONFIG_SNAPCAST_CLIENT_NAME)
 
void setMacAddress (const char *adr)
 
void setOutput (AudioOutput &output)
 Defines the output class.
 
void setServerIP (IPAddress address)
 
void setServerPort (int port)
 
void setSnapOutput (SnapOutput &out)
 Defines the SnapOutput implementation.
 
void setStartOutput (bool start)
 
void setStartTask (bool flag)
 
void setVolumeFactor (float fact)
 Adjust volume by factor e.g. 1.5.
 
SnapOutputsnapOutput ()
 
float volume (void)
 Provides the volume (in the range of 0.0 to 1.0)
 
size_t writeAudio (const uint8_t *data, size_t size) override
 fill buffer
 

Protected Types

enum  loop_status_enum { LoopStart , LoopStep , LoopEnd }
 

Protected Member Functions

bool audioBegin ()
 
void audioEnd ()
 
int bufferTaskActivationLimit ()
 Determines the buffer fill limit at which we start to process the data.
 
bool connectClient ()
 connects to the server: returns true if we are connected
 
bool isBufferActive ()
 
bool processLoopStep ()
 
bool processLoopStepFast ()
 
bool processMessageCodecHeader ()
 
bool processMessageCodecHeaderExt (codec_type codecType)
 
bool processMessageCodecHeaderOpus (codec_type codecType)
 
bool processMessageCodecHeaderWav (codec_type codecType)
 
bool processMessageLoop ()
 
bool processMessageServerSettings ()
 
bool processMessageTime ()
 
bool processMessageWireChunk ()
 
bool readBaseMessage ()
 
bool readData ()
 
bool resizeData ()
 
void setMute (bool flag)
 
void setVolume (float vol)
 
bool wireChunk (SnapMessageWireChunk &wire_chunk_message)
 
size_t writeAudioInfo (SnapAudioHeader &header)
 
bool writeHallo ()
 
bool writeMessage ()
 
bool writeTimedMessage ()
 

Protected Attributes

int active_percent
 
std::vector< int16_t > audio
 
SnapMessageBase base_message
 
std::vector< char > base_message_serialized
 
RingBuffer< uint8_t > buffer {0}
 
uint16_t channels = 2
 
const char * client_name = "libsnapcast"
 
uint32_t client_state_muted = 0
 
codec_type codec_from_server = NO_CODEC
 
int16_t frame_size = 512
 
bool header_received = false
 
const char * hostname = CONFIG_SNAPCAST_CLIENT_NAME
 
bool http_task_start = true
 
int id_counter = 0
 
bool is_active = false
 
bool is_fast_loop = false
 
bool is_time_set = false
 
uint64_t last_time_sync = 0
 
loop_status_enum loop_status = LoopStart
 
const char * mac_address = "00-00-00-00-00"
 
timeval now
 
bool output_start = false
 
Client * p_client = nullptr
 
SnapOutputp_snap_output = nullptr
 
std::vector< char > send_receive_buffer
 
IPAddress server_ip
 
int server_port = CONFIG_SNAPCAST_SERVER_PORT
 
SnapMessageServerSettings server_settings_message
 
int size = 0
 
RingBuffer< int16_t > sizes {RTOS_MAX_QUEUE_ENTRY_COUNT}
 
SnapTimesnap_time = SnapTime::instance()
 
char * start = nullptr
 
const char * TAG = "SnapProcessorBuffered"
 
SnapMessageTime time_message
 

Detailed Description

Processor for which the encoded output is buffered in a ringbuffer in order to prevent any buffer underruns.

Author
Phil Schatzmann
Version
0.1
Date
2024-03-04

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