mirror of
https://github.com/rhasspy/espeak-ng.git
synced 2026-11-04 06:32:20 +00:00
Create an espeak-ng version of espeak_SetVoiceBy(Name|Properties).
This commit is contained in:
@@ -43,6 +43,7 @@ typedef enum {
|
||||
ENS_FIFO_BUFFER_FULL = 0x100003FF,
|
||||
ENS_NOT_INITIALIZED = 0x100004FF,
|
||||
ENS_AUDIO_ERROR = 0x100005FF,
|
||||
ENS_VOICE_NOT_FOUND = 0x100006FF,
|
||||
} espeak_ng_STATUS;
|
||||
|
||||
typedef enum {
|
||||
@@ -72,6 +73,12 @@ espeak_ng_SetParameter(espeak_PARAMETER parameter,
|
||||
ESPEAK_NG_API espeak_ng_STATUS
|
||||
espeak_ng_SetPunctuationList(const wchar_t *punctlist);
|
||||
|
||||
ESPEAK_NG_API espeak_ng_STATUS
|
||||
espeak_ng_SetVoiceByName(const char *name);
|
||||
|
||||
ESPEAK_NG_API espeak_ng_STATUS
|
||||
espeak_ng_SetVoiceByProperties(espeak_VOICE *voice_selector);
|
||||
|
||||
ESPEAK_NG_API espeak_ng_STATUS
|
||||
espeak_ng_Synthesize(const void *text,
|
||||
size_t size,
|
||||
|
||||
@@ -123,6 +123,16 @@ ESPEAK_API espeak_ERROR espeak_SetPunctuationList(const wchar_t *punctlist)
|
||||
return status_to_espeak_error(espeak_ng_SetPunctuationList(punctlist));
|
||||
}
|
||||
|
||||
ESPEAK_API espeak_ERROR espeak_SetVoiceByName(const char *name)
|
||||
{
|
||||
return status_to_espeak_error(espeak_SetVoiceByName(name));
|
||||
}
|
||||
|
||||
ESPEAK_API espeak_ERROR espeak_SetVoiceByProperties(espeak_VOICE *voice_selector)
|
||||
{
|
||||
return status_to_espeak_error(espeak_SetVoiceByProperties(voice_selector));
|
||||
}
|
||||
|
||||
ESPEAK_API espeak_ERROR espeak_Cancel(void)
|
||||
{
|
||||
return status_to_espeak_error(espeak_ng_Cancel());
|
||||
|
||||
@@ -141,8 +141,6 @@ espeak_ng_STATUS sync_espeak_Key(const char *key);
|
||||
espeak_ng_STATUS sync_espeak_Char(wchar_t character);
|
||||
void sync_espeak_SetPunctuationList(const wchar_t *punctlist);
|
||||
void sync_espeak_SetParameter(espeak_PARAMETER parameter, int value, int relative);
|
||||
int sync_espeak_SetVoiceByName(const char *name);
|
||||
int sync_espeak_SetVoiceByProperties(espeak_VOICE *voice_selector);
|
||||
espeak_ng_STATUS SetParameter(int parameter, int value, int relative);
|
||||
|
||||
int sync_espeak_terminated_msg(unsigned int unique_identifier, void *user_data);
|
||||
|
||||
@@ -1510,7 +1510,7 @@ static void GetVoices(const char *path)
|
||||
|
||||
#pragma GCC visibility push(default)
|
||||
|
||||
espeak_ERROR espeak_SetVoiceByName(const char *name)
|
||||
ESPEAK_NG_API espeak_ng_STATUS espeak_ng_SetVoiceByName(const char *name)
|
||||
{
|
||||
espeak_VOICE *v;
|
||||
int ix;
|
||||
@@ -1541,7 +1541,7 @@ espeak_ERROR espeak_SetVoiceByName(const char *name)
|
||||
DoVoiceChange(voice);
|
||||
voice_selector.languages = voice->language_name;
|
||||
SetVoiceStack(&voice_selector, variant_name);
|
||||
return EE_OK;
|
||||
return ENS_OK;
|
||||
}
|
||||
|
||||
if (n_voices_list == 0)
|
||||
@@ -1557,24 +1557,23 @@ espeak_ERROR espeak_SetVoiceByName(const char *name)
|
||||
return EE_OK;
|
||||
}
|
||||
}
|
||||
return EE_INTERNAL_ERROR; // voice name not found
|
||||
return ENS_VOICE_NOT_FOUND;
|
||||
}
|
||||
|
||||
espeak_ERROR espeak_SetVoiceByProperties(espeak_VOICE *voice_selector)
|
||||
ESPEAK_NG_API espeak_ng_STATUS espeak_ng_SetVoiceByProperties(espeak_VOICE *voice_selector)
|
||||
{
|
||||
const char *voice_id;
|
||||
int voice_found;
|
||||
|
||||
voice_id = SelectVoice(voice_selector, &voice_found);
|
||||
|
||||
if (voice_found == 0)
|
||||
return EE_NOT_FOUND;
|
||||
return ENS_VOICE_NOT_FOUND;
|
||||
|
||||
LoadVoiceVariant(voice_id, 0);
|
||||
DoVoiceChange(voice);
|
||||
SetVoiceStack(voice_selector, "");
|
||||
|
||||
return EE_OK;
|
||||
return ENS_OK;
|
||||
}
|
||||
|
||||
#pragma GCC visibility pop
|
||||
|
||||
Reference in New Issue
Block a user