mirror of
https://github.com/ndarilek/tts-rs.git
synced 2024-11-22 09:09:37 +00:00
Add Tts::synthesize method
This commit is contained in:
parent
91a0f03f1a
commit
4f4ab53252
|
@ -375,6 +375,15 @@ impl Tts {
|
||||||
.speak(text.into().as_str(), interrupt)
|
.speak(text.into().as_str(), interrupt)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn synthesize<S: Into<String>>(&mut self, text: S) -> Result<Vec<u8>, Error> {
|
||||||
|
let Features { synthesize, .. } = self.supported_features();
|
||||||
|
if synthesize {
|
||||||
|
self.0.write().unwrap().synthesize(text.into().as_str())
|
||||||
|
} else {
|
||||||
|
Err(Error::UnsupportedFeature)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Stops current speech.
|
/// Stops current speech.
|
||||||
pub fn stop(&mut self) -> Result<&Self, Error> {
|
pub fn stop(&mut self) -> Result<&Self, Error> {
|
||||||
let Features { stop, .. } = self.supported_features();
|
let Features { stop, .. } = self.supported_features();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user