From 6f2ee63de937744342a021fa3d454acaec9925d4 Mon Sep 17 00:00:00 2001 From: Dominik Werder Date: Wed, 4 Jun 2025 11:29:46 +0200 Subject: [PATCH] Add helper --- src/msp.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/msp.rs b/src/msp.rs index 5038a09..ab277ba 100644 --- a/src/msp.rs +++ b/src/msp.rs @@ -191,6 +191,17 @@ impl PrebinnedPartitioning { let dt = self.bin_len().mul(n); TsMs::from_ms_u64(dt.ms()) } + + pub fn lsp_inc(&self, msp: MspU32, lsp: LspU32) -> (MspU32, LspU32) { + let mut m2 = msp; + let mut l2 = lsp; + l2.0 += 1; + if l2.0 >= self.patch_len() { + l2.0 = 0; + m2.0 += 1; + } + (m2, l2) + } } impl TryFrom for PrebinnedPartitioning {