Remove de/structuring from public API
This commit is contained in:
parent
7fc3882607
commit
823c026533
@ -110,7 +110,7 @@ function textToSpeechTest() {
|
|||||||
const text = document.querySelector('#text-to-speech-voice-test').dataset.speechText || '';
|
const text = document.querySelector('#text-to-speech-voice-test').dataset.speechText || '';
|
||||||
const voiceUri = document.querySelector('#text-to-speech-voice').value;
|
const voiceUri = document.querySelector('#text-to-speech-voice').value;
|
||||||
|
|
||||||
const audio = audioSystem.createTextToSpeechAudio({text, voiceUri});
|
const audio = audioSystem.createTextToSpeechAudio(text, voiceUri);
|
||||||
audio.volume = 1.0;
|
audio.volume = 1.0;
|
||||||
audio.play();
|
audio.play();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
@ -102,7 +102,7 @@ class AudioSystem {
|
|||||||
throw new Error('Could not create audio');
|
throw new Error('Could not create audio');
|
||||||
}
|
}
|
||||||
|
|
||||||
createTextToSpeechAudio({text, voiceUri}) {
|
createTextToSpeechAudio(text, voiceUri) {
|
||||||
const voice = this._getTextToSpeechVoiceFromVoiceUri(voiceUri);
|
const voice = this._getTextToSpeechVoiceFromVoiceUri(voiceUri);
|
||||||
if (voice === null) {
|
if (voice === null) {
|
||||||
throw new Error('Invalid text-to-speech voice');
|
throw new Error('Invalid text-to-speech voice');
|
||||||
@ -117,7 +117,8 @@ class AudioSystem {
|
|||||||
async _createAudio(uri) {
|
async _createAudio(uri) {
|
||||||
const ttsParameters = this._getTextToSpeechParameters(uri);
|
const ttsParameters = this._getTextToSpeechParameters(uri);
|
||||||
if (ttsParameters !== null) {
|
if (ttsParameters !== null) {
|
||||||
return this.createTextToSpeechAudio(ttsParameters);
|
const {text, voiceUri} = ttsParameters;
|
||||||
|
return this.createTextToSpeechAudio(text, voiceUri);
|
||||||
}
|
}
|
||||||
|
|
||||||
return await this._createAudioFromUrl(uri);
|
return await this._createAudioFromUrl(uri);
|
||||||
|
Loading…
Reference in New Issue
Block a user