diff --git a/examples/ggwave-wasm/index-tmpl.html b/examples/ggwave-wasm/index-tmpl.html
index b551bff..ddc7ae3 100644
--- a/examples/ggwave-wasm/index-tmpl.html
+++ b/examples/ggwave-wasm/index-tmpl.html
@@ -62,12 +62,10 @@
-
+
+
+
-
-
-
-
Volume:
@@ -128,6 +126,9 @@
var bufferRx = null;
var brx = new Uint8Array(256);
+ var volume = 10;
+ var protocolId = 1;
+
function lockoutSubmit(button) {
var oldValue = button.value;
@@ -141,81 +142,13 @@
}
function selectConfig(configId) {
- paramFreqDelta.value = 1;
- paramFreqStart.value = 40;
- paramFramesPerTx.value = 9;
- paramBytesPerTx.value = 3;
-
- if (configId == 1) {
- paramFreqDelta.value = 1;
- paramFreqStart.value = 40;
- paramFramesPerTx.value = 6;
- paramBytesPerTx.value = 3;
- }
-
- if (configId == 2) {
- paramFreqDelta.value = 1;
- paramFreqStart.value = 40;
- paramFramesPerTx.value = 3;
- paramBytesPerTx.value = 3;
- }
-
- if (configId == 3) {
- paramFreqDelta.value = 1;
- paramFreqStart.value = 320;
- paramFramesPerTx.value = 9;
- paramBytesPerTx.value = 3;
- }
-
- if (configId == 4) {
- paramFreqDelta.value = 4;
- paramFreqStart.value = 40;
- paramFramesPerTx.value = 9;
- paramBytesPerTx.value = 3;
- }
-
- if (configId == 5) {
- paramFreqDelta.value = 2;
- paramFreqStart.value = 40;
- paramFramesPerTx.value = 18;
- paramBytesPerTx.value = 6;
- }
-
- if (configId == 6) {
- paramFreqDelta.value = 2;
- paramFreqStart.value = 40;
- paramFramesPerTx.value = 9;
- paramBytesPerTx.value = 6;
- }
-
- if (configId == 7) {
- paramFreqDelta.value = 4;
- paramFreqStart.value = 320;
- paramFramesPerTx.value = 9;
- paramBytesPerTx.value = 3;
- }
-
- Module._setTxMode(1); // Variable length mode
- Module._setParameters(
- paramFreqDelta.value,
- paramFreqStart.value,
- paramFramesPerTx.value,
- paramBytesPerTx.value,
- 0,
- paramVolume.value);
+ protocolId = configId;
}
function updateScroll(sName) {
val = document.getElementById('param'+sName).value;
document.getElementById('param'+sName+'Scroll').innerHTML = val;
-
- Module._setParameters(
- paramFreqDelta.value,
- paramFreqStart.value,
- paramFramesPerTx.value,
- paramBytesPerTx.value,
- 0,
- paramVolume.value);
+ volume = val;
}
function getSampleRate() {
diff --git a/examples/ggwave-wasm/main.js b/examples/ggwave-wasm/main.js
index af2e63b..ee39e55 100644
--- a/examples/ggwave-wasm/main.js
+++ b/examples/ggwave-wasm/main.js
@@ -6,7 +6,7 @@ function transmitText(sText) {
var buffer = Module._malloc(256);
Module.writeArrayToMemory(r, buffer, 256);
- Module._setText(sText.length, buffer);
+ Module._sendData(sText.length, buffer, protocolId, volume);
Module._free(buffer);
}
|