nsISynthVoiceRegistry.idl (2269B)
1 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* This Source Code Form is subject to the terms of the Mozilla Public 3 * License, v. 2.0. If a copy of the MPL was not distributed with this file, 4 * You can obtain one at http://mozilla.org/MPL/2.0/. */ 5 6 #include "nsISupports.idl" 7 8 interface nsISpeechService; 9 10 [scriptable, builtinclass, uuid(5d7a0b38-77e5-4ee5-897c-ce5db9b85d44)] 11 interface nsISynthVoiceRegistry : nsISupports 12 { 13 /** 14 * Register a speech synthesis voice. 15 * 16 * @param aService the service that provides this voice. 17 * @param aUri a unique identifier for this voice. 18 * @param aName human-readable name for this voice. 19 * @param aLang a BCP 47 language tag. 20 * @param aLocalService true if service does not require network. 21 * @param aQueuesUtterances true if voice only speaks one utterance at a time 22 */ 23 void addVoice(in nsISpeechService aService, in AString aUri, 24 in AString aName, in AString aLang, 25 in boolean aLocalService, in boolean aQueuesUtterances); 26 27 /** 28 * Remove a speech synthesis voice. 29 * 30 * @param aService the service that was used to add the voice. 31 * @param aUri a unique identifier of an existing voice. 32 */ 33 void removeVoice(in nsISpeechService aService, in AString aUri); 34 35 /** 36 * Notify content of voice availability changes. This allows content 37 * to be notified of voice catalog changes in real time. 38 */ 39 void notifyVoicesChanged(); 40 41 /** 42 * Notify chrome code of an error when starting speech synthesis service 43 */ 44 void notifyVoicesError(in AString aError); 45 46 /** 47 * Set a voice as default. 48 * 49 * @param aUri a unique identifier of an existing voice. 50 * @param aIsDefault true if this voice should be toggled as default. 51 */ 52 void setDefaultVoice(in AString aUri, in boolean aIsDefault); 53 54 readonly attribute uint32_t voiceCount; 55 56 AString getVoice(in uint32_t aIndex); 57 58 boolean isDefaultVoice(in AString aUri); 59 60 boolean isLocalVoice(in AString aUri); 61 62 AString getVoiceLang(in AString aUri); 63 64 AString getVoiceName(in AString aUri); 65 }; 66 67 %{C++ 68 #define NS_SYNTHVOICEREGISTRY_CONTRACTID \ 69 "@mozilla.org/synth-voice-registry;1" 70 %}