r2t2 - Transmit data through the PC speaker (#32)

* inital implementation

* remove file

* ggwave-cli : txProtocol -> txProtocolId

* ggwave : add custom protocol enum values

* r2t2 : use cutom protocols

* r2t2 : build only on Unix systems

* r2t2 : remove thread

* r2t2-rx : wip

* r2t2 : wasm build ready + various fixes

* r2t2 : error message

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* r2t2 : length 16

* r2t2 : use slow protocol by default

* r2t2 : add timestamp

* r2t2 : update html

* r2t2 : update github link

* r2t2 : more robust tx

* r2t2 : add option to use beep command

* emscripten : cannot use requestAnimationFrame when capturing audio

This causes the queued audio buffer to grow indefinitely when the page
is not focused, causing the process to run out of memory.

* r2t2 : disable beep option

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* r2t2 : add example to README
This commit is contained in:
Georgi Gerganov
2021-04-18 13:20:45 +03:00
committed by GitHub
parent 464aa2283b
commit 00b23ff54f
28 changed files with 4153 additions and 29 deletions

View File

@@ -24,7 +24,7 @@ int main(int argc, char** argv) {
auto argm = parseCmdArguments(argc, argv);
int captureId = argm["c"].empty() ? 0 : std::stoi(argm["c"]);
int playbackId = argm["p"].empty() ? 0 : std::stoi(argm["p"]);
int txProtocol = argm["t"].empty() ? 1 : std::stoi(argm["t"]);
int txProtocolId = argm["t"].empty() ? 1 : std::stoi(argm["t"]);
int payloadLength = argm["l"].empty() ? -1 : std::stoi(argm["l"]);
bool printTones = argm.find("v") == argm.end() ? false : true;
@@ -41,12 +41,12 @@ int main(int argc, char** argv) {
printf(" -t%d : %s\n", protocol.first, protocol.second.name);
}
if (txProtocol < 0 || txProtocol > (int) ggWave->getTxProtocols().size()) {
fprintf(stderr, "Unknown Tx protocol %d\n", txProtocol);
if (txProtocolId < 0 || txProtocolId > (int) ggWave->getTxProtocols().size()) {
fprintf(stderr, "Unknown Tx protocol %d\n", txProtocolId);
return -3;
}
printf("Selecting Tx protocol %d\n", txProtocol);
printf("Selecting Tx protocol %d\n", txProtocolId);
std::mutex mutex;
std::thread inputThread([&]() {
@@ -76,7 +76,7 @@ int main(int argc, char** argv) {
}
{
std::lock_guard<std::mutex> lock(mutex);
ggWave->init(input.size(), input.data(), ggWave->getTxProtocol(txProtocol), 10);
ggWave->init(input.size(), input.data(), ggWave->getTxProtocol(txProtocolId), 10);
}
inputOld = input;
}