Adding support for variable data length

The length of the data is encoded in the first 3 bytes of the transmission:
  - Byte 0: data length
  - Byte 1: ECC
  - Byte 2: ECC

For this type of transmission it is necessary to add an "end-of-message"
marker at the end of the Tx. This marker is used by the receiver to
understand when the transmission is over. At this point the receiver starts
analyzing the recorded data. First, the data length is decoded. After, this
length is used to try to decode the remaining data.

The number ECC bytes used for the payload is calculated as 2*(N/5), where N
is the length of the payload.
This commit is contained in:
Georgi Gerganov
2018-05-31 19:19:37 +03:00
parent f1aad28b21
commit be44800fa0
2 changed files with 119 additions and 23 deletions

View File

@@ -7,5 +7,6 @@ em++ -Wall -Wextra -O3 -std=c++11 -s USE_SDL=2 -s WASM=1 ./main.cpp -o wave.js -
"_getFramesLeftToRecord", "_getFramesToRecord",
"_getFramesLeftToAnalyze", "_getFramesToAnalyze",
"_hasDeviceOutput", "_hasDeviceCapture", "_doInit",
"_setTxMode",
"_main"]' \
-s EXTRA_EXPORTED_RUNTIME_METHODS='["ccall", "cwrap", "writeArrayToMemory"]'