aboutsummaryrefslogtreecommitdiff
path: root/src/itfile.rs
diff options
context:
space:
mode:
authorGravatar Chris Xiong <chirs241097@gmail.com> 2022-11-10 01:54:26 -0500
committerGravatar Chris Xiong <chirs241097@gmail.com> 2022-11-10 01:54:26 -0500
commitaf733bc521d1f8578e4ec4d704c3e776be185603 (patch)
tree5436f9295f83a6c5d543be81a1db153ce253aff0 /src/itfile.rs
parent9b47fe51e8647393e3d2799cd3940b8cfb8dd9a6 (diff)
downloadit2midi-af733bc521d1f8578e4ec4d704c3e776be185603.tar.xz
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.
Diffstat (limited to 'src/itfile.rs')
-rw-r--r--src/itfile.rs52
1 files changed, 26 insertions, 26 deletions
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<Cell>
}
@@ -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)
{