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

Processor for which the encoded output is buffered in a queue. The decoding and audio output can be done on the second core by calling loop1();. More...

#include <SnapProcessorRP2040.h>

Inheritance diagram for SnapProcessorRP2040:
SnapProcessor

Public Member Functions

 SnapProcessorRP2040 (int bufferSizeBytes, int activationAtPercent=75)
 Default constructor.
 
 SnapProcessorRP2040 (SnapOutput &output, int bufferSizeBytes, 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!
 
bool doLoop1 () override
 Usually not used!
 
void end (void) override
 
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
 
void initQueues (int bufferSizeBytes)
 store parameters provided by constructor
 
bool isBufferActive ()
 
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)
 
size_t writeAudio (const uint8_t *data, size_t size) override
 Writes the encoded audio data to a queue.
 
size_t writeAudioInfo (SnapAudioHeader &header)
 
bool writeHallo ()
 
bool writeMessage ()
 
bool writeTimedMessage ()
 

Protected Attributes

int active_percent = 0
 
std::vector< int16_t > audio
 
SnapMessageBase base_message
 
std::vector< char > base_message_serialized
 
audio_tools::BufferRP2040T< uint8_t > buffer {1024, 0}
 
int buffer_count = 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
 
audio_tools::BufferRP2040T< size_t > size_queue {1, 0}
 
SnapTimesnap_time = SnapTime::instance()
 
char * start = nullptr
 
const char * TAG = "SnapProcessorRP2040"
 
SnapMessageTime time_message
 

Detailed Description

Processor for which the encoded output is buffered in a queue. The decoding and audio output can be done on the second core by calling loop1();.

Author
Phil Schatzmann
Version
0.1
Date
2024-02-26

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