mirror of
https://github.com/mii443/ncb-tts-r2.git
synced 2025-08-22 16:15:29 +00:00
support vec audio
This commit is contained in:
@ -78,7 +78,7 @@ impl TTSMessage for Message {
|
||||
res
|
||||
}
|
||||
|
||||
async fn synthesize(&self, instance: &mut TTSInstance, ctx: &Context) -> Compressed {
|
||||
async fn synthesize(&self, instance: &mut TTSInstance, ctx: &Context) -> Vec<Compressed> {
|
||||
let text = self.parse(instance, ctx).await;
|
||||
|
||||
let data_read = ctx.data.read().await;
|
||||
@ -127,6 +127,6 @@ impl TTSMessage for Message {
|
||||
.unwrap(),
|
||||
};
|
||||
|
||||
audio
|
||||
vec![audio]
|
||||
}
|
||||
}
|
||||
|
@ -32,7 +32,9 @@ impl TTSInstance {
|
||||
let manager = songbird::get(&ctx).await.unwrap();
|
||||
let call = manager.get(self.guild).unwrap();
|
||||
let mut call = call.lock().await;
|
||||
call.enqueue(audio.into()).await;
|
||||
for audio in audio {
|
||||
call.enqueue(audio.into()).await;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,7 @@ pub trait TTSMessage {
|
||||
/// ```rust
|
||||
/// let audio = message.synthesize(instance, ctx).await;
|
||||
/// ```
|
||||
async fn synthesize(&self, instance: &mut TTSInstance, ctx: &Context) -> Compressed;
|
||||
async fn synthesize(&self, instance: &mut TTSInstance, ctx: &Context) -> Vec<Compressed>;
|
||||
}
|
||||
|
||||
pub struct AnnounceMessage {
|
||||
@ -43,7 +43,7 @@ impl TTSMessage for AnnounceMessage {
|
||||
)
|
||||
}
|
||||
|
||||
async fn synthesize(&self, instance: &mut TTSInstance, ctx: &Context) -> Compressed {
|
||||
async fn synthesize(&self, instance: &mut TTSInstance, ctx: &Context) -> Vec<Compressed> {
|
||||
let text = self.parse(instance, ctx).await;
|
||||
let data_read = ctx.data.read().await;
|
||||
let storage = data_read
|
||||
@ -72,6 +72,6 @@ impl TTSMessage for AnnounceMessage {
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
audio
|
||||
vec![audio]
|
||||
}
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ impl TTS {
|
||||
|
||||
if let Some(audio) = self.cache.get(&cache_key) {
|
||||
info!("Cache hit for VOICEVOX TTS");
|
||||
return Ok(audio.clone());
|
||||
return Ok(audio.new_handle());
|
||||
}
|
||||
info!("Cache miss for VOICEVOX TTS");
|
||||
|
||||
@ -58,7 +58,7 @@ impl TTS {
|
||||
|
||||
if let Some(audio) = self.cache.get(&cache_key) {
|
||||
info!("Cache hit for GCP TTS");
|
||||
return Ok(audio.clone());
|
||||
return Ok(audio.new_handle());
|
||||
}
|
||||
info!("Cache miss for GCP TTS");
|
||||
|
||||
|
Reference in New Issue
Block a user