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

Snap Processor implementation which does not rely on FreeRTOS. More...

#include <SnapProcessor.h>

Inheritance diagram for SnapProcessor:
SnapProcessorBuffered SnapProcessorRP2040 SnapProcessorRTOS

Public Member Functions

 SnapProcessor (SnapOutput &output)
 
virtual bool begin ()
 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 ()
 
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)
 

Protected Types

enum  loop_status_enum { LoopStart , LoopStep , LoopEnd }
 

Protected Member Functions

bool audioBegin ()
 
void audioEnd ()
 
bool connectClient ()
 connects to the server: returns true if we are connected
 
virtual void processExt ()
 additional processing
 
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)
 
virtual size_t writeAudio (const uint8_t *data, size_t size)
 
size_t writeAudioInfo (SnapAudioHeader &header)
 
bool writeHallo ()
 
bool writeMessage ()
 
bool writeTimedMessage ()
 

Protected Attributes

std::vector< int16_t > audio
 
SnapMessageBase base_message
 
std::vector< char > base_message_serialized
 
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_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
 
SnapTimesnap_time = SnapTime::instance()
 
char * start = nullptr
 
const char * TAG = "SnapProcessor"
 
SnapMessageTime time_message
 

Detailed Description

Snap Processor implementation which does not rely on FreeRTOS.

Author
Phil Schatzmann
Version
0.1
Date
2023-10-28

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