Skip to content

Commit

Permalink
output: revert audio buffer to 50ms
Browse files Browse the repository at this point in the history
  • Loading branch information
hinto-janai committed Nov 28, 2023
1 parent 5d49dd1 commit 2e19e78
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions shukusai/src/audio/output.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ mod output {
}

// Create PulseAudio buffer attribute.
const T_LENGTH: u32 = 8192;
const T_LENGTH: u32 = 16384;
let pa_buf_attr = pulse::def::BufferAttr {
// This reduces the audio buffer we hold.
//
Expand All @@ -134,7 +134,7 @@ mod output {
// via Festival since we flush the samples that
// haven't been played yet.
//
// This sets it to around 25ms~.
// This sets it to around 50ms~.
tlength: T_LENGTH,

maxlength: std::u32::MAX,
Expand Down Expand Up @@ -304,8 +304,8 @@ mod output {
buffer_size: cpal::BufferSize::Default,
};

// Create a ring buffer with a capacity for up-to 25ms of audio.
let ring_len = ((25 * spec.rate as usize) / 1000) * num_channels;
// Create a ring buffer with a capacity for up-to 50ms of audio.
let ring_len = ((50 * 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 2e19e78

Please sign in to comment.