From f798257f77920c2ac6f4213b6c5b4c5b74fdb2ff Mon Sep 17 00:00:00 2001 From: Georgi Gerganov Date: Mon, 30 May 2022 19:09:53 +0300 Subject: [PATCH] examples : remove ggwave-mod No longer needed since the core ggwave lib now supports mono-tone protocols --- .gitignore | 1 + examples/CMakeLists.txt | 3 - examples/arduino-rx-web/CMakeLists.txt | 6 +- examples/arduino-rx-web/arduino-rx-web.cpp | 21 +- examples/arduino-rx-web/index-tmpl.html | 4 +- examples/ggwave-mod/include/ggwave/ggwave.h | 578 ------- examples/ggwave-mod/src/CMakeLists.txt | 60 - examples/ggwave-mod/src/ggwave-mod.js | 21 - examples/ggwave-mod/src/ggwave.cpp | 1434 ----------------- examples/ggwave-mod/src/reed-solomon/LICENSE | 21 - examples/ggwave-mod/src/reed-solomon/gf.hpp | 235 --- examples/ggwave-mod/src/reed-solomon/poly.hpp | 94 -- examples/ggwave-mod/src/reed-solomon/rs.hpp | 538 ------- examples/ggwave-mod/src/resampler.cpp | 157 -- examples/ggwave-mod/src/resampler.h | 49 - examples/r2t2/CMakeLists.txt | 6 +- examples/r2t2/main.cpp | 21 +- examples/r2t2/r2t2-rx.cpp | 21 +- include/ggwave/ggwave.h | 28 +- src/ggwave.cpp | 44 +- 20 files changed, 88 insertions(+), 3254 deletions(-) delete mode 100644 examples/ggwave-mod/include/ggwave/ggwave.h delete mode 100644 examples/ggwave-mod/src/CMakeLists.txt delete mode 100644 examples/ggwave-mod/src/ggwave-mod.js delete mode 100644 examples/ggwave-mod/src/ggwave.cpp delete mode 100644 examples/ggwave-mod/src/reed-solomon/LICENSE delete mode 100644 examples/ggwave-mod/src/reed-solomon/gf.hpp delete mode 100644 examples/ggwave-mod/src/reed-solomon/poly.hpp delete mode 100644 examples/ggwave-mod/src/reed-solomon/rs.hpp delete mode 100644 examples/ggwave-mod/src/resampler.cpp delete mode 100644 examples/ggwave-mod/src/resampler.h diff --git a/.gitignore b/.gitignore index 7a72417..30bcdfd 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ build build-* compile_commands.json +.exrc .clangd .cache .vimspector.json diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 113df7f..c2e2efa 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -79,9 +79,6 @@ if (GGWAVE_SUPPORT_SDL2) ) endif() -# modified ggwave used by some of the examples -add_subdirectory(ggwave-mod/src) - # examples if (EMSCRIPTEN) diff --git a/examples/arduino-rx-web/CMakeLists.txt b/examples/arduino-rx-web/CMakeLists.txt index 3aa06b7..0b39aea 100644 --- a/examples/arduino-rx-web/CMakeLists.txt +++ b/examples/arduino-rx-web/CMakeLists.txt @@ -15,10 +15,10 @@ if (NOT EMSCRIPTEN) target_link_libraries(${TARGET} PRIVATE ggwave-common - ggwave-mod + ggwave ${SDL2_LIBRARIES} ) else() - configure_file(${CMAKE_CURRENT_SOURCE_DIR}/index-tmpl.html ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${TARGET}/index.html @ONLY) - configure_file(${CMAKE_SOURCE_DIR}/examples/ggwave-mod/src/ggwave-mod.js ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${TARGET}/ggwave-mod.js COPYONLY) + configure_file(${CMAKE_CURRENT_SOURCE_DIR}/index-tmpl.html ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${TARGET}/index.html @ONLY) + configure_file(${CMAKE_SOURCE_DIR}/bindings/javascript/ggwave.js ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${TARGET}/ggwave.js COPYONLY) endif() diff --git a/examples/arduino-rx-web/arduino-rx-web.cpp b/examples/arduino-rx-web/arduino-rx-web.cpp index 83e909a..5672c7a 100644 --- a/examples/arduino-rx-web/arduino-rx-web.cpp +++ b/examples/arduino-rx-web/arduino-rx-web.cpp @@ -138,7 +138,7 @@ bool GGWave_init( SDL_AudioSpec playbackSpec; SDL_zero(playbackSpec); - playbackSpec.freq = GGWave::kBaseSampleRate + sampleRateOffset; + playbackSpec.freq = GGWave::kDefaultSampleRate + sampleRateOffset; playbackSpec.format = AUDIO_S16SYS; playbackSpec.channels = 1; playbackSpec.samples = 16*1024; @@ -181,7 +181,7 @@ bool GGWave_init( if (g_devIdInp == 0) { SDL_AudioSpec captureSpec; captureSpec = g_obtainedSpecOut; - captureSpec.freq = GGWave::kBaseSampleRate + sampleRateOffset; + captureSpec.freq = GGWave::kDefaultSampleRate + sampleRateOffset; captureSpec.format = AUDIO_F32SYS; captureSpec.samples = 1024; @@ -238,10 +238,13 @@ bool GGWave_init( payloadLength, (float) g_obtainedSpecInp.freq, (float) g_obtainedSpecOut.freq, + GGWave::kDefaultSampleRate, 512, GGWave::kDefaultSoundMarkerThreshold, sampleFormatInp, - sampleFormatOut}); + sampleFormatOut, + GGWAVE_OPERATING_MODE_RX_AND_TX, + }); } return true; @@ -340,12 +343,12 @@ int main(int argc, char** argv) { #endif const GGWave::TxProtocols protocols = { - { GGWAVE_TX_PROTOCOL_CUSTOM_0, { "[R2T2] Normal", 64, 9, 1, } }, - { GGWAVE_TX_PROTOCOL_CUSTOM_1, { "[R2T2] Fast", 64, 6, 1, } }, - { GGWAVE_TX_PROTOCOL_CUSTOM_2, { "[R2T2] Fastest", 64, 3, 1, } }, - { GGWAVE_TX_PROTOCOL_CUSTOM_3, { "[R2T2] Low Normal", 16, 9, 1, } }, - { GGWAVE_TX_PROTOCOL_CUSTOM_4, { "[R2T2] Low Fast", 16, 6, 1, } }, - { GGWAVE_TX_PROTOCOL_CUSTOM_5, { "[R2T2] Low Fastest", 16, 3, 1, } }, + { GGWAVE_TX_PROTOCOL_CUSTOM_0, { "[R2T2] Normal", 64, 9, 1, 2, } }, + { GGWAVE_TX_PROTOCOL_CUSTOM_1, { "[R2T2] Fast", 64, 6, 1, 2, } }, + { GGWAVE_TX_PROTOCOL_CUSTOM_2, { "[R2T2] Fastest", 64, 3, 1, 2, } }, + { GGWAVE_TX_PROTOCOL_CUSTOM_3, { "[R2T2] Low Normal", 16, 9, 1, 2, } }, + { GGWAVE_TX_PROTOCOL_CUSTOM_4, { "[R2T2] Low Fast", 16, 6, 1, 2, } }, + { GGWAVE_TX_PROTOCOL_CUSTOM_5, { "[R2T2] Low Fastest", 16, 3, 1, 2, } }, }; const auto argm = parseCmdArguments(argc, argv); diff --git a/examples/arduino-rx-web/index-tmpl.html b/examples/arduino-rx-web/index-tmpl.html index a426014..66ac4d1 100644 --- a/examples/arduino-rx-web/index-tmpl.html +++ b/examples/arduino-rx-web/index-tmpl.html @@ -58,7 +58,7 @@ - +