Skip to content

Commit

Permalink
fix typos
Browse files Browse the repository at this point in the history
  • Loading branch information
csukuangfj committed Dec 1, 2023
1 parent c0e4956 commit 22bce19
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 14 deletions.
2 changes: 1 addition & 1 deletion sherpa-onnx/c-api/c-api.h
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
4 changes: 2 additions & 2 deletions sherpa-onnx/csrc/offline-tts.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
24 changes: 13 additions & 11 deletions sherpa-onnx/csrc/sherpa-onnx-offline-tts-play.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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<float> data;
Expand All @@ -30,18 +30,20 @@ struct Samples {
struct Buffer {
std::queue<Samples> 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<float>{s, s + n};
Expand All @@ -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;
}
Expand All @@ -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);

Expand Down

0 comments on commit 22bce19

Please sign in to comment.