From f8cf52fa4b2bbaff5627fa397a26589070084d3e Mon Sep 17 00:00:00 2001 From: Chris Xiong Date: Fri, 25 Nov 2022 23:34:51 -0500 Subject: Actually produce some valid midi output. Major restructure in the IT player: No more custom trait objects, let's just use closures instead... Basic note handling. Fixes to the midi file modules so the output is now valid. Other fixes to appease the Rust Gods. Current converter handles no IT effects (except timing effects like Axx, Bxx, Cxx, SBx and SEx, as those are handled as a part of the player). But this is a start. --- src/utils.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/utils.rs') diff --git a/src/utils.rs b/src/utils.rs index 0dc91f7..cbe9716 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -1,5 +1,6 @@ use std::ops::*; +#[derive(Copy, Clone)] pub struct Rational { n: i64, @@ -77,6 +78,6 @@ impl Rational let c = gcd(self.n, self.d); Rational{n: self.n / c, d: self.d / c} } - fn as_int_trunc(self) -> i64 {self.n / self.d} - fn as_int_round(self) -> i64 {(self.n as f64 / self.d as f64).round() as i64} + pub fn as_int_trunc(self) -> i64 {self.n / self.d} + pub fn as_int_round(self) -> i64 {(self.n as f64 / self.d as f64).round() as i64} } -- cgit v1.2.3