From: <sv...@op...> - 2024-11-02 21:12:05
|
Author: sagamusix Date: Sat Nov 2 22:11:52 2024 New Revision: 22090 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=22090 Log: [Fix] MED: Fix correct octave transposition in some MED files that have hardware mixing disabled but sample transpose enabled; hopefully doesn't break anything else. Fixes Journey.med (https://www.un4seen.com/forum/?topic=15448.msg143713#msg143713). Modified: trunk/OpenMPT/soundlib/Load_med.cpp Modified: trunk/OpenMPT/soundlib/Load_med.cpp ============================================================================== --- trunk/OpenMPT/soundlib/Load_med.cpp Sat Nov 2 18:02:13 2024 (r22089) +++ trunk/OpenMPT/soundlib/Load_med.cpp Sat Nov 2 22:11:52 2024 (r22090) @@ -625,7 +625,7 @@ param1 = param; } // Octave wrapping for 4-channel modules - if(ctx.hardwareMixSamples && note >= NOTE_MIDDLEC + 2 * 12) + if(note >= NOTE_MIDDLEC + 2 * 12) needInstruments = true; if(note >= NOTE_MIN && note <= NOTE_MAX) @@ -1055,13 +1055,14 @@ { needInstruments = true; instr.Transpose(-24); - } else if(!isSynth && hardwareMixSamples) + } else if(!isSynth && (hardwareMixSamples || sampleHeader.sampleTranspose)) { + int offset = NOTE_MIDDLEC + (hardwareMixSamples ? 24 : 36); for(auto ¬e : instr.NoteMap) { int realNote = note + sampleHeader.sampleTranspose; - if(realNote >= NOTE_MIDDLEC + 24) - note -= static_cast<uint8>(mpt::align_down(realNote - NOTE_MIDDLEC - 12, 12)); + if(realNote >= offset) + note -= static_cast<uint8>(mpt::align_down(realNote - offset + 12, 12)); } } |