From 103dfd52db82a9d8258998fa853f7cb02d43a277 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sun, 20 Oct 2024 22:39:55 +0000 Subject: [PATCH 1/3] Update Rust crate xmrs to v0.8.5 --- tracker/agb-xm-core/Cargo.toml | 2 +- tracker/agb-xm/Cargo.toml | 2 +- tracker/desktop-player/Cargo.toml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tracker/agb-xm-core/Cargo.toml b/tracker/agb-xm-core/Cargo.toml index 15e27bf1..d4e806d8 100644 --- a/tracker/agb-xm-core/Cargo.toml +++ b/tracker/agb-xm-core/Cargo.toml @@ -16,4 +16,4 @@ syn = "2" agb_tracker_interop = { version = "0.21.1", path = "../agb-tracker-interop", default-features = false } agb_fixnum = { version = "0.21.1", path = "../../agb-fixnum" } -xmrs = { version = "=0.8.1", features = ["std", "import"] } +xmrs = { version = "=0.8.5", features = ["std", "import"] } diff --git a/tracker/agb-xm/Cargo.toml b/tracker/agb-xm/Cargo.toml index c26088ee..81de4854 100644 --- a/tracker/agb-xm/Cargo.toml +++ b/tracker/agb-xm/Cargo.toml @@ -19,4 +19,4 @@ proc-macro2 = "1" quote = "1" syn = "2" -xmrs = "=0.8.1" +xmrs = "=0.8.5" diff --git a/tracker/desktop-player/Cargo.toml b/tracker/desktop-player/Cargo.toml index 96178207..0a46bfd6 100644 --- a/tracker/desktop-player/Cargo.toml +++ b/tracker/desktop-player/Cargo.toml @@ -13,6 +13,6 @@ agb_tracker = { version = "0.21.1", path = "../agb-tracker", default-features = agb_fixnum = { version = "0.21.1", path = "../../agb-fixnum" } anyhow = "1" -xmrs = "=0.8.1" +xmrs = "=0.8.5" cpal = "0.15" From 3be63230ded5075754575f3aee78912171fc8564 Mon Sep 17 00:00:00 2001 From: Gwilym Inzani Date: Wed, 6 Nov 2024 09:51:15 +0000 Subject: [PATCH 2/3] Get it all compiling again --- tracker/agb-xm-core/src/lib.rs | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/tracker/agb-xm-core/src/lib.rs b/tracker/agb-xm-core/src/lib.rs index 8122c4fb..ba3b399a 100644 --- a/tracker/agb-xm-core/src/lib.rs +++ b/tracker/agb-xm-core/src/lib.rs @@ -63,16 +63,17 @@ pub fn parse_module(module: &Module) -> agb_tracker_interop::Track { let volume = Num::from_f32(sample.volume); let sample = match &sample.data { - SampleDataType::Depth8(depth8) => depth8 + SampleDataType::Mono8(depth8) => depth8 .iter() .map(|value| *value as u8) .take(sample_len) .collect::>(), - SampleDataType::Depth16(depth16) => depth16 + SampleDataType::Mono16(depth16) => depth16 .iter() .map(|sample| (sample >> 8) as i8 as u8) .take(sample_len) .collect::>(), + _ => panic!("Stereo samples not supported"), }; let fadeout = Num::from_f32(instrument.volume_fadeout); @@ -691,23 +692,23 @@ impl EnvelopeData { } let sustain = if e.sustain_enabled { - Some( - Self::envelope_frame_to_gba_frame(e.point[e.sustain_point as usize].frame, bpm) - as usize, - ) + Some(Self::envelope_frame_to_gba_frame( + e.point[e.sustain_point].frame, + bpm, + )) } else { None }; let (loop_start, loop_end) = if e.loop_enabled { ( Some(Self::envelope_frame_to_gba_frame( - e.point[e.loop_start_point as usize].frame, + e.point[e.loop_start_point].frame, bpm, - ) as usize), + )), Some(Self::envelope_frame_to_gba_frame( - e.point[e.loop_end_point as usize].frame, + e.point[e.loop_end_point].frame, bpm, - ) as usize), + )), ) } else { (None, None) @@ -748,13 +749,13 @@ impl EnvelopeData { } } - fn envelope_frame_to_gba_frame(envelope_frame: u16, bpm: u32) -> u16 { + fn envelope_frame_to_gba_frame(envelope_frame: usize, bpm: u32) -> usize { // FT2 manual says number of ticks / second = BPM * 0.4 // somehow this works as a good approximation :/ - (envelope_frame as u32 * 250 / bpm) as u16 + (envelope_frame as u32 * 250 / bpm) as usize } - fn gba_frame_to_envelope_frame(gba_frame: u16, bpm: u32) -> u16 { - (gba_frame as u32 * bpm / 250) as u16 + fn gba_frame_to_envelope_frame(gba_frame: usize, bpm: u32) -> usize { + (gba_frame as u32 * bpm / 250) as usize } } From 0333a631f89cc1ebd79ce0119d44d6616cb59a37 Mon Sep 17 00:00:00 2001 From: Gwilym Inzani Date: Wed, 6 Nov 2024 09:59:34 +0000 Subject: [PATCH 3/3] Don't divide by 64 any more --- tracker/agb-xm-core/src/lib.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tracker/agb-xm-core/src/lib.rs b/tracker/agb-xm-core/src/lib.rs index ba3b399a..c7117b83 100644 --- a/tracker/agb-xm-core/src/lib.rs +++ b/tracker/agb-xm-core/src/lib.rs @@ -653,7 +653,7 @@ static AMIGA_FREQUENCIES: &[u32] = &[ 457, ]; -#[derive(PartialEq, Eq, Hash, Clone)] +#[derive(PartialEq, Eq, Hash, Clone, Debug)] struct EnvelopeData { amounts: Vec>, sustain: Option, @@ -685,7 +685,7 @@ impl EnvelopeData { let first_point = &e.point[index]; let second_point = &e.point[index + 1]; - let amount = EnvelopePoint::lerp(first_point, second_point, xm_frame) / 64.0; + let amount = EnvelopePoint::lerp(first_point, second_point, xm_frame); let amount = Num::from_f32(amount); amounts.push(amount);