assassin-bug/src/engine/output.js

26 lines
761 B
JavaScript

import { TTS } from '../framework/tts';
import { AriaOutput } from '../framework/tts/outputs/aria';
import Sound from './sound';
export default class Output {
constructor() {
this.tts = new TTS(new AriaOutput());
this.history = document.getElementById("output-area");
this.sound = new Sound();
}
say(string) {
this.sound.play(`assets/scroll.wav`);
const node = document.createElement("p");
string.split("\n").forEach((line) => {
node.appendChild(document.createTextNode(line));
node.appendChild(document.createElement("br"));
});
this.history.appendChild(node);
// this.tts.speak(string);
}
play(file) {
this.sound.play(file);
}
}