Skip to content

Commit

Permalink
[Imp] When creating a new MOD file, it is now possible to specifiy wh…
Browse files Browse the repository at this point in the history
…ether it should be an Amiga MOD (4 channels, enable PT quirks and Amiga resampler) or a PC MOD (8 channels, disable PT quirks and Amiga resampler). Fixes https://bugs.openmpt.org/view.php?id=1830

git-svn-id: https://source.openmpt.org/svn/openmpt/trunk/OpenMPT@22141 56274372-70c3-4bfc-bfc3-4c3a0b034d27
  • Loading branch information
sagamusix committed Nov 10, 2024
1 parent b392ffc commit 90055c0
Show file tree
Hide file tree
Showing 8 changed files with 43 additions and 15 deletions.
5 changes: 3 additions & 2 deletions mptrack/GeneralConfigDlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,13 +95,14 @@ BOOL COptionsGeneral::OnInitDialog()

m_defaultArtist.SetWindowText(mpt::ToCString(TrackerSettings::Instance().defaultArtist.Get()));

const struct
static constexpr struct
{
MODTYPE type;
const TCHAR *str;
} formats[] =
{
{ MOD_TYPE_MOD, _T("MOD") },
{ MOD_TYPE_MOD, _T("MOD (Amiga)") },
{ MOD_TYPE_MOD_PC, _T("MOD (PC)")},
{ MOD_TYPE_XM, _T("XM") },
{ MOD_TYPE_S3M, _T("S3M") },
{ MOD_TYPE_IT, _T("IT") },
Expand Down
15 changes: 15 additions & 0 deletions mptrack/Moddoc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -625,6 +625,10 @@ void CModDoc::InitializeMod()
case MOD_TYPE_MOD:
m_SndFile.ChnSettings.resize(4);
break;
case MOD_TYPE_MOD_PC:
m_SndFile.ChangeModTypeTo(MOD_TYPE_MOD);
m_SndFile.ChnSettings.resize(8);
break;
case MOD_TYPE_S3M:
m_SndFile.ChnSettings.resize(16);
break;
Expand Down Expand Up @@ -661,6 +665,17 @@ void CModDoc::InitializeMod()
m_SndFile.m_nSamplePreAmp = m_SndFile.m_nVSTiVolume = 48;
// Setup LRRL panning scheme for MODs
m_SndFile.SetupMODPanning();

if(GetModType() == MOD_TYPE_MOD)
{
const bool isAmiga = GetNumChannels() == 4;
m_SndFile.m_SongFlags.set(SONG_ISAMIGA | SONG_AMIGALIMITS | SONG_PT_MODE, isAmiga);
m_SndFile.m_playBehaviour.set(kMODOneShotLoops, isAmiga);
m_SndFile.m_playBehaviour.set(kMODSampleSwap, isAmiga);
m_SndFile.m_playBehaviour.set(kMODOutOfRangeNoteDelay, isAmiga);
m_SndFile.m_playBehaviour.set(kMODTempoOnSecondTick, isAmiga);
m_SndFile.m_playBehaviour.set(kFT2MODTremoloRampWaveform);
}
}
if (!m_SndFile.m_nSamples)
{
Expand Down
19 changes: 10 additions & 9 deletions mptrack/Mptrack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -620,15 +620,16 @@ MODTYPE CTrackApp::m_nDefaultDocType = MOD_TYPE_IT;

BEGIN_MESSAGE_MAP(CTrackApp, CWinApp)
//{{AFX_MSG_MAP(CTrackApp)
ON_COMMAND(ID_FILE_NEW, &CTrackApp::OnFileNew)
ON_COMMAND(ID_FILE_NEWMOD, &CTrackApp::OnFileNewMOD)
ON_COMMAND(ID_FILE_NEWS3M, &CTrackApp::OnFileNewS3M)
ON_COMMAND(ID_FILE_NEWXM, &CTrackApp::OnFileNewXM)
ON_COMMAND(ID_FILE_NEWIT, &CTrackApp::OnFileNewIT)
ON_COMMAND(ID_NEW_MPT, &CTrackApp::OnFileNewMPT)
ON_COMMAND(ID_FILE_OPEN, &CTrackApp::OnFileOpen)
ON_COMMAND(ID_FILE_CLOSEALL, &CTrackApp::OnFileCloseAll)
ON_COMMAND(ID_APP_ABOUT, &CTrackApp::OnAppAbout)
ON_COMMAND(ID_FILE_NEW, &CTrackApp::OnFileNew)
ON_COMMAND(ID_FILE_NEWMOD, &CTrackApp::OnFileNewMOD_Amiga)
ON_COMMAND(ID_FILE_NEWMOD_PC, &CTrackApp::OnFileNewMOD_PC)
ON_COMMAND(ID_FILE_NEWS3M, &CTrackApp::OnFileNewS3M)
ON_COMMAND(ID_FILE_NEWXM, &CTrackApp::OnFileNewXM)
ON_COMMAND(ID_FILE_NEWIT, &CTrackApp::OnFileNewIT)
ON_COMMAND(ID_NEW_MPT, &CTrackApp::OnFileNewMPT)
ON_COMMAND(ID_FILE_OPEN, &CTrackApp::OnFileOpen)
ON_COMMAND(ID_FILE_CLOSEALL, &CTrackApp::OnFileCloseAll)
ON_COMMAND(ID_APP_ABOUT, &CTrackApp::OnAppAbout)
ON_UPDATE_COMMAND_UI(ID_FILE_CLOSEALL, &CTrackApp::OnUpdateAnyDocsOpen)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
Expand Down
3 changes: 2 additions & 1 deletion mptrack/Mptrack.h
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,8 @@ class CTrackApp : public CWinApp
CModDoc *NewDocument(MODTYPE newType = MOD_TYPE_NONE);

afx_msg void OnFileNew() { NewDocument(); }
afx_msg void OnFileNewMOD() { NewDocument(MOD_TYPE_MOD); }
afx_msg void OnFileNewMOD_Amiga() { NewDocument(MOD_TYPE_MOD); }
afx_msg void OnFileNewMOD_PC() { NewDocument(MOD_TYPE_MOD_PC); }
afx_msg void OnFileNewS3M() { NewDocument(MOD_TYPE_S3M); }
afx_msg void OnFileNewXM() { NewDocument(MOD_TYPE_XM); }
afx_msg void OnFileNewIT() { NewDocument(MOD_TYPE_IT); }
Expand Down
10 changes: 8 additions & 2 deletions mptrack/TrackerSettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,18 @@ static Version GetPreviousSettingsVersion(const mpt::ustring &iniVersion)

mpt::ustring SettingsModTypeToString(MODTYPE modtype)
{
return CSoundFile::GetModSpecifications(modtype).GetFileExtension();
if(modtype == MOD_TYPE_MOD_PC)
return UL_("mod-pc");
else
return CSoundFile::GetModSpecifications(modtype).GetFileExtension();
}

MODTYPE SettingsStringToModType(const mpt::ustring &str)
{
return CModSpecifications::ExtensionToType(str);
if(str == UL_("mod-pc"))
return MOD_TYPE_MOD_PC;
else
return CModSpecifications::ExtensionToType(str);
}


Expand Down
3 changes: 2 additions & 1 deletion mptrack/mptrack.rc
Original file line number Diff line number Diff line change
Expand Up @@ -2778,7 +2778,8 @@ BEGIN
MENUITEM "&IT", ID_FILE_NEWIT
MENUITEM "&XM", ID_FILE_NEWXM
MENUITEM "&S3M", ID_FILE_NEWS3M
MENUITEM "M&OD", ID_FILE_NEWMOD
MENUITEM "M&OD (Amiga)", ID_FILE_NEWMOD
MENUITEM "MOD (&PC)", ID_FILE_NEWMOD_PC
MENUITEM "Open&MPT Module", ID_NEW_MPT
END
MENUITEM "&Open...\tCtrl+O", ID_FILE_OPEN
Expand Down
1 change: 1 addition & 0 deletions mptrack/resource.h
Original file line number Diff line number Diff line change
Expand Up @@ -1148,6 +1148,7 @@
// From here: Command range [ID_PLUGSELECT, ID_PLUGSELECT + MAX_MIXPLUGINS]
#define ID_VSTMACRO_INFO 36002
#define ID_VSTINPUT_INFO 36003
#define ID_FILE_NEWMOD_PC 36004
#define ID_APPROX_BPM 36007
#define ID_FACTORY_MENU 36008
#define ID_PLUG_BYPASS 36009
Expand Down
2 changes: 2 additions & 0 deletions soundlib/Snd_defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@ enum MODTYPE
MOD_TYPE_STP = 0x8000000,
MOD_TYPE_PLM = 0x10000000,
MOD_TYPE_SFX = 0x20000000,

MOD_TYPE_MOD_PC = MOD_TYPE_MOD | MOD_TYPE_XM,
};
DECLARE_FLAGSET(MODTYPE)

Expand Down

0 comments on commit 90055c0

Please sign in to comment.