From: <sv...@op...> - 2024-06-26 21:38:03
|
Author: sagamusix Date: Wed Jun 26 23:37:50 2024 New Revision: 21084 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=21084 Log: [Imp] Add parameters for changing sample play direction to volume column Play Control command. These can be used as a backup when there's not enough space to import all commands from non-native formats. Improves playback of "Are You Flying with Me?" by Jazzcat. Modified: trunk/OpenMPT/soundlib/ModChannel.cpp trunk/OpenMPT/soundlib/ModChannel.h trunk/OpenMPT/soundlib/Snd_fx.cpp trunk/OpenMPT/soundlib/modcommand.cpp Modified: trunk/OpenMPT/soundlib/ModChannel.cpp ============================================================================== --- trunk/OpenMPT/soundlib/ModChannel.cpp Tue Jun 25 23:35:15 2024 (r21083) +++ trunk/OpenMPT/soundlib/ModChannel.cpp Wed Jun 26 23:37:50 2024 (r21084) @@ -249,4 +249,18 @@ } +// Volume command :xx +void ModChannel::PlayControl(uint8 param) +{ + switch(param) + { + case 0: isPaused = true; break; + case 1: isPaused = false; break; + case 2: dwFlags.set(CHN_PINGPONGFLAG, false); break; + case 3: dwFlags.set(CHN_PINGPONGFLAG, true); break; + case 4: dwFlags.flip(CHN_PINGPONGFLAG); break; + } +} + + OPENMPT_NAMESPACE_END Modified: trunk/OpenMPT/soundlib/ModChannel.h ============================================================================== --- trunk/OpenMPT/soundlib/ModChannel.h Tue Jun 25 23:35:15 2024 (r21083) +++ trunk/OpenMPT/soundlib/ModChannel.h Wed Jun 26 23:37:50 2024 (r21084) @@ -230,6 +230,8 @@ // IT command S73-S7E void InstrumentControl(uint8 param, const CSoundFile &sndFile); + // Volume command :xx + void PlayControl(uint8 param); int32 GetMIDIPitchBend() const noexcept { return (static_cast<int32>(microTuning) + 0x8000) / 4; } void SetMIDIPitchBend(const uint8 high, const uint8 low) noexcept Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp ============================================================================== --- trunk/OpenMPT/soundlib/Snd_fx.cpp Tue Jun 25 23:35:15 2024 (r21083) +++ trunk/OpenMPT/soundlib/Snd_fx.cpp Wed Jun 26 23:37:50 2024 (r21084) @@ -1304,8 +1304,9 @@ } break; case VOLCMD_PLAYCONTROL: - if(m.vol <= 1) - chn.isPaused = (m.vol == 0); + if(m.vol >= 2 && m.vol <= 4) + memory.RenderChannel(nChn, oldTickDuration); // Re-sync what we've got so far + chn.PlayControl(m.vol); break; default: break; @@ -3261,8 +3262,7 @@ break; case VOLCMD_PLAYCONTROL: - if(vol <= 1) - chn.isPaused = (vol == 0); + chn.PlayControl(vol); break; default: Modified: trunk/OpenMPT/soundlib/modcommand.cpp ============================================================================== --- trunk/OpenMPT/soundlib/modcommand.cpp Tue Jun 25 23:35:15 2024 (r21083) +++ trunk/OpenMPT/soundlib/modcommand.cpp Wed Jun 26 23:37:50 2024 (r21084) @@ -1300,22 +1300,26 @@ return {VOLCMD_FINEVOLDOWN, static_cast<VOL>(param & 0x0F)}; break; case CMD_S3MCMDEX: - switch(param >> 4) + switch(param & 0xF0) { - case 0x08: + case 0x80: return {VOLCMD_PANNING, static_cast<VOL>(((param & 0x0F) << 2) + 2)}; + case 0x90: + if(param >= 0x9E && force) + return {VOLCMD_PLAYCONTROL, static_cast<VOL>(param - 0x9E + 2)}; + break; default: break; } break; case CMD_MODCMDEX: - switch(param >> 4) + switch(param & 0xF0) { - case 0x08: + case 0x80: return {VOLCMD_PANNING, static_cast<VOL>(((param & 0x0F) << 2) + 2)}; - case 0x0A: + case 0xA0: return {VOLCMD_FINEVOLUP, static_cast<VOL>(param & 0x0F)}; - case 0x0B: + case 0xB0: return {VOLCMD_FINEVOLDOWN, static_cast<VOL>(param & 0x0F)}; default: break; |