pub struct LocalTtsProvider { /* private fields */ }Expand description
On-device KittenTTS via ONNX Runtime + misaki-rs G2P (no espeak / GPL).
Pool size is intentionally 1 session per model (serial inference under a mutex). Throughput concurrency is governed by ResourceGovernor TTS permits rather than unbounded parallel ONNX sessions (memory cost of multi-session pools is not free for mobile/desktop defaults).
Loaded packs participate in a weighted residency registry (JOE-1646 / JOE-1784). Default providers share the process-global pool; engines own isolated pools.
Implementations§
Source§impl LocalTtsProvider
impl LocalTtsProvider
pub fn new(cache_dir: PathBuf) -> Self
Sourcepub fn with_runtime(
cache_dir: PathBuf,
pool: Arc<TtsSessionPool>,
governor: Arc<ResourceGovernor>,
) -> Self
pub fn with_runtime( cache_dir: PathBuf, pool: Arc<TtsSessionPool>, governor: Arc<ResourceGovernor>, ) -> Self
Construct with an explicit TTS pool and governor (JOE-1784 / engine path).
pub fn with_progress(self, v: bool) -> Self
pub fn with_local_only(self, v: bool) -> Self
pub fn with_max_chars(self, n: usize) -> Self
pub fn pool(&self) -> &Arc<TtsSessionPool> ⓘ
Sourcepub fn clear_sessions(&self)
pub fn clear_sessions(&self)
Drop idle loaded ONNX sessions in this provider’s pool.
Active synthesis leases keep their registry entry and residency weight until the pin drops — a clear during an in-flight synth cannot make the same key reloadable as a second native session (JOE-1646).
Does not delete cached files under the TTS cache directory.
Trait Implementations§
Source§impl SynthesisProvider for LocalTtsProvider
impl SynthesisProvider for LocalTtsProvider
fn name(&self) -> &'static str
fn synthesize<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
text: &'life1 str,
opts: &'life2 SynthesisOptions,
) -> Pin<Box<dyn Future<Output = Result<SynthesisResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn preload<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
model: &'life1 str,
voice: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Auto Trait Implementations§
impl Freeze for LocalTtsProvider
impl RefUnwindSafe for LocalTtsProvider
impl Send for LocalTtsProvider
impl Sync for LocalTtsProvider
impl Unpin for LocalTtsProvider
impl UnsafeUnpin for LocalTtsProvider
impl UnwindSafe for LocalTtsProvider
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more