-
Notifications
You must be signed in to change notification settings - Fork 508
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added offline-tts-cache-mechanism-config.cc,.h
- Loading branch information
Your Name
committed
Jan 24, 2025
1 parent
f0c5242
commit f6e11ed
Showing
5 changed files
with
74 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// sherpa-onnx/csrc/offline-tts-cache-mechanism-config.cc | ||
// | ||
// Copyright (c) 2025 @mah92 From Iranian people to the community with love | ||
|
||
#include "sherpa-onnx/csrc/offline-tts-cache-mechanism-config.h" | ||
|
||
#include <vector> | ||
|
||
#include "sherpa-onnx/csrc/file-utils.h" | ||
#include "sherpa-onnx/csrc/macros.h" | ||
|
||
namespace sherpa_onnx { | ||
|
||
void OfflineTtsCacheMechanismConfig::Register(ParseOptions *po) { | ||
po->Register("tts-cache-dir", &cache_dir, | ||
"Path to the directory containing dict for espeak-ng."); | ||
po->Register("tts-cache-size", &cache_size, | ||
"Cache size for wav files in bytes. After the cache size is filled, wav files are kept based on usage statstics."); | ||
} | ||
|
||
bool OfflineTtsCacheMechanismConfig::Validate() const { | ||
return true; | ||
} | ||
|
||
std::string OfflineTtsCacheMechanismConfig::ToString() const { | ||
std::ostringstream os; | ||
|
||
os << "OfflineTtsCacheMechanismConfig("; | ||
os << "cache_dir=\"" << cache_dir << "\", "; | ||
os << "cache_size=" << cache_size << ")"; | ||
|
||
return os.str(); | ||
} | ||
|
||
} // namespace sherpa_onnx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// sherpa-onnx/csrc/offline-tts-cache-mechanism-config.h | ||
// | ||
// Copyright (c) 2025 @mah92 From Iranian people to the community with love | ||
|
||
#ifndef SHERPA_ONNX_CSRC_OFFLINE_TTS_CACHE_MECHANISM_CONFIG_H_ | ||
#define SHERPA_ONNX_CSRC_OFFLINE_TTS_CACHE_MECHANISM_CONFIG_H_ | ||
|
||
#include <string> | ||
|
||
#include "sherpa-onnx/csrc/parse-options.h" | ||
|
||
namespace sherpa_onnx { | ||
|
||
struct OfflineTtsCacheMechanismConfig { | ||
|
||
std::string cache_dir; | ||
|
||
int32_t cache_size; | ||
|
||
OfflineTtsCacheMechanismConfig() = default; | ||
|
||
OfflineTtsCacheMechanismConfig(const std::string &cache_dir, | ||
int32_t cache_size) | ||
: cache_dir(cache_dir), | ||
cache_size(cache_size) {} | ||
|
||
void Register(ParseOptions *po); | ||
bool Validate() const; | ||
|
||
std::string ToString() const; | ||
}; | ||
|
||
} // namespace sherpa_onnx | ||
|
||
#endif // SHERPA_ONNX_CSRC_OFFLINE_TTS_CACHE_MECHANISM_CONFIG_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters