├── docs
└── html
│ ├── bc_s.png
│ ├── bdwn.png
│ ├── doc.png
│ ├── open.png
│ ├── closed.png
│ ├── nav_f.png
│ ├── nav_g.png
│ ├── nav_h.png
│ ├── sync_on.png
│ ├── tab_a.png
│ ├── tab_b.png
│ ├── tab_h.png
│ ├── tab_s.png
│ ├── splitbar.png
│ ├── sync_off.png
│ ├── folderclosed.png
│ ├── folderopen.png
│ ├── search
│ ├── classes_2.js
│ ├── search_l.png
│ ├── search_m.png
│ ├── search_r.png
│ ├── classes_3.js
│ ├── classes_1.js
│ ├── classes_4.js
│ ├── classes_6.js
│ ├── namespaces_0.js
│ ├── pages_0.js
│ ├── classes_8.js
│ ├── all_0.js
│ ├── all_d.js
│ ├── functions_0.js
│ ├── functions_d.js
│ ├── classes_5.js
│ ├── classes_9.js
│ ├── classes_a.js
│ ├── all_4.js
│ ├── functions_4.js
│ ├── all_2.js
│ ├── functions_2.js
│ ├── all_b.js
│ ├── functions_b.js
│ ├── searchdata.js
│ ├── all_7.js
│ ├── functions_7.js
│ ├── functions_9.js
│ ├── nomatches.html
│ ├── all_9.js
│ ├── all_3.js
│ ├── functions_3.js
│ ├── classes_7.js
│ ├── all_c.js
│ ├── functions_c.js
│ ├── all_a.js
│ ├── functions_a.js
│ ├── all_5.js
│ ├── all_6.js
│ ├── functions_5.js
│ ├── functions_6.js
│ ├── close.svg
│ ├── all_1.js
│ ├── functions_1.js
│ ├── all_0.html
│ ├── all_1.html
│ ├── all_2.html
│ ├── all_3.html
│ ├── all_4.html
│ ├── all_5.html
│ ├── all_6.html
│ ├── all_7.html
│ ├── all_8.html
│ ├── all_9.html
│ ├── all_a.html
│ ├── all_b.html
│ ├── all_c.html
│ ├── all_d.html
│ ├── pages_0.html
│ ├── classes_0.html
│ ├── classes_1.html
│ ├── classes_2.html
│ ├── classes_3.html
│ ├── classes_4.html
│ ├── classes_5.html
│ ├── classes_6.html
│ ├── classes_7.html
│ ├── classes_8.html
│ ├── classes_9.html
│ ├── classes_a.html
│ ├── functions_0.html
│ ├── functions_1.html
│ ├── functions_2.html
│ ├── functions_3.html
│ ├── functions_4.html
│ ├── functions_5.html
│ ├── functions_6.html
│ ├── functions_7.html
│ ├── functions_8.html
│ ├── functions_9.html
│ ├── functions_a.html
│ ├── functions_b.html
│ ├── functions_c.html
│ ├── functions_d.html
│ ├── namespaces_0.html
│ ├── classes_0.js
│ └── mag_sel.svg
│ ├── class_snap_output.png
│ ├── class_snap_processor.png
│ ├── class_snap_time_sync.png
│ ├── class_snap_output_simple.png
│ ├── class_snap_output_tasks.png
│ ├── class_snap_processor_tasks.png
│ ├── class_snap_time_sync_fixed.png
│ ├── class_snap_processor_r_t_o_s.png
│ ├── class_snap_time_sync_dynamic.png
│ ├── classsnap__arduino_1_1_snap_output.png
│ ├── classsnap__arduino_1_1_snap_processor.png
│ ├── classsnap__arduino_1_1_snap_time_sync.png
│ ├── class_snap_time_sync_dynamic_since_start.png
│ ├── classsnap__arduino_1_1_snap_time_sync_fixed.png
│ ├── classsnap__arduino_1_1_snap_processor_buffered.png
│ ├── classsnap__arduino_1_1_snap_processor_r_p2040.png
│ ├── classsnap__arduino_1_1_snap_processor_r_t_o_s.png
│ ├── classsnap__arduino_1_1_snap_time_sync_dynamic.png
│ ├── classsnap__arduino_1_1_snap_time_sync_dynamic_since_start.png
│ ├── menudata.js
│ ├── menu.js
│ ├── dir_da61e3e9a357748887e3ca8d7c5a0c16.html
│ ├── dir_2666c81470adc64840ad535dbb7c3c8b.html
│ ├── dir_a85da072069d9bd71d4ecf2c917a6bdd.html
│ ├── dir_68267d1309a1af8e8297ef4c3efbcdba.html
│ ├── structtime__message-members.html
│ ├── structtv-members.html
│ ├── structtv__t-members.html
│ ├── structerror-members.html
│ ├── structc_j_s_o_n___hooks-members.html
│ ├── structtime__message.html
│ ├── structsnap__arduino_1_1tv__t-members.html
│ ├── structread__buffer__t-members.html
│ ├── structwrite__buffer__t-members.html
│ ├── structinternal__hooks-members.html
│ ├── structwire__chunk__message-members.html
│ ├── structcodec__header__message-members.html
│ ├── struct_snap_message_time-members.html
│ └── structerror.html
├── .gitignore
├── library.properties
├── examples
├── Tests
│ ├── TestTime
│ │ └── TestTime.ino
│ ├── TestGetHttp
│ │ └── TestGetHttp.ino
│ └── TestOutput
│ │ └── TestOutput.ino
├── SnapClientInternalDAC
│ └── SnapClientInternalDAC.ino
├── SnapClientVS1053
│ └── SnapClientVS1053.ino
├── SnapClientI2S
│ └── SnapClientI2S.ino
├── SnapClientAudioKit
│ └── SnapClientAudioKit.ino
├── SnapClientFreeRTOS
│ └── SnapClientFreeRTOS.ino
├── SnapClientRP2040
│ └── SnapClientRP2040.ino
└── SnapClientEthernet
│ └── SnapClientEthernet.ino
├── src
├── api
│ ├── SnapLogger.h
│ ├── SnapCommon.h
│ ├── SnapProcessorBuffered.h
│ ├── SnapTime.h
│ └── SnapProcessorRP2040.h
└── SnapConfig.h
├── CMakeLists.txt
└── README.md
/docs/html/bc_s.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pschatzmann/arduino-snapclient/HEAD/docs/html/bc_s.png
--------------------------------------------------------------------------------
/docs/html/bdwn.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pschatzmann/arduino-snapclient/HEAD/docs/html/bdwn.png
--------------------------------------------------------------------------------
/docs/html/doc.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pschatzmann/arduino-snapclient/HEAD/docs/html/doc.png
--------------------------------------------------------------------------------
/docs/html/open.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pschatzmann/arduino-snapclient/HEAD/docs/html/open.png
--------------------------------------------------------------------------------
/docs/html/closed.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pschatzmann/arduino-snapclient/HEAD/docs/html/closed.png
--------------------------------------------------------------------------------
/docs/html/nav_f.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pschatzmann/arduino-snapclient/HEAD/docs/html/nav_f.png
--------------------------------------------------------------------------------
/docs/html/nav_g.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pschatzmann/arduino-snapclient/HEAD/docs/html/nav_g.png
--------------------------------------------------------------------------------
/docs/html/nav_h.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pschatzmann/arduino-snapclient/HEAD/docs/html/nav_h.png
--------------------------------------------------------------------------------
/docs/html/sync_on.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pschatzmann/arduino-snapclient/HEAD/docs/html/sync_on.png
--------------------------------------------------------------------------------
/docs/html/tab_a.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pschatzmann/arduino-snapclient/HEAD/docs/html/tab_a.png
--------------------------------------------------------------------------------
/docs/html/tab_b.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pschatzmann/arduino-snapclient/HEAD/docs/html/tab_b.png
--------------------------------------------------------------------------------
/docs/html/tab_h.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pschatzmann/arduino-snapclient/HEAD/docs/html/tab_h.png
--------------------------------------------------------------------------------
/docs/html/tab_s.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pschatzmann/arduino-snapclient/HEAD/docs/html/tab_s.png
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .vscode/
2 | build/
3 | miniaudio.h
4 | arduino-snapclient.code-workspace
5 | _deps/
6 | CMakeFiles/
--------------------------------------------------------------------------------
/docs/html/splitbar.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pschatzmann/arduino-snapclient/HEAD/docs/html/splitbar.png
--------------------------------------------------------------------------------
/docs/html/sync_off.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pschatzmann/arduino-snapclient/HEAD/docs/html/sync_off.png
--------------------------------------------------------------------------------
/docs/html/folderclosed.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pschatzmann/arduino-snapclient/HEAD/docs/html/folderclosed.png
--------------------------------------------------------------------------------
/docs/html/folderopen.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pschatzmann/arduino-snapclient/HEAD/docs/html/folderopen.png
--------------------------------------------------------------------------------
/docs/html/search/classes_2.js:
--------------------------------------------------------------------------------
1 | var searchData=
2 | [
3 | ['error_37',['error',['../structerror.html',1,'']]]
4 | ];
5 |
--------------------------------------------------------------------------------
/docs/html/class_snap_output.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pschatzmann/arduino-snapclient/HEAD/docs/html/class_snap_output.png
--------------------------------------------------------------------------------
/docs/html/search/search_l.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pschatzmann/arduino-snapclient/HEAD/docs/html/search/search_l.png
--------------------------------------------------------------------------------
/docs/html/search/search_m.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pschatzmann/arduino-snapclient/HEAD/docs/html/search/search_m.png
--------------------------------------------------------------------------------
/docs/html/search/search_r.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pschatzmann/arduino-snapclient/HEAD/docs/html/search/search_r.png
--------------------------------------------------------------------------------
/docs/html/class_snap_processor.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pschatzmann/arduino-snapclient/HEAD/docs/html/class_snap_processor.png
--------------------------------------------------------------------------------
/docs/html/class_snap_time_sync.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pschatzmann/arduino-snapclient/HEAD/docs/html/class_snap_time_sync.png
--------------------------------------------------------------------------------
/docs/html/class_snap_output_simple.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pschatzmann/arduino-snapclient/HEAD/docs/html/class_snap_output_simple.png
--------------------------------------------------------------------------------
/docs/html/class_snap_output_tasks.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pschatzmann/arduino-snapclient/HEAD/docs/html/class_snap_output_tasks.png
--------------------------------------------------------------------------------
/docs/html/class_snap_processor_tasks.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pschatzmann/arduino-snapclient/HEAD/docs/html/class_snap_processor_tasks.png
--------------------------------------------------------------------------------
/docs/html/class_snap_time_sync_fixed.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pschatzmann/arduino-snapclient/HEAD/docs/html/class_snap_time_sync_fixed.png
--------------------------------------------------------------------------------
/docs/html/search/classes_3.js:
--------------------------------------------------------------------------------
1 | var searchData=
2 | [
3 | ['hello_5fmessage_38',['hello_message',['../structhello__message.html',1,'']]]
4 | ];
5 |
--------------------------------------------------------------------------------
/docs/html/class_snap_processor_r_t_o_s.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pschatzmann/arduino-snapclient/HEAD/docs/html/class_snap_processor_r_t_o_s.png
--------------------------------------------------------------------------------
/docs/html/class_snap_time_sync_dynamic.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pschatzmann/arduino-snapclient/HEAD/docs/html/class_snap_time_sync_dynamic.png
--------------------------------------------------------------------------------
/docs/html/search/classes_1.js:
--------------------------------------------------------------------------------
1 | var searchData=
2 | [
3 | ['tv_5ft_98',['tv_t',['../structsnap__arduino_1_1tv__t.html',1,'snap_arduino']]]
4 | ];
5 |
--------------------------------------------------------------------------------
/docs/html/search/classes_4.js:
--------------------------------------------------------------------------------
1 | var searchData=
2 | [
3 | ['internal_5fhooks_39',['internal_hooks',['../structinternal__hooks.html',1,'']]]
4 | ];
5 |
--------------------------------------------------------------------------------
/docs/html/search/classes_6.js:
--------------------------------------------------------------------------------
1 | var searchData=
2 | [
3 | ['read_5fbuffer_5ft_42',['read_buffer_t',['../structread__buffer__t.html',1,'']]]
4 | ];
5 |
--------------------------------------------------------------------------------
/docs/html/search/namespaces_0.js:
--------------------------------------------------------------------------------
1 | var searchData=
2 | [
3 | ['snap_5farduino_99',['snap_arduino',['../namespacesnap__arduino.html',1,'']]]
4 | ];
5 |
--------------------------------------------------------------------------------
/docs/html/classsnap__arduino_1_1_snap_output.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pschatzmann/arduino-snapclient/HEAD/docs/html/classsnap__arduino_1_1_snap_output.png
--------------------------------------------------------------------------------
/docs/html/search/pages_0.js:
--------------------------------------------------------------------------------
1 | var searchData=
2 | [
3 | ['snapcast_20client_20for_20arduino_156',['Snapcast Client for Arduino',['../index.html',1,'']]]
4 | ];
5 |
--------------------------------------------------------------------------------
/docs/html/classsnap__arduino_1_1_snap_processor.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pschatzmann/arduino-snapclient/HEAD/docs/html/classsnap__arduino_1_1_snap_processor.png
--------------------------------------------------------------------------------
/docs/html/classsnap__arduino_1_1_snap_time_sync.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pschatzmann/arduino-snapclient/HEAD/docs/html/classsnap__arduino_1_1_snap_time_sync.png
--------------------------------------------------------------------------------
/docs/html/class_snap_time_sync_dynamic_since_start.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pschatzmann/arduino-snapclient/HEAD/docs/html/class_snap_time_sync_dynamic_since_start.png
--------------------------------------------------------------------------------
/docs/html/classsnap__arduino_1_1_snap_time_sync_fixed.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pschatzmann/arduino-snapclient/HEAD/docs/html/classsnap__arduino_1_1_snap_time_sync_fixed.png
--------------------------------------------------------------------------------
/docs/html/classsnap__arduino_1_1_snap_processor_buffered.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pschatzmann/arduino-snapclient/HEAD/docs/html/classsnap__arduino_1_1_snap_processor_buffered.png
--------------------------------------------------------------------------------
/docs/html/classsnap__arduino_1_1_snap_processor_r_p2040.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pschatzmann/arduino-snapclient/HEAD/docs/html/classsnap__arduino_1_1_snap_processor_r_p2040.png
--------------------------------------------------------------------------------
/docs/html/classsnap__arduino_1_1_snap_processor_r_t_o_s.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pschatzmann/arduino-snapclient/HEAD/docs/html/classsnap__arduino_1_1_snap_processor_r_t_o_s.png
--------------------------------------------------------------------------------
/docs/html/classsnap__arduino_1_1_snap_time_sync_dynamic.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pschatzmann/arduino-snapclient/HEAD/docs/html/classsnap__arduino_1_1_snap_time_sync_dynamic.png
--------------------------------------------------------------------------------
/docs/html/search/classes_8.js:
--------------------------------------------------------------------------------
1 | var searchData=
2 | [
3 | ['time_5fmessage_50',['time_message',['../structtime__message.html',1,'']]],
4 | ['tv_51',['tv',['../structtv.html',1,'']]]
5 | ];
6 |
--------------------------------------------------------------------------------
/docs/html/classsnap__arduino_1_1_snap_time_sync_dynamic_since_start.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pschatzmann/arduino-snapclient/HEAD/docs/html/classsnap__arduino_1_1_snap_time_sync_dynamic_since_start.png
--------------------------------------------------------------------------------
/docs/html/search/all_0.js:
--------------------------------------------------------------------------------
1 | var searchData=
2 | [
3 | ['audiobegin_0',['audioBegin',['../classsnap__arduino_1_1_snap_output.html#ab7f75dcf2fef63819309c44bca400074',1,'snap_arduino::SnapOutput']]]
4 | ];
5 |
--------------------------------------------------------------------------------
/docs/html/search/all_d.js:
--------------------------------------------------------------------------------
1 | var searchData=
2 | [
3 | ['_7esnapclient_76',['~SnapClient',['../classsnap__arduino_1_1_snap_client.html#a33755d7beaca179dfbdb2c7ef7e1943f',1,'snap_arduino::SnapClient']]]
4 | ];
5 |
--------------------------------------------------------------------------------
/docs/html/search/functions_0.js:
--------------------------------------------------------------------------------
1 | var searchData=
2 | [
3 | ['audiobegin_100',['audioBegin',['../classsnap__arduino_1_1_snap_output.html#ab7f75dcf2fef63819309c44bca400074',1,'snap_arduino::SnapOutput']]]
4 | ];
5 |
--------------------------------------------------------------------------------
/docs/html/search/functions_d.js:
--------------------------------------------------------------------------------
1 | var searchData=
2 | [
3 | ['_7esnapclient_155',['~SnapClient',['../classsnap__arduino_1_1_snap_client.html#a33755d7beaca179dfbdb2c7ef7e1943f',1,'snap_arduino::SnapClient']]]
4 | ];
5 |
--------------------------------------------------------------------------------
/docs/html/search/classes_5.js:
--------------------------------------------------------------------------------
1 | var searchData=
2 | [
3 | ['parse_5fbuffer_40',['parse_buffer',['../structparse__buffer.html',1,'']]],
4 | ['printbuffer_41',['printbuffer',['../structprintbuffer.html',1,'']]]
5 | ];
6 |
--------------------------------------------------------------------------------
/docs/html/search/classes_9.js:
--------------------------------------------------------------------------------
1 | var searchData=
2 | [
3 | ['wire_5fchunk_5fmessage_52',['wire_chunk_message',['../structwire__chunk__message.html',1,'']]],
4 | ['write_5fbuffer_5ft_53',['write_buffer_t',['../structwrite__buffer__t.html',1,'']]]
5 | ];
6 |
--------------------------------------------------------------------------------
/docs/html/search/classes_a.js:
--------------------------------------------------------------------------------
1 | var searchData=
2 | [
3 | ['wire_5fchunk_5fmessage_52',['wire_chunk_message',['../structwire__chunk__message.html',1,'']]],
4 | ['write_5fbuffer_5ft_53',['write_buffer_t',['../structwrite__buffer__t.html',1,'']]]
5 | ];
6 |
--------------------------------------------------------------------------------
/library.properties:
--------------------------------------------------------------------------------
1 | name=snapclient
2 | version=0.1.1
3 | author=https://github.com/jorgenkraghjakobsen
4 | maintainer=Phil Schatzmann
5 | sentence=snapclient
6 | paragraph=snapclient
7 | category=Signal Input/Output
8 | url=https://github.com/pschatzmann/arduino-sanpclient
9 | architectures=*
10 |
--------------------------------------------------------------------------------
/docs/html/search/all_4.js:
--------------------------------------------------------------------------------
1 | var searchData=
2 | [
3 | ['end_7',['end',['../classsnap__arduino_1_1_snap_output.html#af8e0a63ec718201627220299012e654f',1,'snap_arduino::SnapOutput::end()'],['../classsnap__arduino_1_1_snap_client.html#a081b5c662ecee58405a543518f699d31',1,'snap_arduino::SnapClient::end()']]]
4 | ];
5 |
--------------------------------------------------------------------------------
/docs/html/search/functions_4.js:
--------------------------------------------------------------------------------
1 | var searchData=
2 | [
3 | ['end_107',['end',['../classsnap__arduino_1_1_snap_output.html#af8e0a63ec718201627220299012e654f',1,'snap_arduino::SnapOutput::end()'],['../classsnap__arduino_1_1_snap_client.html#a081b5c662ecee58405a543518f699d31',1,'snap_arduino::SnapClient::end()']]]
4 | ];
5 |
--------------------------------------------------------------------------------
/docs/html/search/all_2.js:
--------------------------------------------------------------------------------
1 | var searchData=
2 | [
3 | ['connectclient_3',['connectClient',['../classsnap__arduino_1_1_snap_processor.html#a66f87ab2cb4fc7994001ed5dad8af679',1,'snap_arduino::SnapProcessor']]],
4 | ['copy_4',['copy',['../classsnap__arduino_1_1_snap_processor_r_t_o_s.html#aaa6c087511a52e64fc9ad92820c7c0a8',1,'snap_arduino::SnapProcessorRTOS']]]
5 | ];
6 |
--------------------------------------------------------------------------------
/docs/html/search/functions_2.js:
--------------------------------------------------------------------------------
1 | var searchData=
2 | [
3 | ['connectclient_103',['connectClient',['../classsnap__arduino_1_1_snap_processor.html#a66f87ab2cb4fc7994001ed5dad8af679',1,'snap_arduino::SnapProcessor']]],
4 | ['copy_104',['copy',['../classsnap__arduino_1_1_snap_processor_r_t_o_s.html#aaa6c087511a52e64fc9ad92820c7c0a8',1,'snap_arduino::SnapProcessorRTOS']]]
5 | ];
6 |
--------------------------------------------------------------------------------
/docs/html/search/all_b.js:
--------------------------------------------------------------------------------
1 | var searchData=
2 | [
3 | ['volume_72',['volume',['../classsnap__arduino_1_1_snap_output.html#a1d59a107c6918cdc9a17b92f6cd4e136',1,'snap_arduino::SnapOutput::volume()'],['../classsnap__arduino_1_1_snap_processor.html#a92937495d01c777a843b576f7fd02145',1,'snap_arduino::SnapProcessor::volume()'],['../classsnap__arduino_1_1_snap_client.html#a92937495d01c777a843b576f7fd02145',1,'snap_arduino::SnapClient::volume()']]]
4 | ];
5 |
--------------------------------------------------------------------------------
/docs/html/search/functions_b.js:
--------------------------------------------------------------------------------
1 | var searchData=
2 | [
3 | ['volume_151',['volume',['../classsnap__arduino_1_1_snap_output.html#a1d59a107c6918cdc9a17b92f6cd4e136',1,'snap_arduino::SnapOutput::volume()'],['../classsnap__arduino_1_1_snap_processor.html#a92937495d01c777a843b576f7fd02145',1,'snap_arduino::SnapProcessor::volume()'],['../classsnap__arduino_1_1_snap_client.html#a92937495d01c777a843b576f7fd02145',1,'snap_arduino::SnapClient::volume()']]]
4 | ];
5 |
--------------------------------------------------------------------------------
/docs/html/search/searchdata.js:
--------------------------------------------------------------------------------
1 | var indexSectionsWithContent =
2 | {
3 | 0: "abcdegipstuvw~",
4 | 1: "st",
5 | 2: "s",
6 | 3: "abcdegipstuvw~",
7 | 4: "s"
8 | };
9 |
10 | var indexSectionNames =
11 | {
12 | 0: "all",
13 | 1: "classes",
14 | 2: "namespaces",
15 | 3: "functions",
16 | 4: "pages"
17 | };
18 |
19 | var indexSectionLabels =
20 | {
21 | 0: "All",
22 | 1: "Classes",
23 | 2: "Namespaces",
24 | 3: "Functions",
25 | 4: "Pages"
26 | };
27 |
28 |
--------------------------------------------------------------------------------
/docs/html/search/all_7.js:
--------------------------------------------------------------------------------
1 | var searchData=
2 | [
3 | ['playbackfactor_17',['playbackFactor',['../classsnap__arduino_1_1_snap_output.html#a6f02241f9435b0062580626d1894a573',1,'snap_arduino::SnapOutput']]],
4 | ['processext_18',['processExt',['../classsnap__arduino_1_1_snap_processor.html#a9ace7c86de0ecc5afd903ec1bddbcc70',1,'snap_arduino::SnapProcessor::processExt()'],['../classsnap__arduino_1_1_snap_processor_buffered.html#a9ace7c86de0ecc5afd903ec1bddbcc70',1,'snap_arduino::SnapProcessorBuffered::processExt()']]]
5 | ];
6 |
--------------------------------------------------------------------------------
/docs/html/search/functions_7.js:
--------------------------------------------------------------------------------
1 | var searchData=
2 | [
3 | ['playbackfactor_117',['playbackFactor',['../classsnap__arduino_1_1_snap_output.html#a6f02241f9435b0062580626d1894a573',1,'snap_arduino::SnapOutput']]],
4 | ['processext_118',['processExt',['../classsnap__arduino_1_1_snap_processor.html#a9ace7c86de0ecc5afd903ec1bddbcc70',1,'snap_arduino::SnapProcessor::processExt()'],['../classsnap__arduino_1_1_snap_processor_buffered.html#a9ace7c86de0ecc5afd903ec1bddbcc70',1,'snap_arduino::SnapProcessorBuffered::processExt()']]]
5 | ];
6 |
--------------------------------------------------------------------------------
/docs/html/search/functions_9.js:
--------------------------------------------------------------------------------
1 | var searchData=
2 | [
3 | ['task_5fcopy_146',['task_copy',['../classsnap__arduino_1_1_snap_processor_r_t_o_s.html#a2725cad0984c9c469b19fd065371fe69',1,'snap_arduino::SnapProcessorRTOS']]],
4 | ['time_147',['time',['../classsnap__arduino_1_1_snap_time.html#a0371cbc995b3b2f546215d4ebfc11ade',1,'snap_arduino::SnapTime']]],
5 | ['timedifferenceclientserverms_148',['timeDifferenceClientServerMs',['../classsnap__arduino_1_1_snap_time.html#a058d57baeeb43619ca44ee9342b6c70c',1,'snap_arduino::SnapTime']]]
6 | ];
7 |
--------------------------------------------------------------------------------
/docs/html/search/nomatches.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/examples/Tests/TestTime/TestTime.ino:
--------------------------------------------------------------------------------
1 | #include "AudioTools.h"
2 | #include "SnapClient.h"
3 | #include "AudioTools/AudioCodecs/CodecOpus.h"
4 |
5 | OpusAudioDecoder opus;
6 | NullStream out;
7 | SnapClient client(out, opus);
8 |
9 | void setup() {
10 | Serial.begin(115200);
11 | // login to wifi
12 | WiFi.begin(CONFIG_WIFI_SSID, CONFIG_WIFI_PASSWORD);
13 | Serial.print("Connecting to WiFi ..");
14 | while (WiFi.status() != WL_CONNECTED) {
15 | Serial.print('.');
16 | delay(1000);
17 | }
18 |
19 | client.setStartTask(false);
20 | client.begin();
21 | }
22 |
23 | void loop() {}
--------------------------------------------------------------------------------
/docs/html/search/all_9.js:
--------------------------------------------------------------------------------
1 | var searchData=
2 | [
3 | ['task_5fcopy_66',['task_copy',['../classsnap__arduino_1_1_snap_processor_r_t_o_s.html#a2725cad0984c9c469b19fd065371fe69',1,'snap_arduino::SnapProcessorRTOS']]],
4 | ['time_67',['time',['../classsnap__arduino_1_1_snap_time.html#a0371cbc995b3b2f546215d4ebfc11ade',1,'snap_arduino::SnapTime']]],
5 | ['timedifferenceclientserverms_68',['timeDifferenceClientServerMs',['../classsnap__arduino_1_1_snap_time.html#a058d57baeeb43619ca44ee9342b6c70c',1,'snap_arduino::SnapTime']]],
6 | ['tv_5ft_69',['tv_t',['../structsnap__arduino_1_1tv__t.html',1,'snap_arduino']]]
7 | ];
8 |
--------------------------------------------------------------------------------
/examples/Tests/TestGetHttp/TestGetHttp.ino:
--------------------------------------------------------------------------------
1 |
2 | #include "AudioTools.h"
3 | #include "SnapClient.h"
4 | #include "AudioTools/AudioCodecs/CodecOpus.h"
5 |
6 | OpusAudioDecoder opus;
7 | NullStream out;
8 | SnapClient client(out,opus);
9 |
10 | void setup() {
11 | Serial.begin(115200);
12 | // login to wifi
13 | WiFi.begin(CONFIG_WIFI_SSID, CONFIG_WIFI_PASSWORD);
14 | Serial.print("Connecting to WiFi ..");
15 | while (WiFi.status() != WL_CONNECTED) {
16 | Serial.print('.');
17 | delay(1000);
18 | }
19 |
20 | client.setStartOutput(false);
21 | client.begin();
22 | }
23 |
24 | void loop() {}
--------------------------------------------------------------------------------
/docs/html/search/all_3.js:
--------------------------------------------------------------------------------
1 | var searchData=
2 | [
3 | ['doloop_5',['doLoop',['../classsnap__arduino_1_1_snap_processor.html#abdd99e468f667b748b0c9bfd395163d7',1,'snap_arduino::SnapProcessor::doLoop()'],['../classsnap__arduino_1_1_snap_client.html#abdd99e468f667b748b0c9bfd395163d7',1,'snap_arduino::SnapClient::doLoop()']]],
4 | ['doloop1_6',['doLoop1',['../classsnap__arduino_1_1_snap_processor.html#acd628840f7e43d32563552bda5f90689',1,'snap_arduino::SnapProcessor::doLoop1()'],['../classsnap__arduino_1_1_snap_processor_r_p2040.html#ac5e4b26fa498b1963ace4509ebf4b86e',1,'snap_arduino::SnapProcessorRP2040::doLoop1()']]]
5 | ];
6 |
--------------------------------------------------------------------------------
/src/api/SnapLogger.h:
--------------------------------------------------------------------------------
1 | /**
2 | * Logging: on the ESP32 we use the provided logger. On other platforms we write to stderr
3 | */
4 |
5 | #pragma once
6 |
7 | #ifdef ESP32
8 | # include "esp_log.h"
9 | #else
10 | static char msg[100] = ": ";
11 | # define DEFAULT_LOG(...) { Serial.print(__PRETTY_FUNCTION__); snprintf((char*)msg+2, 100, __VA_ARGS__); Serial.println(msg); }
12 | # define ESP_LOGE(tag, ...) DEFAULT_LOG(__VA_ARGS__)
13 | # define ESP_LOGW(tag, ...) DEFAULT_LOG(__VA_ARGS__)
14 | # define ESP_LOGI(tag, ...) //DEFAULT_LOG(__VA_ARGS__)
15 | # define ESP_LOGD(tag, ...) //DEFAULT_LOG(__VA_ARGS__)
16 | #endif
--------------------------------------------------------------------------------
/docs/html/search/functions_3.js:
--------------------------------------------------------------------------------
1 | var searchData=
2 | [
3 | ['doloop_105',['doLoop',['../classsnap__arduino_1_1_snap_processor.html#abdd99e468f667b748b0c9bfd395163d7',1,'snap_arduino::SnapProcessor::doLoop()'],['../classsnap__arduino_1_1_snap_client.html#abdd99e468f667b748b0c9bfd395163d7',1,'snap_arduino::SnapClient::doLoop()']]],
4 | ['doloop1_106',['doLoop1',['../classsnap__arduino_1_1_snap_processor.html#acd628840f7e43d32563552bda5f90689',1,'snap_arduino::SnapProcessor::doLoop1()'],['../classsnap__arduino_1_1_snap_processor_r_p2040.html#ac5e4b26fa498b1963ace4509ebf4b86e',1,'snap_arduino::SnapProcessorRP2040::doLoop1()']]]
5 | ];
6 |
--------------------------------------------------------------------------------
/examples/Tests/TestOutput/TestOutput.ino:
--------------------------------------------------------------------------------
1 | #include "AudioTools.h"
2 | #include "SnapClient.h"
3 | #include "AudioTools/AudioCodecs/CodecOpus.h"
4 |
5 | OpusAudioDecoder opus;
6 | NullStream out;
7 | SnapClient client(out, opus);
8 |
9 | void setup() {
10 | Serial.begin(115200);
11 |
12 | // login to wifi
13 | WiFi.begin(CONFIG_WIFI_SSID, CONFIG_WIFI_PASSWORD);
14 | Serial.print("Connecting to WiFi ..");
15 | while (WiFi.status() != WL_CONNECTED) {
16 | Serial.print('.');
17 | delay(1000);
18 | }
19 |
20 | // do not start http task
21 | client.setStartTask(false);
22 | client.begin();
23 | }
24 |
25 | void loop() {}
--------------------------------------------------------------------------------
/docs/html/search/classes_7.js:
--------------------------------------------------------------------------------
1 | var searchData=
2 | [
3 | ['server_5fsettings_5fmessage_43',['server_settings_message',['../structserver__settings__message.html',1,'']]],
4 | ['snapaudioheader_44',['SnapAudioHeader',['../struct_snap_audio_header.html',1,'']]],
5 | ['snapclient_45',['SnapClient',['../class_snap_client.html',1,'']]],
6 | ['snapoutputsimple_46',['SnapOutputSimple',['../class_snap_output_simple.html',1,'']]],
7 | ['snapoutputtasks_47',['SnapOutputTasks',['../class_snap_output_tasks.html',1,'']]],
8 | ['snapprocessor_48',['SnapProcessor',['../class_snap_processor.html',1,'']]],
9 | ['snapprocessortasks_49',['SnapProcessorTasks',['../class_snap_processor_tasks.html',1,'']]]
10 | ];
11 |
--------------------------------------------------------------------------------
/docs/html/search/all_c.js:
--------------------------------------------------------------------------------
1 | var searchData=
2 | [
3 | ['write_73',['write',['../classsnap__arduino_1_1_snap_output.html#a5f985ca872c6ce5fb8fe126cf9a0a01f',1,'snap_arduino::SnapOutput']]],
4 | ['writeaudio_74',['writeAudio',['../classsnap__arduino_1_1_snap_processor_buffered.html#af26d304c20113d4184aa61703aef6bc7',1,'snap_arduino::SnapProcessorBuffered::writeAudio()'],['../classsnap__arduino_1_1_snap_processor_r_p2040.html#af26d304c20113d4184aa61703aef6bc7',1,'snap_arduino::SnapProcessorRP2040::writeAudio()'],['../classsnap__arduino_1_1_snap_processor_r_t_o_s.html#af26d304c20113d4184aa61703aef6bc7',1,'snap_arduino::SnapProcessorRTOS::writeAudio()']]],
5 | ['writeheader_75',['writeHeader',['../classsnap__arduino_1_1_snap_output.html#a86e635e425cf8781cb707183a1648f35',1,'snap_arduino::SnapOutput']]]
6 | ];
7 |
--------------------------------------------------------------------------------
/docs/html/search/functions_c.js:
--------------------------------------------------------------------------------
1 | var searchData=
2 | [
3 | ['write_152',['write',['../classsnap__arduino_1_1_snap_output.html#a5f985ca872c6ce5fb8fe126cf9a0a01f',1,'snap_arduino::SnapOutput']]],
4 | ['writeaudio_153',['writeAudio',['../classsnap__arduino_1_1_snap_processor_buffered.html#af26d304c20113d4184aa61703aef6bc7',1,'snap_arduino::SnapProcessorBuffered::writeAudio()'],['../classsnap__arduino_1_1_snap_processor_r_p2040.html#af26d304c20113d4184aa61703aef6bc7',1,'snap_arduino::SnapProcessorRP2040::writeAudio()'],['../classsnap__arduino_1_1_snap_processor_r_t_o_s.html#af26d304c20113d4184aa61703aef6bc7',1,'snap_arduino::SnapProcessorRTOS::writeAudio()']]],
5 | ['writeheader_154',['writeHeader',['../classsnap__arduino_1_1_snap_output.html#a86e635e425cf8781cb707183a1648f35',1,'snap_arduino::SnapOutput']]]
6 | ];
7 |
--------------------------------------------------------------------------------
/docs/html/search/all_a.js:
--------------------------------------------------------------------------------
1 | var searchData=
2 | [
3 | ['updateactualdelay_70',['updateActualDelay',['../classsnap__arduino_1_1_snap_time_sync.html#a159ed048ebe13885c54954aa2a78546b',1,'snap_arduino::SnapTimeSync']]],
4 | ['updateservertime_71',['updateServerTime',['../classsnap__arduino_1_1_snap_time_sync.html#af8923b482e191076bb12d2285f39ae09',1,'snap_arduino::SnapTimeSync::updateServerTime()'],['../classsnap__arduino_1_1_snap_time_sync_dynamic.html#ae8d7b0aa7af23a93851e1a4245939696',1,'snap_arduino::SnapTimeSyncDynamic::updateServerTime()'],['../classsnap__arduino_1_1_snap_time_sync_dynamic_since_start.html#ae8d7b0aa7af23a93851e1a4245939696',1,'snap_arduino::SnapTimeSyncDynamicSinceStart::updateServerTime()'],['../classsnap__arduino_1_1_snap_time_sync_fixed.html#ae8d7b0aa7af23a93851e1a4245939696',1,'snap_arduino::SnapTimeSyncFixed::updateServerTime()']]]
5 | ];
6 |
--------------------------------------------------------------------------------
/docs/html/search/functions_a.js:
--------------------------------------------------------------------------------
1 | var searchData=
2 | [
3 | ['updateactualdelay_149',['updateActualDelay',['../classsnap__arduino_1_1_snap_time_sync.html#a159ed048ebe13885c54954aa2a78546b',1,'snap_arduino::SnapTimeSync']]],
4 | ['updateservertime_150',['updateServerTime',['../classsnap__arduino_1_1_snap_time_sync.html#af8923b482e191076bb12d2285f39ae09',1,'snap_arduino::SnapTimeSync::updateServerTime()'],['../classsnap__arduino_1_1_snap_time_sync_dynamic.html#ae8d7b0aa7af23a93851e1a4245939696',1,'snap_arduino::SnapTimeSyncDynamic::updateServerTime()'],['../classsnap__arduino_1_1_snap_time_sync_dynamic_since_start.html#ae8d7b0aa7af23a93851e1a4245939696',1,'snap_arduino::SnapTimeSyncDynamicSinceStart::updateServerTime()'],['../classsnap__arduino_1_1_snap_time_sync_fixed.html#ae8d7b0aa7af23a93851e1a4245939696',1,'snap_arduino::SnapTimeSyncFixed::updateServerTime()']]]
5 | ];
6 |
--------------------------------------------------------------------------------
/docs/html/search/all_5.js:
--------------------------------------------------------------------------------
1 | var searchData=
2 | [
3 | ['getdelayms_8',['getDelayMs',['../classsnap__arduino_1_1_snap_output.html#a10297964d6abd0cffcb68332fff761b5',1,'snap_arduino::SnapOutput']]],
4 | ['getfactor_9',['getFactor',['../classsnap__arduino_1_1_snap_time_sync.html#a47e677c2396350208f1a2499fced812a',1,'snap_arduino::SnapTimeSync::getFactor()'],['../classsnap__arduino_1_1_snap_time_sync_dynamic.html#a266c93347cd6fb48d564c9d12ec26059',1,'snap_arduino::SnapTimeSyncDynamic::getFactor()'],['../classsnap__arduino_1_1_snap_time_sync_dynamic_since_start.html#a266c93347cd6fb48d564c9d12ec26059',1,'snap_arduino::SnapTimeSyncDynamicSinceStart::getFactor()'],['../classsnap__arduino_1_1_snap_time_sync_fixed.html#a266c93347cd6fb48d564c9d12ec26059',1,'snap_arduino::SnapTimeSyncFixed::getFactor()']]],
5 | ['getstartdelay_10',['getStartDelay',['../classsnap__arduino_1_1_snap_time_sync.html#a8a84aacea77de2dfdc9827cb7f71c735',1,'snap_arduino::SnapTimeSync']]]
6 | ];
7 |
--------------------------------------------------------------------------------
/docs/html/search/all_6.js:
--------------------------------------------------------------------------------
1 | var searchData=
2 | [
3 | ['init_5frtos_11',['init_rtos',['../classsnap__arduino_1_1_snap_processor_r_t_o_s.html#a2ac99dcb18f12f765b2da0f7f77cd17b',1,'snap_arduino::SnapProcessorRTOS']]],
4 | ['initqueues_12',['initQueues',['../classsnap__arduino_1_1_snap_processor_r_p2040.html#a03d18f97e323fb6f4527bc29a28ae92b',1,'snap_arduino::SnapProcessorRP2040']]],
5 | ['isactive_13',['isActive',['../classsnap__arduino_1_1_snap_output.html#aed4f7586f45db6092d8ca7fa56944755',1,'snap_arduino::SnapOutput']]],
6 | ['ismute_14',['isMute',['../classsnap__arduino_1_1_snap_output.html#aa6f1c80ac878b7c454a49f0f16f2bfb0',1,'snap_arduino::SnapOutput']]],
7 | ['issync_15',['isSync',['../classsnap__arduino_1_1_snap_time_sync.html#ae361c9a0939daff16cd8652325124905',1,'snap_arduino::SnapTimeSync']]],
8 | ['iswifi_16',['isWiFi',['../classsnap__arduino_1_1_snap_client.html#a2f71e236c6bfd49b51b2b883116244d8',1,'snap_arduino::SnapClient']]]
9 | ];
10 |
--------------------------------------------------------------------------------
/docs/html/search/functions_5.js:
--------------------------------------------------------------------------------
1 | var searchData=
2 | [
3 | ['getdelayms_108',['getDelayMs',['../classsnap__arduino_1_1_snap_output.html#a10297964d6abd0cffcb68332fff761b5',1,'snap_arduino::SnapOutput']]],
4 | ['getfactor_109',['getFactor',['../classsnap__arduino_1_1_snap_time_sync.html#a47e677c2396350208f1a2499fced812a',1,'snap_arduino::SnapTimeSync::getFactor()'],['../classsnap__arduino_1_1_snap_time_sync_dynamic.html#a266c93347cd6fb48d564c9d12ec26059',1,'snap_arduino::SnapTimeSyncDynamic::getFactor()'],['../classsnap__arduino_1_1_snap_time_sync_dynamic_since_start.html#a266c93347cd6fb48d564c9d12ec26059',1,'snap_arduino::SnapTimeSyncDynamicSinceStart::getFactor()'],['../classsnap__arduino_1_1_snap_time_sync_fixed.html#a266c93347cd6fb48d564c9d12ec26059',1,'snap_arduino::SnapTimeSyncFixed::getFactor()']]],
5 | ['getstartdelay_110',['getStartDelay',['../classsnap__arduino_1_1_snap_time_sync.html#a8a84aacea77de2dfdc9827cb7f71c735',1,'snap_arduino::SnapTimeSync']]]
6 | ];
7 |
--------------------------------------------------------------------------------
/docs/html/search/functions_6.js:
--------------------------------------------------------------------------------
1 | var searchData=
2 | [
3 | ['init_5frtos_111',['init_rtos',['../classsnap__arduino_1_1_snap_processor_r_t_o_s.html#a2ac99dcb18f12f765b2da0f7f77cd17b',1,'snap_arduino::SnapProcessorRTOS']]],
4 | ['initqueues_112',['initQueues',['../classsnap__arduino_1_1_snap_processor_r_p2040.html#a03d18f97e323fb6f4527bc29a28ae92b',1,'snap_arduino::SnapProcessorRP2040']]],
5 | ['isactive_113',['isActive',['../classsnap__arduino_1_1_snap_output.html#aed4f7586f45db6092d8ca7fa56944755',1,'snap_arduino::SnapOutput']]],
6 | ['ismute_114',['isMute',['../classsnap__arduino_1_1_snap_output.html#aa6f1c80ac878b7c454a49f0f16f2bfb0',1,'snap_arduino::SnapOutput']]],
7 | ['issync_115',['isSync',['../classsnap__arduino_1_1_snap_time_sync.html#ae361c9a0939daff16cd8652325124905',1,'snap_arduino::SnapTimeSync']]],
8 | ['iswifi_116',['isWiFi',['../classsnap__arduino_1_1_snap_client.html#a2f71e236c6bfd49b51b2b883116244d8',1,'snap_arduino::SnapClient']]]
9 | ];
10 |
--------------------------------------------------------------------------------
/src/api/SnapCommon.h:
--------------------------------------------------------------------------------
1 | /**
2 | * Global Shared Objects
3 | */
4 |
5 | #pragma once
6 | #include
7 | #include
8 | #include
9 |
10 | namespace snap_arduino {
11 |
12 | enum codec_type { NO_CODEC, PCM, FLAC, OGG, OPUS };
13 | static const char *TAG="COMMON";
14 | /**
15 | * @brief Information about the next bucket
16 | * @author Phil Schatzmann
17 | * @version 0.1
18 | * @date 2023-10-28
19 | * @copyright Copyright (c) 2023
20 | */
21 | struct SnapAudioHeader {
22 | int32_t sec = 0;
23 | int32_t usec = 0;
24 | size_t size = 0;
25 | codec_type codec = NO_CODEC;
26 |
27 | uint64_t operator-(SnapAudioHeader &h1) {
28 | return (sec - h1.sec) * 1000000 + usec - h1.usec;
29 | }
30 | };
31 |
32 | /// Recording of local_ms and server_ms
33 | struct SnapTimePoints {
34 | uint32_t local_ms = millis();
35 | uint32_t server_ms;
36 | SnapTimePoints() = default;
37 | SnapTimePoints(uint32_t serverMs){
38 | server_ms = serverMs;
39 | }
40 | };
41 |
42 |
43 | inline void checkHeap() {
44 | #if CONFIG_CHECK_HEAP && defined(ESP32)
45 | heap_caps_check_integrity_all(true);
46 | #endif
47 | }
48 |
49 | inline void logHeap() {
50 | #ifdef ESP32
51 | ESP_LOGD(TAG, "Free Heap: %d / Free Heap PSRAM %d", ESP.getFreeHeap(),
52 | ESP.getFreePsram());
53 | #endif
54 | }
55 |
56 | }
57 |
--------------------------------------------------------------------------------
/examples/SnapClientInternalDAC/SnapClientInternalDAC.ino:
--------------------------------------------------------------------------------
1 | /**
2 | * @brief SnapClient with Opus decoder: OUtput to internal DAC on an ESP32
3 | * @author Phil Schatzmann
4 | * @copyright GPLv3
5 | */
6 |
7 | #include "AudioTools.h"
8 | #include "SnapClient.h"
9 | #include "AudioTools/AudioCodecs/CodecOpus.h"
10 |
11 | #define ARDUINO_LOOP_STACK_SIZE (10 * 1024)
12 |
13 | OpusAudioDecoder opus;
14 | AnalogAudioStream out;
15 | WiFiClient wifi;
16 | SnapTimeSyncDynamic synch(172, 10); // optional configuratioin
17 | SnapClient client(wifi, out, opus);
18 |
19 | void setup() {
20 | Serial.begin(115200);
21 |
22 | // login to wifi -> Define values in SnapConfig.h or replace them here
23 | WiFi.begin(CONFIG_WIFI_SSID, CONFIG_WIFI_PASSWORD);
24 | Serial.print("Connecting to WiFi ..");
25 | while (WiFi.status() != WL_CONNECTED) {
26 | Serial.print('.');
27 | delay(1000);
28 | }
29 |
30 | // print ip address
31 | Serial.println();
32 | Serial.println(WiFi.localIP());
33 |
34 | // initialize output
35 | auto cfg = out.defaultConfig();
36 | //cfg.buffer_size = 512;
37 | //cfg.buffer_count = 6;
38 | out.begin(cfg);
39 |
40 | // Define CONFIG_SNAPCAST_SERVER_HOST in SnapConfig.h or here
41 | // client.setServerIP(IPAddress(192,168,1,38));
42 |
43 | // start snap client
44 | client.begin(synch);
45 | }
46 |
47 | void loop() {
48 | client.doLoop();
49 | }
--------------------------------------------------------------------------------
/examples/SnapClientVS1053/SnapClientVS1053.ino:
--------------------------------------------------------------------------------
1 | /**
2 | * @brief SnapClient where the decoding is done by a VS1053 module.
3 | * This module supports: Ogg Vorbis / MP3 / AAC / WMA / FLAC / MIDI / WAV so
4 | * we can copy the received stream as is to the module.
5 | * DRAFT: not tested!
6 | * @author Phil Schatzmann
7 | * @copyright GPLv3
8 | */
9 | #include "AudioTools.h"
10 | #include "SnapClient.h"
11 | #include "AudioTools/AudioLibs/VS1053Stream.h"
12 |
13 |
14 | VS1053Stream out; // final output
15 | WiFiClient wifi;
16 | SnapTimeSyncDynamic synch(172, 10); // optional configuratioin
17 | CopyDecoder codec;
18 | SnapClient client(wifi, out, codec);
19 |
20 | void setup() {
21 | Serial.begin(115200);
22 |
23 | // login to wifi -> Define values in SnapConfig.h or replace them here
24 | WiFi.begin(CONFIG_WIFI_SSID, CONFIG_WIFI_PASSWORD);
25 | Serial.print("Connecting to WiFi ..");
26 | while (WiFi.status() != WL_CONNECTED) {
27 | Serial.print('.');
28 | delay(1000);
29 | }
30 |
31 | // print ip address
32 | Serial.println();
33 | Serial.println(WiFi.localIP());
34 |
35 | // use full volume of VS1053
36 | out.setVolume(1.0);
37 |
38 | // Define CONFIG_SNAPCAST_SERVER_HOST in SnapConfig.h or here
39 | // client.setServerIP(IPAddress(192,168,1,38));
40 |
41 | // start snap client
42 | client.begin(synch);
43 | }
44 |
45 | void loop() {
46 | client.doLoop();
47 | }
--------------------------------------------------------------------------------
/docs/html/search/close.svg:
--------------------------------------------------------------------------------
1 |
2 |
13 |
15 |
16 |
18 | image/svg+xml
19 |
21 |
22 |
23 |
24 |
25 |
27 |
31 |
32 |
--------------------------------------------------------------------------------
/examples/SnapClientI2S/SnapClientI2S.ino:
--------------------------------------------------------------------------------
1 | /**
2 | * @brief SnapClient with Opus decoder: I2S OUtput on an ESP32
3 | * @author Phil Schatzmann
4 | * @copyright GPLv3
5 | */
6 |
7 | #include "AudioTools.h"
8 | #include "SnapClient.h"
9 | #include "AudioTools/AudioCodecs/CodecOpus.h"
10 |
11 | #define ARDUINO_LOOP_STACK_SIZE (10 * 1024)
12 |
13 | OpusAudioDecoder opus;
14 | I2SStream out;
15 | WiFiClient wifi;
16 | SnapTimeSyncDynamic synch(172, 10); // optional configuratioin
17 | SnapClient client(wifi, out, opus);
18 |
19 | void setup() {
20 | Serial.begin(115200);
21 |
22 | // login to wifi -> Define values in SnapConfig.h or replace them here
23 | WiFi.begin(CONFIG_WIFI_SSID, CONFIG_WIFI_PASSWORD);
24 | Serial.print("Connecting to WiFi ..");
25 | while (WiFi.status() != WL_CONNECTED) {
26 | Serial.print('.');
27 | delay(1000);
28 | }
29 |
30 | // print ip address
31 | Serial.println();
32 | Serial.println(WiFi.localIP());
33 |
34 | // setup I2S to define custom pins
35 | auto cfg = out.defaultConfig();
36 | cfg.pin_bck = 14;
37 | cfg.pin_ws = 15;
38 | cfg.pin_data = 22;
39 | //cfg.buffer_size = 512;
40 | //cfg.buffer_count = 6;
41 | out.begin(cfg);
42 |
43 | // Define CONFIG_SNAPCAST_SERVER_HOST in SnapConfig.h or here
44 | // client.setServerIP(IPAddress(192,168,1,38));
45 |
46 | // start snap client
47 | client.begin(synch);
48 | }
49 |
50 | void loop() {
51 | client.doLoop();
52 | }
--------------------------------------------------------------------------------
/docs/html/search/all_1.js:
--------------------------------------------------------------------------------
1 | var searchData=
2 | [
3 | ['begin_1',['begin',['../classsnap__arduino_1_1_snap_output.html#a50f45551c10ca30a0bc7f447e70188b1',1,'snap_arduino::SnapOutput::begin()'],['../classsnap__arduino_1_1_snap_processor.html#a50f45551c10ca30a0bc7f447e70188b1',1,'snap_arduino::SnapProcessor::begin()'],['../classsnap__arduino_1_1_snap_processor_buffered.html#acba365cc28eb702040c382646cfb0a7a',1,'snap_arduino::SnapProcessorBuffered::begin()'],['../classsnap__arduino_1_1_snap_processor_r_p2040.html#acba365cc28eb702040c382646cfb0a7a',1,'snap_arduino::SnapProcessorRP2040::begin()'],['../classsnap__arduino_1_1_snap_processor_r_t_o_s.html#acba365cc28eb702040c382646cfb0a7a',1,'snap_arduino::SnapProcessorRTOS::begin()'],['../classsnap__arduino_1_1_snap_time_sync.html#a4574307f85a0f36e8f25910d3361f84e',1,'snap_arduino::SnapTimeSync::begin()'],['../classsnap__arduino_1_1_snap_client.html#abc2c0a4c4160fe59696af412649e43eb',1,'snap_arduino::SnapClient::begin(SnapTimeSync &timeSync)'],['../classsnap__arduino_1_1_snap_client.html#a601fb7cf1fc15db50c71a826f084f934',1,'snap_arduino::SnapClient::begin()']]],
4 | ['buffertaskactivationlimit_2',['bufferTaskActivationLimit',['../classsnap__arduino_1_1_snap_processor_buffered.html#a8cbdf6515e63a9997a9245cf7bc2929c',1,'snap_arduino::SnapProcessorBuffered::bufferTaskActivationLimit()'],['../classsnap__arduino_1_1_snap_processor_r_t_o_s.html#a8cbdf6515e63a9997a9245cf7bc2929c',1,'snap_arduino::SnapProcessorRTOS::bufferTaskActivationLimit()']]]
5 | ];
6 |
--------------------------------------------------------------------------------
/docs/html/search/functions_1.js:
--------------------------------------------------------------------------------
1 | var searchData=
2 | [
3 | ['begin_101',['begin',['../classsnap__arduino_1_1_snap_output.html#a50f45551c10ca30a0bc7f447e70188b1',1,'snap_arduino::SnapOutput::begin()'],['../classsnap__arduino_1_1_snap_processor.html#a50f45551c10ca30a0bc7f447e70188b1',1,'snap_arduino::SnapProcessor::begin()'],['../classsnap__arduino_1_1_snap_processor_buffered.html#acba365cc28eb702040c382646cfb0a7a',1,'snap_arduino::SnapProcessorBuffered::begin()'],['../classsnap__arduino_1_1_snap_processor_r_p2040.html#acba365cc28eb702040c382646cfb0a7a',1,'snap_arduino::SnapProcessorRP2040::begin()'],['../classsnap__arduino_1_1_snap_processor_r_t_o_s.html#acba365cc28eb702040c382646cfb0a7a',1,'snap_arduino::SnapProcessorRTOS::begin()'],['../classsnap__arduino_1_1_snap_time_sync.html#a4574307f85a0f36e8f25910d3361f84e',1,'snap_arduino::SnapTimeSync::begin()'],['../classsnap__arduino_1_1_snap_client.html#abc2c0a4c4160fe59696af412649e43eb',1,'snap_arduino::SnapClient::begin(SnapTimeSync &timeSync)'],['../classsnap__arduino_1_1_snap_client.html#a601fb7cf1fc15db50c71a826f084f934',1,'snap_arduino::SnapClient::begin()']]],
4 | ['buffertaskactivationlimit_102',['bufferTaskActivationLimit',['../classsnap__arduino_1_1_snap_processor_buffered.html#a8cbdf6515e63a9997a9245cf7bc2929c',1,'snap_arduino::SnapProcessorBuffered::bufferTaskActivationLimit()'],['../classsnap__arduino_1_1_snap_processor_r_t_o_s.html#a8cbdf6515e63a9997a9245cf7bc2929c',1,'snap_arduino::SnapProcessorRTOS::bufferTaskActivationLimit()']]]
5 | ];
6 |
--------------------------------------------------------------------------------
/examples/SnapClientAudioKit/SnapClientAudioKit.ino:
--------------------------------------------------------------------------------
1 | /**
2 | * @brief SnapClient with Opus decoder: I2S Output to an ESP32 AudioKit
3 | * @author Phil Schatzmann
4 | * @copyright GPLv3
5 | */
6 | #include "AudioTools.h"
7 | #include "SnapClient.h"
8 | #include "AudioTools/AudioLibs/AudioBoardStream.h" // install https://github.com/pschatzmann/arduino-audio-driver
9 | #include "AudioTools/AudioCodecs/CodecOpus.h" // https://github.com/pschatzmann/arduino-libopus
10 |
11 | #define ARDUINO_LOOP_STACK_SIZE (10 * 1024)
12 |
13 | AudioBoardStream out(AudioKitEs8388V1);
14 | //WAVDecoder pcm;
15 | OpusAudioDecoder opus;
16 | WiFiClient wifi;
17 | SnapTimeSyncDynamic synch(172, 10); // optional configuratioin
18 | SnapClient client(wifi, out, opus);
19 |
20 | void setup() {
21 | Serial.begin(115200);
22 |
23 | // login to wifi -> Define values in SnapConfig.h or replace them here
24 | WiFi.begin(CONFIG_WIFI_SSID, CONFIG_WIFI_PASSWORD);
25 | Serial.print("Connecting to WiFi ..");
26 | while (WiFi.status() != WL_CONNECTED) {
27 | Serial.print('.');
28 | delay(1000);
29 | }
30 |
31 | // print ip address
32 | Serial.println();
33 | Serial.println(WiFi.localIP());
34 |
35 | // use full volume of kit - volume control done by client
36 | out.setVolume(1.0);
37 |
38 | // Define CONFIG_SNAPCAST_SERVER_HOST in SnapConfig.h or here
39 | // client.setServerIP(IPAddress(192,168,1,38));
40 |
41 | // start snap client
42 | client.begin(synch);
43 | }
44 |
45 | void loop() {
46 | client.doLoop();
47 | }
--------------------------------------------------------------------------------
/docs/html/search/all_0.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
Loading...
13 |
14 |
19 |
Searching...
20 |
No Matches
21 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/docs/html/search/all_1.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
Loading...
13 |
14 |
19 |
Searching...
20 |
No Matches
21 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/docs/html/search/all_2.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
Loading...
13 |
14 |
19 |
Searching...
20 |
No Matches
21 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/docs/html/search/all_3.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
Loading...
13 |
14 |
19 |
Searching...
20 |
No Matches
21 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/docs/html/search/all_4.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
Loading...
13 |
14 |
19 |
Searching...
20 |
No Matches
21 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/docs/html/search/all_5.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
Loading...
13 |
14 |
19 |
Searching...
20 |
No Matches
21 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/docs/html/search/all_6.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
Loading...
13 |
14 |
19 |
Searching...
20 |
No Matches
21 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/docs/html/search/all_7.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
Loading...
13 |
14 |
19 |
Searching...
20 |
No Matches
21 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/docs/html/search/all_8.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
Loading...
13 |
14 |
19 |
Searching...
20 |
No Matches
21 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/docs/html/search/all_9.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
Loading...
13 |
14 |
19 |
Searching...
20 |
No Matches
21 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/docs/html/search/all_a.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
Loading...
13 |
14 |
19 |
Searching...
20 |
No Matches
21 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/docs/html/search/all_b.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
Loading...
13 |
14 |
19 |
Searching...
20 |
No Matches
21 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/docs/html/search/all_c.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
Loading...
13 |
14 |
19 |
Searching...
20 |
No Matches
21 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/docs/html/search/all_d.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
Loading...
13 |
14 |
19 |
Searching...
20 |
No Matches
21 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/docs/html/search/pages_0.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
Loading...
13 |
14 |
19 |
Searching...
20 |
No Matches
21 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/docs/html/search/classes_0.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
Loading...
13 |
14 |
19 |
Searching...
20 |
No Matches
21 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/docs/html/search/classes_1.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
Loading...
13 |
14 |
19 |
Searching...
20 |
No Matches
21 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/docs/html/search/classes_2.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
Loading...
13 |
14 |
19 |
Searching...
20 |
No Matches
21 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/docs/html/search/classes_3.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
Loading...
13 |
14 |
19 |
Searching...
20 |
No Matches
21 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/docs/html/search/classes_4.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
Loading...
13 |
14 |
19 |
Searching...
20 |
No Matches
21 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/docs/html/search/classes_5.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
Loading...
13 |
14 |
19 |
Searching...
20 |
No Matches
21 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/docs/html/search/classes_6.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
Loading...
13 |
14 |
19 |
Searching...
20 |
No Matches
21 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/docs/html/search/classes_7.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
Loading...
13 |
14 |
19 |
Searching...
20 |
No Matches
21 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/docs/html/search/classes_8.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
Loading...
13 |
14 |
19 |
Searching...
20 |
No Matches
21 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/docs/html/search/classes_9.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
Loading...
13 |
14 |
19 |
Searching...
20 |
No Matches
21 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/docs/html/search/classes_a.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
Loading...
13 |
14 |
19 |
Searching...
20 |
No Matches
21 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/docs/html/search/functions_0.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
Loading...
13 |
14 |
19 |
Searching...
20 |
No Matches
21 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/docs/html/search/functions_1.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
Loading...
13 |
14 |
19 |
Searching...
20 |
No Matches
21 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/docs/html/search/functions_2.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
Loading...
13 |
14 |
19 |
Searching...
20 |
No Matches
21 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/docs/html/search/functions_3.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
Loading...
13 |
14 |
19 |
Searching...
20 |
No Matches
21 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/docs/html/search/functions_4.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
Loading...
13 |
14 |
19 |
Searching...
20 |
No Matches
21 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/docs/html/search/functions_5.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
Loading...
13 |
14 |
19 |
Searching...
20 |
No Matches
21 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/docs/html/search/functions_6.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
Loading...
13 |
14 |
19 |
Searching...
20 |
No Matches
21 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/docs/html/search/functions_7.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
Loading...
13 |
14 |
19 |
Searching...
20 |
No Matches
21 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/docs/html/search/functions_8.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
Loading...
13 |
14 |
19 |
Searching...
20 |
No Matches
21 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/docs/html/search/functions_9.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
Loading...
13 |
14 |
19 |
Searching...
20 |
No Matches
21 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/docs/html/search/functions_a.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
Loading...
13 |
14 |
19 |
Searching...
20 |
No Matches
21 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/docs/html/search/functions_b.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
Loading...
13 |
14 |
19 |
Searching...
20 |
No Matches
21 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/docs/html/search/functions_c.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
Loading...
13 |
14 |
19 |
Searching...
20 |
No Matches
21 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/docs/html/search/functions_d.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
Loading...
13 |
14 |
19 |
Searching...
20 |
No Matches
21 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/docs/html/search/namespaces_0.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
Loading...
13 |
14 |
19 |
Searching...
20 |
No Matches
21 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/examples/SnapClientFreeRTOS/SnapClientFreeRTOS.ino:
--------------------------------------------------------------------------------
1 | #include "AudioTools.h"
2 | #include "SnapClient.h"
3 | #include "api/SnapProcessorRTOS.h" // install https://github.com/pschatzmann/arduino-freertos-addons
4 | #include "AudioTools/AudioLibs/AudioBoardStream.h" // install https://github.com/pschatzmann/arduino-audio-driver
5 | #include "AudioTools/AudioCodecs/CodecOpus.h" // https://github.com/pschatzmann/arduino-libopus
6 |
7 |
8 | AudioBoardStream out(AudioKitEs8388V1); // or replace with e.g. I2SStream out;
9 | //WAVDecoder pcm;
10 | OpusAudioDecoder opus;
11 | WiFiClient wifi;
12 | SnapProcessorRTOS rtos(1024*8); // define queue with 8 kbytes
13 | SnapTimeSyncDynamic synch(172, 10); // optional configuratioin
14 | SnapClient client(wifi, out, opus);
15 |
16 | void setup() {
17 | Serial.begin(115200);
18 |
19 | // login to wifi -> Define values in SnapConfig.h or replace them here
20 | WiFi.begin(CONFIG_WIFI_SSID, CONFIG_WIFI_PASSWORD);
21 | Serial.print("Connecting to WiFi ..");
22 | while (WiFi.status() != WL_CONNECTED) {
23 | Serial.print('.');
24 | delay(1000);
25 | }
26 |
27 | // initialize output
28 | auto cfg = out.defaultConfig();
29 | //cfg.buffer_size = 512;
30 | //cfg.buffer_count = 6;
31 | out.begin(cfg);
32 |
33 | // print ip address
34 | Serial.println();
35 | Serial.println(WiFi.localIP());
36 |
37 | // use full volume of kit - volume control done by client
38 | out.setVolume(1.0);
39 |
40 | // Use FreeRTOS
41 | client.setSnapProcessor(rtos);
42 |
43 | // Define CONFIG_SNAPCAST_SERVER_HOST in SnapConfig.h or here
44 | //client.setServerIP(IPAddress(192,168,1,33));
45 |
46 | // start snap client
47 | client.begin(synch);
48 | }
49 |
50 |
51 | void loop() {
52 | client.doLoop();
53 | }
--------------------------------------------------------------------------------
/src/SnapConfig.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | // activate extended functionality
4 |
5 | #ifndef CONFIG_SNAPCLIENT_SNTP_ENABLE
6 | # define CONFIG_SNAPCLIENT_SNTP_ENABLE false
7 | #endif
8 | #ifndef CONFIG_SNAPCLIENT_USE_MDNS
9 | # define CONFIG_SNAPCLIENT_USE_MDNS true
10 | #endif
11 | #ifndef CONFIG_NVS_FLASH
12 | # define CONFIG_NVS_FLASH false
13 | #endif
14 | #ifndef CONFIG_CHECK_HEAP
15 | # define CONFIG_CHECK_HEAP false
16 | #endif
17 |
18 | // snapcast parameters;
19 | #ifndef CONFIG_SNAPCAST_SERVER_HOST
20 | # define CONFIG_SNAPCAST_SERVER_HOST "192.168.1.33"
21 | #endif
22 | #ifndef CONFIG_SNAPCAST_SERVER_PORT
23 | # define CONFIG_SNAPCAST_SERVER_PORT 1704
24 | #endif
25 | #ifndef CONFIG_SNAPCAST_BUFF_LEN
26 | # define CONFIG_SNAPCAST_BUFF_LEN 1024
27 | #endif
28 | #ifndef CONFIG_SNAPCAST_CLIENT_NAME
29 | # define CONFIG_SNAPCAST_CLIENT_NAME "arduino-snapclient"
30 | #endif
31 | #ifndef CONFIG_SNTP_SERVER
32 | # define CONFIG_SNTP_SERVER "pool.ntp.org"
33 | #endif
34 | #ifndef CONFIG_CLIENT_TIMEOUT_SEC
35 | # define CONFIG_CLIENT_TIMEOUT_SEC 5
36 | #endif
37 | #ifndef CONFIG_PROCESSING_TIME_MS
38 | # define CONFIG_PROCESSING_TIME_MS -172
39 | #endif
40 | #ifndef CONFIG_STREAMIN_DECODER_BUFFER
41 | # define CONFIG_STREAMIN_DECODER_BUFFER (12 * 1024)
42 | #endif
43 |
44 | // wifi
45 | #ifndef CONFIG_WIFI_SSID
46 | # define CONFIG_WIFI_SSID "piratnet"
47 | #endif
48 | #ifndef CONFIG_WIFI_PASSWORD
49 | # define CONFIG_WIFI_PASSWORD "12341234"
50 | #endif
51 |
52 | // FreeRTOS - max number of entries in the queue
53 | #ifndef RTOS_MAX_QUEUE_ENTRY_COUNT
54 | # define RTOS_MAX_QUEUE_ENTRY_COUNT 200
55 | #endif
56 |
57 | #ifndef RTOS_STACK_SIZE
58 | # define RTOS_STACK_SIZE 10 * 1024
59 | #endif
60 |
61 | #ifndef RTOS_TASK_PRIORITY
62 | # define RTOS_TASK_PRIORITY 2
63 | #endif
64 |
65 | #ifndef SNAP_NO_NAMESPACE
66 | namespace snap_arduino {}
67 | using namespace snap_arduino;
68 | #endif
--------------------------------------------------------------------------------
/examples/SnapClientRP2040/SnapClientRP2040.ino:
--------------------------------------------------------------------------------
1 | /**
2 | * @brief SnapClient with Opus decoder: Wifi processing is on core 0, decoding and
3 | * i2s output is on core 1.
4 | * @author Phil Schatzmann
5 | * @copyright GPLv3
6 | */
7 |
8 | #include "AudioTools.h"
9 | #include "AudioTools/AudioCodecs/CodecOpus.h"
10 | #include "SnapClient.h"
11 | #include "api/SnapProcessorRP2040.h"
12 |
13 | I2SStream out;
14 | OpusAudioDecoder opus;
15 | WiFiClient wifi;
16 | //SnapTimeSyncDynamic synch(172, 10); // optional configuratioin
17 | SnapClient client(wifi, out, opus);
18 | SnapProcessorRP2040 processor_rp2040(1024*8); // define OPUS queue with 8 kbytes
19 |
20 | void setup() {
21 | Serial.begin(115200);
22 | AudioToolsLogger.begin(Serial, AudioToolsLogLevel::Info);
23 | while(!Serial);
24 | Serial.println("starting...");
25 |
26 | // login to wifi -> Define values in SnapConfig.h or replace them here
27 | WiFi.begin("ssid", "password");
28 | Serial.print("Connecting to WiFi ..");
29 | while (WiFi.status() != WL_CONNECTED) {
30 | Serial.print('.');
31 | delay(1000);
32 | }
33 |
34 | // print ip address
35 | Serial.println();
36 | Serial.println(WiFi.localIP());
37 |
38 | // Define CONFIG_SNAPCAST_SERVER_HOST in SnapConfig.h or here
39 | client.setServerIP(IPAddress(192,168,1,44));
40 | client.setSnapProcessor(processor_rp2040);
41 |
42 | // start snap client
43 | client.begin();
44 | Serial.println("started");
45 | }
46 |
47 | void loop() {
48 | // fill queue
49 | client.doLoop();
50 | }
51 |
52 | void setup1(){
53 | // setup I2S to define custom pins
54 | auto cfg = out.defaultConfig();
55 | //cfg.pin_bck = 14;
56 | //cfg.pin_ws = 15;
57 | //cfg.pin_data = 22;
58 | cfg.sample_rate = 48000;
59 | cfg.buffer_size = 1024;
60 | cfg.buffer_count = 4;
61 | out.begin(cfg);
62 | }
63 |
64 | void loop1(){
65 | // trigger output from queue
66 | processor_rp2040.doLoop1();
67 | }
--------------------------------------------------------------------------------
/examples/SnapClientEthernet/SnapClientEthernet.ino:
--------------------------------------------------------------------------------
1 | // Example for EthernetClient: We just test the output by reporting the received data bytes
2 |
3 | #include
4 | #include
5 | #include "AudioTools.h"
6 | #include "SnapClient.h"
7 |
8 | EthernetClient eth;
9 | MeasuringStream out{10, &Serial}; // log ever 10 writes
10 | CopyDecoder codec;
11 | SnapClient client(eth, out, codec);
12 | byte mac[] = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED};
13 | //IPAddress ip(192, 168, 1, 177);
14 | //IPAddress gateway(192, 168, 1, 1);
15 | //IPAddress dns(8, 8, 8, 8);
16 |
17 |
18 | void setup() {
19 | Serial.begin(115200);
20 | while(!Serial);
21 | Serial.println("setup");
22 |
23 | // example for rp2040
24 | SPI.setMISO(16);
25 | SPI.setMOSI(19);
26 | SPI.setSCK(18);
27 | SPI.setCS(17);
28 | SPI.begin(17); // use default pins$
29 |
30 | // start the Ethernet connection:
31 | Ethernet.init(17);
32 | Ethernet.begin(mac);
33 | //Ethernet.begin(mac, ip, dns, gateway);
34 |
35 | // Check for Ethernet hardware present
36 | if (Ethernet.hardwareStatus() == EthernetNoHardware) {
37 | Serial.println("Ethernet shield was not found. Sorry, can't run without hardware. :(");
38 | while (true);
39 | }
40 |
41 | // Check link status
42 | if (Ethernet.linkStatus() == LinkOFF) {
43 | Serial.println("Ethernet cable is not connected.");
44 | }
45 | Serial.print("local IP: ");
46 | Serial.println(Ethernet.localIP());
47 |
48 | // wait for link
49 | Serial.println("waiting for link...");
50 | while(Ethernet.linkStatus()!=LinkON){
51 | delay(10);
52 | }
53 |
54 | // Define CONFIG_SNAPCAST_SERVER_HOST in SnapConfig.h or here
55 | client.setServerIP(IPAddress(192, 168, 1, 44));
56 |
57 | // start snap client
58 | if (!client.begin()) {
59 | Serial.print("Could not connect to snap server");
60 | while (true);
61 | }
62 |
63 | out.setReportBytes(true);
64 | Serial.println("setup success");
65 | }
66 |
67 | void loop() { client.doLoop(); }
--------------------------------------------------------------------------------
/docs/html/search/classes_0.js:
--------------------------------------------------------------------------------
1 | var searchData=
2 | [
3 | ['snapaudioheader_77',['SnapAudioHeader',['../structsnap__arduino_1_1_snap_audio_header.html',1,'snap_arduino']]],
4 | ['snapclient_78',['SnapClient',['../classsnap__arduino_1_1_snap_client.html',1,'snap_arduino']]],
5 | ['snapmessagebase_79',['SnapMessageBase',['../structsnap__arduino_1_1_snap_message_base.html',1,'snap_arduino']]],
6 | ['snapmessagecodecheader_80',['SnapMessageCodecHeader',['../structsnap__arduino_1_1_snap_message_codec_header.html',1,'snap_arduino']]],
7 | ['snapmessagehallo_81',['SnapMessageHallo',['../structsnap__arduino_1_1_snap_message_hallo.html',1,'snap_arduino']]],
8 | ['snapmessageserversettings_82',['SnapMessageServerSettings',['../structsnap__arduino_1_1_snap_message_server_settings.html',1,'snap_arduino']]],
9 | ['snapmessagetime_83',['SnapMessageTime',['../structsnap__arduino_1_1_snap_message_time.html',1,'snap_arduino']]],
10 | ['snapmessagewirechunk_84',['SnapMessageWireChunk',['../structsnap__arduino_1_1_snap_message_wire_chunk.html',1,'snap_arduino']]],
11 | ['snapoutput_85',['SnapOutput',['../classsnap__arduino_1_1_snap_output.html',1,'snap_arduino']]],
12 | ['snapprocessor_86',['SnapProcessor',['../classsnap__arduino_1_1_snap_processor.html',1,'snap_arduino']]],
13 | ['snapprocessorbuffered_87',['SnapProcessorBuffered',['../classsnap__arduino_1_1_snap_processor_buffered.html',1,'snap_arduino']]],
14 | ['snapprocessorrp2040_88',['SnapProcessorRP2040',['../classsnap__arduino_1_1_snap_processor_r_p2040.html',1,'snap_arduino']]],
15 | ['snapprocessorrtos_89',['SnapProcessorRTOS',['../classsnap__arduino_1_1_snap_processor_r_t_o_s.html',1,'snap_arduino']]],
16 | ['snapreadbuffer_90',['SnapReadBuffer',['../structsnap__arduino_1_1_snap_read_buffer.html',1,'snap_arduino']]],
17 | ['snaptime_91',['SnapTime',['../classsnap__arduino_1_1_snap_time.html',1,'snap_arduino']]],
18 | ['snaptimepoints_92',['SnapTimePoints',['../structsnap__arduino_1_1_snap_time_points.html',1,'snap_arduino']]],
19 | ['snaptimesync_93',['SnapTimeSync',['../classsnap__arduino_1_1_snap_time_sync.html',1,'snap_arduino']]],
20 | ['snaptimesyncdynamic_94',['SnapTimeSyncDynamic',['../classsnap__arduino_1_1_snap_time_sync_dynamic.html',1,'snap_arduino']]],
21 | ['snaptimesyncdynamicsincestart_95',['SnapTimeSyncDynamicSinceStart',['../classsnap__arduino_1_1_snap_time_sync_dynamic_since_start.html',1,'snap_arduino']]],
22 | ['snaptimesyncfixed_96',['SnapTimeSyncFixed',['../classsnap__arduino_1_1_snap_time_sync_fixed.html',1,'snap_arduino']]],
23 | ['snapwritebuffer_97',['SnapWriteBuffer',['../structsnap__arduino_1_1_snap_write_buffer.html',1,'snap_arduino']]]
24 | ];
25 |
--------------------------------------------------------------------------------
/docs/html/search/mag_sel.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
19 |
21 |
22 |
24 | image/svg+xml
25 |
27 |
28 |
29 |
30 |
31 |
33 |
57 |
63 |
69 |
74 |
75 |
--------------------------------------------------------------------------------
/src/api/SnapProcessorBuffered.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include "SnapOutput.h"
3 |
4 | namespace snap_arduino {
5 |
6 | /**
7 | * @brief Processor for which the encoded output is buffered in a ringbuffer in
8 | * order to prevent any buffer underruns.
9 | * @author Phil Schatzmann
10 | * @version 0.1
11 | * @date 2024-03-04
12 | * @copyright Copyright (c) 2024
13 | */
14 | class SnapProcessorBuffered : public SnapProcessor {
15 | public:
16 | /// Default constructor
17 | SnapProcessorBuffered(int buffer_size, int activationAtPercent = 75)
18 | : SnapProcessor() {
19 | buffer.resize(buffer_size);
20 | active_percent = activationAtPercent;
21 | }
22 |
23 | bool begin() override {
24 | // regular begin logic
25 | bool result = SnapProcessor::begin();
26 | // empty buffer
27 | buffer.reset();
28 | sizes.reset();
29 | is_active = false;
30 | return result;
31 | }
32 |
33 | /// fill buffer
34 | size_t writeAudio(const uint8_t *data, size_t size) override {
35 | if (size > buffer.size()) {
36 | ESP_LOGE(TAG, "The buffer is too small. Use a multiple of %d", size);
37 | stop();
38 | }
39 | sizes.write(size);
40 | size_t result = buffer.writeArray(data, size);
41 | ESP_LOGI(TAG, "size: %zu / buffer %d", size, buffer.available());
42 |
43 | if (result != size)
44 | ESP_LOGE(TAG, "Could not buffer all data %d->%d", size, result);
45 |
46 | return result;
47 | }
48 |
49 | /// Decode from buffer
50 | virtual void processExt() {
51 | if (isBufferActive()) {
52 | int16_t step_size = sizes.read();
53 | if (step_size > 0) {
54 | uint8_t tmp[step_size];
55 | int size_eff = buffer.readArray(tmp, step_size);
56 | int size_written = SnapProcessor::writeAudio(tmp, size_eff);
57 | if (size_written != size_eff) {
58 | ESP_LOGE(TAG, "Could not write all data %d->%d", size_eff,
59 | size_written);
60 | }
61 | }
62 | }
63 | delay(1);
64 | }
65 |
66 | protected:
67 | const char *TAG = "SnapProcessorBuffered";
68 | RingBuffer buffer{0};
69 | RingBuffer sizes{RTOS_MAX_QUEUE_ENTRY_COUNT};
70 | bool is_active = false;
71 | int active_percent;
72 |
73 | bool isBufferActive() {
74 | if (!is_active) {
75 | if (buffer.available() >= bufferTaskActivationLimit()) {
76 | is_active = true;
77 | }
78 | }
79 | return is_active;
80 | }
81 |
82 | /// Determines the buffer fill limit at which we start to process the data
83 | int bufferTaskActivationLimit() {
84 | return static_cast(active_percent) / 100.0 * buffer.size();
85 | }
86 | };
87 |
88 | } // namespace snap_arduino
89 |
--------------------------------------------------------------------------------
/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.16)
2 |
3 | # set the project name
4 | project(snapclient)
5 |
6 | # we use FetchContent to install
7 | include(FetchContent)
8 |
9 | set(CMAKE_CXX_STANDARD 17)
10 |
11 | # Disable Portaudio
12 | option(ADD_PORTAUDIO "Do not use Portaudio" OFF)
13 | option(BUILD_SHARED_LIBS "Build using shared libraries" OFF)
14 |
15 | set(CODEC "opus" CACHE STRING "codec selected by the user")
16 | set_property(CACHE CODEC PROPERTY STRINGS flac ogg opus pcm)
17 |
18 |
19 | # lots of warnings and all warnings as errors ?
20 | ## add_compile_options(-Wall -Wextra )
21 |
22 | # audio tools
23 | FetchContent_Declare(arduino-audio-tools GIT_REPOSITORY https://github.com/pschatzmann/arduino-audio-tools.git GIT_TAG main )
24 | FetchContent_GetProperties(arduino-audio-tools)
25 | if(NOT arduino-audio-tools_POPULATED)
26 | FetchContent_Populate(arduino-audio-tools)
27 | add_subdirectory(${arduino-audio-tools_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}/arduino-audio-tools)
28 | endif()
29 |
30 | # opus
31 | FetchContent_Declare(arduino_libopus GIT_REPOSITORY https://github.com/pschatzmann/arduino-libopus.git GIT_TAG main )
32 | FetchContent_GetProperties(arduino_libopus)
33 | if(NOT arduino_libopus_POPULATED)
34 | FetchContent_Populate(arduino_libopus)
35 | add_subdirectory(${arduino_libopus_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}/arduino_libopus)
36 | endif()
37 |
38 | # flac
39 | if(CODEC==flac)
40 | FetchContent_Declare(arduino_libflac GIT_REPOSITORY https://github.com/pschatzmann/arduino-libflac.git GIT_TAG main )
41 | FetchContent_GetProperties(arduino_libflac)
42 | if(NOT arduino_libflac_POPULATED)
43 | FetchContent_Populate(arduino_libflac)
44 | add_subdirectory(${arduino_libflac_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}/arduino_libflac)
45 | endif()
46 | endif()
47 |
48 | # ogg
49 | if(CODEC==ogg)
50 | FetchContent_Declare(arduino_libvorbis GIT_REPOSITORY https://github.com/pschatzmann/arduino-libvorbis-idec GIT_TAG main )
51 | FetchContent_GetProperties(arduino_libvorbis)
52 | if(NOT arduino_libvorbis_POPULATED)
53 | FetchContent_Populate(arduino_libvorbis)
54 | add_subdirectory(${arduino_libvorbis_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}/arduino_libvorbis)
55 | endif()
56 | endif()
57 |
58 |
59 | add_library(snapclient INTERFACE)
60 |
61 | # define location for header files
62 | target_include_directories(snapclient INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/src )
63 |
64 | # specify libraries
65 | if(CODEC==opus)
66 | target_link_libraries(snapclient INTERFACE arduino-audio-tools arduino_emulator arduino_libopus)
67 | endif()
68 | if(CODEC==flac)
69 | target_link_libraries(snapclient INTERFACE arduino-audio-tools arduino_emulator arduino_libopus arduino_libflac)
70 | endif()
71 | if(CODEC==ogg)
72 | target_link_libraries(snapclient INTERFACE arduino-audio-tools arduino_emulator arduino_libopus arduino_libvorbis)
73 | endif()
74 |
75 | target_compile_definitions(snapclient INTERFACE -DARDUINO -DEXIT_ON_STOP -DIS_DESKTOP -DCONFIG_USE_RTOS=0 -DCONFIG_USE_PSRAM=0 -DCONFIG_SNAPCLIENT_SNTP_ENABLE=0 -DCONFIG_SNAPCLIENT_USE_MDNS=0)
76 |
77 |
78 |
--------------------------------------------------------------------------------
/docs/html/menudata.js:
--------------------------------------------------------------------------------
1 | /*
2 | @licstart The following is the entire license notice for the JavaScript code in this file.
3 |
4 | The MIT License (MIT)
5 |
6 | Copyright (C) 1997-2020 by Dimitri van Heesch
7 |
8 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software
9 | and associated documentation files (the "Software"), to deal in the Software without restriction,
10 | including without limitation the rights to use, copy, modify, merge, publish, distribute,
11 | sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
12 | furnished to do so, subject to the following conditions:
13 |
14 | The above copyright notice and this permission notice shall be included in all copies or
15 | substantial portions of the Software.
16 |
17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
18 | BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
20 | DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 |
23 | @licend The above is the entire license notice for the JavaScript code in this file
24 | */
25 | var menudata={children:[
26 | {text:"Main Page",url:"index.html"},
27 | {text:"Namespaces",url:"namespaces.html",children:[
28 | {text:"Namespace List",url:"namespaces.html"}]},
29 | {text:"Classes",url:"annotated.html",children:[
30 | {text:"Class List",url:"annotated.html"},
31 | {text:"Class Index",url:"classes.html"},
32 | {text:"Class Hierarchy",url:"hierarchy.html"},
33 | {text:"Class Members",url:"functions.html",children:[
34 | {text:"All",url:"functions.html",children:[
35 | {text:"a",url:"functions.html#index_a"},
36 | {text:"b",url:"functions.html#index_b"},
37 | {text:"c",url:"functions.html#index_c"},
38 | {text:"d",url:"functions.html#index_d"},
39 | {text:"e",url:"functions.html#index_e"},
40 | {text:"g",url:"functions.html#index_g"},
41 | {text:"i",url:"functions.html#index_i"},
42 | {text:"p",url:"functions.html#index_p"},
43 | {text:"s",url:"functions.html#index_s"},
44 | {text:"t",url:"functions.html#index_t"},
45 | {text:"u",url:"functions.html#index_u"},
46 | {text:"v",url:"functions.html#index_v"},
47 | {text:"w",url:"functions.html#index_w"},
48 | {text:"~",url:"functions.html#index__7E"}]},
49 | {text:"Functions",url:"functions_func.html",children:[
50 | {text:"a",url:"functions_func.html#index_a"},
51 | {text:"b",url:"functions_func.html#index_b"},
52 | {text:"c",url:"functions_func.html#index_c"},
53 | {text:"d",url:"functions_func.html#index_d"},
54 | {text:"e",url:"functions_func.html#index_e"},
55 | {text:"g",url:"functions_func.html#index_g"},
56 | {text:"i",url:"functions_func.html#index_i"},
57 | {text:"p",url:"functions_func.html#index_p"},
58 | {text:"s",url:"functions_func.html#index_s"},
59 | {text:"t",url:"functions_func.html#index_t"},
60 | {text:"u",url:"functions_func.html#index_u"},
61 | {text:"v",url:"functions_func.html#index_v"},
62 | {text:"w",url:"functions_func.html#index_w"},
63 | {text:"~",url:"functions_func.html#index__7E"}]}]}]},
64 | {text:"Files",url:"files.html",children:[
65 | {text:"File List",url:"files.html"}]}]}
66 |
--------------------------------------------------------------------------------
/docs/html/menu.js:
--------------------------------------------------------------------------------
1 | /*
2 | @licstart The following is the entire license notice for the JavaScript code in this file.
3 |
4 | The MIT License (MIT)
5 |
6 | Copyright (C) 1997-2020 by Dimitri van Heesch
7 |
8 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software
9 | and associated documentation files (the "Software"), to deal in the Software without restriction,
10 | including without limitation the rights to use, copy, modify, merge, publish, distribute,
11 | sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
12 | furnished to do so, subject to the following conditions:
13 |
14 | The above copyright notice and this permission notice shall be included in all copies or
15 | substantial portions of the Software.
16 |
17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
18 | BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
20 | DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 |
23 | @licend The above is the entire license notice for the JavaScript code in this file
24 | */
25 | function initMenu(relPath,searchEnabled,serverSide,searchPage,search) {
26 | function makeTree(data,relPath) {
27 | var result='';
28 | if ('children' in data) {
29 | result+='';
36 | }
37 | return result;
38 | }
39 |
40 | $('#main-nav').append(makeTree(menudata,relPath));
41 | $('#main-nav').children(':first').addClass('sm sm-dox').attr('id','main-menu');
42 | if (searchEnabled) {
43 | if (serverSide) {
44 | $('#main-menu').append(' ');
45 | } else {
46 | $('#main-menu').append(' ');
47 | }
48 | }
49 | $('#main-menu').smartmenus();
50 | }
51 | /* @license-end */
52 |
--------------------------------------------------------------------------------
/docs/html/dir_da61e3e9a357748887e3ca8d7c5a0c16.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | arduino-snapclient: src/api Directory Reference
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 | arduino-snapclient
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
38 |
39 |
40 |
47 |
48 |
49 |
53 |
54 |
55 |
56 |
57 |
60 |
61 |
62 |
66 |
67 |
71 |
72 |
73 |
74 |
77 |
78 |
79 |
--------------------------------------------------------------------------------
/docs/html/dir_2666c81470adc64840ad535dbb7c3c8b.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | arduino-snapclient: src/sandbox Directory Reference
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 | arduino-snapclient
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
38 |
39 |
40 |
47 |
48 |
49 |
53 |
54 |
55 |
56 |
57 |
60 |
61 |
62 |
66 |
67 |
71 |
72 |
73 |
74 |
77 |
78 |
79 |
--------------------------------------------------------------------------------
/docs/html/dir_a85da072069d9bd71d4ecf2c917a6bdd.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | arduino-snapclient: src/lightsnapcast Directory Reference
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 | arduino-snapclient
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
38 |
39 |
40 |
47 |
48 |
49 |
53 |
54 |
55 |
56 |
57 |
60 |
61 |
62 |
66 |
67 |
71 |
72 |
73 |
74 |
77 |
78 |
79 |
--------------------------------------------------------------------------------
/docs/html/dir_68267d1309a1af8e8297ef4c3efbcdba.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | arduino-snapclient: src Directory Reference
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 | arduino-snapclient
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
38 |
39 |
40 |
47 |
48 |
49 |
53 |
54 |
55 |
56 |
57 |
60 |
61 |
62 |
66 |
67 |
71 |
77 |
78 |
81 |
82 |
83 |
--------------------------------------------------------------------------------
/docs/html/structtime__message-members.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | arduino-snapclient: Member List
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 | arduino-snapclient
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
38 |
39 |
40 |
47 |
48 |
49 |
53 |
54 |
55 |
56 |
57 |
60 |
61 |
62 |
63 |
67 |
68 |
69 |
This is the complete list of members for time_message , including all inherited members.
70 |
73 |
74 |
77 |
78 |
79 |
--------------------------------------------------------------------------------
/docs/html/structtv-members.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | arduino-snapclient: Member List
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 | arduino-snapclient
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
38 |
39 |
40 |
47 |
48 |
49 |
53 |
54 |
55 |
56 |
57 |
60 |
61 |
62 |
63 |
67 |
68 |
69 |
This is the complete list of members for tv , including all inherited members.
70 |
71 | sec (defined in tv )tv
72 | usec (defined in tv )tv
73 |
74 |
75 |
78 |
79 |
80 |
--------------------------------------------------------------------------------
/docs/html/structtv__t-members.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | arduino-snapclient: Member List
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 | arduino-snapclient
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
38 |
39 |
40 |
47 |
48 |
49 |
53 |
54 |
55 |
56 |
57 |
60 |
61 |
62 |
63 |
67 |
68 |
69 |
This is the complete list of members for tv_t , including all inherited members.
70 |
74 |
75 |
78 |
79 |
80 |
--------------------------------------------------------------------------------
/docs/html/structerror-members.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | arduino-snapclient: Member List
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 | arduino-snapclient
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
38 |
39 |
40 |
47 |
48 |
49 |
53 |
54 |
55 |
56 |
57 |
60 |
61 |
62 |
63 |
67 |
68 |
69 |
This is the complete list of members for error , including all inherited members.
70 |
74 |
75 |
78 |
79 |
80 |
--------------------------------------------------------------------------------
/src/api/SnapTime.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include "AudioTools/CoreAudio/AudioBasic/Collections/Vector.h"
3 | #include
4 | #include
5 |
6 | namespace snap_arduino {
7 |
8 | /**
9 | * @brief The the sys/time functions are used to represent the server time.
10 | * The local time will be measured with the help of the Arduino millis() method.
11 | * This class provides the basic functionality to translate between local and server time.
12 | * @author Phil Schatzmann
13 | * @version 0.1
14 | * @date 2023-10-28
15 | * @copyright Copyright (c) 2023
16 | */
17 | class SnapTime {
18 | public:
19 | static SnapTime &instance() {
20 | static SnapTime self;
21 | return self;
22 | }
23 |
24 | /// Provides the actual time as timeval
25 | timeval time() {
26 | timeval result;
27 | int rc = gettimeofday(&result, NULL);
28 | if (rc) {
29 | uint32_t ms = millis();
30 | result.tv_sec = ms / 1000;
31 | result.tv_usec = (ms - (result.tv_sec * 1000)) * 1000;
32 | }
33 | return result;
34 | }
35 |
36 | /// Provides the current server time in ms
37 | uint32_t serverMillis() {
38 | return toMillis(server_time) - server_ms + millis() -
39 | timeDifferenceClientServerMs();
40 | }
41 |
42 | uint32_t localMillis() { return toMillis(time()); }
43 |
44 | /// Provides the avg latecy in milliseconds
45 | int timeDifferenceClientServerMs() {
46 | int result = time_diff;
47 | assert(result == time_diff);
48 | return result;
49 | }
50 |
51 | uint32_t toMillis(timeval tv) { return toMillis(tv.tv_sec, tv.tv_usec); }
52 |
53 | inline uint32_t toMillis(uint32_t sec, uint32_t usec) {
54 | return sec * 1000 + (usec / 1000);
55 | }
56 |
57 | bool printLocalTime(const char *msg) {
58 | const timeval val = time();
59 | auto *tm_result = gmtime(&val.tv_sec);
60 |
61 | char str[80];
62 | strftime(str, 80, "%d-%m-%Y %H-%M-%S", tm_result);
63 | ESP_LOGI(TAG, "%s: Time is %s", msg, str);
64 | return true;
65 | }
66 |
67 | /// Record the last time difference between client and server
68 | void setTimeDifferenceClientServerMs(uint32_t diff) {
69 | time_diff = diff;
70 | time_update_count++;
71 | }
72 |
73 | // updates the time difference between the local and server time
74 | void updateServerTime(timeval &server) {
75 | server_ms = millis();
76 | server_time = server;
77 | }
78 |
79 | // Calculat the difference between 2 timeval
80 | timeval timeDifference(timeval t1, timeval t2) {
81 | timeval result;
82 | timersub(&t1, &t2, &result);
83 | return result;
84 | }
85 |
86 | // Calculat the difference between 2 timeval -> result in ms
87 | uint32_t timeDifferenceMs(timeval t1, timeval t2) {
88 | timeval result;
89 | timersub(&t1, &t2, &result);
90 | return toMillis(result);
91 | }
92 |
93 | #ifdef ESP32
94 | void setupSNTPTime() {
95 | ESP_LOGD(TAG, "start");
96 | const char *ntpServer = CONFIG_SNTP_SERVER;
97 | const long gmtOffset_sec = 1 * 60 * 60;
98 | const int daylightOffset_sec = 1 * 60 * 60;
99 | for (int retry = 0; retry < 5; retry++) {
100 | configTime(gmtOffset_sec, daylightOffset_sec, ntpServer);
101 | tm time;
102 | if (!getLocalTime(&time)) {
103 | continue;
104 | }
105 | SnapTime::instance().printLocalTime("SNTP");
106 | has_sntp_time = true;
107 | break;
108 | }
109 | }
110 | #endif
111 |
112 | protected:
113 | const char *TAG = "SnapTime";
114 | uint32_t time_diff = 0;
115 | uint32_t server_ms = 0;
116 | uint32_t local_ms;
117 | uint32_t time_update_count = 0;
118 | timeval server_time;
119 | bool has_sntp_time = false;
120 |
121 | };
122 |
123 | }
124 |
--------------------------------------------------------------------------------
/docs/html/structc_j_s_o_n___hooks-members.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | arduino-snapclient: Member List
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 | arduino-snapclient
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
38 |
39 |
40 |
47 |
48 |
49 |
53 |
54 |
55 |
56 |
57 |
60 |
61 |
62 |
63 |
67 |
68 |
69 |
This is the complete list of members for cJSON_Hooks , including all inherited members.
70 |
74 |
75 |
78 |
79 |
80 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Snapcast Client for Arduino
2 |
3 | ### Snapcast Audio Streaming Client for Arduino
4 |
5 | [Snapcast](https://github.com/badaix/snapcast) is a multiroom client-server audio player, where all clients are time synchronized with the server to play perfectly synced audio
6 |
7 | ### Feature list
8 |
9 | - Header only C++ implementation
10 | - PCM, Opus decoding is supported
11 | - Auto connect to snapcast server on network
12 | - The functionality has been tested on an ESP32
13 | - Memory efficient implementation, so that PSRAM is not needed
14 | - Use any output device or DSP chain suppored by the [Audio Tools](https://github.com/pschatzmann/arduino-audio-tools)
15 | - Flexible design so that you can choose from different processor implementations and synchronizers.
16 |
17 | The disadvantage of these goals is, that you need to fine tune the solution to have it working as you want.
18 |
19 | ### Description
20 |
21 | I have rewritten the [snapclient](https://github.com/jorgenkraghjakobsen/snapclient) from Jørgen Kragh Jakobsen to an Arduino Library and integrated my AudioTools project to be used to define the output devices.
22 |
23 | ### Example Arduino Sketch
24 |
25 | Here is an example Arduino sketch that uses the Wifi as communication API, the WAVs codec and outputs the audio with I2S:
26 |
27 | ```C++
28 | #include "AudioTools.h"
29 | #include "SnapClient.h"
30 | #include "AudioTools/AudioCodecs/CodecOpus.h" // https://github.com/pschatzmann/arduino-libopus
31 | //#include "api/SnapProcessorRTOS.h" // install https://github.com/pschatzmann/arduino-freertos-addons
32 |
33 | OpusAudioDecoder codec;
34 | WiFiClient wifi;
35 | I2SStream out;
36 | SnapClient client(wifi, out, codec);
37 |
38 | void setup() {
39 | Serial.begin(115200);
40 |
41 | // login to wifi -> Define values in SnapConfig.h or replace them here
42 | WiFi.begin(CONFIG_WIFI_SSID, CONFIG_WIFI_PASSWORD);
43 | Serial.print("Connecting to WiFi ..");
44 | while (WiFi.status() != WL_CONNECTED) {
45 | Serial.print('.');
46 | delay(1000);
47 | }
48 |
49 | // print ip address
50 | Serial.println();
51 | Serial.println(WiFi.localIP());
52 |
53 | // setup I2S to define custom pins
54 | auto cfg = out.defaultConfig();
55 | config.pin_bck = 14;
56 | config.pin_ws = 15;
57 | config.pin_data = 22;
58 | // cfg.buffer_size = 512;
59 | // cfg.buffer_count = 40;
60 | out.begin(cfg);
61 |
62 | // Use FreeRTOS
63 | //client.setSnapProcessor(rtos);
64 |
65 | // Define CONFIG_SNAPCAST_SERVER_HOST in SnapConfig.h or here
66 | // client.setServerIP(IPAddress(192,168,1,33));
67 |
68 | // start snap client
69 | client.begin();
70 | }
71 |
72 | void loop() {
73 | client.doLoop();
74 | }
75 |
76 | ```
77 | Change the snapserver.conf to define ```codec = opus``` and restart the snapserver with ```sudo service snapserver restart```.
78 | You can test now your sketch e.g. with ```ffmpeg -i http://stream.srg-ssr.ch/m/rsj/mp3_128 -f s16le -ar 48000 /tmp/snapfifo```
79 |
80 | For further information on codecs please check the information in the Wiki!
81 |
82 |
83 | ### Documentation
84 |
85 | For further information
86 | - consult the [class documentation](https://pschatzmann.github.io/arduino-snapclient/html/annotated.html) or
87 | - the [examples](examples/)
88 | - the Wiki
89 |
90 |
91 | ### Dependencies
92 |
93 | - [Audio Tools](https://github.com/pschatzmann/arduino-audio-tools) (mandatory)
94 | - [LibOpus](https://github.com/pschatzmann/arduino-libopus) (optional)
95 | - [LibFLAC.h](https://github.com/pschatzmann/arduino-libflac) (optinal)
96 | - [CodecVorbis](https://github.com/pschatzmann/arduino-libvorbis-idec) (optional)
97 |
98 |
99 | ### Configuration
100 |
101 | Configuration settings can be found in [SnapConfig.h](https://github.com/pschatzmann/arduino-snapcast/blob/main/src/SnapConfig.h)
102 |
103 |
104 |
--------------------------------------------------------------------------------
/docs/html/structtime__message.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | arduino-snapclient: time_message Struct Reference
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 | arduino-snapclient
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
38 |
39 |
40 |
47 |
48 |
49 |
53 |
54 |
55 |
56 |
57 |
60 |
61 |
62 |
63 |
70 |
71 |
72 |
74 |
75 | tv_t latency
76 |
77 |
78 |
The documentation for this struct was generated from the following file:
81 |
82 |
83 |
86 |
87 |
88 |
--------------------------------------------------------------------------------
/docs/html/structsnap__arduino_1_1tv__t-members.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | arduino-snapclient: Member List
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 | arduino-snapclient
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
38 |
39 |
40 |
47 |
48 |
49 |
53 |
54 |
55 |
56 |
57 |
60 |
61 |
62 |
66 |
67 |
71 |
72 |
73 |
This is the complete list of members for tv_t , including all inherited members.
74 |
78 |
79 |
82 |
83 |
84 |
--------------------------------------------------------------------------------
/docs/html/structread__buffer__t-members.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | arduino-snapclient: Member List
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 | arduino-snapclient
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
38 |
39 |
40 |
47 |
48 |
49 |
53 |
54 |
55 |
56 |
57 |
60 |
61 |
62 |
63 |
67 |
68 |
69 |
This is the complete list of members for read_buffer_t , including all inherited members.
70 |
75 |
76 |
79 |
80 |
81 |
--------------------------------------------------------------------------------
/docs/html/structwrite__buffer__t-members.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | arduino-snapclient: Member List
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 | arduino-snapclient
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
38 |
39 |
40 |
47 |
48 |
49 |
53 |
54 |
55 |
56 |
57 |
60 |
61 |
62 |
63 |
67 |
68 |
69 |
This is the complete list of members for write_buffer_t , including all inherited members.
70 |
75 |
76 |
79 |
80 |
81 |
--------------------------------------------------------------------------------
/docs/html/structinternal__hooks-members.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | arduino-snapclient: Member List
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 | arduino-snapclient
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
38 |
39 |
40 |
47 |
48 |
49 |
53 |
54 |
55 |
56 |
57 |
60 |
61 |
62 |
63 |
67 |
68 |
69 |
This is the complete list of members for internal_hooks , including all inherited members.
70 |
75 |
76 |
79 |
80 |
81 |
--------------------------------------------------------------------------------
/docs/html/structwire__chunk__message-members.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | arduino-snapclient: Member List
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 | arduino-snapclient
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
38 |
39 |
40 |
47 |
48 |
49 |
53 |
54 |
55 |
56 |
57 |
60 |
61 |
62 |
63 |
67 |
68 |
69 |
This is the complete list of members for wire_chunk_message , including all inherited members.
70 |
75 |
76 |
79 |
80 |
81 |
--------------------------------------------------------------------------------
/src/api/SnapProcessorRP2040.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include "AudioTools/Concurrency/RP2040.h"
3 | #include "SnapOutput.h"
4 |
5 | namespace snap_arduino {
6 |
7 | /**
8 | * @brief Processor for which the encoded output is buffered in a queue. The decoding and
9 | * audio output can be done on the second core by calling loop1();
10 | *
11 | * @author Phil Schatzmann
12 | * @version 0.1
13 | * @date 2024-02-26
14 | * @copyright Copyright (c) 2023
15 | */
16 | class SnapProcessorRP2040 : public SnapProcessor {
17 | public:
18 | /// Default constructor
19 | SnapProcessorRP2040(SnapOutput &output, int bufferSizeBytes, int activationAtPercent = 75)
20 | : SnapProcessor(output) {
21 | active_percent = activationAtPercent;
22 | initQueues(bufferSizeBytes);
23 | }
24 | /// Default constructor
25 | SnapProcessorRP2040(int bufferSizeBytes, int activationAtPercent = 75)
26 | : SnapProcessor() {
27 | active_percent = activationAtPercent;
28 | initQueues(bufferSizeBytes);
29 | }
30 |
31 | bool begin() override {
32 | ESP_LOGW(TAG, "begin: %d", buffer_count * 1024);
33 | // regular begin logic
34 | bool result = SnapProcessor::begin();
35 |
36 | // allocate buffer
37 | buffer.setBlockingRead(true);
38 | buffer.setBlockingWrite(true);
39 | buffer.resize(buffer_count * 1024);
40 |
41 | // we need to read back the buffer with the written sizes
42 | size_queue.resize(RTOS_MAX_QUEUE_ENTRY_COUNT);
43 |
44 | is_active = false;
45 | return result;
46 | }
47 |
48 | void end(void) override {
49 | size_queue.clear();
50 | buffer.reset();
51 | SnapProcessor::end();
52 | }
53 |
54 | bool doLoop1() override {
55 | ESP_LOGD(TAG, "doLoop1 %d / %d", size_queue.available(), buffer.available());
56 | if (!isBufferActive()) return true;
57 |
58 | size_t size = 0;
59 | if (size_queue.readArray(&size, 1)) {
60 | uint8_t data[size];
61 | int read = buffer.readArray(data, size);
62 | if (read != size){
63 | ESP_LOGE(TAG, "readArray failed %d -> %d", size, read);
64 | }
65 | int written = p_snap_output->audioWrite(data, size);
66 | if (written != size) {
67 | ESP_LOGE(TAG, "write error: %d of %d", written, size);
68 | }
69 | }
70 | return true;
71 | }
72 |
73 | protected:
74 | const char *TAG = "SnapProcessorRP2040";
75 | audio_tools::BufferRP2040T size_queue{1, 0};
76 | audio_tools::BufferRP2040T buffer{1024, 0}; // size defined in begin
77 | int buffer_count = 0;
78 | bool is_active = false;
79 | int active_percent = 0;
80 |
81 | bool isBufferActive() {
82 | if (!is_active && buffer.available()>0) {
83 |
84 | int limit = buffer.size() * active_percent / 100;
85 | if (buffer.available() >= limit) {
86 | LOGI("Setting buffer active");
87 | is_active = true;
88 | }
89 | delay(10);
90 | }
91 | return is_active;
92 | }
93 |
94 | /// store parameters provided by constructor
95 | void initQueues(int bufferSizeBytes) {
96 | buffer_count = bufferSizeBytes / 1024;
97 | if (buffer_count <= 2){
98 | buffer_count = 2;
99 | }
100 | }
101 |
102 | /// Writes the encoded audio data to a queue
103 | size_t writeAudio(const uint8_t *data, size_t size) override {
104 |
105 | if (size > buffer.size()) {
106 | ESP_LOGE(TAG, "The buffer is too small with %d. Use a multiple of %d", buffer.size(), size);
107 | stop();
108 | }
109 |
110 | ESP_LOGI(TAG, "size: %zu / buffer %d", size, buffer.available());
111 | if (!p_snap_output->isStarted() || size == 0) {
112 | ESP_LOGW(TAG, "not started");
113 | return 0;
114 | }
115 |
116 | if (!p_snap_output->synchronizePlayback()) {
117 | return size;
118 | }
119 |
120 | if (!size_queue.writeArray(&size, 1)) {
121 | ESP_LOGW(TAG, "size_queue full");
122 | return 0;
123 | }
124 |
125 | size_t size_written = buffer.writeArray(data, size);
126 | if (size_written != size) {
127 | ESP_LOGE(TAG, "buffer-overflow");
128 | }
129 |
130 | return size;
131 | }
132 | };
133 |
134 | } // namespace snap_arduino
135 |
--------------------------------------------------------------------------------
/docs/html/structcodec__header__message-members.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | arduino-snapclient: Member List
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 | arduino-snapclient
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
38 |
39 |
40 |
47 |
48 |
49 |
53 |
54 |
55 |
56 |
57 |
60 |
61 |
62 |
63 |
67 |
68 |
69 |
This is the complete list of members for codec_header_message , including all inherited members.
70 |
75 |
76 |
79 |
80 |
81 |
--------------------------------------------------------------------------------
/docs/html/struct_snap_message_time-members.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | arduino-snapclient: Member List
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 | arduino-snapclient
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
38 |
39 |
40 |
47 |
48 |
49 |
53 |
54 |
55 |
56 |
57 |
60 |
61 |
62 |
63 |
67 |
68 |
69 |
This is the complete list of members for SnapMessageTime , including all inherited members.
70 |
75 |
76 |
79 |
80 |
81 |
--------------------------------------------------------------------------------
/docs/html/structerror.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | arduino-snapclient: error Struct Reference
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 | arduino-snapclient
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
38 |
39 |
40 |
47 |
48 |
49 |
53 |
54 |
55 |
56 |
57 |
60 |
61 |
62 |
63 |
70 |
71 |
72 |
74 |
75 | const unsigned char * json
76 |
77 |
78 | size_t position
79 |
80 |
81 |
The documentation for this struct was generated from the following file:
82 | src/lightsnapcast/cJSON.c
83 |
84 |
85 |
86 |
89 |
90 |
91 |
--------------------------------------------------------------------------------