Skip to content

Commit

Permalink
Added 'LocaleName' in VoiceInfo Class (#679)
Browse files Browse the repository at this point in the history
  • Loading branch information
shivsarthak committed May 19, 2023
1 parent 10efe02 commit 04a442d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/sdk/SynthesisVoicesResult.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export class SynthesisVoicesResult extends SynthesisResult {
super(requestId, ResultReason.VoicesListRetrieved, undefined, new PropertyCollection());
this.privVoices = [];
for (const item of json) {
this.privVoices.push(new VoiceInfo(item as { Name: string; LocalName: string; ShortName: string; Gender: string; VoiceType: string; Locale: string; StyleList: string[] }));
this.privVoices.push(new VoiceInfo(item as { Name: string; LocalName: string; LocaleName: string; ShortName: string; Gender: string; VoiceType: string; Locale: string; StyleList: string[] }));
}
} else {
super(requestId, ResultReason.Canceled, errorDetails ? errorDetails : "Error information unavailable", new PropertyCollection());
Expand Down
8 changes: 7 additions & 1 deletion src/sdk/VoiceInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,19 @@ export class VoiceInfo {
private privLocale: string;
private privShortName: string;
private privLocalName: string;
private privLocaleName: string;
private privGender: SynthesisVoiceGender;
private privVoiceType: SynthesisVoiceType;
private privStyleList: string[] = [];
private privVoicePath: string;

public constructor(json: { Name: string; LocalName: string; ShortName: string; Gender: string; VoiceType: string; Locale: string; StyleList: string[] }) {
public constructor(json: { Name: string; LocalName: string; ShortName: string; Gender: string; VoiceType: string; LocaleName: string ; Locale: string; StyleList: string[] }) {
this.privVoicePath = "";
if (!!json) {
this.privName = json.Name;
this.privLocale = json.Locale;
this.privShortName = json.ShortName;
this.privLocaleName = json.LocaleName;
this.privLocalName = json.LocalName;
this.privVoiceType = json.VoiceType.endsWith("Standard") ? SynthesisVoiceType.OnlineStandard : SynthesisVoiceType.OnlineNeural;
this.privGender = json.Gender === "Male" ? SynthesisVoiceGender.Male : json.Gender === "Female" ? SynthesisVoiceGender.Female : SynthesisVoiceGender.Unknown;
Expand Down Expand Up @@ -72,6 +74,10 @@ export class VoiceInfo {
return this.privLocalName;
}

public get localeName(): string {
return this.privLocaleName;
}

public get gender(): SynthesisVoiceGender {
return this.privGender;
}
Expand Down

0 comments on commit 04a442d

Please sign in to comment.