From e74de81c08c748dff8d1f1d4fe8e098759d70329 Mon Sep 17 00:00:00 2001
From: "hinto.janai" <hinto.janai@protonmail.com>
Date: Mon, 27 Nov 2023 10:14:12 -0500
Subject: [PATCH] output: use audio spec sample rate when calculating ring size

The config sample rate was used before, which may have
been the lower OS default, e.g:

44,100hz may have been used before (default for Windows)
where the audio is actually 96,000hz, effectively halving
the ring buffer size.
---
 shukusai/src/audio/output.rs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/shukusai/src/audio/output.rs b/shukusai/src/audio/output.rs
index 29ae0f0b..7b2ce6f5 100644
--- a/shukusai/src/audio/output.rs
+++ b/shukusai/src/audio/output.rs
@@ -284,7 +284,7 @@ mod output {
 			};
 
 			// Create a ring buffer with a capacity for up-to 25ms of audio.
-			let ring_len = ((25 * config.sample_rate.0 as usize) / 1000) * num_channels;
+			let ring_len = ((25 * spec.rate as usize) / 1000) * num_channels;
 
 			let ring_buf = SpscRb::new(ring_len);
 			let (ring_buf_producer, ring_buf_consumer) = (ring_buf.producer(), ring_buf.consumer());