diff --git a/vocodes/public/avatars/james-earl-jones.jpg b/vocodes/public/avatars/james-earl-jones.jpg new file mode 100644 index 0000000000..c9ac1b082c Binary files /dev/null and b/vocodes/public/avatars/james-earl-jones.jpg differ diff --git a/vocodes/public/full/darth-vader-full.png b/vocodes/public/full/darth-vader-full.png new file mode 100644 index 0000000000..aba98070b7 Binary files /dev/null and b/vocodes/public/full/darth-vader-full.png differ diff --git a/vocodes/src/model/Speakers.ts b/vocodes/src/model/Speakers.ts index 227378dddf..121bd8f7e8 100644 --- a/vocodes/src/model/Speakers.ts +++ b/vocodes/src/model/Speakers.ts @@ -34,6 +34,10 @@ const SPEAKER_CATEGORIES : Map = new Map([ class Speaker { name: string; slug: string; + + // Used for speakers like "darth-vader" who are backed by "james-earl-jones". + apiSlugOverride?: string; + defaultVoice: boolean; description: string; avatarUrl?: string; @@ -41,7 +45,7 @@ class Speaker { voiceQuality?: number; categories: SpeakerCategory[]; - constructor(name: string, slug: string, description: string, categories: SpeakerCategory[], avatarUrl?: string, fullUrl?: string, voiceQuality?: number, defaultVoice?: boolean) { + constructor(name: string, slug: string, description: string, categories: SpeakerCategory[], avatarUrl?: string, fullUrl?: string, voiceQuality?: number, defaultVoice?: boolean, apiSlugOverride?: string) { this.name = name; this.slug = slug; this.description = description; @@ -50,6 +54,7 @@ class Speaker { this.voiceQuality = voiceQuality; this.defaultVoice = defaultVoice !== undefined && defaultVoice; this.categories = categories; + this.apiSlugOverride = apiSlugOverride; } static fromJson(json: any) : Speaker { @@ -75,6 +80,13 @@ class Speaker { return this.name; } + getApiSlug(): string { + if (this.apiSlugOverride !== undefined) { + return this.apiSlugOverride; + } + return this.slug; + } + getSlug() : string { return this.slug; } @@ -247,6 +259,16 @@ const SPEAKERS : Speaker[] = [ fullUrl: "danny-devito-full.png", voiceQuality: 6.9, }), + Speaker.fromJson({ + name: "Darth Vader", + slug: "darth-vader", + apiSlugOverride: "james-earl-jones", + description: "Star Wars", + avatarUrl: "darth-vader.jpg", + fullUrl: "darth-vader-full.png", + voiceQuality: 5.5, + categories: ["celebrities"], + }), Speaker.fromJson({ name: "David Cross", slug: "david-cross", @@ -314,7 +336,7 @@ const SPEAKERS : Speaker[] = [ name: "James Earl Jones", slug: "james-earl-jones", description: "Actor and voice actor.", - avatarUrl: "darth-vader.jpg", + avatarUrl: "james-earl-jones.jpg", fullUrl: "james-earl-jones-full.png", voiceQuality: 5.5, categories: ["celebrities"], diff --git a/vocodes/src/modes/speak/Form.tsx b/vocodes/src/modes/speak/Form.tsx index 9b69bb3f41..ba0f1f225e 100644 --- a/vocodes/src/modes/speak/Form.tsx +++ b/vocodes/src/modes/speak/Form.tsx @@ -40,7 +40,7 @@ class Form extends React.Component { } public speak(sentence: string, speaker: Speaker) { - let request = new SpeakRequest(sentence, speaker.getSlug()); + let request = new SpeakRequest(sentence, speaker.getApiSlug()); console.log("Making SpeakRequest:", request);