diff options
author | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2020-09-10 11:57:38 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-10 11:57:38 -0400 |
commit | 35abd517b933036b95bb58b463a48edd1c985bb1 (patch) | |
tree | 34a31589727c6e04659cc7195b5c27b61df5036e /ext/mixed/js/display.js | |
parent | 17ebe6a754d53fad97ab607f17e2bba8d8565361 (diff) |
AudioUriBuilder simplification (#799)
* Rename variables to disambiguate
* Update handler argument convention
* Update getUri argument convention
* Change _getAudioUri argument convention
* Change getDefinitionAudio argument convention
* Add api.getDefinitionAudio definition
Diffstat (limited to 'ext/mixed/js/display.js')
-rw-r--r-- | ext/mixed/js/display.js | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/ext/mixed/js/display.js b/ext/mixed/js/display.js index ea6b52c0..6fdab46b 100644 --- a/ext/mixed/js/display.js +++ b/ext/mixed/js/display.js @@ -42,8 +42,8 @@ class Display extends EventDispatcher { this._audioFallback = null; this._audioSystem = new AudioSystem({ audioUriBuilder: { - getUri: async (definition, source, details) => { - return await api.audioGetUri(definition, source, details); + getUri: async (source, expression, reading, details) => { + return await api.audioGetUri(source, expression, reading, details); } }, useCache: true @@ -1071,7 +1071,7 @@ class Display extends EventDispatcher { try { this.setSpinnerVisible(true); - const expression = expressionIndex === -1 ? definition : definition.expressions[expressionIndex]; + const {expression, reading} = expressionIndex === -1 ? definition : definition.expressions[expressionIndex]; this._stopPlayingAudio(); @@ -1079,7 +1079,7 @@ class Display extends EventDispatcher { try { const {sources, textToSpeechVoice, customSourceUrl} = this._options.audio; let index; - ({audio, index} = await this._audioSystem.getDefinitionAudio(expression, sources, {textToSpeechVoice, customSourceUrl})); + ({audio, index} = await this._audioSystem.getDefinitionAudio(sources, expression, reading, {textToSpeechVoice, customSourceUrl})); info = `From source ${1 + index}: ${sources[index]}`; } catch (e) { if (this._audioFallback === null) { |