mirror of
https://github.com/rhasspy/espeak-ng.git
synced 2026-11-26 21:14:27 +00:00
Use espeak_SetVoiceByName in emscripten glue when only name is provided.
This commit is contained in:
@@ -50,23 +50,31 @@ public:
|
||||
espeak_SetSynthCallback(NULL);
|
||||
}
|
||||
|
||||
void set_voice(
|
||||
long set_voice(
|
||||
const char* aName,
|
||||
const char* aLang,
|
||||
const char* aLang=NULL,
|
||||
unsigned char aGender=0,
|
||||
unsigned char aAge=0,
|
||||
unsigned char aVariant = 0
|
||||
) {
|
||||
espeak_VOICE props = { 0 };
|
||||
props.name = aName;
|
||||
props.languages = aLang;
|
||||
props.gender = aGender;
|
||||
props.age = aAge;
|
||||
props.variant = aVariant;
|
||||
long result = 0;
|
||||
if (aLang || aGender || aAge || aVariant) {
|
||||
espeak_VOICE props = { 0 };
|
||||
props.name = aName;
|
||||
props.languages = aLang;
|
||||
props.gender = aGender;
|
||||
props.age = aAge;
|
||||
props.variant = aVariant;
|
||||
result = espeak_SetVoiceByProperties(&props);
|
||||
} else {
|
||||
result = espeak_SetVoiceByName(aName);
|
||||
}
|
||||
|
||||
// This way we don't need to allocate the name/lang strings to the heap.
|
||||
// Instead, we store the actual global voice.
|
||||
espeak_SetVoiceByProperties(&props);
|
||||
current_voice = espeak_GetCurrentVoice();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
int getSizeOfEventStruct_() {
|
||||
|
||||
Reference in New Issue
Block a user