Rename function

This commit is contained in:
toasted-nutbread 2020-03-07 14:11:28 -05:00
parent a8eb50d96f
commit 6adf2cf63f
3 changed files with 6 additions and 6 deletions

View File

@ -171,7 +171,7 @@ async function audioInject(definition, fields, sources, optionsContext, audioSys
const expressions = definition.expressions; const expressions = definition.expressions;
const audioSourceDefinition = Array.isArray(expressions) ? expressions[0] : definition; const audioSourceDefinition = Array.isArray(expressions) ? expressions[0] : definition;
const {uri} = await audioSystem.getExpressionAudio(audioSourceDefinition, sources, {tts: false, optionsContext}); const {uri} = await audioSystem.getDefinitionAudio(audioSourceDefinition, sources, {tts: false, optionsContext});
const filename = audioBuildFilename(audioSourceDefinition); const filename = audioBuildFilename(audioSourceDefinition);
if (filename !== null) { if (filename !== null) {
definition.audio = {url: uri, filename}; definition.audio = {url: uri, filename};

View File

@ -78,16 +78,16 @@ class AudioSystem {
} }
} }
async getExpressionAudio(expression, sources, details) { async getDefinitionAudio(definition, sources, details) {
const key = `${expression.expression}:${expression.reading}`; const key = `${definition.expression}:${definition.reading}`;
const cacheValue = this._cache.get(expression); const cacheValue = this._cache.get(definition);
if (typeof cacheValue !== 'undefined') { if (typeof cacheValue !== 'undefined') {
const {audio, uri, source} = cacheValue; const {audio, uri, source} = cacheValue;
return {audio, uri, source}; return {audio, uri, source};
} }
for (const source of sources) { for (const source of sources) {
const uri = await this._getAudioUri(expression, source, details); const uri = await this._getAudioUri(definition, source, details);
if (uri === null) { continue; } if (uri === null) { continue; }
try { try {

View File

@ -775,7 +775,7 @@ class Display {
const sources = this.options.audio.sources; const sources = this.options.audio.sources;
let audio, source, info; let audio, source, info;
try { try {
({audio, source} = await this.audioSystem.getExpressionAudio(expression, sources)); ({audio, source} = await this.audioSystem.getDefinitionAudio(expression, sources));
info = `From source ${1 + sources.indexOf(source)}: ${source}`; info = `From source ${1 + sources.indexOf(source)}: ${source}`;
} catch (e) { } catch (e) {
if (this.audioFallback === null) { if (this.audioFallback === null) {