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