diff --git a/sherpa-onnx/c-api/c-api.h b/sherpa-onnx/c-api/c-api.h index 604880360..29d4996c5 100644 --- a/sherpa-onnx/c-api/c-api.h +++ b/sherpa-onnx/c-api/c-api.h @@ -655,7 +655,7 @@ SHERPA_ONNX_API const SherpaOnnxGeneratedAudio *SherpaOnnxOfflineTtsGenerate( // callback is called whenever SherpaOnnxOfflineTtsConfig.max_num_sentences // sentences have been processed. The pointer passed to the callback -// is freed once the callback is returned. The so caller should not keep +// is freed once the callback is returned. So the caller should not keep // a reference to it. SHERPA_ONNX_API const SherpaOnnxGeneratedAudio * SherpaOnnxOfflineTtsGenerateWithCallback( diff --git a/sherpa-onnx/csrc/offline-tts.h b/sherpa-onnx/csrc/offline-tts.h index 19e1c0fa1..a673e54d7 100644 --- a/sherpa-onnx/csrc/offline-tts.h +++ b/sherpa-onnx/csrc/offline-tts.h @@ -71,8 +71,8 @@ class OfflineTts { // dataset. // @param speed The speed for the generated speech. E.g., 2 means 2x faster. // @param callback If not NULL, it is called whenever config.max_num_sentences - // sentence has been processed. Note that the passed - // pointer `samples for the callback might be invalidated + // sentences have been processed. Note that the passed + // pointer `samples` for the callback might be invalidated // after the callback is returned, so the caller should not // keep a reference to it. The caller can copy the data if // he/she wants to access the samples after the callback diff --git a/sherpa-onnx/csrc/sherpa-onnx-offline-tts-play.cc b/sherpa-onnx/csrc/sherpa-onnx-offline-tts-play.cc index c6c80b47a..1da2711d2 100644 --- a/sherpa-onnx/csrc/sherpa-onnx-offline-tts-play.cc +++ b/sherpa-onnx/csrc/sherpa-onnx-offline-tts-play.cc @@ -19,8 +19,8 @@ #include "sherpa-onnx/csrc/parse-options.h" #include "sherpa-onnx/csrc/wave-writer.h" -std::condition_variable g_cv; -std::mutex g_cv_m; +static std::condition_variable g_cv; +static std::mutex g_cv_m; struct Samples { std::vector data; @@ -30,18 +30,20 @@ struct Samples { struct Buffer { std::queue samples; std::mutex mutex; -} g_buffer; +}; + +static Buffer g_buffer; -bool g_started = false; -bool g_stopped = false; -bool g_killed = false; +static bool g_started = false; +static bool g_stopped = false; +static bool g_killed = false; static void Handler(int32_t /*sig*/) { g_killed = true; fprintf(stderr, "\nCaught Ctrl + C. Exiting\n"); } -void AudioGeneratedCallback(const float *s, int32_t n) { +static void AudioGeneratedCallback(const float *s, int32_t n) { if (n > 0) { Samples samples; samples.data = std::vector{s, s + n}; @@ -54,9 +56,9 @@ void AudioGeneratedCallback(const float *s, int32_t n) { static int PlayCallback(const void * /*in*/, void *out, unsigned long n, // NOLINT - const PaStreamCallbackTimeInfo * /*timeInfo*/, - PaStreamCallbackFlags /*statusFlags*/, - void * /*userData*/) { + const PaStreamCallbackTimeInfo * /*time_info*/, + PaStreamCallbackFlags /*status_flags*/, + void * /*user_data*/) { if (g_killed) { return paComplete; } @@ -70,7 +72,7 @@ static int PlayCallback(const void * /*in*/, void *out, return paComplete; } - // The current sentence is super long, though very unlikely, that + // The current sentence is so long, though very unlikely, that // the model has not finished processing it yet. std::fill_n(pout, n, 0);