tts: default language to auto, NULL lang selects auto, reject NULL text
This commit is contained in:
@@ -439,8 +439,12 @@ qt_status pipeline_tts_synthesize(PipelineTTS * pt,
|
||||
TtsPerf perf = {};
|
||||
Timer t_total;
|
||||
|
||||
// NULL lang selects automatic language: the prompt carries no
|
||||
// language id and the model infers it from the text.
|
||||
const char * lang = params->lang ? params->lang : "auto";
|
||||
|
||||
Timer t_build;
|
||||
if (!prompt_builder_build(pt, tok, params->text, params->lang, instruct, speaker, ref_spk_emb_ptr, ref_text,
|
||||
if (!prompt_builder_build(pt, tok, params->text, lang, instruct, speaker, ref_spk_emb_ptr, ref_text,
|
||||
ref_codes_T > 0 ? ref_codes.data() : NULL, ref_codes_T, &prompt)) {
|
||||
return QT_STATUS_GENERATE_FAILED;
|
||||
}
|
||||
|
||||
@@ -313,6 +313,14 @@ enum qt_status qt_synthesize(struct qt_context * q, const struct qt_tts_params *
|
||||
return QT_STATUS_INVALID_PARAMS;
|
||||
}
|
||||
|
||||
if (!params->text || !params->text[0]) {
|
||||
qt_set_error("qt_synthesize: params->text is NULL or empty");
|
||||
if (out) {
|
||||
qt_audio_free(out);
|
||||
}
|
||||
return QT_STATUS_INVALID_PARAMS;
|
||||
}
|
||||
|
||||
// Mode validation. Mirrors the upstream Python which raises
|
||||
// ValueError when generate_voice_design is called on a non
|
||||
// voice_design model and the same shape applies to
|
||||
|
||||
+4
-2
@@ -197,8 +197,10 @@ QT_API void qt_log_set(qt_log_cb cb, void * user_data);
|
||||
struct qt_tts_params {
|
||||
int abi_version;
|
||||
|
||||
// Input text and language hint. lang accepts the upstream
|
||||
// qwen3-tts language names ("english", "chinese", "auto", ...).
|
||||
// Input text and language hint. text is required and non empty.
|
||||
// lang accepts the upstream qwen3-tts language names ("english",
|
||||
// "chinese", "auto", ...). NULL selects "auto": the prompt carries
|
||||
// no language id and the model infers it from the text.
|
||||
// instruct is the style instruction string; required for
|
||||
// voice_design, optional for custom_voice, rejected for base.
|
||||
// speaker is the named speaker for custom_voice models, rejected
|
||||
|
||||
Reference in New Issue
Block a user