mirror of
https://github.com/italicsjenga/agb.git
synced 2024-12-23 00:01:34 +11:00
Handle RampDown
This commit is contained in:
parent
3bd8b9019d
commit
8fa595f7f7
|
@ -51,7 +51,7 @@ pub struct Envelope {
|
|||
pub loop_end: Option<usize>,
|
||||
|
||||
pub vib_waveform: Waveform,
|
||||
pub vib_amount: Num<u16, 12>,
|
||||
pub vib_amount: Num<i16, 12>,
|
||||
pub vib_speed: u8,
|
||||
}
|
||||
|
||||
|
|
|
@ -553,7 +553,7 @@ struct EnvelopeData {
|
|||
|
||||
vib_waveform: Waveform,
|
||||
vib_speed: u8,
|
||||
vib_amount: Num<u32, 12>,
|
||||
vib_amount: Num<i32, 12>,
|
||||
}
|
||||
|
||||
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,
|
||||
|
|
Loading…
Reference in a new issue