Skip to content

Commit 79e7d59

Browse files
committed
refactor: remove unneeded max_delay_time check
1 parent 53e0215 commit 79e7d59

File tree

1 file changed

+5
-12
lines changed

1 file changed

+5
-12
lines changed

src/node/delay.rs

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -197,18 +197,11 @@ impl DelayNode {
197197
"NotSupportedError - maxDelayTime MUST be greater than zero and less than three minutes",
198198
);
199199

200-
// wW internally clamp max delay to quantum duration. This ensure
201-
// that even if the declared max_delay_time and max_delay are smaller
202-
// than quantum duration, the node, if found in a loop, will gracefully
203-
// fallback to the clamped behavior. (e.g. we ensure that ring buffer
204-
// size is always >= 2)
205-
let quantum_duration = 1. / sample_rate * RENDER_QUANTUM_SIZE as f64;
206-
let max_delay_time = options.max_delay_time.max(quantum_duration);
207-
208-
// Allocate large enough buffer to store all delayed samples.
209-
// We add one extra buffer in the ring buffer so that reader never read the
210-
// same entry in history as the writer, even if `delay_time === max_delay_time`
211-
// cf. test_max_delay_multiple_of_quantum_size and test_max_delay
200+
// Allocate large enough ring buffer to store all delayed samples.
201+
// We add one extra slot in the ring buffer so that reader never reads the
202+
// same entry in history as the writer, even if `delay_time == max_delay_time`
203+
// of if `max_delay_time < quantum duration`
204+
let max_delay_time = options.max_delay_time;
212205
let num_quanta =
213206
(max_delay_time * sample_rate / RENDER_QUANTUM_SIZE as f64).ceil() as usize;
214207
let ring_buffer = Vec::with_capacity(num_quanta + 1);

0 commit comments

Comments
 (0)