Skip to content

Commit

Permalink
output: use audio spec sample rate when calculating ring size
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
hinto-janai committed Nov 27, 2023
1 parent ff96ba5 commit e74de81
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion shukusai/src/audio/output.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down

0 comments on commit e74de81

Please sign in to comment.