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

@@ -158,7 +158,7 @@
var isiOS = /iPad|iPhone|iPod|CriOS/.test(navigator.userAgent) && !window.MSStream;
var isInitialized = false;
var isAudioContextUnlocked = !isiOS;
var isAudioContextUnlocked = true;
var htmlGreenLED = "<div class=\"led-green\"></div>";
var htmlRedLED = "<div class=\"led-red\"></div>";
@@ -193,7 +193,7 @@
}
}
var isBrowserSupported = !isiOS;
var isBrowserSupported = true;
{
var el = document.getElementById('is-browser-supported');
if (isBrowserSupported) {
@@ -229,7 +229,7 @@
postRun: [ (function() { document.getElementById("butInit").disabled = false; }) ],
print: (function() {
var element = document.getElementById('output');
if (element) element.alue = ''; // clear browser cache
if (element) element.value = ''; // clear browser cache
return function(text) {
if (arguments.length > 1) text = Array.prototype.slice.call(arguments).join(' ');
console.log(text);
@@ -293,7 +293,7 @@
Module.setStatus('Initializing...');
window.onerror = function(event) {
Module.setStatus('Exception thrown, see JavaScript console');
Module.setStatus('Exception thrown: ' + JSON.stringify(event));
spinnerElement.style.display = 'none';
Module.setStatus = function(text) {
if (text) Module.printErr('[post-exception status] ' + text);
@@ -301,22 +301,22 @@
};
window.addEventListener('touchstart', function() {
if (isAudioContextUnlocked == false && SDL2.audioContext) {
var buffer = SDL2.audioContext.createBuffer(1, 1, 22050);
var source = SDL2.audioContext.createBufferSource();
source.buffer = buffer;
source.connect(SDL2.audioContext.destination);
source.start();
//if (isAudioContextUnlocked == false && SDL2.audioContext) {
// var buffer = SDL2.audioContext.createBuffer(1, 1, 22050);
// var source = SDL2.audioContext.createBufferSource();
// source.buffer = buffer;
// source.connect(SDL2.audioContext.destination);
// source.start();
setTimeout(function() {
if((source.playbackState === source.PLAYING_STATE || source.playbackState === source.FINISHED_STATE)) {
isAudioContextUnlocked = true;
Module.setStatus('Wab Audio API unlocked successfully!');
} else {
Module.setStatus('Failed to unlock Web Audio APIi. This browser seems to not be supported');
}
}, 0);
}
// setTimeout(function() {
// if((source.playbackState === source.PLAYING_STATE || source.playbackState === source.FINISHED_STATE)) {
// isAudioContextUnlocked = true;
// Module.setStatus('Wab Audio API unlocked successfully!');
// } else {
// Module.setStatus('Failed to unlock Web Audio APIi. This browser seems to not be supported');
// }
// }, 0);
//}
}, false);
function playSound(filename){