From 21fce9f3d98e4381f8813cf9c63410ca1dbd7f91 Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Mon, 18 Jan 2021 22:01:08 -0500 Subject: Audio system refactoring (#1275) * Simplify details * Simplify audio creation * Return an array of sources instead of a single item * Use sourceIndex instead of index * Rename APIs * Return more info about the source * Return source instead of sourceIndex --- ext/mixed/js/display-audio.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'ext/mixed/js/display-audio.js') diff --git a/ext/mixed/js/display-audio.js b/ext/mixed/js/display-audio.js index c423446e..0cd8a625 100644 --- a/ext/mixed/js/display-audio.js +++ b/ext/mixed/js/display-audio.js @@ -117,9 +117,10 @@ class DisplayAudio { let audio; let info; try { - let index; - ({audio, index} = await this._audioSystem.createDefinitionAudio(sources, expression, reading, {textToSpeechVoice, customSourceUrl})); - info = `From source ${1 + index}: ${sources[index]}`; + let source; + ({audio, source} = await this._audioSystem.createExpressionAudio(sources, expression, reading, {textToSpeechVoice, customSourceUrl})); + const sourceIndex = sources.indexOf(source); + info = `From source ${1 + sourceIndex}: ${source}`; } catch (e) { audio = this._audioSystem.getFallbackAudio(); info = 'Could not find audio'; -- cgit v1.2.3