// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// This file was generated by:
// tools/json_schema_compiler/compiler.py.
// NOTE: The format of types has changed. 'FooType' is now
// 'chrome.ttsEngine.FooType'.
// Please run the closure compiler before committing changes.
// See
// https://chromium.googlesource.com/chromium/src/+/main/docs/closure_compilation.md
/**
* @fileoverview Externs generated from namespace: ttsEngine
* @externs
*/
/** @const */
chrome.ttsEngine = {};
/**
* @enum {string}
* @see https://developer.chrome.com/extensions/ttsEngine#type-VoiceGender
*/
chrome.ttsEngine.VoiceGender = {
MALE: 'male',
FEMALE: 'female',
};
/**
* Options specified to the tts.speak() method.
* @typedef {{
* voiceName: (string|undefined),
* lang: (string|undefined),
* gender: (!chrome.ttsEngine.VoiceGender|undefined),
* rate: (number|undefined),
* pitch: (number|undefined),
* volume: (number|undefined)
* }}
* @see https://developer.chrome.com/extensions/ttsEngine#type-SpeakOptions
*/
chrome.ttsEngine.SpeakOptions;
/**
* Contains the audio stream format expected to be produced by an engine.
* @typedef {{
* sampleRate: number,
* bufferSize: number
* }}
* @see https://developer.chrome.com/extensions/ttsEngine#type-AudioStreamOptions
*/
chrome.ttsEngine.AudioStreamOptions;
/**
* Parameters containing an audio buffer and associated data.
* @typedef {{
* audioBuffer: Float32Array,
* charIndex: (number|undefined),
* isLastBuffer: (boolean|undefined)
* }}
* @see https://developer.chrome.com/extensions/ttsEngine#type-AudioBuffer
*/
chrome.ttsEngine.AudioBuffer;
/**
* Called by an engine to update its list of voices. This list overrides any
* voices declared in this extension's manifest.
* @param {!Array<!chrome.tts.TtsVoice>} voices Array of
* $(ref:tts.TtsVoice) objects representing the available voices for speech
* synthesis.
* @see https://developer.chrome.com/extensions/ttsEngine#method-updateVoices
*/
chrome.ttsEngine.updateVoices = function(voices) {};
/**
* Routes a TTS event from a speech engine to a client.
* @param {number} requestId
* @param {!chrome.tts.TtsEvent} event The update event from the
* text-to-speech engine indicating the status of this utterance.
* @see https://developer.chrome.com/extensions/ttsEngine#method-sendTtsEvent
*/
chrome.ttsEngine.sendTtsEvent = function(requestId, event) {};
/**
* Routes TTS audio from a speech engine to a client.
* @param {number} requestId
* @param {!chrome.ttsEngine.AudioBuffer} audio An audio buffer from the
* text-to-speech engine.
* @see https://developer.chrome.com/extensions/ttsEngine#method-sendTtsAudio
*/
chrome.ttsEngine.sendTtsAudio = function(requestId, audio) {};
/**
* Called when the user makes a call to tts.speak() and one of the voices from
* this extension's manifest is the first to match the options object.
* @type {!ChromeEvent}
* @see https://developer.chrome.com/extensions/ttsEngine#event-onSpeak
*/
chrome.ttsEngine.onSpeak;
/**
* Called when the user makes a call to tts.speak() and one of the voices from
* this extension's manifest is the first to match the options object. Differs
* from ttsEngine.onSpeak in that Chrome provides audio playback services and
* handles dispatching tts events.
* @type {!ChromeEvent}
* @see https://developer.chrome.com/extensions/ttsEngine#event-onSpeakWithAudioStream
*/
chrome.ttsEngine.onSpeakWithAudioStream;
/**
* Fired when a call is made to tts.stop and this extension may be in the middle
* of speaking. If an extension receives a call to onStop and speech is already
* stopped, it should do nothing (not raise an error). If speech is in the
* paused state, this should cancel the paused state.
* @type {!ChromeEvent}
* @see https://developer.chrome.com/extensions/ttsEngine#event-onStop
*/
chrome.ttsEngine.onStop;
/**
* Optional: if an engine supports the pause event, it should pause the current
* utterance being spoken, if any, until it receives a resume event or stop
* event. Note that a stop event should also clear the paused state.
* @type {!ChromeEvent}
* @see https://developer.chrome.com/extensions/ttsEngine#event-onPause
*/
chrome.ttsEngine.onPause;
/**
* Optional: if an engine supports the pause event, it should also support the
* resume event, to continue speaking the current utterance, if any. Note that a
* stop event should also clear the paused state.
* @type {!ChromeEvent}
* @see https://developer.chrome.com/extensions/ttsEngine#event-onResume
*/
chrome.ttsEngine.onResume;