-
Notifications
You must be signed in to change notification settings - Fork 4
Selecting a Processor
Phil Schatzmann edited this page Feb 29, 2024
·
5 revisions
By default, the system uses the SnapProcessor class to manage the processing. The logic is quite straight forward: it requests data from the server in the Arduino loop and just submits the audio data to the decoder. There is no buffering involved, except the one that is provided by your output device (e.g. I2S).
SnapClient client(wifi, out, codec);
void begin() {
...
client.begin();
...
}
Alternatively you can select the SnapProcessorRTOS by defining your custom processor to the Snap Client (via setSnapProcesor()). Here the logic is that the Arduino loop is filling a RTOS queue and the decoder is fed by a separate RTOS task that gets the data from the queue. In the constructor of the SnapProcessorRTOS you need to define the queue size.
SnapProcessorRTOS rtos(1024*8); // define queue with 8 kbytes
SnapClient client(wifi, out, codec);
void begin(){
...
client.setSnapProcessor(rtos);
client.begin();
...
}