Skip to content

Commit

Permalink
Fix out-of-range speaker id warning in generate_audio_from_text function
Browse files Browse the repository at this point in the history
  • Loading branch information
royshil committed Jul 1, 2024
1 parent c182a14 commit 6201b9c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/sherpa-tts/sherpa-tts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ void generate_audio_from_text(sherpa_tts_context &ctx, const std::string &text,
if (ctx.num_speakers == 0) {
obs_log(LOG_WARNING, "No speakers found in the model. Assuming speaker id 0.");
speaker_id = 0;
} else if (speaker_id < 0 || speaker_id >= ctx.num_speakers) {
} else if (speaker_id >= ctx.num_speakers) {
obs_log(LOG_WARNING, "Speaker id %d is out of range (0 -> %d), using speaker id 0",
speaker_id, ctx.num_speakers - 1);
speaker_id = 0;
Expand Down

0 comments on commit 6201b9c

Please sign in to comment.