Skip to content

Commit

Permalink
[Imp] Enable the "hide volume column for MOD" feature for other impor…
Browse files Browse the repository at this point in the history
…ted 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
  • Loading branch information
sagamusix committed Nov 27, 2024
1 parent b8cadc4 commit 8bbfc9e
Show file tree
Hide file tree
Showing 15 changed files with 17 additions and 13 deletions.
2 changes: 1 addition & 1 deletion mptrack/View_pat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
2 changes: 1 addition & 1 deletion soundlib/Load_fmt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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++)
Expand Down
2 changes: 1 addition & 1 deletion soundlib/Load_ftm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion soundlib/Load_gmc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion soundlib/Load_ice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion soundlib/Load_ims.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion soundlib/Load_kris.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
2 changes: 2 additions & 0 deletions soundlib/Load_mo3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions soundlib/Load_mod.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion soundlib/Load_mus_km.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion soundlib/Load_stk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion soundlib/Load_unic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions soundlib/Snd_defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
4 changes: 2 additions & 2 deletions soundlib/Sndfile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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, {});
}
Expand Down
2 changes: 1 addition & 1 deletion soundlib/mod_specifications.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 8bbfc9e

Please sign in to comment.