diff formats/src/th06/pos.rs @ 783:ec1e06402a97

Replace SDL2_mixer with the kira crate
author Link Mauve <linkmauve@linkmauve.fr>
date Fri, 21 Nov 2025 10:21:59 +0100
parents
children
line wrap: on
line diff
new file mode 100644
--- /dev/null
+++ b/formats/src/th06/pos.rs
@@ -0,0 +1,21 @@
+//! POS music track format support.
+
+use nom::{IResult, Parser, number::complete::le_u32};
+
+/// A struct describing the loop points of Touhou background music.
+#[derive(Debug, Clone)]
+pub struct LoopPoints {
+    /// Time to which the music should loop after reaching end.
+    pub start: u32,
+
+    /// Time at which to loop back to start.
+    pub end: u32,
+}
+
+impl LoopPoints {
+    /// Parse a slice of bytes into a `LoopPoints` struct.
+    pub fn from_slice(input: &[u8]) -> IResult<&[u8], LoopPoints> {
+        let (i, (start, end)) = (le_u32, le_u32).parse(input)?;
+        Ok((i, LoopPoints { start, end }))
+    }
+}