From 8bbfc9e51359f0ad16968819bb1f0a9f0a22d408 Mon Sep 17 00:00:00 2001 From: Johannes Schultz Date: Wed, 27 Nov 2024 22:18:46 +0000 Subject: [PATCH] [Imp] Enable the "hide volume column for MOD" feature for other imported formats that don't have a volume column, and it is also not used for importing other effects. git-svn-id: https://source.openmpt.org/svn/openmpt/trunk/OpenMPT@22328 56274372-70c3-4bfc-bfc3-4c3a0b034d27 --- mptrack/View_pat.cpp | 2 +- soundlib/Load_fmt.cpp | 2 +- soundlib/Load_ftm.cpp | 2 +- soundlib/Load_gmc.cpp | 2 +- soundlib/Load_ice.cpp | 2 +- soundlib/Load_ims.cpp | 2 +- soundlib/Load_kris.cpp | 2 +- soundlib/Load_mo3.cpp | 2 ++ soundlib/Load_mod.cpp | 1 + soundlib/Load_mus_km.cpp | 2 +- soundlib/Load_stk.cpp | 2 +- soundlib/Load_unic.cpp | 2 +- soundlib/Snd_defs.h | 1 + soundlib/Sndfile.cpp | 4 ++-- soundlib/mod_specifications.cpp | 2 +- 15 files changed, 17 insertions(+), 13 deletions(-) diff --git a/mptrack/View_pat.cpp b/mptrack/View_pat.cpp index 094850a8835..1a1d4719934 100644 --- a/mptrack/View_pat.cpp +++ b/mptrack/View_pat.cpp @@ -198,7 +198,7 @@ void CViewPattern::OnInitialUpdate() m_visibleColumns.set(); CModDoc *modDoc = GetDocument(); - if(modDoc->GetModType() == MOD_TYPE_MOD && !modDoc->GetSoundFile().m_SongFlags[SONG_IMPORTED] && TrackerSettings::Instance().autoHideVolumeColumnForMOD) + if(modDoc->GetSoundFile().m_SongFlags[SONG_FORMAT_NO_VOLCOL] && TrackerSettings::Instance().autoHideVolumeColumnForMOD) m_visibleColumns.reset(PatternCursor::volumeColumn); } diff --git a/soundlib/Load_fmt.cpp b/soundlib/Load_fmt.cpp index 1d803d7187f..09e4a9f89f9 100644 --- a/soundlib/Load_fmt.cpp +++ b/soundlib/Load_fmt.cpp @@ -89,7 +89,7 @@ bool CSoundFile::ReadFMT(FileReader &file, ModLoadingFlags loadFlags) m_nSamples = 8; Order().SetDefaultTempo(TEMPO(45.5)); // 18.2 Hz timer m_playBehaviour.set(kOPLNoteStopWith0Hz); - m_SongFlags.set(SONG_IMPORTED); + m_SongFlags.set(SONG_IMPORTED | SONG_FORMAT_NO_VOLCOL); m_songName = mpt::String::ReadBuf(mpt::String::maybeNullTerminated, fileHeader.songName); for(CHANNELINDEX chn = 0; chn < 8; chn++) diff --git a/soundlib/Load_ftm.cpp b/soundlib/Load_ftm.cpp index bec4a51dfc6..6484a32c695 100644 --- a/soundlib/Load_ftm.cpp +++ b/soundlib/Load_ftm.cpp @@ -108,7 +108,7 @@ bool CSoundFile::ReadFTM(FileReader &file, ModLoadingFlags loadFlags) ChnSettings[chn].nPan = (chn < 2 || chn > 5) ? 64 : 192; ChnSettings[chn].dwFlags.set(CHN_MUTE, !(fileHeader.muteStatus & (1 << chn))); } - m_SongFlags.set(SONG_LINEARSLIDES | SONG_ISAMIGA | SONG_IMPORTED); + m_SongFlags.set(SONG_LINEARSLIDES | SONG_ISAMIGA | SONG_IMPORTED | SONG_FORMAT_NO_VOLCOL); m_playBehaviour.set(kContinueSampleWithoutInstr); m_playBehaviour.set(kST3NoMutedChannels); m_playBehaviour.set(kApplyUpperPeriodLimit); diff --git a/soundlib/Load_gmc.cpp b/soundlib/Load_gmc.cpp index 14239320888..8677989a473 100644 --- a/soundlib/Load_gmc.cpp +++ b/soundlib/Load_gmc.cpp @@ -115,7 +115,7 @@ bool CSoundFile::ReadGMC(FileReader &file, ModLoadingFlags loadFlags) m_nMinPeriod = 113 * 4; m_nMaxPeriod = 856 * 4; m_nSamplePreAmp = 64; - m_SongFlags.set(SONG_FASTPORTAS); + m_SongFlags.set(SONG_FASTPORTAS | SONG_IMPORTED | SONG_FORMAT_NO_VOLCOL); Order().SetDefaultTempoInt(125); Order().SetDefaultSpeed(6); diff --git a/soundlib/Load_ice.cpp b/soundlib/Load_ice.cpp index 8a4b40fb122..d04facc0c52 100644 --- a/soundlib/Load_ice.cpp +++ b/soundlib/Load_ice.cpp @@ -118,7 +118,7 @@ bool CSoundFile::ReadICE(FileReader &file, ModLoadingFlags loadFlags) m_nMinPeriod = 14 * 4; m_nMaxPeriod = 3424 * 4; m_nSamplePreAmp = 64; - m_SongFlags.set(SONG_PT_MODE | SONG_IMPORTED); + m_SongFlags.set(SONG_PT_MODE | SONG_IMPORTED | SONG_FORMAT_NO_VOLCOL); m_playBehaviour.reset(kMODOneShotLoops); m_playBehaviour.set(kMODIgnorePanning); m_playBehaviour.set(kMODSampleSwap); // untested diff --git a/soundlib/Load_ims.cpp b/soundlib/Load_ims.cpp index b8b5593d758..b7930bf36f7 100644 --- a/soundlib/Load_ims.cpp +++ b/soundlib/Load_ims.cpp @@ -90,7 +90,7 @@ bool CSoundFile::ReadIMS(FileReader &file, ModLoadingFlags loadFlags) return true; InitializeGlobals(MOD_TYPE_MOD, 4); - m_SongFlags.set(SONG_IMPORTED); + m_SongFlags.set(SONG_IMPORTED | SONG_FORMAT_NO_VOLCOL); Order().SetDefaultTempoInt(125); Order().SetDefaultSpeed(6); Order().SetRestartPos(fileHeader.order.restartPos); diff --git a/soundlib/Load_kris.cpp b/soundlib/Load_kris.cpp index 414bbc40d94..6618d78a135 100644 --- a/soundlib/Load_kris.cpp +++ b/soundlib/Load_kris.cpp @@ -98,7 +98,7 @@ bool CSoundFile::ReadKRIS(FileReader &file, ModLoadingFlags loadFlags) m_nMinPeriod = 113 * 4; m_nMaxPeriod = 856 * 4; m_nSamplePreAmp = 64; - m_SongFlags.set(SONG_PT_MODE | SONG_IMPORTED); + m_SongFlags.set(SONG_PT_MODE | SONG_IMPORTED | SONG_FORMAT_NO_VOLCOL); m_playBehaviour.set(kMODIgnorePanning); m_playBehaviour.set(kMODSampleSwap); diff --git a/soundlib/Load_mo3.cpp b/soundlib/Load_mo3.cpp index 15df3a9980a..c5eae4607c4 100644 --- a/soundlib/Load_mo3.cpp +++ b/soundlib/Load_mo3.cpp @@ -926,6 +926,8 @@ bool CSoundFile::ReadMO3(FileReader &file, ModLoadingFlags loadFlags) m_nDefaultGlobalVolume = std::min(fileHeader.globalVol.get(), uint8(128)) * 2; else if(m_nType == MOD_TYPE_S3M) m_nDefaultGlobalVolume = std::min(fileHeader.globalVol.get(), uint8(64)) * 4; + else if(m_nType == MOD_TYPE_MOD) + m_SongFlags.set(SONG_FORMAT_NO_VOLCOL); if(fileHeader.sampleVolume < 0) m_nSamplePreAmp = fileHeader.sampleVolume + 52; diff --git a/soundlib/Load_mod.cpp b/soundlib/Load_mod.cpp index 935bdba43fd..81defed01e9 100644 --- a/soundlib/Load_mod.cpp +++ b/soundlib/Load_mod.cpp @@ -298,6 +298,7 @@ bool CSoundFile::ReadMOD(FileReader &file, ModLoadingFlags loadFlags) } InitializeGlobals(MOD_TYPE_MOD, modMagicResult.numChannels); + m_SongFlags.set(SONG_FORMAT_NO_VOLCOL); bool isNoiseTracker = modMagicResult.isNoiseTracker; bool isStartrekker = modMagicResult.isStartrekker; diff --git a/soundlib/Load_mus_km.cpp b/soundlib/Load_mus_km.cpp index a6a6461f2d8..9f42afba380 100644 --- a/soundlib/Load_mus_km.cpp +++ b/soundlib/Load_mus_km.cpp @@ -170,7 +170,7 @@ bool CSoundFile::ReadMUS_KM(FileReader &file, ModLoadingFlags loadFlags) return false; InitializeGlobals(MOD_TYPE_MOD, 4); - m_SongFlags = SONG_AMIGALIMITS | SONG_IMPORTED | SONG_ISAMIGA; // Yes, those were not Amiga games but the format fully conforms to Amiga limits, so allow the Amiga Resampler to be used. + m_SongFlags = SONG_AMIGALIMITS | SONG_IMPORTED | SONG_FORMAT_NO_VOLCOL | SONG_ISAMIGA; // Yes, those were not Amiga games but the format fully conforms to Amiga limits, so allow the Amiga Resampler to be used. m_nSamples = 0; static constexpr uint16 MUS_SAMPLE_UNUSED = 255; // Sentinel value to check if a sample needs to be duplicated diff --git a/soundlib/Load_stk.cpp b/soundlib/Load_stk.cpp index 6fb39ccf96d..934f25329f7 100644 --- a/soundlib/Load_stk.cpp +++ b/soundlib/Load_stk.cpp @@ -227,7 +227,7 @@ bool CSoundFile::ReadSTK(FileReader &file, ModLoadingFlags loadFlags) m_nMinPeriod = 113 * 4; m_nMaxPeriod = 856 * 4; m_nSamplePreAmp = 64; - m_SongFlags.set(SONG_PT_MODE | SONG_AUTO_VOLSLIDE_STK); + m_SongFlags.set(SONG_PT_MODE | SONG_FORMAT_NO_VOLCOL | SONG_AUTO_VOLSLIDE_STK); m_songName = mpt::String::ReadBuf(mpt::String::spacePadded, fileHeaders.songname); // Setup channel pan positions and volume diff --git a/soundlib/Load_unic.cpp b/soundlib/Load_unic.cpp index 66a56acf943..cd515473c0a 100644 --- a/soundlib/Load_unic.cpp +++ b/soundlib/Load_unic.cpp @@ -237,7 +237,7 @@ bool CSoundFile::ReadUNIC(FileReader &file, ModLoadingFlags loadFlags) m_nMinPeriod = 113 * 4; m_nMaxPeriod = 856 * 4; m_nSamplePreAmp = 64; - m_SongFlags.set(SONG_PT_MODE | SONG_IMPORTED); + m_SongFlags.set(SONG_PT_MODE | SONG_IMPORTED | SONG_FORMAT_NO_VOLCOL); m_playBehaviour.reset(kMODOneShotLoops); m_playBehaviour.set(kMODIgnorePanning); m_playBehaviour.set(kMODSampleSwap); // untested diff --git a/soundlib/Snd_defs.h b/soundlib/Snd_defs.h index be027ce3a3d..5b0bfd803d9 100644 --- a/soundlib/Snd_defs.h +++ b/soundlib/Snd_defs.h @@ -305,6 +305,7 @@ enum SongFlags SONG_AUTO_VIBRATO = 0x8000, // Vibrato command is continued automatically SONG_AUTO_TREMOLO = 0x1'8000, // Tremolo command is continued automatically SONG_AUTO_VOLSLIDE_STK = 0x2'0000, // Automatic volume slide command is interpreted like in STK files (rather than like in STP files) + SONG_FORMAT_NO_VOLCOL = 0x4'0000, // The original (imported) format has no volume column, so it can be hidden in the pattern editor. }; DECLARE_FLAGSET(SongFlags) diff --git a/soundlib/Sndfile.cpp b/soundlib/Sndfile.cpp index 9057670fb8a..f9050b14b91 100644 --- a/soundlib/Sndfile.cpp +++ b/soundlib/Sndfile.cpp @@ -225,9 +225,9 @@ void CSoundFile::InitializeGlobals(MODTYPE type, CHANNELINDEX numChannels) // Note: we do not use the Amiga resampler for DBM as it's a multichannel format and can make use of higher-quality Amiga soundcards instead of Paula. if(GetType() & (/*MOD_TYPE_DBM | */MOD_TYPE_DIGI | MOD_TYPE_MED | MOD_TYPE_MOD | MOD_TYPE_OKT | MOD_TYPE_SFX | MOD_TYPE_STP)) - { m_SongFlags.set(SONG_ISAMIGA); - } + if(GetType() & (MOD_TYPE_AMF0 | MOD_TYPE_DIGI | MOD_TYPE_MTM)) + m_SongFlags.set(SONG_FORMAT_NO_VOLCOL); ChnSettings.assign(numChannels, {}); } diff --git a/soundlib/mod_specifications.cpp b/soundlib/mod_specifications.cpp index a9edbeefdd0..d90b4c1d5f3 100644 --- a/soundlib/mod_specifications.cpp +++ b/soundlib/mod_specifications.cpp @@ -97,7 +97,7 @@ constexpr CModSpecifications mod_ = 31, // SamplesMax 0, // instrumentMax MixLevels::Compatible, // defaultMixLevels - SONG_PT_MODE | SONG_AMIGALIMITS | SONG_ISAMIGA, // Supported song flags + SONG_PT_MODE | SONG_AMIGALIMITS | SONG_ISAMIGA | SONG_FORMAT_NO_VOLCOL, // Supported song flags 0, // Max MIDI mapping directives 0, // No instrument envelopes false, // No notecut.