pub struct TtsHandler { /* private fields */ }Expand description
A plugin that sends Danmaku text to a TTS service and plays the audio sequentially.
This handler supports two modes:
- REST API mode: Sends text to a TTS REST API server, receives base64-encoded audio data, decodes it and plays through the system’s audio output
- Command mode: Uses local command-line TTS programs (like
sayon macOS orespeak-ngon Linux)
Messages are processed sequentially to avoid overlapping audio.
Implementations§
Source§impl TtsHandler
impl TtsHandler
Sourcepub fn new_rest_api_default(server_url: String) -> Self
pub fn new_rest_api_default(server_url: String) -> Self
Create a new TTS handler with REST API using default Chinese voice settings
Sourcepub fn new_rest_api_default_with_volume(server_url: String, volume: f32) -> Self
pub fn new_rest_api_default_with_volume(server_url: String, volume: f32) -> Self
Create a new TTS handler with REST API using default Chinese voice settings and custom volume
Sourcepub fn new_rest_api(
server_url: String,
voice: Option<String>,
backend: Option<String>,
quality: Option<String>,
format: Option<String>,
sample_rate: Option<u32>,
) -> Self
pub fn new_rest_api( server_url: String, voice: Option<String>, backend: Option<String>, quality: Option<String>, format: Option<String>, sample_rate: Option<u32>, ) -> Self
Create a new TTS handler with REST API and custom configuration
Sourcepub fn new_rest_api_with_volume(
server_url: String,
voice: Option<String>,
backend: Option<String>,
quality: Option<String>,
format: Option<String>,
sample_rate: Option<u32>,
volume: Option<f32>,
) -> Self
pub fn new_rest_api_with_volume( server_url: String, voice: Option<String>, backend: Option<String>, quality: Option<String>, format: Option<String>, sample_rate: Option<u32>, volume: Option<f32>, ) -> Self
Create a new TTS handler with REST API and custom configuration including volume
Sourcepub fn new_command(tts_command: String, tts_args: Vec<String>) -> Self
pub fn new_command(tts_command: String, tts_args: Vec<String>) -> Self
Create a new TTS handler with command-line TTS
Sourcepub fn new_default(server_url: String) -> Self
👎Deprecated: Use new_rest_api_default instead
pub fn new_default(server_url: String) -> Self
Legacy method - kept for backward compatibility
Trait Implementations§
Source§impl EventHandler for TtsHandler
impl EventHandler for TtsHandler
fn handle(&self, msg: &BiliMessage, _context: &EventContext)
Auto Trait Implementations§
impl Freeze for TtsHandler
impl !RefUnwindSafe for TtsHandler
impl Send for TtsHandler
impl Sync for TtsHandler
impl Unpin for TtsHandler
impl !UnwindSafe for TtsHandler
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
Mutably borrows from an owned value. Read more