Added progress for callback of tts generator (#712)
Co-authored-by: leohwang <leohwang@360converter.com>
This commit is contained in:
@@ -9,6 +9,11 @@
|
||||
#include "sherpa-onnx/csrc/parse-options.h"
|
||||
#include "sherpa-onnx/csrc/wave-writer.h"
|
||||
|
||||
void audioCallback(const float *samples, int32_t n, float progress)
|
||||
{
|
||||
printf( "sample=%d, progress=%f\n", n, progress );
|
||||
}
|
||||
|
||||
int main(int32_t argc, char *argv[]) {
|
||||
const char *kUsageMessage = R"usage(
|
||||
Offline text-to-speech with sherpa-onnx
|
||||
@@ -74,7 +79,7 @@ or details.
|
||||
sherpa_onnx::OfflineTts tts(config);
|
||||
|
||||
const auto begin = std::chrono::steady_clock::now();
|
||||
auto audio = tts.Generate(po.GetArg(1), sid);
|
||||
auto audio = tts.Generate(po.GetArg(1), sid, 1.0, audioCallback);
|
||||
const auto end = std::chrono::steady_clock::now();
|
||||
|
||||
if (audio.samples.empty()) {
|
||||
|
||||
Reference in New Issue
Block a user