diff --git a/src/implement/message.rs b/src/implement/message.rs index 39d54a9..a93d4b6 100644 --- a/src/implement/message.rs +++ b/src/implement/message.rs @@ -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 { 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] } } diff --git a/src/tts/instance.rs b/src/tts/instance.rs index e2b07ae..bba0e1c 100644 --- a/src/tts/instance.rs +++ b/src/tts/instance.rs @@ -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; + } } } diff --git a/src/tts/message.rs b/src/tts/message.rs index e9718ce..e821473 100644 --- a/src/tts/message.rs +++ b/src/tts/message.rs @@ -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; } 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 { 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] } } diff --git a/src/tts/tts.rs b/src/tts/tts.rs index d9a01ea..ebbd2cc 100644 --- a/src/tts/tts.rs +++ b/src/tts/tts.rs @@ -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");