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IAAW,SAAS,IAAI,UAAU,CAAC,WAAW,CAAC,CAE9C;IAED,IAAW,WAAW,IAAI,UAAU,CAAC,aAAa,CAAC,CAElD;IAED,IAAW,SAAS,IAAI,UAAU,CAAC,WAAW,CAAC,CAE9C;IAED,IAAW,UAAU,IAAI,UAAU,CAAC,YAAY,CAAC,CAEhD;IAED,IAAW,MAAM,IAAI,oBAAoB,CAExC;IAED,IAAW,SAAS,IAAI,kBAAkB,CAEzC;IAED,IAAW,SAAS,IAAI,UAAU,CAAC,WAAW,CAAC,CAE9C;IAED,IAAW,eAAe,IAAI,UAAU,CAAC,iBAAiB,CAAC,CAE1D;IAED,IAAW,MAAM,IAAI,UAAU,CAAC,QAAQ,CAAC,CAExC;IAED,IAAW,mBAAmB,IAAI,UAAU,CAAC,qBAAqB,CAAC,CAGlE;IAED,IAAW,cAAc,IAAI,UAAU,CAAC,gBAAgB,CAAC,CAExD;IAED,IAAW,mBAAmB,IAAI,UAAU,CAAC,qBAAqB,CAAC,CAElE;IAED,IAAW,YAAY,IAAI,UAAU,CAAC,cAAc,CAAC,CAEpD;IAED,IAAW,QAAQ,IAAI,SAAS,CAE/B;CACJ","file":"VoiceInfo.d.ts","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT license.\n\nimport { IVoiceJson, IVoiceTag } from \"./IVoiceJson\";\n\n/**\n * Defines the gender of synthesis voices.\n * Added in version 1.20.0.\n */\nexport enum SynthesisVoiceGender {\n\n /** Gender unknown */\n Unknown,\n\n /** Female voice */\n Female,\n\n /** Male voice */\n Male,\n\n /** Neutral voice */\n Neutral\n}\n\nexport enum SynthesisVoiceType {\n /**\n * Voice type is not known.\n */\n Unknown = 0,\n\n /**\n * Online neural voices.\n */\n OnlineNeural = 1,\n\n /**\n * Online standard voices. These voices are deprecated.\n */\n OnlineStandard = 2,\n\n /**\n * Offline neural voices.\n */\n OfflineNeural = 3,\n\n /**\n * Offline standard voices.\n */\n OfflineStandard = 4,\n\n /**\n * High definition (HD) voices. Refer to https://learn.microsoft.com/azure/ai-services/speech-service/high-definition-voices\n */\n OnlineNeuralHD = 5,\n}\n\nconst GENDER_LOOKUP: Record<string, SynthesisVoiceGender> = {\n [SynthesisVoiceGender[SynthesisVoiceGender.Neutral]]: SynthesisVoiceGender.Neutral,\n [SynthesisVoiceGender[SynthesisVoiceGender.Male]]: SynthesisVoiceGender.Male,\n [SynthesisVoiceGender[SynthesisVoiceGender.Female]]: SynthesisVoiceGender.Female,\n};\n\nconst VOICE_TYPE_LOOKUP: Record<string, SynthesisVoiceType> = {\n Neural: SynthesisVoiceType.OnlineNeural,\n NeuralHD: SynthesisVoiceType.OnlineNeuralHD,\n};\n\n/**\n * Information about Speech Synthesis voice\n * Added in version 1.20.0.\n * @class VoiceInfo\n */\nexport class VoiceInfo {\n private privName: IVoiceJson[\"Name\"];\n private privLocale: IVoiceJson[\"Locale\"];\n private privShortName: IVoiceJson[\"ShortName\"];\n private privDisplayName: IVoiceJson[\"DisplayName\"];\n private privLocalName: IVoiceJson[\"LocalName\"];\n private privLocaleName: IVoiceJson[\"LocaleName\"];\n private privGender: SynthesisVoiceGender;\n private privVoiceType: SynthesisVoiceType;\n private privStyleList: IVoiceJson[\"StyleList\"] = [];\n private privSampleRateHertz: IVoiceJson[\"SampleRateHertz\"];\n private privStatus: IVoiceJson[\"Status\"];\n private privExtendedPropertyMap: IVoiceJson[\"ExtendedPropertyMap\"];\n private privWordsPerMinute: IVoiceJson[\"WordsPerMinute\"];\n private privSecondaryLocaleList: IVoiceJson[\"SecondaryLocaleList\"];\n private privRolePlayList: IVoiceJson[\"RolePlayList\"];\n private privVoiceTag: IVoiceTag;\n\n public constructor(json: IVoiceJson) {\n if (!!json) {\n this.privName = json.Name;\n this.privLocale = json.Locale;\n this.privShortName = json.ShortName;\n this.privLocaleName = json.LocaleName;\n this.privDisplayName = json.DisplayName;\n this.privLocalName = json.LocalName;\n this.privVoiceType = VOICE_TYPE_LOOKUP[json.VoiceType] || SynthesisVoiceType.Unknown;\n this.privGender = GENDER_LOOKUP[json.Gender] || SynthesisVoiceGender.Unknown;\n\n if (!!json.StyleList && Array.isArray(json.StyleList)) {\n for (const style of json.StyleList) {\n this.privStyleList.push(style);\n }\n }\n\n this.privSampleRateHertz = json.SampleRateHertz;\n this.privStatus = json.Status;\n\n if (json.ExtendedPropertyMap) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n this.privExtendedPropertyMap = json.ExtendedPropertyMap;\n }\n\n this.privWordsPerMinute = json.WordsPerMinute;\n\n if (Array.isArray(json.SecondaryLocaleList)) {\n this.privSecondaryLocaleList = [...json.SecondaryLocaleList];\n }\n\n if (Array.isArray(json.RolePlayList)) {\n this.privRolePlayList = [...json.RolePlayList];\n }\n\n if (json.VoiceTag) {\n this.privVoiceTag = json.VoiceTag;\n }\n }\n }\n\n public get name(): IVoiceJson[\"Name\"] {\n return this.privName;\n }\n\n public get locale(): IVoiceJson[\"Locale\"] {\n return this.privLocale;\n }\n\n public get shortName(): IVoiceJson[\"ShortName\"] {\n return this.privShortName;\n }\n\n public get displayName(): IVoiceJson[\"DisplayName\"] {\n return this.privDisplayName;\n }\n\n public get localName(): IVoiceJson[\"LocalName\"] {\n return this.privLocalName;\n }\n\n public get localeName(): IVoiceJson[\"LocaleName\"] {\n return this.privLocaleName;\n }\n\n public get gender(): SynthesisVoiceGender {\n return this.privGender;\n }\n\n public get voiceType(): SynthesisVoiceType {\n return this.privVoiceType;\n }\n\n public get styleList(): IVoiceJson[\"StyleList\"] {\n return this.privStyleList;\n }\n\n public get sampleRateHertz(): IVoiceJson[\"SampleRateHertz\"] {\n return this.privSampleRateHertz;\n }\n\n public get status(): IVoiceJson[\"Status\"] {\n return this.privStatus;\n }\n\n public get extendedPropertyMap(): IVoiceJson[\"ExtendedPropertyMap\"] {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n return this.privExtendedPropertyMap;\n }\n\n public get wordsPerMinute(): IVoiceJson[\"WordsPerMinute\"] {\n return this.privWordsPerMinute;\n }\n\n public get secondaryLocaleList(): IVoiceJson[\"SecondaryLocaleList\"] {\n return this.privSecondaryLocaleList;\n }\n\n public get rolePlayList(): IVoiceJson[\"RolePlayList\"] {\n return this.privRolePlayList;\n }\n\n public get voiceTag(): IVoiceTag {\n return this.privVoiceTag;\n }\n}\n"]}