client sdk
This commit is contained in:
+9
-10
@@ -73,10 +73,9 @@ pub struct FishAudioTts {
|
||||
|
||||
impl FishAudioTts {
|
||||
pub fn new(config: &Config) -> Self {
|
||||
let reference = config.tts_reference().map(|(audio_path, text)| Reference {
|
||||
audio_path,
|
||||
text,
|
||||
});
|
||||
let reference = config
|
||||
.tts_reference()
|
||||
.map(|(audio_path, text)| Reference { audio_path, text });
|
||||
if let Some(r) = &reference {
|
||||
info!(
|
||||
audio_path = %r.audio_path,
|
||||
@@ -273,7 +272,11 @@ impl TtsEngine for FishAudioTts {
|
||||
debug!(
|
||||
chunk_count,
|
||||
total_samples,
|
||||
avg_chunk_bytes = if chunk_count > 0 { (total_samples * 2) / chunk_count } else { 0 },
|
||||
avg_chunk_bytes = if chunk_count > 0 {
|
||||
(total_samples * 2) / chunk_count
|
||||
} else {
|
||||
0
|
||||
},
|
||||
audio_s = format!("{:.2}", total_samples as f32 / tts_sr as f32),
|
||||
elapsed_ms = t0.elapsed().as_millis(),
|
||||
queue_len = tts_queue.len(),
|
||||
@@ -290,11 +293,7 @@ impl TtsEngine for FishAudioTts {
|
||||
/// Parse 16-bit LE PCM samples from a chunk and push them directly to the
|
||||
/// queue (Fish Audio's 44.1 kHz output matches the mixer rate).
|
||||
/// Returns the number of samples pushed.
|
||||
fn ingest_pcm_chunk(
|
||||
chunk: &[u8],
|
||||
carry: &mut Option<u8>,
|
||||
tts_queue: &SampleRingBuffer,
|
||||
) -> usize {
|
||||
fn ingest_pcm_chunk(chunk: &[u8], carry: &mut Option<u8>, tts_queue: &SampleRingBuffer) -> usize {
|
||||
let mut samples: Vec<i16> = Vec::with_capacity(chunk.len() / 2 + 1);
|
||||
let mut iter = chunk.iter().copied();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user