| 
									
										
										
										
											2021-11-04 20:58:37 +01:00
										 |  |  | import { TTS } from '../framework/tts'; | 
					
						
							|  |  |  | import { AriaOutput } from '../framework/tts/outputs/aria'; | 
					
						
							| 
									
										
										
										
											2021-11-05 14:28:01 +01:00
										 |  |  | import Sound from './sound'; | 
					
						
							| 
									
										
										
										
											2021-11-04 20:58:37 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | export default class Output { | 
					
						
							|  |  |  |     constructor() { | 
					
						
							|  |  |  |         this.tts = new TTS(new AriaOutput()); | 
					
						
							|  |  |  |         this.history = document.getElementById("output-area"); | 
					
						
							| 
									
										
										
										
											2021-11-05 14:28:01 +01:00
										 |  |  |         this.sound = new Sound(); | 
					
						
							| 
									
										
										
										
											2021-11-04 20:58:37 +01:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     say(string) { | 
					
						
							| 
									
										
										
										
											2021-11-05 14:28:01 +01:00
										 |  |  |         this.sound.play(`assets/scroll.wav`); | 
					
						
							| 
									
										
										
										
											2021-11-04 20:58:37 +01:00
										 |  |  |         const node = document.createElement("p"); | 
					
						
							| 
									
										
										
										
											2021-11-05 00:02:02 +01:00
										 |  |  |         string.split("\n").forEach((line) => { | 
					
						
							|  |  |  |             node.appendChild(document.createTextNode(line)); | 
					
						
							|  |  |  |             node.appendChild(document.createElement("br")); | 
					
						
							|  |  |  |         }); | 
					
						
							| 
									
										
										
										
											2021-11-04 20:58:37 +01:00
										 |  |  |         this.history.appendChild(node); | 
					
						
							|  |  |  |         // this.tts.speak(string);
 | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2021-11-05 14:28:01 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     play(file) { | 
					
						
							|  |  |  |         this.sound.play(file); | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2021-11-04 20:58:37 +01:00
										 |  |  | } |