mirror of
https://github.com/ndarilek/tts-rs.git
synced 2024-11-23 01:29:38 +00:00
Prepare Backend and Features for synthesis
This commit is contained in:
parent
b3d2b788f7
commit
bf522b42a7
|
@ -250,6 +250,7 @@ impl Backend for Android {
|
|||
utterance_callbacks: true,
|
||||
voice: false,
|
||||
get_voice: false,
|
||||
synthesize: false,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -284,6 +285,10 @@ impl Backend for Android {
|
|||
}
|
||||
}
|
||||
|
||||
fn synthesize(&mut self, text: &str) -> Result<Vec<u8>, Error> {
|
||||
unimplemented!();
|
||||
}
|
||||
|
||||
fn stop(&mut self) -> Result<(), Error> {
|
||||
let vm = Self::vm()?;
|
||||
let env = vm.get_env()?;
|
||||
|
|
|
@ -123,6 +123,10 @@ impl Backend for AppKit {
|
|||
Ok(None)
|
||||
}
|
||||
|
||||
fn synthesize(&mut self, text: &str) -> Result<Vec<u8>, Error> {
|
||||
unimplemented!();
|
||||
}
|
||||
|
||||
fn stop(&mut self) -> Result<(), Error> {
|
||||
trace!("stop()");
|
||||
unsafe {
|
||||
|
|
|
@ -169,6 +169,7 @@ impl Backend for AvFoundation {
|
|||
voice: true,
|
||||
get_voice: false,
|
||||
utterance_callbacks: true,
|
||||
synthesize: false,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -205,6 +206,10 @@ impl Backend for AvFoundation {
|
|||
Ok(Some(UtteranceId::AvFoundation(utterance)))
|
||||
}
|
||||
|
||||
fn synthesize(&mut self, text: &str) -> Result<Vec<u8>, Error> {
|
||||
unimplemented!();
|
||||
}
|
||||
|
||||
fn stop(&mut self) -> Result<(), Error> {
|
||||
trace!("stop()");
|
||||
unsafe {
|
||||
|
|
|
@ -85,6 +85,7 @@ impl Backend for SpeechDispatcher {
|
|||
voice: true,
|
||||
get_voice: false,
|
||||
utterance_callbacks: true,
|
||||
synthesize: false,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -108,6 +109,10 @@ impl Backend for SpeechDispatcher {
|
|||
}
|
||||
}
|
||||
|
||||
fn synthesize(&mut self, text: &str) -> Result<Vec<u8>, Error> {
|
||||
unimplemented!();
|
||||
}
|
||||
|
||||
fn stop(&mut self) -> Result<(), Error> {
|
||||
trace!("stop()");
|
||||
self.0.cancel()?;
|
||||
|
|
|
@ -39,6 +39,10 @@ impl Backend for Tolk {
|
|||
Ok(None)
|
||||
}
|
||||
|
||||
fn synthesize(&mut self, text: &str) -> Result<Vec<u8>, Error> {
|
||||
unimplemented!();
|
||||
}
|
||||
|
||||
fn stop(&mut self) -> Result<(), Error> {
|
||||
trace!("stop()");
|
||||
self.0.silence();
|
||||
|
|
|
@ -59,6 +59,7 @@ impl Backend for Web {
|
|||
voice: true,
|
||||
get_voice: true,
|
||||
utterance_callbacks: true,
|
||||
synthesize: false,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -121,6 +122,10 @@ impl Backend for Web {
|
|||
}
|
||||
}
|
||||
|
||||
fn synthesize(&mut self, text: &str) -> Result<Vec<u8>, Error> {
|
||||
unimplemented!();
|
||||
}
|
||||
|
||||
fn stop(&mut self) -> Result<(), Error> {
|
||||
trace!("stop()");
|
||||
if let Some(window) = web_sys::window() {
|
||||
|
|
|
@ -156,6 +156,7 @@ impl Backend for WinRt {
|
|||
voice: true,
|
||||
get_voice: true,
|
||||
utterance_callbacks: true,
|
||||
synthesize: false,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -207,6 +208,10 @@ impl Backend for WinRt {
|
|||
Ok(Some(utterance_id))
|
||||
}
|
||||
|
||||
fn synthesize(&mut self, text: &str) -> Result<Vec<u8>, Error> {
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
fn stop(&mut self) -> std::result::Result<(), Error> {
|
||||
trace!("stop()");
|
||||
if !self.is_speaking()? {
|
||||
|
|
|
@ -162,6 +162,7 @@ unsafe impl Sync for UtteranceId {}
|
|||
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
|
||||
pub struct Features {
|
||||
pub is_speaking: bool,
|
||||
pub synthesize: bool,
|
||||
pub pitch: bool,
|
||||
pub rate: bool,
|
||||
pub stop: bool,
|
||||
|
@ -217,6 +218,7 @@ pub trait Backend: Clone {
|
|||
fn id(&self) -> Option<BackendId>;
|
||||
fn supported_features(&self) -> Features;
|
||||
fn speak(&mut self, text: &str, interrupt: bool) -> Result<Option<UtteranceId>, Error>;
|
||||
fn synthesize(&mut self, text: &str) -> Result<Vec<u8>, Error>;
|
||||
fn stop(&mut self) -> Result<(), Error>;
|
||||
fn min_rate(&self) -> f32;
|
||||
fn max_rate(&self) -> f32;
|
||||
|
|
Loading…
Reference in New Issue
Block a user