1
0
Fork 0

Fix assertions in clamping functions

This was previously comparing against the buffer's length, so the `<`
made sense. But this approach always allows events at time 0 even if the
buffer is empty.
This commit is contained in:
Robbert van der Helm 2023-02-01 17:39:08 +01:00
parent d735d23ffa
commit 15128edde4

View file

@ -69,7 +69,7 @@ pub fn clamp_input_event_timing(timing: u32, total_buffer_len: u32) -> u32 {
let last_valid_index = total_buffer_len.saturating_sub(1);
nih_debug_assert!(
timing < last_valid_index,
timing <= last_valid_index,
"Input event is out of bounds, will be clamped to the buffer's size"
);
@ -83,7 +83,7 @@ pub fn clamp_output_event_timing(timing: u32, total_buffer_len: u32) -> u32 {
let last_valid_index = total_buffer_len.saturating_sub(1);
nih_debug_assert!(
timing < last_valid_index,
timing <= last_valid_index,
"Output event is out of bounds, will be clamped to the buffer's size"
);