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:
parent
d735d23ffa
commit
15128edde4
1 changed files with 2 additions and 2 deletions
|
@ -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);
|
let last_valid_index = total_buffer_len.saturating_sub(1);
|
||||||
|
|
||||||
nih_debug_assert!(
|
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"
|
"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);
|
let last_valid_index = total_buffer_len.saturating_sub(1);
|
||||||
|
|
||||||
nih_debug_assert!(
|
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"
|
"Output event is out of bounds, will be clamped to the buffer's size"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue