aboutsummaryrefslogtreecommitdiff
path: root/src/convert.rs
diff options
context:
space:
mode:
authorGravatar Chris Xiong <chirs241097@gmail.com> 2022-11-23 12:53:37 -0500
committerGravatar Chris Xiong <chirs241097@gmail.com> 2022-11-23 12:53:37 -0500
commit736033237b41f91bcc093c06780e47c4ad5febaa (patch)
tree8fa1cd0ae0b659a5bb5993d3d84f06ed116683a5 /src/convert.rs
parent5405aea1f7dc629626b39e480ba459b5037af7f2 (diff)
downloadit2midi-736033237b41f91bcc093c06780e47c4ad5febaa.tar.xz
AAAArgh finally we read IT timing info.
Diffstat (limited to 'src/convert.rs')
-rw-r--r--src/convert.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/convert.rs b/src/convert.rs
index ca45e4a..884708d 100644
--- a/src/convert.rs
+++ b/src/convert.rs
@@ -15,6 +15,7 @@ struct PlayerState
current_tick: u8,
speed: u8,
tempo: u8,
+ rpb: u8,
loop_start: u8,
loop_ctr: u8,
row_extension: u8,
@@ -172,6 +173,7 @@ impl<'a> Player<'a>
current_tick: 0,
speed: self.it.header.speed,
tempo: self.it.header.tempo,
+ rpb: self.it.time_signature().unwrap_or((4, 16)).0 as u8,
loop_start: 0,
loop_ctr: !0,
row_extension: 0,
@@ -231,7 +233,7 @@ impl<'a> CellHandler for ConvertCellHandler<'a>
let itfile::Cell{mask, note, inst, vol, efx, fxp} = cell;
if !ch == 0
{
- self.miditick += <Rational as From<u32>>::from(960) / (ps.speed as u16 * 4).into();
+ self.miditick += <Rational as From<u32>>::from(960) / (ps.speed as u16 * ps.rpb as u16).into();
}
ps
}