This commit is contained in:
Dragon Fire
2024-04-04 23:26:15 -04:00
parent cdc8e8afa1
commit 97fefe42ed
+4 -12
View File
@@ -65,25 +65,17 @@ module.exports = class MorseCommand extends Command {
} }
const c = processedScript[cIndex]; const c = processedScript[cIndex];
if (c === '.') { if (c === '.') {
for (let i = 0; i < dotSamples * 2; i++) { for (let i = 0; i < dotSamples; i++) {
if (i > dotSamples) {
data[(currentIndex * dotSamples) + i] = 127;
} else {
const libIndex = this.library[44 + i]; const libIndex = this.library[44 + i];
data[(currentIndex * dotSamples) + i] = libIndex; data[(currentIndex * dotSamples) + i] = libIndex;
} }
} currentIndex += 1;
currentIndex += 2;
} else if (c === '-') { } else if (c === '-') {
for (let i = 0; i < dashSamples + dotSamples; i++) { for (let i = 0; i < dashSamples; i++) {
if (i > dashSamples) {
data[(currentIndex * dashSamples) + i] = 127;
} else {
const libIndex = this.library[44 + dotSamples + i]; const libIndex = this.library[44 + dotSamples + i];
data[(currentIndex * dashSamples) + i] = libIndex; data[(currentIndex * dashSamples) + i] = libIndex;
} }
} currentIndex += 3;
currentIndex += 4;
} else if (c === ' ' && processedScript[cIndex + 1] === ' ') { } else if (c === ' ' && processedScript[cIndex + 1] === ' ') {
for (let i = 0; i < dotSamples * 7; i++) { for (let i = 0; i < dotSamples * 7; i++) {
data[(currentIndex * dotSamples) + i] = 127; data[(currentIndex * dotSamples) + i] = 127;