From 35abd517b933036b95bb58b463a48edd1c985bb1 Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Thu, 10 Sep 2020 11:57:38 -0400 Subject: 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 --- ext/mixed/js/display.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'ext/mixed/js/display.js') 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) { -- cgit v1.2.3