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

#include <SnapProcessorRTOS.h>

Inheritance diagram for SnapProcessorRTOS:
SnapProcessor

Public Member Functions

 SnapProcessorRTOS (int buffer_size, int activationAtPercent=75)
 Default constructor.
 
 SnapProcessorRTOS (SnapOutput &output, int buffer_size, int activationAtPercent=75)
 Default constructor.
 
bool begin () override
 
virtual void doLoop ()
 Call via SnapClient in Arduino Loop!
 
void end (void) override
 
tv_t getLatency ()
 
void setAudioInfo (AudioInfo info)
 
void setClient (Client &client)
 Defines an alternative client to the WiFiClient.
 
void setDecoder (AudioDecoder &dec)
 Defines the decoder class.
 
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 Member Functions

bool audioBegin ()
 
void audioEnd ()
 
int bufferTaskActivationLimit ()
 Determines the buffer fill limit at which we start to process the data.
 
bool connectClient ()
 
void copy ()
 Copy the buffered data to the output.
 
void init_rtos (int buffer_size, int activationAtPercent)
 
bool processLoopStep ()
 
bool processMessageCodecHeader ()
 
bool processMessageCodecHeaderExt (codec_type codecType)
 
bool processMessageCodecHeaderOpus (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 ()
 

Static Protected Member Functions

static void task_copy ()
 static method for rtos task: make sure we constantly output audio
 

Protected Attributes

int active_percent
 
std::vector< int16_t > audio
 
SnapMessageBase base_message
 
std::vector< char > base_message_serialized
 
audio_tools::SynchronizedBufferRTOS< uint8_t > buffer {0}
 
uint16_t channels = 2
 
uint32_t client_state_muted = 0
 
codec_type codec_from_server = NO_CODEC
 
int16_t frame_size = 512
 
bool header_received = false
 
bool http_task_start = true
 
int id_counter = 0
 
bool is_time_set = false
 
uint64_t last_time_sync = 0
 
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
 
int size = 0
 
cpp_freertos::Queue size_queue {200, sizeof(size_t)}
 
SnapTimesnap_time = SnapTime::instance()
 
char * start = nullptr
 
const char * TAG = "SnapProcessorRTOS"
 
cpp_freertos::Task task {"output", TASK_STACK_SIZE, 1, task_copy}
 
const uint16_t TASK_STACK_SIZE = 10 * 1024
 
bool task_started = false
 
SnapMessageTime time_message
 

Static Protected Attributes

static SnapProcessorRTOSself = nullptr
 

Detailed Description

Processor for which the encoded output is buffered in a queue in order to prevent any buffer underruns. A RTOS task feeds the output from the queue.


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