From: <sv...@op...> - 2024-12-06 15:54:56
|
Author: sagamusix Date: Fri Dec 6 16:54:43 2024 New Revision: 22476 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=22476 Log: [Fix] MED: Apply repeating high octaves to all non-MIDI instruments. (https://www.un4seen.com/forum/?topic=15448.msg144154#msg144154) [Fix] MED: Add special handling for low tempos in BPM mode (https://www.un4seen.com/forum/?topic=15448.msg144160#msg144160). Modified: trunk/OpenMPT/soundlib/Load_med.cpp Modified: trunk/OpenMPT/soundlib/Load_med.cpp ============================================================================== --- trunk/OpenMPT/soundlib/Load_med.cpp Thu Dec 5 10:52:22 2024 (r22475) +++ trunk/OpenMPT/soundlib/Load_med.cpp Fri Dec 6 16:54:43 2024 (r22476) @@ -395,6 +395,10 @@ { if(bpmMode && !is8Ch) { + // Observed in OctaMED 5 and MED SoundStudio 1.03 (bug?) + if(tempo < 7) + return TEMPO(111.5); + // You would have thought that we could use modern tempo mode here. // Alas, the number of ticks per row still influences the tempo. :( return TEMPO((tempo * rowsPerBeat) / 4.0); @@ -654,7 +658,8 @@ if(note >= NOTE_MIDDLEC + 2 * 12) needInstruments = true; - if(note > NOTE_MIN + 131) + // This doesn't happen in MED SoundStudio for Windows... closest we have to be able to identify it is the usage of 7-bit volume + if(note > NOTE_MIN + 131 && !ctx.vol7bit) note -= 108; else if(note > NOTE_MAX) note -= mpt::align_down(note - (NOTE_MAX - 11), 12); @@ -1085,15 +1090,6 @@ { needInstruments = true; instr.Transpose(-24); - } 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 >= offset) - note -= static_cast<uint8>(mpt::align_down(realNote - offset + 12, 12)); - } } // midiChannel = 0xFF == midi instrument but with invalid channel, midiChannel = 0x00 == sample-based instrument? @@ -1125,6 +1121,17 @@ instr.nMidiProgram = sampleHeader.midiPreset; } + if(!instr.nMidiChannel != MidiNoChannel) + { + int offset = NOTE_MIDDLEC + (hardwareMixSamples ? 24 : 36); + for(auto ¬e : instr.NoteMap) + { + int realNote = note + sampleHeader.sampleTranspose; + if(realNote >= offset) + note -= static_cast<uint8>(mpt::align_down(realNote - offset + 12, 12)); + } + } + for(SAMPLEINDEX i = 0; i < numSamples; i++) { ModSample &mptSmp = Samples[smp + i]; |