From 8ae1da427756a9a1e057b3518c4069ac7d5b4b3a Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Wed, 9 Oct 2019 22:33:35 -0400 Subject: Update audio options format --- ext/mixed/js/display.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'ext/mixed') diff --git a/ext/mixed/js/display.js b/ext/mixed/js/display.js index 78e6d8e3..c1224084 100644 --- a/ext/mixed/js/display.js +++ b/ext/mixed/js/display.js @@ -189,7 +189,7 @@ class Display { addable: options.anki.enable, grouped: options.general.resultOutputMode === 'group', merged: options.general.resultOutputMode === 'merge', - playback: options.general.audioSource !== 'disabled', + playback: options.audio.enabled, compactGlossaries: options.general.compactGlossaries, debug: options.general.debugInfo }; @@ -209,7 +209,7 @@ class Display { const {index, scroll} = context || {}; this.entryScrollIntoView(index || 0, scroll); - if (this.options.general.autoPlayAudio && this.options.general.audioSource !== 'disabled') { + if (this.options.audio.enabled && this.options.audio.autoPlay) { this.autoPlayAudio(); } @@ -404,7 +404,7 @@ class Display { this.setSpinnerVisible(true); const expression = expressionIndex === -1 ? definition : definition.expressions[expressionIndex]; - let url = await apiAudioGetUrl(expression, this.options.general.audioSource, this.optionsContext); + let url = await apiAudioGetUrl(expression, this.options.audio.sources[0], this.optionsContext); if (!url) { url = '/mixed/mp3/button.mp3'; } @@ -413,10 +413,11 @@ class Display { this.audioCache[key].pause(); } + const volume = this.options.audio.volume / 100.0; let audio = this.audioCache[url]; if (audio) { audio.currentTime = 0; - audio.volume = this.options.general.audioVolume / 100.0; + audio.volume = volume; audio.play(); } else { audio = new Audio(url); @@ -426,7 +427,7 @@ class Display { } this.audioCache[url] = audio; - audio.volume = this.options.general.audioVolume / 100.0; + audio.volume = volume; audio.play(); }; } -- cgit v1.2.3