summaryrefslogtreecommitdiff
path: root/ext/mixed/js/display-audio.js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2021-01-18 22:01:08 -0500
committerGitHub <noreply@github.com>2021-01-18 22:01:08 -0500
commit21fce9f3d98e4381f8813cf9c63410ca1dbd7f91 (patch)
tree124a510e4f208bbd7516b2eae98454400e9b4c54 /ext/mixed/js/display-audio.js
parent85c723b85f47ff3048ba7aca46a532aa1bc44064 (diff)
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
Diffstat (limited to 'ext/mixed/js/display-audio.js')
-rw-r--r--ext/mixed/js/display-audio.js7
1 files changed, 4 insertions, 3 deletions
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';