diff --git a/tracker/agb-tracker-interop/src/lib.rs b/tracker/agb-tracker-interop/src/lib.rs index 8e958f5d..565c1d89 100644 --- a/tracker/agb-tracker-interop/src/lib.rs +++ b/tracker/agb-tracker-interop/src/lib.rs @@ -51,7 +51,7 @@ pub struct Envelope { pub loop_end: Option, pub vib_waveform: Waveform, - pub vib_amount: Num, + pub vib_amount: Num, pub vib_speed: u8, } diff --git a/tracker/agb-xm-core/src/lib.rs b/tracker/agb-xm-core/src/lib.rs index 53fb75c7..9298361d 100644 --- a/tracker/agb-xm-core/src/lib.rs +++ b/tracker/agb-xm-core/src/lib.rs @@ -553,7 +553,7 @@ struct EnvelopeData { vib_waveform: Waveform, vib_speed: u8, - vib_amount: Num, + vib_amount: Num, } impl EnvelopeData { @@ -616,8 +616,17 @@ impl EnvelopeData { let vib_depth = instrument.vibrato.depth * 16.0; let c4_speed = note_to_speed(Note::C4, 0.0, 0, frequency_type); - let vib_amount = - note_to_speed(Note::C4, vib_depth.into(), 0, frequency_type) / c4_speed - 1; + let mut vib_amount = + (note_to_speed(Note::C4, vib_depth.into(), 0, frequency_type) / c4_speed - 1) + .try_change_base() + .unwrap(); + + if matches!( + instrument.vibrato.waveform, + xmrs::instr_vibrato::Waveform::RampDown + ) { + vib_amount = -vib_amount; + } EnvelopeData { amounts,