From 8459028858ca81a71de98850931d38e19108395e Mon Sep 17 00:00:00 2001 From: ashley Date: Sat, 26 Aug 2023 22:07:56 -0400 Subject: [PATCH] octave shifts that may or may not be needed for all dmf files --- src/reskit/soundtrack/formats/dmf.rs | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/src/reskit/soundtrack/formats/dmf.rs b/src/reskit/soundtrack/formats/dmf.rs index ff72b6c..1c71a6f 100644 --- a/src/reskit/soundtrack/formats/dmf.rs +++ b/src/reskit/soundtrack/formats/dmf.rs @@ -469,18 +469,21 @@ impl DmfModule { Some( match note { 100 => Note::NoteOff, - 1 => Note::CSharp( octave ), - 2 => Note::D( octave ), - 3 => Note::DSharp( octave ), - 4 => Note::E( octave ), - 5 => Note::F( octave ), - 6 => Note::FSharp( octave ), - 7 => Note::G( octave ), - 8 => Note::GSharp( octave ), - 9 => Note::A( octave ), - 10 => Note::ASharp( octave ), - 11 => Note::B( octave ), - 12 => Note::C( octave + 1 ), // deflemask y u shift the octave down 1 for C?? + // check: do these octave shifts make sense for all dmf modules? + // they were needed on the test dmf but no documentation supports it + // test dmf sounds off key otherwise... + 1 => Note::CSharp( if channel > 5 { octave - 1 } else { octave } ), + 2 => Note::D( if channel > 5 { octave - 1 } else { octave } ), + 3 => Note::DSharp( if channel > 5 { octave - 1 } else { octave } ), + 4 => Note::E( if channel > 5 { octave - 1 } else { octave } ), + 5 => Note::F( if channel > 5 { octave - 1 } else { octave } ), + 6 => Note::FSharp( if channel > 5 { octave - 1 } else { octave } ), + 7 => Note::G( if channel > 5 { octave - 1 } else { octave } ), + 8 => Note::GSharp( if channel > 5 { octave - 1 } else { octave } ), + 9 => Note::A( if channel > 5 { octave - 1 } else { octave } ), + 10 => Note::ASharp( if channel > 5 { octave - 1 } else { octave } ), + 11 => Note::B( if channel > 5 { octave - 1 } else { octave } ), + 12 => Note::C( if channel > 5 { octave } else { octave + 1 } ), // deflemask y u shift the octave down 1 for C?? _ => return Err( format!( "invalid file: invalid note id {}", note ) )? } )