From af733bc521d1f8578e4ec4d704c3e776be185603 Mon Sep 17 00:00:00 2001 From: Chris Xiong Date: Thu, 10 Nov 2022 01:54:26 -0500 Subject: Handle timing effects. Shitton of changes to make it compile. Also redesigned some shit just in case I want to reuse the code for a tracker module playback engine. --- src/itfile.rs | 52 ++++++++++++++++++++++++++-------------------------- 1 file changed, 26 insertions(+), 26 deletions(-) (limited to 'src/itfile.rs') diff --git a/src/itfile.rs b/src/itfile.rs index 03c79ee..76c1997 100644 --- a/src/itfile.rs +++ b/src/itfile.rs @@ -18,28 +18,28 @@ macro_rules! zero_default { #[repr(C, packed)] pub struct Header { - magic: [u8; 4], - song_name: [u8; 26], - pat_highlight: u16, //PHiligt - nord: u16, //OrdNum - ninst: u16, //InsNum - nsamp: u16, //SmpNum - npatt: u16, //PatNum - tracker_version: u16, //Cwt/v - format_version: u16, //Cmwt - flags: u16, //Flags - special: u16, //Special - global_volume: u8, //GV - mix_volume: u8, //MV - speed: u8, //IS - tempo: u8, //IT - stereo_seperation: u8, //Sep - wheel_depth: u8, //PWD - msg_length: u16, //MsgLgth - msg_offset: u32, //Message Offset - reserved: u32, - channel_pan: [u8; 64], - channel_vol: [u8; 64] + pub magic: [u8; 4], + pub song_name: [u8; 26], + pub pat_highlight: u16, //PHiligt + pub nord: u16, //OrdNum + pub ninst: u16, //InsNum + pub nsamp: u16, //SmpNum + pub npatt: u16, //PatNum + pub tracker_version: u16, //Cwt/v + pub format_version: u16, //Cmwt + pub flags: u16, //Flags + pub special: u16, //Special + pub global_volume: u8, //GV + pub mix_volume: u8, //MV + pub speed: u8, //IS + pub tempo: u8, //IT + pub stereo_seperation: u8, //Sep + pub wheel_depth: u8, //PWD + pub msg_length: u16, //MsgLgth + pub msg_offset: u32, //Message Offset + pub reserved: u32, + pub channel_pan: [u8; 64], + pub channel_vol: [u8; 64] } zero_default!{Header} @@ -182,7 +182,7 @@ pub struct Cell pub struct Patt { - pub nrows: u16, + pub nrows: u8, pub nch: u8, pub data: Vec } @@ -233,11 +233,11 @@ impl Patt { return Err(self::Error::CorruptPatternData); } - Ok(Patt{nrows, nch:64, data}) + Ok(Patt{nrows: nrows as u8, nch:64, data}) } - pub fn cell_at(&self, r: u16, c: u8) -> &Cell + pub fn cell_at(&self, r: u8, c: u8) -> &Cell { - &self.data[((r * self.nch as u16) + c as u16) as usize] + &self.data[((r as u16 * self.nch as u16) + c as u16) as usize] } pub fn dump(&self) { -- cgit v1.2.3