You can subscribe to this list here.
| 2006 |
Jan
|
Feb
|
Mar
(1) |
Apr
(1) |
May
|
Jun
(1) |
Jul
|
Aug
(10) |
Sep
|
Oct
|
Nov
|
Dec
(3) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2007 |
Jan
(1) |
Feb
(2) |
Mar
(3) |
Apr
(2) |
May
(10) |
Jun
(2) |
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
(3) |
Dec
|
| 2008 |
Jan
(6) |
Feb
(4) |
Mar
(5) |
Apr
(2) |
May
(1) |
Jun
(1) |
Jul
(4) |
Aug
(6) |
Sep
(2) |
Oct
(9) |
Nov
(1) |
Dec
(4) |
| 2009 |
Jan
(9) |
Feb
(2) |
Mar
(2) |
Apr
(2) |
May
(6) |
Jun
(18) |
Jul
(33) |
Aug
(39) |
Sep
(33) |
Oct
(24) |
Nov
(23) |
Dec
(22) |
| 2010 |
Jan
(29) |
Feb
(32) |
Mar
(51) |
Apr
(17) |
May
(31) |
Jun
(21) |
Jul
(32) |
Aug
(28) |
Sep
(35) |
Oct
(27) |
Nov
(11) |
Dec
(13) |
| 2011 |
Jan
(14) |
Feb
(13) |
Mar
(27) |
Apr
(27) |
May
(28) |
Jun
(20) |
Jul
(43) |
Aug
(52) |
Sep
(66) |
Oct
(61) |
Nov
(11) |
Dec
(8) |
| 2012 |
Jan
(20) |
Feb
(30) |
Mar
(38) |
Apr
(21) |
May
(33) |
Jun
(21) |
Jul
(25) |
Aug
(9) |
Sep
(24) |
Oct
(42) |
Nov
(27) |
Dec
(41) |
| 2013 |
Jan
(20) |
Feb
(35) |
Mar
(156) |
Apr
(298) |
May
(258) |
Jun
(201) |
Jul
(105) |
Aug
(60) |
Sep
(193) |
Oct
(245) |
Nov
(280) |
Dec
(194) |
| 2014 |
Jan
(63) |
Feb
(202) |
Mar
(200) |
Apr
(23) |
May
(53) |
Jun
(105) |
Jul
(18) |
Aug
(26) |
Sep
(110) |
Oct
(187) |
Nov
(97) |
Dec
(74) |
| 2015 |
Jan
(45) |
Feb
(55) |
Mar
(116) |
Apr
(116) |
May
(193) |
Jun
(164) |
Jul
(50) |
Aug
(111) |
Sep
(98) |
Oct
(71) |
Nov
(103) |
Dec
(63) |
| 2016 |
Jan
(33) |
Feb
(101) |
Mar
(182) |
Apr
(139) |
May
(140) |
Jun
(103) |
Jul
(165) |
Aug
(286) |
Sep
(208) |
Oct
(127) |
Nov
(97) |
Dec
(54) |
| 2017 |
Jan
(64) |
Feb
(335) |
Mar
(202) |
Apr
(212) |
May
(139) |
Jun
(127) |
Jul
(294) |
Aug
(154) |
Sep
(170) |
Oct
(152) |
Nov
(156) |
Dec
(62) |
| 2018 |
Jan
(168) |
Feb
(237) |
Mar
(196) |
Apr
(174) |
May
(174) |
Jun
(161) |
Jul
(127) |
Aug
(88) |
Sep
(149) |
Oct
(66) |
Nov
(52) |
Dec
(135) |
| 2019 |
Jan
(146) |
Feb
(126) |
Mar
(104) |
Apr
(58) |
May
(60) |
Jun
(28) |
Jul
(197) |
Aug
(129) |
Sep
(141) |
Oct
(148) |
Nov
(63) |
Dec
(100) |
| 2020 |
Jan
(74) |
Feb
(37) |
Mar
(59) |
Apr
(154) |
May
(194) |
Jun
(133) |
Jul
(313) |
Aug
(197) |
Sep
(49) |
Oct
(162) |
Nov
(143) |
Dec
(57) |
| 2021 |
Jan
(120) |
Feb
(107) |
Mar
(314) |
Apr
(157) |
May
(524) |
Jun
(169) |
Jul
(72) |
Aug
(133) |
Sep
(135) |
Oct
(146) |
Nov
(198) |
Dec
(325) |
| 2022 |
Jan
(409) |
Feb
(249) |
Mar
(138) |
Apr
(95) |
May
(102) |
Jun
(221) |
Jul
(66) |
Aug
(120) |
Sep
(192) |
Oct
(131) |
Nov
(53) |
Dec
(171) |
| 2023 |
Jan
(357) |
Feb
(82) |
Mar
(168) |
Apr
(218) |
May
(196) |
Jun
(86) |
Jul
(115) |
Aug
(49) |
Sep
(190) |
Oct
(102) |
Nov
(45) |
Dec
(76) |
| 2024 |
Jan
(86) |
Feb
(50) |
Mar
(324) |
Apr
(209) |
May
(197) |
Jun
(232) |
Jul
(194) |
Aug
(247) |
Sep
(219) |
Oct
(266) |
Nov
(328) |
Dec
(304) |
| 2025 |
Jan
(191) |
Feb
(115) |
Mar
(137) |
Apr
(32) |
May
(126) |
Jun
(403) |
Jul
(213) |
Aug
(203) |
Sep
(148) |
Oct
(109) |
Nov
(191) |
Dec
(209) |
| 2026 |
Jan
(127) |
Feb
(123) |
Mar
(160) |
Apr
(141) |
May
(48) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: <sag...@us...> - 2011-08-01 22:47:51
|
Revision: 954
http://modplug.svn.sourceforge.net/modplug/?rev=954&view=rev
Author: saga-games
Date: 2011-08-01 22:47:44 +0000 (Mon, 01 Aug 2011)
Log Message:
-----------
[Imp] Macros are now sanitized and cleared after first null char before saving them to a module file.
[Imp] When saving a file loaded from a template for the first time, the extension of the proposed filename is not duplicated anymore.
[Ref] Some more related save code refactoring.
Modified Paths:
--------------
trunk/OpenMPT/mptrack/MainFrm.cpp
trunk/OpenMPT/mptrack/Moddoc.cpp
trunk/OpenMPT/soundlib/Sndfile.cpp
Modified: trunk/OpenMPT/mptrack/MainFrm.cpp
===================================================================
--- trunk/OpenMPT/mptrack/MainFrm.cpp 2011-08-01 16:21:19 UTC (rev 953)
+++ trunk/OpenMPT/mptrack/MainFrm.cpp 2011-08-01 22:47:44 UTC (rev 954)
@@ -481,6 +481,9 @@
void CMainFrame::OnClose()
//------------------------
{
+ // TODO: Here we could add a custom dialog that lists all modified files, and the user could select which should be saved.
+ // How do we get all files? Does the document manager help here?
+
CChildFrame *pMDIActive = (CChildFrame *)MDIGetActive();
BeginWaitCursor();
@@ -2177,6 +2180,14 @@
ASSERT(pDoc->IsKindOf(RUNTIME_CLASS(CModDoc)) == TRUE);
CModDoc* pModDoc = static_cast<CModDoc*>(pDoc);
pModDoc->ClearFilePath(); // Clear path so that saving will not take place in templates/examples folder.
+ // Remove extension from title, so that saving the file will not suggest a filename like f.e. "template.mptm.mptm".
+ const CString title = pModDoc->GetTitle();
+ const int dotPos = title.ReverseFind('.');
+ if(dotPos >= 0)
+ {
+ pModDoc->SetTitle(title.Left(dotPos));
+ }
+
if (bTemplateFile)
{
pModDoc->GetFileHistory()->clear(); // Reset edit history for template files
@@ -2362,7 +2373,7 @@
{
case kcViewTree: OnBarCheck(IDD_TREEVIEW); break;
case kcViewOptions: OnViewOptions(); break;
- case kcViewMain: OnBarCheck(59392); break;
+ case kcViewMain: OnBarCheck(59392 /* MAINVIEW */); break;
case kcFileImportMidiLib: OnImportMidiLib(); break;
case kcFileAddSoundBank: OnAddDlsBank(); break;
case kcPauseSong: OnPlayerPause(); break;
Modified: trunk/OpenMPT/mptrack/Moddoc.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Moddoc.cpp 2011-08-01 16:21:19 UTC (rev 953)
+++ trunk/OpenMPT/mptrack/Moddoc.cpp 2011-08-01 22:47:44 UTC (rev 954)
@@ -436,13 +436,11 @@
//--------------------------------------------------------------------------
{
static int greccount = 0;
- TCHAR fext[_MAX_EXT] = _T("");
UINT dwPacking = 0;
BOOL bOk = FALSE;
m_SndFile.m_dwLastSavedWithVersion = MptVersion::num;
if (!lpszPathName)
return FALSE;
- _tsplitpath(lpszPathName, NULL, NULL, NULL, fext);
MODTYPE type = m_SndFile.GetType(); // CModSpecifications::ExtensionToType(fext);
if (type == MOD_TYPE_NONE && !greccount)
@@ -460,17 +458,21 @@
case MOD_TYPE_MOD: bOk = m_SndFile.SaveMod(lpszPathName, dwPacking); break;
case MOD_TYPE_S3M: bOk = m_SndFile.SaveS3M(lpszPathName, dwPacking); break;
case MOD_TYPE_XM: bOk = m_SndFile.SaveXM(lpszPathName, dwPacking); break;
- case MOD_TYPE_IT: bOk = (m_SndFile.m_dwSongFlags & SONG_ITPROJECT || !lstrcmpi(fext, _T(".itp"))) ? m_SndFile.SaveITProject(lpszPathName) : m_SndFile.SaveIT(lpszPathName, dwPacking); break;
+ case MOD_TYPE_IT: bOk = (m_SndFile.m_dwSongFlags & SONG_ITPROJECT) ? m_SndFile.SaveITProject(lpszPathName) : m_SndFile.SaveIT(lpszPathName, dwPacking); break;
case MOD_TYPE_MPT: bOk = m_SndFile.SaveIT(lpszPathName, dwPacking); break;
}
EndWaitCursor();
if (bOk)
{
- if (type == m_SndFile.GetType() && !bTemplateFile)
+ if (!bTemplateFile)
+ {
+ // Set new path for this file, unless we are saving a template, in which case we want to keep the old file path.
SetPathName(lpszPathName);
+ }
ShowLog();
if (bTemplateFile)
{
+ // Update template menu.
CMainFrame* const pMainFrame = CMainFrame::GetMainFrame();
if (pMainFrame)
pMainFrame->CreateTemplateModulesMenu();
@@ -491,7 +493,8 @@
BOOL CModDoc::SaveModified()
//--------------------------
{
- if((m_SndFile.m_nType & MOD_TYPE_IT) && m_SndFile.m_dwSongFlags & SONG_ITPROJECT && !(m_SndFile.m_dwSongFlags & SONG_ITPEMBEDIH)){
+ if((m_SndFile.m_nType & MOD_TYPE_IT) && m_SndFile.m_dwSongFlags & SONG_ITPROJECT && !(m_SndFile.m_dwSongFlags & SONG_ITPEMBEDIH))
+ {
bool unsavedInstrument = false;
@@ -506,8 +509,10 @@
if(unsavedInstrument && ::MessageBox(NULL,"Do you want to save modified instruments?",NULL,MB_ICONQUESTION | MB_YESNO | MB_APPLMODAL) == IDYES){
- for(INSTRUMENTINDEX i = 0 ; i < m_SndFile.m_nInstruments ; i++){
- if(m_SndFile.m_szInstrumentPath[i][0] != '\0'){
+ for(INSTRUMENTINDEX i = 0 ; i < m_SndFile.m_nInstruments ; i++)
+ {
+ if(m_SndFile.m_szInstrumentPath[i][0] != '\0')
+ {
int size = strlen(m_SndFile.m_szInstrumentPath[i]);
bool iti = _stricmp(&m_SndFile.m_szInstrumentPath[i][size-3],"iti") == 0;
bool xi = _stricmp(&m_SndFile.m_szInstrumentPath[i][size-2],"xi") == 0;
@@ -596,7 +601,7 @@
if ((!lpszPathName) || (!lpszPathName[0]) || m_ShowSavedialog)
{
_splitpath(m_strPathName, drive, path, fname, NULL);
- if (!fname[0]) strcpy(fname, m_strTitle);
+ if (!fname[0]) strcpy(fname, GetTitle());
strcpy(s, drive);
strcat(s, path);
strcat(s, fname);
@@ -1787,15 +1792,10 @@
if ((!pMainFrm) || (!m_SndFile.GetType())) return;
switch (type)
{
- /*case MOD_TYPE_XM:
- ext = "xm";
- pattern = "Fast Tracker Files (*.xm)|*.xm||";
- break;*/
case MOD_TYPE_MOD:
- ext = ModSpecs::mod.fileExtension;
pattern = FileFilterMOD;
if( AfxMessageBox(GetStrI18N(TEXT(
- "Compared to regular MOD save, compatibility export adjust the beginning of oneshot samples "
+ "Compared to regular MOD save, compatibility export adjusts the beginning of oneshot samples "
"in order to make the file compatible with ProTracker and other Amiga-based trackers. "
"Note that this feature does not remove effects \"invented\" by other PC-based trackers (f.e. panning commands)."
"\n\n Proceed?")), MB_ICONINFORMATION|MB_YESNO) != IDYES
@@ -1803,12 +1803,10 @@
return;
break;
case MOD_TYPE_IT:
- ext = ModSpecs::it.fileExtension;
pattern = FileFilterIT;
::MessageBox(NULL,"Warning: the exported file will not contain any of MPT's file-format hacks.", "Compatibility export warning.",MB_ICONINFORMATION | MB_OK);
break;
case MOD_TYPE_XM:
- ext = ModSpecs::xm.fileExtension;
pattern = FileFilterXM;
::MessageBox(NULL,"Warning: the exported file will not contain any of MPT's file-format hacks.", "Compatibility export warning.",MB_ICONINFORMATION | MB_OK);
break;
@@ -1816,6 +1814,7 @@
::MessageBox(NULL,"Compatibility export is currently only available for MOD, XM and IT modules.", "Can't do compatibility export.",MB_ICONINFORMATION | MB_OK);
return;
}
+ ext = m_SndFile.GetModSpecifications().fileExtension;
_splitpath(GetPathName(), drive, path, fname, NULL);
filename = drive;
@@ -3951,11 +3950,14 @@
FixNullString(m_SndFile.ChnSettings[nChn].szName);
}
+ // Macros
+ m_SndFile.SanitizeMacros();
+
// Pattern names
- // Halp, this is currently not possible. Is it even needed?
+ // Those are CStrings and don't need to be fixed.
// Sequence names.
- // Not needed?
+ // Those are CStrings and don't need to be fixed.
}
Modified: trunk/OpenMPT/soundlib/Sndfile.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Sndfile.cpp 2011-08-01 16:21:19 UTC (rev 953)
+++ trunk/OpenMPT/soundlib/Sndfile.cpp 2011-08-01 22:47:44 UTC (rev 954)
@@ -940,15 +940,15 @@
{
for(size_t i = 0; i < CountOf(m_MidiCfg.szMidiGlb); i++)
{
- SetNullTerminator(m_MidiCfg.szMidiGlb[i]);
+ FixNullString(m_MidiCfg.szMidiGlb[i]);
}
for(size_t i = 0; i < CountOf(m_MidiCfg.szMidiSFXExt); i++)
{
- SetNullTerminator(m_MidiCfg.szMidiSFXExt[i]);
+ FixNullString(m_MidiCfg.szMidiSFXExt[i]);
}
for(size_t i = 0; i < CountOf(m_MidiCfg.szMidiZXXExt); i++)
{
- SetNullTerminator(m_MidiCfg.szMidiZXXExt[i]);
+ FixNullString(m_MidiCfg.szMidiZXXExt[i]);
}
}
@@ -2662,9 +2662,9 @@
MemsetZero(m_defaultInstrument);
m_defaultInstrument.nResampling = SRCMODE_DEFAULT;
m_defaultInstrument.nFilterMode = FLTMODE_UNCHANGED;
- m_defaultInstrument.nPPC = 5*12;
- m_defaultInstrument.nGlobalVol=64;
- m_defaultInstrument.nPan = 0x20 << 2;
+ m_defaultInstrument.nPPC = 5 * 12;
+ m_defaultInstrument.nGlobalVol = 64;
+ m_defaultInstrument.nPan = 32 * 4;
//m_defaultInstrument.nIFC = 0xFF;
m_defaultInstrument.PanEnv.nReleaseNode=ENV_RELEASE_NODE_UNSET;
m_defaultInstrument.PitchEnv.nReleaseNode=ENV_RELEASE_NODE_UNSET;
@@ -2942,4 +2942,3 @@
FixMIDIConfigString(midiCfg.szMidiZXXExt[i]);
}
}
-
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sag...@us...> - 2011-08-01 16:21:27
|
Revision: 953
http://modplug.svn.sourceforge.net/modplug/?rev=953&view=rev
Author: saga-games
Date: 2011-08-01 16:21:19 +0000 (Mon, 01 Aug 2011)
Log Message:
-----------
[New] MRU list length can now be set through a hidden INI option, MRUListLength in [Misc] (up to 15 entries)
[Mod] OpenMPT: Version is now 1.20.00.02
Modified Paths:
--------------
trunk/OpenMPT/mptrack/Mptrack.cpp
trunk/OpenMPT/mptrack/version.h
Modified: trunk/OpenMPT/mptrack/Mptrack.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Mptrack.cpp 2011-08-01 16:17:20 UTC (rev 952)
+++ trunk/OpenMPT/mptrack/Mptrack.cpp 2011-08-01 16:21:19 UTC (rev 953)
@@ -830,9 +830,10 @@
}
m_pszProfileName = _tcsdup(m_szConfigFileName);
+ int mruListLength = GetPrivateProfileInt("Misc", "MRUListLength", 10, m_pszProfileName);
+ Limit(mruListLength, 0, 15);
+ LoadStdProfileSettings((UINT)mruListLength); // Load standard INI file options (including MRU)
- LoadStdProfileSettings(10); // Load standard INI file options (including MRU)
-
// Register document templates
m_pModTemplate = new CModDocTemplate(
IDR_MODULETYPE,
Modified: trunk/OpenMPT/mptrack/version.h
===================================================================
--- trunk/OpenMPT/mptrack/version.h 2011-08-01 16:17:20 UTC (rev 952)
+++ trunk/OpenMPT/mptrack/version.h 2011-08-01 16:21:19 UTC (rev 953)
@@ -15,7 +15,7 @@
#define VER_MAJORMAJOR 1
#define VER_MAJOR 20
#define VER_MINOR 00
-#define VER_MINORMINOR 01
+#define VER_MINORMINOR 02
//Creates version number from version parts that appears in version string.
//For example MAKE_VERSION_NUMERIC(1,17,02,28) gives version number of
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sag...@us...> - 2011-08-01 16:17:27
|
Revision: 952
http://modplug.svn.sourceforge.net/modplug/?rev=952&view=rev
Author: saga-games
Date: 2011-08-01 16:17:20 +0000 (Mon, 01 Aug 2011)
Log Message:
-----------
[Ref] Pattern cursor refactoring.
Modified Paths:
--------------
trunk/OpenMPT/mptrack/View_pat.cpp
trunk/OpenMPT/mptrack/View_pat.h
Modified: trunk/OpenMPT/mptrack/View_pat.cpp
===================================================================
--- trunk/OpenMPT/mptrack/View_pat.cpp 2011-07-31 23:32:09 UTC (rev 951)
+++ trunk/OpenMPT/mptrack/View_pat.cpp 2011-08-01 16:17:20 UTC (rev 952)
@@ -3018,7 +3018,7 @@
if (vol > 64) vol = 64;
m->vol = (BYTE)vol;
}
- if ((((nChn << 3) | 3u) >= (m_dwBeginSel & 0xFFFF)) && (((nChn << 3) | 3u) <= (m_dwEndSel & 0xFFFF)))
+ if ((CreateCursor(0, nChn, EFFECT_COLUMN) >= (m_dwBeginSel & 0xFFFF)) && (CreateCursor(0, nChn, EFFECT_COLUMN) <= (m_dwEndSel & 0xFFFF)))
{
if ((m->command == CMD_VOLUME) && (m->param <= 64))
{
@@ -3697,23 +3697,23 @@
case kcNavigateLeftSelect:
case kcNavigateLeft: if ((CMainFrame::GetSettings().m_dwPatternSetup & PATTERN_WRAP) && (!m_dwCursor))
- SetCurrentColumn((((pSndFile->GetNumChannels() - 1) << 3) | 4));
+ SetCurrentColumn(CreateCursor(0, pSndFile->GetNumChannels() - 1, LAST_COLUMN));
else
SetCurrentColumn(m_dwCursor - 1);
return wParam;
case kcNavigateRightSelect:
- case kcNavigateRight: if ((CMainFrame::GetSettings().m_dwPatternSetup & PATTERN_WRAP) && (m_dwCursor >= (((pSndFile->m_nChannels-1) << 3u) | 4u)))
+ case kcNavigateRight: if ((CMainFrame::GetSettings().m_dwPatternSetup & PATTERN_WRAP) && (m_dwCursor >= CreateCursor(0, pSndFile->GetNumChannels() - 1, LAST_COLUMN)))
SetCurrentColumn(0);
else
SetCurrentColumn(m_dwCursor + 1);
return wParam;
case kcNavigateNextChanSelect:
- case kcNavigateNextChan: SetCurrentColumn((((GetChanFromCursor(m_dwCursor) + 1) % pSndFile->m_nChannels) << 3) | GetColTypeFromCursor(m_dwCursor)); return wParam;
+ case kcNavigateNextChan: SetCurrentColumn(CreateCursor(0, (GetChanFromCursor(m_dwCursor) + 1) % pSndFile->GetNumChannels(), GetColTypeFromCursor(m_dwCursor))); return wParam;
case kcNavigatePrevChanSelect:
case kcNavigatePrevChan:{if(GetChanFromCursor(m_dwCursor) > 0)
- SetCurrentColumn((((GetChanFromCursor(m_dwCursor) - 1) % pSndFile->m_nChannels) << 3) | GetColTypeFromCursor(m_dwCursor));
+ SetCurrentColumn(CreateCursor(0, (GetChanFromCursor(m_dwCursor) - 1) % pSndFile->GetNumChannels(), GetColTypeFromCursor(m_dwCursor)));
else
- SetCurrentColumn(GetColTypeFromCursor(m_dwCursor) | ((pSndFile->m_nChannels-1) << 3));
+ SetCurrentColumn(CreateCursor(0, (pSndFile->GetNumChannels() - 1), GetColTypeFromCursor(m_dwCursor)));
UINT n = CreateCursor(m_nRow) | m_dwCursor;
SetCurSel(n, n); return wParam;}
@@ -3729,15 +3729,17 @@
case kcHomeAbsolute: if (m_dwCursor) SetCurrentColumn(0); if (m_nRow > 0) SetCurrentRow(0); return wParam;
case kcEndHorizontalSelect:
- case kcEndHorizontal: if (m_dwCursor!=(((pSndFile->GetNumChannels() - 1u) << 3u) | 4)) SetCurrentColumn(((pSndFile->m_nChannels-1) << 3) | 4);
+ case kcEndHorizontal: if (m_dwCursor != CreateCursor(0, pSndFile->GetNumChannels() - 1, LAST_COLUMN)) SetCurrentColumn(CreateCursor(0, pSndFile->GetNumChannels() - 1, LAST_COLUMN));
else if (m_nRow < pModDoc->GetPatternSize(m_nPattern) - 1) SetCurrentRow(pModDoc->GetPatternSize(m_nPattern) - 1);
return wParam;
case kcEndVerticalSelect:
case kcEndVertical: if (m_nRow < pModDoc->GetPatternSize(m_nPattern) - 1) SetCurrentRow(pModDoc->GetPatternSize(m_nPattern) - 1);
- else if (m_dwCursor!=(((pSndFile->GetNumChannels() - 1) << 3u) | 4u)) SetCurrentColumn(((pSndFile->m_nChannels-1) << 3u) | 4);
+ else if (m_dwCursor != CreateCursor(0, pSndFile->GetNumChannels() - 1, LAST_COLUMN)) SetCurrentColumn(CreateCursor(0, pSndFile->GetNumChannels() - 1, LAST_COLUMN));
return wParam;
case kcEndAbsoluteSelect:
- case kcEndAbsolute: SetCurrentColumn(((pSndFile->GetNumChannels() - 1) << 3) | 4); if (m_nRow < pModDoc->GetPatternSize(m_nPattern) - 1) SetCurrentRow(pModDoc->GetPatternSize(m_nPattern) - 1); return wParam;
+ case kcEndAbsolute: SetCurrentColumn(CreateCursor(0, pSndFile->GetNumChannels() - 1, LAST_COLUMN));
+ if (m_nRow < pModDoc->GetPatternSize(m_nPattern) - 1) SetCurrentRow(pModDoc->GetPatternSize(m_nPattern) - 1);
+ return wParam;
case kcNextPattern: { UINT n = m_nPattern + 1;
while ((n < pSndFile->Patterns.Size()) && (!pSndFile->Patterns[n])) n++;
@@ -4207,9 +4209,9 @@
}
//Enter note off
- if(pModDoc->GetSoundFile()->GetModSpecifications().hasNoteOff) // ===
+ if(pSndFile->GetModSpecifications().hasNoteOff) // ===
p->note = NOTE_KEYOFF;
- else if(pModDoc->GetSoundFile()->GetModSpecifications().hasNoteCut) // ^^^
+ else if(pSndFile->GetModSpecifications().hasNoteCut) // ^^^
p->note = NOTE_NOTECUT;
else { // we don't have anything to cut (MOD format) - use volume or ECx
if(usePlaybackPosition && nTick) // ECx
Modified: trunk/OpenMPT/mptrack/View_pat.h
===================================================================
--- trunk/OpenMPT/mptrack/View_pat.h 2011-07-31 23:32:09 UTC (rev 951)
+++ trunk/OpenMPT/mptrack/View_pat.h 2011-08-01 16:17:20 UTC (rev 952)
@@ -113,7 +113,8 @@
RECT m_rcDragItem, m_rcDropItem;
bool m_bContinueSearch, m_bWholePatternFitsOnScreen;
- DWORD m_dwStatus, m_dwCursor;
+ DWORD m_dwStatus;
+ DWORD m_dwCursor; // Current cursor position, without row number.
DWORD m_dwBeginSel, m_dwEndSel; // Upper-left / Lower-right corners of selection
DWORD m_dwStartSel, m_dwDragPos; // Point where selection was started
WORD ChnVUMeters[MAX_BASECHANNELS];
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sag...@us...> - 2011-07-31 23:32:16
|
Revision: 951
http://modplug.svn.sourceforge.net/modplug/?rev=951&view=rev
Author: saga-games
Date: 2011-07-31 23:32:09 +0000 (Sun, 31 Jul 2011)
Log Message:
-----------
[Fix] Revision 948 broke some functions because of broken resource indices.
Revision Links:
--------------
http://modplug.svn.sourceforge.net/modplug/?rev=948&view=rev
Modified Paths:
--------------
trunk/OpenMPT/mptrack/mptrack.rc
trunk/OpenMPT/mptrack/resource.h
Modified: trunk/OpenMPT/mptrack/mptrack.rc
===================================================================
--- trunk/OpenMPT/mptrack/mptrack.rc 2011-07-31 13:13:23 UTC (rev 950)
+++ trunk/OpenMPT/mptrack/mptrack.rc 2011-07-31 23:32:09 UTC (rev 951)
@@ -2810,9 +2810,9 @@
END
POPUP "&Info"
BEGIN
- MENUITEM "I&nputs", ID_INFO_INPUTS36015
+ MENUITEM "I&nputs", ID_INFO_INPUTS
MENUITEM "Ou&tputs", ID_INFO_OUPUTS
- MENUITEM "&Macros", ID_INFO_MACROS36017
+ MENUITEM "&Macros", ID_INFO_MACROS
END
POPUP "&Options"
BEGIN
Modified: trunk/OpenMPT/mptrack/resource.h
===================================================================
--- trunk/OpenMPT/mptrack/resource.h 2011-07-31 13:13:23 UTC (rev 950)
+++ trunk/OpenMPT/mptrack/resource.h 2011-07-31 23:32:09 UTC (rev 951)
@@ -1106,10 +1106,7 @@
#define ID_INFO_INPUTS 36011
#define ID_INFO_OUTPUTS 36012
#define ID_INFO_MACROS 36013
-#define ID_INFO36014 36014
-#define ID_INFO_INPUTS36015 36015
#define ID_INFO_OUPUTS 36016
-#define ID_INFO_MACROS36017 36017
#define ID_EDIT_GOTO 36018
#define ID_VIEW_GRAPH 36019
#define ID_PATTERN_TRANSITIONMUTE 36020
@@ -1164,37 +1161,37 @@
#define ID_CLEANUP_REARRANGESAMPLES 40223
#define ID_ORDERLIST_RENDER 40224
#define ID_EDIT_CLEANUP 40225
-#define ID_ORDERLIST_EDIT_COPY 40231
-#define ID_ORDERLIST_EDIT_CUT 40232
-#define ID_ORDERLIST_EDIT_PASTE 40233
-#define ID_CHANNEL_RENAME 40234
-#define ID_EDIT_PASTEFLOOD 40235
-#define ID_MODTREE_DUPLICATE 40236
-#define ID_MODTREE_INSERT 40237
-#define ID_MODTREE_SWITCHTO 40238
-#define ID_EDIT_PUSHFORWARDPASTE 40239
-#define ID_EDIT_SPLITKEYBOARDSETTINGS 40240
-#define ID_EDIT_PASTESPECIAL 40241
+#define ID_ORDERLIST_EDIT_COPY 40226
+#define ID_ORDERLIST_EDIT_CUT 40227
+#define ID_ORDERLIST_EDIT_PASTE 40228
+#define ID_CHANNEL_RENAME 40229
+#define ID_EDIT_PASTEFLOOD 40230
+#define ID_MODTREE_DUPLICATE 40231
+#define ID_MODTREE_INSERT 40232
+#define ID_MODTREE_SWITCHTO 40233
+#define ID_EDIT_PUSHFORWARDPASTE 40234
+#define ID_EDIT_SPLITKEYBOARDSETTINGS 40235
+#define ID_EDIT_PASTESPECIAL 40236
#define ID_CHANGE_PCNOTE_PARAM 40242
-#define ID_MODTREE_CLOSE 40243
-#define ID_SAMPLE_GENERATOR_MENU 40244
-#define ID_SAMPLE_GENERATOR_PRESET_MENU 40344
-#define ID_SAMPLE_GENERATE 40445
-#define ID_NOTEMAP_TRANS_UP 40446
-#define ID_NOTEMAP_TRANS_DOWN 40447
-#define ID_PATTERN_EDIT_PCNOTE_PLUGIN 40448
-#define ID_ENVELOPE_ZOOM_IN 40449
-#define ID_ENVELOPE_ZOOM_OUT 40450
-#define ID_PANIC 40451
-#define ID_VIEW_EDITHISTORY 40452
-#define ID_SAMPLE_GRID 40453
-#define ID_SAMPLE_QUICKFADE 40454
-#define ID_EDIT_MIXPASTE_ITSTYLE 40455
-#define ID_VIEW_MPTHACKS 40456
-#define ID_PLUGINTOINSTRUMENT 40457
-#define ID_INTERNETUPDATE 40458
-#define ID_HELP_EXAMPLEMODULES 40459
-#define ID_FILE_SAVEASTEMPLATE 40460
+#define ID_MODTREE_CLOSE 41243
+#define ID_SAMPLE_GENERATOR_MENU 41244
+#define ID_SAMPLE_GENERATOR_PRESET_MENU 41344
+#define ID_SAMPLE_GENERATE 41445
+#define ID_NOTEMAP_TRANS_UP 41446
+#define ID_NOTEMAP_TRANS_DOWN 41447
+#define ID_PATTERN_EDIT_PCNOTE_PLUGIN 41448
+#define ID_ENVELOPE_ZOOM_IN 41449
+#define ID_ENVELOPE_ZOOM_OUT 41450
+#define ID_PANIC 41451
+#define ID_VIEW_EDITHISTORY 41452
+#define ID_SAMPLE_GRID 41453
+#define ID_SAMPLE_QUICKFADE 41454
+#define ID_EDIT_MIXPASTE_ITSTYLE 41455
+#define ID_VIEW_MPTHACKS 41456
+#define ID_PLUGINTOINSTRUMENT 41457
+#define ID_INTERNETUPDATE 41458
+#define ID_HELP_EXAMPLEMODULES 41459
+#define ID_FILE_SAVEASTEMPLATE 41460
// Next default values for new objects
//
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sag...@us...> - 2011-07-31 13:13:30
|
Revision: 950
http://modplug.svn.sourceforge.net/modplug/?rev=950&view=rev
Author: saga-games
Date: 2011-07-31 13:13:23 +0000 (Sun, 31 Jul 2011)
Log Message:
-----------
[Fix] Pattern interpolation broke in revision 944
[Mod] OpenMPT: Version is now 1.20.00.01
Revision Links:
--------------
http://modplug.svn.sourceforge.net/modplug/?rev=944&view=rev
Modified Paths:
--------------
trunk/OpenMPT/mptrack/View_pat.cpp
trunk/OpenMPT/mptrack/View_pat.h
trunk/OpenMPT/mptrack/version.h
Modified: trunk/OpenMPT/mptrack/View_pat.cpp
===================================================================
--- trunk/OpenMPT/mptrack/View_pat.cpp 2011-07-31 12:02:15 UTC (rev 949)
+++ trunk/OpenMPT/mptrack/View_pat.cpp 2011-07-31 13:13:23 UTC (rev 950)
@@ -617,7 +617,7 @@
}
-BOOL CViewPattern::PrepareUndo(DWORD dwBegin, DWORD dwEnd)
+bool CViewPattern::PrepareUndo(DWORD dwBegin, DWORD dwEnd)
//--------------------------------------------------------
{
CModDoc *pModDoc = GetDocument();
@@ -627,9 +627,8 @@
nRowBeg = GetRowFromCursor(dwBegin);
nChnEnd = GetChanFromCursor(dwEnd);
nRowEnd = GetRowFromCursor(dwEnd);
- if( (nChnEnd < nChnBeg) || (nRowEnd < nRowBeg) ) return FALSE;
- if (pModDoc) return pModDoc->GetPatternUndo()->PrepareUndo(m_nPattern, nChnBeg, nRowBeg, nChnEnd-nChnBeg+1, nRowEnd-nRowBeg+1);
- return FALSE;
+ if((nChnEnd < nChnBeg) || (nRowEnd < nRowBeg) || pModDoc == nullptr) return false;
+ return pModDoc->GetPatternUndo()->PrepareUndo(m_nPattern, nChnBeg, nRowBeg, nChnEnd-nChnBeg+1, nRowEnd-nRowBeg+1);
}
@@ -2388,9 +2387,7 @@
bool doPCinterpolation = false;
- int vsrc, vdest, vcmd = 0, verr = 0;
- ASSERT(row1 >= row0);
- UINT distance = row1 - row0;
+ int vsrc, vdest, vcmd = 0, verr = 0, distance = row1 - row0;
const MODCOMMAND srcCmd = *pSndFile->Patterns[m_nPattern].GetpModCommand(row0, nchn);
const MODCOMMAND destCmd = *pSndFile->Patterns[m_nPattern].GetpModCommand(row1, nchn);
@@ -2404,7 +2401,7 @@
vsrc = srcCmd.note;
vdest = destCmd.note;
vcmd = srcCmd.instr;
- verr = (distance * 59) / NOTE_MAX;
+ verr = (distance * (NOTE_MAX - 1)) / NOTE_MAX;
break;
case VOL_COLUMN:
vsrc = srcCmd.vol;
@@ -2459,19 +2456,23 @@
MODCOMMAND* pcmd = pSndFile->Patterns[m_nPattern].GetpModCommand(row0, nchn);
- for (UINT i=0; i<=distance; i++, pcmd += pSndFile->m_nChannels) {
+ for (int i = 0; i <= distance; i++, pcmd += pSndFile->GetNumChannels())
+ {
- switch(type) {
+ switch(type)
+ {
case NOTE_COLUMN:
- if ((!pcmd->note) || (pcmd->instr == vcmd)) {
- int note = vsrc + ((vdest - vsrc) * (int)i + verr) / distance;
+ if ((!pcmd->note) || (pcmd->instr == vcmd))
+ {
+ int note = vsrc + ((vdest - vsrc) * i + verr) / distance;
pcmd->note = (BYTE)note;
pcmd->instr = vcmd;
}
break;
case VOL_COLUMN:
- if ((!pcmd->volcmd) || (pcmd->volcmd == vcmd)) {
- int vol = vsrc + ((vdest - vsrc) * (int)i + verr) / distance;
+ if ((!pcmd->volcmd) || (pcmd->volcmd == vcmd))
+ {
+ int vol = vsrc + ((vdest - vsrc) * i + verr) / distance;
pcmd->vol = (BYTE)vol;
pcmd->volcmd = vcmd;
}
@@ -2480,7 +2481,7 @@
if(doPCinterpolation)
{ // With PC/PCs notes, copy PCs note and plug index to all rows where
// effect interpolation is done if no PC note with non-zero instrument is there.
- const uint16 val = static_cast<uint16>(vsrc + ((vdest - vsrc) * (int)i + verr) / distance);
+ const uint16 val = static_cast<uint16>(vsrc + ((vdest - vsrc) * i + verr) / distance);
if (pcmd->IsPcNote() == false || pcmd->instr == 0)
{
pcmd->note = PCnote;
@@ -2493,7 +2494,7 @@
{
if ((!pcmd->command) || (pcmd->command == vcmd))
{
- int val = vsrc + ((vdest - vsrc) * (int)i + verr) / distance;
+ int val = vsrc + ((vdest - vsrc) * i + verr) / distance;
pcmd->param = (BYTE)val;
pcmd->command = vcmd;
}
@@ -2508,7 +2509,8 @@
} //end for all channels where type is selected
- if (changed) {
+ if (changed)
+ {
pModDoc->SetModified();
InvalidatePattern(FALSE);
}
@@ -2870,8 +2872,6 @@
if (pSndFile->Patterns[m_nPattern])
{
- MODCOMMAND *p = pSndFile->Patterns[m_nPattern];
-
CHANNELINDEX firstChannel = GetSelectionStartChan(), lastChannel = GetSelectionEndChan();
ROWINDEX firstRow = GetSelectionStartRow(), lastRow = GetSelectionEndRow();
firstChannel = CLAMP(firstChannel, 0, pSndFile->GetNumChannels() - 1);
@@ -2906,7 +2906,7 @@
for (ROWINDEX nRow = firstRow; nRow <= lastRow; nRow++)
{
- MODCOMMAND *m = p + nRow * pSndFile->m_nChannels + firstChannel;
+ MODCOMMAND *m = pSndFile->Patterns[m_nPattern].GetpModCommand(nRow, firstChannel);
for (CHANNELINDEX nChn = firstChannel; nChn <= lastChannel; nChn++, m++)
{
if ((m->command == CMD_VOLUME) && (m->param <= 64))
@@ -2922,9 +2922,9 @@
if ((m->note) && (m->note <= NOTE_MAX) && (m->instr))
{
UINT nSmp = m->instr;
- if (pSndFile->m_nInstruments)
+ if (pSndFile->GetNumInstruments())
{
- if ((nSmp <= pSndFile->m_nInstruments) && (pSndFile->Instruments[nSmp]))
+ if ((nSmp <= pSndFile->GetNumInstruments()) && (pSndFile->Instruments[nSmp]))
{
nSmp = pSndFile->Instruments[nSmp]->Keyboard[m->note];
if(!nSmp) chvol[nChn] = 64; // hack for instruments without samples
@@ -2933,7 +2933,7 @@
nSmp = 0;
}
}
- if ((nSmp) && (nSmp <= pSndFile->m_nSamples))
+ if ((nSmp) && (nSmp <= pSndFile->GetNumSamples()))
{
chvol[nChn] = (BYTE)(pSndFile->Samples[nSmp].nVolume >> 2);
break;
@@ -2958,7 +2958,7 @@
for (ROWINDEX nRow = firstRow; nRow <= lastRow; nRow++)
{
- MODCOMMAND *m = p + nRow * pSndFile->m_nChannels + firstChannel;
+ MODCOMMAND *m = pSndFile->Patterns[m_nPattern].GetpModCommand(nRow, firstChannel);
const int cy = lastRow - firstRow + 1; // total rows (for fading)
for (CHANNELINDEX nChn = firstChannel; nChn <= lastChannel; nChn++, m++)
{
Modified: trunk/OpenMPT/mptrack/View_pat.h
===================================================================
--- trunk/OpenMPT/mptrack/View_pat.h 2011-07-31 12:02:15 UTC (rev 949)
+++ trunk/OpenMPT/mptrack/View_pat.h 2011-07-31 13:13:23 UTC (rev 950)
@@ -196,7 +196,7 @@
void SelectBeatOrMeasure(bool selectBeat);
BOOL TransposeSelection(int transp);
- BOOL PrepareUndo(DWORD dwBegin, DWORD dwEnd);
+ bool PrepareUndo(DWORD dwBegin, DWORD dwEnd);
void DeleteRows(UINT colmin, UINT colmax, UINT nrows);
void OnDropSelection();
void ProcessChar(UINT nChar, UINT nFlags);
Modified: trunk/OpenMPT/mptrack/version.h
===================================================================
--- trunk/OpenMPT/mptrack/version.h 2011-07-31 12:02:15 UTC (rev 949)
+++ trunk/OpenMPT/mptrack/version.h 2011-07-31 13:13:23 UTC (rev 950)
@@ -15,7 +15,7 @@
#define VER_MAJORMAJOR 1
#define VER_MAJOR 20
#define VER_MINOR 00
-#define VER_MINORMINOR 00
+#define VER_MINORMINOR 01
//Creates version number from version parts that appears in version string.
//For example MAKE_VERSION_NUMERIC(1,17,02,28) gives version number of
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sag...@us...> - 2011-07-31 12:02:22
|
Revision: 949
http://modplug.svn.sourceforge.net/modplug/?rev=949&view=rev
Author: saga-games
Date: 2011-07-31 12:02:15 +0000 (Sun, 31 Jul 2011)
Log Message:
-----------
[Fix] Pattern amplify broke in revision 927.
[Mod] 669 Loader: Extended song title.
Revision Links:
--------------
http://modplug.svn.sourceforge.net/modplug/?rev=927&view=rev
Modified Paths:
--------------
trunk/OpenMPT/mptrack/View_pat.cpp
trunk/OpenMPT/soundlib/Load_669.cpp
Modified: trunk/OpenMPT/mptrack/View_pat.cpp
===================================================================
--- trunk/OpenMPT/mptrack/View_pat.cpp 2011-07-31 09:45:11 UTC (rev 948)
+++ trunk/OpenMPT/mptrack/View_pat.cpp 2011-07-31 12:02:15 UTC (rev 949)
@@ -2890,7 +2890,7 @@
}
firstChannel++;
}
- if(CreateCursor(0, lastChannel << 3, useVolCol ? VOL_COLUMN : EFFECT_COLUMN) > (m_dwEndSel & 0xFFFF))
+ if(CreateCursor(0, lastChannel, useVolCol ? VOL_COLUMN : EFFECT_COLUMN) > (m_dwEndSel & 0xFFFF))
{
if(lastChannel == 0)
{
Modified: trunk/OpenMPT/soundlib/Load_669.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Load_669.cpp 2011-07-31 09:45:11 UTC (rev 948)
+++ trunk/OpenMPT/soundlib/Load_669.cpp 2011-07-31 12:02:15 UTC (rev 949)
@@ -69,8 +69,8 @@
m_nDefaultSpeed = 6;
m_nChannels = 8;
- memcpy(m_szNames[0], pfh->songmessage, 16);
- SpaceToNullStringFixed<16>(m_szNames[0]);
+ memcpy(m_szNames[0], pfh->songmessage, min(MAX_SAMPLENAME - 1, 36));
+ SpaceToNullStringFixed<min(MAX_SAMPLENAME - 1, 36)>(m_szNames[0]);
m_nSamples = pfh->samples;
for (SAMPLEINDEX nSmp = 1; nSmp <= m_nSamples; nSmp++, psmp++)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rel...@us...> - 2011-07-31 09:45:20
|
Revision: 948
http://modplug.svn.sourceforge.net/modplug/?rev=948&view=rev
Author: relabsoluness
Date: 2011-07-31 09:45:11 +0000 (Sun, 31 Jul 2011)
Log Message:
-----------
[Ref] Changed some resource IDs because they were in reserved range.
Modified Paths:
--------------
trunk/OpenMPT/mptrack/resource.h
Modified: trunk/OpenMPT/mptrack/resource.h
===================================================================
--- trunk/OpenMPT/mptrack/resource.h 2011-07-30 22:14:04 UTC (rev 947)
+++ trunk/OpenMPT/mptrack/resource.h 2011-07-31 09:45:11 UTC (rev 948)
@@ -70,6 +70,15 @@
#define IDS_UNABLE_TO_CREATE_USER_TEMPLATE_FOLDER 231
#define IDS_FILE_DOES_NOT_EXIST 232
#define IDS_FILE_EXISTS_BUT_IS_NOT_READABLE 233
+#define IDS_ERR_FILEOPEN 234
+#define IDS_ERR_FILETYPE 235
+#define IDS_ERR_SAVEINS 236
+#define IDS_ERR_OUTOFMEMORY 237
+#define IDS_ERR_TOOMANYINS 238
+#define IDS_ERR_SAVESONG 239
+#define IDS_ERR_TOOMANYPAT 240
+#define IDS_ERR_TOOMANYSMP 241
+#define IDS_ERR_SAVESMP 242
#define IDB_MAINBAR 300
#define IDB_IMAGELIST 301
#define IDB_PATTERNS 302
@@ -1131,73 +1140,61 @@
#define ID_EXAMPLE_MODULES_LASTINRANGE 40053
#define ID_FILE_OPENTEMPLATE 40054
#define ID_FILE_OPENTEMPLATE_LASTINRANGE 40103
-#define IDS_ERR_FILEOPEN 55001
-#define IDS_ERR_FILETYPE 55002
-#define IDS_ERR_SAVEINS 55003
-#define IDS_ERR_OUTOFMEMORY 55004
-#define IDS_ERR_TOOMANYINS 55005
-#define IDS_ERR_SAVESONG 55006
-#define IDS_ERR_TOOMANYPAT 55007
-#define IDS_ERR_TOOMANYSMP 55008
-#define IDS_ERR_SAVESMP 55009
-#define ID_INDICATOR_TIME 59143
-#define ID_INDICATOR_USER 59144
-#define ID_INDICATOR_INFO 59145
-#define IDS_STRING59146 59146
-#define ID_INDICATOR_XINFO 59147
-#define ID_PATTERN_ADDCHANNEL_FRONT 59148
-#define ID_PATTERN_ADDCHANNEL_AFTER 59149
-#define ID_PATTERN_REMOVECHANNEL 59150
-#define ID_PATTERN_REMOVECHANNELDIALOG 59151
-#define ID_Menu 59200
-#define ID_FILE_SAVECOMPAT 59202
-#define ID_NEW_MPT 59203
-#define ID_CLEANUP_PLUGS 59205
-#define ID_ENVELOPE_TOGGLERELEASENODE 59206
-#define ID_Menu59207 59207
-#define ID_ENVELOPE_SCALEPOINTS 59208
-#define ID_VIEW_MIDIMAPPING 59211
-#define ID_PATTERN_DUPLICATECHANNEL 59216
-#define ID_EDIT_GOTO_MENU 59220
-#define ID_CLEANUP_COMPO 59221
-#define ID_SAMPLE_DRAW 59224
-#define ID_SAMPLE_ADDSILENCE 59225
-#define ID_OVERFLOWPASTE 59226
-#define ID_NOTEMAP_COPY_NOTE 59227
-#define ID_CLEANUP_REARRANGESAMPLES 59228
-#define ID_ORDERLIST_RENDER 59229
-#define ID_EDIT_CLEANUP 59230
-#define ID_ORDERLIST_EDIT_COPY 59231
-#define ID_ORDERLIST_EDIT_CUT 59232
-#define ID_ORDERLIST_EDIT_PASTE 59233
-#define ID_CHANNEL_RENAME 59234
-#define ID_EDIT_PASTEFLOOD 59235
-#define ID_MODTREE_DUPLICATE 59236
-#define ID_MODTREE_INSERT 59237
-#define ID_MODTREE_SWITCHTO 59238
-#define ID_EDIT_PUSHFORWARDPASTE 59239
-#define ID_EDIT_SPLITKEYBOARDSETTINGS 59240
-#define ID_EDIT_PASTESPECIAL 59241
-#define ID_CHANGE_PCNOTE_PARAM 59242
-#define ID_MODTREE_CLOSE 60243
-#define ID_SAMPLE_GENERATOR_MENU 60244
-#define ID_SAMPLE_GENERATOR_PRESET_MENU 60344
-#define ID_SAMPLE_GENERATE 60445
-#define ID_NOTEMAP_TRANS_UP 60446
-#define ID_NOTEMAP_TRANS_DOWN 60447
-#define ID_PATTERN_EDIT_PCNOTE_PLUGIN 60448
-#define ID_ENVELOPE_ZOOM_IN 60449
-#define ID_ENVELOPE_ZOOM_OUT 60450
-#define ID_PANIC 60451
-#define ID_VIEW_EDITHISTORY 60452
-#define ID_SAMPLE_GRID 60453
-#define ID_SAMPLE_QUICKFADE 60454
-#define ID_EDIT_MIXPASTE_ITSTYLE 60455
-#define ID_VIEW_MPTHACKS 60456
-#define ID_PLUGINTOINSTRUMENT 60457
-#define ID_INTERNETUPDATE 60458
-#define ID_HELP_EXAMPLEMODULES 60459
-#define ID_FILE_SAVEASTEMPLATE 60460
+#define ID_INDICATOR_TIME 40143
+#define ID_INDICATOR_USER 40144
+#define ID_INDICATOR_INFO 40145
+#define ID_FILE_SAVECOMPAT 40146
+#define ID_INDICATOR_XINFO 40147
+#define ID_PATTERN_ADDCHANNEL_FRONT 40148
+#define ID_PATTERN_ADDCHANNEL_AFTER 40149
+#define ID_PATTERN_REMOVECHANNEL 40150
+#define ID_PATTERN_REMOVECHANNELDIALOG 40151
+#define ID_NEW_MPT 40152
+#define ID_CLEANUP_PLUGS 40153
+#define ID_ENVELOPE_TOGGLERELEASENODE 40154
+#define ID_ENVELOPE_SCALEPOINTS 40155
+#define ID_VIEW_MIDIMAPPING 40156
+#define ID_PATTERN_DUPLICATECHANNEL 40216
+#define ID_EDIT_GOTO_MENU 40217
+#define ID_CLEANUP_COMPO 40218
+#define ID_SAMPLE_DRAW 40219
+#define ID_SAMPLE_ADDSILENCE 40220
+#define ID_OVERFLOWPASTE 40221
+#define ID_NOTEMAP_COPY_NOTE 40222
+#define ID_CLEANUP_REARRANGESAMPLES 40223
+#define ID_ORDERLIST_RENDER 40224
+#define ID_EDIT_CLEANUP 40225
+#define ID_ORDERLIST_EDIT_COPY 40231
+#define ID_ORDERLIST_EDIT_CUT 40232
+#define ID_ORDERLIST_EDIT_PASTE 40233
+#define ID_CHANNEL_RENAME 40234
+#define ID_EDIT_PASTEFLOOD 40235
+#define ID_MODTREE_DUPLICATE 40236
+#define ID_MODTREE_INSERT 40237
+#define ID_MODTREE_SWITCHTO 40238
+#define ID_EDIT_PUSHFORWARDPASTE 40239
+#define ID_EDIT_SPLITKEYBOARDSETTINGS 40240
+#define ID_EDIT_PASTESPECIAL 40241
+#define ID_CHANGE_PCNOTE_PARAM 40242
+#define ID_MODTREE_CLOSE 40243
+#define ID_SAMPLE_GENERATOR_MENU 40244
+#define ID_SAMPLE_GENERATOR_PRESET_MENU 40344
+#define ID_SAMPLE_GENERATE 40445
+#define ID_NOTEMAP_TRANS_UP 40446
+#define ID_NOTEMAP_TRANS_DOWN 40447
+#define ID_PATTERN_EDIT_PCNOTE_PLUGIN 40448
+#define ID_ENVELOPE_ZOOM_IN 40449
+#define ID_ENVELOPE_ZOOM_OUT 40450
+#define ID_PANIC 40451
+#define ID_VIEW_EDITHISTORY 40452
+#define ID_SAMPLE_GRID 40453
+#define ID_SAMPLE_QUICKFADE 40454
+#define ID_EDIT_MIXPASTE_ITSTYLE 40455
+#define ID_VIEW_MPTHACKS 40456
+#define ID_PLUGINTOINSTRUMENT 40457
+#define ID_INTERNETUPDATE 40458
+#define ID_HELP_EXAMPLEMODULES 40459
+#define ID_FILE_SAVEASTEMPLATE 40460
// Next default values for new objects
//
@@ -1205,7 +1202,7 @@
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_3D_CONTROLS 1
#define _APS_NEXT_RESOURCE_VALUE 530
-#define _APS_NEXT_COMMAND_VALUE 60461
+#define _APS_NEXT_COMMAND_VALUE 40461
#define _APS_NEXT_CONTROL_VALUE 2436
#define _APS_NEXT_SYMED_VALUE 901
#endif
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sag...@us...> - 2011-07-30 22:14:12
|
Revision: 947
http://modplug.svn.sourceforge.net/modplug/?rev=947&view=rev
Author: saga-games
Date: 2011-07-30 22:14:04 +0000 (Sat, 30 Jul 2011)
Log Message:
-----------
[New/Fix/Imp/Mod/etc] Completely overhauled macro handling system. Hopefully 99% compatible with IT's MIDI macros as defined in MIDI.TXT. Some macro letters have been changed / added, see the "macro help" button in the macro settings. Macros can now also make use of volume / panning envelopes, however this does not work very well yet (neither with Zxx, nor with \xx) - big TODO! Handling of those things is expected to change in the future, so don't rely on the buggy behaviour.
[Mod] OpenMPT: Version is now 1.20.00.00
Modified Paths:
--------------
trunk/OpenMPT/mptrack/Moddoc.cpp
trunk/OpenMPT/mptrack/Moddoc.h
trunk/OpenMPT/mptrack/TrackerSettings.cpp
trunk/OpenMPT/mptrack/dlg_misc.cpp
trunk/OpenMPT/mptrack/dlg_misc.h
trunk/OpenMPT/mptrack/mptrack.rc
trunk/OpenMPT/mptrack/version.h
trunk/OpenMPT/soundlib/Snd_defs.h
trunk/OpenMPT/soundlib/Snd_fx.cpp
trunk/OpenMPT/soundlib/Sndfile.cpp
trunk/OpenMPT/soundlib/Sndfile.h
trunk/OpenMPT/soundlib/Sndmix.cpp
Modified: trunk/OpenMPT/mptrack/Moddoc.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Moddoc.cpp 2011-07-30 21:36:06 UTC (rev 946)
+++ trunk/OpenMPT/mptrack/Moddoc.cpp 2011-07-30 22:14:04 UTC (rev 947)
@@ -3227,13 +3227,40 @@
if (value.Compare("F0F001z")==0) return sfx_reso;
if (value.Compare("F0F002z")==0) return sfx_mode;
if (value.Compare("F0F003z")==0) return sfx_drywet;
- if (value.Compare("BK00z")>=0 && value.Compare("BKFFz")<=0 && value.GetLength()==5)
+ if (value.Compare("Bc00z")>=0 && value.Compare("BcFFz")<=0 && value.GetLength()==5)
return sfx_cc;
if (value.Compare("F0F079z")>0 && value.Compare("F0F1G")<0 && value.GetLength()==7)
return sfx_plug;
return sfx_custom; //custom/unknown
}
+
+CString CModDoc::GetMacroName(enmParameteredMacroType macro)
+//----------------------------------------------------------
+{
+ switch(macro)
+ {
+ case sfx_unused:
+ return _T("Unused");
+ case sfx_cutoff:
+ return _T("Set Filter Cutoff");
+ case sfx_reso:
+ return _T("Set Filter Resonance");
+ case sfx_mode:
+ return _T("Set Filter Mode");
+ case sfx_drywet:
+ return _T("Set Plugin Dry/Wet Ratio");
+ case sfx_plug:
+ return _T("Control Plugin Param...");
+ case sfx_cc:
+ return _T("MIDI CC...");
+ case sfx_custom:
+ default:
+ return _T("Custom");
+ }
+}
+
+
int CModDoc::MacroToPlugParam(CString macro)
//------------------------------------------
{
@@ -3291,14 +3318,14 @@
// Retrieve Zxx (Z80-ZFF) type from current macro configuration
-enmFixedMacroType CModDoc::GetZxxType(const CHAR (&szMidiZXXExt)[128][MACRO_LENGTH])
+enmFixedMacroType CModDoc::GetZxxType(const char (&szMidiZXXExt)[128][MACRO_LENGTH])
//----------------------------------------------------------------------------------
{
// Compare with all possible preset patterns
for(size_t i = 1; i < zxx_max; i++)
{
// Prepare pattern to compare
- CHAR szPatterns[128][MACRO_LENGTH];
+ char szPatterns[128][MACRO_LENGTH];
CreateZxxFromType(szPatterns, static_cast<enmFixedMacroType>(i));
bool bFound = true;
@@ -3317,7 +3344,7 @@
// Create Zxx (Z80 - ZFF) from one out of five presets
-void CModDoc::CreateZxxFromType(CHAR (&szMidiZXXExt)[128][MACRO_LENGTH], enmFixedMacroType iZxxType)
+void CModDoc::CreateZxxFromType(char (&szMidiZXXExt)[128][MACRO_LENGTH], enmFixedMacroType iZxxType)
//--------------------------------------------------------------------------------------------------
{
for(size_t i = 0; i < 128; i++)
@@ -3759,7 +3786,7 @@
}
//set new macro
- CHAR *pMacroToSet = GetSoundFile()->m_MidiCfg.szMidiSFXExt[macroToSet];
+ char *pMacroToSet = GetSoundFile()->m_MidiCfg.szMidiSFXExt[macroToSet];
if (paramToUse < 128)
{
wsprintf(pMacroToSet, "F0F0%Xz",paramToUse+128);
Modified: trunk/OpenMPT/mptrack/Moddoc.h
===================================================================
--- trunk/OpenMPT/mptrack/Moddoc.h 2011-07-30 21:36:06 UTC (rev 946)
+++ trunk/OpenMPT/mptrack/Moddoc.h 2011-07-30 22:14:04 UTC (rev 947)
@@ -256,10 +256,11 @@
// Various MIDI Macro helpers
static enmParameteredMacroType GetMacroType(CString value); //rewbs.xinfo
+ static CString GetMacroName(enmParameteredMacroType macro);
static int MacroToPlugParam(CString value); //rewbs.xinfo
static int MacroToMidiCC(CString value);
- static enmFixedMacroType GetZxxType(const CHAR (&szMidiZXXExt)[128][MACRO_LENGTH]);
- static void CreateZxxFromType(CHAR (&szMidiZXXExt)[128][MACRO_LENGTH], enmFixedMacroType iZxxType);
+ static enmFixedMacroType GetZxxType(const char (&szMidiZXXExt)[128][MACRO_LENGTH]);
+ static void CreateZxxFromType(char (&szMidiZXXExt)[128][MACRO_LENGTH], enmFixedMacroType iZxxType);
bool IsMacroDefaultSetupUsed() const;
int FindMacroForParam(long param) const;
Modified: trunk/OpenMPT/mptrack/TrackerSettings.cpp
===================================================================
--- trunk/OpenMPT/mptrack/TrackerSettings.cpp 2011-07-30 21:36:06 UTC (rev 946)
+++ trunk/OpenMPT/mptrack/TrackerSettings.cpp 2011-07-30 22:14:04 UTC (rev 947)
@@ -211,6 +211,11 @@
GetPrivateProfileString("Zxx Macros", snam, macros.szMidiZXXExt[izxx], macros.szMidiZXXExt[izxx], CountOf(macros.szMidiZXXExt[izxx]), iniFile);
SetNullTerminator(macros.szMidiZXXExt[izxx]);
}
+ // Fix old nasty broken (non-standard) MIDI configs in INI file.
+ if(storedVersion >= "1.17" && storedVersion < "1.20")
+ {
+ CSoundFile::FixMIDIConfigStrings(macros);
+ }
theApp.SetDefaultMidiMacro(¯os);
// Default directory location
@@ -435,7 +440,7 @@
#define SETTINGS_REGKEY_BASE "Software\\Olivier Lapicque\\"
-#define SETTINGS_REGKEY_DEFAULT "ModPlug Tracker"
+#define SETTINGS_REGKEY_DEFAULT "ModPlug Tracker"
#define SETTINGS_REGEXT_WINDOW "\\Window"
#define SETTINGS_REGEXT_SETTINGS "\\Settings"
Modified: trunk/OpenMPT/mptrack/dlg_misc.cpp
===================================================================
--- trunk/OpenMPT/mptrack/dlg_misc.cpp 2011-07-30 21:36:06 UTC (rev 946)
+++ trunk/OpenMPT/mptrack/dlg_misc.cpp 2011-07-30 22:14:04 UTC (rev 947)
@@ -680,6 +680,7 @@
ON_COMMAND(IDC_CHECK1, OnEmbedMidiCfg)
ON_COMMAND(IDC_BUTTON1, OnSetAsDefault)
ON_COMMAND(IDC_BUTTON2, OnResetCfg)
+ ON_COMMAND(IDC_BUTTON3, OnMacroHelp)
ON_CBN_SELCHANGE(IDC_COMBO1, OnSFxChanged)
ON_CBN_SELCHANGE(IDC_COMBO2, OnSFxPresetChanged)
ON_CBN_SELCHANGE(IDC_COMBO3, OnZxxPresetChanged)
@@ -916,6 +917,26 @@
}
+void CMidiMacroSetup::OnMacroHelp()
+//---------------------------------
+{
+ MessageBox(_T("Valid characters in macros:\n\n"
+ "0-9, A-F - Raw hex data (4-Bit value)\n"
+ "c - MIDI channel (4-Bit value)\n"
+ "n - Note value\n\n"
+ "v - Note velocity\n"
+ "u - Computed note volume (including envelopes)\n\n"
+ "x - Note panning\n"
+ "y - Computed panning (including envelopes)\n\n"
+ "a - High byte of bank select\n"
+ "b - Low byte of bank select\n"
+ "p - Program select\n\n"
+ "z - Zxx parameter (00-7F)\n\n"
+ "Macros can be up to 31 characters long and contain multiple MIDI messages. SysEx messages are automatically terminated if not specified by the user."),
+ _T("OpenMPT MIDI Macro quick reference"), MB_OK | MB_ICONINFORMATION);
+}
+
+
void CMidiMacroSetup::OnEmbedMidiCfg()
//------------------------------------
{
@@ -946,7 +967,7 @@
if (sfx < 16)
{
- CHAR *pmacro = m_MidiCfg.szMidiSFXExt[sfx];
+ char *pmacro = m_MidiCfg.szMidiSFXExt[sfx];
switch(sfx_preset)
{
case sfx_unused: strcpy(pmacro, ""); break; // unused
@@ -954,7 +975,7 @@
case sfx_reso: strcpy(pmacro, "F0F001z"); break; // reso
case sfx_mode: strcpy(pmacro, "F0F002z"); break; // mode
case sfx_drywet: strcpy(pmacro, "F0F003z"); break;
- case sfx_cc: strcpy(pmacro, "BK00z"); break; // MIDI cc - TODO: get value from other menus
+ case sfx_cc: strcpy(pmacro, "Bc00z"); break; // MIDI cc - TODO: get value from other menus
case sfx_plug: strcpy(pmacro, "F0F080z"); break; // plug param - TODO: get value from other menus
case sfx_custom: /*strcpy(pmacro, "z");*/ break; // custom - leave as is.
}
@@ -983,28 +1004,20 @@
UINT sfx = m_CbnSFx.GetCurSel();
if (sfx < 16)
{
- memset(s, 0, sizeof(s));
- m_EditSFx.GetWindowText(s, MACRO_LENGTH - 1);
- s[MACRO_LENGTH - 1] = 0;
- // Fix letter case
- for(size_t i = 0; i < MACRO_LENGTH; i++)
+ if(ValidateMacroString(m_EditSFx, m_MidiCfg.szMidiSFXExt[sfx], true))
{
- if(s[i] >= 'd' && s[i] <= 'f') // a,b,c have special meanings
- {
- s[i] = s[i] - 'a' + 'A';
- } else if(s[i] == 'N' || s[i] == 'V' || s[i] == 'U' || s[i] == 'X' || s[i] == 'Y' || s[i] == 'Z' || s[i] == 'P')
- {
- s[i] = s[i] - 'A' + 'a';
- }
+ MemsetZero(s);
+ m_EditSFx.GetWindowText(s, MACRO_LENGTH);
+ SetNullTerminator(s);
+ memcpy(m_MidiCfg.szMidiSFXExt[sfx], s, MACRO_LENGTH);
+
+ int sfx_preset = m_pModDoc->GetMacroType(m_MidiCfg.szMidiSFXExt[sfx]);
+ //int param = m_pModDoc->MacroToPlugParam(m_MidiCfg.szMidiSFXExt[sfx]);
+
+ m_CbnSFxPreset.SetCurSel(sfx_preset);
+ ToggleBoxes(sfx_preset, sfx);
+ UpdateMacroList(sfx);
}
-
- memcpy(m_MidiCfg.szMidiSFXExt[sfx], s, MACRO_LENGTH);
- int sfx_preset = m_pModDoc->GetMacroType(m_MidiCfg.szMidiSFXExt[sfx]);
- //int param = m_pModDoc->MacroToPlugParam(m_MidiCfg.szMidiSFXExt[sfx]);
-
- m_CbnSFxPreset.SetCurSel(sfx_preset);
- ToggleBoxes(sfx_preset, sfx);
- UpdateMacroList(sfx);
}
}
@@ -1016,10 +1029,13 @@
UINT zxx = m_CbnZxx.GetCurSel();
if (zxx < 128)
{
- memset(s, 0, sizeof(s));
- m_EditZxx.GetWindowText(s, MACRO_LENGTH - 1);
- s[MACRO_LENGTH - 1] = 0;
- memcpy(m_MidiCfg.szMidiZXXExt[zxx], s, MACRO_LENGTH);
+ if(ValidateMacroString(m_EditZxx, m_MidiCfg.szMidiZXXExt[zxx], false))
+ {
+ MemsetZero(s);
+ m_EditZxx.GetWindowText(s, MACRO_LENGTH);
+ SetNullTerminator(s);
+ memcpy(m_MidiCfg.szMidiZXXExt[zxx], s, MACRO_LENGTH);
+ }
}
}
@@ -1116,7 +1132,7 @@
{
CString macroText;
UINT cc = m_CbnMacroCC.GetItemData(m_CbnMacroCC.GetCurSel());
- macroText.Format("BK%02Xz", cc&0xFF);
+ macroText.Format("Bc%02Xz", cc & 0xFF);
m_EditSFx.SetWindowText(macroText);
}
@@ -1157,6 +1173,62 @@
}
+bool CMidiMacroSetup::ValidateMacroString(CEdit &wnd, char *lastMacro, bool isParametric)
+//---------------------------------------------------------------------------------------
+{
+ CString macroStr;
+ wnd.GetWindowText(macroStr);
+
+ bool allowed = true, caseChange = false;
+ for(int i = 0; i < macroStr.GetLength(); i++)
+ {
+ char c = macroStr.GetAt(i);
+ if(c == 'k' || c == 'K') // Previously, 'K' was used for MIDI channel
+ {
+ caseChange = true;
+ macroStr.SetAt(i, 'c');
+ } else if (c >= 'd' && c <= 'f') // abc have special meanings, but def can be fixed
+ {
+ caseChange = true;
+ macroStr.SetAt(i, c - 'a' + 'A');
+ } else if(c == 'N' || c == 'V' || c == 'U' || c == 'X' || c == 'Y' || c == 'Z' || c == 'P')
+ {
+ caseChange = true;
+ macroStr.SetAt(i, c - 'A' + 'a');
+ } else if(!(
+ (c >= '0' && c <= '9') || (c >= 'A' && c <= 'F') || (c >= 'a' && c <= 'c') ||
+ (c == 'v' || c == 'u' || c == 'x' || c == 'y' || c == 'p' || c == 'n' || c == ' ') ||
+ (c == 'z' && isParametric)))
+ {
+ allowed = false;
+ break;
+ }
+ }
+
+ if(!allowed)
+ {
+ // Replace text and keep cursor position if we just typed in an invalid character
+ int start, end;
+ wnd.GetSel(start, end);
+ wnd.SetWindowText(lastMacro);
+ wnd.SetSel(start - 1, end - 1, true);
+ MessageBeep(MB_OK);
+ return false;
+ }
+ else
+ {
+ if(caseChange)
+ {
+ // Replace text and keep cursor position if there was a case conversion
+ int start, end;
+ wnd.GetSel(start, end);
+ wnd.SetWindowText(macroStr);
+ wnd.SetSel(start, end, true);
+ }
+ return true;
+ }
+}
+
////////////////////////////////////////////////////////////////////////////////////////////
// Keyboard Control
Modified: trunk/OpenMPT/mptrack/dlg_misc.h
===================================================================
--- trunk/OpenMPT/mptrack/dlg_misc.h 2011-07-30 21:36:06 UTC (rev 946)
+++ trunk/OpenMPT/mptrack/dlg_misc.h 2011-07-30 22:14:04 UTC (rev 947)
@@ -152,6 +152,8 @@
CSoundFile *m_pSndFile;
CModDoc *m_pModDoc;
+ bool ValidateMacroString(CEdit &wnd, char *lastMacro, bool isParametric);
+
void UpdateMacroList(int macro=-1);
void ToggleBoxes(UINT preset, UINT sfx);
virtual BOOL OnInitDialog();
@@ -159,6 +161,7 @@
afx_msg void UpdateDialog();
afx_msg void OnSetAsDefault();
afx_msg void OnResetCfg();
+ afx_msg void OnMacroHelp();
afx_msg void OnEmbedMidiCfg();
afx_msg void OnSFxChanged();
afx_msg void OnSFxPresetChanged();
Modified: trunk/OpenMPT/mptrack/mptrack.rc
===================================================================
--- trunk/OpenMPT/mptrack/mptrack.rc 2011-07-30 21:36:06 UTC (rev 946)
+++ trunk/OpenMPT/mptrack/mptrack.rc 2011-07-30 22:14:04 UTC (rev 947)
@@ -299,12 +299,12 @@
END
#endif // APSTUDIO_INVOKED
-#endif // German (Germany) resources
+#endif // Deutsch (Deutschland) resources
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
-// English (U.S.) resources
+// Englisch (USA) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
@@ -1228,6 +1228,7 @@
CONTROL "Embed macro configuration in file when saving",IDC_CHECK1,
"Button",BS_AUTOCHECKBOX | BS_TOP | WS_TABSTOP,6,338,288,10
COMBOBOX IDC_MACROCC,63,257,111,111,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
+ PUSHBUTTON "Macro Help",IDC_BUTTON3,300,84,50,14
END
IDD_CHORDEDIT DIALOGEX 0, 0, 245, 148
@@ -2524,12 +2525,12 @@
IDC_SAMPLE_XFADE "Crossfade Loop Points\nCrossfade between loop start and loop end to create seamless sample loops."
END
-#endif // English (U.S.) resources
+#endif // Englisch (USA) resources
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
-// English (U.K.) resources
+// Englisch (GB) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENG)
#ifdef _WIN32
@@ -2902,7 +2903,7 @@
//
IDR_BUILTIN_TUNINGS TUNING "res\\built-inTunings.tc"
-#endif // English (U.K.) resources
+#endif // Englisch (GB) resources
/////////////////////////////////////////////////////////////////////////////
Modified: trunk/OpenMPT/mptrack/version.h
===================================================================
--- trunk/OpenMPT/mptrack/version.h 2011-07-30 21:36:06 UTC (rev 946)
+++ trunk/OpenMPT/mptrack/version.h 2011-07-30 22:14:04 UTC (rev 947)
@@ -13,8 +13,8 @@
//Version definitions. The only thing that needs to be changed when changing version number.
#define VER_MAJORMAJOR 1
-#define VER_MAJOR 19
-#define VER_MINOR 03
+#define VER_MAJOR 20
+#define VER_MINOR 00
#define VER_MINORMINOR 00
//Creates version number from version parts that appears in version string.
Modified: trunk/OpenMPT/soundlib/Snd_defs.h
===================================================================
--- trunk/OpenMPT/soundlib/Snd_defs.h 2011-07-30 21:36:06 UTC (rev 946)
+++ trunk/OpenMPT/soundlib/Snd_defs.h 2011-07-30 22:14:04 UTC (rev 947)
@@ -403,10 +403,6 @@
INST_NUMFILTERMODES
};*/
-// MIDI Macros
-#define MACRO_MASK 0x7F5F7F5F
-#define MACRO_INTERNAL 0x30463046 // internal macro (F0F0), controls lower 8 bits (f.e. cutoff, resonance, low plugin params)
-#define MACRO_INTERNALEX 0x31463046 // internal extended macro (F0F1), controls higher 8 bits (high plugin params)
// Vibrato Types
enum VibratoType
Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Snd_fx.cpp 2011-07-30 21:36:06 UTC (rev 946)
+++ trunk/OpenMPT/soundlib/Snd_fx.cpp 2011-07-30 22:14:04 UTC (rev 947)
@@ -457,7 +457,14 @@
for (CHANNELINDEX n = 0; n < m_nChannels; n++)
{
Chn[n].nGlobalVol = chnvols[n];
- if (notes[n]) Chn[n].nNewNote = notes[n];
+ if (notes[n])
+ {
+ Chn[n].nNewNote = notes[n];
+ if(NOTE_IS_VALID(notes[n]))
+ {
+ Chn[n].nLastNote = notes[n];
+ }
+ }
if (instr[n]) Chn[n].nNewIns = instr[n];
if (vols[n] != 0xFF)
{
@@ -1539,7 +1546,10 @@
// Note Cut/Off/Fade => ignore instrument
if (note >= NOTE_MIN_SPECIAL) instr = 0;
- if ((note) && (note <= NOTE_MAX)) pChn->nNewNote = note;
+ if ((note) && (note <= NOTE_MAX))
+ {
+ pChn->nNewNote = pChn->nLastNote = note;
+ }
// New Note Action ?
if ((note) && (note <= NOTE_MAX) && (!bPorta))
@@ -2125,14 +2135,14 @@
break;
// Midi Controller
- case CMD_MIDI: // Midi Controller (on first tick only)
- case CMD_SMOOTHMIDI: // Midi Controller (smooth, i.e. on every tick)
+ case CMD_MIDI: // MIDI Controller (on first tick only)
+ case CMD_SMOOTHMIDI: // MIDI Controller (smooth, i.e. on every tick)
- if((cmd == CMD_MIDI) && !(m_dwSongFlags & SONG_FIRSTTICK)) break;
+ /*if((cmd == CMD_MIDI) && !(m_dwSongFlags & SONG_FIRSTTICK)) break;
if (param < 0x80)
- ProcessMidiMacro(nChn, (cmd == CMD_SMOOTHMIDI), m_MidiCfg.szMidiSFXExt[pChn->nActiveMacro], param);
+ ProcessMIDIMacro(nChn, (cmd == CMD_SMOOTHMIDI), m_MidiCfg.szMidiSFXExt[pChn->nActiveMacro], param);
else
- ProcessMidiMacro(nChn, (cmd == CMD_SMOOTHMIDI), m_MidiCfg.szMidiZXXExt[(param & 0x7F)], 0);
+ ProcessMIDIMacro(nChn, (cmd == CMD_SMOOTHMIDI), m_MidiCfg.szMidiZXXExt[(param & 0x7F)], 0);*/
break;
// IMF Commands
@@ -3049,121 +3059,219 @@
}
-// Process a Midi Macro.
+// Process a MIDI Macro.
// Parameters:
// [in] nChn: Mod channel to apply macro on
// [in] isSmooth: If true, internal macros are interpolated between two rows
-// [in] pszMidiMacro: Actual Midi Macro
-// [in] param: Parameter for parametric macros
-void CSoundFile::ProcessMidiMacro(UINT nChn, bool isSmooth, LPCSTR pszMidiMacro, UINT param)
-//------------------------------------------------------------------------------------------
+// [in] macro: Actual MIDI Macro string
+// [in] param: Parameter for parametric macros (Z00 - Z7F)
+// [in] plugin: Plugin to send MIDI message to (if not specified but needed, it is autodetected)
+void CSoundFile::ProcessMIDIMacro(CHANNELINDEX nChn, bool isSmooth, char *macro, uint8 param, PLUGINDEX plugin)
+//-------------------------------------------------------------------------------------------------------------
{
- MODCHANNEL *pChn = &Chn[nChn];
- DWORD dwMacro = LittleEndian(*((DWORD *)pszMidiMacro)) & MACRO_MASK;
- int nInternalCode;
+ const MODCHANNEL *pChn = &Chn[nChn];
+ const MODINSTRUMENT *pIns = GetNumInstruments() ? pChn->pModInstrument : nullptr;
- // Not Internal Device ?
- if (dwMacro != MACRO_INTERNAL && dwMacro != MACRO_INTERNALEX)
+ unsigned char out[MACRO_LENGTH];
+ size_t outPos = 0; // output buffer position, which also equals the number of complete bytes
+ bool firstNibble = true;
+
+ for(size_t pos = 0; pos < MACRO_LENGTH && macro[pos]; pos++)
{
- // we don't cater for external devices at tick resolution.
- if(isSmooth && !(m_dwSongFlags & SONG_FIRSTTICK))
+ bool isNibble = false; // did we parse a nibble or a byte value?
+ unsigned char data = 0; // data that has just been parsed
+
+ // Parse next macro byte... See Impulse Tracker's MIDI.TXT for detailed information on each possible character.
+ if(macro[pos] >= '0' && macro[pos] <= '9')
{
- return;
+ isNibble = true;
+ data = (unsigned char)macro[pos] - '0';
}
+ else if(macro[pos] >= 'A' && macro[pos] <= 'F')
+ {
+ isNibble = true;
+ data = (unsigned char)macro[pos] - 'A' + 0x0A;
+ } else if(macro[pos] == 'c') // c: MIDI channel
+ {
+ isNibble = true;
+ data = (unsigned char)GetBestMidiChan(pChn);
+ } else if(macro[pos] == 'n') // n: note value (last triggered note)
+ {
+ if(pChn->nLastNote != NOTE_NONE && NOTE_IS_VALID(pChn->nLastNote))
+ {
+ data = (unsigned char)(pChn->nLastNote - NOTE_MIN);
+ }
+ } else if(macro[pos] == 'v') // v: velocity
+ {
+ data = (unsigned char)min(pChn->nVolume / 2, 127);
- UINT pos = 0, nNib = 0, nBytes = 0;
- DWORD dwMidiCode = 0, dwByteCode = 0;
+ } else if(macro[pos] == 'u') // u: volume (calculated)
+ {
+ data = (unsigned char)min(pChn->nCalcVolume >> 7, 127);
+ } else if(macro[pos] == 'x') // x: pan set
+ {
+ data = (unsigned char)min(pChn->nPan / 2, 127);
+ } else if(macro[pos] == 'y') // y: calculated pan
+ {
+ data = (unsigned char)min(pChn->nRealPan / 2, 127);
+ } else if(macro[pos] == 'a') // a: high byte of bank select
+ {
+ if(pIns && pIns->wMidiBank)
+ {
+ data = (unsigned char)(((pIns->wMidiBank - 1) >> 7) & 0x7F);
+ }
+ } else if(macro[pos] == 'b') // b: low byte of bank select
+ {
+ if(pIns && pIns->wMidiBank)
+ {
+ data = (unsigned char)((pIns->wMidiBank - 1) & 0x7F);
+ }
+ } else if(macro[pos] == 'p') // p: program select
+ {
+ if(pIns && pIns->nMidiProgram)
+ {
+ data = (unsigned char)((pIns->nMidiProgram - 1) & 0x7F);
+ }
+ } else if(macro[pos] == 'z') // z: macro data
+ {
+ data = (unsigned char)(param & 0x7F);
+ } else // unrecognized byte (f.e. space char)
+ {
+ continue;
+ }
- while (pos + 6 <= 32)
+ // Append parsed data
+ if(isNibble) // parsed a nibble (constant or 'c' variable)
{
- const CHAR cData = pszMidiMacro[pos++];
- if (!cData) break;
- if ((cData >= '0') && (cData <= '9')) { dwByteCode = (dwByteCode << 4) | (cData - '0'); nNib++; } else
- if ((cData >= 'A') && (cData <= 'F')) { dwByteCode = (dwByteCode << 4) | (cData - 'A' + 10); nNib++; } else
- if ((cData >= 'a') && (cData <= 'f')) { dwByteCode = (dwByteCode << 4) | (cData - 'a' + 10); nNib++; } else
- if ((cData == 'z') || (cData == 'Z')) { dwByteCode = param & 0x7F; nNib = 2; } else
- if ((cData == 'x') || (cData == 'X')) { dwByteCode = param & 0x70; nNib = 2; } else
- if ((cData == 'y') || (cData == 'Y')) { dwByteCode = (param & 0x0F) << 3; nNib = 2; }
- if ((cData == 'k') || (cData == 'K')) { dwByteCode = (dwByteCode << 4) | GetBestMidiChan(pChn); nNib++; }
+ if(firstNibble)
+ {
+ out[outPos] = data;
+ } else
+ {
+ out[outPos] = (out[outPos] << 4) | data;
+ outPos++;
+ }
+ firstNibble = !firstNibble;
+ } else // parsed a byte (variable)
+ {
+ if(!firstNibble) // From MIDI.TXT: '9n' is exactly the same as '09 n' or '9 n' -- so finish current byte first
+ {
+ outPos++;
+ }
+ out[outPos++] = data;
+ firstNibble = true;
+ }
+ }
+ if(!firstNibble)
+ {
+ // Finish current byte
+ outPos++;
+ }
- if (nNib >= 2)
+ if(outPos == 0)
+ {
+ // Nothing there to send!
+ return;
+ }
+
+ // Macro string has been parsed and translated, now send the message(s)...
+ size_t sendPos = 0;
+ while(sendPos < outPos)
+ {
+ size_t sendLen = 0;
+ if(out[sendPos] == 0xF0)
+ {
+ // SysEx start
+ if((sendPos <= outPos - 4) && (out[sendPos + 1] == 0xF0 || out[sendPos + 1] == 0xF1))
{
- nNib = 0;
- dwMidiCode |= dwByteCode << (nBytes * 8);
- dwByteCode = 0;
- nBytes++;
-
- if (nBytes >= 3)
+ // Internal macro (normal (F0F0) or extended (F0F1)), 4 bytes long
+ sendLen = 4;
+ } else
+ {
+ // SysEx message, find end of message
+ for(size_t i = sendPos + 1; i < outPos; i++)
{
- UINT nMasterCh = (nChn < m_nChannels) ? nChn + 1 : pChn->nMasterChn;
- if ((nMasterCh) && (nMasterCh <= m_nChannels))
+ if(out[i] == 0xF7)
{
-// -> CODE#0015
-// -> DESC="channels management dlg"
- UINT nPlug = GetBestPlugin(nChn, PRIORITISE_CHANNEL, EVEN_IF_MUTED);
- if(pChn->dwFlags & CHN_NOFX) nPlug = 0;
-// -! NEW_FEATURE#0015
- if ((nPlug) && (nPlug <= MAX_MIXPLUGINS))
- {
- IMixPlugin *pPlugin = m_MixPlugins[nPlug - 1].pMixPlugin;
- if ((pPlugin) && (m_MixPlugins[nPlug - 1].pMixState))
- {
- pPlugin->MidiSend(dwMidiCode);
- }
- }
+ // Found end of SysEx message
+ sendLen = i - sendPos + 1;
+ break;
}
- nBytes = 0;
- dwMidiCode = 0;
}
+ if(sendLen == 0)
+ {
+ // Didn't find end, so "invent" end of SysEx message
+ out[outPos++] = 0xF7;
+ sendLen = outPos - sendPos;
+ }
}
+ } else
+ {
+ // Other MIDI messages, find beginning of next message
+ while(sendPos + (++sendLen) < outPos)
+ {
+ if((out[sendPos + sendLen] & 0x80) != 0)
+ {
+ // Next message begins here.
+ break;
+ }
+ }
+ }
+ if(sendLen == 0)
+ {
+ break;
}
-
- return;
+
+ size_t bytesSent = SendMIDIData(nChn, isSmooth, out + sendPos, sendLen, plugin);
+ // Ideally (if there's no error in the macro data), we should have sendLen == bytesSent.
+ if(bytesSent > 0)
+ {
+ sendPos += bytesSent;
+ } else
+ {
+ sendPos += sendLen;
+ }
+
}
- // Internal device
- const bool extendedParam = (dwMacro == MACRO_INTERNALEX);
+}
- pszMidiMacro += 4; // skip the F0.F0 part of the macro
- // Determine which internal device is called; every internal code looks like F0.F0.yy.xx,
- // where yy is the "device" (cutoff, resonance, plugin parameter, etc.) and xx is the value.
- nInternalCode = -256;
- if ((pszMidiMacro[0] >= '0') && (pszMidiMacro[0] <= '9')) nInternalCode = (pszMidiMacro[0] - '0') << 4; else
- if ((pszMidiMacro[0] >= 'A') && (pszMidiMacro[0] <= 'F')) nInternalCode = (pszMidiMacro[0] - 'A' + 0x0A) << 4;
- if ((pszMidiMacro[1] >= '0') && (pszMidiMacro[1] <= '9')) nInternalCode += (pszMidiMacro[1] - '0'); else
- if ((pszMidiMacro[1] >= 'A') && (pszMidiMacro[1] <= 'F')) nInternalCode += (pszMidiMacro[1] - 'A' + 0x0A);
- // Filter ?
- if (nInternalCode >= 0)
+
+// Process MIDI macro data parsed by ProcessMIDIMacro... return bytes sent on success, 0 on (parse) failure.
+size_t CSoundFile::SendMIDIData(CHANNELINDEX nChn, bool isSmooth, const unsigned char *macro, size_t macroLen, PLUGINDEX plugin)
+//------------------------------------------------------------------------------------------------------------------------------
+{
+ if(macroLen < 1)
{
- CHAR cData1 = pszMidiMacro[2];
- DWORD dwParam = 0;
+ return 0;
+ }
- if ((cData1 == 'z') || (cData1 == 'Z'))
+ MODCHANNEL *pChn = &Chn[nChn];
+
+ if(macro[0] == 0xF0 && (macro[1] == 0xF0 || macro[1] == 0xF1))
+ {
+ // Internal device.
+ if(macroLen < 4)
{
- // parametric macro
- dwParam = param;
- } else
- {
- // fixed macro
- CHAR cData2 = pszMidiMacro[3];
- if ((cData1 >= '0') && (cData1 <= '9')) dwParam += (cData1 - '0') << 4; else
- if ((cData1 >= 'A') && (cData1 <= 'F')) dwParam += (cData1 - 'A' + 0x0A) << 4;
- if ((cData2 >= '0') && (cData2 <= '9')) dwParam += (cData2 - '0'); else
- if ((cData2 >= 'A') && (cData2 <= 'F')) dwParam += (cData2 - 'A' + 0x0A);
+ return 0;
}
+ const bool isExtended = (macro[1] == 0xF1);
+ const uint8 macroCode = macro[2];
+ const uint8 param = macro[3];
- switch(nInternalCode)
+ switch(macroCode)
{
// F0.F0.00.xx: Set CutOff
case 0x00:
+ if(!isExtended)
{
int oldcutoff = pChn->nCutOff;
- if (dwParam < 0x80)
+ if(param < 0x80)
{
if(!isSmooth)
{
- pChn->nCutOff = dwParam;
+ pChn->nCutOff = param;
} else
{
// on the first tick only, calculate step
@@ -3171,7 +3279,7 @@
{
pChn->m_nPlugInitialParamValue = pChn->nCutOff;
// (dwParam & 0x7F) extracts the actual value that we're going to pass
- pChn->m_nPlugParamValueStep = (float)((int)dwParam - pChn->m_nPlugInitialParamValue) / (float)m_nMusicSpeed;
+ pChn->m_nPlugParamValueStep = (float)((int)param - pChn->m_nPlugInitialParamValue) / (float)GetNumTicksOnCurrentRow();
}
//update param on all ticks
pChn->nCutOff = (BYTE) (pChn->m_nPlugInitialParamValue + (m_nTickCount + 1) * pChn->m_nPlugParamValueStep + 0.5);
@@ -3180,61 +3288,71 @@
}
#ifndef NO_FILTER
oldcutoff -= pChn->nCutOff;
- if (oldcutoff < 0) oldcutoff = -oldcutoff;
- if ((pChn->nVolume > 0) || (oldcutoff < 0x10)
+ if(oldcutoff < 0) oldcutoff = -oldcutoff;
+ if((pChn->nVolume > 0) || (oldcutoff < 0x10)
|| (!(pChn->dwFlags & CHN_FILTER)) || (!(pChn->nLeftVol|pChn->nRightVol)))
SetupChannelFilter(pChn, (pChn->dwFlags & CHN_FILTER) ? false : true);
#endif // NO_FILTER
+ return 4;
}
break;
-
+
// F0.F0.01.xx: Set Resonance
case 0x01:
- if (dwParam < 0x80)
+ if(!isExtended)
{
- pChn->nRestoreResonanceOnNewNote = 0;
- if(!isSmooth)
+ if(param < 0x80)
{
- pChn->nResonance = dwParam;
- } else
- {
- // on the first tick only, calculate step
- if(m_dwSongFlags & SONG_FIRSTTICK)
+ pChn->nRestoreResonanceOnNewNote = 0;
+ if(!isSmooth)
{
- pChn->m_nPlugInitialParamValue = pChn->nResonance;
- // (dwParam & 0x7F) extracts the actual value that we're going to pass
- pChn->m_nPlugParamValueStep = (float)((int)dwParam - pChn->m_nPlugInitialParamValue) / (float)m_nMusicSpeed;
+ pChn->nResonance = param;
+ } else
+ {
+ // on the first tick only, calculate step
+ if(m_dwSongFlags & SONG_FIRSTTICK)
+ {
+ pChn->m_nPlugInitialParamValue = pChn->nResonance;
+ // (dwParam & 0x7F) extracts the actual value that we're going to pass
+ pChn->m_nPlugParamValueStep = (float)((int)param - pChn->m_nPlugInitialParamValue) / (float)GetNumTicksOnCurrentRow();
+ }
+ //update param on all ticks
+ pChn->nResonance = (BYTE) (pChn->m_nPlugInitialParamValue + (m_nTickCount + 1) * pChn->m_nPlugParamValueStep + 0.5);
}
- //update param on all ticks
- pChn->nResonance = (BYTE) (pChn->m_nPlugInitialParamValue + (m_nTickCount + 1) * pChn->m_nPlugParamValueStep + 0.5);
}
- }
-
+
#ifndef NO_FILTER
- SetupChannelFilter(pChn, (pChn->dwFlags & CHN_FILTER) ? false : true);
+ SetupChannelFilter(pChn, (pChn->dwFlags & CHN_FILTER) ? false : true);
#endif // NO_FILTER
+ return 4;
+ }
break;
// F0.F0.02.xx: Set filter mode (high nibble determines filter mode)
case 0x02:
- if (dwParam < 0x20)
+ if(!isExtended)
{
- pChn->nFilterMode = (dwParam >> 4);
+ if(param < 0x20)
+ {
+ pChn->nFilterMode = (param >> 4);
#ifndef NO_FILTER
- SetupChannelFilter(pChn, (pChn->dwFlags & CHN_FILTER) ? false : true);
+ SetupChannelFilter(pChn, (pChn->dwFlags & CHN_FILTER) ? false : true);
#endif // NO_FILTER
+ }
+ return 4;
}
break;
- // F0.F0.03.xx: Set plug dry/wet
+ // F0.F0.03.xx: Set plug dry/wet
case 0x03:
+ if(!isExtended)
{
- const UINT nPlug = GetBestPlugin(nChn, PRIORITISE_CHANNEL, EVEN_IF_MUTED);
- if ((nPlug) && (nPlug <= MAX_MIXPLUGINS) && dwParam < 0x80)
+ const PLUGINDEX nPlug = (plugin != 0) ? plugin : GetBestPlugin(nChn, PRIORITISE_CHANNEL, EVEN_IF_MUTED);
+ if ((nPlug) && (nPlug <= MAX_MIXPLUGINS) && param < 0x80)
{
if(!isSmooth)
{
- m_MixPlugins[nPlug - 1].fDryRatio = 1.0 - (static_cast<float>(dwParam) / 127.0f);
+ m_MixPlugins[nPlug - 1].fDryRatio = 1.0 - (static_cast<float>(param) / 127.0f);
} else
{
// on the first tick only, calculate step
@@ -3242,48 +3360,73 @@
{
pChn->m_nPlugInitialParamValue = m_MixPlugins[nPlug - 1].fDryRatio;
// (dwParam & 0x7F) extracts the actual value that we're going to pass
- pChn->m_nPlugParamValueStep = ((1 - ((float)(dwParam) / 127.0f)) - pChn->m_nPlugInitialParamValue) / (float)m_nMusicSpeed;
+ pChn->m_nPlugParamValueStep = ((1 - ((float)(param) / 127.0f)) - pChn->m_nPlugInitialParamValue) / (float)GetNumTicksOnCurrentRow();
}
//update param on all ticks
m_MixPlugins[nPlug - 1].fDryRatio = pChn->m_nPlugInitialParamValue + (float)(m_nTickCount + 1) * pChn->m_nPlugParamValueStep;
}
}
+ return 4;
}
break;
-
- // F0.F0.{80|n}.xx: Set VST effect parameter n to xx
+ // F0.F0.{80|n}.xx / F0.F1.n.xx: Set VST effect parameter n to xx
default:
- if (nInternalCode & 0x80 || extendedParam)
+ if((macroCode & 0x80) || isExtended)
{
- UINT nPlug = GetBestPlugin(nChn, PRIORITISE_CHANNEL, EVEN_IF_MUTED);
- if ((nPlug) && (nPlug <= MAX_MIXPLUGINS))
+ const PLUGINDEX nPlug = (plugin != 0) ? plugin : GetBestPlugin(nChn, PRIORITISE_CHANNEL, EVEN_IF_MUTED);
+ const UINT plugParam = isExtended ? (0x80 + macroCode) : (macroCode & 0x7F);
+ if((nPlug) && (nPlug <= MAX_MIXPLUGINS))
{
IMixPlugin *pPlugin = m_MixPlugins[nPlug-1].pMixPlugin;
- if ((pPlugin) && (m_MixPlugins[nPlug-1].pMixState))
+ if((pPlugin) && (m_MixPlugins[nPlug-1].pMixState))
{
if(!isSmooth)
{
- pPlugin->SetZxxParameter(extendedParam ? (0x80 + nInternalCode) : (nInternalCode & 0x7F), dwParam & 0x7F);
+ pPlugin->SetZxxParameter(plugParam, param & 0x7F);
} else
{
// on the first tick only, calculate step
if(m_dwSongFlags & SONG_FIRSTTICK)
{
- pChn->m_nPlugInitialParamValue = pPlugin->GetZxxParameter(extendedParam ? (0x80 + nInternalCode) : (nInternalCode & 0x7F));
+ pChn->m_nPlugInitialParamValue = pPlugin->GetZxxParameter(plugParam);
// (dwParam & 0x7F) extracts the actual value that we're going to pass
- pChn->m_nPlugParamValueStep = ((int)(dwParam & 0x7F) - pChn->m_nPlugInitialParamValue) / (float)m_nMusicSpeed;
+ pChn->m_nPlugParamValueStep = ((int)(param & 0x7F) - pChn->m_nPlugInitialParamValue) / (float)GetNumTicksOnCurrentRow();
}
//update param on all ticks
- pPlugin->SetZxxParameter(extendedParam ? (0x80 + nInternalCode) : (nInternalCode & 0x7F), (UINT) (pChn->m_nPlugInitialParamValue + (m_nTickCount + 1) * pChn->m_nPlugParamValueStep + 0.5));
+ pPlugin->SetZxxParameter(plugParam, (UINT) (pChn->m_nPlugInitialParamValue + (m_nTickCount + 1) * pChn->m_nPlugParamValueStep + 0.5));
}
}
}
+ return 4;
}
-
- } // end switch
- } // end internal device
-
+ break;
+ }
+ } else
+ {
+ // Not an internal device. Pass on to appropriate plugin.
+ const UINT nMasterCh = (nChn < GetNumChannels()) ? nChn + 1 : pChn->nMasterChn;
+ if((nMasterCh) && (nMasterCh <= GetNumChannels()))
+ {
+ const PLUGINDEX nPlug = (pChn->dwFlags & CHN_NOFX) ? 0 : ((plugin != 0) ? plugin : GetBestPlugin(nChn, PRIORITISE_CHANNEL, EVEN_IF_MUTED));
+ if((nPlug) && (nPlug <= MAX_MIXPLUGINS))
+ {
+ IMixPlugin *pPlugin = m_MixPlugins[nPlug - 1].pMixPlugin;
+ if ((pPlugin) && (m_MixPlugins[nPlug - 1].pMixState))
+ {
+ // currently, we don't support sending long MIDI messages in one go... split it up
+ for(size_t pos = 0; pos < macroLen; pos += 3)
+ {
+ DWORD curData = 0;
+ memcpy(&curData, macro + pos, min(3, macroLen - pos));
+ pPlugin->MidiSend(curData);
+ }
+ }
+ }
+ }
+ return macroLen;
+ }
+ return 0;
}
@@ -3322,14 +3465,6 @@
if ((pChn->nRowNote >= NOTE_MIN) && (pChn->nRowNote <= NOTE_MAX))
{
- /* if (bPorta)
- pChn->nPos = param;
- else
- pChn->nPos += param; */
- // The code above doesn't make sense at all. If there's a note and no porta, how on earth could nPos be something else than 0?
- // Anyway, keeping a debug assert here, just in case...
- ASSERT(bPorta || pChn->nPos == 0);
-
// XM compatibility: Portamento + Offset = Ignore offset
if(bPorta && IsCompatibleMode(TRK_FASTTRACKER2))
{
Modified: trunk/OpenMPT/soundlib/Sndfile.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Sndfile.cpp 2011-07-30 21:36:06 UTC (rev 946)
+++ trunk/OpenMPT/soundlib/Sndfile.cpp 2011-07-30 22:14:04 UTC (rev 947)
@@ -764,6 +764,12 @@
if ((m_nRestartPos >= Order.size()) || (Order[m_nRestartPos] >= Patterns.Size())) m_nRestartPos = 0;
+ // Fix old nasty broken (non-standard) MIDI configs in files.
+ if(m_dwLastSavedWithVersion && m_dwLastSavedWithVersion < MAKE_VERSION_NUMERIC(1, 20, 00, 00))
+ {
+ FixMIDIConfigStrings(m_MidiCfg);
+ }
+
// plugin loader
string sNotFound;
std::list<PLUGINDEX> notFoundIDs;
@@ -918,13 +924,13 @@
//-----------------------------
{
MemsetZero(m_MidiCfg);
- lstrcpy(m_MidiCfg.szMidiGlb[MIDIOUT_START], "FF");
- lstrcpy(m_MidiCfg.szMidiGlb[MIDIOUT_STOP], "FC");
- lstrcpy(m_MidiCfg.szMidiGlb[MIDIOUT_NOTEON], "9c n v");
- lstrcpy(m_MidiCfg.szMidiGlb[MIDIOUT_NOTEOFF], "9c n 0");
- lstrcpy(m_MidiCfg.szMidiGlb[MIDIOUT_PROGRAM], "Cc p");
- lstrcpy(m_MidiCfg.szMidiSFXExt[0], "F0F000z");
- for (int iz=0; iz<16; iz++) wsprintf(m_MidiCfg.szMidiZXXExt[iz], "F0F001%02X", iz*8);
+ strcpy(m_MidiCfg.szMidiGlb[MIDIOUT_START], "FF");
+ strcpy(m_MidiCfg.szMidiGlb[MIDIOUT_STOP], "FC");
+ strcpy(m_MidiCfg.szMidiGlb[MIDIOUT_NOTEON], "9c n v");
+ strcpy(m_MidiCfg.szMidiGlb[MIDIOUT_NOTEOFF], "9c n 0");
+ strcpy(m_MidiCfg.szMidiGlb[MIDIOUT_PROGRAM], "Cc p");
+ strcpy(m_MidiCfg.szMidiSFXExt[0], "F0F000z");
+ CModDoc::CreateZxxFromType(m_MidiCfg.szMidiZXXExt, zxx_reso4Bit);
}
@@ -2902,3 +2908,38 @@
{
m_bITBidiMode = IsCompatibleMode(TRK_IMPULSETRACKER);
}
+
+
+void FixMIDIConfigString(char *line)
+//----------------------------------
+{
+ for(size_t i = 0; i < MACRO_LENGTH; i++)
+ {
+ if(line[i] >= 'a' && line[i] <= 'f') // both A-F and a-f were treated as hex constants
+ {
+ line[i] = line[i] - 'a' + 'A';
+ } else if(line[i] == 'K' || line[i] == 'k') // channel was K or k
+ {
+ line[i] = 'c';
+ } else if(line[i] == 'X' || line[i] == 'x' || line[i] == 'Y' || line[i] == 'y') // those were pointless
+ {
+ line[i] = 'z';
+ }
+ }
+}
+
+
+// Fix old-format (not conforming to IT's MIDI macro definitions) MIDI config strings.
+void CSoundFile::FixMIDIConfigStrings(MODMIDICFG &midiCfg)
+//--------------------------------------------------------
+{
+ for(size_t i = 0; i < CountOf(midiCfg.szMidiSFXExt); i++)
+ {
+ FixMIDIConfigString(midiCfg.szMidiSFXExt[i]);
+ }
+ for(size_t i = 0; i < CountOf(midiCfg.szMidiZXXExt); i++)
+ {
+ FixMIDIConfigString(midiCfg.szMidiZXXExt[i]);
+ }
+}
+
Modified: trunk/OpenMPT/soundlib/Sndfile.h
===================================================================
--- trunk/OpenMPT/soundlib/Sndfile.h 2011-07-30 21:36:06 UTC (rev 946)
+++ trunk/OpenMPT/soundlib/Sndfile.h 2011-07-30 22:14:04 UTC (rev 947)
@@ -211,6 +211,7 @@
LONG nRealVolume, nRealPan;
LONG nVolume, nPan, nFadeOutVol;
LONG nPeriod, nC5Speed, nPortamentoDest;
+ int nCalcVolume; // Calculated channel volume, 14-Bit (without global volume, pre-amp etc applied) - for MIDI macros
MODINSTRUMENT *pModInstrument; // Currently assigned instrument slot
MODCHANNEL_ENVINFO VolEnv, PanEnv, PitchEnv; // Envelope playback info
MODSAMPLE *pModSample; // Currently assigned sample slot
@@ -230,6 +231,7 @@
BYTE nRestoreResonanceOnNewNote; //Like above
BYTE nRestoreCutoffOnNewNote; //Like above
BYTE nNote, nNNA;
+ BYTE nLastNote; // Last note, ignoring note offs and cuts - for MIDI macros
BYTE nNewNote, nNewIns, nCommand, nArpeggio;
BYTE nOldVolumeSlide, nOldFineVolUpDown;
BYTE nOldPortaUpDown, nOldFinePortaUpDown;
@@ -453,9 +455,9 @@
#define MACRO_LENGTH 32 // max number of chars per macro
struct MODMIDICFG
{
- CHAR szMidiGlb[9][MACRO_LENGTH];
- CHAR szMidiSFXExt[16][MACRO_LENGTH];
- CHAR szMidiZXXExt[128][MACRO_LENGTH];
+ char szMidiGlb[9][MACRO_LENGTH]; // Global MIDI macros
+ char szMidiSFXExt[16][MACRO_LENGTH]; // Parametric MIDI macros
+ char szMidiZXXExt[128][MACRO_LENGTH]; // Fixed MIDI macros
};
STATIC_ASSERT(sizeof(MODMIDICFG) == 4896); // this is directly written to files, so the size must be correct!
@@ -778,6 +780,8 @@
bool ReadJ2B(const LPCBYTE lpStream, const DWORD dwMemLength);
bool ReadMID(const LPCBYTE lpStream, DWORD dwMemLength);
+ static void FixMIDIConfigStrings(MODMIDICFG &midiCfg);
+
// Save Functions
#ifndef MODPLUG_NO_FILESAVE
UINT WriteSample(FILE *f, MODSAMPLE *pSmp, UINT nFlags, UINT nMaxLen=0);
@@ -942,7 +946,9 @@
void ExtendedS3MCommands(UINT nChn, UINT param);
void ExtendedChannelEffect(MODCHANNEL *, UINT param);
inline void InvertLoop(MODCHANNEL* pChn);
- void ProcessMidiMacro(UINT nChn, bool isSmooth, LPCSTR pszMidiMacro, UINT param = 0);
+ void ProcessMacroOnChannel(CHANNELINDEX nChn);
+ void ProcessMIDIMacro(CHANNELINDEX nChn, bool isSmooth, char *macro, uint8 param = 0, PLUGINDEX plugin = 0);
+ size_t SendMIDIData(CHANNELINDEX nChn, bool isSmooth, const unsigned char *macro, size_t macroLen, PLUGINDEX plugin);
void SetupChannelFilter(MODCHANNEL *pChn, bool bReset, int flt_modifier = 256) const;
// Low-Level effect processing
void DoFreqSlide(MODCHANNEL *pChn, LONG nFreqSlide);
Modified: trunk/OpenMPT/soundlib/Sndmix.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Sndmix.cpp 2011-07-30 21:36:06 UTC (rev 946)
+++ trunk/OpenMPT/soundlib/Sndmix.cpp 2011-07-30 22:14:04 UTC (rev 947)
@@ -1220,6 +1220,7 @@
pChn->dwFlags |= CHN_NOTEFADE;
pChn->nFadeOutVol = 0;
pChn->nRealVolume = 0;
+ pChn->nCalcVolume = 0;
}
}
}
@@ -1922,6 +1923,12 @@
// Check for unused channel
if ((pChn->dwFlags & CHN_MUTE) || ((nChn >= m_nChannels) && (!pChn->nLength)))
{
+ if(nChn < m_nChannels)
+ {
+ // Process MIDI macros on channels that are currently muted.
+ ProcessMacroOnChannel(nChn);
+ }
+
pChn->nVUMeter = 0;
#ifdef ENABLE_STEREOVU
pChn->nLeftVU = pChn->nRightVU = 0;
@@ -1944,6 +1951,7 @@
// Reset channel data
pChn->nInc = 0;
pChn->nRealVolume = 0;
+ pChn->nCalcVolume = 0;
pChn->nRampLength = 0;
@@ -1955,7 +1963,11 @@
// Calc Frequency
int period;
- if (pChn->nPeriod && pChn->nLength)
+
+ // Also process envelopes etc. when there's a plugin on this channel, for possible fake automation using volume and pan data.
+ // We only care about master channels, though, since automation only "happens" on them.
+ const bool plugAssigned = (nChn < m_nChannels) && (ChnSettings[nChn].nMixPlugin || (pChn->pModInstrument != nullptr && pChn->pModInstrument->nMixPlug));
+ if ((pChn->nPeriod && pChn->nLength) || plugAssigned)
{
int vol = pChn->nVolume;
@@ -2004,6 +2016,9 @@
pChn->nRealVolume = _muldiv(vol * m_nGlobalVolume, pChn->nGlobalVol * pChn->nInsVol, 1 << 20);
}
}
+
+ pChn->nCalcVolume = vol; // Update calculated volume for MIDI macros
+
if (pChn->nPeriod < m_nMinPeriod) pChn->nPeriod = m_nMinPeriod;
period = pChn->nPeriod;
if ((pChn->dwFlags & (CHN_GLISSANDO|CHN_PORTAMENTO)) == (CHN_GLISSANDO|CHN_PORTAMENTO))
@@ -2021,6 +2036,14 @@
ProcessPanbrello(pChn);
+ }
+
+ // Now that all relevant envelopes etc. have been processed, we can parse the MIDI macro data.
+ ProcessMacroOnChannel(nChn);
+
+ // After MIDI macros have been processed, we can also process the pitch / filter envelope and other pitch-related things.
+ if (pChn->nPeriod && pChn->nLength)
+ {
int nPeriodFrac = 0;
ProcessPitchFilterEnvelope(pChn, period);
@@ -2075,6 +2098,7 @@
pChn->nFadeOutVol = 0;
pChn->dwFlags |= CHN_NOTEFADE;
pChn->nRealVolume = 0;
+ pChn->nCalcVolume = 0;
}
UINT ninc = _muldiv(freq, 0x10000, gdwMixingFreq);
@@ -2303,6 +2327,22 @@
}
+void CSoundFile::ProcessMacroOnChannel(CHANNELINDEX nChn)
+//-------------------------------------------------------
+{
+ MODCHANNEL *pChn = &Chn[nChn];
+ if(nChn < m_nChannels && pChn->nRowCommand == CMD_MIDI || pChn->nRowCommand == CMD_SMOOTHMIDI)
+ {
+ // Only smooth MIDI macros are processed on every tick
+ if((pChn->nRowCommand == CMD_MIDI) && !(m_dwSongFlags & SONG_FIRSTTICK)) return;
+ if(pChn->nRowParam < 0x80)
+ ProcessMIDIMacro(nChn, (pChn->nRowCommand == CMD_SMOOTHMIDI), m_MidiCfg.szMidiSFXExt[pChn->nActiveMacro], pChn->nRowParam);
+ else
+ ProcessMIDIMacro(nChn, (pChn->nRowCommand == CMD_SMOOTHMIDI), m_MidiCfg.szMidiZXXExt[(pChn->nRowParam & 0x7F)], 0);
+ }
+}
+
+
#ifdef MODPLUG_TRACKER
VOID CSoundFile::ProcessMidiOut(UINT nChn, MODCHANNEL *pChn) //rewbs.VSTdelay: added arg
@@ -2329,6 +2369,7 @@
// Get instrument info and plugin reference
MODINSTRUMENT *pIns = pChn->pModInstrument;
+ PLUGINDEX nPlugin = 0;
IMixPlugin *pPlugin = nullptr;
if ((instr) && (instr < MAX_INSTRUMENTS))
@@ -2339,7 +2380,7 @@
// Check instrument plugins
if ((pIns->nMidiChannel >= 1) && (pIns->nMidiChannel <= 16))
{
- UINT nPlugin = GetBestPlugin(nChn, PRIORITISE_INSTRUMENT, RESPECT_MUTES);
+ nPlugin = GetBestPlugin(nChn, PRIORITISE_INSTRUMENT, RESPECT_MUTES);
if ((nPlugin) && (nPlugin <= MAX_MIXPLUGINS))
{
pPlugin = m_MixPlugins[nPlugin-1].pMixPlugin;
@@ -2387,6 +2428,8 @@
MODCOMMAND::NOTE realNote = note;
if((note >= NOTE_MIN) && (note <= NOTE_MAX))
realNote = pIns->NoteMap[note - 1];
+ // Experimental VST panning
+ //ProcessMIDIMacro(nChn, false, m_MidiCfg.szMidiGlb[MIDIOUT_PAN], 0, nPlugin);
pPlugin->MidiCommand(pIns->nMidiChannel, pIns->nMidiProgram, pIns->wMidiBank, realNote, velocity, nChn);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sag...@us...> - 2011-07-30 21:36:12
|
Revision: 946
http://modplug.svn.sourceforge.net/modplug/?rev=946&view=rev
Author: saga-games
Date: 2011-07-30 21:36:06 +0000 (Sat, 30 Jul 2011)
Log Message:
-----------
[Ref] Hey, we could even move the ramping code around...
Modified Paths:
--------------
trunk/OpenMPT/soundlib/Sndfile.h
trunk/OpenMPT/soundlib/Sndmix.cpp
Modified: trunk/OpenMPT/soundlib/Sndfile.h
===================================================================
--- trunk/OpenMPT/soundlib/Sndfile.h 2011-07-30 21:27:33 UTC (rev 945)
+++ trunk/OpenMPT/soundlib/Sndfile.h 2011-07-30 21:36:06 UTC (rev 946)
@@ -912,6 +912,8 @@
void ProcessVibrato(MODCHANNEL *pChn, int &period, CTuning::RATIOTYPE &vibratoFactor);
void ProcessSampleAutoVibrato(MODCHANNEL *pChn, int &period, CTuning::RATIOTYPE &vibratoFactor, int &nPeriodFrac);
+ void ProcessRamping(MODCHANNEL *pChn);
+
protected:
// Channel Effects
void PortamentoUp(MODCHANNEL *pChn, UINT param, const bool fineAsRegular = false);
Modified: trunk/OpenMPT/soundlib/Sndmix.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Sndmix.cpp 2011-07-30 21:27:33 UTC (rev 945)
+++ trunk/OpenMPT/soundlib/Sndmix.cpp 2011-07-30 21:36:06 UTC (rev 946)
@@ -874,6 +874,10 @@
}
+////////////////////////////////////////////////////////////////////////////////////////////
+// Channel effect processing
+
+
void CSoundFile::ProcessVolumeSwing(MODCHANNEL *pChn, int &vol)
//-------------------------------------------------------------
{
@@ -1729,6 +1733,65 @@
}
+void CSoundFile::ProcessRamping(MODCHANNEL *pChn)
+//-----------------------------------------------
+{
+ pChn->nRightRamp = pChn->nLeftRamp = 0;
+ if ((pChn->dwFlags & CHN_VOLUMERAMP) // && gnVolumeRampSamples //rewbs: this allows us to use non ramping mix functions if ramping is 0
+ && ((pChn->nRightVol != pChn->nNewRightVol) || (pChn->nLeftVol != pChn->nNewLeftVol)))
+ {
+ LONG nRampLength = gnVolumeRampSamples;
+ // -> CODE#0027
+ // -> DESC="per-instrument volume ramping setup"
+ BOOL enableCustomRamp = pChn->pModInstrument && (m_nType & (MOD_TYPE_IT | MOD_TYPE_MPT | MOD_TYPE_XM));
+ if(enableCustomRamp) nRampLength = pChn->pModInstrument->nVolRamp ? (gdwMixingFreq * pChn->pModInstrument->nVolRamp / 100000) : gnVolumeRampSamples;
+ if(!nRampLength) nRampLength = 1;
+ // -! NEW_FEATURE#0027
+ LONG nRightDelta = ((pChn->nNewRightVol - pChn->nRightVol) << VOLUMERAMPPRECISION);
+ LONG nLeftDelta = ((pChn->nNewLeftVol - pChn->nLeftVol) << VOLUMERAMPPRECISION);
+#ifndef FASTSOUNDLIB
+ // -> CODE#0027
+ // -> DESC="per-instrument volume ramping setup "
+ // if ((gdwSoundSetup & SNDMIX_DIRECTTODISK)
+ // || ((gdwSysInfo & (SYSMIX_ENABLEMMX|SYSMIX_FASTCPU))
+ // && (gdwSoundSetup & SNDMIX_HQRESAMPLER) && (gnCPUUsage <= 50)))
+ if ((gdwSoundSetup & SNDMIX_DIRECTTODISK)
+ || ((gdwSysInfo & (SYSMIX_ENABLEMMX|SYSMIX_FASTCPU))
+ && (gdwSoundSetup & SNDMIX_HQRESAMPLER) && (gnCPUUsage <= 50) && !(enableCustomRamp && pChn->pModInstrument->nVolRamp)))
+ // -! NEW_FEATURE#0027
+ {
+ if ((pChn->nRightVol|pChn->nLeftVol) && (pChn->nNewRightVol|pChn->nNewLeftVol) && (!(pChn->dwFlags & CHN_FASTVOLRAMP)))
+ {
+ nRampLength = m_nBufferCount;
+ if (nRampLength > (1 << (VOLUMERAMPPRECISION-1))) nRampLength = (1 << (VOLUMERAMPPRECISION-1));
+ if (nRampLength < (LONG)gnVolumeRampSamples) nRampLength = gnVolumeRampSamples;
+ }
+ }
+#endif // FASTSOUNDLIB
+ pChn->nRightRamp = nRightDelta / nRampLength;
+ pChn->nLeftRamp = nLeftDelta / nRampLength;
+ pChn->nRightVol = pChn->nNewRightVol - ((pChn->nRightRamp * nRampLength) >> VOLUMERAMPPRECISION);
+ pChn->nLeftVol = pChn->nNewLeftVol - ((pChn->nLeftRamp * nRampLength) >> VOLUMERAMPPRECISION);
+ if (pChn->nRightRamp|pChn->nLeftRamp)
+ {
+ pChn->nRampLength = nRampLength;
+ } else
+ {
+ pChn->dwFlags &= ~CHN_VOLUMERAMP;
+ pChn->nRightVol = pChn->nNewRightVol;
+ pChn->nLeftVol = pChn->nNewLeftVol;
+ }
+ } else
+ {
+ pChn->dwFlags &= ~CHN_VOLUMERAMP;
+ pChn->nRightVol = pChn->nNewRightVol;
+ pChn->nLeftVol = pChn->nNewLeftVol;
+ }
+ pChn->nRampRightVol = pChn->nRightVol << VOLUMERAMPPRECISION;
+ pChn->nRampLeftVol = pChn->nLeftVol << VOLUMERAMPPRECISION;
+}
+
+
////////////////////////////////////////////////////////////////////////////////////////////
// Handles envelopes & mixer setup
@@ -2187,64 +2250,13 @@
pChn->nNewRightVol >>= extraAttenuation;
pChn->nNewLeftVol >>= extraAttenuation;
- pChn->nRightRamp = pChn->nLeftRamp = 0;
// Dolby Pro-Logic Surround
if ((pChn->dwFlags & CHN_SURROUND) && (gnChannels == 2)) pChn->nNewLeftVol = - pChn->nNewLeftVol;
// Checking Ping-Pong Loops
if (pChn->dwFlags & CHN_PINGPONGFLAG) pChn->nInc = -pChn->nInc;
// Setting up volume ramp
- if ((pChn->dwFlags & CHN_VOLUMERAMP) // && gnVolumeRampSamples //rewbs: this allows us to use non ramping mix functions if ramping is 0
- && ((pChn->nRightVol != pChn->nNewRightVol) || (pChn->nLeftVol != pChn->nNewLeftVol)))
- {
- LONG nRampLength = gnVolumeRampSamples;
-// -> CODE#0027
-// -> DESC="per-instrument volume ramping setup"
- BOOL enableCustomRamp = pChn->pModInstrument && (m_nType & (MOD_TYPE_IT | MOD_TYPE_MPT | MOD_TYPE_XM));
- if(enableCustomRamp) nRampLength = pChn->pModInstrument->nVolRamp ? (gdwMixingFreq * pChn->pModInstrument->nVolRamp / 100000) : gnVolumeRampSamples;
- if(!nRampLength) nRampLength = 1;
-// -! NEW_FEATURE#0027
- LONG nRightDelta = ((pChn->nNewRightVol - pChn->nRightVol) << VOLUMERAMPPRECISION);
- LONG nLeftDelta = ((pChn->nNewLeftVol - pChn->nLeftVol) << VOLUMERAMPPRECISION);
-#ifndef FASTSOUNDLIB
-// -> CODE#0027
-// -> DESC="per-instrument volume ramping setup "
-// if ((gdwSoundSetup & SNDMIX_DIRECTTODISK)
-// || ((gdwSysInfo & (SYSMIX_ENABLEMMX|SYSMIX_FASTCPU))
-// && (gdwSoundSetup & SNDMIX_HQRESAMPLER) && (gnCPUUsage <= 50)))
- if ((gdwSoundSetup & SNDMIX_DIRECTTODISK)
- || ((gdwSysInfo & (SYSMIX_ENABLEMMX|SYSMIX_FASTCPU))
- && (gdwSoundSetup & SNDMIX_HQRESAMPLER) && (gnCPUUsage <= 50) && !(enableCustomRamp && pChn->pModInstrument->nVolRamp)))
-// -! NEW_FEATURE#0027
- {
- if ((pChn->nRightVol|pChn->nLeftVol) && (pChn->nNewRightVol|pChn->nNewLeftVol) && (!(pChn->dwFlags & CHN_FASTVOLRAMP)))
- {
- nRampLength = m_nBufferCount;
- if (nRampLength > (1 << (VOLUMERAMPPRECISION-1))) nRampLength = (1 << (VOLUMERAMPPRECISION-1));
- if (nRampLength < (LONG)gnVolumeRampSamples) nRampLength = gnVolumeRampSamples;
- }
- }
-#endif // FASTSOUNDLIB
- pChn->nRightRamp = nRightDelta / nRampLength;
- pChn->nLeftRamp = nLeftDelta / nRampLength;
- pChn->nRightVol = pChn->nNewRightVol - ((pChn->nRightRamp * nRampLength) >> VOLUMERAMPPRECISION);
- pChn->nLeftVol = pChn->nNewLeftVol - ((pChn->nLeftRamp * nRampLength) >> VOLUMERAMPPRECISION);
- if (pChn->nRightRamp|pChn->nLeftRamp)
- {
- pChn->nRampLength = nRampLength;
- } else
- {
- pChn->dwFlags &= ~CHN_VOLUMERAMP;
- pChn->nRightVol = pChn->nNewRightVol;
- pChn->nLeftVol = pChn->nNewLeftVol;
- }
- } else
- {
- pChn->dwFlags &= ~CHN_VOLUMERAMP;
- pChn->nRightVol = pChn->nNewRightVol;
- pChn->nLeftVol = pChn->nNewLeftVol;
- }
- pChn->nRampRightVol = pChn->nRightVol << VOLUMERAMPPRECISION;
- pChn->nRampLeftVol = pChn->nLeftVol << VOLUMERAMPPRECISION;
+ ProcessRamping(pChn);
+
// Adding the channel in the channel list
ChnMix[m_nMixChannels++] = nChn;
} else
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sag...@us...> - 2011-07-30 21:27:41
|
Revision: 945
http://modplug.svn.sourceforge.net/modplug/?rev=945&view=rev
Author: saga-games
Date: 2011-07-30 21:27:33 +0000 (Sat, 30 Jul 2011)
Log Message:
-----------
[Ref] Shuffled around a lot of effect processing in sndmix.cpp (with an upcoming commit in mind...)
Modified Paths:
--------------
trunk/OpenMPT/soundlib/Sndfile.h
trunk/OpenMPT/soundlib/Sndmix.cpp
Modified: trunk/OpenMPT/soundlib/Sndfile.h
===================================================================
--- trunk/OpenMPT/soundlib/Sndfile.h 2011-07-30 20:40:29 UTC (rev 944)
+++ trunk/OpenMPT/soundlib/Sndfile.h 2011-07-30 21:27:33 UTC (rev 945)
@@ -18,6 +18,7 @@
#include "midi.h"
#include "Snd_defs.h"
#include "Endianness.h"
+#include "tuning.h"
// For VstInt32 and stuff - a stupid workaround for IMixPlugin.
#ifndef NO_VST
@@ -28,8 +29,8 @@
typedef intptr_t VstIntPtr;
#endif
-class CTuningBase;
-typedef CTuningBase CTuning;
+//class CTuningBase;
+//typedef CTuningBase CTuning;
// Sample Struct
@@ -887,7 +888,31 @@
void SetTempo(UINT param, bool setAsNonModcommand = false);
void SetSpeed(UINT param);
-private:
+protected:
+ // Channel effect processing
+ void ProcessVolumeSwing(MODCHANNEL *pChn, int &vol);
+ void ProcessPanningSwing(MODCHANNEL *pChn);
+ void ProcessTremolo(MODCHANNEL *pChn, int &vol);
+ void ProcessTremor(MODCHANNEL *pChn, int &vol);
+
+ void ProcessVolumeEnvelope(MODCHANNEL *pChn, int &vol);
+ void ProcessPanningEnvelope(MODCHANNEL *pChn);
+ void ProcessPitchFilterEnvelope(MODCHANNEL *pChn, int &period);
+
+ void IncrementVolumeEnvelopePosition(MODCHANNEL *pChn);
+ void IncrementPanningEnvelopePosition(MODCHANNEL *pChn);
+ void IncrementPitchFilterEnvelopePosition(MODCHANNEL *pChn);
+
+ void ProcessInstrumentFade(MODCHANNEL *pChn, int &vol);
+
+ void ProcessPitchPanSeparation(MODCHANNEL *pChn);
+ void ProcessPanbrello(MODCHANNEL *pChn);
+
+ void ProcessArpeggio(MODCHANNEL *pChn, int &period, CTuning::NOTEINDEXTYPE &arpeggioSteps);
+ void ProcessVibrato(MODCHANNEL *pChn, int &period, CTuning::RATIOTYPE &vibratoFactor);
+ void ProcessSampleAutoVibrato(MODCHANNEL *pChn, int &period, CTuning::RATIOTYPE &vibratoFactor, int &nPeriodFrac);
+
+protected:
// Channel Effects
void PortamentoUp(MODCHANNEL *pChn, UINT param, const bool fineAsRegular = false);
void PortamentoDown(MODCHANNEL *pChn, UINT param, const bool fineAsRegular = false);
@@ -1046,7 +1071,7 @@
bool ReadFixedLineLengthMessage(const BYTE *data, const size_t length, const size_t lineLength, const size_t lineEndingLength, void (*pTextConverter)(char &) = nullptr);
public:
- int GetVolEnvValueFromPosition(int position, MODINSTRUMENT* pIns) const;
+ int GetVolEnvValueFromPosition(int position, const MODINSTRUMENT* pIns) const;
void ResetChannelEnvelopes(MODCHANNEL *pChn);
void ResetChannelEnvelope(MODCHANNEL_ENVINFO &env);
void SetDefaultInstrumentValues(MODINSTRUMENT *pIns);
Modified: trunk/OpenMPT/soundlib/Sndmix.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Sndmix.cpp 2011-07-30 20:40:29 UTC (rev 944)
+++ trunk/OpenMPT/soundlib/Sndmix.cpp 2011-07-30 21:27:33 UTC (rev 945)
@@ -823,7 +823,7 @@
}
// Reset channel values
MODCHANNEL *pChn = Chn;
- MODCOMMAND *m = Patterns[m_nPattern] + m_nRow * m_nChannels;
+ MODCOMMAND *m = Patterns[m_nPattern].GetRow(m_nRow);
for (UINT nChn=0; nChn<m_nChannels; pChn++, nChn++, m++)
{
pChn->nRowNote = m->note;
@@ -874,6 +874,861 @@
}
+void CSoundFile::ProcessVolumeSwing(MODCHANNEL *pChn, int &vol)
+//-------------------------------------------------------------
+{
+ if(pChn->nVolSwing)
+ {
+ if(GetModFlag(MSF_OLDVOLSWING))
+ {
+ vol += pChn->nVolSwing;
+ }
+ else
+ {
+ pChn->nVolume += pChn->nVolSwing;
+ pChn->nVolume = CLAMP(pChn->nVolume, 0, 256);
+ vol = pChn->nVolume;
+ pChn->nVolSwing = 0;
+ }
+ }
+
+ vol = CLAMP(vol, 0, 256);
+}
+
+
+void CSoundFile::ProcessPanningSwing(MODCHANNEL *pChn)
+//----------------------------------------------------
+{
+ if(GetModFlag(MSF_OLDVOLSWING))
+ {
+ pChn->nRealPan = pChn->nPan + pChn->nPanSwing;
+ }
+ else
+ {
+ pChn->nPan += pChn->nPanSwing;
+ pChn->nPan = CLAMP(pChn->nPan, 0, 256);
+ pChn->nPanSwing = 0;
+ pChn->nRealPan = pChn->nPan;
+ }
+
+ pChn->nRealPan = CLAMP(pChn->nRealPan, 0, 256);
+}
+
+
+void CSoundFile::ProcessTremolo(MODCHANNEL *pChn, int &vol)
+//---------------------------------------------------------
+{
+ if (pChn->dwFlags & CHN_TREMOLO)
+ {
+ UINT trempos = pChn->nTremoloPos;
+ // IT compatibility: Why would you not want to execute tremolo at volume 0?
+ if (vol > 0 || IsCompatibleMode(TRK_IMPULSETRACKER))
+ {
+ // IT compatibility: We don't need a different attenuation here because of the different tables we're going to use
+ const int tremattn = (m_nType & MOD_TYPE_XM || IsCompatibleMode(TRK_IMPULSETRACKER)) ? 5 : 6;
+ switch (pChn->nTremoloType & 0x03)
+ {
+ case 1:
+ // IT compatibility: IT has its own, more precise tables
+ vol += ((IsCompatibleMode(TRK_IMPULSETRACKER) ? ITRampDownTable[trempos] : ModRampDownTable[trempos]) * (int)pChn->nTremoloDepth) >> tremattn;
+ break;
+ case 2:
+ // IT compatibility: IT has its own, more precise tables
+ vol += ((IsCompatibleMode(TRK_IMPULSETRACKER) ? ITSquareTable[trempos] : ModSquareTable[trempos]) * (int)pChn->nTremoloDepth) >> tremattn;
+ break;
+ case 3:
+ //IT compatibility 19. Use random values
+ if(IsCompatibleMode(TRK_IMPULSETRACKER))
+ vol += (((rand() & 0x7F) - 0x40) * (int)pChn->nTremoloDepth) >> tremattn;
+ else
+ vol += (ModRandomTable[trempos] * (int)pChn->nTremoloDepth) >> tremattn;
+ break;
+ default:
+ // IT compatibility: IT has its own, more precise tables
+ vol += ((IsCompatibleMode(TRK_IMPULSETRACKER) ? ITSinusTable[trempos] : ModSinusTable[trempos]) * (int)pChn->nTremoloDepth) >> tremattn;
+ }
+ }
+ if ((m_nTickCount) || ((m_nType & (MOD_TYPE_STM|MOD_TYPE_S3M|MOD_TYPE_IT|MOD_TYPE_MPT)) && (!(m_dwSongFlags & SONG_ITOLDEFFECTS))))
+ {
+ // IT compatibility: IT has its own, more precise tables
+ if(IsCompatibleMode(TRK_IMPULSETRACKER))
+ pChn->nTremoloPos = (pChn->nTremoloPos + 4 * pChn->nTremoloSpeed) & 0xFF;
+ else
+ pChn->nTremoloPos = (pChn->nTremoloPos + pChn->nTremoloSpeed) & 0x3F;
+ }
+ }
+}
+
+
+void CSoundFile::ProcessTremor(MODCHANNEL *pChn, int &vol)
+//--------------------------------------------------------
+{
+ if(pChn->nCommand == CMD_TREMOR)
+ {
+ // IT compatibility 12. / 13.: Tremor
+ if(IsCompatibleMode(TRK_IMPULSETRACKER))
+ {
+ if ((pChn->nTremorCount & 128) && pChn->nLength)
+ {
+ if (pChn->nTremorCount == 128)
+ pChn->nTremorCount = (pChn->nTremorParam >> 4) | 192;
+ else if (pChn->nTremorCount == 192)
+ pChn->nTremorCount = (pChn->nTremorParam & 0xf) | 128;
+ else
+ pChn->nTremorCount--;
+ }
+
+ if ((pChn->nTremorCount & 192) == 128)
+ vol = 0;
+ }
+ else
+ {
+ UINT n = (pChn->nTremorParam >> 4) + (pChn->nTremorParam & 0x0F);
+ UINT ontime = pChn->nTremorParam >> 4;
+ if ((!(m_nType & (MOD_TYPE_IT|MOD_TYPE_MPT))) || (m_dwSongFlags & SONG_ITOLDEFFECTS))
+ {
+ n += 2;
+ ontime++;
+ }
+ UINT tremcount = (UINT)pChn->nTremorCount;
+ if (tremcount >= n) tremcount = 0;
+ if ((m_nTickCount) || (m_nType & (MOD_TYPE_S3M|MOD_TYPE_IT|MOD_TYPE_MPT)))
+ {
+ if (tremcount >= ontime) vol = 0;
+ pChn->nTremorCount = (BYTE)(tremcount + 1);
+ }
+ }
+ pChn->dwFlags |= CHN_FASTVOLRAMP;
+ }
+}
+
+
+void CSoundFile::ProcessVolumeEnvelope(MODCHANNEL *pChn, int &vol)
+//----------------------------------------------------------------
+{
+ const MODINSTRUMENT *pIns = pChn->pModInstrument;
+
+ // IT Compatibility: S77 does not disable the volume envelope, it just pauses the counter
+ // Problem: This pauses on the wrong tick at the moment...
+ if (((pChn->dwFlags & CHN_VOLENV) || ((pIns->VolEnv.dwFlags & ENV_ENABLED) && IsCompatibleMode(TRK_IMPULSETRACKER))) && (pIns->VolEnv.nNodes))
+ {
+ int envvol = GetVolEnvValueFromPosition(pChn->VolEnv.nEnvPosition, pIns);
+
+ // if we are in the release portion of the envelope,
+ // rescale envelope factor so that it is proportional to the release point
+ // and release envelope beginning.
+ if (pIns->VolEnv.nReleaseNode != ENV_RELEASE_NODE_UNSET
+ && pChn->VolEnv.nEnvPosition >= pIns->VolEnv.Ticks[pIns->VolEnv.nReleaseNode]
+ && pChn->VolEnv.nEnvValueAtReleaseJump != NOT_YET_RELEASED)
+ {
+ int envValueAtReleaseJump = pChn->VolEnv.nEnvValueAtReleaseJump;
+ int envValueAtReleaseNode = pIns->VolEnv.Values[pIns->VolEnv.nReleaseNode] << 2;
+
+ //If we have just hit the release node, force the current env value
+ //to be that of the release node. This works around the case where
+ // we have another node at the same position as the release node.
+ if (pChn->VolEnv.nEnvPosition == pIns->VolEnv.Ticks[pIns->VolEnv.nReleaseNode])
+ envvol = envValueAtReleaseNode;
+
+ int relativeVolumeChange = (envvol - envValueAtReleaseNode) * 2;
+ envvol = envValueAtReleaseJump + relativeVolumeChange;
+ }
+ vol = (vol * CLAMP(envvol, 0, 512)) >> 8;
+ }
+
+}
+
+
+void CSoundFile::ProcessPanningEnvelope(MODCHANNEL *pChn)
+//-------------------------------------------------------
+{
+ const MODINSTRUMENT *pIns = pChn->pModInstrument;
+
+ // IT Compatibility: S79 does not disable the panning envelope, it just pauses the counter
+ // Problem: This pauses on the wrong tick at the moment...
+ if (((pChn->dwFlags & CHN_PANENV) || ((pIns->PanEnv.dwFlags & ENV_ENABLED) && IsCompatibleMode(TRK_IMPULSETRACKER))) && (pIns->PanEnv.nNodes))
+ {
+ int envpos = pChn->PanEnv.nEnvPosition;
+ UINT pt = pIns->PanEnv.nNodes - 1;
+ for (UINT i=0; i<(UINT)(pIns->PanEnv.nNodes-1); i++)
+ {
+ if (envpos <= pIns->PanEnv.Ticks[i])
+ {
+ pt = i;
+ break;
+ }
+ }
+ int x2 = pIns->PanEnv.Ticks[pt], y2 = pIns->PanEnv.Values[pt];
+ int x1, envpan;
+ if (envpos >= x2)
+ {
+ envpan = y2;
+ x1 = x2;
+ } else if (pt)
+ {
+ envpan = pIns->PanEnv.Values[pt-1];
+ x1 = pIns->PanEnv.Ticks[pt-1];
+ } else
+ {
+ envpan = 128;
+ x1 = 0;
+ }
+ if ((x2 > x1) && (envpos > x1))
+ {
+ envpan += ((envpos - x1) * (y2 - envpan)) / (x2 - x1);
+ }
+
+ envpan = CLAMP(envpan, 0, 64);
+ int pan = pChn->nPan;
+ if (pan >= 128)
+ {
+ pan += ((envpan - 32) * (256 - pan)) / 32;
+ } else
+ {
+ pan += ((envpan - 32) * (pan)) / 32;
+ }
+
+ pChn->nRealPan = CLAMP(pan, 0, 256);
+ }
+}
+
+
+void CSoundFile::ProcessPitchFilterEnvelope(MODCHANNEL *pChn, int &period)
+//------------------------------------------------------------------------
+{
+ const MODINSTRUMENT *pIns = pChn->pModInstrument;
+
+ // IT Compatibility: S7B does not disable the pitch envelope, it just pauses the counter
+ // Problem: This pauses on the wrong tick at the moment...
+ if ((pIns) && ((pChn->dwFlags & CHN_PITCHENV) || ((pIns->PitchEnv.dwFlags & ENV_ENABLED) && IsCompatibleMode(TRK_IMPULSETRACKER))) && (pChn->pModInstrument->PitchEnv.nNodes))
+ {
+ int envpos = pChn->PitchEnv.nEnvPosition;
+ UINT pt = pIns->PitchEnv.nNodes - 1;
+ for (UINT i=0; i<(UINT)(pIns->PitchEnv.nNodes-1); i++)
+ {
+ if (envpos <= pIns->PitchEnv.Ticks[i])
+ {
+ pt = i;
+ break;
+ }
+ }
+ int x2 = pIns->PitchEnv.Ticks[pt];
+ int x1, envpitch;
+ if (envpos >= x2)
+ {
+ envpitch = (((int)pIns->PitchEnv.Values[pt]) - ENVELOPE_MID) * 8;
+ x1 = x2;
+ } else if (pt)
+ {
+ envpitch = (((int)pIns->PitchEnv.Values[pt-1]) - ENVELOPE_MID) * 8;
+ x1 = pIns->PitchEnv.Ticks[pt-1];
+ } else
+ {
+ envpitch = 0;
+ x1 = 0;
+ }
+ if (envpos > x2) envpos = x2;
+ if ((x2 > x1) && (envpos > x1))
+ {
+ int envpitchdest = (((int)pIns->PitchEnv.Values[pt]) - 32) * 8;
+ envpitch += ((envpos - x1) * (envpitchdest - envpitch)) / (x2 - x1);
+ }
+ envpitch = CLAMP(envpitch, -256, 256);
+
+ //if (pIns->PitchEnv.dwFlags & ENV_FILTER)
+ if (pChn->dwFlags & CHN_FILTERENV)
+ {
+ // Filter Envelope: controls cutoff frequency
+#ifndef NO_FILTER
+ SetupChannelFilter(pChn, (pChn->dwFlags & CHN_FILTER) ? false : true, envpitch);
+#endif // NO_FILTER
+ } else
+ {
+ // Pitch Envelope
+ if(m_nType == MOD_TYPE_MPT && pChn->pModInstrument && pChn->pModInstrument->pTuning)
+ {
+ if(pChn->nFineTune != envpitch)
+ {
+ pChn->nFineTune = envpitch;
+ pChn->m_CalculateFreq = true;
+ //Preliminary tests indicated that this behavior
+ //is very close to original(with 12TET) when finestep count
+ //is 15.
+ }
+ }
+ else //Original behavior
+ {
+ int l = envpitch;
+ if (l < 0)
+ {
+ l = -l;
+ if (l > 255) l = 255;
+ period = _muldiv(period, LinearSlideUpTable[l], 0x10000);
+ } else
+ {
+ if (l > 255) l = 255;
+ period = _muldiv(period, LinearSlideDownTable[l], 0x10000);
+ }
+ } //End: Original behavior.
+ }
+ }
+}
+
+
+void CSoundFile::IncrementVolumeEnvelopePosition(MODCHANNEL *pChn)
+//----------------------------------------------------------------
+{
+ const MODINSTRUMENT *pIns = pChn->pModInstrument;
+
+ if (pChn->dwFlags & CHN_VOLENV)
+ {
+ // Increase position
+ pChn->VolEnv.nEnvPosition++;
+ // Volume Loop ?
+ if (pIns->VolEnv.dwFlags & ENV_LOOP)
+ {
+ UINT volloopend = pIns->VolEnv.Ticks[pIns->VolEnv.nLoopEnd];
+ if (m_nType != MOD_TYPE_XM) volloopend++;
+ if (pChn->VolEnv.nEnvPosition == volloopend)
+ {
+ pChn->VolEnv.nEnvPosition = pIns->VolEnv.Ticks[pIns->VolEnv.nLoopStart];
+ if ((pIns->VolEnv.nLoopEnd == pIns->VolEnv.nLoopStart) && (!pIns->VolEnv.Values[pIns->VolEnv.nLoopStart])
+ && ((!(m_nType & MOD_TYPE_XM)) || (pIns->VolEnv.nLoopEnd+1 == (int)pIns->VolEnv.nNodes)))
+ {
+ pChn->dwFlags |= CHN_NOTEFADE;
+ pChn->nFadeOutVol = 0;
+ }
+ }
+ }
+ // Volume Sustain ?
+ if ((pIns->VolEnv.dwFlags & ENV_SUSTAIN) && (!(pChn->dwFlags & CHN_KEYOFF)))
+ {
+ if (pChn->VolEnv.nEnvPosition == (UINT)pIns->VolEnv.Ticks[pIns->VolEnv.nSustainEnd] + 1)
+ pChn->VolEnv.nEnvPosition = pIns->VolEnv.Ticks[pIns->VolEnv.nSustainStart];
+ } else
+ // End of Envelope ?
+ if (pChn->VolEnv.nEnvPosition > pIns->VolEnv.Ticks[pIns->VolEnv.nNodes - 1])
+ {
+ if ((m_nType & (MOD_TYPE_IT | MOD_TYPE_MPT)) || (pChn->dwFlags & CHN_KEYOFF)) pChn->dwFlags |= CHN_NOTEFADE;
+ pChn->VolEnv.nEnvPosition = pIns->VolEnv.Ticks[pIns->VolEnv.nNodes - 1];
+ if ((!pIns->VolEnv.Values[pIns->VolEnv.nNodes-1]) && ((pChn->nMasterChn > 0) || (m_nType & (MOD_TYPE_IT | MOD_TYPE_MPT))))
+ {
+ pChn->dwFlags |= CHN_NOTEFADE;
+ pChn->nFadeOutVol = 0;
+ pChn->nRealVolume = 0;
+ }
+ }
+ }
+}
+
+
+void CSoundFile::IncrementPanningEnvelopePosition(MODCHANNEL *pChn)
+//-----------------------------------------------------------------
+{
+ const MODINSTRUMENT *pIns = pChn->pModInstrument;
+
+ if (pChn->dwFlags & CHN_PANENV)
+ {
+ pChn->PanEnv.nEnvPosition++;
+ if (pIns->PanEnv.dwFlags & ENV_LOOP)
+ {
+ UINT panloopend = pIns->PanEnv.Ticks[pIns->PanEnv.nLoopEnd];
+ if (m_nType != MOD_TYPE_XM) panloopend++;
+ if (pChn->PanEnv.nEnvPosition == panloopend)
+ pChn->PanEnv.nEnvPosition = pIns->PanEnv.Ticks[pIns->PanEnv.nLoopStart];
+ }
+ // Panning Sustain ?
+ if ((pIns->PanEnv.dwFlags & ENV_SUSTAIN) && (pChn->PanEnv.nEnvPosition == (UINT)pIns->PanEnv.Ticks[pIns->PanEnv.nSustainEnd]+1)
+ && (!(pChn->dwFlags & CHN_KEYOFF)))
+ {
+ // Panning sustained
+ pChn->PanEnv.nEnvPosition = pIns->PanEnv.Ticks[pIns->PanEnv.nSustainStart];
+ } else
+ {
+ if (pChn->PanEnv.nEnvPosition > pIns->PanEnv.Ticks[pIns->PanEnv.nNodes - 1])
+ pChn->PanEnv.nEnvPosition = pIns->PanEnv.Ticks[pIns->PanEnv.nNodes - 1];
+ }
+ }
+}
+
+
+void CSoundFile::IncrementPitchFilterEnvelopePosition(MODCHANNEL *pChn)
+//---------------------------------------------------------------------
+{
+ const MODINSTRUMENT *pIns = pChn->pModInstrument;
+
+ if (pChn->dwFlags & CHN_PITCHENV)
+ {
+ // Increase position
+ pChn->PitchEnv.nEnvPosition++;
+ // Pitch Loop ?
+ if (pIns->PitchEnv.dwFlags & ENV_LOOP)
+ {
+ UINT pitchloopend = pIns->PitchEnv.Ticks[pIns->PitchEnv.nLoopEnd];
+ //IT compatibility 24. Short envelope loops
+ if (IsCompatibleMode(TRK_IMPULSETRACKER)) pitchloopend++;
+ if (pChn->PitchEnv.nEnvPosition >= pitchloopend)
+ pChn->PitchEnv.nEnvPosition = pIns->PitchEnv.Ticks[pIns->PitchEnv.nLoopStart];
+ }
+ // Pitch Sustain ?
+ if ((pIns->PitchEnv.dwFlags & ENV_SUSTAIN) && (!(pChn->dwFlags & CHN_KEYOFF)))
+ {
+ if (pChn->PitchEnv.nEnvPosition == (UINT)pIns->PitchEnv.Ticks[pIns->PitchEnv.nSustainEnd]+1)
+ pChn->PitchEnv.nEnvPosition = pIns->PitchEnv.Ticks[pIns->PitchEnv.nSustainStart];
+ } else
+ {
+ if (pChn->PitchEnv.nEnvPosition > pIns->PitchEnv.Ticks[pIns->PitchEnv.nNodes - 1])
+ pChn->PitchEnv.nEnvPosition = pIns->PitchEnv.Ticks[pIns->PitchEnv.nNodes - 1];
+ }
+ }
+}
+
+
+void CSoundFile::ProcessInstrumentFade(MODCHANNEL *pChn, int &vol)
+//----------------------------------------------------------------
+{
+ // FadeOut volume
+ if (pChn->dwFlags & CHN_NOTEFADE)
+ {
+ const MODINSTRUMENT *pIns = pChn->pModInstrument;
+
+ UINT fadeout = pIns->nFadeOut;
+ if (fadeout)
+ {
+ pChn->nFadeOutVol -= fadeout << 1;
+ if (pChn->nFadeOutVol <= 0) pChn->nFadeOutVol = 0;
+ vol = (vol * pChn->nFadeOutVol) >> 16;
+ } else if (!pChn->nFadeOutVol)
+ {
+ vol = 0;
+ }
+ }
+}
+
+
+void CSoundFile::ProcessPitchPanSeparation(MODCHANNEL *pChn)
+//----------------------------------------------------------
+{
+ const MODINSTRUMENT *pIns = pChn->pModInstrument;
+
+ if ((pIns->nPPS) && (pChn->nRealPan) && (pChn->nNote))
+ {
+ // PPS value is 1/512, i.e. PPS=1 will adjust by 8/512 = 1/64 for each 8 semitones
+ // with PPS = 32 / PPC = C-5, E-6 will pan hard right (and D#6 will not)
+ // IT compatibility: IT has a wider pan range here
+ int pandelta = (int)pChn->nRealPan + (int)((int)(pChn->nNote - pIns->nPPC - 1) * (int)pIns->nPPS) / (int)(IsCompatibleMode(TRK_IMPULSETRACKER) ? 4 : 8);
+ pChn->nRealPan = CLAMP(pandelta, 0, 256);
+ }
+}
+
+
+void CSoundFile::ProcessPanbrello(MODCHANNEL *pChn)
+//-------------------------------------------------
+{
+ if (pChn->dwFlags & CHN_PANBRELLO)
+ {
+ UINT panpos;
+ // IT compatibility: IT has its own, more precise tables
+ if(IsCompatibleMode(TRK_IMPULSETRACKER))
+ panpos = pChn->nPanbrelloPos & 0xFF;
+ else
+ panpos = ((pChn->nPanbrelloPos + 0x10) >> 2) & 0x3F;
+ LONG pdelta;
+ switch (pChn->nPanbrelloType & 0x03)
+ {
+ case 1:
+ // IT compatibility: IT has its own, more precise tables
+ pdelta = IsCompatibleMode(TRK_IMPULSETRACKER) ? ITRampDownTable[panpos] : ModRampDownTable[panpos];
+ break;
+ case 2:
+ // IT compatibility: IT has its own, more precise tables
+ pdelta = IsCompatibleMode(TRK_IMPULSETRACKER) ? ITSquareTable[panpos] : ModSquareTable[panpos];
+ break;
+ case 3:
+ //IT compatibility 19. Use random values
+ if(IsCompatibleMode(TRK_IMPULSETRACKER))
+ pdelta = (rand() & 0x7f) - 0x40;
+ else
+ pdelta = ModRandomTable[panpos];
+ break;
+ default:
+ // IT compatibility: IT has its own, more precise tables
+ pdelta = IsCompatibleMode(TRK_IMPULSETRACKER) ? ITSinusTable[panpos] : ModSinusTable[panpos];
+ }
+ pChn->nPanbrelloPos += pChn->nPanbrelloSpeed;
+ pdelta = ((pdelta * (int)pChn->nPanbrelloDepth) + 2) >> 3;
+ pdelta += pChn->nRealPan;
+
+ pChn->nRealPan = CLAMP(pdelta, 0, 256);
+ //if(IsCompatibleMode(TRK_IMPULSETRACKER)) pChn->nPan = pChn->nRealPan; // TODO
+ }
+}
+
+
+void CSoundFile::ProcessArpeggio(MODCHANNEL *pChn, int &period, CTuning::NOTEINDEXTYPE &arpeggioSteps)
+//----------------------------------------------------------------------------------------------------
+{
+ if (pChn->nCommand == CMD_ARPEGGIO)
+ {
+#ifndef NO_VST
+#if 0
+ // EXPERIMENTAL VSTi arpeggio. Far from perfect!
+ if(pChn->pModInstrument && pChn->pModInstrument->nMixPlug && !(m_dwSongFlags & SONG_FIRSTTICK))
+ {
+ const MODINSTRUMENT *pIns = pChn->pModInstrument;
+ IMixPlugin *pPlugin = m_MixPlugins[pIns->nMixPlug - 1].pMixPlugin;
+ if(pPlugin)
+ {
+ // Temporary logic: This ensures that the first and last tick are both playing the base note.
+ int nCount = (int)m_nTickCount - (int)(m_nMusicSpeed * (m_nPatternDelay + 1) + m_nFrameDelay - 1);
+ int nStep = 0, nLastStep = 0;
+ nCount = -nCount;
+ switch(nCount % 3)
+ {
+ case 0:
+ nStep = 0;
+ nLastStep = pChn->nArpeggio & 0x0F;
+ break;
+ case 1:
+ nStep = pChn->nArpeggio >> 4;
+ nLastStep = 0;
+ break;
+ case 2:
+ nStep = pChn->nArpeggio & 0x0F;
+ nLastStep = pChn->nArpeggio >> 4;
+ break;
+ }
+ // First tick is always 0
+ if(m_nTickCount == 1)
+ nLastStep = 0;
+
+ pPlugin->MidiCommand(pIns->nMidiChannel, pIns->nMidiProgram, pIns->wMidiBank, pChn->nNote + nStep, pChn->nVolume, nChn);
+ pPlugin->MidiCommand(pIns->nMidiChannel, pIns->nMidiProgram, pIns->wMidiBank, pChn->nNote + nLastStep + NOTE_KEYOFF, 0, nChn);
+ }
+ }
+#endif // 0
+#endif // NO_VST
+
+ if((m_nType & MOD_TYPE_MPT) && pChn->pModInstrument && pChn->pModInstrument->pTuning)
+ {
+ switch(m_nTickCount % 3)
+ {
+ case 0:
+ arpeggioSteps = 0;
+ break;
+ case 1:
+ arpeggioSteps = pChn->nArpeggio >> 4; // >> 4 <-> division by 16. This gives the first number in the parameter.
+ break;
+ case 2:
+ arpeggioSteps = pChn->nArpeggio % 16; //Gives the latter number in the parameter.
+ break;
+ }
+ pChn->m_CalculateFreq = true;
+ pChn->m_ReCalculateFreqOnFirstTick = true;
+ }
+ else
+ {
+ //IT playback compatibility 01 & 02
+ if(IsCompatibleMode(TRK_IMPULSETRACKER))
+ {
+ if(pChn->nArpeggio >> 4 != 0 || (pChn->nArpeggio & 0x0F) != 0)
+ {
+ switch(m_nTickCount % 3)
+ {
+ case 1: period = Util::Round<int>(period / TwoToPowerXOver12(pChn->nArpeggio >> 4)); break;
+ case 2: period = Util::Round<int>(period / TwoToPowerXOver12(pChn->nArpeggio & 0x0F)); break;
+ }
+ }
+ }
+ // FastTracker 2: Swedish tracker logic (TM) arpeggio
+ else if(IsCompatibleMode(TRK_FASTTRACKER2))
+ {
+ BYTE note = pChn->nNote;
+ int arpPos = 0;
+
+ if (!(m_dwSongFlags & SONG_FIRSTTICK))
+ {
+ arpPos = ((int)m_nMusicSpeed - (int)m_nTickCount) % 3;
+ if((m_nMusicSpeed > 18) && (m_nMusicSpeed - m_nTickCount > 16)) arpPos = 2; // swedish tracker logic, I love it
+ switch(arpPos)
+ {
+ case 1: note += (pChn->nArpeggio >> 4); break;
+ case 2: note += (pChn->nArpeggio & 0x0F); break;
+ }
+ }
+
+ if (note > 109 && arpPos != 0)
+ note = 109; // FT2's note limit
+
+ period = GetPeriodFromNote(note, pChn->nFineTune, pChn->nC5Speed);
+
+ }
+ // Other trackers
+ else
+ {
+ switch(m_nTickCount % 3)
+ {
+ case 1: period = GetPeriodFromNote(pChn->nNote + (pChn->nArpeggio >> 4), pChn->nFineTune, pChn->nC5Speed); break;
+ case 2: period = GetPeriodFromNote(pChn->nNote + (pChn->nArpeggio & 0x0F), pChn->nFineTune, pChn->nC5Speed); break;
+ }
+ }
+ }
+ }
+}
+
+
+void CSoundFile::ProcessVibrato(MODCHANNEL *pChn, int &period, CTuning::RATIOTYPE &vibratoFactor)
+//-----------------------------------------------------------------------------------------------
+{
+ if (pChn->dwFlags & CHN_VIBRATO)
+ {
+ UINT vibpos = pChn->nVibratoPos;
+ LONG vdelta;
+ switch (pChn->nVibratoType & 0x03)
+ {
+ case 1:
+ // IT compatibility: IT has its own, more precise tables
+ vdelta = IsCompatibleMode(TRK_IMPULSETRACKER) ? ITRampDownTable[vibpos] : ModRampDownTable[vibpos];
+ break;
+ case 2:
+ // IT compatibility: IT has its own, more precise tables
+ vdelta = IsCompatibleMode(TRK_IMPULSETRACKER) ? ITSquareTable[vibpos] : ModSquareTable[vibpos];
+ break;
+ case 3:
+ //IT compatibility 19. Use random values
+ if(IsCompatibleMode(TRK_IMPULSETRACKER))
+ vdelta = (rand() & 0x7F) - 0x40;
+ else
+ vdelta = ModRandomTable[vibpos];
+ break;
+ default:
+ // IT compatibility: IT has its own, more precise tables
+ vdelta = IsCompatibleMode(TRK_IMPULSETRACKER) ? ITSinusTable[vibpos] : ModSinusTable[vibpos];
+ }
+
+ if(m_nType == MOD_TYPE_MPT && pChn->pModInstrument && pChn->pModInstrument->pTuning)
+ {
+ //Hack implementation: Scaling vibratofactor to [0.95; 1.05]
+ //using figure from above tables and vibratodepth parameter
+ vibratoFactor += 0.05F * vdelta * pChn->m_VibratoDepth / 128.0F;
+ pChn->m_CalculateFreq = true;
+ pChn->m_ReCalculateFreqOnFirstTick = false;
+
+ if(m_nTickCount + 1 == m_nMusicSpeed)
+ pChn->m_ReCalculateFreqOnFirstTick = true;
+ }
+ else //Original behavior
+ {
+ UINT vdepth;
+ // IT compatibility: correct vibrato depth
+ if(IsCompatibleMode(TRK_IMPULSETRACKER))
+ {
+ // Yes, vibrato goes backwards with old effects enabled!
+ if(m_dwSongFlags & SONG_ITOLDEFFECTS)
+ {
+ vdepth = 5;
+ vdelta = -vdelta;
+ } else
+ {
+ vdepth = 6;
+ }
+ }
+ else
+ {
+ vdepth = ((!(m_nType & (MOD_TYPE_IT|MOD_TYPE_MPT))) || (m_dwSongFlags & SONG_ITOLDEFFECTS)) ? 6 : 7;
+ }
+ vdelta = (vdelta * (int)pChn->nVibratoDepth) >> vdepth;
+ if ((m_dwSongFlags & SONG_LINEARSLIDES) && (m_nType & (MOD_TYPE_IT | MOD_TYPE_MPT)))
+ {
+ LONG l = vdelta;
+ if (l < 0)
+ {
+ l = -l;
+ vdelta = _muldiv(period, LinearSlideDownTable[l >> 2], 0x10000) - period;
+ if (l & 0x03) vdelta += _muldiv(period, FineLinearSlideDownTable[l & 0x03], 0x10000) - period;
+ } else
+ {
+ vdelta = _muldiv(period, LinearSlideUpTable[l >> 2], 0x10000) - period;
+ if (l & 0x03) vdelta += _muldiv(period, FineLinearSlideUpTable[l & 0x03], 0x10000) - period;
+ }
+ }
+ period += vdelta;
+ }
+ if ((m_nTickCount) || ((m_nType & (MOD_TYPE_IT | MOD_TYPE_MPT)) && (!(m_dwSongFlags & SONG_ITOLDEFFECTS))))
+ {
+ // IT compatibility: IT has its own, more precise tables
+ if(IsCompatibleMode(TRK_IMPULSETRACKER))
+ pChn->nVibratoPos = (vibpos + 4 * pChn->nVibratoSpeed) & 0xFF;
+ else
+ pChn->nVibratoPos = (vibpos + pChn->nVibratoSpeed) & 0x3F;
+ }
+ }
+}
+
+
+void CSoundFile::ProcessSampleAutoVibrato(MODCHANNEL *pChn, int &period, CTuning::RATIOTYPE &vibratoFactor, int &nPeriodFrac)
+//--------------------------------------------------------------------------------------------------------------------------
+{
+ // Sample Auto-Vibrato
+ if ((pChn->pModSample) && (pChn->pModSample->nVibDepth))
+ {
+ MODSAMPLE *pSmp = pChn->pModSample;
+ const bool alternativeTuning = pChn->pModInstrument && pChn->pModInstrument->pTuning;
+
+ // IT compatibility: Autovibrato is so much different in IT that I just put this in a separate code block, to get rid of a dozen IsCompatibilityMode() calls.
+ if(IsCompatibleMode(TRK_IMPULSETRACKER) && !alternativeTuning)
+ {
+ // Schism's autovibrato code
+
+ /*
+ X86 Assembler from ITTECH.TXT:
+ 1) Mov AX, [SomeVariableNameRelatingToVibrato]
+ 2) Add AL, Rate
+ 3) AdC AH, 0
+ 4) AH contains the depth of the vibrato as a fine-linear slide.
+ 5) Mov [SomeVariableNameRelatingToVibrato], AX ; For the next cycle.
+ */
+ const int vibpos = pChn->nAutoVibPos & 0xFF;
+ int adepth = pChn->nAutoVibDepth; // (1)
+ adepth += pSmp->nVibSweep & 0xFF; // (2 & 3)
+ adepth = min(adepth, (int)(pSmp->nVibDepth << 8));
+ pChn->nAutoVibDepth = adepth; // (5)
+ adepth >>= 8; // (4)
+
+ pChn->nAutoVibPos += pSmp->nVibRate;
+
+ int vdelta;
+ switch(pSmp->nVibType)
+ {
+ case VIB_RANDOM:
+ vdelta = (rand() & 0x7F) - 0x40;
+ break;
+ case VIB_RAMP_DOWN:
+ vdelta = ITRampDownTable[vibpos];
+ break;
+ case VIB_RAMP_UP:
+ vdelta = -ITRampDownTable[vibpos];
+ break;
+ case VIB_SQUARE:
+ vdelta = ITSquareTable[vibpos];
+ break;
+ case VIB_SINE:
+ default:
+ vdelta = ITSinusTable[vibpos];
+ break;
+ }
+
+ vdelta = (vdelta * adepth) >> 6;
+ int l = abs(vdelta);
+ if(vdelta < 0)
+ {
+ vdelta = _muldiv(period, LinearSlideDownTable[l >> 2], 0x10000) - period;
+ if (l & 0x03)
+ {
+ vdelta += _muldiv(period, FineLinearSlideDownTable[l & 0x03], 0x10000) - period;
+ }
+ } else
+ {
+ vdelta = _muldiv(period, LinearSlideUpTable[l >> 2], 0x10000) - period;
+ if (l & 0x03)
+ {
+ vdelta += _muldiv(period, FineLinearSlideUpTable[l & 0x03], 0x10000) - period;
+ }
+ }
+ period -= vdelta;
+
+ } else
+ {
+ // MPT's autovibrato code
+ if (pSmp->nVibSweep == 0)
+ {
+ pChn->nAutoVibDepth = pSmp->nVibDepth << 8;
+ } else
+ {
+ // Calculate current autovibrato depth using vibsweep
+ if (m_nType & (MOD_TYPE_IT | MOD_TYPE_MPT))
+ {
+ // Note: changed bitshift from 3 to 1 as the variable is not divided by 4 in the IT loader anymore
+ // - so we divide sweep by 4 here.
+ pChn->nAutoVibDepth += pSmp->nVibSweep << 1;
+ } else
+ {
+ if (!(pChn->dwFlags & CHN_KEYOFF))
+ {
+ pChn->nAutoVibDepth += (pSmp->nVibDepth << 8) / pSmp->nVibSweep;
+ }
+ }
+ if ((pChn->nAutoVibDepth >> 8) > pSmp->nVibDepth)
+ pChn->nAutoVibDepth = pSmp->nVibDepth << 8;
+ }
+ pChn->nAutoVibPos += pSmp->nVibRate;
+ int vdelta;
+ switch(pSmp->nVibType)
+ {
+ case VIB_RANDOM:
+ vdelta = ModRandomTable[pChn->nAutoVibPos & 0x3F];
+ pChn->nAutoVibPos++;
+ break;
+ case VIB_RAMP_DOWN:
+ vdelta = ((0x40 - (pChn->nAutoVibPos >> 1)) & 0x7F) - 0x40;
+ break;
+ case VIB_RAMP_UP:
+ vdelta = ((0x40 + (pChn->nAutoVibPos >> 1)) & 0x7f) - 0x40;
+ break;
+ case VIB_SQUARE:
+ vdelta = (pChn->nAutoVibPos & 128) ? +64 : -64;
+ break;
+ case VIB_SINE:
+ default:
+ vdelta = ft2VibratoTable[pChn->nAutoVibPos & 0xFF];
+ }
+ int n;
+ n = ((vdelta * pChn->nAutoVibDepth) >> 8);
+
+ if(alternativeTuning)
+ {
+ //Vib sweep is not taken into account here.
+ vibratoFactor += 0.05F * pSmp->nVibDepth * vdelta / 4096.0F; //4096 == 64^2
+ //See vibrato for explanation.
+ pChn->m_CalculateFreq = true;
+ /*
+ Finestep vibrato:
+ const float autoVibDepth = pSmp->nVibDepth * val / 4096.0F; //4096 == 64^2
+ vibratoFineSteps += static_cast<CTuning::FINESTEPTYPE>(pChn->pModInstrument->pTuning->GetFineStepCount() * autoVibDepth);
+ pChn->m_CalculateFreq = true;
+ */
+ }
+ else //Original behavior
+ {
+ if (m_nType & (MOD_TYPE_IT | MOD_TYPE_MPT))
+ {
+ int df1, df2;
+ if (n < 0)
+ {
+ n = -n;
+ UINT n1 = n >> 8;
+ df1 = LinearSlideUpTable[n1];
+ df2 = LinearSlideUpTable[n1+1];
+ } else
+ {
+ UINT n1 = n >> 8;
+ df1 = LinearSlideDownTable[n1];
+ df2 = LinearSlideDownTable[n1+1];
+ }
+ n >>= 2;
+ period = _muldiv(period, df1 + ((df2 - df1) * (n & 0x3F) >> 6), 256);
+ nPeriodFrac = period & 0xFF;
+ period >>= 8;
+ } else
+ {
+ period += (n >> 6);
+ }
+ } //Original MPT behavior
+ }
+ }
+}
+
+
////////////////////////////////////////////////////////////////////////////////////////////
// Handles envelopes & mixer setup
@@ -958,12 +1813,14 @@
if (m_pConfig->getUseGlobalPreAmp())
{
int realmastervol = m_nMasterVolume;
- if (realmastervol > 0x80) {
+ if (realmastervol > 0x80)
+ {
//Attenuate global pre-amp depending on num channels
realmastervol = 0x80 + ((realmastervol - 0x80) * (nchn32+4)) / 16;
}
mastervol = (realmastervol * (m_nSamplePreAmp)) >> 6;
- } else {
+ } else
+ {
//Preferred option: don't use global pre-amp at all.
mastervol = m_nSamplePreAmp;
}
@@ -973,11 +1830,13 @@
mastervol = _muldiv(mastervol, m_nGlobalFadeSamples, m_nGlobalFadeMaxSamples);
}
- if (m_pConfig->getUseGlobalPreAmp()) {
+ if (m_pConfig->getUseGlobalPreAmp())
+ {
UINT attenuation = (gdwSoundSetup & SNDMIX_AGC) ? PreAmpAGCTable[nchn32>>1] : PreAmpTable[nchn32>>1];
if(attenuation < 1) attenuation = 1;
nMasterVol = (mastervol << 7) / attenuation;
- } else {
+ } else
+ {
nMasterVol = mastervol;
}
}
@@ -1023,19 +1882,6 @@
pChn->nInc = 0;
pChn->nRealVolume = 0;
- if(GetModFlag(MSF_OLDVOLSWING))
- {
- pChn->nRealPan = pChn->nPan + pChn->nPanSwing;
- }
- else
- {
- pChn->nPan += pChn->nPanSwing;
- pChn->nPan = CLAMP(pChn->nPan, 0, 256);
- pChn->nPanSwing = 0;
- pChn->nRealPan = pChn->nPan;
- }
-
- pChn->nRealPan = CLAMP(pChn->nRealPan, 0, 256);
pChn->nRampLength = 0;
//Aux variables
@@ -1045,213 +1891,26 @@
MODINSTRUMENT *pIns = pChn->pModInstrument;
// Calc Frequency
- if ((pChn->nPeriod) && (pChn->nLength))
+ int period;
+ if (pChn->nPeriod && pChn->nLength)
{
int vol = pChn->nVolume;
- if(pChn->nVolSwing)
- {
- if(GetModFlag(MSF_OLDVOLSWING))
- {
- vol += pChn->nVolSwing;
- }
- else
- {
- pChn->nVolume += pChn->nVolSwing;
- pChn->nVolume = CLAMP(pChn->nVolume, 0, 256);
- vol = pChn->nVolume;
- pChn->nVolSwing = 0;
- }
- }
+ ProcessVolumeSwing(pChn, vol);
+ ProcessPanningSwing(pChn);
+ ProcessTremolo(pChn, vol);
+ ProcessTremor(pChn, vol);
- vol = CLAMP(vol, 0, 256);
-
- // Tremolo
- if (pChn->dwFlags & CHN_TREMOLO)
- {
- UINT trempos = pChn->nTremoloPos;
- // IT compatibility: Why would you not want to execute tremolo at volume 0?
- if (vol > 0 || IsCompatibleMode(TRK_IMPULSETRACKER))
- {
- // IT compatibility: We don't need a different attenuation here because of the different tables we're going to use
- const int tremattn = (m_nType & MOD_TYPE_XM || IsCompatibleMode(TRK_IMPULSETRACKER)) ? 5 : 6;
- switch (pChn->nTremoloType & 0x03)
- {
- case 1:
- // IT compatibility: IT has its own, more precise tables
- vol += ((IsCompatibleMode(TRK_IMPULSETRACKER) ? ITRampDownTable[trempos] : ModRampDownTable[trempos]) * (int)pChn->nTremoloDepth) >> tremattn;
- break;
- case 2:
- // IT compatibility: IT has its own, more precise tables
- vol += ((IsCompatibleMode(TRK_IMPULSETRACKER) ? ITSquareTable[trempos] : ModSquareTable[trempos]) * (int)pChn->nTremoloDepth) >> tremattn;
- break;
- case 3:
- //IT compatibility 19. Use random values
- if(IsCompatibleMode(TRK_IMPULSETRACKER))
- vol += (((rand() & 0x7F) - 0x40) * (int)pChn->nTremoloDepth) >> tremattn;
- else
- vol += (ModRandomTable[trempos] * (int)pChn->nTremoloDepth) >> tremattn;
- break;
- default:
- // IT compatibility: IT has its own, more precise tables
- vol += ((IsCompatibleMode(TRK_IMPULSETRACKER) ? ITSinusTable[trempos] : ModSinusTable[trempos]) * (int)pChn->nTremoloDepth) >> tremattn;
- }
- }
- if ((m_nTickCount) || ((m_nType & (MOD_TYPE_STM|MOD_TYPE_S3M|MOD_TYPE_IT|MOD_TYPE_MPT)) && (!(m_dwSongFlags & SONG_ITOLDEFFECTS))))
- {
- // IT compatibility: IT has its own, more precise tables
- if(IsCompatibleMode(TRK_IMPULSETRACKER))
- pChn->nTremoloPos = (pChn->nTremoloPos + 4 * pChn->nTremoloSpeed) & 0xFF;
- else
- pChn->nTremoloPos = (pChn->nTremoloPos + pChn->nTremoloSpeed) & 0x3F;
- }
- }
-
- // Tremor
- if(pChn->nCommand == CMD_TREMOR)
- {
- // IT compatibility 12. / 13.: Tremor
- if(IsCompatibleMode(TRK_IMPULSETRACKER))
- {
- if ((pChn->nTremorCount & 128) && pChn->nLength)
- {
- if (pChn->nTremorCount == 128)
- pChn->nTremorCount = (pChn->nTremorParam >> 4) | 192;
- else if (pChn->nTremorCount == 192)
- pChn->nTremorCount = (pChn->nTremorParam & 0xf) | 128;
- else
- pChn->nTremorCount--;
- }
-
- if ((pChn->nTremorCount & 192) == 128)
- vol = 0;
- }
- else
- {
- UINT n = (pChn->nTremorParam >> 4) + (pChn->nTremorParam & 0x0F);
- UINT ontime = pChn->nTremorParam >> 4;
- if ((!(m_nType & (MOD_TYPE_IT|MOD_TYPE_MPT))) || (m_dwSongFlags & SONG_ITOLDEFFECTS))
- {
- n += 2;
- ontime++;
- }
- UINT tremcount = (UINT)pChn->nTremorCount;
- if (tremcount >= n) tremcount = 0;
- if ((m_nTickCount) || (m_nType & (MOD_TYPE_S3M|MOD_TYPE_IT|MOD_TYPE_MPT)))
- {
- if (tremcount >= ontime) vol = 0;
- pChn->nTremorCount = (BYTE)(tremcount + 1);
- }
- }
- pChn->dwFlags |= CHN_FASTVOLRAMP;
- }
-
// Clip volume and multiply
vol = CLAMP(vol, 0, 256) << 6;
// Process Envelopes
if (pIns)
{
- // Volume Envelope
- // IT Compatibility: S77 does not disable the volume envelope, it just pauses the counter
- // Problem: This pauses on the wrong tick at the moment...
- if (((pChn->dwFlags & CHN_VOLENV) || ((pIns->VolEnv.dwFlags & ENV_ENABLED) && IsCompatibleMode(TRK_IMPULSETRACKER))) && (pIns->VolEnv.nNodes))
- {
- int envvol = GetVolEnvValueFromPosition(pChn->VolEnv.nEnvPosition, pIns);
-
- // if we are in the release portion of the envelope,
- // rescale envelope factor so that it is proportional to the release point
- // and release envelope beginning.
- if (pIns->VolEnv.nReleaseNode != ENV_RELEASE_NODE_UNSET
- && pChn->VolEnv.nEnvPosition>=pIns->VolEnv.Ticks[pIns->VolEnv.nReleaseNode]
- && pChn->VolEnv.nEnvValueAtReleaseJump != NOT_YET_RELEASED)
- {
- int envValueAtReleaseJump = pChn->VolEnv.nEnvValueAtReleaseJump;
- int envValueAtReleaseNode = pIns->VolEnv.Values[pIns->VolEnv.nReleaseNode] << 2;
-
- //If we have just hit the release node, force the current env value
- //to be that of the release node. This works around the case where
- // we have another node at the same position as the release node.
- if (pChn->VolEnv.nEnvPosition == pIns->VolEnv.Ticks[pIns->VolEnv.nReleaseNode])
- envvol = envValueAtReleaseNode;
-
- int relativeVolumeChange = (envvol - envValueAtReleaseNode) * 2;
- envvol = envValueAtReleaseJump + relativeVolumeChange;
- }
- vol = (vol * CLAMP(envvol, 0, 512)) >> 8;
- }
- // Panning Envelope
- // IT Compatibility: S79 does not disable the panning envelope, it just pauses the counter
- // Problem: This pauses on the wrong tick at the moment...
- if (((pChn->dwFlags & CHN_PANENV) || ((pIns->PanEnv.dwFlags & ENV_ENABLED) && IsCompatibleMode(TRK_IMPULSETRACKER))) && (pIns->PanEnv.nNodes))
- {
- int envpos = pChn->PanEnv.nEnvPosition;
- UINT pt = pIns->PanEnv.nNodes - 1;
- for (UINT i=0; i<(UINT)(pIns->PanEnv.nNodes-1); i++)
- {
- if (envpos <= pIns->PanEnv.Ticks[i])
- {
- pt = i;
- break;
- }
- }
- int x2 = pIns->PanEnv.Ticks[pt], y2 = pIns->PanEnv.Values[pt];
- int x1, envpan;
- if (envpos >= x2)
- {
- envpan = y2;
- x1 = x2;
- } else
- if (pt)
- {
- envpan = pIns->PanEnv.Values[pt-1];
- x1 = pIns->PanEnv.Ticks[pt-1];
- } else
- {
- envpan = 128;
- x1 = 0;
- }
- if ((x2 > x1) && (envpos > x1))
- {
- envpan += ((envpos - x1) * (y2 - envpan)) / (x2 - x1);
- }
-
- envpan = CLAMP(envpan, 0, 64);
- int pan = pChn->nPan;
- if (pan >= 128)
- {
- pan += ((envpan - 32) * (256 - pan)) / 32;
- } else
- {
- pan += ((envpan - 32) * (pan)) / 32;
- }
-
- pChn->nRealPan = CLAMP(pan, 0, 256);
- }
- // FadeOut volume
- if (pChn->dwFlags & CHN_NOTEFADE)
- {
- UINT fadeout = pIns->nFadeOut;
- if (fadeout)
- {
- pChn->nFadeOutVol -= fadeout << 1;
- if (pChn->nFadeOutVol <= 0) pChn->nFadeOutVol = 0;
- vol = (vol * pChn->nFadeOutVol) >> 16;
- } else
- if (!pChn->nFadeOutVol)
- {
- vol = 0;
- }
- }
- // Pitch/Pan separation
- if ((pIns->nPPS) && (pChn->nRealPan) && (pChn->nNote))
- {
- // PPS value is 1/512, i.e. PPS=1 will adjust by 8/512 = 1/64 for each 8 semitones
- // with PPS = 32 / PPC = C-5, E-6 will pan hard right (and D#6 will not)
- // IT compatibility: IT has a wider pan range here
- int pandelta = (int)pChn->nRealPan + (int)((int)(pChn->nNote - pIns->nPPC - 1) * (int)pIns->nPPS) / (int)(IsCompatibleMode(TRK_IMPULSETRACKER) ? 4 : 8);
- pChn->nRealPan = CLAMP(pandelta, 0, 256);
- }
+ ProcessVolumeEnvelope(pChn, vol);
+ ProcessInstrumentFade(pChn, vol);
+ ProcessPanningEnvelope(pChn);
+ ProcessPitchPanSeparation(pChn);
} else
{
// No Envelope: key off => note cut
@@ -1283,442 +1942,28 @@
}
}
if (pChn->nPeriod < m_nMinPeriod) pChn->nPeriod = m_nMinPeriod;
- int period = pChn->nPeriod;
+ period = pChn->nPeriod;
if ((pChn->dwFlags & (CHN_GLISSANDO|CHN_PORTAMENTO)) == (CHN_GLISSANDO|CHN_PORTAMENTO))
{
period = GetPeriodFromNote(GetNoteFromPeriod(period), pChn->nFineTune, pChn->nC5Speed);
}
- // Arpeggio ?
- if (pChn->nCommand == CMD_ARPEGGIO)
- {
- if(m_nType == MOD_TYPE_MPT && pChn->pModInstrument && pChn->pModInstrument->pTuning)
- {
- switch(m_nTickCount % 3)
- {
- case 0:
- arpeggioSteps = 0;
- break;
- case 1:
- arpeggioSteps = pChn->nArpeggio >> 4; // >> 4 <-> division by 16. This gives the first number in the parameter.
- break;
- case 2:
- arpeggioSteps = pChn->nArpeggio % 16; //Gives the latter number in the parameter.
- break;
- }
- pChn->m_CalculateFreq = true;
- pChn->m_ReCalculateFreqOnFirstTick = true;
- }
- else
- {
- //IT playback compatibility 01 & 02
- if(IsCompatibleMode(TRK_IMPULSETRACKER))
- {
- if(pChn->nArpeggio >> 4 != 0 || (pChn->nArpeggio & 0x0F) != 0)
- {
- switch(m_nTickCount % 3)
- {
- case 1: period = Util::Round<int>(period / TwoToPowerXOver12(pChn->nArpeggio >> 4)); break;
- case 2: period = Util::Round<int>(period / TwoToPowerXOver12(pChn->nArpeggio & 0x0F)); break;
- }
- }
- }
- // FastTracker 2: Swedish tracker logic (TM) arpeggio
- else if(IsCompatibleMode(TRK_FASTTRACKER2))
- {
- BYTE note = pChn->nNote;
- int arpPos = 0;
+ ProcessArpeggio(pChn, period, arpeggioSteps);
- if (!(m_dwSongFlags & SONG_FIRSTTICK))
- {
- arpPos = ((int)m_nMusicSpeed - (int)m_nTickCount) % 3;
- if((m_nMusicSpeed > 18) && (m_nMusicSpeed - m_nTickCount > 16)) arpPos = 2; // swedish tracker logic, I love it
- switch(arpPos)
- {
- case 1: note += (pChn->nArpeggio >> 4); break;
- case 2: note += (pChn->nArpeggio & 0x0F); break;
- }
- }
-
- if (note > 109 && arpPos != 0)
- note = 109; // FT2's note limit
-
- period = GetPeriodFromNote(note, pChn->nFineTune, pChn->nC5Speed);
-
- }
- // Other trackers
- else
- {
- switch(m_nTickCount % 3)
- {
- case 1: period = GetPeriodFromNote(pChn->nNote + (pChn->nArpeggio >> 4), pChn->nFineTune, pChn->nC5Speed); break;
- case 2: period = GetPeriodFromNote(pChn->nNote + (pChn->nArpeggio & 0x0F), pChn->nFineTune, pChn->nC5Speed); break;
- }
- }
- }
- }
-
// Preserve Amiga freq limits
if (m_dwSongFlags & (SONG_AMIGALIMITS|SONG_PT1XMODE))
+ {
period = CLAMP(period, 113 * 4, 856 * 4);
-
- // Pitch/Filter Envelope
- // IT Compatibility: S7B does not disable the pitch envelope, it just pauses the counter
- // Problem: This pauses on the wrong tick at the moment...
- if ((pIns) && ((pChn->dwFlags & CHN_PITCHENV) || ((pIns->PitchEnv.dwFlags & ENV_ENABLED) && IsCompatibleMode(TRK_IMPULSETRACKER))) && (pChn->pModInstrument->PitchEnv.nNodes))
- {
- int envpos = pChn->PitchEnv.nEnvPosition;
- UINT pt = pIns->PitchEnv.nNodes - 1;
- for (UINT i=0; i<(UINT)(pIns->PitchEnv.nNodes-1); i++)
- {
- if (envpos <= pIns->PitchEnv.Ticks[i])
- {
- pt = i;
- break;
- }
- }
- int x2 = pIns->PitchEnv.Ticks[pt];
- int x1, envpitch;
- if (envpos >= x2)
- {
- envpitch = (((int)pIns->PitchEnv.Values[pt]) - ENVELOPE_MID) * 8;
- x1 = x2;
- } else
- if (pt)
- {
- envpitch = (((int)pIns->PitchEnv.Values[pt-1]) - ENVELOPE_MID) * 8;
- x1 = pIns->PitchEnv.Ticks[pt-1];
- } else
- {
- envpitch = 0;
- x1 = 0;
- }
- if (envpos > x2) envpos = x2;
- if ((x2 > x1) && (envpos > x1))
- {
- int envpitchdest = (((int)pIns->PitchEnv.Values[pt]) - 32) * 8;
- envpitch += ((envpos - x1) * (envpitchdest - envpitch)) / (x2 - x1);
- }
- envpitch = CLAMP(envpitch, -256, 256);
- // Filter Envelope: controls cutoff frequency
- //if (pIns->PitchEnv.dwFlags & ENV_FILTER)
- if (pChn->dwFlags & CHN_FILTERENV)
- {
-#ifndef NO_FILTER
- SetupChannelFilter(pChn, (pChn->dwFlags & CHN_FILTER) ? false : true, envpitch);
-#endif // NO_FILTER
- } else
- // Pitch Envelope
- {
- if(m_nType == MOD_TYPE_MPT && pChn->pModInstrument && pChn->pModInstrument->pTuning)
- {
- if(pChn->nFineTune != envpitch)
- {
- pChn->nFineTune = envpitch;
- pChn->m_CalculateFreq = true;
- //Preliminary tests indicated that this behavior
- //is very close to original(with 12TET) when finestep count
- //is 15.
- }
- }
- else //Original behavior
- {
- int l = envpitch;
- if (l < 0)
- {
- l = -l;
- if (l > 255) l = 255;
- period = _muldiv(period, LinearSlideUpTable[l], 0x10000);
- } else
- {
- if (l > 255) l = 255;
- period = _muldiv(period, LinearSlideDownTable[l], 0x10000);
- }
- } //End: Original behavior.
- }
}
-
- // Vibrato
- if (pChn->dwFlags & CHN_VIBRATO)
- {
- UINT vibpos = pChn->nVibratoPos;
- LONG vdelta;
- switch (pChn->nVibratoType & 0x03)
- {
- case 1:
- // IT compatibility: IT has its own, more precise tables
- vdelta = IsCompatibleMode(TRK_IMPULSETRACKER) ? ITRampDownTable[vibpos] : ModRampDownTable[vibpos];
- break;
- case 2:
- // IT compatibility: IT has its own, more precise tables
- vdelta = IsCompatibleMode(TRK_IMPULSETRACKER) ? ITSquareTable[vibpos] : ModSquareTable[vibpos];
- break;
- case 3:
- //IT compatibility 19. Use random values
- if(IsCompatibleMode(TRK_IMPULSETRACKER))
- vdelta = (rand() & 0x7F) - 0x40;
- else
- vdelta = ModRandomTable[vibpos];
- break;
- default:
- // IT compatibility: IT has its own, more precise tables
- vdelta = IsCompatibleMode(TRK_IMPULSETRACKER) ? ITSinusTable[vibpos] : ModSinusTable[vibpos];
- }
- if(m_nType == MOD_TYPE_MPT && pChn->pModInstrument && pChn->pModInstrument->pTuning)
- {
- //Hack implementation: Scaling vibratofactor to [0.95; 1.05]
- //using figure from above tables and vibratodepth parameter
- vibratoFactor += 0.05F * vdelta * pChn->m_VibratoDepth / 128.0F;
- pChn->m_CalculateFreq = true;
- pChn->m_ReCalculateFreqOnFirstTick = false;
+ ProcessPanbrello(pChn);
- if(m_nTickCount + 1 == m_nMusicSpeed)
- pChn->m_ReCalculateFreqOnFirstTick = true;
- }
- else //Original behavior
- {
- UINT vdepth;
- // IT compatibility: correct vibrato depth
- if(IsCompatibleMode(TRK_IMPULSETRACKER))
- {
- // Yes, vibrato goes backwards with old effects enabled!
- if(m_dwSongFlags & SONG_ITOLDEFFECTS)
- {
- vdepth = 5;
- vdelta = -vdelta;
- } else
- {
- vdepth = 6;
- }
- }
- else
- {
- vdepth = ((!(m_nType & (MOD_TYPE_IT|MOD_TYPE_MPT))) || (m_dwSongFlags & SONG_ITOLDEFFECTS)) ? 6 : 7;
- }
- vdelta = (vdelta * (int)pChn->nVibratoDepth) >> vdepth;
- if ((m_dwSongFlags & SONG_LINEARSLIDES) && (m_nType & (MOD_TYPE_IT | MOD_TYPE_MPT)))
- {
- LONG l = vdelta;
- if (l < 0)
- {
- l = -l;
- vdelta = _muldiv(period, LinearSlideDownTable[l >> 2], 0x10000) - period;
- if (l & 0x03) vdelta += _muldiv(period, FineLinearSlideDownTable[l & 0x03], 0x10000) - period;
- } else
- {
- vdelta = _muldiv(period, LinearSlideUpTable[l >> 2], 0x10000) - period;
- if (l & 0x03) vdelta += _muldiv(period, FineLinearSlideUpTable[l & 0x03], 0x10000) - period;
- }
- }
- period += vdelta;
- }
- if ((m_nTickCount) || ((m_nType & (MOD_TYPE_IT | MOD_TYPE_MPT)) && (!(m_dwSongFlags & SONG_ITOLDEFFECTS))))
- {
- // IT compatibility: IT has its own, more precise tables
- if(IsCompatibleMode(TRK_IMPULSETRACKER))
- pChn->nVibratoPos = (vibpos + 4 * pChn->nVibratoSpeed) & 0xFF;
- else
- pChn->nVibratoPos = (vibpos + pChn->nVibratoSpeed) & 0x3F;
- }
- }
- // Panbrello
- if (pChn->dwFlags & CHN_PANBRELLO)
- {
- UINT panpos;
- // IT compatibility: IT has its own, more precise tables
- if(IsCompatibleMode(TRK_IMPULSETRACKER))
- panpos = pChn->nPanbrelloPos & 0xFF;
- else
- panpos = ((pChn->nPanbrelloPos + 0x10) >> 2) & 0x3F;
- LONG pdelta;
- switch (pChn->nPanbrelloType & 0x03)
- {
- case 1:
- // IT compatibility: IT has its own, more precise tables
- pdelta = IsCompatibleMode(TRK_IMPULSETRACKER) ? ITRampDownTable[panpos] : ModRampDownTable[panpos];
- break;
- case 2:
- // IT compatibility: IT has its own, more precise tables
- pdelta = IsCompatibleMode(TRK_IMPULSETRACKER) ? ITSquareTable[panpos] : ModSquareTable[panpos];
- break;
- case 3:
- //IT compatibility 19. Use random values
- if(IsCompatibleMode(TRK_IMPULSETRACKER))
- pdelta = (rand() & 0x7f) - 0x40;
- else
- pdelta = ModRandomTable[panpos];
- break;
- default:
- // IT compatibility: IT has its own, more precise tables
- pdelta = IsCompatibleMode(TRK_IMPULSETRACKER) ? ITSinusTable[panpos] : ModSinusTable[panpos];
- }
- pChn->nPanbrelloPos += pChn->nPanbrelloSpeed;
- pdelta = ((pdelta * (int)pChn->nPanbrelloDepth) + 2) >> 3;
- pdelta += pChn->nRealPan;
-
- pChn->nRealPan = CLAMP(pdelta, 0, 256);
- //if(IsCompatibleMode(TRK_IMPULSETRACKER)) pChn->nPan = pChn->nRealPan; // TODO
- }
int nPeriodFrac = 0;
- // Sample Auto-Vibrato
- if ((pChn->pModSample) && (pChn->pModSample->nVibDepth))
- {
- MODSAMPLE *pSmp = pChn->pModSample;
- const bool alternativeTuning = pChn->pModInstrument && pChn->pModInstrument->pTuning;
- // IT compatibility: Autovibrato is so much different in IT that I just put this in a separate code block, to get rid of a dozen IsCompatibilityMode() calls.
- if(IsCompatibleMode(TRK_IMPULSETRACKER) && !alternativeTuning)
- {
- // Schism's autovibrato code
+ ProcessPitchFilterEnvelope(pChn, period);
+ ProcessVibrato(pChn, period, vibratoFactor);
+ ProcessSampleAutoVibrato(pChn, period, vibratoFactor, nPeriodFrac);
- /*
- X86 Assembler from ITTECH.TXT:
- 1) Mov AX, [SomeVariableNameRelatingToVibrato]
- 2) Add AL, Rate
- 3) AdC AH, 0
- 4) AH contains the depth of the vibrato as a fine-linear slide.
- 5) Mov [SomeVariableNameRelatingToVibrato], AX ; For the next cycle.
- */
- const int vibpos = pChn->nAutoVibPos & 0xFF;
- int adepth = pChn->nAutoVibDepth; // (1)
- adepth += pSmp->nVibSweep & 0xFF; // (2 & 3)
- adepth = min(adepth, (int)(pSmp->nVibDepth << 8));
- pChn->nAutoVibDepth = adepth; // (5)
- adepth >>= 8; // (4)
-
- pChn->nAutoVibPos += pSmp->nVibRate;
-
- int vdelta;
- switch(pSmp->nVibType)
- {
- case VIB_RANDOM:
- vdelta = (rand() & 0x7F) - 0x40;
- break;
- case VIB_RAMP_DOWN:
- vdelta = ITRampDownTable[vibpos];
- break;
- case VIB_RAMP_UP:
- vdelta = -ITRampDownTable[vibpos];
- break;
- case VIB_SQUARE:
- vdelta = ITSquareTable[vibpos];
- break;
- case VIB_SINE:
- default:
- vdelta = ITSinusTable[vibpos];
- break;
- }
-
- vdelta = (vdelta * adepth) >> 6;
- int l = abs(vdelta);
- if(vdelta < 0)
- {
- vdelta = _muldiv(period, LinearSlideDownTable[l >> 2], 0x10000) - period;
- if (l & 0x03)
- {
- vdelta += _muldiv(period, FineLinearSlideDownTable[l & 0x03], 0x10000) - period;
- }
- } else
- {
- vdelta = _muldiv(period, LinearSlideUpTable[l >> 2], 0x10000) - period;
- if (l & 0x03)
- {
- vdelta += _muldiv(period, FineLinearSlideUpTable[l & 0x03], 0x10000) - period;
- }
- }
- period -= vdelta;
-
- } else
- {
- // MPT's autovibrato code
- if (pSmp->nVibSweep == 0)
- {
- pChn->nAutoVibDepth = pSmp->nVibDepth << 8;
- } else
- {
- // Calculate current autovibrato depth using vibsweep
- if (m_nType & (MOD_TYPE_IT | MOD_TYPE_MPT))
- {
- // Note: changed bitshift from 3 to 1 as the variable is not divided by 4 in the IT loader anymore
- // - so we divide sweep by 4 here.
- pChn->nAutoVibDepth += pSmp->nVibSweep << 1;
- } else
- {
- if (!(pChn->dwFlags & CHN_KEYOFF))
- {
- pChn->nAutoVibDepth += (pSmp->nVibDepth << 8) / pSmp->nVibSweep;
- }
- }
- if ((pChn->nAutoVibDepth >> 8) > pSmp->nVibDepth)
- pChn->nAutoVibDepth = pSmp->nVibDepth << 8;
- }
- pChn->nAutoVibPos += pSmp->nVibRate;
- int vdelta;
- switch(pSmp->nVibType)
- {
- case VIB_RANDOM:
- vdelta = ModRandomTable[pChn->nAutoVibPos & 0x3F];
- pChn->nAutoVibPos++;
- break;
- case VIB_RAMP_DOWN:
- vdelta = ((0x40 - (pChn->nAutoVibPos >> 1)) & 0x7F) - 0x40;
- break;
- case VIB_RAMP_UP:
- vdelta = ((0x40 + (pChn->nAutoVibPos >> 1)) & 0x7f) - 0x40;
- break;
- case VIB_SQUARE:
- vdelta = (pChn->nAutoVibPos & 128) ? +64 : -64;
- break;
- case VIB_SINE:
- default:
- vdelta = ft2VibratoTable[pChn->nAutoVibPos & 0xFF];
- }
- int n;
- n = ((vdelta * pChn->nAutoVibDepth) >> 8);
-
- if(alternativeTuning)
- {
- //Vib sweep is not taken into account here.
- vibratoFactor += 0.05F * pSmp->nVibDepth * vdelta / 4096.0F; //4096 == 64^2
- //See vibrato for explanation.
- pChn->m_CalculateFreq = true;
- /*
- Finestep vibrato:
- const float autoVibDepth = pSmp->nVibDepth * val / 4096.0F; //4096 == 64^2
- vibratoFineSteps += static_cast<CTuning::FINESTEPTYPE>(pChn->pModInstrument->pTuning->GetFineStepCount() * autoVibDepth);
- pChn->m_CalculateFreq = true;
- */
- }
- else //Original behavior
- {
- if (m_nType & (MOD_TYPE_IT | MOD_TYPE_MPT))
- {
- int df1, df2;
- if (n < 0)
- {
- n = -n;
- UINT n1 = n >> 8;
- df1 = LinearSlideUpTable[n1];
- df2 = LinearSlideUpTable[n1+1];
- } else
- {
- UINT n1 = n >> 8;
- df1 = LinearSlideDownTable[n1];
- df2 = LinearSlideDownTable[n1+1];
- }
- n >>= 2;
- period = _muldiv(period, df1 + ((df2 - df1) * (n & 0x3F) >> 6), 256);
- nPeriodFrac = period & 0xFF;
- period >>= 8;
- } else
- {
- period += (n >> 6);
- }
- } //Original MPT behavior
- }
-
- } //End: AutoVibrato
// Final Period
if (period <= m_nMinPeriod)
{
@@ -1775,100 +2020,16 @@
if (ninc > 0xFF0000) ninc = 0xFF0000;
pChn->nInc = (ninc+1) & ~3;
}
-
- // Increment envelope position
+
+ // Increment envelope positions
if (pIns)
{
- // Volume Envelope
- if (pChn->dwFlags & CHN_VOLENV)
- {
- // Increase position
- pChn->VolEnv.nEnvPosition++;
- // Volume Loop ?
- if (pIns->VolEnv.dwFlags & ENV_LOOP)
- {
- UINT volloopend = pIns->VolEnv.Ticks[pIns->VolEnv.nLoopEnd];
- if (m_nType != MOD_TYPE_XM) volloopend++;
- if (pChn->VolEnv.nEnvPosition == volloopend)
- {
- pChn->VolEnv.nEnvPosition = pIns->VolEnv.Ticks[pIns->VolEnv.nLoopStart];
- if ((pIns->VolEnv.nLoopEnd == pIns->VolEnv.nLoopStart) && (!pIns->VolEnv.Values[pIns->VolEnv.nLoopStart])
- && ((!(m_nType & MOD_TYPE_XM)) || (pIns->VolEnv.nLoopEnd+1 == (int)pIns->VolEnv.nNodes)))
- {
- pChn->dwFlags |= CHN_NOTEFADE;
- pChn->nFadeOutVol = 0;
- }
- }
- }
- // Volume Sustain ?
- if ((pIns->VolEnv.dwFlags & ENV_SUSTAIN) && (!(pChn->dwFlags & CHN_KEYOFF)))
- {
- if (pChn->VolEnv.nEnvPosition == (UINT)pIns->VolEnv.Ticks[pIns->VolEnv.nSustainEnd] + 1)
- pChn->VolEnv.nEnvPosition = pIns->VolEnv.Ticks[pIns->VolEnv.nSustainStart];
- } else
- // End of Envelope ?
- if (pChn->VolEnv.nEnvPosition > pIns->VolEnv.Ticks[pIns->VolEnv.nNodes - 1])
- {
- if ((m_nType & (MOD_TYPE_IT | MOD_TYPE_MPT)) || (pChn->dwFlags & CHN_KEYOFF)) pChn->dwFlags |= CHN_NOTEFADE;
- pChn->VolEnv.nEnvPosition = pIns->VolEnv.Ticks[pIns->VolEnv.nNodes - 1];
- if ((!pIns->VolEnv.Values[pIns->VolEnv.nNodes-1]) && ((nChn >= m_nChannels) || (m_nType & (MOD_TYPE_IT | MOD_TYPE_MPT))))
- {
- pChn->dwFlags |= CHN_NOTEFADE;
- pChn->nFadeOutVol = 0;
- pChn->nRealVolume = 0;
- }
- }
- }
- // Panning Envelope
- if (pChn->dwFlags & CHN_PANENV)
- {
- pChn->PanEnv.nEnvPosition++;
- if (pIns->PanEnv.dwFlags & ENV_LOOP)
- {
- UINT panloopend = pIns->PanEnv.Ticks[pIns->PanEnv.nLoopEnd];
- if (m_nType != MOD_TYPE_XM) panloopend++;
- if (pChn->PanEnv.nEnvPosition == panloopend)
- pChn->PanEnv.nEnvPosition = pIns->PanEnv.Ticks[pIns->PanEnv.nLoopStart];
- }
- // Panning Sustain ?
- if ((pIns->PanEnv.dwFlags & ENV_SUSTAIN) && (pChn->PanEnv.nEnvPosition == (UINT)pIns->PanEnv.Ticks[pIns->PanEnv.nSustainEnd]+1)
- && (!(pChn->dwFlags & CHN_KEYOFF)))
- {
- // Panning sustained
- pChn->PanEnv.nEnvPosition = pIns->PanEnv.Ticks[pIns->PanEnv.nSustainStart];
- } else
- {
- if (pChn->PanEnv.nEnvPosition > pIns->PanEnv.Ticks[pIns->PanEnv.nNodes - 1])
- pChn->PanEnv.nEnvPosition = pIns->PanEnv.Ticks[pIns->PanEnv.nNodes - 1];
- }
- }
- // Pitch Envelope
- if (pChn->dwFlags & CHN_PITCHENV)
- {
- // Increase position
- pChn->PitchEnv.nEnvPosition++;
- // Pitch Loop ?
- if (pIns->PitchEnv.dwFlags & ENV_LOOP)
- {
- UINT pitchloopend = pIns->PitchEnv.Ticks[pIns->PitchEnv.nLoopEnd];
- //IT compatibility 24. Short envelope loops
- if (IsCompatibleMode(TRK_IMPULSETRACKER)) pitchloopend++;
- if (pChn->PitchEnv.nEnvPosition >= pitchloopend)
- pChn->PitchEnv.nEnvPosition = pIns->PitchEnv.Ticks[pIns->PitchEnv.nLoopStart];
- }
- // Pitch Sustain ?
- if ((pIns->PitchEnv.dwFlags & ENV_SUSTAIN) && (!(pChn->dwFlags & CHN_KEYOFF)))
- {
- if (pChn->PitchEnv.nEnvPosition == (UINT)pIns->PitchEnv.Ticks[pIns->PitchEnv.nSustainEnd]+1)
- pChn->PitchEnv.nEnvPosition = pIns->PitchEnv.Ticks[pIns->PitchEnv.nSustainStart];
- } else
- {
- if (pChn->PitchEnv.nEnvPosition > pIns->PitchEnv.Ticks[pIns->PitchEnv.nNodes - 1])
- pChn->PitchEnv.nEnvPosition = pIns->PitchEnv.Ticks[pIns->PitchEnv.nNodes - 1];
- }
- }
+ IncrementVolumeEnvelopePosition(pChn);
+ IncrementPanningEnvelopePosition(pChn);
+ IncrementPitchFilterEnvelopePosition(pChn);
}
+
#ifdef MODPLUG_PLAYER
// Limit CPU -> > 80% -> don't ramp
if ((gnCPUUsage >= 80) && (!pChn->nRealVolume))
@@ -2238,8 +2399,8 @@
}
}
-int CSoundFile::GetVolEnvValueFromPosition(int position, MODINSTRUMENT* pIns) const
-//---------------------------------------------------------------------------------
+int CSoundFile::GetVolEnvValueFromPosition(int position, const MODINSTRUMENT* pIns) const
+//---------------------------------------------------------------------------------------
{
UINT pt = pIns->VolEnv.nNodes - 1;
@@ -2289,38 +2450,45 @@
VOID CSoundFile::ApplyGlobalVolume(int SoundBuffer[], long lTotalSampleCount)
//---------------------------------------------------------------------------
{
- long delta=0;
- long step=0;
+ long delta=0;
+ long step=0;
- if (m_nGlobalVolumeDestination != m_nGlobalVolume) { //user has provided new global volume
- m_nGlobalVolumeDestination = m_nGlobalVolume;
- m_nSamplesToGlobalVolRampDest = gnVolumeRampSamples;
- }
+ if (m_nGlobalVolumeDestination != m_nGlobalVolume)
+ {
+ //user has provided new global volume
+ m_nGlobalVolumeDestination = m_nGlobalVolume;
+ m_nSamplesToGlobalVolRampDest = gnVolumeRampSamples;
+ }
- if (m_nSamplesToGlobalVolRampDest>0) { // still some ramping left to do.
- long highResGlobalVolumeDestination = static_cast<long>(m_nGlobalVolumeDestination)<<VOLUMERAMPPRECISION;
-
- delta = highResGlobalVolumeDestination-m_lHighResRampingGlobalVolume;
+ if (m_nSamplesToGlobalVolRampDest>0)
+ {
+ // still some ramping left to do.
+ long highResGlobalVolumeDestination = static_cast<long>(m_nGlobalVolumeDestination)<<VOLUMERAMPPRECISION;
+
+ delta = highResGlobalVolumeDestination-m_lHighResRampingGl...
[truncated message content] |
|
From: <rel...@us...> - 2011-07-30 20:40:37
|
Revision: 944
http://modplug.svn.sourceforge.net/modplug/?rev=944&view=rev
Author: relabsoluness
Date: 2011-07-30 20:40:29 +0000 (Sat, 30 Jul 2011)
Log Message:
-----------
[Ref] Clean up: Building mptrack-project should now generate much less warnings.
Modified Paths:
--------------
trunk/OpenMPT/mptrack/ColourEdit.cpp
trunk/OpenMPT/mptrack/Draw_pat.cpp
trunk/OpenMPT/mptrack/EffectVis.cpp
trunk/OpenMPT/mptrack/EffectVis.h
trunk/OpenMPT/mptrack/HyperEdit.cpp
trunk/OpenMPT/mptrack/HyperEdit2.cpp
trunk/OpenMPT/mptrack/ModConvert.cpp
trunk/OpenMPT/mptrack/OpenGLControl.cpp
trunk/OpenMPT/mptrack/OpenGLControl.h
trunk/OpenMPT/mptrack/OpenGLDevice.cpp
trunk/OpenMPT/mptrack/OpenGLEditor.cpp
trunk/OpenMPT/mptrack/OpenGLEditor.h
trunk/OpenMPT/mptrack/PSRatioCalc.cpp
trunk/OpenMPT/mptrack/PatternGotoDialog.cpp
trunk/OpenMPT/mptrack/SoundFilePlayConfig.h
trunk/OpenMPT/mptrack/TrackerSettings.cpp
trunk/OpenMPT/mptrack/View_pat.cpp
trunk/OpenMPT/mptrack/View_pat.h
trunk/OpenMPT/mptrack/misc_util.h
trunk/OpenMPT/mptrack/test/test.cpp
trunk/OpenMPT/soundlib/Dlsbank.cpp
trunk/OpenMPT/soundlib/Dlsbank.h
trunk/OpenMPT/soundlib/LOAD_DMF.CPP
trunk/OpenMPT/soundlib/LOAD_DSM.CPP
trunk/OpenMPT/soundlib/Load_med.cpp
trunk/OpenMPT/soundlib/Load_mod.cpp
trunk/OpenMPT/soundlib/Snd_defs.h
trunk/OpenMPT/soundlib/Snd_flt.cpp
trunk/OpenMPT/soundlib/Snddev.cpp
trunk/OpenMPT/soundlib/Sndmix.cpp
trunk/OpenMPT/soundlib/Tables.cpp
trunk/OpenMPT/soundlib/WindowedFIR.cpp
trunk/OpenMPT/soundlib/mod_specifications.h
Modified: trunk/OpenMPT/mptrack/ColourEdit.cpp
===================================================================
--- trunk/OpenMPT/mptrack/ColourEdit.cpp 2011-07-30 20:32:17 UTC (rev 943)
+++ trunk/OpenMPT/mptrack/ColourEdit.cpp 2011-07-30 20:40:29 UTC (rev 944)
@@ -25,6 +25,7 @@
HBRUSH CColourEdit::CtlColor(CDC* pDC, UINT nCtlColor)
{
+ UNREFERENCED_PARAMETER(nCtlColor);
pDC->SetTextColor(m_crText); //set text color
pDC->SetBkColor(m_crBackGnd); //set the text's background color
return m_brBackGnd; //return the brush used for background - this sets control background
Modified: trunk/OpenMPT/mptrack/Draw_pat.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Draw_pat.cpp 2011-07-30 20:32:17 UTC (rev 943)
+++ trunk/OpenMPT/mptrack/Draw_pat.cpp 2011-07-30 20:40:29 UTC (rev 944)
@@ -374,7 +374,7 @@
{
if(pTuning)
{ // Drawing custom note names
- string noteStr = pTuning->GetNoteName(note-NOTE_MIDDLEC);
+ string noteStr = pTuning->GetNoteName(static_cast<CTuningBase::NOTEINDEXTYPE>(note-NOTE_MIDDLEC));
if(noteStr.size() < 3)
noteStr.resize(3, ' ');
@@ -528,7 +528,7 @@
DrawButtonRect(hdc, &rect, s,
(pSndFile->ChnSettings[ncolhdr].dwFlags & CHN_MUTE) ? TRUE : FALSE,
((m_bInItemRect) && ((m_nDragItem & DRAGITEM_MASK) == DRAGITEM_CHNHEADER) && ((m_nDragItem & DRAGITEM_VALUEMASK) == ncolhdr)) ? TRUE : FALSE,
- pModDoc->IsChannelRecord(ncolhdr) ? DT_RIGHT : DT_CENTER);
+ pModDoc->IsChannelRecord(static_cast<CHANNELINDEX>(ncolhdr)) ? DT_RIGHT : DT_CENTER);
// When dragging around channel headers, mark insertion position
if(m_bDragging && !m_bInItemRect
@@ -550,7 +550,7 @@
CRect insRect;
insRect.SetRect(xpaint, ypaint, xpaint+nColumnWidth / 8 + 3, ypaint + 16);
// if (MultiRecordMask[ncolhdr>>3] & (1 << (ncolhdr&7)))
- if (pModDoc->IsChannelRecord1(ncolhdr))
+ if (pModDoc->IsChannelRecord1(static_cast<CHANNELINDEX>(ncolhdr)))
{
// rect.DeflateRect(1, 1);
// InvertRect(hdc, &rect);
@@ -562,7 +562,7 @@
DrawButtonRect(hdc, &insRect, s, FALSE, FALSE, DT_CENTER);
FrameRect(hdc,&insRect,CMainFrame::brushBlack);
}
- else if (pModDoc->IsChannelRecord2(ncolhdr))
+ else if (pModDoc->IsChannelRecord2(static_cast<CHANNELINDEX>(ncolhdr)))
{
FrameRect(hdc,&rect,CMainFrame::brushGray);
InvertRect(hdc, &rect);
@@ -1003,7 +1003,7 @@
{
if (m->command)
{
- UINT command = m->command & 0x3F;
+ MODCOMMAND::COMMAND command = m->command & 0x3F;
int n = pSndFile->GetModSpecifications().GetEffectLetter(command);
ASSERT(n > ' ');
//if (n <= ' ') n = '?';
@@ -1484,7 +1484,7 @@
{
CSoundFile *pSndFile = pModDoc->GetSoundFile();
CHAR s[512];
- UINT nChn;
+ CHANNELINDEX nChn;
wsprintf(s, "Row %d, Col %d", GetCurrentRow(), GetCurrentChannel() + 1);
pMainFrm->SetUserText(s);
if (::GetFocus() == m_hWnd)
Modified: trunk/OpenMPT/mptrack/EffectVis.cpp
===================================================================
--- trunk/OpenMPT/mptrack/EffectVis.cpp 2011-07-30 20:32:17 UTC (rev 943)
+++ trunk/OpenMPT/mptrack/EffectVis.cpp 2011-07-30 20:40:29 UTC (rev 944)
@@ -37,7 +37,7 @@
m_nParamToErase = -1;
m_nLastDrawnRow = -1;
m_nLastDrawnY = -1;
- m_nOldPlayPos = -1;
+ m_nOldPlayPos = UINT_MAX;
m_nFillEffect = m_pModDoc->GetIndexFromEffect(CMD_SMOOTHMIDI, 0);
m_nAction=kAction_OverwriteFX;
m_templatePCNote.Set(NOTE_PCS, 1, 0, 0);
@@ -334,6 +334,7 @@
//-----------------------------------------------------------------------------------------
void CEffectVis::ShowVis(CDC * pDC, CRect rectBorder)
{
+ UNREFERENCED_PARAMETER(rectBorder);
if (m_boolForceRedraw)
{
m_boolForceRedraw = FALSE ;
@@ -438,7 +439,7 @@
//---------------------------------------
{
//erase
- if (m_nRowToErase<m_startRow || m_nParamToErase < 0)
+ if ((UINT)m_nRowToErase<m_startRow || m_nParamToErase < 0)
{
::FillRect(m_dcNodes.m_hDC, &m_rcDraw, m_brushBlack);
}
@@ -461,7 +462,7 @@
void CEffectVis::InvalidateRow(int row)
{
- if ((row < m_startRow) || (row > m_endRow)) return;
+ if (((UINT)row < m_startRow) || ((UINT)row > m_endRow)) return;
//It seems this optimisation doesn't work properly yet. Disable in Update()
@@ -538,6 +539,9 @@
void CEffectVis::OnSize(UINT nType, int cx, int cy)
{
+ UNREFERENCED_PARAMETER(nType);
+ UNREFERENCED_PARAMETER(cx);
+ UNREFERENCED_PARAMETER(cy);
GetClientRect(&m_rcFullWin);
m_rcDraw.SetRect( m_rcFullWin.left + LEFTBORDER, m_rcFullWin.top + TOPBORDER,
m_rcFullWin.right - RIGHTBORDER, m_rcFullWin.bottom - BOTTOMBORDER);
@@ -585,7 +589,7 @@
m_startRow = startRow;
m_endRow = endRow;
m_nRows = endRow - startRow;
- m_nChan = nchn;
+ m_nChan = static_cast<CHANNELINDEX>(nchn);
m_nPattern = pat;
//Check document exists
@@ -648,7 +652,7 @@
rect.SetRect(x-NODEHALF, y-NODEHALF, x+NODEHALF+1, y+NODEHALF+1);
if (rect.PtInRect(point))
{
- m_pModDoc->GetPatternUndo()->PrepareUndo(m_nPattern, m_nChan, row, m_nChan+1, row+1);
+ m_pModDoc->GetPatternUndo()->PrepareUndo(static_cast<PATTERNINDEX>(m_nPattern), m_nChan, row, m_nChan+1, row+1);
m_nDragItem = row;
}
}
@@ -687,7 +691,7 @@
{
// Interpolate if we detect that rows have been skipped but the left mouse button was not released.
// This ensures we produce a smooth curve even when we are not notified of mouse movements at a high frequency (e.g. if CPU usage is high)
- if ((m_nLastDrawnRow>(int)m_startRow) && (row != m_nLastDrawnRow) && (row != m_nLastDrawnRow+1) && (row != m_nLastDrawnRow-1))
+ if ((m_nLastDrawnRow>(int)m_startRow) && ((int)row != m_nLastDrawnRow) && ((int)row != m_nLastDrawnRow+1) && ((int)row != m_nLastDrawnRow-1))
{
int steps = abs((long)row-(long)m_nLastDrawnRow);
ASSERT(steps!=0);
@@ -698,7 +702,7 @@
for (int i=1; i<=steps; i++)
{
currentRow = m_nLastDrawnRow+(direction*i);
- int interpolatedY = m_nLastDrawnY+((float)i*factor+0.5f);
+ int interpolatedY = static_cast<int>(m_nLastDrawnY+((float)i*factor+0.5f));
MakeChange(currentRow, interpolatedY);
}
@@ -746,7 +750,7 @@
SetFocus();
SetCapture();
- m_pModDoc->GetPatternUndo()->PrepareUndo(m_nPattern, m_nChan, m_startRow, m_nChan+1, m_endRow);
+ m_pModDoc->GetPatternUndo()->PrepareUndo(static_cast<PATTERNINDEX>(m_nPattern), m_nChan, m_startRow, m_nChan+1, m_endRow);
m_dwStatus |= FXVSTATUS_LDRAGGING;
}
@@ -806,7 +810,7 @@
{
k =m_cmbEffectList.AddString(s);
m_cmbEffectList.SetItemData(k, i);
- if (i==m_nFillEffect)
+ if ((long)i == m_nFillEffect)
m_cmbEffectList.SetCurSel(k);
}
}
Modified: trunk/OpenMPT/mptrack/EffectVis.h
===================================================================
--- trunk/OpenMPT/mptrack/EffectVis.h 2011-07-30 20:32:17 UTC (rev 943)
+++ trunk/OpenMPT/mptrack/EffectVis.h 2011-07-30 20:40:29 UTC (rev 944)
@@ -62,7 +62,7 @@
UINT m_startRow;
UINT m_endRow;
UINT m_nRows;
- UINT m_nChan;
+ CHANNELINDEX m_nChan;
UINT m_nPattern;
long m_nFillEffect, m_nAction;
Modified: trunk/OpenMPT/mptrack/HyperEdit.cpp
===================================================================
--- trunk/OpenMPT/mptrack/HyperEdit.cpp 2011-07-30 20:32:17 UTC (rev 943)
+++ trunk/OpenMPT/mptrack/HyperEdit.cpp 2011-07-30 20:40:29 UTC (rev 944)
@@ -21,6 +21,8 @@
#include "stdafx.h"
#include "HyperEdit.h"
+#pragma warning(disable:4018) // "'<' : signed/unsigned mismatch"
+
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
@@ -215,3 +217,5 @@
CEdit::OnTimer(nIDEvent);
}
+#pragma warning(default:4018)
+
Modified: trunk/OpenMPT/mptrack/HyperEdit2.cpp
===================================================================
--- trunk/OpenMPT/mptrack/HyperEdit2.cpp 2011-07-30 20:32:17 UTC (rev 943)
+++ trunk/OpenMPT/mptrack/HyperEdit2.cpp 2011-07-30 20:40:29 UTC (rev 944)
@@ -20,6 +20,9 @@
#include "stdafx.h"
#include "HyperEdit.h"
+#pragma warning(disable:4244) // "conversion from 'type1' to 'type2', possible loss of data"
+#pragma warning(disable:4018) // "'<' : signed/unsigned mismatch"
+
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
@@ -235,3 +238,5 @@
return FALSE; // Not a valid token by default
}
+#pragma warning(default:4244)
+#pragma warning(default:4018)
Modified: trunk/OpenMPT/mptrack/ModConvert.cpp
===================================================================
--- trunk/OpenMPT/mptrack/ModConvert.cpp 2011-07-30 20:32:17 UTC (rev 943)
+++ trunk/OpenMPT/mptrack/ModConvert.cpp 2011-07-30 20:40:29 UTC (rev 944)
@@ -51,7 +51,7 @@
//---------------------------------------------------------------------------------------------------------
{
// shorten instrument envelope if necessary (for mod conversion)
- const UINT iEnvMax = pSndFile->GetModSpecifications().envelopePointsMax;
+ const uint8 iEnvMax = pSndFile->GetModSpecifications().envelopePointsMax;
#define TRIMENV(iEnvLen) if(iEnvLen > iEnvMax) { iEnvLen = iEnvMax; CHANGEMODTYPE_WARNING(wTrimmedEnvelopes); }
Modified: trunk/OpenMPT/mptrack/OpenGLControl.cpp
===================================================================
--- trunk/OpenMPT/mptrack/OpenGLControl.cpp 2011-07-30 20:32:17 UTC (rev 943)
+++ trunk/OpenMPT/mptrack/OpenGLControl.cpp 2011-07-30 20:40:29 UTC (rev 944)
@@ -2,6 +2,7 @@
//
#include "stdafx.h"
+#if 0
#include "OpenGLControl.h"
#ifdef _DEBUG
@@ -164,3 +165,5 @@
{
return TRUE;
}
+
+#endif // 0
Modified: trunk/OpenMPT/mptrack/OpenGLControl.h
===================================================================
--- trunk/OpenMPT/mptrack/OpenGLControl.h 2011-07-30 20:32:17 UTC (rev 943)
+++ trunk/OpenMPT/mptrack/OpenGLControl.h 2011-07-30 20:40:29 UTC (rev 944)
@@ -1,6 +1,8 @@
#if !defined(AFX_OPENGLCONTROL_H__52A6B63B_01A2_449D_8691_1FF59EECAB71__INCLUDED_)
#define AFX_OPENGLCONTROL_H__52A6B63B_01A2_449D_8691_1FF59EECAB71__INCLUDED_
+#if 0
+
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
@@ -63,4 +65,6 @@
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ f\xFCgt unmittelbar vor der vorhergehenden Zeile zus\xE4tzliche Deklarationen ein.
+#endif // 0
+
#endif // AFX_OPENGLCONTROL_H__52A6B63B_01A2_449D_8691_1FF59EECAB71__INCLUDED_
Modified: trunk/OpenMPT/mptrack/OpenGLDevice.cpp
===================================================================
--- trunk/OpenMPT/mptrack/OpenGLDevice.cpp 2011-07-30 20:32:17 UTC (rev 943)
+++ trunk/OpenMPT/mptrack/OpenGLDevice.cpp 2011-07-30 20:40:29 UTC (rev 944)
@@ -13,6 +13,7 @@
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
+#if 0
#include "OpenGLDevice.h"
//////////////////////////////////////////////////////////////////////
@@ -152,4 +153,6 @@
}
return true;
-}
\ No newline at end of file
+}
+
+#endif // 0
Modified: trunk/OpenMPT/mptrack/OpenGLEditor.cpp
===================================================================
--- trunk/OpenMPT/mptrack/OpenGLEditor.cpp 2011-07-30 20:32:17 UTC (rev 943)
+++ trunk/OpenMPT/mptrack/OpenGLEditor.cpp 2011-07-30 20:40:29 UTC (rev 944)
@@ -1,4 +1,5 @@
#include "stdafx.h"
+#if 0
#include "mptrack.h"
#include "mainfrm.h"
#include "childfrm.h"
@@ -83,3 +84,5 @@
CDialog::OnPaint();
}
}
+
+#endif // 0
Modified: trunk/OpenMPT/mptrack/OpenGLEditor.h
===================================================================
--- trunk/OpenMPT/mptrack/OpenGLEditor.h 2011-07-30 20:32:17 UTC (rev 943)
+++ trunk/OpenMPT/mptrack/OpenGLEditor.h 2011-07-30 20:40:29 UTC (rev 944)
@@ -1,4 +1,7 @@
#pragma once
+
+#if 0
+
#include "globals.h"
#include "OpenGLControl.h"
@@ -25,3 +28,5 @@
public:
afx_msg void OnPaint();
};
+
+#endif // 0
Modified: trunk/OpenMPT/mptrack/PSRatioCalc.cpp
===================================================================
--- trunk/OpenMPT/mptrack/PSRatioCalc.cpp 2011-07-30 20:32:17 UTC (rev 943)
+++ trunk/OpenMPT/mptrack/PSRatioCalc.cpp 2011-07-30 20:40:29 UTC (rev 944)
@@ -16,7 +16,7 @@
, m_lSamplesOrig(samples), m_nSpeed(speed), m_nTempo(tempo), m_dRatio(ratio), m_nRowsPerBeat(rowsPerBeat), m_nTempoMode(tempoMode)
{
//Sample rate will not change. We can calculate original duration once and disgard sampleRate.
- m_lMsOrig=1000.0*((double)m_lSamplesOrig / sampleRate);
+ m_lMsOrig= static_cast<ULONGLONG>(1000.0*((double)m_lSamplesOrig / sampleRate));
CalcSamples();
CalcMs();
CalcRows();
@@ -122,13 +122,13 @@
void CPSRatioCalc::CalcSamples()
{
- m_lSamplesNew=m_lSamplesOrig*(m_dRatio/100.0);
+ m_lSamplesNew = static_cast<ULONGLONG>(m_lSamplesOrig*(m_dRatio/100.0));
return;
}
void CPSRatioCalc::CalcMs()
{
- m_lMsNew=m_lMsOrig*(m_dRatio/100.0);
+ m_lMsNew = static_cast<ULONGLONG>(m_lMsOrig*(m_dRatio/100.0));
return;
}
Modified: trunk/OpenMPT/mptrack/PatternGotoDialog.cpp
===================================================================
--- trunk/OpenMPT/mptrack/PatternGotoDialog.cpp 2011-07-30 20:32:17 UTC (rev 943)
+++ trunk/OpenMPT/mptrack/PatternGotoDialog.cpp 2011-07-30 20:40:29 UTC (rev 944)
@@ -48,7 +48,7 @@
{
m_nRow = row;
m_nChannel = chan;
- m_nPattern = pat;
+ m_nPattern = static_cast<PATTERNINDEX>(pat);
m_nActiveOrder = ord;
m_nOrder = ord;
m_pSndFile = pSndFile;
@@ -103,7 +103,7 @@
}
UpdateData();
- m_nOrder = m_pSndFile->FindOrder(m_nPattern, m_nActiveOrder);
+ m_nOrder = m_pSndFile->FindOrder(static_cast<PATTERNINDEX>(m_nPattern), m_nActiveOrder);
if (m_nOrder >= m_pSndFile->Order.size()) {
m_nOrder=0;
Modified: trunk/OpenMPT/mptrack/SoundFilePlayConfig.h
===================================================================
--- trunk/OpenMPT/mptrack/SoundFilePlayConfig.h 2011-07-30 20:32:17 UTC (rev 943)
+++ trunk/OpenMPT/mptrack/SoundFilePlayConfig.h 2011-07-30 20:40:29 UTC (rev 944)
@@ -85,9 +85,9 @@
float m_VSTiAttenuation;
float m_VSTiVolume;
- float m_normalSamplePreAmp;
- float m_normalVSTiVol;
- float m_normalGlobalVol;
+ double m_normalSamplePreAmp;
+ double m_normalVSTiVol;
+ double m_normalGlobalVol;
bool m_globalVolumeAppliesToMaster;
bool m_ignorePreAmp;
Modified: trunk/OpenMPT/mptrack/TrackerSettings.cpp
===================================================================
--- trunk/OpenMPT/mptrack/TrackerSettings.cpp 2011-07-30 20:32:17 UTC (rev 943)
+++ trunk/OpenMPT/mptrack/TrackerSettings.cpp 2011-07-30 20:40:29 UTC (rev 944)
@@ -337,7 +337,8 @@
CSoundFile::m_nStereoSeparation = CMainFrame::GetPrivateProfileLong("Sound Settings", "StereoSeparation", CSoundFile::m_nStereoSeparation, iniFile);
CSoundFile::m_nMaxMixChannels = CMainFrame::GetPrivateProfileLong("Sound Settings", "MixChannels", CSoundFile::m_nMaxMixChannels, iniFile);
gbWFIRType = static_cast<BYTE>(CMainFrame::GetPrivateProfileDWord("Sound Settings", "XMMSModplugResamplerWFIRType", gbWFIRType, iniFile));
- gdWFIRCutoff = static_cast<double>(CMainFrame::GetPrivateProfileLong("Sound Settings", "ResamplerWFIRCutoff", gdWFIRCutoff * 100.0, iniFile)) / 100.0;
+ //gdWFIRCutoff = static_cast<double>(CMainFrame::GetPrivateProfileLong("Sound Settings", "ResamplerWFIRCutoff", gdWFIRCutoff * 100.0, iniFile)) / 100.0;
+ gdWFIRCutoff = static_cast<double>(CMainFrame::GetPrivateProfileLong("Sound Settings", "ResamplerWFIRCutoff", Util::Round<long>(gdWFIRCutoff * 100.0), iniFile)) / 100.0;
glVolumeRampSamples = CMainFrame::GetPrivateProfileLong("Sound Settings", "VolumeRampSamples", glVolumeRampSamples, iniFile);
m_dwMidiSetup = CMainFrame::GetPrivateProfileDWord("MIDI Settings", "MidiSetup", m_dwMidiSetup, iniFile);
Modified: trunk/OpenMPT/mptrack/View_pat.cpp
===================================================================
--- trunk/OpenMPT/mptrack/View_pat.cpp 2011-07-30 20:32:17 UTC (rev 943)
+++ trunk/OpenMPT/mptrack/View_pat.cpp 2011-07-30 20:40:29 UTC (rev 944)
@@ -136,7 +136,7 @@
CViewPattern::CViewPattern()
//--------------------------
{
- m_pOpenGLEditor = NULL; //rewbs.fxvis
+ //m_pOpenGLEditor = NULL; //rewbs.fxvis
m_pEffectVis = NULL; //rewbs.fxvis
m_pRandomizer = NULL;
m_bLastNoteEntryBlocked=false;
@@ -436,10 +436,11 @@
{
UINT ncol = GetCurrentColumn();
UINT xofs = GetXScrollPos();
- int nchn = ncol >> 3;
+ const UINT nchn = ncol >> 3;
if (nchn < xofs)
{
- scroll.cx = (int)(nchn - xofs) * m_szCell.cx;
+ scroll.cx = (int)(xofs - nchn) * m_szCell.cx;
+ scroll.cx *= -1;
} else
if (nchn > xofs)
{
@@ -713,11 +714,13 @@
m_pRandomizer=NULL;
}
+ /*
if (m_pOpenGLEditor) {
m_pOpenGLEditor->DoClose();
delete m_pOpenGLEditor;
m_pOpenGLEditor = NULL;
}
+ */
CModScrollView::OnDestroy();
@@ -770,14 +773,14 @@
const DWORD endSel = (GetRowFromCursor(m_dwBeginSel) < GetRowFromCursor(m_dwEndSel)) ? m_dwEndSel : m_dwBeginSel;
pModDoc->GetPatternUndo()->PrepareUndo(m_nPattern, 0, 0, pSndFile->GetNumChannels(), pSndFile->Patterns[m_nPattern].GetNumRows());
- int finalDest = GetRowFromCursor(startSel) + (GetRowFromCursor(endSel) - GetRowFromCursor(startSel))*2;
+ const ROWINDEX finalDest = GetRowFromCursor(startSel) + (GetRowFromCursor(endSel) - GetRowFromCursor(startSel))*2;
for (int row = finalDest; row > (int)GetRowFromCursor(startSel); row -= 2)
{
int offset = row - GetRowFromCursor(startSel);
for (UINT i=(startSel & 0xFFFF); i<=(endSel & 0xFFFF); i++) if (GetColTypeFromCursor(i) <= LAST_COLUMN)
{
UINT chn = GetChanFromCursor(i);
- if ((chn >= pSndFile->GetNumChannels()) || (row >= pSndFile->Patterns[m_nPattern].GetNumRows())) continue;
+ if ((chn >= pSndFile->GetNumChannels()) || (ROWINDEX(row) >= pSndFile->Patterns[m_nPattern].GetNumRows())) continue;
MODCOMMAND *dest = &p[row * pSndFile->GetNumChannels() + chn];
MODCOMMAND *src = &p[(row-offset/2) * pSndFile->GetNumChannels() + chn];
MODCOMMAND *blank= &p[(row-1) * pSndFile->GetNumChannels() + chn];
@@ -820,12 +823,12 @@
const DWORD endSel = (GetRowFromCursor(m_dwBeginSel) < GetRowFromCursor(m_dwEndSel)) ? m_dwEndSel : m_dwBeginSel;
pModDoc->GetPatternUndo()->PrepareUndo(m_nPattern, 0, 0, pSndFile->GetNumChannels(), pSndFile->Patterns[m_nPattern].GetNumRows());
- int finalDest = GetRowFromCursor(startSel) + (GetRowFromCursor(endSel) - GetRowFromCursor(startSel))/2;
+ const ROWINDEX finalDest = GetRowFromCursor(startSel) + (GetRowFromCursor(endSel) - GetRowFromCursor(startSel))/2;
- for (int row = GetRowFromCursor(startSel); row <= finalDest; row++)
+ for (ROWINDEX row = GetRowFromCursor(startSel); row <= finalDest; row++)
{
- int offset = row - GetRowFromCursor(startSel);
- int srcRow = GetRowFromCursor(startSel) + (offset * 2);
+ const ROWINDEX offset = row - GetRowFromCursor(startSel);
+ const ROWINDEX srcRow = GetRowFromCursor(startSel) + (offset * 2);
for (UINT i = (startSel & 0xFFFF); i <= (endSel & 0xFFFF); i++) if (GetColTypeFromCursor(i) <= LAST_COLUMN)
{
@@ -865,7 +868,7 @@
}
}
}
- for (int row = finalDest + 1; row <= GetRowFromCursor(endSel); row++)
+ for (ROWINDEX row = finalDest + 1; row <= GetRowFromCursor(endSel); row++)
{
for (UINT i = (startSel & 0xFFFF); i <= (endSel & 0xFFFF); i++) if (GetColTypeFromCursor(i) <= LAST_COLUMN)
{
@@ -2385,8 +2388,9 @@
bool doPCinterpolation = false;
- int vsrc, vdest, vcmd = 0, verr = 0, distance;
- distance = row1 - row0;
+ int vsrc, vdest, vcmd = 0, verr = 0;
+ ASSERT(row1 >= row0);
+ UINT distance = row1 - row0;
const MODCOMMAND srcCmd = *pSndFile->Patterns[m_nPattern].GetpModCommand(row0, nchn);
const MODCOMMAND destCmd = *pSndFile->Patterns[m_nPattern].GetpModCommand(row1, nchn);
@@ -3014,7 +3018,7 @@
if (vol > 64) vol = 64;
m->vol = (BYTE)vol;
}
- if ((((nChn << 3) | 3) >= (m_dwBeginSel & 0xFFFF)) && (((nChn << 3) | 3) <= (m_dwEndSel & 0xFFFF)))
+ if ((((nChn << 3) | 3u) >= (m_dwBeginSel & 0xFFFF)) && (((nChn << 3) | 3u) <= (m_dwEndSel & 0xFFFF)))
{
if ((m->command == CMD_VOLUME) && (m->param <= 64))
{
@@ -3698,7 +3702,7 @@
SetCurrentColumn(m_dwCursor - 1);
return wParam;
case kcNavigateRightSelect:
- case kcNavigateRight: if ((CMainFrame::GetSettings().m_dwPatternSetup & PATTERN_WRAP) && (m_dwCursor >= (((pSndFile->m_nChannels-1) << 3) | 4)))
+ case kcNavigateRight: if ((CMainFrame::GetSettings().m_dwPatternSetup & PATTERN_WRAP) && (m_dwCursor >= (((pSndFile->m_nChannels-1) << 3u) | 4u)))
SetCurrentColumn(0);
else
SetCurrentColumn(m_dwCursor + 1);
@@ -3725,12 +3729,12 @@
case kcHomeAbsolute: if (m_dwCursor) SetCurrentColumn(0); if (m_nRow > 0) SetCurrentRow(0); return wParam;
case kcEndHorizontalSelect:
- case kcEndHorizontal: if (m_dwCursor!=(((pSndFile->GetNumChannels() - 1) << 3) | 4)) SetCurrentColumn(((pSndFile->m_nChannels-1) << 3) | 4);
+ case kcEndHorizontal: if (m_dwCursor!=(((pSndFile->GetNumChannels() - 1u) << 3u) | 4)) SetCurrentColumn(((pSndFile->m_nChannels-1) << 3) | 4);
else if (m_nRow < pModDoc->GetPatternSize(m_nPattern) - 1) SetCurrentRow(pModDoc->GetPatternSize(m_nPattern) - 1);
return wParam;
case kcEndVerticalSelect:
case kcEndVertical: if (m_nRow < pModDoc->GetPatternSize(m_nPattern) - 1) SetCurrentRow(pModDoc->GetPatternSize(m_nPattern) - 1);
- else if (m_dwCursor!=(((pSndFile->GetNumChannels() - 1) << 3) | 4)) SetCurrentColumn(((pSndFile->m_nChannels-1) << 3) | 4);
+ else if (m_dwCursor!=(((pSndFile->GetNumChannels() - 1) << 3u) | 4u)) SetCurrentColumn(((pSndFile->m_nChannels-1) << 3u) | 4);
return wParam;
case kcEndAbsoluteSelect:
case kcEndAbsolute: SetCurrentColumn(((pSndFile->GetNumChannels() - 1) << 3) | 4); if (m_nRow < pModDoc->GetPatternSize(m_nPattern) - 1) SetCurrentRow(pModDoc->GetPatternSize(m_nPattern) - 1); return wParam;
@@ -3990,9 +3994,9 @@
void CViewPattern::SetSpacing(int n)
//----------------------------------
{
- if (n != m_nSpacing)
+ if (static_cast<UINT>(n) != m_nSpacing)
{
- m_nSpacing = n;
+ m_nSpacing = static_cast<UINT>(n);
PostCtrlMessage(CTRLMSG_SETSPACING, m_nSpacing);
}
}
Modified: trunk/OpenMPT/mptrack/View_pat.h
===================================================================
--- trunk/OpenMPT/mptrack/View_pat.h 2011-07-30 20:32:17 UTC (rev 943)
+++ trunk/OpenMPT/mptrack/View_pat.h 2011-07-30 20:40:29 UTC (rev 944)
@@ -142,7 +142,7 @@
CPatternRandomizer *m_pRandomizer; //rewbs.fxVis
public:
CEffectVis *m_pEffectVis; //rewbs.fxVis
- COpenGLEditor *m_pOpenGLEditor; //rewbs.fxVis
+ //COpenGLEditor *m_pOpenGLEditor; //rewbs.fxVis
CViewPattern();
@@ -347,7 +347,7 @@
static ROWINDEX GetRowFromCursor(DWORD cursor) { return (cursor >> 16); };
static CHANNELINDEX GetChanFromCursor(DWORD cursor) { return static_cast<CHANNELINDEX>((cursor & 0xFFFF) >> 3); };
- static UINT GetColTypeFromCursor(DWORD cursor) { return (cursor & 0x07); };
+ static PatternColumns GetColTypeFromCursor(DWORD cursor) { return static_cast<PatternColumns>((cursor & 0x07)); };
static DWORD CreateCursor(ROWINDEX row, CHANNELINDEX channel = 0, UINT column = 0) { return (row << 16) | ((channel << 3) & 0x1FFF) | (column & 0x07); };
private:
Modified: trunk/OpenMPT/mptrack/misc_util.h
===================================================================
--- trunk/OpenMPT/mptrack/misc_util.h 2011-07-30 20:32:17 UTC (rev 943)
+++ trunk/OpenMPT/mptrack/misc_util.h 2011-07-30 20:40:29 UTC (rev 944)
@@ -253,6 +253,20 @@
// Returns maximum value of given integer type.
template <class T> inline T MaxValueOfType(const T&) {static_assert(std::numeric_limits<T>::is_integer == true, "Only interger types are allowed."); return (std::numeric_limits<T>::max)();}
+ /// Returns value rounded to nearest integer.
+ inline double Round(const double& val) {return std::floor(val + 0.5);}
+
+ /// Rounds given double value to nearest integer value of type T.
+ template <class T> inline T Round(const double& val)
+ {
+ static_assert(std::numeric_limits<T>::is_integer == true, "Type is a not an integer");
+ static_assert(sizeof(T) <= 4, "Revise the implementation for integers > 32-bits.");
+ const double valRounded = Round(val);
+ ASSERT(valRounded >= (std::numeric_limits<T>::min)() && valRounded <= (std::numeric_limits<T>::max)());
+ const T intval = static_cast<T>(valRounded);
+ return intval;
+ }
+
};
Modified: trunk/OpenMPT/mptrack/test/test.cpp
===================================================================
--- trunk/OpenMPT/mptrack/test/test.cpp 2011-07-30 20:32:17 UTC (rev 943)
+++ trunk/OpenMPT/mptrack/test/test.cpp 2011-07-30 20:40:29 UTC (rev 944)
@@ -220,6 +220,31 @@
VERIFY_EQUAL(CModSpecifications::ExtensionToType(_T("s2m")), MOD_TYPE_NONE);
VERIFY_EQUAL(CModSpecifications::ExtensionToType(_T("")), MOD_TYPE_NONE);
VERIFY_EQUAL(CModSpecifications::ExtensionToType(LPCTSTR(nullptr)), MOD_TYPE_NONE);
+
+ VERIFY_EQUAL( Util::Round(1.99), 2.0 );
+ VERIFY_EQUAL( Util::Round(1.5), 2.0 );
+ VERIFY_EQUAL( Util::Round(1.1), 1.0 );
+ VERIFY_EQUAL( Util::Round(-0.1), 0.0 );
+ VERIFY_EQUAL( Util::Round(-0.5), 0.0 );
+ VERIFY_EQUAL( Util::Round(-0.9), -1.0 );
+ VERIFY_EQUAL( Util::Round(-1.4), -1.0 );
+ VERIFY_EQUAL( Util::Round(-1.7), -2.0 );
+ VERIFY_EQUAL( Util::Round<int32>(int32_max + 0.1), int32_max );
+ VERIFY_EQUAL( Util::Round<int32>(int32_max - 0.4), int32_max );
+ VERIFY_EQUAL( Util::Round<int32>(int32_min + 0.1), int32_min );
+ VERIFY_EQUAL( Util::Round<int32>(int32_min - 0.1), int32_min );
+ VERIFY_EQUAL( Util::Round<uint32>(uint32_max + 0.499), uint32_max );
+ VERIFY_EQUAL( Util::Round<int8>(110.1), 110 );
+ VERIFY_EQUAL( Util::Round<int8>(-110.1), -110 );
+
+ // These should fail to compile
+ //Util::Round<std::string>(1.0);
+ //Util::Round<int64>(1.0);
+ //Util::Round<uint64>(1.0);
+
+ // This should trigger assert in Round.
+ //VERIFY_EQUAL( Util::Round<int8>(-129), 0 );
+
}
@@ -461,14 +486,10 @@
theApp.RemoveMruItem(0);
}
-
-template<class T>
-T Round(double a) {return static_cast<T>(floor(a + 0.5));}
-
double Rand01() {return rand() / double(RAND_MAX);}
template <class T>
-T Rand(const T& min, const T& max) {return Round<T>(min + Rand01() * (max - min));}
+T Rand(const T& min, const T& max) {return Util::Round<T>(min + Rand01() * (max - min));}
Modified: trunk/OpenMPT/soundlib/Dlsbank.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Dlsbank.cpp 2011-07-30 20:32:17 UTC (rev 943)
+++ trunk/OpenMPT/soundlib/Dlsbank.cpp 2011-07-30 20:40:29 UTC (rev 944)
@@ -1468,7 +1468,7 @@
}
-BOOL CDLSBank::ExtractSample(CSoundFile *pSndFile, UINT nSample, UINT nIns, UINT nRgn, int transpose)
+BOOL CDLSBank::ExtractSample(CSoundFile *pSndFile, SAMPLEINDEX nSample, UINT nIns, UINT nRgn, int transpose)
//---------------------------------------------------------------------------------------------------
{
DLSINSTRUMENT *pDlsIns;
@@ -1602,13 +1602,14 @@
}
-BOOL CDLSBank::ExtractInstrument(CSoundFile *pSndFile, UINT nInstr, UINT nIns, UINT nDrumRgn)
+BOOL CDLSBank::ExtractInstrument(CSoundFile *pSndFile, INSTRUMENTINDEX nInstr, UINT nIns, UINT nDrumRgn)
//-------------------------------------------------------------------------------------------
{
BYTE RgnToSmp[DLSMAXREGIONS];
DLSINSTRUMENT *pDlsIns;
MODINSTRUMENT *pIns;
- UINT nSample, nRgnMin, nRgnMax, nEnv;
+ UINT nRgnMin, nRgnMax, nEnv;
+ SAMPLEINDEX nSample;
if ((!m_pInstruments) || (nIns >= m_nInstruments) || (!pSndFile)) return FALSE;
pDlsIns = &m_pInstruments[nIns];
Modified: trunk/OpenMPT/soundlib/Dlsbank.h
===================================================================
--- trunk/OpenMPT/soundlib/Dlsbank.h 2011-07-30 20:32:17 UTC (rev 943)
+++ trunk/OpenMPT/soundlib/Dlsbank.h 2011-07-30 20:40:29 UTC (rev 944)
@@ -2,6 +2,7 @@
#define _DLS_BANK_H_
class CSoundFile;
+#include "Snd_defs.h"
#pragma pack(1)
@@ -121,8 +122,8 @@
UINT GetRegionFromKey(UINT nIns, UINT nKey);
BOOL FreeWaveForm(LPBYTE p);
BOOL ExtractWaveForm(UINT nIns, UINT nRgn, LPBYTE *ppWave, DWORD *pLen);
- BOOL ExtractSample(CSoundFile *pSndFile, UINT nSample, UINT nIns, UINT nRgn, int transpose=0);
- BOOL ExtractInstrument(CSoundFile *pSndFile, UINT nInstr, UINT nIns, UINT nDrumRgn);
+ BOOL ExtractSample(CSoundFile *pSndFile, SAMPLEINDEX nSample, UINT nIns, UINT nRgn, int transpose=0);
+ BOOL ExtractInstrument(CSoundFile *pSndFile, INSTRUMENTINDEX nInstr, UINT nIns, UINT nDrumRgn);
// Internal Loader Functions
protected:
Modified: trunk/OpenMPT/soundlib/LOAD_DMF.CPP
===================================================================
--- trunk/OpenMPT/soundlib/LOAD_DMF.CPP 2011-07-30 20:32:17 UTC (rev 943)
+++ trunk/OpenMPT/soundlib/LOAD_DMF.CPP 2011-07-30 20:40:29 UTC (rev 944)
@@ -1120,7 +1120,7 @@
DMFNewNode(&tree);
value = 0;
- for (int i = 0; i < maxlen; i++)
+ for (UINT i = 0; i < maxlen; i++)
{
actnode = 0;
sign = DMFReadBits(&tree, 1);
Modified: trunk/OpenMPT/soundlib/LOAD_DSM.CPP
===================================================================
--- trunk/OpenMPT/soundlib/LOAD_DSM.CPP 2011-07-30 20:32:17 UTC (rev 943)
+++ trunk/OpenMPT/soundlib/LOAD_DSM.CPP 2011-07-30 20:40:29 UTC (rev 944)
@@ -91,7 +91,8 @@
DSMFILEHEADER *pfh = (DSMFILEHEADER *)lpStream;
DSMSONG *psong;
DWORD dwMemPos;
- UINT nPat, nSmp;
+ UINT nSmp;
+ PATTERNINDEX nPat;
if ((!lpStream) || (dwMemLength < 1024) || (pfh->id_RIFF != DSMID_RIFF)
|| (pfh->riff_len + 8 > dwMemLength) || (pfh->riff_len < 1024)
Modified: trunk/OpenMPT/soundlib/Load_med.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Load_med.cpp 2011-07-30 20:32:17 UTC (rev 943)
+++ trunk/OpenMPT/soundlib/Load_med.cpp 2011-07-30 20:40:29 UTC (rev 944)
@@ -271,7 +271,7 @@
{
const BYTE bpmvals[9] = { 179,164,152,141,131,123,116,110,104};
- UINT command = p->command;
+ MODCOMMAND::COMMAND command = p->command;
UINT param = p->param;
switch(command)
{
@@ -467,10 +467,11 @@
// 0x2E ?
Log("Unknown command: cmd=0x%02X param=0x%02X\n", command, param);
#endif
- command = param = 0;
+ command = 0;
+ param = 0;
}
p->command = command;
- p->param = param;
+ p->param = static_cast<MODCOMMAND::PARAM>(param);
}
@@ -636,13 +637,13 @@
playtransp = pmsh->playtransp;
} else
{
- UINT nOrders, nSections;
+ UINT nSections;
+ ORDERINDEX nOrders = 0;
WORD nTrks = BigEndianW(pmsh2->numtracks);
if ((nTrks >= 4) && (nTrks <= 32)) m_nChannels = nTrks;
DWORD playseqtable = BigEndian(pmsh2->playseqtable);
UINT numplayseqs = BigEndianW(pmsh2->numpseqs);
if (!numplayseqs) numplayseqs = 1;
- nOrders = 0;
nSections = BigEndianW(pmsh2->numsections);
DWORD sectiontable = BigEndian(pmsh2->sectiontable);
if ((!nSections) || (!sectiontable) || (sectiontable >= dwMemLength-2)) nSections = 1;
@@ -736,7 +737,7 @@
}
// Track Names
DWORD trackinfo_ofs = BigEndian(pmex->trackinfo_ofs);
- if ((trackinfo_ofs) && (trackinfo_ofs < dwMemLength) && (m_nChannels * 4 < dwMemLength - trackinfo_ofs))
+ if ((trackinfo_ofs) && (trackinfo_ofs < dwMemLength) && (m_nChannels * 4u < dwMemLength - trackinfo_ofs))
{
DWORD *ptrktags = (DWORD *)(lpStream + trackinfo_ofs);
for (UINT i=0; i<m_nChannels; i++)
@@ -830,7 +831,7 @@
BYTE instr = s[1] >> 4;
if (s[0] & 0x80) instr |= 0x10;
if (s[0] & 0x40) instr |= 0x20;
- if ((note) && (note <= 132)) p->note = note + playtransp;
+ if ((note) && (note <= 132)) p->note = static_cast<BYTE>(note + playtransp);
p->instr = instr;
p->command = s[1] & 0x0F;
p->param = s[2];
Modified: trunk/OpenMPT/soundlib/Load_mod.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Load_mod.cpp 2011-07-30 20:32:17 UTC (rev 943)
+++ trunk/OpenMPT/soundlib/Load_mod.cpp 2011-07-30 20:40:29 UTC (rev 944)
@@ -40,7 +40,7 @@
case 0x0C: command = CMD_VOLUME; break;
case 0x0D: command = CMD_PATTERNBREAK; param = ((param >> 4) * 10) + (param & 0x0F); break;
case 0x0E: command = CMD_MODCMDEX; break;
- case 0x0F: command = (param <= ((m_nType & (MOD_TYPE_MOD)) ? 0x20 : 0x1F)) ? CMD_SPEED : CMD_TEMPO;
+ case 0x0F: command = (param <= ((m_nType & (MOD_TYPE_MOD)) ? 0x20u : 0x1Fu)) ? CMD_SPEED : CMD_TEMPO;
if ((param == 0xFF) && (m_nSamples == 15) && (m_nType & MOD_TYPE_MOD)) command = 0; break; //<rewbs> what the hell is this?! :) //<jojo> it's the "stop tune" command! :-P
// Extension for XM extended effects
case 'G' - 55: command = CMD_GLOBALVOLUME; break; //16
@@ -123,8 +123,8 @@
case CMD_VOLUME: command = 0x0C; break;
case CMD_PATTERNBREAK: command = 0x0D; param = ((param / 10) << 4) | (param % 10); break;
case CMD_MODCMDEX: command = 0x0E; break;
- case CMD_SPEED: command = 0x0F; param = min(param, (bXM) ? 0x1F : 0x20); break;
- case CMD_TEMPO: command = 0x0F; param = max(param, (bXM) ? 0x20 : 0x21); break;
+ case CMD_SPEED: command = 0x0F; param = min(param, (bXM) ? 0x1Fu : 0x20u); break;
+ case CMD_TEMPO: command = 0x0F; param = max(param, (bXM) ? 0x20u : 0x21u); break;
case CMD_GLOBALVOLUME: command = 'G' - 55; break;
case CMD_GLOBALVOLSLIDE: command = 'H' - 55; break;
case CMD_KEYOFF: command = 'K' - 55; break;
@@ -395,7 +395,7 @@
norders--;
m_nRestartPos = pMagic->nRestartPos;
if (m_nRestartPos >= 0x78) m_nRestartPos = 0;
- if (m_nRestartPos + 1 >= (UINT)norders) m_nRestartPos = 0;
+ if (m_nRestartPos + 1u >= norders) m_nRestartPos = 0;
if (!nbp) return false;
DWORD dwWowTest = dwTotalSampleLen+dwMemPos;
if ((IsMagic(pMagic->Magic, "M.K.")) && (dwWowTest + nbp*8*256 == dwMemLength)) m_nChannels = 8;
@@ -706,7 +706,7 @@
MODSAMPLE *pSmp = &Samples[insmap[ismpd]];
if(bCompatibilityExport == true) // first two bytes have to be 0 due to PT's one-shot loop ("no loop")
{
- int iOverwriteLen = 2 * pSmp->GetBytesPerSample();
+ size_t iOverwriteLen = 2 * pSmp->GetBytesPerSample();
memset(pSmp->pSample, 0, min(iOverwriteLen, pSmp->GetSampleSizeInBytes()));
}
UINT flags = RS_PCM8S;
Modified: trunk/OpenMPT/soundlib/Snd_defs.h
===================================================================
--- trunk/OpenMPT/soundlib/Snd_defs.h 2011-07-30 20:32:17 UTC (rev 943)
+++ trunk/OpenMPT/soundlib/Snd_defs.h 2011-07-30 20:40:29 UTC (rev 944)
@@ -10,6 +10,8 @@
#ifndef SND_DEF_H
#define SND_DEF_H
+#include "../mptrack/typedefs.h"
+
#ifndef LPCBYTE
typedef const BYTE * LPCBYTE;
#endif
Modified: trunk/OpenMPT/soundlib/Snd_flt.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Snd_flt.cpp 2011-07-30 20:32:17 UTC (rev 943)
+++ trunk/OpenMPT/soundlib/Snd_flt.cpp 2011-07-30 20:40:29 UTC (rev 944)
@@ -86,16 +86,16 @@
{
if(pChn->nCutSwing)
{
- pChn->nCutOff += pChn->nCutSwing;
- if(pChn->nCutOff > 127) pChn->nCutOff = 127;
- if(pChn->nCutOff < 0) pChn->nCutOff = 0;
+ static_assert(sizeof(pChn->nCutOff) == 1, "check cast if this fails");
+ pChn->nCutOff = static_cast<BYTE>(pChn->nCutOff + pChn->nCutSwing);
+ Limit(pChn->nCutOff, BYTE(0), BYTE(127));
pChn->nCutSwing = 0;
}
if(pChn->nResSwing)
{
- pChn->nResonance += pChn->nResSwing;
- if(pChn->nResonance > 127) pChn->nResonance = 127;
- if(pChn->nResonance < 0) pChn->nResonance = 0;
+ static_assert(sizeof(pChn->nResonance) == 1, "check cast if this fails");
+ pChn->nResonance = static_cast<BYTE>(pChn->nResonance + pChn->nResSwing);
+ Limit(pChn->nResonance, BYTE(0), BYTE(127));
pChn->nResSwing = 0;
}
cutoff = max( min((int)pChn->nCutOff,127), 0); // cap cutoff
Modified: trunk/OpenMPT/soundlib/Snddev.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Snddev.cpp 2011-07-30 20:32:17 UTC (rev 943)
+++ trunk/OpenMPT/soundlib/Snddev.cpp 2011-07-30 20:40:29 UTC (rev 944)
@@ -173,7 +173,9 @@
void CWaveDevice::SilenceAudioBuffer(ISoundSource *pSource, ULONG nMaxLatency, DWORD dwBuffer)
{
-
+ UNREFERENCED_PARAMETER(pSource);
+ UNREFERENCED_PARAMETER(nMaxLatency);
+ UNREFERENCED_PARAMETER(dwBuffer);
}
@@ -506,7 +508,9 @@
void CDSoundDevice::SilenceAudioBuffer(ISoundSource *pSource, ULONG nMaxLatency, DWORD dwBuffer)
{
-
+ UNREFERENCED_PARAMETER(pSource);
+ UNREFERENCED_PARAMETER(nMaxLatency);
+ UNREFERENCED_PARAMETER(dwBuffer);
}
BOOL CDSoundDevice::FillAudioBuffer(ISoundSource *pSource, ULONG nMaxLatency, DWORD)
@@ -902,6 +906,8 @@
void CASIODevice::SilenceAudioBuffer(ISoundSource *pSource, ULONG nMaxLatency, DWORD dwBuffer)
//--------------------------------------------------------------------------------------------
{
+ UNREFERENCED_PARAMETER(pSource);
+ UNREFERENCED_PARAMETER(nMaxLatency);
for (UINT ich=0; ich<m_nChannels; ich++){
memset(m_BufferInfo[ich].buffers[dwBuffer], 0, m_nAsioBufferLen);
}
@@ -911,6 +917,8 @@
BOOL CASIODevice::FillAudioBuffer(ISoundSource *pSource, ULONG nMaxLatency, DWORD dwBuffer)
//-----------------------------------------------------------------------------------------
{
+ UNREFERENCED_PARAMETER(nMaxLatency);
+
DWORD dwSampleSize = m_nChannels*(m_nBitsPerSample>>3);
DWORD dwSamplesLeft = m_nAsioBufferLen;
DWORD dwFrameLen = (ASIO_BLOCK_LEN*sizeof(int)) / dwSampleSize;
@@ -1006,6 +1014,7 @@
void CASIODevice::BufferSwitch(long doubleBufferIndex, ASIOBool directProcess)
//----------------------------------------------------------------------------
{
+ UNREFERENCED_PARAMETER(directProcess);
if ((gpCurrentAsio) && (gpCurrentAsio->m_bMixRunning)) SoundDeviceCallback(doubleBufferIndex);
}
@@ -1013,12 +1022,16 @@
void CASIODevice::SampleRateDidChange(ASIOSampleRate sRate)
//---------------------------------------------------------
{
+ UNREFERENCED_PARAMETER(sRate);
}
long CASIODevice::AsioMessage(long selector, long value, void* message, double* opt)
//----------------------------------------------------------------------------------
{
+ UNREFERENCED_PARAMETER(value);
+ UNREFERENCED_PARAMETER(message);
+ UNREFERENCED_PARAMETER(opt);
#ifdef ASIO_LOG
// Log("AsioMessage(%d, %d)\n", selector, value);
#endif
Modified: trunk/OpenMPT/soundlib/Sndmix.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Sndmix.cpp 2011-07-30 20:32:17 UTC (rev 943)
+++ trunk/OpenMPT/soundlib/Sndmix.cpp 2011-07-30 20:40:29 UTC (rev 944)
@@ -1318,8 +1318,8 @@
{
switch(m_nTickCount % 3)
{
- case 1: period = period / TwoToPowerXOver12(pChn->nArpeggio >> 4); break;
- case 2: period = period / TwoToPowerXOver12(pChn->nArpeggio & 0x0F); break;
+ case 1: period = Util::Round<int>(period / TwoToPowerXOver12(pChn->nArpeggio >> 4)); break;
+ case 2: period = Util::Round<int>(period / TwoToPowerXOver12(pChn->nArpeggio & 0x0F)); break;
}
}
}
@@ -1747,7 +1747,7 @@
{
if(pChn->m_CalculateFreq || (pChn->m_ReCalculateFreqOnFirstTick && m_nTickCount == 0))
{
- pChn->m_Freq = pChn->nC5Speed * vibratoFactor * pIns->pTuning->GetRatio(pChn->nNote - NOTE_MIDDLEC + arpeggioSteps, pChn->nFineTune+pChn->m_PortamentoFineSteps);
+ pChn->m_Freq = Util::Round<UINT>(pChn->nC5Speed * vibratoFactor * pIns->pTuning->GetRatio(pChn->nNote - NOTE_MIDDLEC + arpeggioSteps, pChn->nFineTune+pChn->m_PortamentoFineSteps));
if(!pChn->m_CalculateFreq)
pChn->m_ReCalculateFreqOnFirstTick = false;
else
@@ -1759,7 +1759,7 @@
//Applying Pitch/Tempo lock.
if(m_nType & (MOD_TYPE_IT | MOD_TYPE_MPT) && pIns && pIns->wPitchToTempoLock)
- freq *= (float)m_nMusicTempo / (float)pIns->wPitchToTempoLock;
+ freq = MulDiv(freq, m_nMusicTempo, pIns->wPitchToTempoLock);
if ((m_nType & (MOD_TYPE_IT | MOD_TYPE_MPT)) && (freq < 256))
@@ -2304,7 +2304,8 @@
step = delta/static_cast<long>(m_nSamplesToGlobalVolRampDest);
UINT maxStep = max(50, (10000/gnVolumeRampSamples+1)); //define max step size as some factor of user defined ramping value: the lower the value, the more likely the click.
- while (abs(step)>maxStep) { //if step is too big (might cause click), extend ramp length.
+ while (static_cast<UINT>(abs(step)) > maxStep) //if step is too big (might cause click), extend ramp length.
+ {
m_nSamplesToGlobalVolRampDest += gnVolumeRampSamples;
step = delta/static_cast<long>(m_nSamplesToGlobalVolRampDest);
}
Modified: trunk/OpenMPT/soundlib/Tables.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Tables.cpp 2011-07-30 20:32:17 UTC (rev 943)
+++ trunk/OpenMPT/soundlib/Tables.cpp 2011-07-30 20:40:29 UTC (rev 944)
@@ -618,7 +618,7 @@
fsinc = sin(x*kPi) * izero(beta*sqrt(1-x*x*(1.0/16.0))) / (izero_beta*x*kPi); // Kaiser window
}
int n = (int)(fsinc * lowpass_factor * (16384*256));
- *psinc++ = (n+0x80)>>8; // force rounding
+ *psinc++ = static_cast<short>((n+0x80)>>8); // force rounding
}
}
Modified: trunk/OpenMPT/soundlib/WindowedFIR.cpp
===================================================================
--- trunk/OpenMPT/soundlib/WindowedFIR.cpp 2011-07-30 20:32:17 UTC (rev 943)
+++ trunk/OpenMPT/soundlib/WindowedFIR.cpp 2011-07-30 20:40:29 UTC (rev 944)
@@ -66,7 +66,7 @@
int _LPcl;
float _LPcllen = (float)(1L<<WFIR_FRACBITS); // number of precalculated lines for 0..1 (-1..0)
float _LNorm = 1.0f / (float)(2.0f * _LPcllen);
- float _LCut = CMainFrame::GetSettings().gdWFIRCutoff;
+ float _LCut = static_cast<float>(CMainFrame::GetSettings().gdWFIRCutoff);
float _LScale = (float)WFIR_QUANTSCALE;
for( _LPcl=0;_LPcl<WFIR_LUTLEN;_LPcl++ )
{
Modified: trunk/OpenMPT/soundlib/mod_specifications.h
===================================================================
--- trunk/OpenMPT/soundlib/mod_specifications.h 2011-07-30 20:32:17 UTC (rev 943)
+++ trunk/OpenMPT/soundlib/mod_specifications.h 2011-07-30 20:40:29 UTC (rev 944)
@@ -50,7 +50,7 @@
UINT speedMin; // Minimum ticks per frame
UINT speedMax; // Maximum ticks per frame
bool hasComments; // True if format has a comments field
- UINT envelopePointsMax; // Maximum number of points of each envelope
+ uint8 envelopePointsMax; // Maximum number of points of each envelope
bool hasReleaseNode; // Envelope release node
char commands[MAX_EFFECTS + 1]; // An array holding all commands this format supports; commands that are not supported are marked with "?"
char volcommands[MAX_VOLCMDS + 1]; // dito, but for volume column
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sag...@us...> - 2011-07-30 20:32:24
|
Revision: 943
http://modplug.svn.sourceforge.net/modplug/?rev=943&view=rev
Author: saga-games
Date: 2011-07-30 20:32:17 +0000 (Sat, 30 Jul 2011)
Log Message:
-----------
[Ref] Song message handling has been refactored a bit.
[Mod] Debug test modules are now removed from MRU list.
Modified Paths:
--------------
trunk/OpenMPT/mptrack/Ctrl_com.cpp
trunk/OpenMPT/mptrack/Mod2wave.cpp
trunk/OpenMPT/mptrack/test/test.cpp
trunk/OpenMPT/soundlib/Load_it.cpp
trunk/OpenMPT/soundlib/Message.cpp
trunk/OpenMPT/soundlib/Sndfile.h
Modified: trunk/OpenMPT/mptrack/Ctrl_com.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Ctrl_com.cpp 2011-07-30 18:54:07 UTC (rev 942)
+++ trunk/OpenMPT/mptrack/Ctrl_com.cpp 2011-07-30 20:32:17 UTC (rev 943)
@@ -119,9 +119,9 @@
if ((ln >= LINE_LENGTH-1) || (!*p))
{
if (((BYTE)c) > ' ') s[ln++] = c;
- c = 0x0D;
+ c = INTERNAL_LINEENDING;
}
- if (c == 0x0D)
+ if (c == INTERNAL_LINEENDING)
{
s[ln] = 0x0D;
s[ln+1] = 0x0A;
@@ -175,11 +175,16 @@
if (ln > LINE_LENGTH-1) ln = LINE_LENGTH-1;
s[ln] = 0;
while ((ln > 0) && (((BYTE)s[ln-1]) <= ' ')) s[--ln] = 0;
- if (i+1 < n) strcat(s, "\r");
+ if (i+1 < n)
+ {
+ size_t l = strlen(s);
+ s[l++] = INTERNAL_LINEENDING;
+ s[l] = '\0';
+ }
strcat(p, s);
}
UINT len = strlen(p);
- while ((len > 0) && ((p[len-1] == ' ') || (p[len-1] == '\r')))
+ while ((len > 0) && ((p[len-1] == ' ') || (p[len-1] == INTERNAL_LINEENDING)))
{
len--;
p[len] = 0;
Modified: trunk/OpenMPT/mptrack/Mod2wave.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Mod2wave.cpp 2011-07-30 18:54:07 UTC (rev 942)
+++ trunk/OpenMPT/mptrack/Mod2wave.cpp 2011-07-30 20:32:17 UTC (rev 943)
@@ -560,21 +560,7 @@
if (m_pSndFile->m_lpszSongComments)
{
- m_FileTags.comments = m_pSndFile->m_lpszSongComments;
- // convert \r to \n, remove bad characters
- for(size_t i = 0; i < m_FileTags.comments.length(); i++)
- {
- if(m_FileTags.comments.substr(i, 1) == "\r")
- m_FileTags.comments.replace(i, 1, "\n");
- if(m_FileTags.comments.substr(i, 1) < " " && m_FileTags.comments.substr(i, 1) != "\n")
- m_FileTags.comments.replace(i, 1, " ");
- }
-
- /*size_t spos;
- while((spos = m_FileTags.comments.find("\r")) != string::npos)
- {
- m_FileTags.comments.replace(spos, 1, "\n");
- }*/
+ m_FileTags.comments = m_pSndFile->GetSongMessage(leLF);
}
else
{
@@ -631,6 +617,7 @@
EndDialog(IDCANCEL);
return;
}
+
SetPriorityClass(GetCurrentProcess(), NORMAL_PRIORITY_CLASS);
int oldVol = m_pSndFile->GetMasterVolume();
int nOldRepeat = m_pSndFile->GetRepeatCount();
Modified: trunk/OpenMPT/mptrack/test/test.cpp
===================================================================
--- trunk/OpenMPT/mptrack/test/test.cpp 2011-07-30 18:54:07 UTC (rev 942)
+++ trunk/OpenMPT/mptrack/test/test.cpp 2011-07-30 20:32:17 UTC (rev 943)
@@ -450,11 +450,15 @@
// Test file saving
pModDoc->DoSave(theFile + "saved.mptm");
pModDoc->OnCloseDocument();
-
+
// Reload the saved file and test if everything is still working correctly.
pModDoc = (CModDoc *)theApp.OpenDocumentFile(theFile + "saved.mptm");
TestLoadFile(pModDoc);
pModDoc->OnCloseDocument();
+
+ // Forget about the files we just loaded
+ theApp.RemoveMruItem(0);
+ theApp.RemoveMruItem(0);
}
Modified: trunk/OpenMPT/soundlib/Load_it.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Load_it.cpp 2011-07-30 18:54:07 UTC (rev 942)
+++ trunk/OpenMPT/soundlib/Load_it.cpp 2011-07-30 20:32:17 UTC (rev 943)
@@ -1332,8 +1332,8 @@
const tm* const p = localtime(&creationTime);
if (p != nullptr)
loadDate = *p;
- else if (pSndFile->GetModDocPtr() != nullptr)
- pSndFile->GetModDocPtr()->AddLogEvent(LogEventUnexpectedError,
+ else if (pSndFile->GetpModDoc() != nullptr)
+ pSndFile->GetpModDoc()->AddLogEvent(LogEventUnexpectedError,
__FUNCTION__,
_T("localtime() returned nullptr."));
openTime = (uint32)((double)difftime(time(nullptr), creationTime) * 18.2f);
Modified: trunk/OpenMPT/soundlib/Message.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Message.cpp 2011-07-30 18:54:07 UTC (rev 942)
+++ trunk/OpenMPT/soundlib/Message.cpp 2011-07-30 20:32:17 UTC (rev 943)
@@ -113,14 +113,14 @@
{
case '\r':
if(lineEnding != leLF)
- m_lpszSongComments[cpos] = '\r';
+ m_lpszSongComments[cpos] = INTERNAL_LINEENDING;
else
m_lpszSongComments[cpos] = ' ';
if(lineEnding == leCRLF) i++; // skip the LF
break;
case '\n':
if(lineEnding != leCR && lineEnding != leCRLF)
- m_lpszSongComments[cpos] = '\r';
+ m_lpszSongComments[cpos] = INTERNAL_LINEENDING;
else
m_lpszSongComments[cpos] = ' ';
break;
@@ -158,7 +158,7 @@
for(size_t line = 0, fpos = 0, cpos = 0; line < num_lines; line++, fpos += (lineLength + lineEndingLength), cpos += (lineLength + 1))
{
memcpy(m_lpszSongComments + cpos, data + fpos, min(lineLength, length - fpos));
- m_lpszSongComments[cpos + lineLength] = '\r';
+ m_lpszSongComments[cpos + lineLength] = INTERNAL_LINEENDING;
// fix weird chars
for(size_t lpos = 0; lpos < lineLength; lpos++)
@@ -181,73 +181,47 @@
}
-// OLD and unused function. Do we still need it?
-UINT CSoundFile::GetSongMessage(LPSTR s, UINT len, UINT linesize)
-//---------------------------------------------------------------
+// Retrieve song message.
+// [in] lineEnding: line ending formatting of the text in memory.
+// [in] pTextConverter: Pointer to a callback function which can be used to post-process the written characters, if necessary (nullptr otherwise).
+// [out] returns formatted song message.
+CString CSoundFile::GetSongMessage(const enmLineEndings lineEnding, void (*pTextConverter)(char &))
+//-------------------------------------------------------------------------------------------------
{
- LPCSTR p = m_lpszSongComments;
- if (!p) return 0;
- UINT i = 2, ln=0;
- if ((len) && (s)) s[0] = '\r';
- if ((len > 1) && (s)) s[1] = '\n';
- while ((*p) && (i+2 < len))
+ CString comments;
+
+ if(m_lpszSongComments == nullptr)
{
- BYTE c = (BYTE)*p++;
- if ((c == 0x0D) || ((c == ' ') && (ln >= linesize)))
- { if (s) { s[i++] = '\r'; s[i++] = '\n'; } else i+= 2; ln=0; }
- else
- if (c >= 0x20) { if (s) s[i++] = c; else i++; ln++; }
+ return comments;
}
- if (s) s[i] = 0;
- return i;
-}
+ const size_t len = strlen(m_lpszSongComments);
+ comments.Preallocate(len);
-// OLD and unused function. Do we still need it?
-UINT CSoundFile::GetRawSongMessage(LPSTR s, UINT len, UINT linesize)
-//------------------------------------------------------------------
-{
- LPCSTR p = m_lpszSongComments;
- if (!p) return 0;
- UINT i = 0, ln=0;
- while ((*p) && (i < len-1))
+ for(size_t i = 0; i < len; i++)
{
- BYTE c = (BYTE)*p++;
- if ((c == 0x0D) || (c == 0x0A))
+ if(m_lpszSongComments[i] == INTERNAL_LINEENDING)
{
- if (ln)
+ switch(lineEnding)
{
- while (ln < linesize) { if (s) s[i] = ' '; i++; ln++; }
- ln = 0;
+ case leCR:
+ default:
+ comments.Append("\r");
+ break;
+ case leLF:
+ comments.Append("\n");
+ break;
+ case leCRLF:
+ comments.Append("\r\n");
+ break;
}
} else
- if ((c == ' ') && (!ln))
- {
- UINT k=0;
- while ((p[k]) && (p[k] >= ' ')) k++;
- if (k <= linesize)
- {
- if (s) s[i] = ' ';
- i++;
- ln++;
- }
- } else
- {
- if (s) s[i] = c;
- i++;
- ln++;
- if (ln == linesize) ln = 0;
- }
- }
- if (ln)
- {
- while ((ln < linesize) && (i < len))
{
- if (s) s[i] = ' ';
- i++;
- ln++;
+ char c = m_lpszSongComments[i];
+ // Pre-process text
+ if(pTextConverter != nullptr) pTextConverter(c);
+ comments.AppendChar(c);
}
}
- if (s) s[i] = 0;
- return i;
+ return comments;
}
Modified: trunk/OpenMPT/soundlib/Sndfile.h
===================================================================
--- trunk/OpenMPT/soundlib/Sndfile.h 2011-07-30 18:54:07 UTC (rev 942)
+++ trunk/OpenMPT/soundlib/Sndfile.h 2011-07-30 20:32:17 UTC (rev 943)
@@ -476,7 +476,9 @@
leAutodetect, // Detect suitable line ending
};
+#define INTERNAL_LINEENDING '\r' // The character that represents line endings internally
+
// For WAV export (writing pattern positions to file)
struct PatternCuePoint
{
@@ -695,7 +697,6 @@
inline bool TypeIsXM_MOD() const { return (m_nType & (MOD_TYPE_XM | MOD_TYPE_MOD)) != 0; }
inline bool TypeIsMOD_S3M() const { return (m_nType & (MOD_TYPE_MOD | MOD_TYPE_S3M)) != 0; }
CModDoc* GetpModDoc() const { return m_pModDoc; }
- CModDoc* GetModDocPtr() const { return m_pModDoc; }
void SetMasterVolume(UINT vol, bool adjustAGC = false);
UINT GetMasterVolume() const { return m_nMasterVolume; }
@@ -1020,6 +1021,12 @@
// Free previously allocated song message memory.
void FreeMessage();
+ // Retrieve song message.
+ // [in] lineEnding: line ending formatting of the text in memory.
+ // [in] pTextConverter: Pointer to a callback function which can be used to post-process the written characters, if necessary (nullptr otherwise).
+ // [out] returns formatted song message.
+ CString GetSongMessage(const enmLineEndings lineEnding, void (*pTextConverter)(char &) = nullptr);
+
protected:
// Read song message from a mapped file.
// [in] data: pointer to the data in memory that is going to be read
@@ -1038,10 +1045,6 @@
// [out] returns true on success.
bool ReadFixedLineLengthMessage(const BYTE *data, const size_t length, const size_t lineLength, const size_t lineEndingLength, void (*pTextConverter)(char &) = nullptr);
- // Currently unused (and the code doesn't look very nice :)
- UINT GetSongMessage(LPSTR s, UINT cbsize, UINT linesize=32);
- UINT GetRawSongMessage(LPSTR s, UINT cbsize, UINT linesize=32);
-
public:
int GetVolEnvValueFromPosition(int position, MODINSTRUMENT* pIns) const;
void ResetChannelEnvelopes(MODCHANNEL *pChn);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sag...@us...> - 2011-07-30 18:54:13
|
Revision: 942
http://modplug.svn.sourceforge.net/modplug/?rev=942&view=rev
Author: saga-games
Date: 2011-07-30 18:54:07 +0000 (Sat, 30 Jul 2011)
Log Message:
-----------
[Mod] Removed existance check for unmo3.dll in sourceforge installer, updated paths to unmo3.dll 2.4.0.2
Modified Paths:
--------------
trunk/OpenMPT/installer/install-unmo3-free-itd.iss
trunk/OpenMPT/installer/install-unmo3-free.iss
trunk/OpenMPT/installer/install.iss
Modified: trunk/OpenMPT/installer/install-unmo3-free-itd.iss
===================================================================
--- trunk/OpenMPT/installer/install-unmo3-free-itd.iss 2011-07-30 00:50:44 UTC (rev 941)
+++ trunk/OpenMPT/installer/install-unmo3-free-itd.iss 2011-07-30 18:54:07 UTC (rev 942)
@@ -21,7 +21,7 @@
begin
if(IsTaskSelected('downloadmo3') And FileExists(ExpandConstant('{tmp}\openmpt-unmo3.dll.tmp'))) then
begin
- if(GetSHA1OfFile(ExpandConstant('{tmp}\openmpt-unmo3.dll.tmp')) <> '393be7e0f50c62d142386a16d6855ca771025554') then
+ if(GetSHA1OfFile(ExpandConstant('{tmp}\openmpt-unmo3.dll.tmp')) <> 'f8ec44e0a089f17ddd6333956ecc37cd8081e7e8') then
begin
MsgBox('Warning: unmo3.dll has been downloaded, but its checksum is wrong! This means that either the downloaded file is corrupted or that a newer version of unmo3.dll is available. The file has thus not been installed. Please obtain unmo3.dll from http://openmpt.org/ and verify its checksum.', mbCriticalError, MB_OK)
end else
@@ -32,11 +32,6 @@
end;
end;
-function IsUNMO3Installed(): Boolean;
-begin
- Result := FileExists(ExpandConstant('{app}\unmo3.dll'));
-end;
-
procedure InitializeWizard();
begin
ITD_Init();
@@ -51,7 +46,7 @@
begin
if(IsTaskSelected('downloadmo3')) then
begin
- ITD_AddFile('http://openmpt.org/files/unmo3/2.4.0.1/unmo3.dll', ExpandConstant('{tmp}\openmpt-unmo3.dll.tmp'));
+ ITD_AddFile('http://openmpt.org/files/unmo3/2.4.0.2/unmo3.dll', ExpandConstant('{tmp}\openmpt-unmo3.dll.tmp'));
ITD_AddMirror('ftp://ftp.untergrund.net/users/sagamusix/openmpt/unmo3.dll', ExpandConstant('{tmp}\openmpt-unmo3.dll.tmp'));
end else
begin
Modified: trunk/OpenMPT/installer/install-unmo3-free.iss
===================================================================
--- trunk/OpenMPT/installer/install-unmo3-free.iss 2011-07-30 00:50:44 UTC (rev 941)
+++ trunk/OpenMPT/installer/install-unmo3-free.iss 2011-07-30 18:54:07 UTC (rev 942)
@@ -13,14 +13,14 @@
#include "install.iss"
[_ISToolDownload]
-Source: http://openmpt.org/files/unmo3/2.4.0.1/unmo3.dll; DestDir: {tmp}; DestName: openmpt-unmo3.dll.tmp; Tasks: downloadmo3
+Source: http://openmpt.org/files/unmo3/2.4.0.2/unmo3.dll; DestDir: {tmp}; DestName: openmpt-unmo3.dll.tmp; Tasks: downloadmo3
[Code]
// Verify checksum of downloaded file, and if it is OK, copy it to the app directory.
procedure VerifyUNMO3Checksum();
begin
if(IsTaskSelected('downloadmo3') And FileExists(ExpandConstant('{tmp}\openmpt-unmo3.dll.tmp'))) then
begin
- if(GetSHA1OfFile(ExpandConstant('{tmp}\openmpt-unmo3.dll.tmp')) <> '393be7e0f50c62d142386a16d6855ca771025554') then
+ if(GetSHA1OfFile(ExpandConstant('{tmp}\openmpt-unmo3.dll.tmp')) <> 'f8ec44e0a089f17ddd6333956ecc37cd8081e7e8') then
begin
MsgBox('Warning: unmo3.dll has been downloaded, but its checksum is wrong! This means that either the downloaded file is corrupted or that a newer version of unmo3.dll is available. The file has thus not been installed. Please obtain unmo3.dll from http://openmpt.org/ and verify its checksum.', mbCriticalError, MB_OK)
end else
@@ -31,11 +31,6 @@
end;
end;
-function IsUNMO3Installed(): Boolean;
-begin
- Result := FileExists(ExpandConstant('{app}\unmo3.dll'));
-end;
-
// Function generated by ISTool.
function NextButtonClick(CurPage: Integer): Boolean;
begin
Modified: trunk/OpenMPT/installer/install.iss
===================================================================
--- trunk/OpenMPT/installer/install.iss 2011-07-30 00:50:44 UTC (rev 941)
+++ trunk/OpenMPT/installer/install.iss 2011-07-30 18:54:07 UTC (rev 942)
@@ -43,7 +43,7 @@
Name: desktopicon; Description: {cm:CreateDesktopIcon}; GroupDescription: {cm:AdditionalIcons}
Name: quicklaunchicon; Description: {cm:CreateQuickLaunchIcon}; GroupDescription: {cm:AdditionalIcons}; Flags: unchecked
#ifdef DOWNLOAD_MO3
-Name: downloadmo3; Description: Download unmo3 (library needed for reading MO3 files, recommended); Check: not IsUNMO3Installed; GroupDescription: Options:
+Name: downloadmo3; Description: Download unmo3 (library needed for reading MO3 files, recommended); GroupDescription: Options:
#endif
Name: update_c; Description: Automatically check for updates; GroupDescription: Options:
Name: portable; Description: Portable mode (use program folder for storing settings, no registry changes); GroupDescription: Options:; Flags: unchecked
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sag...@us...> - 2011-07-30 00:50:50
|
Revision: 941
http://modplug.svn.sourceforge.net/modplug/?rev=941&view=rev
Author: saga-games
Date: 2011-07-30 00:50:44 +0000 (Sat, 30 Jul 2011)
Log Message:
-----------
[Mod] Deprecated mod flags are now greyed out on the song properties, unless they are used by the module.
Modified Paths:
--------------
trunk/OpenMPT/mptrack/dlg_misc.cpp
Modified: trunk/OpenMPT/mptrack/dlg_misc.cpp
===================================================================
--- trunk/OpenMPT/mptrack/dlg_misc.cpp 2011-07-30 00:49:19 UTC (rev 940)
+++ trunk/OpenMPT/mptrack/dlg_misc.cpp 2011-07-30 00:50:44 UTC (rev 941)
@@ -223,6 +223,10 @@
CheckDlgButton(IDC_CHK_MIDICCBUG, m_pSndFile->GetModFlag(MSF_MIDICC_BUGEMULATION));
CheckDlgButton(IDC_CHK_OLDRANDOM, m_pSndFile->GetModFlag(MSF_OLDVOLSWING));
+ // Deprecated flags are greyed out if they are not being used.
+ GetDlgItem(IDC_CHK_MIDICCBUG)->EnableWindow(m_pSndFile->GetModFlag(MSF_MIDICC_BUGEMULATION) ? TRUE : FALSE);
+ GetDlgItem(IDC_CHK_OLDRANDOM)->EnableWindow(m_pSndFile->GetModFlag(MSF_OLDVOLSWING) ? TRUE : FALSE);
+
// Mixmode Box
GetDlgItem(IDC_TEXT_MIXMODE)->ShowWindow(XMorITorMPT);
m_PlugMixBox.ShowWindow(XMorITorMPT);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sag...@us...> - 2011-07-30 00:49:27
|
Revision: 940
http://modplug.svn.sourceforge.net/modplug/?rev=940&view=rev
Author: saga-games
Date: 2011-07-30 00:49:19 +0000 (Sat, 30 Jul 2011)
Log Message:
-----------
[Ref] More code cleanup
[Fix] Saving mod type does not depend on file extension anymore (so editing an IT file and saving it as "foo.mod" will actually save it as an IT file with .mod extension, not as a ProTracker MOD)
Modified Paths:
--------------
trunk/OpenMPT/mptrack/AutoSaver.cpp
trunk/OpenMPT/mptrack/CleanupSong.cpp
trunk/OpenMPT/mptrack/Ctrl_gen.cpp
trunk/OpenMPT/mptrack/Ctrl_ins.cpp
trunk/OpenMPT/mptrack/MPTHacks.cpp
trunk/OpenMPT/mptrack/MainFrm.cpp
trunk/OpenMPT/mptrack/Mainfrm.h
trunk/OpenMPT/mptrack/ModConvert.cpp
trunk/OpenMPT/mptrack/Moddoc.cpp
trunk/OpenMPT/mptrack/Vstplug.cpp
trunk/OpenMPT/mptrack/mod2midi.cpp
trunk/OpenMPT/mptrack/test/test.cpp
trunk/OpenMPT/soundlib/Sndfile.cpp
trunk/OpenMPT/soundlib/Sndfile.h
trunk/OpenMPT/soundlib/mod_specifications.cpp
trunk/OpenMPT/soundlib/mod_specifications.h
trunk/OpenMPT/soundlib/patternContainer.cpp
trunk/OpenMPT/soundlib/patternContainer.h
Modified: trunk/OpenMPT/mptrack/AutoSaver.cpp
===================================================================
--- trunk/OpenMPT/mptrack/AutoSaver.cpp 2011-07-29 20:54:38 UTC (rev 939)
+++ trunk/OpenMPT/mptrack/AutoSaver.cpp 2011-07-30 00:49:19 UTC (rev 940)
@@ -42,16 +42,20 @@
{
}
+
//////////////
// Entry Point
//////////////
+
bool CAutoSaver::DoSave(DWORD curTime)
+//------------------------------------
{
bool success = true;
//If time to save and not already having save in progress.
- if (CheckTimer(curTime) && !m_bSaveInProgress) {
+ if (CheckTimer(curTime) && !m_bSaveInProgress)
+ {
m_bSaveInProgress = true;
CDocTemplate *pDocTemplate;
CModDoc *pModDoc;
@@ -70,7 +74,8 @@
pDocTemplate = pTrackApp->GetNextDocTemplate(posTemplate);
posDocument = pDocTemplate->GetFirstDocPosition();
- while (posDocument) { //for all open documents
+ while (posDocument) //for all open documents
+ {
pModDoc = (CModDoc*)(pDocTemplate->GetNextDoc(posDocument));
if (pModDoc && pModDoc->ModifiedSinceLastAutosave() && pModDoc->GetSoundFile())
{
@@ -95,188 +100,215 @@
return success;
}
+
////////////////
// Member access
////////////////
+
+
void CAutoSaver::Enable()
+//-----------------------
{
- m_bEnabled=true;
+ m_bEnabled = true;
}
+
void CAutoSaver::Disable()
+//------------------------
{
- m_bEnabled=false;
+ m_bEnabled = false;
}
+
bool CAutoSaver::IsEnabled()
+//--------------------------
{
return m_bEnabled;
}
+
void CAutoSaver::SetUseOriginalPath(bool useOrgPath)
+//--------------------------------------------------
{
m_bUseOriginalPath=useOrgPath;
}
+
bool CAutoSaver::GetUseOriginalPath()
+//-----------------------------------
{
return m_bUseOriginalPath;
}
+
void CAutoSaver::SetPath(CString path)
+//------------------------------------
{
m_csPath = path;
}
+
CString CAutoSaver::GetPath()
+//---------------------------
{
return m_csPath;
}
+
void CAutoSaver::SetFilenameTemplate(CString fnTemplate)
+//------------------------------------------------------
{
m_csFileNameTemplate = fnTemplate;
}
+
CString CAutoSaver::GetFilenameTemplate()
+//---------------------------------------
{
return m_csFileNameTemplate;
}
+
void CAutoSaver::SetHistoryDepth(int history)
+//-------------------------------------------
{
- if (history<1) {
- m_nBackupHistory=1;
- } else if (history>100) {
- m_nBackupHistory=100;
- } else {
- m_nBackupHistory=history;
- }
+ Limit(history, 1, 100);
+ m_nBackupHistory = history;
}
+
int CAutoSaver::GetHistoryDepth()
+//_------------------------------
{
return m_nBackupHistory;
}
+
void CAutoSaver::SetSaveInterval(int minutes)
+//-------------------------------------------
{
- if (minutes<1) {
- minutes=1;
- } else if (minutes>10000) {
- minutes=10000;
- }
+ Limit(minutes, 1, 10000);
- m_nSaveInterval=minutes*60*1000; //minutes to milliseconds
+ m_nSaveInterval=minutes * 60 * 1000; //minutes to milliseconds
}
+
int CAutoSaver::GetSaveInterval()
+//-------------------------------
{
return m_nSaveInterval/60/1000;
}
+
///////////////////////////
// Implementation internals
///////////////////////////
+
bool CAutoSaver::CheckTimer(DWORD curTime)
+//----------------------------------------
{
DWORD curInterval = curTime-m_nLastSave;
- return (curInterval>=m_nSaveInterval);
+ return (curInterval >= m_nSaveInterval);
}
CString CAutoSaver::BuildFileName(CModDoc* pModDoc)
+//-------------------------------------------------
{
CString timeStamp = (CTime::GetCurrentTime()).Format("%Y%m%d.%H%M%S");
CString name;
- if (m_bUseOriginalPath) {
- if (pModDoc->m_bHasValidPath) { // Check that the file has a user-chosen path
+ if (m_bUseOriginalPath)
+ {
+ if (pModDoc->m_bHasValidPath)
+ {
+ // Check that the file has a user-chosen path
name = pModDoc->GetPathName();
- } else { // if it doesnt, put it in settings dir
+ } else
+ {
+ // if it doesnt, put it in settings dir
name = theApp.GetConfigPath() + pModDoc->GetTitle();
}
- } else {
+ } else
+ {
name = m_csPath+pModDoc->GetTitle();
}
name.Append(".AutoSave."); //append backup tag
name.Append(timeStamp); //append timestamp
- switch (pModDoc->GetModType()) { //append extension
- case MOD_TYPE_MOD:
- name.Append(".mod");
- break;
- case MOD_TYPE_IT:
- if((pModDoc->GetSoundFile())->m_dwSongFlags & SONG_ITPROJECT){
- name.Append(".itp");
- } else{
- name.Append(".it");
- }
- break;
- case MOD_TYPE_MPT:
- name.Append(".mptm");
- break;
- case MOD_TYPE_XM:
- name.Append(".xm");
- break;
- case MOD_TYPE_S3M:
- name.Append(".s3m");
- break;
+ name.Append("."); //append extension
+ if((pModDoc->GetSoundFile()->m_dwSongFlags & SONG_ITPROJECT) != 0)
+ {
+ name.Append("itp");
+ } else
+ {
+ name.Append(pModDoc->GetSoundFile()->GetModSpecifications().fileExtension);
}
return name;
}
+
+
bool CAutoSaver::SaveSingleFile(CModDoc *pModDoc)
+//-----------------------------------------------
{
// We do not call CModDoc::DoSave as this populates the Recent Files
// list with backups... hence we have duplicated code.. :(
- BOOL success=false;
+ bool success = false;
CSoundFile* pSndFile = pModDoc->GetSoundFile();
- if (pSndFile) {
+ if (pSndFile)
+ {
CString fileName = BuildFileName(pModDoc);
- switch (pModDoc->GetModType()) {
- case MOD_TYPE_MOD:
- success = pSndFile->SaveMod(fileName, 0);
- break;
- case MOD_TYPE_S3M:
- success = pSndFile->SaveS3M(fileName, 0);
- break;
- case MOD_TYPE_XM:
- success = pSndFile->SaveXM(fileName, 0);
- break;
- case MOD_TYPE_IT:
- success = (pSndFile->m_dwSongFlags & SONG_ITPROJECT) ?
- pSndFile->SaveITProject(fileName) :
- pSndFile->SaveIT(fileName, 0);
- break;
- case MOD_TYPE_MPT:
- //Using IT save function also for MPT.
- success = pSndFile->SaveIT(fileName, 0);
- break;
+ switch (pModDoc->GetModType())
+ {
+ case MOD_TYPE_MOD:
+ success = pSndFile->SaveMod(fileName, 0);
+ break;
+ case MOD_TYPE_S3M:
+ success = pSndFile->SaveS3M(fileName, 0);
+ break;
+ case MOD_TYPE_XM:
+ success = pSndFile->SaveXM(fileName, 0);
+ break;
+ case MOD_TYPE_IT:
+ success = (pSndFile->m_dwSongFlags & SONG_ITPROJECT) ?
+ pSndFile->SaveITProject(fileName) :
+ pSndFile->SaveIT(fileName, 0);
+ break;
+ case MOD_TYPE_MPT:
+ //Using IT save function also for MPT.
+ success = pSndFile->SaveIT(fileName, 0);
+ break;
//default:
- //Do nothing
+ //Do nothing
}
}
- return (success == TRUE);
+ return success;
}
+
void CAutoSaver::CleanUpBackups(CModDoc *pModDoc)
+//-----------------------------------------------
{
CString path;
- if (m_bUseOriginalPath) {
- if (pModDoc->m_bHasValidPath) { // Check that the file has a user-chosen path
+ if (m_bUseOriginalPath)
+ {
+ if (pModDoc->m_bHasValidPath) // Check that the file has a user-chosen path
+ {
CString fullPath = pModDoc->GetPathName();
path = fullPath.Left(fullPath.GetLength()-pModDoc->GetTitle().GetLength()); //remove file name if necessary
- } else {
+ } else
+ {
path = theApp.GetConfigPath();
}
- } else {
+ } else
+ {
path = m_csPath;
}
@@ -286,15 +318,18 @@
BOOL bResult = finder.FindFile(searchPattern);
CArray<CString> foundfiles;
- while(bResult) {
+ while(bResult)
+ {
bResult = finder.FindNextFile();
foundfiles.Add(path+finder.GetFileName());
}
finder.Close();
std::sort(foundfiles.GetData(), foundfiles.GetData() + foundfiles.GetSize());
- while (foundfiles.GetSize()>m_nBackupHistory) {
- try {
+ while (foundfiles.GetSize()>m_nBackupHistory)
+ {
+ try
+ {
CString toRemove=foundfiles[0];
CFile::Remove(toRemove);
} catch (CFileException* /*pEx*/){}
@@ -304,10 +339,12 @@
}
+
///////////////////////////////////////////////////////////////////////////////////////
// CAutoSaverGUI dialog : AutoSaver GUI
///////////////////////////////////////////////////////////////////////////////////////
+
IMPLEMENT_DYNAMIC(CAutoSaverGUI, CPropertyPage)
CAutoSaverGUI::CAutoSaverGUI(CAutoSaver* pAutoSaver)
: CPropertyPage(CAutoSaverGUI::IDD)
Modified: trunk/OpenMPT/mptrack/CleanupSong.cpp
===================================================================
--- trunk/OpenMPT/mptrack/CleanupSong.cpp 2011-07-29 20:54:38 UTC (rev 939)
+++ trunk/OpenMPT/mptrack/CleanupSong.cpp 2011-07-30 00:49:19 UTC (rev 940)
@@ -706,7 +706,7 @@
INSTRUMENTINDEX nSwap, nIndex;
bool bReorg = false;
- if (!pSndFile->m_nInstruments) return false;
+ if (!pSndFile->GetNumInstruments()) return false;
char removeSamples = -1;
if ( !((pSndFile->GetType() == MOD_TYPE_IT) && (pSndFile->m_dwSongFlags & SONG_ITPROJECT))) //never remove an instrument's samples in ITP.
Modified: trunk/OpenMPT/mptrack/Ctrl_gen.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Ctrl_gen.cpp 2011-07-29 20:54:38 UTC (rev 939)
+++ trunk/OpenMPT/mptrack/Ctrl_gen.cpp 2011-07-30 00:49:19 UTC (rev 940)
@@ -346,7 +346,7 @@
void CCtrlGeneral::OnTempoChanged()
//---------------------------------
{
- CHAR s[32];
+ CHAR s[16];
if ((m_pSndFile) && (m_pModDoc) && (m_bInitialized))
{
m_EditTempo.GetWindowText(s, sizeof(s));
@@ -373,7 +373,7 @@
void CCtrlGeneral::OnSpeedChanged()
//---------------------------------
{
- CHAR s[32];
+ CHAR s[16];
if ((m_pSndFile) && (m_pModDoc) && (m_bInitialized))
{
m_EditSpeed.GetWindowText(s, sizeof(s));
@@ -381,7 +381,8 @@
{
UINT n = atoi(s);
n = CLAMP(n, m_pSndFile->GetModSpecifications().speedMin, m_pSndFile->GetModSpecifications().speedMax);
- if (n != m_pSndFile->m_nDefaultSpeed) {
+ if (n != m_pSndFile->m_nDefaultSpeed)
+ {
m_bEditsLocked=true;
m_EditSpeed.SetModify(FALSE);
m_pSndFile->m_nDefaultSpeed = n;
@@ -398,8 +399,9 @@
void CCtrlGeneral::OnVSTiVolChanged()
//-------------------------------------
{
- CHAR s[32];
- if ((m_pSndFile) && (m_pModDoc) && (m_bInitialized)) {
+ CHAR s[16];
+ if ((m_pSndFile) && (m_pModDoc) && (m_bInitialized))
+ {
m_EditVSTiVol.GetWindowText(s, sizeof(s));
if (s[0]) {
UINT n = ConvertStrTo<UINT>(s);
@@ -420,8 +422,9 @@
void CCtrlGeneral::OnSamplePAChanged()
//-------------------------------------
{
- CHAR s[32];
- if ((m_pSndFile) && (m_pModDoc) && (m_bInitialized)) {
+ CHAR s[16];
+ if ((m_pSndFile) && (m_pModDoc) && (m_bInitialized))
+ {
m_EditSamplePA.GetWindowText(s, sizeof(s));
if (s[0]) {
UINT n = ConvertStrTo<UINT>(s);
@@ -441,7 +444,7 @@
void CCtrlGeneral::OnGlobalVolChanged()
//-------------------------------------
{
- CHAR s[32];
+ CHAR s[16];
if ((m_pSndFile) && (m_pModDoc) && (m_bInitialized))
{
m_EditGlobalVol.GetWindowText(s, sizeof(s));
@@ -619,14 +622,16 @@
}
-BOOL CCtrlGeneral::GetToolTipText(UINT uId, LPSTR pszText) {
-//----------------------------------------------------------
+BOOL CCtrlGeneral::GetToolTipText(UINT uId, LPSTR pszText)
+//--------------------------------------------------------
+{
const char moreRecentMixModeNote[] = "Use a more recent mixmode to see dB offsets.";
if ((pszText) && (uId))
{
const bool displayDBValues = m_pSndFile->m_pConfig->getDisplayDBValues();
- switch(uId) {
+ switch(uId)
+ {
case IDC_SLIDER_SAMPLEPREAMP:
(displayDBValues) ? setAsDecibels(pszText, m_pSndFile->m_nSamplePreAmp, m_pSndFile->m_pConfig->getNormalSamplePreAmp()) : wsprintf(pszText, moreRecentMixModeNote);
return TRUE;
@@ -645,18 +650,19 @@
}
-void CCtrlGeneral::setAsDecibels(LPSTR stringToSet, double value, double valueAtZeroDB) {
+void CCtrlGeneral::setAsDecibels(LPSTR stringToSet, double value, double valueAtZeroDB)
//-------------------------------------------------------------------------------------
-
- if (value==0) {
+{
+ if (value == 0)
+ {
wsprintf(stringToSet, "-inf");
return;
}
double changeFactor = value / valueAtZeroDB;
- double dB = 10*log(changeFactor);
+ double dB = 10 * log(changeFactor);
- char sign = (dB>=0)?'+':' ';
+ char sign = (dB>=0) ? '+' : ' ';
sprintf(stringToSet, "%c%.2f dB", sign, dB);
return;
Modified: trunk/OpenMPT/mptrack/Ctrl_ins.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Ctrl_ins.cpp 2011-07-29 20:54:38 UTC (rev 939)
+++ trunk/OpenMPT/mptrack/Ctrl_ins.cpp 2011-07-30 00:49:19 UTC (rev 940)
@@ -1868,10 +1868,10 @@
if (b) pIns->dwFlags |= INS_SETPANNING;
else pIns->dwFlags &= ~INS_SETPANNING;
- if(b && m_pSndFile->GetType() & MOD_TYPE_IT|MOD_TYPE_MPT)
+ if(b && m_pSndFile->GetType() & (MOD_TYPE_IT|MOD_TYPE_MPT))
{
bool smpPanningInUse = false;
- for(BYTE i = 0; i<ARRAYELEMCOUNT(pIns->Keyboard); i++)
+ for(BYTE i = 0; i < CountOf(pIns->Keyboard); i++)
{
const SAMPLEINDEX smp = pIns->Keyboard[i];
if(smp <= m_pSndFile->GetNumSamples() && m_pSndFile->Samples[smp].uFlags & CHN_PANNING)
@@ -1889,7 +1889,7 @@
_T(""),
MB_YESNO) == IDYES)
{
- for(BYTE i = 0; i < ARRAYELEMCOUNT(pIns->Keyboard); i++)
+ for(BYTE i = 0; i < CountOf(pIns->Keyboard); i++)
{
const SAMPLEINDEX smp = pIns->Keyboard[i];
if(smp <= m_pSndFile->GetNumSamples())
Modified: trunk/OpenMPT/mptrack/MPTHacks.cpp
===================================================================
--- trunk/OpenMPT/mptrack/MPTHacks.cpp 2011-07-29 20:54:38 UTC (rev 939)
+++ trunk/OpenMPT/mptrack/MPTHacks.cpp 2011-07-30 00:49:19 UTC (rev 940)
@@ -147,7 +147,7 @@
AddToLog("Found VST plugins\n");
// Pattern count
- if(m_SndFile.GetNumPatterns() > originalSpecs->patternsMax)
+ if(m_SndFile.Patterns.GetNumPatterns() > originalSpecs->patternsMax)
{
message.Format("Found too many patterns (%d allowed)\n", originalSpecs->patternsMax);
AddToLog(message);
@@ -208,7 +208,7 @@
foundHacks = true;
if(autofix)
{
- for(PATTERNINDEX i = 0; i < m_SndFile.GetNumPatterns(); i++)
+ for(PATTERNINDEX i = 0; i < m_SndFile.Patterns.GetNumPatterns(); i++)
{
m_SndFile.Patterns[i].SetName("");
}
@@ -371,7 +371,7 @@
if(!originalSpecs->hasPatternSignatures)
{
foundHere = false;
- for(PATTERNINDEX i = 0; i < m_SndFile.GetNumPatterns(); i++)
+ for(PATTERNINDEX i = 0; i < m_SndFile.Patterns.GetNumPatterns(); i++)
{
if(m_SndFile.Patterns[i].GetOverrideSignature())
{
Modified: trunk/OpenMPT/mptrack/MainFrm.cpp
===================================================================
--- trunk/OpenMPT/mptrack/MainFrm.cpp 2011-07-29 20:54:38 UTC (rev 939)
+++ trunk/OpenMPT/mptrack/MainFrm.cpp 2011-07-30 00:49:19 UTC (rev 940)
@@ -1216,6 +1216,7 @@
if (penEnvelopeHighlight) DeleteObject(penEnvelopeHighlight);
penEnvelopeHighlight = ::CreatePen(PS_SOLID, 0, RGB(0xFF, 0xFF, 0x00));
+ // Generel tab VU meters
for (UINT i=0; i<NUM_VUMETER_PENS*2; i++)
{
int r0,g0,b0, r1,g1,b1;
@@ -1275,17 +1276,6 @@
}
-VOID CMainFrame::GetKeyName(LONG lParam, LPSTR pszName, UINT cbSize)
-//------------------------------------------------------------------
-{
- pszName[0] = (char)cbSize;
- if ((cbSize > 0) && (lParam))
- {
- GetKeyNameText(lParam, pszName, cbSize);
- }
-}
-
-
/////////////////////////////////////////////////////////////////////////////
// CMainFrame operations
@@ -2471,7 +2461,8 @@
CSoundFile *pSndFile = NULL;
pSndFile = GetActiveDoc()->GetSoundFile();
- if (pSndFile) {
+ if (pSndFile)
+ {
return pSndFile->GetCurrentBPM();
}
return 0;
@@ -2691,6 +2682,7 @@
#endif // NO_VST
}
+
void AddPluginParameternamesToCombobox(CComboBox& CBox, SNDMIXPLUGIN& plug)
//-------------------------------------------------------------------------
{
@@ -2698,6 +2690,7 @@
AddPluginParameternamesToCombobox(CBox, *(CVstPlugin *)plug.pMixPlugin);
}
+
void AddPluginParameternamesToCombobox(CComboBox& CBox, CVstPlugin& plug)
//-----------------------------------------------------------------------
{
Modified: trunk/OpenMPT/mptrack/Mainfrm.h
===================================================================
--- trunk/OpenMPT/mptrack/Mainfrm.h 2011-07-29 20:54:38 UTC (rev 939)
+++ trunk/OpenMPT/mptrack/Mainfrm.h 2011-07-30 00:49:19 UTC (rev 940)
@@ -412,7 +412,7 @@
static HPEN penBlack, penDarkGray, penLightGray, penWhite, penHalfDarkGray, penSample, penEnvelope, penEnvelopeHighlight, penSeparator, penScratch, penGray00, penGray33, penGray40, penGray55, penGray80, penGray99, penGraycc, penGrayff;
static HCURSOR curDragging, curNoDrop, curArrow, curNoDrop2, curVSplit;
static LPMODPLUGDIB bmpPatterns, bmpNotes, bmpVUMeters, bmpVisNode, bmpVisPcNode;
- static HPEN gpenVuMeter[NUM_VUMETER_PENS*2];
+ static HPEN gpenVuMeter[NUM_VUMETER_PENS * 2]; // General tab VU meters
protected:
@@ -498,8 +498,6 @@
static HFONT GetLargeFixedFont() { return m_hLargeFixedFont; }
static void UpdateAllViews(DWORD dwHint, CObject *pHint=NULL);
static LRESULT CALLBACK KeyboardProc(int code, WPARAM wParam, LPARAM lParam);
- static void TranslateKeyboardMap(LPSTR pszKbd);
- static VOID GetKeyName(LONG lParam, LPSTR pszName, UINT cbSize);
static CInputHandler *m_InputHandler; //rewbs.customKeys
static CAutoSaver *m_pAutoSaver; //rewbs.customKeys
//static CPerformanceCounter *m_pPerfCounter;
Modified: trunk/OpenMPT/mptrack/ModConvert.cpp
===================================================================
--- trunk/OpenMPT/mptrack/ModConvert.cpp 2011-07-29 20:54:38 UTC (rev 939)
+++ trunk/OpenMPT/mptrack/ModConvert.cpp 2011-07-30 00:49:19 UTC (rev 940)
@@ -432,7 +432,7 @@
// Check for patterns with custom time signatures (fixing will be applied in the pattern container)
if(!CSoundFile::GetModSpecifications(nNewType).hasPatternSignatures)
{
- for(PATTERNINDEX nPat = 0; nPat < m_SndFile.GetNumPatterns(); nPat++)
+ for(PATTERNINDEX nPat = 0; nPat < m_SndFile.Patterns.GetNumPatterns(); nPat++)
{
if(m_SndFile.Patterns[nPat].GetOverrideSignature())
{
Modified: trunk/OpenMPT/mptrack/Moddoc.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Moddoc.cpp 2011-07-29 20:54:38 UTC (rev 939)
+++ trunk/OpenMPT/mptrack/Moddoc.cpp 2011-07-30 00:49:19 UTC (rev 940)
@@ -34,6 +34,7 @@
const TCHAR FileFilterNone[] = _T("");
const TCHAR* ModTypeToFilter(const CSoundFile& sndFile)
+//-----------------------------------------------------
{
const MODTYPE modtype = sndFile.GetType();
switch(modtype)
@@ -432,7 +433,7 @@
BOOL CModDoc::OnSaveDocument(LPCTSTR lpszPathName, const bool bTemplateFile)
-//------------------------------------------------
+//--------------------------------------------------------------------------
{
static int greccount = 0;
TCHAR fext[_MAX_EXT] = _T("");
@@ -442,20 +443,8 @@
if (!lpszPathName)
return FALSE;
_tsplitpath(lpszPathName, NULL, NULL, NULL, fext);
- MODTYPE type = CModSpecifications::ExtensionToType(fext);
+ MODTYPE type = m_SndFile.GetType(); // CModSpecifications::ExtensionToType(fext);
- /*
- if (!lstrcmpi(fext, ".mod")) type = MOD_TYPE_MOD; else
- if (!lstrcmpi(fext, ".s3m")) type = MOD_TYPE_S3M; else
- if (!lstrcmpi(fext, ".xm")) type = MOD_TYPE_XM; else
-// -> CODE#0023
-// -> DESC="IT project files (.itp)"
-// if (!lstrcmpi(fext, ".it")) nType = MOD_TYPE_IT; else
- if (!lstrcmpi(fext, ".it") || !lstrcmpi(fext, ".itp")) type = MOD_TYPE_IT; else
- if (!lstrcmpi(fext, ".mptm")) type = MOD_TYPE_MPT; else
-// -! NEW_FEATURE#0023
-*/
-
if (type == MOD_TYPE_NONE && !greccount)
{
greccount++;
@@ -565,26 +554,17 @@
CHAR s[_MAX_PATH] = "";
CHAR path[_MAX_PATH]="", drive[_MAX_DRIVE]="";
CHAR fname[_MAX_FNAME]="", fext[_MAX_EXT]="";
- std::string extFilter = "", defaultExtension = "";
+ std::string defaultExtension = m_SndFile.GetModSpecifications().fileExtension;
switch(m_SndFile.GetType())
{
case MOD_TYPE_MOD:
MsgBoxHidable(ModCompatibilityExportTip);
- defaultExtension = "mod";
- extFilter = FileFilterMOD;
- strcpy(fext, ".mod");
break;
case MOD_TYPE_S3M:
- defaultExtension = "s3m";
- extFilter = FileFilterS3M;
- strcpy(fext, ".s3m");
break;
case MOD_TYPE_XM:
MsgBoxHidable(XMCompatibilityExportTip);
- defaultExtension = "xm";
- extFilter = FileFilterXM;
- strcpy(fext, ".xm");
break;
case MOD_TYPE_IT:
// -> CODE#0023
@@ -592,29 +572,27 @@
// lpszDefExt = "it";
// lpszFilter = "Impulse Tracker Modules (*.it)|*.it||";
// strcpy(fext, ".it");
- if(m_SndFile.m_dwSongFlags & SONG_ITPROJECT){
+ if(m_SndFile.m_dwSongFlags & SONG_ITPROJECT)
+ {
+ // Special case...
defaultExtension = "itp";
- extFilter = FileFilterITP;
- strcpy(fext, ".itp");
}
else
{
MsgBoxHidable(ItCompatibilityExportTip);
- defaultExtension = "it";
- extFilter = FileFilterIT;
- strcpy(fext, ".it");
}
// -! NEW_FEATURE#0023
break;
case MOD_TYPE_MPT:
- defaultExtension = "mptm";
- extFilter = FileFilterMPT;
- strcpy(fext, ".mptm");
break;
default:
ErrorBox(IDS_ERR_SAVESONG, CMainFrame::GetMainFrame());
return FALSE;
}
+
+ strcpy(fext, ".");
+ strcat(fext, defaultExtension.c_str());
+
if ((!lpszPathName) || (!lpszPathName[0]) || m_ShowSavedialog)
{
_splitpath(m_strPathName, drive, path, fname, NULL);
@@ -625,7 +603,7 @@
strcat(s, fext);
FileDlgResult files = CTrackApp::ShowOpenSaveFileDialog(false, defaultExtension, s,
- extFilter,
+ ModTypeToFilter(m_SndFile),
CMainFrame::GetSettings().GetWorkingDirectory(DIR_MODS));
if(files.abort) return FALSE;
@@ -2192,12 +2170,12 @@
#define MAX_FXINFO 70
-const MPTEFFECTINFO gFXInfo[MAX_FXINFO] =
+const MPTEFFECTINFO gFXInfo[] =
{
{CMD_ARPEGGIO, 0,0, 0, MOD_TYPE_ALL, "Arpeggio"},
{CMD_PORTAMENTOUP, 0,0, 0, MOD_TYPE_ALL, "Portamento Up"},
{CMD_PORTAMENTODOWN,0,0, 0, MOD_TYPE_ALL, "Portamento Down"},
- {CMD_TONEPORTAMENTO,0,0, 0, MOD_TYPE_ALL, "Tone portamento"},
+ {CMD_TONEPORTAMENTO,0,0, 0, MOD_TYPE_ALL, "Tone Portamento"},
{CMD_VIBRATO, 0,0, 0, MOD_TYPE_ALL, "Vibrato"},
{CMD_TONEPORTAVOL, 0,0, 0, MOD_TYPE_ALL, "Volslide+Toneporta"},
{CMD_VIBRATOVOL, 0,0, 0, MOD_TYPE_ALL, "VolSlide+Vibrato"},
@@ -2212,59 +2190,59 @@
{CMD_SPEED, 0,0, 0, MOD_TYPE_ALL, "Set Speed"},
{CMD_TEMPO, 0,0, 0, MOD_TYPE_ALL, "Set Tempo"},
{CMD_TREMOR, 0,0, 0, MOD_TYPE_NOMOD, "Tremor"},
- {CMD_CHANNELVOLUME, 0,0, 0, MOD_TYPE_S3MITMPT, "Set channel volume"},
- {CMD_CHANNELVOLSLIDE,0,0, 0, MOD_TYPE_S3MITMPT, "Channel volslide"},
- {CMD_GLOBALVOLUME, 0,0, 0, MOD_TYPE_NOMOD, "Set global volume"},
- {CMD_GLOBALVOLSLIDE,0,0, 0, MOD_TYPE_NOMOD, "Global volume slide"},
- {CMD_KEYOFF, 0,0, 0, MOD_TYPE_XM, "Key off"},
- {CMD_FINEVIBRATO, 0,0, 0, MOD_TYPE_S3MITMPT, "Fine vibrato"},
+ {CMD_CHANNELVOLUME, 0,0, 0, MOD_TYPE_S3MITMPT, "Set Channel Volume"},
+ {CMD_CHANNELVOLSLIDE,0,0, 0, MOD_TYPE_S3MITMPT, "Channel Volume Slide"},
+ {CMD_GLOBALVOLUME, 0,0, 0, MOD_TYPE_NOMOD, "Set Global Volume"},
+ {CMD_GLOBALVOLSLIDE,0,0, 0, MOD_TYPE_NOMOD, "Global Volume Slide"},
+ {CMD_KEYOFF, 0,0, 0, MOD_TYPE_XM, "Key Off"},
+ {CMD_FINEVIBRATO, 0,0, 0, MOD_TYPE_S3MITMPT, "Fine Vibrato"},
{CMD_PANBRELLO, 0,0, 0, MOD_TYPE_NOMOD, "Panbrello"},
- {CMD_PANNINGSLIDE, 0,0, 0, MOD_TYPE_NOMOD, "Panning slide"},
+ {CMD_PANNINGSLIDE, 0,0, 0, MOD_TYPE_NOMOD, "Panning Slide"},
{CMD_SETENVPOSITION,0,0, 0, MOD_TYPE_XM, "Envelope position"},
- {CMD_MIDI, 0,0, 0x7F, MOD_TYPE_NOMOD, "Midi macro"},
- {CMD_SMOOTHMIDI, 0,0, 0x7F, MOD_TYPE_NOMOD, "Smooth Midi macro"}, //rewbs.smoothVST
+ {CMD_MIDI, 0,0, 0x7F, MOD_TYPE_NOMOD, "MIDI Macro"},
+ {CMD_SMOOTHMIDI, 0,0, 0x7F, MOD_TYPE_NOMOD, "Smooth MIDI Macro"}, //rewbs.smoothVST
// Extended MOD/XM effects
- {CMD_MODCMDEX, 0xF0,0x10, 0, MOD_TYPE_MODXM, "Fine porta up"},
- {CMD_MODCMDEX, 0xF0,0x20, 0, MOD_TYPE_MODXM, "Fine porta down"},
+ {CMD_MODCMDEX, 0xF0,0x10, 0, MOD_TYPE_MODXM, "Fine Porta Up"},
+ {CMD_MODCMDEX, 0xF0,0x20, 0, MOD_TYPE_MODXM, "Fine Porta Down"},
{CMD_MODCMDEX, 0xF0,0x30, 0, MOD_TYPE_MODXM, "Glissando Control"},
- {CMD_MODCMDEX, 0xF0,0x40, 0, MOD_TYPE_MODXM, "Vibrato waveform"},
- {CMD_MODCMDEX, 0xF0,0x50, 0, MOD_TYPE_MODXM, "Set finetune"},
- {CMD_MODCMDEX, 0xF0,0x60, 0, MOD_TYPE_MODXM, "Pattern loop"},
- {CMD_MODCMDEX, 0xF0,0x70, 0, MOD_TYPE_MODXM, "Tremolo waveform"},
- {CMD_MODCMDEX, 0xF0,0x80, 0, MOD_TYPE_MODXM, "Set panning"},
- {CMD_MODCMDEX, 0xF0,0x90, 0, MOD_TYPE_MODXM, "Retrigger note"},
- {CMD_MODCMDEX, 0xF0,0xA0, 0, MOD_TYPE_MODXM, "Fine volslide up"},
- {CMD_MODCMDEX, 0xF0,0xB0, 0, MOD_TYPE_MODXM, "Fine volslide down"},
- {CMD_MODCMDEX, 0xF0,0xC0, 0, MOD_TYPE_MODXM, "Note cut"},
- {CMD_MODCMDEX, 0xF0,0xD0, 0, MOD_TYPE_MODXM, "Note delay"},
- {CMD_MODCMDEX, 0xF0,0xE0, 0, MOD_TYPE_MODXM, "Pattern delay"},
- {CMD_MODCMDEX, 0xF0,0xF0, 0, MOD_TYPE_XM, "Set active macro"},
+ {CMD_MODCMDEX, 0xF0,0x40, 0, MOD_TYPE_MODXM, "Vibrato Waveform"},
+ {CMD_MODCMDEX, 0xF0,0x50, 0, MOD_TYPE_MODXM, "Set Finetune"},
+ {CMD_MODCMDEX, 0xF0,0x60, 0, MOD_TYPE_MODXM, "Pattern Loop"},
+ {CMD_MODCMDEX, 0xF0,0x70, 0, MOD_TYPE_MODXM, "Tremolo Waveform"},
+ {CMD_MODCMDEX, 0xF0,0x80, 0, MOD_TYPE_MODXM, "Set Panning"},
+ {CMD_MODCMDEX, 0xF0,0x90, 0, MOD_TYPE_MODXM, "Retrigger Note"},
+ {CMD_MODCMDEX, 0xF0,0xA0, 0, MOD_TYPE_MODXM, "Fine Volslide Up"},
+ {CMD_MODCMDEX, 0xF0,0xB0, 0, MOD_TYPE_MODXM, "Fine Volslide Down"},
+ {CMD_MODCMDEX, 0xF0,0xC0, 0, MOD_TYPE_MODXM, "Note Cut"},
+ {CMD_MODCMDEX, 0xF0,0xD0, 0, MOD_TYPE_MODXM, "Note Delay"},
+ {CMD_MODCMDEX, 0xF0,0xE0, 0, MOD_TYPE_MODXM, "Pattern Delay"},
+ {CMD_MODCMDEX, 0xF0,0xF0, 0, MOD_TYPE_XM, "Set Active Macro"},
{CMD_MODCMDEX, 0xF0,0xF0, 0, MOD_TYPE_MOD, "Invert Loop"},
// Extended S3M/IT effects
- {CMD_S3MCMDEX, 0xF0,0x10, 0, MOD_TYPE_S3MITMPT, "Glissando control"},
- {CMD_S3MCMDEX, 0xF0,0x20, 0, MOD_TYPE_S3M, "Set finetune"},
- {CMD_S3MCMDEX, 0xF0,0x30, 0, MOD_TYPE_S3MITMPT, "Vibrato waveform"},
- {CMD_S3MCMDEX, 0xF0,0x40, 0, MOD_TYPE_S3MITMPT, "Tremolo waveform"},
- {CMD_S3MCMDEX, 0xF0,0x50, 0, MOD_TYPE_S3MITMPT, "Panbrello waveform"},
- {CMD_S3MCMDEX, 0xF0,0x60, 0, MOD_TYPE_S3MITMPT, "Fine pattern delay"},
- {CMD_S3MCMDEX, 0xF0,0x80, 0, MOD_TYPE_S3MITMPT, "Set panning"},
- {CMD_S3MCMDEX, 0xF0,0xA0, 0, MOD_TYPE_S3MITMPT, "Set high offset"},
- {CMD_S3MCMDEX, 0xF0,0xB0, 0, MOD_TYPE_S3MITMPT, "Pattern loop"},
- {CMD_S3MCMDEX, 0xF0,0xC0, 0, MOD_TYPE_S3MITMPT, "Note cut"},
- {CMD_S3MCMDEX, 0xF0,0xD0, 0, MOD_TYPE_S3MITMPT, "Note delay"},
- {CMD_S3MCMDEX, 0xF0,0xE0, 0, MOD_TYPE_S3MITMPT, "Pattern delay"},
- {CMD_S3MCMDEX, 0xF0,0xF0, 0, MOD_TYPE_ITMPT, "Set active macro"},
+ {CMD_S3MCMDEX, 0xF0,0x10, 0, MOD_TYPE_S3MITMPT, "Glissando Control"},
+ {CMD_S3MCMDEX, 0xF0,0x20, 0, MOD_TYPE_S3M, "Set Finetune"},
+ {CMD_S3MCMDEX, 0xF0,0x30, 0, MOD_TYPE_S3MITMPT, "Vibrato Waveform"},
+ {CMD_S3MCMDEX, 0xF0,0x40, 0, MOD_TYPE_S3MITMPT, "Tremolo Waveform"},
+ {CMD_S3MCMDEX, 0xF0,0x50, 0, MOD_TYPE_S3MITMPT, "Panbrello Waveform"},
+ {CMD_S3MCMDEX, 0xF0,0x60, 0, MOD_TYPE_S3MITMPT, "Fine Pattern Delay"},
+ {CMD_S3MCMDEX, 0xF0,0x80, 0, MOD_TYPE_S3MITMPT, "Set Panning"},
+ {CMD_S3MCMDEX, 0xF0,0xA0, 0, MOD_TYPE_S3MITMPT, "Set High Offset"},
+ {CMD_S3MCMDEX, 0xF0,0xB0, 0, MOD_TYPE_S3MITMPT, "Pattern Loop"},
+ {CMD_S3MCMDEX, 0xF0,0xC0, 0, MOD_TYPE_S3MITMPT, "Note Cut"},
+ {CMD_S3MCMDEX, 0xF0,0xD0, 0, MOD_TYPE_S3MITMPT, "Note Delay"},
+ {CMD_S3MCMDEX, 0xF0,0xE0, 0, MOD_TYPE_S3MITMPT, "Pattern Delay"},
+ {CMD_S3MCMDEX, 0xF0,0xF0, 0, MOD_TYPE_ITMPT, "Set Active Macro"},
// MPT XM extensions and special effects
- {CMD_XFINEPORTAUPDOWN,0xF0,0x10,0, MOD_TYPE_XM, "Extra fine porta up"},
- {CMD_XFINEPORTAUPDOWN,0xF0,0x20,0, MOD_TYPE_XM, "Extra fine porta down"},
- {CMD_XFINEPORTAUPDOWN,0xF0,0x50,0, MOD_TYPE_XM, "Panbrello waveform"},
- {CMD_XFINEPORTAUPDOWN,0xF0,0x60,0, MOD_TYPE_XM, "Fine pattern delay"},
- {CMD_XFINEPORTAUPDOWN,0xF0,0x90,0, MOD_TYPE_XM, "Sound control"},
- {CMD_XFINEPORTAUPDOWN,0xF0,0xA0,0, MOD_TYPE_XM, "Set high offset"},
+ {CMD_XFINEPORTAUPDOWN,0xF0,0x10,0, MOD_TYPE_XM, "Extra Fine Porta Up"},
+ {CMD_XFINEPORTAUPDOWN,0xF0,0x20,0, MOD_TYPE_XM, "Extra Fine Porta Down"},
+ {CMD_XFINEPORTAUPDOWN,0xF0,0x50,0, MOD_TYPE_XM, "Panbrello Waveform"},
+ {CMD_XFINEPORTAUPDOWN,0xF0,0x60,0, MOD_TYPE_XM, "Fine Pattern Delay"},
+ {CMD_XFINEPORTAUPDOWN,0xF0,0x90,0, MOD_TYPE_XM, "Sound Control"},
+ {CMD_XFINEPORTAUPDOWN,0xF0,0xA0,0, MOD_TYPE_XM, "Set High Offset"},
// MPT IT extensions and special effects
- {CMD_S3MCMDEX, 0xF0,0x90, 0, MOD_TYPE_S3MITMPT, "Sound control"},
- {CMD_S3MCMDEX, 0xF0,0x70, 0, MOD_TYPE_ITMPT, "Instr. control"},
- {CMD_DELAYCUT, 0x00,0x00, 0, MOD_TYPE_MPT, "Note delay and cut"},
+ {CMD_S3MCMDEX, 0xF0,0x90, 0, MOD_TYPE_S3MITMPT, "Sound Control"},
+ {CMD_S3MCMDEX, 0xF0,0x70, 0, MOD_TYPE_ITMPT, "Instr. Control"},
+ {CMD_DELAYCUT, 0x00,0x00, 0, MOD_TYPE_MPT, "Note Delay and Cut"},
// -> CODE#0010
// -> DESC="add extended parameter mechanism to pattern effects"
{CMD_XPARAM, 0x00,0x00, 0, MOD_TYPE_XMITMPT, "X param"},
@@ -2273,7 +2251,9 @@
{CMD_NOTESLIDEDOWN, 0x00,0x00, 0, MOD_TYPE_NONE, "Note Slide Down"}, // .IMF effect
};
+STATIC_ASSERT(CountOf(gFXInfo) == MAX_FXINFO);
+
UINT CModDoc::GetNumEffects() const
//---------------------------------
{
@@ -2417,21 +2397,27 @@
//----------------------------------------------------------------------
{
//if (pParam) *pParam = -1;
- if (ndx >= MAX_FXINFO) {
+ if (ndx >= MAX_FXINFO)
+ {
refParam = 0;
return CMD_NONE;
}
//Cap parameter to match FX if necessary.
- if (gFXInfo[ndx].dwParamMask) {
- if (refParam < static_cast<int>(gFXInfo[ndx].dwParamValue)) {
+ if (gFXInfo[ndx].dwParamMask)
+ {
+ if (refParam < static_cast<int>(gFXInfo[ndx].dwParamValue))
+ {
refParam = gFXInfo[ndx].dwParamValue; // for example: delay with param < D0 becomes SD0
- } else if (refParam > static_cast<int>(gFXInfo[ndx].dwParamValue)+15) {
- refParam = gFXInfo[ndx].dwParamValue+15; // for example: delay with param > DF becomes SDF
+ } else if (refParam > static_cast<int>(gFXInfo[ndx].dwParamValue) + 15)
+ {
+ refParam = gFXInfo[ndx].dwParamValue + 15; // for example: delay with param > DF becomes SDF
}
}
- if (gFXInfo[ndx].dwFlags) {
- if (refParam > static_cast<int>(gFXInfo[ndx].dwFlags)) {
+ if (gFXInfo[ndx].dwFlags)
+ {
+ if (refParam > static_cast<int>(gFXInfo[ndx].dwFlags))
+ {
refParam = gFXInfo[ndx].dwFlags; //used for Zxx macro control: limit to 7F max.
}
}
@@ -2443,7 +2429,8 @@
MODCOMMAND::COMMAND CModDoc::GetEffectFromIndex(UINT ndx)
//-------------------------------------------------------
{
- if (ndx >= MAX_FXINFO) {
+ if (ndx >= MAX_FXINFO)
+ {
return CMD_NONE;
}
@@ -2453,7 +2440,8 @@
UINT CModDoc::GetEffectMaskFromIndex(UINT ndx)
//--------------------------------------------
{
- if (ndx >= MAX_FXINFO) {
+ if (ndx >= MAX_FXINFO)
+ {
return 0;
}
@@ -3064,10 +3052,10 @@
LPCSTR pszName; // ie "Set Volume"
} MPTVOLCMDINFO;
-#define MAX_VOLINFO 15
+#define MAX_VOLINFO (MAX_VOLCMDS - 1)
-const MPTVOLCMDINFO gVolCmdInfo[MAX_VOLINFO] =
+const MPTVOLCMDINFO gVolCmdInfo[] =
{
{VOLCMD_VOLUME, MOD_TYPE_NOMOD, "v: Set Volume"},
{VOLCMD_PANNING, MOD_TYPE_NOMOD, "p: Set Panning"},
@@ -3086,7 +3074,9 @@
{VOLCMD_OFFSET, MOD_TYPE_ITMPT, "o: Offset"}, //rewbs.volOff
};
+STATIC_ASSERT(CountOf(gVolCmdInfo) == MAX_VOLINFO);
+
UINT CModDoc::GetNumVolCmds() const
//---------------------------------
{
@@ -3097,7 +3087,7 @@
LONG CModDoc::GetIndexFromVolCmd(UINT volcmd)
//-------------------------------------------
{
- for (UINT i=0; i<MAX_VOLINFO; i++)
+ for (UINT i = 0; i < MAX_VOLINFO; i++)
{
if (gVolCmdInfo[i].dwVolCmd == volcmd) return i;
}
@@ -3150,7 +3140,7 @@
//----------------------------
{
CMainFrame *pMainFrm = CMainFrame::GetMainFrame();
- if (!pMainFrm) return 0;
+ if (!pMainFrm) return nullptr;
CMDIChildWnd *pMDIActive = pMainFrm->MDIGetActive();
if (pMDIActive)
{
@@ -3166,7 +3156,7 @@
return (CChildFrame *)pView->GetParentFrame();
}
- return NULL;
+ return nullptr;
}
HWND CModDoc::GetEditPosition(ROWINDEX &row, PATTERNINDEX &pat, ORDERINDEX &ord)
@@ -3197,14 +3187,17 @@
ord = patternViewState->nOrder;
}
//rewbs.fix3185: if position is invalid, go to start of song.
- if (ord >= m_SndFile.Order.size()) {
+ if (ord >= m_SndFile.Order.size())
+ {
ord = 0;
pat = pSndFile->Order[ord];
}
- if (pat >= m_SndFile.Patterns.Size()) {
+ if (pat >= m_SndFile.Patterns.Size())
+ {
pat=0;
}
- if (row >= pSndFile->Patterns[pat].GetNumRows()) {
+ if (row >= pSndFile->Patterns[pat].GetNumRows())
+ {
row=0;
}
//end rewbs.fix3185
@@ -3446,9 +3439,11 @@
pSndFile->m_nNextRow = 0;
pSndFile->ResetTotalTickCount();
//rewbs.vstCompliance
- if (pModPlaying == this) {
+ if (pModPlaying == this)
+ {
pSndFile->StopAllVsti();
- } else {
+ } else
+ {
pSndFile->ResumePlugins();
}
//end rewbs.vstCompliance
@@ -3502,15 +3497,18 @@
pSndFile->LoopPattern(nPat);
pSndFile->m_nNextRow = nRow;
//rewbs.VSTCompliance
- if (pModPlaying == this) {
+ if (pModPlaying == this)
+ {
pSndFile->StopAllVsti();
- } else {
+ } else
+ {
pSndFile->ResumePlugins();
}
//end rewbs.VSTCompliance
END_CRITICAL();
- if (pModPlaying != this) {
+ if (pModPlaying != this)
+ {
pMainFrm->PlayMod(this, followSonghWnd, m_dwNotifyType|MPTNOTIFY_POSITION|MPTNOTIFY_VUMETERS); //rewbs.fix2977
}
}
@@ -3668,16 +3666,18 @@
newPath += path;
//Catch case where we don't have a filename yet.
- if (fname[0] == 0) {
+ if (fname[0] == 0)
+ {
newPath += GetTitle();
- } else {
+ } else
+ {
newPath += fname;
}
switch(nNewType)
{
case MOD_TYPE_XM: newPath += ".xm"; break;
- case MOD_TYPE_IT: m_SndFile.m_dwSongFlags & SONG_ITPROJECT ? newPath+=".itp" : newPath+=".it"; break;
+ case MOD_TYPE_IT: newPath += m_SndFile.m_dwSongFlags & SONG_ITPROJECT ? ".itp" : ".it"; break;
case MOD_TYPE_MPT: newPath += ".mptm"; break;
case MOD_TYPE_S3M: newPath += ".s3m"; break;
case MOD_TYPE_MOD: newPath += ".mod"; break;
@@ -3931,7 +3931,9 @@
// Not needed?
}
+
void CModDoc::OnSaveTemplateModule()
+//----------------------------------
{
// Create template folder if doesn't exist already.
const LPCTSTR pszTemplateFolder = CMainFrame::GetSettings().GetDefaultDirectory(DIR_TEMPLATE_FILES_USER);
Modified: trunk/OpenMPT/mptrack/Vstplug.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Vstplug.cpp 2011-07-29 20:54:38 UTC (rev 939)
+++ trunk/OpenMPT/mptrack/Vstplug.cpp 2011-07-30 00:49:19 UTC (rev 940)
@@ -218,7 +218,7 @@
if (IDs.GetLength() >= 16)
{
// Get path from cache file
- GetPrivateProfileString(cacheSection, IDs, "", szPath, CountOf(szPath) - 1, cacheFile);
+ GetPrivateProfileString(cacheSection, IDs, "", szPath, CountOf(szPath), cacheFile);
SetNullTerminator(szPath);
theApp.RelativePathToAbsolute(szPath);
Modified: trunk/OpenMPT/mptrack/mod2midi.cpp
===================================================================
--- trunk/OpenMPT/mptrack/mod2midi.cpp 2011-07-29 20:54:38 UTC (rev 939)
+++ trunk/OpenMPT/mptrack/mod2midi.cpp 2011-07-30 00:49:19 UTC (rev 940)
@@ -380,13 +380,13 @@
// Add Song Name on track 0
- m_pSndFile->GetTitle(s);
- if (s[0])
+ const CHAR *modTitle = m_pSndFile->GetTitle();
+ if (modTitle[0])
{
tmp[0] = 0; tmp[1] = 0xff; tmp[2] = 0x01;
Tracks[0].Write(tmp, 3);
- Tracks[0].WriteLen(strlen(s));
- Tracks[0].Write(s, strlen(s));
+ Tracks[0].WriteLen(strlen(modTitle));
+ Tracks[0].Write(modTitle, strlen(modTitle));
}
// Add Song comments on track 0
if ((m_pSndFile->m_lpszSongComments) && (m_pSndFile->m_lpszSongComments[0]))
Modified: trunk/OpenMPT/mptrack/test/test.cpp
===================================================================
--- trunk/OpenMPT/mptrack/test/test.cpp 2011-07-29 20:54:38 UTC (rev 939)
+++ trunk/OpenMPT/mptrack/test/test.cpp 2011-07-30 00:49:19 UTC (rev 940)
@@ -387,7 +387,7 @@
VERIFY_EQUAL_NONCONT(pSndFile->Order.GetSequence(1)[1], 2);
// Patterns
- VERIFY_EQUAL_NONCONT(pSndFile->GetNumPatterns(), 2);
+ VERIFY_EQUAL_NONCONT(pSndFile->Patterns.GetNumPatterns(), 2);
VERIFY_EQUAL_NONCONT(pSndFile->Patterns[0].GetName(), "First Pattern");
VERIFY_EQUAL_NONCONT(pSndFile->Patterns[0].GetNumRows(), 70);
Modified: trunk/OpenMPT/soundlib/Sndfile.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Sndfile.cpp 2011-07-29 20:54:38 UTC (rev 939)
+++ trunk/OpenMPT/soundlib/Sndfile.cpp 2011-07-30 00:49:19 UTC (rev 940)
@@ -1028,34 +1028,6 @@
}
-PATTERNINDEX CSoundFile::GetNumPatterns() const
-//---------------------------------------------
-{
- PATTERNINDEX max = 0;
- for(PATTERNINDEX i = 0; i < Patterns.Size(); i++)
- {
- if(Patterns.IsValidPat(i))
- max = i + 1;
- }
- return max;
-}
-
-
-UINT CSoundFile::GetMaxPosition() const
-//-------------------------------------
-{
- UINT max = 0;
- UINT i = 0;
-
- while ((i < Order.size()) && (Order[i] != Order.GetInvalidPatIndex()))
- {
- if (Order[i] < Patterns.Size()) max += Patterns[Order[i]].GetNumRows();
- i++;
- }
- return max;
-}
-
-
UINT CSoundFile::GetCurrentPos() const
//------------------------------------
{
@@ -2549,7 +2521,7 @@
}
SAMPLEINDEX nExt = 0;
- for (PATTERNINDEX nPat = 0; nPat < GetNumPatterns(); nPat++)
+ for (PATTERNINDEX nPat = 0; nPat < Patterns.GetNumPatterns(); nPat++)
{
const MODCOMMAND *p = Patterns[nPat];
if(p == nullptr)
Modified: trunk/OpenMPT/soundlib/Sndfile.h
===================================================================
--- trunk/OpenMPT/soundlib/Sndfile.h 2011-07-29 20:54:38 UTC (rev 939)
+++ trunk/OpenMPT/soundlib/Sndfile.h 2011-07-30 00:49:19 UTC (rev 940)
@@ -700,14 +700,11 @@
void SetMasterVolume(UINT vol, bool adjustAGC = false);
UINT GetMasterVolume() const { return m_nMasterVolume; }
- // Returns 1 + index of last valid pattern, zero if no such pattern exists.
- PATTERNINDEX GetNumPatterns() const;
INSTRUMENTINDEX GetNumInstruments() const { return m_nInstruments; }
SAMPLEINDEX GetNumSamples() const { return m_nSamples; }
UINT GetCurrentPos() const;
PATTERNINDEX GetCurrentPattern() const { return m_nPattern; }
ORDERINDEX GetCurrentOrder() const { return static_cast<ORDERINDEX>(m_nCurrentPattern); }
- UINT GetMaxPosition() const;
CHANNELINDEX GetNumChannels() const { return m_nChannels; }
IMixPlugin* GetInstrumentPlugin(INSTRUMENTINDEX instr);
@@ -719,7 +716,6 @@
void DontLoopPattern(PATTERNINDEX nPat, ROWINDEX nRow = 0); //rewbs.playSongFromCursor
void SetCurrentPos(UINT nPos);
void SetCurrentOrder(ORDERINDEX nOrder);
- void GetTitle(LPSTR s) const { lstrcpyn(s,m_szNames[0],32); }
LPCSTR GetTitle() const { return m_szNames[0]; }
LPCTSTR GetSampleName(UINT nSample) const;
CString GetInstrumentName(UINT nInstr) const;
Modified: trunk/OpenMPT/soundlib/mod_specifications.cpp
===================================================================
--- trunk/OpenMPT/soundlib/mod_specifications.cpp 2011-07-29 20:54:38 UTC (rev 939)
+++ trunk/OpenMPT/soundlib/mod_specifications.cpp 2011-07-30 00:49:19 UTC (rev 940)
@@ -12,25 +12,27 @@
pszExt++;
char szExtA[CountOf(ModSpecs::mod.fileExtension)];
MemsetZero(szExtA);
- size_t i = 0;
const size_t nLength = _tcslen(pszExt);
if (nLength >= CountOf(szExtA))
return MOD_TYPE_NONE;
- for(i = 0; i<nLength; ++i)
+ for(size_t i = 0; i < nLength; i++)
szExtA[i] = static_cast<char>(pszExt[i]);
- if (!lstrcmpiA(szExtA, ModSpecs::mod.fileExtension) || !lstrcmpiA(szExtA, ModSpecs::modEx.fileExtension))
- return MOD_TYPE_MOD;
- else if (!lstrcmpiA(szExtA, ModSpecs::s3m.fileExtension) || !lstrcmpiA(szExtA, ModSpecs::s3mEx.fileExtension))
- return MOD_TYPE_S3M;
- else if (!lstrcmpiA(szExtA, ModSpecs::xm.fileExtension) || !lstrcmpiA(szExtA, ModSpecs::xmEx.fileExtension))
- return MOD_TYPE_XM;
- else if (!lstrcmpiA(szExtA, ModSpecs::it.fileExtension) || !lstrcmpiA(szExtA, ModSpecs::itEx.fileExtension)
- || !lstrcmpi(szExtA, _T("itp")))
+
+ for(size_t i = 0; i < CountOf(ModSpecs::Collection); i++)
+ {
+ if (!lstrcmpiA(szExtA, ModSpecs::Collection[i]->fileExtension))
+ {
+ return ModSpecs::Collection[i]->internalType;
+ }
+ }
+ // Special case: ITP files...
+ if(!lstrcmpi(szExtA, _T("itp")))
+ {
return MOD_TYPE_IT;
- else if (!lstrcmpiA(szExtA, ModSpecs::mptm.fileExtension))
- return MOD_TYPE_MPT;
- else
- return MOD_TYPE_NONE;
+ }
+
+ return MOD_TYPE_NONE;
+
}
Modified: trunk/OpenMPT/soundlib/mod_specifications.h
===================================================================
--- trunk/OpenMPT/soundlib/mod_specifications.h 2011-07-29 20:54:38 UTC (rev 939)
+++ trunk/OpenMPT/soundlib/mod_specifications.h 2011-07-30 00:49:19 UTC (rev 940)
@@ -24,6 +24,7 @@
// NOTE: If changing order, update all initializations below.
char fileExtension[6]; // File extension without dot.
+ MODTYPE internalType; // Internal MODTYPE value
MODCOMMAND::NOTE noteMin; // Minimum note index (index starts from 1)
MODCOMMAND::NOTE noteMax; // Maximum note index (index starts from 1)
bool hasNoteCut; // True if format has notecut.
@@ -71,6 +72,7 @@
-savefile format and GUI methods can handle new values(might not be a small task :).
*/
"mptm", // File extension
+ MOD_TYPE_MPT, // Internal MODTYPE value
NOTE_MIN, // Minimum note index
NOTE_MAX, // Maximum note index
true, // Has notecut.
@@ -113,6 +115,7 @@
{
// TODO: Set correct values.
"mod", // File extension
+ MOD_TYPE_MOD, // Internal MODTYPE value
37, // Minimum note index
108, // Maximum note index
false, // No notecut.
@@ -153,6 +156,7 @@
{
// TODO: Set correct values.
"mod", // File extension
+ MOD_TYPE_MOD, // Internal MODTYPE value
37, // Minimum note index
108, // Maximum note index
false, // No notecut.
@@ -192,6 +196,7 @@
{
// TODO: Set correct values.
"xm", // File extension
+ MOD_TYPE_XM, // Internal MODTYPE value
13, // Minimum note index
108, // Maximum note index
false, // No notecut.
@@ -232,6 +237,7 @@
{
// TODO: Set correct values.
"xm", // File extension
+ MOD_TYPE_XM, // Internal MODTYPE value
13, // Minimum note index
108, // Maximum note index
false, // No notecut.
@@ -271,6 +277,7 @@
{
// TODO: Set correct values.
"s3m", // File extension
+ MOD_TYPE_S3M, // Internal MODTYPE value
13, // Minimum note index
108, // Maximum note index
true, // Has notecut.
@@ -311,6 +318,7 @@
{
// TODO: Set correct values.
"s3m", // File extension
+ MOD_TYPE_S3M, // Internal MODTYPE value
13, // Minimum note index
108, // Maximum note index
true, // Has notecut.
@@ -350,6 +358,7 @@
{
// TODO: Set correct values.
"it", // File extension
+ MOD_TYPE_IT, // Internal MODTYPE value
1, // Minimum note index
120, // Maximum note index
true, // Has notecut.
@@ -389,6 +398,7 @@
{
// TODO: Set correct values.
"it", // File extension
+ MOD_TYPE_IT, // Internal MODTYPE value
1, // Minimum note index
120, // Maximum note index
true, // Has notecut.
@@ -424,6 +434,8 @@
false, // No custom pattern time signatures
};
+static const CModSpecifications *Collection[] = { &mptm, &mod, &modEx, &s3m, &s3mEx, &xm, &xmEx, &it, &itEx };
+
} // namespace ModSpecs
Modified: trunk/OpenMPT/soundlib/patternContainer.cpp
===================================================================
--- trunk/OpenMPT/soundlib/patternContainer.cpp 2011-07-29 20:54:38 UTC (rev 939)
+++ trunk/OpenMPT/soundlib/patternContainer.cpp 2011-07-30 00:49:19 UTC (rev 940)
@@ -154,6 +154,24 @@
}
+PATTERNINDEX CPatternContainer::GetNumPatterns() const
+//----------------------------------------------------
+{
+ if(Size() == 0)
+ {
+ return 0;
+ }
+ for(PATTERNINDEX nPat = Size(); nPat > 0; nPat--)
+ {
+ if(IsValidPat(nPat - 1))
+ {
+ return nPat;
+ }
+ }
+ return 0;
+}
+
+
PATTERNINDEX CPatternContainer::GetNumNamedPatterns() const
//---------------------------------------------------------
{
Modified: trunk/OpenMPT/soundlib/patternContainer.h
===================================================================
--- trunk/OpenMPT/soundlib/patternContainer.h 2011-07-29 20:54:38 UTC (rev 939)
+++ trunk/OpenMPT/soundlib/patternContainer.h 2011-07-30 00:49:19 UTC (rev 940)
@@ -76,6 +76,9 @@
void OnModTypeChanged(const MODTYPE oldtype);
+ // Returns index of last valid pattern + 1, zero if no such pattern exists.
+ PATTERNINDEX GetNumPatterns() const;
+
// Returns index of highest pattern with pattern named + 1.
PATTERNINDEX GetNumNamedPatterns() const;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rel...@us...> - 2011-07-29 20:54:47
|
Revision: 939
http://modplug.svn.sourceforge.net/modplug/?rev=939&view=rev
Author: relabsoluness
Date: 2011-07-29 20:54:38 +0000 (Fri, 29 Jul 2011)
Log Message:
-----------
[Ref] Some clean up to get build done with less warnings.
Modified Paths:
--------------
trunk/OpenMPT/mptrack/Ctrl_gen.cpp
trunk/OpenMPT/mptrack/Mainbar.cpp
trunk/OpenMPT/mptrack/Moddoc.cpp
trunk/OpenMPT/mptrack/Moddoc.h
trunk/OpenMPT/mptrack/PatternEditorDialogs.cpp
trunk/OpenMPT/mptrack/PatternEditorDialogs.h
trunk/OpenMPT/mptrack/TuningDialog.cpp
trunk/OpenMPT/mptrack/View_pat.h
trunk/OpenMPT/mptrack/Vstplug.cpp
trunk/OpenMPT/mptrack/Vstplug.h
trunk/OpenMPT/mptrack/dlg_misc.cpp
trunk/OpenMPT/mptrack/dlg_misc.h
trunk/OpenMPT/soundlib/Load_itp.cpp
Modified: trunk/OpenMPT/mptrack/Ctrl_gen.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Ctrl_gen.cpp 2011-07-29 20:49:03 UTC (rev 938)
+++ trunk/OpenMPT/mptrack/Ctrl_gen.cpp 2011-07-29 20:54:38 UTC (rev 939)
@@ -281,7 +281,7 @@
if (pSlider==&m_SliderTempo) {
int min, max;
m_SpinTempo.GetRange(min, max);
- int tempo = max - m_SliderTempo.GetPos();
+ const UINT tempo = max - m_SliderTempo.GetPos();
if ((tempo >= m_pSndFile->GetModSpecifications().tempoMin) && (tempo <= m_pSndFile->GetModSpecifications().tempoMax) && (tempo != m_pSndFile->m_nDefaultTempo)) {
m_pSndFile->m_nDefaultTempo = tempo;
m_pSndFile->m_nMusicTempo = tempo;
@@ -292,7 +292,7 @@
}
else if (pSlider==&m_SliderGlobalVol) {
- int gv = MAX_SLIDER_GLOBAL_VOL - m_SliderGlobalVol.GetPos();
+ const UINT gv = MAX_SLIDER_GLOBAL_VOL - m_SliderGlobalVol.GetPos();
if ((gv >= 0) && (gv <= MAX_SLIDER_GLOBAL_VOL) && (gv != m_pSndFile->m_nDefaultGlobalVolume)) {
m_pSndFile->m_nGlobalVolume = gv;
m_pSndFile->m_nDefaultGlobalVolume = gv;
@@ -303,7 +303,7 @@
}
else if (pSlider==&m_SliderSamplePreAmp) {
- int spa = MAX_SLIDER_SAMPLE_VOL - m_SliderSamplePreAmp.GetPos();
+ const UINT spa = MAX_SLIDER_SAMPLE_VOL - m_SliderSamplePreAmp.GetPos();
if ((spa >= 0) && (spa <= MAX_SLIDER_SAMPLE_VOL) && (spa != m_pSndFile->m_nSamplePreAmp)) {
m_pSndFile->m_nSamplePreAmp = spa;
if(m_pSndFile->GetType() != MOD_TYPE_MOD)
@@ -313,7 +313,7 @@
}
else if (pSlider==&m_SliderVSTiVol) {
- int vv = MAX_SLIDER_VSTI_VOL - m_SliderVSTiVol.GetPos();
+ const UINT vv = MAX_SLIDER_VSTI_VOL - m_SliderVSTiVol.GetPos();
if ((vv >= 0) && (vv <= MAX_SLIDER_VSTI_VOL) && (vv != m_pSndFile->m_nVSTiVolume)) {
m_pSndFile->m_nVSTiVolume = vv;
m_pSndFile->RecalculateGainForAllPlugs();
@@ -402,7 +402,7 @@
if ((m_pSndFile) && (m_pModDoc) && (m_bInitialized)) {
m_EditVSTiVol.GetWindowText(s, sizeof(s));
if (s[0]) {
- int n = atoi(s);
+ UINT n = ConvertStrTo<UINT>(s);
n = CLAMP(n, 0, 2000);
if (n != m_pSndFile->m_nVSTiVolume) {
m_bEditsLocked=true;
@@ -424,7 +424,7 @@
if ((m_pSndFile) && (m_pModDoc) && (m_bInitialized)) {
m_EditSamplePA.GetWindowText(s, sizeof(s));
if (s[0]) {
- int n = atoi(s);
+ UINT n = ConvertStrTo<UINT>(s);
n = CLAMP(n, 0, 2000);
if (n != m_pSndFile->m_nSamplePreAmp) {
m_bEditsLocked=true;
Modified: trunk/OpenMPT/mptrack/Mainbar.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Mainbar.cpp 2011-07-29 20:49:03 UTC (rev 938)
+++ trunk/OpenMPT/mptrack/Mainbar.cpp 2011-07-29 20:54:38 UTC (rev 939)
@@ -506,10 +506,10 @@
{
if (n < 0)
{
- pSndFile->m_nMusicSpeed = max(nCurrentSpeed - 1, pSndFile->GetModSpecifications().speedMin);
+ pSndFile->m_nMusicSpeed = Util::Max(UINT(nCurrentSpeed - 1), pSndFile->GetModSpecifications().speedMin);
} else
{
- pSndFile->m_nMusicSpeed = min(nCurrentSpeed + 1, pSndFile->GetModSpecifications().speedMax);
+ pSndFile->m_nMusicSpeed = Util::Min(UINT(nCurrentSpeed + 1), pSndFile->GetModSpecifications().speedMax);
}
m_SpinSpeed.SetPos(0);
}
@@ -523,7 +523,7 @@
}
} else
{
- if (nCurrentRowsPerBeat < pSndFile->m_nCurrentRowsPerMeasure)
+ if (static_cast<ROWINDEX>(nCurrentRowsPerBeat) < pSndFile->m_nCurrentRowsPerMeasure)
{
SetRowsPerBeat(nCurrentRowsPerBeat + 1);
}
Modified: trunk/OpenMPT/mptrack/Moddoc.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Moddoc.cpp 2011-07-29 20:49:03 UTC (rev 938)
+++ trunk/OpenMPT/mptrack/Moddoc.cpp 2011-07-29 20:54:38 UTC (rev 939)
@@ -2173,7 +2173,7 @@
typedef struct MPTEFFECTINFO
{
- DWORD dwEffect; // CMD_XXXX
+ MODCOMMAND::COMMAND dwEffect; // CMD_XXXX
DWORD dwParamMask; // 0 = default
DWORD dwParamValue; // 0 = default
DWORD dwFlags; // FXINFO_XXXX
@@ -2288,7 +2288,7 @@
}
-bool CModDoc::GetEffectName(LPSTR pszDescription, UINT command, UINT param, bool bXX, CHANNELINDEX nChn) //rewbs.xinfo: added chan arg
+bool CModDoc::GetEffectName(LPSTR pszDescription, MODCOMMAND::COMMAND command, UINT param, bool bXX, CHANNELINDEX nChn) //rewbs.xinfo: added chan arg
//------------------------------------------------------------------------------------------------------
{
bool bSupported;
@@ -2413,13 +2413,13 @@
//Returns command and corrects parameter refParam if necessary
-UINT CModDoc::GetEffectFromIndex(UINT ndx, int &refParam)
-//-------------------------------------------------------
+MODCOMMAND::COMMAND CModDoc::GetEffectFromIndex(UINT ndx, int &refParam)
+//----------------------------------------------------------------------
{
//if (pParam) *pParam = -1;
if (ndx >= MAX_FXINFO) {
refParam = 0;
- return 0;
+ return CMD_NONE;
}
//Cap parameter to match FX if necessary.
@@ -2440,11 +2440,11 @@
}
-UINT CModDoc::GetEffectFromIndex(UINT ndx)
-//----------------------------------------
+MODCOMMAND::COMMAND CModDoc::GetEffectFromIndex(UINT ndx)
+//-------------------------------------------------------
{
if (ndx >= MAX_FXINFO) {
- return 0;
+ return CMD_NONE;
}
return gFXInfo[ndx].dwEffect;
@@ -3059,7 +3059,7 @@
typedef struct MPTVOLCMDINFO
{
- DWORD dwVolCmd; // VOLCMD_XXXX
+ MODCOMMAND::VOLCMD dwVolCmd; // VOLCMD_XXXX
DWORD dwFormats; // MOD_TYPE_XXX combo
LPCSTR pszName; // ie "Set Volume"
} MPTVOLCMDINFO;
@@ -3105,8 +3105,8 @@
}
-UINT CModDoc::GetVolCmdFromIndex(UINT ndx)
-//----------------------------------------
+MODCOMMAND::VOLCMD CModDoc::GetVolCmdFromIndex(UINT ndx)
+//------------------------------------------------------
{
return (ndx < MAX_VOLINFO) ? gVolCmdInfo[ndx].dwVolCmd : 0;
}
Modified: trunk/OpenMPT/mptrack/Moddoc.h
===================================================================
--- trunk/OpenMPT/mptrack/Moddoc.h 2011-07-29 20:49:03 UTC (rev 938)
+++ trunk/OpenMPT/mptrack/Moddoc.h 2011-07-29 20:54:38 UTC (rev 939)
@@ -237,12 +237,12 @@
void ActivateWindow();
// Effects Description
- bool GetEffectName(LPSTR pszDescription, UINT command, UINT param, bool bXX = false, CHANNELINDEX nChn = CHANNELINDEX_INVALID); // bXX: Nxx: ...
+ bool GetEffectName(LPSTR pszDescription, MODCOMMAND::COMMAND command, UINT param, bool bXX = false, CHANNELINDEX nChn = CHANNELINDEX_INVALID); // bXX: Nxx: ...
UINT GetNumEffects() const;
bool GetEffectInfo(UINT ndx, LPSTR s, bool bXX = false, DWORD *prangeMin=NULL, DWORD *prangeMax=NULL);
LONG GetIndexFromEffect(UINT command, UINT param);
- UINT GetEffectFromIndex(UINT ndx, int &refParam);
- UINT GetEffectFromIndex(UINT ndx);
+ MODCOMMAND::COMMAND GetEffectFromIndex(UINT ndx, int &refParam);
+ MODCOMMAND::COMMAND GetEffectFromIndex(UINT ndx);
UINT GetEffectMaskFromIndex(UINT ndx);
bool GetEffectNameEx(LPSTR pszName, UINT ndx, UINT param);
BOOL IsExtendedEffect(UINT ndx) const;
@@ -251,7 +251,7 @@
// Volume column effects description
UINT GetNumVolCmds() const;
LONG GetIndexFromVolCmd(UINT volcmd);
- UINT GetVolCmdFromIndex(UINT ndx);
+ MODCOMMAND::VOLCMD GetVolCmdFromIndex(UINT ndx);
BOOL GetVolCmdInfo(UINT ndx, LPSTR s, DWORD *prangeMin=NULL, DWORD *prangeMax=NULL);
// Various MIDI Macro helpers
Modified: trunk/OpenMPT/mptrack/PatternEditorDialogs.cpp
===================================================================
--- trunk/OpenMPT/mptrack/PatternEditorDialogs.cpp 2011-07-29 20:49:03 UTC (rev 938)
+++ trunk/OpenMPT/mptrack/PatternEditorDialogs.cpp 2011-07-29 20:54:38 UTC (rev 939)
@@ -13,6 +13,7 @@
#include "mptrack.h"
#include "Mainfrm.h"
#include "PatternEditorDialogs.h"
+#include "view_pat.h"
// -> CODE#0010
@@ -426,8 +427,8 @@
// Min/Max channels
if (!m_bReplace)
{
- m_nMinChannel = GetDlgItemInt(IDC_EDIT1) - 1;
- m_nMaxChannel = GetDlgItemInt(IDC_EDIT2) - 1;
+ m_nMinChannel = static_cast<CHANNELINDEX>(GetDlgItemInt(IDC_EDIT1) - 1);
+ m_nMaxChannel = static_cast<CHANNELINDEX>(GetDlgItemInt(IDC_EDIT2) - 1);
if (m_nMaxChannel < m_nMinChannel)
{
std::swap(m_nMinChannel, m_nMaxChannel);
@@ -653,13 +654,13 @@
}
-BOOL CEditCommand::ShowEditWindow(UINT nPat, DWORD dwCursor)
+BOOL CEditCommand::ShowEditWindow(PATTERNINDEX nPat, DWORD dwCursor)
//----------------------------------------------------------
{
CHAR s[64];
CSoundFile *pSndFile = m_pModDoc->GetSoundFile();
- UINT nRow = dwCursor >> 16;
- UINT nChannel = (dwCursor & 0xFFFF) >> 3;
+ const ROWINDEX nRow = CViewPattern::GetRowFromCursor(dwCursor);
+ const CHANNELINDEX nChannel = CViewPattern::GetChanFromCursor(dwCursor);
if ((nPat >= pSndFile->Patterns.Size()) || (!m_pModDoc)
|| (nRow >= pSndFile->Patterns[nPat].GetNumRows()) || (nChannel >= pSndFile->m_nChannels)
@@ -702,8 +703,8 @@
}
-void CEditCommand::UpdateNote(UINT note, UINT instr)
-//--------------------------------------------------
+void CEditCommand::UpdateNote(MODCOMMAND::NOTE note, MODCOMMAND::INSTR instr)
+//---------------------------------------------------------------------------
{
CSoundFile *pSndFile = m_pModDoc->GetSoundFile();
if ((m_nPattern >= pSndFile->Patterns.Size()) || (!m_pModDoc)
@@ -731,8 +732,8 @@
}
-void CEditCommand::UpdateVolume(UINT volcmd, UINT vol)
-//----------------------------------------------------
+void CEditCommand::UpdateVolume(MODCOMMAND::VOLCMD volcmd, MODCOMMAND::VOL vol)
+//-----------------------------------------------------------------------------
{
CSoundFile *pSndFile = m_pModDoc->GetSoundFile();
if ((m_nPattern >= pSndFile->Patterns.Size()) || (!m_pModDoc)
@@ -759,8 +760,8 @@
}
-void CEditCommand::UpdateEffect(UINT command, UINT param)
-//-------------------------------------------------------
+void CEditCommand::UpdateEffect(MODCOMMAND::COMMAND command, MODCOMMAND::PARAM param)
+//-----------------------------------------------------------------------------------
{
CSoundFile *pSndFile = m_pModDoc->GetSoundFile();
if ((m_nPattern >= pSndFile->Patterns.Size()) || (!m_pModDoc)
@@ -908,16 +909,16 @@
if ((combo = (CComboBox *)GetDlgItem(IDC_COMBO1)) != NULL)
{
int n = combo->GetCurSel();
- if (n >= 0) m_nNote = combo->GetItemData(n);
+ if (n >= 0) m_nNote = static_cast<MODCOMMAND::NOTE>(combo->GetItemData(n));
}
if ((combo = (CComboBox *)GetDlgItem(IDC_COMBO2)) != NULL)
{
int n = combo->GetCurSel();
if(n >= 0)
{
- const UINT oldInstr = m_nInstr;
+ const MODCOMMAND::INSTR oldInstr = m_nInstr;
CSoundFile* pSndFile = m_pModDoc->GetSoundFile();
- m_nInstr = combo->GetItemData(n);
+ m_nInstr = static_cast<MODCOMMAND::INSTR>(combo->GetItemData(n));
//Checking whether note names should be recreated.
if(!MODCOMMAND::IsPcNote(m_nNote) && pSndFile && pSndFile->Instruments[m_nInstr] && pSndFile->Instruments[oldInstr])
{
@@ -1020,7 +1021,7 @@
int n = combo->GetCurSel();
if (n >= 0)
{
- UINT volcmd = m_pModDoc->GetVolCmdFromIndex(combo->GetItemData(n));
+ MODCOMMAND::VOLCMD volcmd = m_pModDoc->GetVolCmdFromIndex(combo->GetItemData(n));
if (volcmd != m_nVolCmd)
{
m_nVolCmd = volcmd;
@@ -1030,7 +1031,7 @@
}
if ((slider = (CSliderCtrl *)GetDlgItem(IDC_SLIDER1)) != NULL)
{
- m_nVolume = slider->GetPos();
+ m_nVolume = static_cast<MODCOMMAND::VOL>(slider->GetPos());
}
if (m_pParent) m_pParent->UpdateVolume(m_nVolCmd, m_nVolume);
}
@@ -1151,7 +1152,7 @@
{
int param = -1, ndx = combo->GetItemData(n);
m_nCommand = (ndx >= 0) ? m_pModDoc->GetEffectFromIndex(ndx, param) : 0;
- if (param >= 0) m_nParam = param;
+ if (param >= 0) m_nParam = static_cast<MODCOMMAND::PARAM>(param);
bSet = TRUE;
}
UpdateRange(bSet);
@@ -1173,7 +1174,7 @@
UINT param = m_pModDoc->MapPosToValue(fxndx, pos);
if (param != m_nParam)
{
- m_nParam = param;
+ m_nParam = static_cast<MODCOMMAND::PARAM>(param);
UpdateValue(TRUE);
}
}
@@ -1268,7 +1269,7 @@
if ((cnote < 3) || (i == (UINT)nKey))
{
UINT k = (cnote < 3) ? cnote : 2;
- pChords[chord].notes[k] = i+1;
+ pChords[chord].notes[k] = static_cast<BYTE>(i+1);
if (cnote < 3) cnote++;
}
}
@@ -1498,11 +1499,11 @@
{
CDialog::OnOK();
- m_pOptions->splitNote = m_CbnSplitNote.GetCurSel();
+ m_pOptions->splitNote = static_cast<MODCOMMAND::NOTE>(m_CbnSplitNote.GetCurSel());
m_pOptions->octaveModifier = m_CbnOctaveModifier.GetCurSel() - SPLIT_OCTAVE_RANGE;
m_pOptions->octaveLink = (IsDlgButtonChecked(IDC_PATTERN_OCTAVELINK) == TRUE) ? true : false;
- m_pOptions->splitVolume = m_CbnSplitVolume.GetCurSel();
- m_pOptions->splitInstrument = m_CbnSplitInstrument.GetItemData(m_CbnSplitInstrument.GetCurSel());
+ m_pOptions->splitVolume = static_cast<MODCOMMAND::VOL>(m_CbnSplitVolume.GetCurSel());
+ m_pOptions->splitInstrument = static_cast<MODCOMMAND::INSTR>(m_CbnSplitInstrument.GetItemData(m_CbnSplitInstrument.GetCurSel()));
}
Modified: trunk/OpenMPT/mptrack/PatternEditorDialogs.h
===================================================================
--- trunk/OpenMPT/mptrack/PatternEditorDialogs.h 2011-07-29 20:49:03 UTC (rev 938)
+++ trunk/OpenMPT/mptrack/PatternEditorDialogs.h 2011-07-29 20:54:38 UTC (rev 939)
@@ -149,7 +149,8 @@
//==========================================
{
protected:
- UINT m_nNote, m_nInstr;
+ MODCOMMAND::NOTE m_nNote;
+ MODCOMMAND::INSTR m_nInstr;
public:
CPageEditNote(CModDoc *pModDoc, CEditCommand *parent):CPageEditCommand(pModDoc, parent, IDD_PAGEEDITNOTE) {}
@@ -170,7 +171,8 @@
//============================================
{
protected:
- UINT m_nVolCmd, m_nVolume;
+ MODCOMMAND::VOLCMD m_nVolCmd;
+ MODCOMMAND::VOL m_nVolume;
bool m_bIsParamControl;
public:
@@ -193,7 +195,9 @@
//============================================
{
protected:
- UINT m_nCommand, m_nParam, m_nPlugin;
+ MODCOMMAND::COMMAND m_nCommand;
+ MODCOMMAND::PARAM m_nParam;
+ PLUGINDEX m_nPlugin;
UINT m_nPluginParam;
bool m_bIsParamControl;
// -> CODE#0010
@@ -234,7 +238,9 @@
CPageEditEffect *m_pageEffect;
CModDoc *m_pModDoc;
HWND m_hWndView;
- UINT m_nPattern, m_nRow, m_nChannel;
+ ROWINDEX m_nRow;
+ PATTERNINDEX m_nPattern;
+ CHANNELINDEX m_nChannel;
MODCOMMAND m_Command;
bool m_bModified;
@@ -243,14 +249,14 @@
public:
BOOL SetParent(CWnd *parent, CModDoc *pModDoc);
- BOOL ShowEditWindow(UINT nPat, DWORD dwCursor);
+ BOOL ShowEditWindow(PATTERNINDEX nPat, DWORD dwCursor);
// -> CODE#0010
// -> DESC="add extended parameter mechanism to pattern effects"
void OnSelListChange();
// -! NEW_FEATURE#0010
- void UpdateNote(UINT note, UINT instr);
- void UpdateVolume(UINT volcmd, UINT vol);
- void UpdateEffect(UINT command, UINT param);
+ void UpdateNote(MODCOMMAND::NOTE note, MODCOMMAND::INSTR instr);
+ void UpdateVolume(MODCOMMAND::VOLCMD volcmd, MODCOMMAND::VOL vol);
+ void UpdateEffect(MODCOMMAND::COMMAND command, MODCOMMAND::PARAM param);
protected:
//{{AFX_VIRTUAL(CEditCommand)
Modified: trunk/OpenMPT/mptrack/TuningDialog.cpp
===================================================================
--- trunk/OpenMPT/mptrack/TuningDialog.cpp 2011-07-29 20:49:03 UTC (rev 938)
+++ trunk/OpenMPT/mptrack/TuningDialog.cpp 2011-07-29 20:54:38 UTC (rev 939)
@@ -32,7 +32,7 @@
// CTuningDialog dialog
-
+#pragma warning(disable : 4355) // "'this' : used in base member initializer list"
IMPLEMENT_DYNAMIC(CTuningDialog, CDialog)
CTuningDialog::CTuningDialog(CWnd* pParent, const TUNINGVECTOR& rVec, CTuning* pTun)
: CDialog(CTuningDialog::IDD, pParent),
@@ -44,6 +44,7 @@
m_TreeItemTuningItemMap(s_notFoundItemTree, s_notFoundItemTuning),
m_TreeCtrlTuning(this),
m_DoErrorExit(false)
+#pragma warning(default : 4355) // "'this' : used in base member initializer list"
//----------------------------------------
{
m_pActiveTuning = pTun;
Modified: trunk/OpenMPT/mptrack/View_pat.h
===================================================================
--- trunk/OpenMPT/mptrack/View_pat.h 2011-07-29 20:49:03 UTC (rev 938)
+++ trunk/OpenMPT/mptrack/View_pat.h 2011-07-29 20:54:38 UTC (rev 939)
@@ -1,6 +1,8 @@
#ifndef _VIEW_PATTERNS_H_
#define _VIEW_PATTERNS_H_
+#include "globals.h"
+
class CModDoc;
class CEditCommand;
class CEffectVis; //rewbs.fxvis
@@ -342,8 +344,13 @@
public:
afx_msg void OnInitMenu(CMenu* pMenu);
+
+ static ROWINDEX GetRowFromCursor(DWORD cursor) { return (cursor >> 16); };
+ static CHANNELINDEX GetChanFromCursor(DWORD cursor) { return static_cast<CHANNELINDEX>((cursor & 0xFFFF) >> 3); };
+ static UINT GetColTypeFromCursor(DWORD cursor) { return (cursor & 0x07); };
+ static DWORD CreateCursor(ROWINDEX row, CHANNELINDEX channel = 0, UINT column = 0) { return (row << 16) | ((channel << 3) & 0x1FFF) | (column & 0x07); };
+
private:
-
void SetSplitKeyboardSettings();
bool HandleSplit(MODCOMMAND* p, int note);
bool BuildChannelControlCtxMenu(HMENU hMenu);
@@ -372,11 +379,6 @@
CHANNELINDEX GetSelectionEndChan();
UINT ListChansWhereColSelected(PatternColumns colType, CArray<UINT,UINT> &chans);
- static ROWINDEX GetRowFromCursor(DWORD cursor) { return (cursor >> 16); };
- static CHANNELINDEX GetChanFromCursor(DWORD cursor) { return static_cast<CHANNELINDEX>((cursor & 0xFFFF) >> 3); };
- static UINT GetColTypeFromCursor(DWORD cursor) { return (cursor & 0x07); };
- static DWORD CreateCursor(ROWINDEX row, CHANNELINDEX channel = 0, UINT column = 0) { return (row << 16) | ((channel << 3) & 0x1FFF) | (column & 0x07); };
-
bool IsInterpolationPossible(ROWINDEX startRow, ROWINDEX endRow, CHANNELINDEX chan, PatternColumns colType, CSoundFile* pSndFile);
void Interpolate(PatternColumns type);
Modified: trunk/OpenMPT/mptrack/Vstplug.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Vstplug.cpp 2011-07-29 20:49:03 UTC (rev 938)
+++ trunk/OpenMPT/mptrack/Vstplug.cpp 2011-07-29 20:54:38 UTC (rev 939)
@@ -286,7 +286,7 @@
if (!hLib && dw != ERROR_MOD_NOT_FOUND) // "File not found errors" are annoying.
{
TCHAR szBuf[256];
- wsprintf(szBuf, "Warning: encountered problem when loading plugin dll. Error %d: %s", dw, GetErrorMessage(dw));
+ wsprintf(szBuf, "Warning: encountered problem when loading plugin dll. Error %d: %s", dw, (LPCTSTR)GetErrorMessage(dw));
MessageBox(NULL, szBuf, "DEBUG: Error when loading plugin dll", MB_OK);
}
#endif //_DEBUG
@@ -406,11 +406,11 @@
#endif // VST_LOG
}
- try {
+ //try {
FreeLibrary(hLib);
- } catch (...) {
- CVstPluginManager::ReportPlugException("Exception in FreeLibrary(\"%s\")!\n", pszDllPath);
- }
+ //} catch (...) {
+ // CVstPluginManager::ReportPlugException("Exception in FreeLibrary(\"%s\")!\n", pszDllPath);
+ //}
return (bOk) ? m_pVstHead : NULL;
} else
@@ -1087,7 +1087,7 @@
{
// Plugin wants to load or save a file.
std::string extensions, workingDir;
- for(size_t i = 0; i < pFileSel->nbFileTypes; i++)
+ for(VstInt32 i = 0; i < pFileSel->nbFileTypes; i++)
{
VstFileType *pType = &(pFileSel->fileTypes[i]);
extensions += pType->name;
@@ -1230,7 +1230,7 @@
// Close file selector - delete allocated strings.
if(pFileSel->command == kVstMultipleFilesLoad && pFileSel->returnMultiplePaths != nullptr)
{
- for(size_t i = 0; i < pFileSel->nbReturnPath; i++)
+ for(VstInt32 i = 0; i < pFileSel->nbReturnPath; i++)
{
if(pFileSel->returnMultiplePaths[i] != nullptr)
{
@@ -1739,7 +1739,7 @@
m_nEditorX = m_nEditorY = -1;
m_pEvList = NULL;
m_pModDoc = NULL; //rewbs.plugDocAware
- m_nPreviousMidiChan = -1; //rewbs.VSTCompliance
+ m_nPreviousMidiChan = nInvalidMidiChan; //rewbs.VSTCompliance
m_pProcessFP = NULL;
// Insert ourselves in the beginning of the list
@@ -1766,7 +1766,7 @@
m_bPlugResumed = false;
m_bModified = false;
m_dwTimeAtStartOfProcess=0;
- m_nSampleRate = -1; //rewbs.VSTCompliance: gets set on Resume()
+ m_nSampleRate = nInvalidSampleRate; //rewbs.VSTCompliance: gets set on Resume()
memset(m_MidiCh, 0, sizeof(m_MidiCh));
for (int ch=0; ch<16; ch++) {
@@ -1860,7 +1860,7 @@
}
m_nSampleRate=CSoundFile::gdwMixingFreq;
- Dispatch(effSetSampleRate, 0, 0, NULL, CSoundFile::gdwMixingFreq);
+ Dispatch(effSetSampleRate, 0, 0, NULL, static_cast<float>(CSoundFile::gdwMixingFreq));
Dispatch(effSetBlockSize, 0, MIXBUFFERSIZE, NULL, 0.0f);
if (m_pEffect->numPrograms > 0) {
Dispatch(effSetProgram, 0, 0, NULL, 0);
@@ -1911,7 +1911,7 @@
m_pProcessFP = (m_pEffect->flags & effFlagsCanReplacing) ? m_pEffect->processReplacing : m_pEffect->process;
// issue samplerate again here, cos some plugs like it before the block size, other like it right at the end.
- Dispatch(effSetSampleRate, 0, 0, NULL, CSoundFile::gdwMixingFreq);
+ Dispatch(effSetSampleRate, 0, 0, NULL, static_cast<float>(CSoundFile::gdwMixingFreq));
}
@@ -2319,7 +2319,7 @@
void CVstPlugin::Resume()
//-----------------------
{
- long sampleRate = CSoundFile::gdwMixingFreq;
+ const DWORD sampleRate = CSoundFile::gdwMixingFreq;
try {
//reset some stuf
@@ -2329,7 +2329,7 @@
Dispatch(effMainsChanged, 0, 0, NULL, 0.0f); // calls plugin's suspend
if (sampleRate != m_nSampleRate) {
m_nSampleRate=sampleRate;
- Dispatch(effSetSampleRate, 0, 0, NULL, m_nSampleRate);
+ Dispatch(effSetSampleRate, 0, 0, NULL, static_cast<float>(m_nSampleRate));
}
Dispatch(effSetBlockSize, 0, MIXBUFFERSIZE, NULL, 0);
//start off some stuff
@@ -2389,7 +2389,7 @@
if (m_bIsInstrument && m_pSndFile) {
gain /= m_pSndFile->m_pConfig->getVSTiAttenuation();
- gain *= (m_pSndFile->m_nVSTiVolume / m_pSndFile->m_pConfig->getNormalVSTiVol());
+ gain = static_cast<float>(gain * (m_pSndFile->m_nVSTiVolume / m_pSndFile->m_pConfig->getNormalVSTiVol()));
}
m_fGain = gain;
}
@@ -2399,7 +2399,7 @@
//--------------------------------------
{
param = min(param, 127);
- m_pMixStruct->fDryRatio = 1.0-(static_cast<float>(param)/127.0f);
+ m_pMixStruct->fDryRatio = static_cast<float>(1.0-(static_cast<double>(param)/127.0));
}
/*
@@ -2870,8 +2870,8 @@
// pre: 0 <= value <= 16383
- BYTE byte1 = value >> 7; // get last 7 bytes only
- BYTE byte2 = value & 0x7F; // get first 7 bytes only
+ BYTE byte1 = static_cast<BYTE>(value >> 7); // get last 7 bytes only
+ BYTE byte2 = static_cast<BYTE>(value & 0x7F); // get first 7 bytes only
short converted = byte1<<8 | byte2; // merge
return converted;
@@ -2884,9 +2884,9 @@
{
nMidiCh--; // move from 1-17 range to 0-16 range
- short increment = nParam * 0x2000/0xFF;
- short newPitchBendPos = m_nMidiPitchBendPos[nMidiCh] + increment;
- newPitchBendPos = max(MIDI_PitchBend_Min, min(MIDI_PitchBend_Max, newPitchBendPos)); // cap
+ const int16 increment = static_cast<int16>(nParam * 0x2000/0xFF);
+ int16 newPitchBendPos = m_nMidiPitchBendPos[nMidiCh] + increment;
+ Limit(newPitchBendPos, int16(MIDI_PitchBend_Min), int16(MIDI_PitchBend_Max));
MidiPitchBend(nMidiCh, newPitchBendPos);
}
@@ -4167,12 +4167,10 @@
{
int xl = (int)(pIn1[i] * _f2si);
int xr = (int)(pIn2[i] * _f2si);
- if (xl < -32768) xl = -32768;
- if (xl > 32767) xl = 32767;
- if (xr < -32768) xr = -32768;
- if (xr > 32767) xr = 32767;
- pOut[i*2] = xl;
- pOut[i*2+1] = xr;
+ Limit(xl, int16_min, int16_max);
+ Limit(xr, int16_min, int16_max);
+ pOut[i*2] = static_cast<int16>(xl);
+ pOut[i*2+1] = static_cast<int16>(xr);
}
}
Modified: trunk/OpenMPT/mptrack/Vstplug.h
===================================================================
--- trunk/OpenMPT/mptrack/Vstplug.h 2011-07-29 20:49:03 UTC (rev 938)
+++ trunk/OpenMPT/mptrack/Vstplug.h 2011-07-29 20:54:38 UTC (rev 939)
@@ -70,6 +70,7 @@
AEffect *m_pEffect;
void (*m_pProcessFP)(AEffect*, float**, float**, VstInt32); //Function pointer to AEffect processReplacing if supported, else process.
CAbstractVstEditor *m_pEditor; //rewbs.defaultPlugGUI
+ static const UINT nInvalidSampleRate = UINT_MAX;
UINT m_nSampleRate;
bool m_bIsVst2;
SNDMIXPLUGINSTATE m_MixState;
@@ -87,6 +88,7 @@
CModDoc* m_pModDoc; //rewbs.plugDocAware
CSoundFile* m_pSndFile; //rewbs.plugDocAware
// PSNDMIXPLUGIN m_pSndMixPlugin; //rewbs.plugDocAware
+ static const UINT nInvalidMidiChan = UINT_MAX;
UINT m_nPreviousMidiChan; //rewbs.VSTCompliance
bool m_bSongPlaying; //rewbs.VSTCompliance
bool m_bPlugResumed; //rewbs.VSTCompliance
Modified: trunk/OpenMPT/mptrack/dlg_misc.cpp
===================================================================
--- trunk/OpenMPT/mptrack/dlg_misc.cpp 2011-07-29 20:49:03 UTC (rev 938)
+++ trunk/OpenMPT/mptrack/dlg_misc.cpp 2011-07-29 20:54:38 UTC (rev 939)
@@ -384,7 +384,7 @@
sel = m_ChannelsBox.GetCurSel();
if (sel >= 0)
{
- m_nChannels = m_ChannelsBox.GetItemData(sel);
+ m_nChannels = static_cast<CHANNELINDEX>(m_ChannelsBox.GetItemData(sel));
//if (m_nType & MOD_TYPE_XM) m_nChannels = (m_nChannels+1) & 0xFE;
}
Modified: trunk/OpenMPT/mptrack/dlg_misc.h
===================================================================
--- trunk/OpenMPT/mptrack/dlg_misc.h 2011-07-29 20:49:03 UTC (rev 938)
+++ trunk/OpenMPT/mptrack/dlg_misc.h 2011-07-29 20:54:38 UTC (rev 939)
@@ -13,7 +13,7 @@
CComboBox m_TypeBox, m_ChannelsBox, m_TempoModeBox, m_PlugMixBox;
CButton m_CheckBox1, m_CheckBox2, m_CheckBox3, m_CheckBox4, m_CheckBox5, m_CheckBoxPT1x;
CSoundFile *m_pSndFile;
- UINT m_nChannels;
+ CHANNELINDEX m_nChannels;
MODTYPE m_nType;
DWORD m_dwSongFlags;
Modified: trunk/OpenMPT/soundlib/Load_itp.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Load_itp.cpp 2011-07-29 20:49:03 UTC (rev 938)
+++ trunk/OpenMPT/soundlib/Load_itp.cpp 2011-07-29 20:54:38 UTC (rev 939)
@@ -231,7 +231,7 @@
// m_nPatternNames
memcpy(&id,lpStream+dwMemPos,sizeof(DWORD));
- const PATTERNINDEX numNamedPats = id;
+ const PATTERNINDEX numNamedPats = static_cast<PATTERNINDEX>(id);
dwMemPos += sizeof(DWORD);
// pattern name string length (=MAX_PATTERNNAME)
@@ -583,7 +583,7 @@
fwrite(&id, 1, sizeof(id), f);
// order array
- Order.WriteAsByte(f, id);
+ Order.WriteAsByte(f, static_cast<uint16>(id));
// Song Patterns
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rel...@us...> - 2011-07-29 20:49:11
|
Revision: 938
http://modplug.svn.sourceforge.net/modplug/?rev=938&view=rev
Author: relabsoluness
Date: 2011-07-29 20:49:03 +0000 (Fri, 29 Jul 2011)
Log Message:
-----------
[Fix] MIDI: OpenMPT-made MIDI files might not open in MIDI players due to incorrect endian swap in a data field.
[Fix] VST: VST host version fields didn't follow the actual version of OpenMPT (no behaviour changes expected).
Modified Paths:
--------------
trunk/OpenMPT/mptrack/Mptrack.cpp
trunk/OpenMPT/mptrack/mod2midi.cpp
trunk/OpenMPT/mptrack/mod2midi.h
Modified: trunk/OpenMPT/mptrack/Mptrack.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Mptrack.cpp 2011-07-29 12:25:18 UTC (rev 937)
+++ trunk/OpenMPT/mptrack/Mptrack.cpp 2011-07-29 20:49:03 UTC (rev 938)
@@ -2817,9 +2817,24 @@
#ifndef NO_VST
char buffer[64];
- GetPrivateProfileString("VST Plugins", "HostProductString", CVstPluginManager::s_szHostProductString, buffer, ARRAYELEMCOUNT(buffer), m_szConfigFileName);
+ GetPrivateProfileString("VST Plugins", "HostProductString", CVstPluginManager::s_szHostProductString, buffer, CountOf(buffer), m_szConfigFileName);
+
+ // Version <= 1.19.03.00 had buggy handling of custom host information. If last open was from
+ // such OpenMPT version, clear the related settings to get a clean start.
+ const CString sPreviousVer = CMainFrame::GetSettings().gcsPreviousVersion;
+ if (!sPreviousVer.IsEmpty() &&
+ MptVersion::ToNum(sPreviousVer) < MAKE_VERSION_NUMERIC(1, 19, 03, 01) &&
+ strcmp(buffer, "OpenMPT") == 0)
+ {
+ // Remove keys by calling write with nullptr.
+ WritePrivateProfileString(_T("VST Plugins"), _T("HostProductString"), nullptr, m_szConfigFileName);
+ WritePrivateProfileString(_T("VST Plugins"), _T("HostVendorString"), nullptr, m_szConfigFileName);
+ WritePrivateProfileString(_T("VST Plugins"), _T("HostVendorVersion"), nullptr, m_szConfigFileName);
+ }
+
+ GetPrivateProfileString("VST Plugins", "HostProductString", CVstPluginManager::s_szHostProductString, buffer, CountOf(buffer), m_szConfigFileName);
strcpy(CVstPluginManager::s_szHostProductString, buffer);
- GetPrivateProfileString("VST Plugins", "HostVendorString", CVstPluginManager::s_szHostVendorString, buffer, ARRAYELEMCOUNT(buffer), m_szConfigFileName);
+ GetPrivateProfileString("VST Plugins", "HostVendorString", CVstPluginManager::s_szHostVendorString, buffer, CountOf(buffer), m_szConfigFileName);
strcpy(CVstPluginManager::s_szHostVendorString, buffer);
CVstPluginManager::s_nHostVendorVersion = GetPrivateProfileInt("VST Plugins", "HostVendorVersion", CVstPluginManager::s_nHostVendorVersion, m_szConfigFileName);
#endif
@@ -2876,9 +2891,9 @@
WritePrivateProfileString("VST Plugins", "NumPlugins", s, m_szConfigFileName);
#ifndef NO_VST
- WritePrivateProfileString("VST Plugins", "HostProductString", CVstPluginManager::s_szHostProductString, m_szConfigFileName);
- WritePrivateProfileString("VST Plugins", "HostVendorString", CVstPluginManager::s_szHostVendorString, m_szConfigFileName);
- CMainFrame::WritePrivateProfileLong("VST Plugins", "HostVendorVersion", CVstPluginManager::s_nHostVendorVersion, m_szConfigFileName);
+ //WritePrivateProfileString("VST Plugins", "HostProductString", CVstPluginManager::s_szHostProductString, m_szConfigFileName);
+ //WritePrivateProfileString("VST Plugins", "HostVendorString", CVstPluginManager::s_szHostVendorString, m_szConfigFileName);
+ //CMainFrame::WritePrivateProfileLong("VST Plugins", "HostVendorVersion", CVstPluginManager::s_nHostVendorVersion, m_szConfigFileName);
#endif
Modified: trunk/OpenMPT/mptrack/mod2midi.cpp
===================================================================
--- trunk/OpenMPT/mptrack/mod2midi.cpp 2011-07-29 12:25:18 UTC (rev 937)
+++ trunk/OpenMPT/mptrack/mod2midi.cpp 2011-07-29 20:49:03 UTC (rev 938)
@@ -315,7 +315,7 @@
if (nProgram > 127) return;
if ((m_nCurrInstr > 0) && (m_nCurrInstr < MAX_SAMPLES))
{
- m_InstrMap[m_nCurrInstr].nProgram = nProgram;
+ m_InstrMap[m_nCurrInstr].nProgram = static_cast<uint8>(nProgram);
}
}
@@ -347,7 +347,7 @@
UINT nMidiChCurPrg[16];
BYTE tmp[256];
CHAR s[256];
- UINT nPPQN, nTickMultiplier, nClock, nOrder, nRow;
+ UINT nTickMultiplier, nClock, nOrder, nRow;
UINT nSpeed;
CFile f;
@@ -362,7 +362,7 @@
memset(Tracks, 0, sizeof(Tracks));
if (!m_pSndFile->m_nDefaultTempo) m_pSndFile->m_nDefaultTempo = 125;
nTickMultiplier = MOD2MIDI_TEMPOFACTOR;
- nPPQN = (m_pSndFile->m_nDefaultTempo*nTickMultiplier) / 5;
+ const uint16 wPPQN = static_cast<uint16>((m_pSndFile->m_nDefaultTempo*nTickMultiplier) / 5);
rmid.id_RIFF = IFFID_RIFF;
rmid.filelen = sizeof(rmid)+sizeof(mthd)-8;
rmid.id_RMID = 0x44494D52; // "RMID"
@@ -371,9 +371,9 @@
mthd.id = 0x6468544d; // "MThd"
mthd.len = BigEndian(sizeof(mthd)-8);
mthd.wFmt = BigEndianW(1);
- mthd.wTrks = chnCount; // 1 track/channel
+ mthd.wTrks = static_cast<uint16>(chnCount); // 1 track/channel
mthd.wTrks = BigEndianW(mthd.wTrks); //Convert to big endian value.
- mthd.wDivision = BigEndianW(nPPQN);
+ mthd.wDivision = BigEndianW(wPPQN);
if (m_bRmi) f.Write(&rmid, sizeof(rmid));
f.Write(&mthd, sizeof(mthd));
@@ -431,10 +431,12 @@
nRow = 0;
continue;
}
+ PatternRow patternRow = m_pSndFile->Patterns[nPat].GetRow(nRow);
for (UINT nChn=0; nChn<chnCount; nChn++)
{
PDYNMIDITRACK pTrk = &Tracks[nChn];
- MODCOMMAND *m = m_pSndFile->Patterns[nPat].GetpModCommand(nRow, nChn);
+ //MODCOMMAND *m = m_pSndFile->Patterns[nPat].GetpModCommand(nRow, nChn);
+ const MODCOMMAND *m = &patternRow[nChn];
UINT delta_time = nClock - pTrk->nLastEventClock;
UINT len = 0;
@@ -454,8 +456,8 @@
pTrk->nInstrument = nIns;
if ((nMidiCh != 9) && (nProgram != nMidiChCurPrg[nMidiCh]))
{
- tmp[len] = 0xC0|nMidiCh;
- tmp[len+1] = nProgram;
+ tmp[len] = static_cast<BYTE>(0xC0|nMidiCh);
+ tmp[len+1] = static_cast<BYTE>(nProgram);
tmp[len+2] = 0;
len += 3;
}
@@ -469,7 +471,7 @@
if (pTrk->NoteOn[i])
{
tmp[len] = 0x90|(pTrk->NoteOn[i]-1);
- tmp[len+1] = i;
+ tmp[len+1] = static_cast<BYTE>(i);
tmp[len+2] = 0;
tmp[len+3] = 0;
len += 4;
@@ -478,9 +480,9 @@
}
if (m->note <= NOTE_MAX)
{
- pTrk->NoteOn[note] = pTrk->nMidiChannel+1;
- tmp[len] = 0x90|pTrk->nMidiChannel;
- tmp[len+1] = (pTrk->nMidiChannel==9) ? pTrk->nMidiProgram : note;
+ pTrk->NoteOn[note] = static_cast<BYTE>(pTrk->nMidiChannel+1);
+ tmp[len] = static_cast<BYTE>(0x90|pTrk->nMidiChannel);
+ tmp[len+1] = (pTrk->nMidiChannel==9) ? static_cast<BYTE>(pTrk->nMidiProgram) : static_cast<BYTE>(note);
UINT vol = 0x7f;
UINT nsmp = pTrk->nInstrument;
if (m_pSndFile->m_nInstruments)
Modified: trunk/OpenMPT/mptrack/mod2midi.h
===================================================================
--- trunk/OpenMPT/mptrack/mod2midi.h 2011-07-29 12:25:18 UTC (rev 937)
+++ trunk/OpenMPT/mptrack/mod2midi.h 2011-07-29 20:49:03 UTC (rev 938)
@@ -4,7 +4,7 @@
typedef struct _MOD2MIDIINSTR
{
UINT nChannel;
- UINT nProgram;
+ uint8 nProgram;
} MOD2MIDIINSTR, *PMOD2MIDIINSTR;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sag...@us...> - 2011-07-29 12:25:24
|
Revision: 937
http://modplug.svn.sourceforge.net/modplug/?rev=937&view=rev
Author: saga-games
Date: 2011-07-29 12:25:18 +0000 (Fri, 29 Jul 2011)
Log Message:
-----------
[Fix] Default mod type thingy should now really work.
Modified Paths:
--------------
trunk/OpenMPT/mptrack/Mptrack.cpp
Modified: trunk/OpenMPT/mptrack/Mptrack.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Mptrack.cpp 2011-07-28 22:08:33 UTC (rev 936)
+++ trunk/OpenMPT/mptrack/Mptrack.cpp 2011-07-29 12:25:18 UTC (rev 937)
@@ -1019,7 +1019,7 @@
if (!m_bInitialized) return;
// Default module type
- MODTYPE nNewType = MOD_TYPE_IT;
+ MODTYPE nNewType = CMainFrame::GetSettings().defaultModType;
bool bIsProject = false;
// Get active document to make the new module of the same type
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sag...@us...> - 2011-07-28 22:08:39
|
Revision: 936
http://modplug.svn.sourceforge.net/modplug/?rev=936&view=rev
Author: saga-games
Date: 2011-07-28 22:08:33 +0000 (Thu, 28 Jul 2011)
Log Message:
-----------
That last commit wasn't quite correct...
Modified Paths:
--------------
trunk/OpenMPT/mptrack/MainFrm.cpp
Modified: trunk/OpenMPT/mptrack/MainFrm.cpp
===================================================================
--- trunk/OpenMPT/mptrack/MainFrm.cpp 2011-07-28 22:07:15 UTC (rev 935)
+++ trunk/OpenMPT/mptrack/MainFrm.cpp 2011-07-28 22:08:33 UTC (rev 936)
@@ -2189,7 +2189,7 @@
pModDoc->ClearFilePath(); // Clear path so that saving will not take place in templates/examples folder.
if (bTemplateFile)
{
- pModDoc->GetFileHistory()->empty(); // Reset edit history for template files
+ pModDoc->GetFileHistory()->clear(); // Reset edit history for template files
pModDoc->GetSoundFile()->m_dwCreatedWithVersion = MptVersion::num;
pModDoc->GetSoundFile()->m_dwLastSavedWithVersion = 0;
theApp.RemoveMruItem(0);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sag...@us...> - 2011-07-28 22:07:21
|
Revision: 935
http://modplug.svn.sourceforge.net/modplug/?rev=935&view=rev
Author: saga-games
Date: 2011-07-28 22:07:15 +0000 (Thu, 28 Jul 2011)
Log Message:
-----------
[Imp] Templates: Edit history / Made with versions are now reset when loading a template.
[New] Default mod type can now be set in mptrack.ini by setting DefaultModType in the [Misc] section (f.e. "DefaultModType=mptm") - see http://forum.openmpt.org/index.php?topic=4411.0
[Fix] All numeric input fields in the instrument editor are now scrollable.
Modified Paths:
--------------
trunk/OpenMPT/mptrack/MainFrm.cpp
trunk/OpenMPT/mptrack/TrackerSettings.cpp
trunk/OpenMPT/mptrack/TrackerSettings.h
trunk/OpenMPT/mptrack/mptrack.rc
Modified: trunk/OpenMPT/mptrack/MainFrm.cpp
===================================================================
--- trunk/OpenMPT/mptrack/MainFrm.cpp 2011-07-28 21:40:15 UTC (rev 934)
+++ trunk/OpenMPT/mptrack/MainFrm.cpp 2011-07-28 22:07:15 UTC (rev 935)
@@ -2169,6 +2169,7 @@
void CMainFrame::OpenMenuItemFile(const UINT nId, const bool bTemplateFile)
+//-------------------------------------------------------------------------
{
const UINT nIdBegin = (bTemplateFile) ? ID_FILE_OPENTEMPLATE : ID_EXAMPLE_MODULES;
const std::vector<CString>& vecFilePaths = (bTemplateFile) ? s_TemplateModulePaths : s_ExampleModulePaths;
@@ -2188,6 +2189,9 @@
pModDoc->ClearFilePath(); // Clear path so that saving will not take place in templates/examples folder.
if (bTemplateFile)
{
+ pModDoc->GetFileHistory()->empty(); // Reset edit history for template files
+ pModDoc->GetSoundFile()->m_dwCreatedWithVersion = MptVersion::num;
+ pModDoc->GetSoundFile()->m_dwLastSavedWithVersion = 0;
theApp.RemoveMruItem(0);
}
}
Modified: trunk/OpenMPT/mptrack/TrackerSettings.cpp
===================================================================
--- trunk/OpenMPT/mptrack/TrackerSettings.cpp 2011-07-28 21:40:15 UTC (rev 934)
+++ trunk/OpenMPT/mptrack/TrackerSettings.cpp 2011-07-28 22:07:15 UTC (rev 935)
@@ -165,6 +165,8 @@
}
}
+ defaultModType = MOD_TYPE_IT;
+
gnPlugWindowX = 243;
gnPlugWindowY = 273;
gnPlugWindowWidth = 370;
@@ -369,6 +371,8 @@
m_nSampleUndoMaxBuffer = CMainFrame::GetPrivateProfileLong("Sample Editor" , "UndoBufferSize", m_nSampleUndoMaxBuffer >> 20, iniFile);
m_nSampleUndoMaxBuffer = max(1, m_nSampleUndoMaxBuffer) << 20;
+
+ // Default Paths
TCHAR szPath[_MAX_PATH] = "";
for(size_t i = 0; i < NUM_DIRS; i++)
{
@@ -383,6 +387,8 @@
GetPrivateProfileString("Paths", "Key_Config_File", m_szKbdFile, m_szKbdFile, INIBUFFERSIZE, iniFile);
theApp.RelativePathToAbsolute(m_szKbdFile);
+
+ // Effects Settings
CSoundFile::m_nXBassDepth = CMainFrame::GetPrivateProfileLong("Effects", "XBassDepth", CSoundFile::m_nXBassDepth, iniFile);
CSoundFile::m_nXBassRange = CMainFrame::GetPrivateProfileLong("Effects", "XBassRange", CSoundFile::m_nXBassRange, iniFile);
CSoundFile::m_nReverbDepth = CMainFrame::GetPrivateProfileLong("Effects", "ReverbDepth", CSoundFile::m_nReverbDepth, iniFile);
@@ -390,6 +396,8 @@
CSoundFile::m_nProLogicDepth = CMainFrame::GetPrivateProfileLong("Effects", "ProLogicDepth", CSoundFile::m_nProLogicDepth, iniFile);
CSoundFile::m_nProLogicDelay = CMainFrame::GetPrivateProfileLong("Effects", "ProLogicDelay", CSoundFile::m_nProLogicDelay, iniFile);
+
+ // EQ Settings
GetPrivateProfileStruct("Effects", "EQ_Settings", &m_EqSettings, sizeof(EQPRESET), iniFile);
GetPrivateProfileStruct("Effects", "EQ_User1", &CEQSetupDlg::gUserPresets[0], sizeof(EQPRESET), iniFile);
GetPrivateProfileStruct("Effects", "EQ_User2", &CEQSetupDlg::gUserPresets[1], sizeof(EQPRESET), iniFile);
@@ -397,6 +405,7 @@
GetPrivateProfileStruct("Effects", "EQ_User4", &CEQSetupDlg::gUserPresets[3], sizeof(EQPRESET), iniFile);
+ // Auto saver settings
CMainFrame::m_pAutoSaver = new CAutoSaver();
if(CMainFrame::GetPrivateProfileLong("AutoSave", "Enabled", true, iniFile))
{
@@ -413,15 +422,14 @@
CMainFrame::m_pAutoSaver->SetPath(szPath);
CMainFrame::m_pAutoSaver->SetFilenameTemplate(CMainFrame::GetPrivateProfileCString("AutoSave", "FileNameTemplate", "", iniFile));
- GetPrivateProfileString("Misc", "DefaultModType", defaultModType->fileExtension, szPath, INIBUFFERSIZE, iniFile);
- // for(size_t i = 0; i < CountOf(ModSpecs::Collection); i++)
- // {
- // if(!strcmp(szPath, ModSpecs::Collection[i]->fileExtension))
- // {
- // gdefaultModType = ModSpecs::Collection[i];
- // break;
- // }
- // }
+
+ // Default mod type when using the "New" button
+ const MODTYPE oldDefault = defaultModType;
+ defaultModType = CModSpecifications::ExtensionToType(CMainFrame::GetPrivateProfileCString("Misc", "DefaultModType", CSoundFile::GetModSpecifications(defaultModType).fileExtension, iniFile));
+ if(defaultModType == MOD_TYPE_NONE)
+ {
+ defaultModType = oldDefault;
+ }
}
@@ -755,6 +763,8 @@
if (!WritePrivateProfileString("Zxx Macros", snam, macros.szMidiZXXExt[izxx], iniFile)) break;
}
+ WritePrivateProfileString("Misc", "DefaultModType", CSoundFile::GetModSpecifications(defaultModType).fileExtension, iniFile);
+
CMainFrame::GetMainFrame()->SaveBarState("Toolbars");
}
Modified: trunk/OpenMPT/mptrack/TrackerSettings.h
===================================================================
--- trunk/OpenMPT/mptrack/TrackerSettings.h 2011-07-28 21:40:15 UTC (rev 934)
+++ trunk/OpenMPT/mptrack/TrackerSettings.h 2011-07-28 22:07:15 UTC (rev 935)
@@ -43,7 +43,7 @@
glInstrumentWindowHeight, glCommentsWindowHeight, glGraphWindowHeight; //rewbs.varWindowSize
CString gcsPreviousVersion;
CString gcsInstallGUID;
- CModSpecifications const *defaultModType;
+ MODTYPE defaultModType;
// Audio Setup
DWORD m_dwSoundSetup, m_dwRate, m_dwQuality, m_nSrcMode, m_nBitsPerSample, m_nPreAmp, gbLoopSong, m_nChannels;
LONG m_nWaveDevice; // use the SNDDEV_GET_NUMBER and SNDDEV_GET_TYPE macros to decode
Modified: trunk/OpenMPT/mptrack/mptrack.rc
===================================================================
--- trunk/OpenMPT/mptrack/mptrack.rc 2011-07-28 21:40:15 UTC (rev 934)
+++ trunk/OpenMPT/mptrack/mptrack.rc 2011-07-28 22:07:15 UTC (rev 935)
@@ -13,7 +13,7 @@
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
-// German (Germany) resources
+// Deutsch (Deutschland) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_DEU)
#ifdef _WIN32
@@ -707,14 +707,14 @@
CONTROL "Spin1",IDC_SPIN_INSTRUMENT,"msctls_updown32",UDS_WRAP | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_NOTHOUSANDS | WS_TABSTOP,111,8,11,11
EDITTEXT IDC_SAMPLE_NAME,131,6,151,12,ES_AUTOHSCROLL
EDITTEXT IDC_SAMPLE_FILENAME,324,6,105,12,ES_AUTOHSCROLL
- EDITTEXT IDC_EDIT8,84,36,37,12,ES_NUMBER
+ EDITTEXT IDC_EDIT8,84,36,37,12,ES_AUTOHSCROLL | ES_NUMBER
CONTROL "Spin1",IDC_SPIN8,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_NOTHOUSANDS,112,40,8,10
EDITTEXT IDC_EDIT7,84,53,37,12,ES_AUTOHSCROLL | ES_NUMBER
CONTROL "",IDC_SPIN7,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_NOTHOUSANDS,112,57,8,10
CONTROL "Set Pan",IDC_CHECK1,"Button",BS_AUTOCHECKBOX | BS_FLAT | WS_TABSTOP,42,72,42,10
- EDITTEXT IDC_EDIT9,84,70,37,12,ES_NUMBER
+ EDITTEXT IDC_EDIT9,84,70,37,12,ES_AUTOHSCROLL | ES_NUMBER
CONTROL "",IDC_SPIN9,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_NOTHOUSANDS,112,74,8,11
- EDITTEXT IDC_EDIT15,33,99,27,13
+ EDITTEXT IDC_EDIT15,33,99,27,13,ES_AUTOHSCROLL
CONTROL "Spin1",IDC_SPIN12,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_NOTHOUSANDS,61,103,7,11
COMBOBOX IDC_COMBO4,95,99,27,91,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
CONTROL "",IDC_SLIDER5,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS,47,135,36,10
@@ -736,9 +736,9 @@
COMBOBOX IDC_COMBO6,246,99,72,127,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
PUSHBUTTON "Editor",IDC_INSVIEWPLG,321,99,37,13,0,WS_EX_STATICEDGE
COMBOBOX IDC_COMBO5,321,116,37,169,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
- EDITTEXT IDC_EDIT10,321,134,37,12
+ EDITTEXT IDC_EDIT10,321,134,37,12,ES_AUTOHSCROLL
CONTROL "Spin1",IDC_SPIN10,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_NOTHOUSANDS,349,135,8,11
- EDITTEXT IDC_EDIT11,321,152,37,12
+ EDITTEXT IDC_EDIT11,321,152,37,12,ES_AUTOHSCROLL
CONTROL "",IDC_SPIN11,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_NOTHOUSANDS,351,153,8,11
COMBOBOX IDC_PLUGIN_VELOCITYSTYLE,367,115,83,50,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
COMBOBOX IDC_PLUGIN_VOLUMESTYLE,367,148,83,53,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
@@ -752,7 +752,7 @@
CTEXT "MIDI Bank",IDC_STATIC,245,152,72,12,SS_CENTERIMAGE,WS_EX_STATICEDGE
CTEXT "Fade Out",IDC_STATIC,8,53,72,12,SS_CENTERIMAGE,WS_EX_STATICEDGE
CTEXT "Global Volume",IDC_STATIC,8,36,72,12,SS_CENTERIMAGE,WS_EX_STATICEDGE
- CTEXT "File",IDC_STATIC,289,6,36,12,SS_CENTERIMAGE,WS_EX_STATICEDGE
+ CTEXT "File",IDC_STATIC,289,6,35,12,SS_CENTERIMAGE,WS_EX_STATICEDGE
CTEXT "Sep",IDC_STATIC,8,99,25,13,SS_CENTERIMAGE,WS_EX_STATICEDGE
CTEXT "Centre",IDC_STATIC,69,99,26,13,SS_CENTERIMAGE,WS_EX_STATICEDGE
GROUPBOX "Random Variation",IDC_STATIC,131,88,104,80
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sag...@us...> - 2011-07-28 21:40:21
|
Revision: 934
http://modplug.svn.sourceforge.net/modplug/?rev=934&view=rev
Author: saga-games
Date: 2011-07-28 21:40:15 +0000 (Thu, 28 Jul 2011)
Log Message:
-----------
[Mod] Installer: Remove empty template directories on uninstall.
Modified Paths:
--------------
trunk/OpenMPT/installer/install.iss
Modified: trunk/OpenMPT/installer/install.iss
===================================================================
--- trunk/OpenMPT/installer/install.iss 2011-07-28 21:32:33 UTC (rev 933)
+++ trunk/OpenMPT/installer/install.iss 2011-07-28 21:40:15 UTC (rev 934)
@@ -124,9 +124,11 @@
; internet shortcut has to be deleted manually
Type: files; Name: {app}\ModPlug Central.url
; normal installation
+Type: dirifempty; Name: {userappdata}\OpenMPT\TemplateModules; Tasks: not portable
Type: dirifempty; Name: {userappdata}\OpenMPT\tunings; Tasks: not portable
Type: dirifempty; Name: {userappdata}\OpenMPT; Tasks: not portable
; portable installation
+Type: dirifempty; Name: {app}\TemplateModules; Tasks: portable
Type: dirifempty; Name: {app}\tunings; Tasks: portable
#ifdef DOWNLOAD_MO3
Type: files; Name: {app}\unmo3.dll; Tasks: downloadmo3
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sag...@us...> - 2011-07-28 21:32:39
|
Revision: 933
http://modplug.svn.sourceforge.net/modplug/?rev=933&view=rev
Author: saga-games
Date: 2011-07-28 21:32:33 +0000 (Thu, 28 Jul 2011)
Log Message:
-----------
Added missing include statement
Modified Paths:
--------------
trunk/OpenMPT/soundlib/mod_specifications.cpp
Modified: trunk/OpenMPT/soundlib/mod_specifications.cpp
===================================================================
--- trunk/OpenMPT/soundlib/mod_specifications.cpp 2011-07-28 20:51:57 UTC (rev 932)
+++ trunk/OpenMPT/soundlib/mod_specifications.cpp 2011-07-28 21:32:33 UTC (rev 933)
@@ -1,7 +1,10 @@
#include <stdafx.h>
#include "mod_specifications.h"
+#include "..\mptrack\misc_util.h"
+
MODTYPE CModSpecifications::ExtensionToType(LPCTSTR pszExt)
+//---------------------------------------------------------
{
if (pszExt == nullptr)
return MOD_TYPE_NONE;
@@ -30,6 +33,7 @@
return MOD_TYPE_NONE;
}
+
bool CModSpecifications::HasNote(MODCOMMAND::NOTE note) const
//------------------------------------------------------------
{
@@ -50,6 +54,7 @@
return false;
}
+
bool CModSpecifications::HasVolCommand(MODCOMMAND::VOLCMD volcmd) const
//---------------------------------------------------------------------
{
@@ -58,6 +63,7 @@
return true;
}
+
bool CModSpecifications::HasCommand(MODCOMMAND::COMMAND cmd) const
//----------------------------------------------------------------
{
@@ -66,6 +72,7 @@
return true;
}
+
char CModSpecifications::GetVolEffectLetter(MODCOMMAND::VOLCMD volcmd) const
//--------------------------------------------------------------------------
{
@@ -73,6 +80,7 @@
return volcommands[volcmd];
}
+
char CModSpecifications::GetEffectLetter(MODCOMMAND::COMMAND cmd) const
//---------------------------------------------------------------------
{
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rel...@us...> - 2011-07-28 20:52:05
|
Revision: 932
http://modplug.svn.sourceforge.net/modplug/?rev=932&view=rev
Author: relabsoluness
Date: 2011-07-28 20:51:57 +0000 (Thu, 28 Jul 2011)
Log Message:
-----------
[New] General: Template modules. Can be accessed from file-menu.
[New] General: Example modules are now accessible through help menu.
[Ref] Minor tweaks here and there.
Modified Paths:
--------------
trunk/OpenMPT/mptrack/AbstractVstEditor.cpp
trunk/OpenMPT/mptrack/Ctrl_pat.h
trunk/OpenMPT/mptrack/InputHandler.cpp
trunk/OpenMPT/mptrack/MainFrm.cpp
trunk/OpenMPT/mptrack/Mainfrm.h
trunk/OpenMPT/mptrack/Moddoc.cpp
trunk/OpenMPT/mptrack/Moddoc.h
trunk/OpenMPT/mptrack/Mptrack.cpp
trunk/OpenMPT/mptrack/Mptrack.h
trunk/OpenMPT/mptrack/PerformanceCounter.h
trunk/OpenMPT/mptrack/TrackerSettings.cpp
trunk/OpenMPT/mptrack/TrackerSettings.h
trunk/OpenMPT/mptrack/TuningDialog.h
trunk/OpenMPT/mptrack/misc_util.h
trunk/OpenMPT/mptrack/mptrack.rc
trunk/OpenMPT/mptrack/resource.h
trunk/OpenMPT/mptrack/test/test.cpp
trunk/OpenMPT/mptrack/tuningRatioMapWnd.h
trunk/OpenMPT/soundlib/SNDDEVX.H
trunk/OpenMPT/soundlib/mod_specifications.cpp
trunk/OpenMPT/soundlib/mod_specifications.h
Modified: trunk/OpenMPT/mptrack/AbstractVstEditor.cpp
===================================================================
--- trunk/OpenMPT/mptrack/AbstractVstEditor.cpp 2011-07-28 14:59:55 UTC (rev 931)
+++ trunk/OpenMPT/mptrack/AbstractVstEditor.cpp 2011-07-28 20:51:57 UTC (rev 932)
@@ -202,7 +202,7 @@
}
}
SetNullTerminator(rawname);
- CreateVerifiedProgramName(rawname, sizeof(rawname), name, sizeof(name), index);
+ CreateVerifiedProgramName(rawname, CountOf(rawname), name, CountOf(name), index);
m_pMenu->ModifyMenu(8, MF_BYPOSITION, 0, name);
}
Modified: trunk/OpenMPT/mptrack/Ctrl_pat.h
===================================================================
--- trunk/OpenMPT/mptrack/Ctrl_pat.h 2011-07-28 14:59:55 UTC (rev 931)
+++ trunk/OpenMPT/mptrack/Ctrl_pat.h 2011-07-28 20:51:57 UTC (rev 932)
@@ -66,7 +66,7 @@
BYTE GetMargins() {return GetMargins(GetMarginsMax());}
// Returns the effective margin value.
- BYTE GetMargins(const BYTE nMaxMargins) {return min(nMaxMargins, m_nOrderlistMargins);}
+ BYTE GetMargins(const BYTE nMaxMargins) {return Util::Min(nMaxMargins, static_cast<BYTE>(m_nOrderlistMargins));}
// Returns maximum margin value given current window width.
BYTE GetMarginsMax() {return GetMarginsMax(GetLength());}
Modified: trunk/OpenMPT/mptrack/InputHandler.cpp
===================================================================
--- trunk/OpenMPT/mptrack/InputHandler.cpp 2011-07-28 14:59:55 UTC (rev 931)
+++ trunk/OpenMPT/mptrack/InputHandler.cpp 2011-07-28 20:51:57 UTC (rev 932)
@@ -416,9 +416,11 @@
{
case FILENEW: s="&New\t"; c=kcFileNew; break;
case ID_FILE_OPEN: s="&Open...\t"; c=kcFileOpen; break;
+ case ID_FILE_OPENTEMPLATE: return "Open Template\t";
case ID_FILE_CLOSE: s="&Close\t"; c=kcFileClose; break;
case ID_FILE_SAVE: s="&Save\t"; c=kcFileSave; break;
case ID_FILE_SAVE_AS: s="Save &As...\t"; c=kcFileSaveAs; break;
+ case ID_FILE_SAVEASTEMPLATE:s="Save as Template\t"; break;
case ID_FILE_SAVEASWAVE: s="Export as &Wave...\t"; c=kcFileSaveAsWave; break;
case ID_FILE_SAVEASMP3: s="Export as M&P3...\t"; c=kcFileSaveAsMP3; break;
case ID_FILE_SAVEMIDI: s="Export as M&IDI...\t"; c=kcFileSaveMidi; break;
@@ -465,6 +467,8 @@
case ID_VIEW_SONGPROPERTIES:s="Song P&roperties...\t"; c=kcViewSongProperties; break; //rewbs.graph
case ID_VIEW_MIDIMAPPING: s="&MIDI Mapping...\t"; c = kcViewMIDImapping; break;
case ID_VIEW_EDITHISTORY: s="Edit &History...\t"; c = kcViewEditHistory; break;
+ // Help submenu:
+ case ID_EXAMPLE_MODULES: return "&Example Modules\t";
/*
case ID_WINDOW_NEW: s="&New Window\t"; c=kcWindowNew; break;
Modified: trunk/OpenMPT/mptrack/MainFrm.cpp
===================================================================
--- trunk/OpenMPT/mptrack/MainFrm.cpp 2011-07-28 14:59:55 UTC (rev 931)
+++ trunk/OpenMPT/mptrack/MainFrm.cpp 2011-07-28 20:51:57 UTC (rev 932)
@@ -79,11 +79,13 @@
ON_COMMAND(ID_DEFAULT_HELP, CMDIFrameWnd::OnHelpFinder)
ON_COMMAND(ID_NEXTOCTAVE, OnNextOctave)
ON_COMMAND(ID_PREVOCTAVE, OnPrevOctave)
+ ON_COMMAND_RANGE(ID_FILE_OPENTEMPLATE, ID_FILE_OPENTEMPLATE_LASTINRANGE, OnOpenTemplateModule)
ON_COMMAND(ID_ADD_SOUNDBANK, OnAddDlsBank)
ON_COMMAND(ID_IMPORT_MIDILIB, OnImportMidiLib)
ON_COMMAND(ID_MIDI_RECORD, OnMidiRecord)
ON_COMMAND(ID_PANIC, OnPanic)
ON_COMMAND(ID_PLAYER_PAUSE, OnPlayerPause)
+ ON_COMMAND_RANGE(ID_EXAMPLE_MODULES, ID_EXAMPLE_MODULES_LASTINRANGE, OnExampleSong)
ON_COMMAND_EX(IDD_TREEVIEW, OnBarCheck)
ON_COMMAND_EX(ID_NETLINK_MODPLUG, OnInternetLink)
ON_COMMAND_EX(ID_NETLINK_TOP_PICKS, OnInternetLink)
@@ -120,6 +122,9 @@
UINT CMainFrame::m_nLastOptionsPage = 0;
HHOOK CMainFrame::ghKbdHook = NULL;
+std::vector<CString> CMainFrame::s_ExampleModulePaths;
+std::vector<CString> CMainFrame::s_TemplateModulePaths;
+
CRITICAL_SECTION CMainFrame::m_csAudio;
HANDLE CMainFrame::m_hPlayThread = NULL;
DWORD CMainFrame::m_dwPlayThreadId = 0;
@@ -183,7 +188,7 @@
CInputHandler *CMainFrame::m_InputHandler = nullptr; //rewbs.customKeys
CAutoSaver *CMainFrame::m_pAutoSaver = nullptr; //rewbs.autosave
-CPerformanceCounter *CMainFrame::m_pPerfCounter = nullptr;
+//CPerformanceCounter *CMainFrame::m_pPerfCounter = nullptr;
static UINT indicators[] =
{
@@ -231,7 +236,7 @@
m_Settings.LoadSettings();
m_InputHandler = new CInputHandler(this); //rewbs.customKeys
- m_pPerfCounter= new CPerformanceCounter();
+ //m_pPerfCounter= new CPerformanceCounter();
//Loading static tunings here - probably not the best place to do that but anyway.
CSoundFile::LoadStaticTunings();
@@ -288,6 +293,9 @@
UpdateAudioParameters(TRUE);
// Update the tree
m_wndTree.Init();
+
+ CreateExampleModulesMenu();
+ CreateTemplateModulesMenu();
}
@@ -297,7 +305,7 @@
DeleteCriticalSection(&m_csAudio);
delete m_InputHandler; //rewbs.customKeys
delete m_pAutoSaver; //rewbs.autosaver
- delete m_pPerfCounter;
+ //delete m_pPerfCounter;
CChannelManagerDlg::DestroySharedInstance();
CSoundFile::DeleteStaticdata();
@@ -2160,6 +2168,61 @@
}
+void CMainFrame::OpenMenuItemFile(const UINT nId, const bool bTemplateFile)
+{
+ const UINT nIdBegin = (bTemplateFile) ? ID_FILE_OPENTEMPLATE : ID_EXAMPLE_MODULES;
+ const std::vector<CString>& vecFilePaths = (bTemplateFile) ? s_TemplateModulePaths : s_ExampleModulePaths;
+
+ const UINT nIndex = nId - nIdBegin;
+ if (nIndex < vecFilePaths.size())
+ {
+ const CString& sPath = vecFilePaths[nIndex];
+ const bool bAvailable = Util::sdOs::IsPathFileAvailable(sPath, Util::sdOs::FileModeRead);
+ if (bAvailable)
+ {
+ CDocument* pDoc = theApp.OpenDocumentFile(sPath);
+ if (pDoc != nullptr)
+ {
+ ASSERT(pDoc->IsKindOf(RUNTIME_CLASS(CModDoc)) == TRUE);
+ CModDoc* pModDoc = static_cast<CModDoc*>(pDoc);
+ pModDoc->ClearFilePath(); // Clear path so that saving will not take place in templates/examples folder.
+ if (bTemplateFile)
+ {
+ theApp.RemoveMruItem(0);
+ }
+ }
+ }
+ else
+ {
+ const bool bExists = Util::sdOs::IsPathFileAvailable(sPath, Util::sdOs::FileModeExists);
+ CString str;
+ if (bExists)
+ AfxFormatString1(str, IDS_FILE_EXISTS_BUT_IS_NOT_READABLE, (LPCTSTR)sPath);
+ else
+ AfxFormatString1(str, IDS_FILE_DOES_NOT_EXIST, (LPCTSTR)sPath);
+ AfxMessageBox(str);
+ }
+ }
+ else
+ ASSERT(false);
+}
+
+
+void CMainFrame::OnOpenTemplateModule(UINT nId)
+//---------------------------------------------
+{
+ OpenMenuItemFile(nId, true/*open template menu file*/);
+}
+
+
+void CMainFrame::OnExampleSong(UINT nId)
+//--------------------------------------
+{
+ OpenMenuItemFile(nId, false/*open example menu file*/);
+
+}
+
+
LRESULT CMainFrame::OnInvalidatePatterns(WPARAM wParam, LPARAM)
//-------------------------------------------------------------
{
@@ -2520,6 +2583,87 @@
}
+HMENU CMainFrame::CreateFileMenu(const size_t nMaxCount, std::vector<CString>& vPaths, const LPCTSTR pszFolderName, const uint16 nIdRangeBegin)
+//---------------------------------------------------------------------------------------------------------------------------------------------
+{
+ vPaths.clear();
+ HMENU hMenu = ::CreatePopupMenu();
+ ASSERT(hMenu != NULL);
+ if (hMenu != NULL)
+ {
+ UINT_PTR nAddCounter = 0;
+ for(size_t i = 0; i < 2; i++) // 0: app items, 1: user items
+ {
+ // To avoid duplicates, check whether app path and config path are the same.
+ if (i == 1 && _tcsicmp(CTrackApp::GetAppDirPath(), theApp.GetConfigPath()) == 0)
+ break;
+ CFileFind fileFind;
+ CFixedStringT<CString, MAX_PATH> sPath;
+ sPath = (i == 0) ? CTrackApp::GetAppDirPath() : theApp.GetConfigPath();
+ sPath += pszFolderName;
+ if (Util::sdOs::IsPathFileAvailable(sPath, Util::sdOs::FileModeExists) == false)
+ continue;
+ sPath += _T("*");
+
+ BOOL bWorking = fileFind.FindFile(sPath);
+ // Note: The order in which the example files appears in the menu is unspecified.
+ while (bWorking && nAddCounter < nMaxCount)
+ {
+ bWorking = fileFind.FindNextFile();
+ const CString fn = fileFind.GetFileName();
+ if (fileFind.IsDirectory() == FALSE)
+ {
+ vPaths.push_back(fileFind.GetFilePath());
+ AppendMenu(hMenu, MF_STRING, nIdRangeBegin + nAddCounter, fileFind.GetFileName());
+ ++nAddCounter;
+ }
+ }
+ fileFind.Close();
+ }
+
+ if (nAddCounter == 0)
+ AppendMenu(hMenu, MF_STRING | MF_GRAYED | MF_DISABLED, 0, _T("No items found"));
+ }
+
+ return hMenu;
+}
+
+
+void CMainFrame::CreateExampleModulesMenu()
+//-----------------------------------------
+{
+ static_assert(nMaxItemsInExampleModulesMenu == ID_EXAMPLE_MODULES_LASTINRANGE - ID_EXAMPLE_MODULES + 1,
+ "Make sure that there's a proper range for menu commands in resources.");
+ HMENU hMenu = CreateFileMenu(nMaxItemsInExampleModulesMenu, s_ExampleModulePaths, _T("ExampleSongs\\"), ID_EXAMPLE_MODULES);
+ CMenu* const pMainMenu = GetMenu();
+ if (hMenu && pMainMenu && m_InputHandler)
+ VERIFY(pMainMenu->ModifyMenu(ID_EXAMPLE_MODULES, MF_BYCOMMAND | MF_POPUP, (UINT_PTR)hMenu, m_InputHandler->GetMenuText(ID_EXAMPLE_MODULES)));
+ else
+ ASSERT(false);
+}
+
+
+void CMainFrame::CreateTemplateModulesMenu()
+//------------------------------------------
+{
+ static_assert(nMaxItemsInTemplateModulesMenu == ID_FILE_OPENTEMPLATE_LASTINRANGE - ID_FILE_OPENTEMPLATE + 1,
+ "Make sure that there's a proper range for menu commands in resources.");
+ HMENU hMenu = CreateFileMenu(nMaxItemsInTemplateModulesMenu, s_TemplateModulePaths, _T("TemplateModules\\"), ID_FILE_OPENTEMPLATE);
+ CMenu* const pMainMenu = GetMenu();
+ CMenu* pFileMenu = (pMainMenu) ? pMainMenu->GetSubMenu(0) : nullptr;
+ if (hMenu && pFileMenu && m_InputHandler)
+ {
+ if (pFileMenu->GetMenuItemID(1) != ID_FILE_OPEN)
+ pFileMenu = pMainMenu->GetSubMenu(1);
+ ASSERT(pFileMenu->GetMenuItemID(1) == ID_FILE_OPEN);
+ VERIFY(pFileMenu->RemoveMenu(2, MF_BYPOSITION));
+ VERIFY(pFileMenu->InsertMenu(2, MF_BYPOSITION | MF_POPUP, (UINT_PTR)hMenu, m_InputHandler->GetMenuText(ID_FILE_OPENTEMPLATE)));
+ }
+ else
+ ASSERT(false);
+}
+
+
/////////////////////////////////////////////
//Misc helper functions
/////////////////////////////////////////////
@@ -2533,10 +2677,10 @@
PSNDMIXPLUGIN p = &plugarray[iPlug];
CString str;
str.Preallocate(80);
- str.Format("FX%d: ", iPlug+1);
+ str.Format(_T("FX%d: "), iPlug+1);
const int size0 = str.GetLength();
str += (librarynames) ? p->GetLibraryName() : p->GetName();
- if(str.GetLength() <= size0) str += "undefined";
+ if(str.GetLength() <= size0) str += _T("undefined");
CBox.SetItemData(CBox.AddString(str), iPlug + 1);
}
Modified: trunk/OpenMPT/mptrack/Mainfrm.h
===================================================================
--- trunk/OpenMPT/mptrack/Mainfrm.h 2011-07-28 14:59:55 UTC (rev 931)
+++ trunk/OpenMPT/mptrack/Mainfrm.h 2011-07-28 20:51:57 UTC (rev 932)
@@ -502,7 +502,7 @@
static VOID GetKeyName(LONG lParam, LPSTR pszName, UINT cbSize);
static CInputHandler *m_InputHandler; //rewbs.customKeys
static CAutoSaver *m_pAutoSaver; //rewbs.customKeys
- static CPerformanceCounter *m_pPerfCounter;
+ //static CPerformanceCounter *m_pPerfCounter;
static bool WritePrivateProfileLong(const CString section, const CString key, const long value, const CString iniFile);
static long GetPrivateProfileLong(const CString section, const CString key, const long defaultValue, const CString iniFile);
@@ -535,6 +535,19 @@
double GetApproxBPM(); //rewbs.VSTTimeInfo
void ThreadSafeSetModified(CModDoc* modified) {m_pJustModifiedDoc=modified;}
+ void CreateExampleModulesMenu();
+ void CreateTemplateModulesMenu();
+
+ /// Creates submenu whose items are filenames of files in both
+ /// AppDirectory\pszFolderName\ (usually C:\program files\OpenMPT\pszFolderName\)
+ /// and
+ /// ConfigDirectory\pszFolderName (usually %appdata%\OpenMPT\pszFolderName\)
+ /// [in] nMaxCount: Maximum number of items allowed in the menu
+ /// [out] vPaths: Receives the full paths of the files added to the menu.
+ /// [in] pszFolderName: Name of the folder (should end with \)
+ /// [in] nIdRangeBegin: First ID for the menu item.
+ static HMENU CreateFileMenu(const size_t nMaxCount, std::vector<CString>& vPaths, const LPCTSTR pszFolderName, const uint16 nIdRangeBegin);
+
// Player functions
public:
BOOL PlayMod(CModDoc *, HWND hPat=NULL, DWORD dwNotifyType=0);
@@ -576,6 +589,9 @@
virtual void OnUpdateFrameTitle(BOOL bAddToTitle);
//}}AFX_VIRTUAL
+ /// Opens either template or example menu item.
+ void OpenMenuItemFile(const UINT nId, const bool bTemplateFile);
+
// Implementation
public:
virtual ~CMainFrame();
@@ -625,6 +641,8 @@
afx_msg void OnReportBug(); //rewbs.customKeys
afx_msg BOOL OnInternetLink(UINT nID);
afx_msg LRESULT OnUpdatePosition(WPARAM, LPARAM lParam);
+ afx_msg void OnExampleSong(UINT nId);
+ afx_msg void OnOpenTemplateModule(UINT nId);
afx_msg LRESULT OnInvalidatePatterns(WPARAM, LPARAM);
afx_msg LRESULT OnSpecialKey(WPARAM, LPARAM);
afx_msg LRESULT OnCustomKeyMsg(WPARAM, LPARAM);
@@ -639,6 +657,14 @@
afx_msg void OnKillFocus(CWnd* pNewWnd);
afx_msg void OnShowWindow(BOOL bShow, UINT nStatus);
+ // Defines maximum number of items in example modules menu.
+ static const size_t nMaxItemsInExampleModulesMenu = 50;
+ static const size_t nMaxItemsInTemplateModulesMenu = 50;
+
+ /// Array of paths of example modules that are available from help menu.
+ static std::vector<CString> s_ExampleModulePaths;
+ /// Array of paths of template modules that are available from file menu.
+ static std::vector<CString> s_TemplateModulePaths;
};
const CHAR gszBuildDate[] = __DATE__ " " __TIME__;
Modified: trunk/OpenMPT/mptrack/Moddoc.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Moddoc.cpp 2011-07-28 14:59:55 UTC (rev 931)
+++ trunk/OpenMPT/mptrack/Moddoc.cpp 2011-07-28 20:51:57 UTC (rev 932)
@@ -15,6 +15,7 @@
#include "version.h"
#include "modsmp_ctrl.h"
#include "CleanupSong.h"
+#include <shlwapi.h>
extern WORD S3MFineTuneTable[16];
@@ -30,7 +31,22 @@
const TCHAR FileFilterIT[] = _T("Impulse Tracker Modules (*.it)|*.it||");
const TCHAR FileFilterITP[] = _T("Impulse Tracker Projects (*.itp)|*.itp||");
const TCHAR FileFilterMPT[] = _T("OpenMPT Modules (*.mptm)|*.mptm||");
+const TCHAR FileFilterNone[] = _T("");
+const TCHAR* ModTypeToFilter(const CSoundFile& sndFile)
+{
+ const MODTYPE modtype = sndFile.GetType();
+ switch(modtype)
+ {
+ case MOD_TYPE_MOD: return FileFilterMOD;
+ case MOD_TYPE_XM: return FileFilterXM;
+ case MOD_TYPE_S3M: return FileFilterS3M;
+ case MOD_TYPE_IT: return (sndFile.m_dwSongFlags & SONG_ITPROJECT) ? FileFilterITP : FileFilterIT;
+ case MOD_TYPE_MPT: return FileFilterMPT;
+ default: return FileFilterNone;
+ }
+}
+
/////////////////////////////////////////////////////////////////////////////
// CModDoc
@@ -38,6 +54,7 @@
BEGIN_MESSAGE_MAP(CModDoc, CDocument)
//{{AFX_MSG_MAP(CModDoc)
+ ON_COMMAND(ID_FILE_SAVEASTEMPLATE, OnSaveTemplateModule)
ON_COMMAND(ID_FILE_SAVEASWAVE, OnFileWaveConvert)
ON_COMMAND(ID_FILE_SAVEASMP3, OnFileMP3Convert)
ON_COMMAND(ID_FILE_SAVEMIDI, OnFileMidiConvert)
@@ -414,26 +431,32 @@
}
-BOOL CModDoc::OnSaveDocument(LPCTSTR lpszPathName)
+BOOL CModDoc::OnSaveDocument(LPCTSTR lpszPathName, const bool bTemplateFile)
//------------------------------------------------
{
static int greccount = 0;
- TCHAR fext[_MAX_EXT]="";
- UINT nType = m_SndFile.m_nType, dwPacking = 0;
+ TCHAR fext[_MAX_EXT] = _T("");
+ UINT dwPacking = 0;
BOOL bOk = FALSE;
m_SndFile.m_dwLastSavedWithVersion = MptVersion::num;
- if (!lpszPathName) return FALSE;
+ if (!lpszPathName)
+ return FALSE;
_tsplitpath(lpszPathName, NULL, NULL, NULL, fext);
- if (!lstrcmpi(fext, ".mod")) nType = MOD_TYPE_MOD; else
- if (!lstrcmpi(fext, ".s3m")) nType = MOD_TYPE_S3M; else
- if (!lstrcmpi(fext, ".xm")) nType = MOD_TYPE_XM; else
+ MODTYPE type = CModSpecifications::ExtensionToType(fext);
+
+ /*
+ if (!lstrcmpi(fext, ".mod")) type = MOD_TYPE_MOD; else
+ if (!lstrcmpi(fext, ".s3m")) type = MOD_TYPE_S3M; else
+ if (!lstrcmpi(fext, ".xm")) type = MOD_TYPE_XM; else
// -> CODE#0023
// -> DESC="IT project files (.itp)"
// if (!lstrcmpi(fext, ".it")) nType = MOD_TYPE_IT; else
- if (!lstrcmpi(fext, ".it") || !lstrcmpi(fext, ".itp")) nType = MOD_TYPE_IT; else
- if (!lstrcmpi(fext, ".mptm")) nType = MOD_TYPE_MPT; else
+ if (!lstrcmpi(fext, ".it") || !lstrcmpi(fext, ".itp")) type = MOD_TYPE_IT; else
+ if (!lstrcmpi(fext, ".mptm")) type = MOD_TYPE_MPT; else
// -! NEW_FEATURE#0023
- if (!greccount)
+*/
+
+ if (type == MOD_TYPE_NONE && !greccount)
{
greccount++;
bOk = DoSave(NULL, TRUE);
@@ -443,23 +466,32 @@
BeginWaitCursor();
ClearLog();
FixNullStrings();
- switch(nType)
+ switch(type)
{
case MOD_TYPE_MOD: bOk = m_SndFile.SaveMod(lpszPathName, dwPacking); break;
case MOD_TYPE_S3M: bOk = m_SndFile.SaveS3M(lpszPathName, dwPacking); break;
case MOD_TYPE_XM: bOk = m_SndFile.SaveXM(lpszPathName, dwPacking); break;
- case MOD_TYPE_IT: bOk = (m_SndFile.m_dwSongFlags & SONG_ITPROJECT || !lstrcmpi(fext, ".itp")) ? m_SndFile.SaveITProject(lpszPathName) : m_SndFile.SaveIT(lpszPathName, dwPacking); break;
+ case MOD_TYPE_IT: bOk = (m_SndFile.m_dwSongFlags & SONG_ITPROJECT || !lstrcmpi(fext, _T(".itp"))) ? m_SndFile.SaveITProject(lpszPathName) : m_SndFile.SaveIT(lpszPathName, dwPacking); break;
case MOD_TYPE_MPT: bOk = m_SndFile.SaveIT(lpszPathName, dwPacking); break;
}
EndWaitCursor();
if (bOk)
{
- if (nType == m_SndFile.m_nType) SetPathName(lpszPathName);
+ if (type == m_SndFile.GetType() && !bTemplateFile)
+ SetPathName(lpszPathName);
ShowLog();
+ if (bTemplateFile)
+ {
+ CMainFrame* const pMainFrame = CMainFrame::GetMainFrame();
+ if (pMainFrame)
+ pMainFrame->CreateTemplateModulesMenu();
+ }
} else
{
- if(nType == MOD_TYPE_IT && m_SndFile.m_dwSongFlags & SONG_ITPROJECT) ::MessageBox(NULL,"ITP projects need to have a path set for each instrument...",NULL,MB_ICONERROR | MB_OK);
- else ErrorBox(IDS_ERR_SAVESONG, CMainFrame::GetMainFrame());
+ if(type == MOD_TYPE_IT && m_SndFile.m_dwSongFlags & SONG_ITPROJECT)
+ AfxMessageBox(_T("ITP projects need to have a path set for each instrument..."), MB_ICONERROR | MB_OK);
+ else
+ ErrorBox(IDS_ERR_SAVESONG, CMainFrame::GetMainFrame());
}
return bOk;
}
@@ -3898,3 +3930,40 @@
// Sequence names.
// Not needed?
}
+
+void CModDoc::OnSaveTemplateModule()
+{
+ // Create template folder if doesn't exist already.
+ const LPCTSTR pszTemplateFolder = CMainFrame::GetSettings().GetDefaultDirectory(DIR_TEMPLATE_FILES_USER);
+ if (!PathIsDirectory(pszTemplateFolder))
+ {
+ if (!CreateDirectory(pszTemplateFolder, nullptr))
+ {
+ CString sErrMsg;
+ AfxFormatString1(sErrMsg, IDS_UNABLE_TO_CREATE_USER_TEMPLATE_FOLDER, pszTemplateFolder);
+ AfxMessageBox(sErrMsg);
+ return;
+ }
+ }
+
+ // Generate file name candidate.
+ CString sName;
+ for(size_t i = 0; i<1000; ++i)
+ {
+ sName.Format(_T("newTemplate%u."), i);
+ sName += m_SndFile.GetModSpecifications().fileExtension;
+ if (!Util::sdOs::IsPathFileAvailable(pszTemplateFolder + sName, Util::sdOs::FileModeExists))
+ break;
+ }
+
+ // Ask file name from user.
+ FileDlgResult fdr = CTrackApp::ShowOpenSaveFileDialog(false, m_SndFile.GetModSpecifications().fileExtension, (LPCTSTR)sName,
+ ModTypeToFilter(m_SndFile), pszTemplateFolder);
+
+ if (fdr.abort)
+ return;
+
+ const CString sOldPath = m_strPathName;
+ OnSaveDocument(fdr.first_file.c_str(), true/*template file*/);
+ m_strPathName = sOldPath;
+}
Modified: trunk/OpenMPT/mptrack/Moddoc.h
===================================================================
--- trunk/OpenMPT/mptrack/Moddoc.h 2011-07-28 14:59:55 UTC (rev 931)
+++ trunk/OpenMPT/mptrack/Moddoc.h 2011-07-28 20:51:57 UTC (rev 932)
@@ -223,6 +223,7 @@
LPCSTR GetLog() const { return m_lpszLog; }
BOOL ClearLog();
UINT ShowLog(LPCSTR lpszTitle=NULL, CWnd *parent=NULL);
+ void ClearFilePath() {m_strPathName.Empty();}
// Logging for general progress and error events.
void AddLogEvent(LogEventType eventType, LPCTSTR pszFuncName, LPCTSTR pszFormat, ...);
@@ -383,9 +384,10 @@
public:
virtual BOOL OnNewDocument();
virtual BOOL OnOpenDocument(LPCTSTR lpszPathName);
- virtual BOOL OnSaveDocument(LPCTSTR lpszPathName);
+ virtual BOOL OnSaveDocument(LPCTSTR lpszPathName) {return OnSaveDocument(lpszPathName, false);}
virtual void OnCloseDocument();
void SafeFileClose();
+ BOOL OnSaveDocument(LPCTSTR lpszPathName, const bool bTemplateFile);
// -> CODE#0023
// -> DESC="IT project files (.itp)"
@@ -439,6 +441,7 @@
afx_msg void OnPatternPlayNoLoop(); //rewbs.customKeys
afx_msg void OnViewEditHistory();
afx_msg void OnViewMPTHacks();
+ afx_msg void OnSaveTemplateModule();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
private:
Modified: trunk/OpenMPT/mptrack/Mptrack.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Mptrack.cpp 2011-07-28 14:59:55 UTC (rev 931)
+++ trunk/OpenMPT/mptrack/Mptrack.cpp 2011-07-28 20:51:57 UTC (rev 932)
@@ -17,6 +17,7 @@
#include "version.h"
#include "test/test.h"
#include <shlwapi.h>
+#include <afxadv.h>
#include "UpdateCheck.h"
// rewbs.memLeak
@@ -768,6 +769,11 @@
strcpy(m_szPluginCacheFileName, m_szConfigDirectory); // plugin cache
strcat(m_szPluginCacheFileName, "plugin.cache");
+ TCHAR szTemplatePath[MAX_PATH];
+ _tcscpy(szTemplatePath, m_szConfigDirectory);
+ _tcscat(szTemplatePath, _T("TemplateModules\\"));
+ CMainFrame::GetSettings().SetDefaultDirectory(szTemplatePath, DIR_TEMPLATE_FILES_USER);
+
m_bPortableMode = bIsAppDir;
}
@@ -3138,3 +3144,9 @@
}
SetNullTerminator(szPath);
}
+
+void CTrackApp::RemoveMruItem(const int nItem)
+{
+ if (m_pRecentFileList && nItem >= 0 && nItem < m_pRecentFileList->GetSize())
+ m_pRecentFileList->Remove(nItem);
+}
Modified: trunk/OpenMPT/mptrack/Mptrack.h
===================================================================
--- trunk/OpenMPT/mptrack/Mptrack.h 2011-07-28 14:59:55 UTC (rev 931)
+++ trunk/OpenMPT/mptrack/Mptrack.h 2011-07-28 20:51:57 UTC (rev 932)
@@ -178,10 +178,12 @@
BOOL CanEncodeLayer3() const { return m_bLayer3Present; }
BOOL IsWaveExEnabled() const { return m_bExWaveSupport; }
BOOL IsDebug() const { return m_bDebugMode; }
- LPCSTR GetConfigFileName() const { return m_szConfigFileName; }
+ LPCTSTR GetConfigFileName() const { return m_szConfigFileName; }
static bool IsPortableMode() { return m_bPortableMode; }
- LPCSTR GetPluginCacheFileName() const { return m_szPluginCacheFileName; }
- LPCSTR GetConfigPath() const { return m_szConfigDirectory; }
+ LPCTSTR GetPluginCacheFileName() const { return m_szPluginCacheFileName; }
+
+ /// Returns path to config folder including trailing '\'.
+ LPCTSTR GetConfigPath() const { return m_szConfigDirectory; }
void SetupPaths(bool overridePortable);
// Relative / absolute paths conversion
template <size_t nLength>
@@ -189,6 +191,9 @@
template <size_t nLength>
void RelativePathToAbsolute(TCHAR (&szPath)[nLength]);
+ /// Removes item from MRU-list; most recent item has index zero.
+ void RemoveMruItem(const int nItem);
+
// Splash Screen
protected:
VOID StartSplashScreen();
Modified: trunk/OpenMPT/mptrack/PerformanceCounter.h
===================================================================
--- trunk/OpenMPT/mptrack/PerformanceCounter.h 2011-07-28 14:59:55 UTC (rev 931)
+++ trunk/OpenMPT/mptrack/PerformanceCounter.h 2011-07-28 20:51:57 UTC (rev 932)
@@ -1,5 +1,6 @@
#pragma once
+#if 0
class CPerformanceCounter
{
protected:
@@ -59,3 +60,4 @@
}
};
+#endif
Modified: trunk/OpenMPT/mptrack/TrackerSettings.cpp
===================================================================
--- trunk/OpenMPT/mptrack/TrackerSettings.cpp 2011-07-28 14:59:55 UTC (rev 931)
+++ trunk/OpenMPT/mptrack/TrackerSettings.cpp 2011-07-28 20:51:57 UTC (rev 932)
@@ -22,7 +22,7 @@
#include "TrackerSettings.h"
-const TCHAR *TrackerSettings::m_szDirectoryToSettingsName[NUM_DIRS] = { _T("Songs_Directory"), _T("Samples_Directory"), _T("Instruments_Directory"), _T("Plugins_Directory"), _T("Plugin_Presets_Directory"), _T("Export_Directory"), _T("") };
+const TCHAR *TrackerSettings::m_szDirectoryToSettingsName[NUM_DIRS] = { _T("Songs_Directory"), _T("Samples_Directory"), _T("Instruments_Directory"), _T("Plugins_Directory"), _T("Plugin_Presets_Directory"), _T("Export_Directory"), _T(""), _T("") };
TrackerSettings::TrackerSettings()
Modified: trunk/OpenMPT/mptrack/TrackerSettings.h
===================================================================
--- trunk/OpenMPT/mptrack/TrackerSettings.h 2011-07-28 14:59:55 UTC (rev 931)
+++ trunk/OpenMPT/mptrack/TrackerSettings.h 2011-07-28 20:51:57 UTC (rev 932)
@@ -24,6 +24,7 @@
DIR_PLUGINPRESETS,
DIR_EXPORT,
DIR_TUNING,
+ DIR_TEMPLATE_FILES_USER,
NUM_DIRS
};
Modified: trunk/OpenMPT/mptrack/TuningDialog.h
===================================================================
--- trunk/OpenMPT/mptrack/TuningDialog.h 2011-07-28 14:59:55 UTC (rev 931)
+++ trunk/OpenMPT/mptrack/TuningDialog.h 2011-07-28 20:51:57 UTC (rev 932)
@@ -7,6 +7,7 @@
#include <string>
#include "afxcmn.h"
#include "afxwin.h"
+#include "resource.h"
using std::vector;
using std::string;
Modified: trunk/OpenMPT/mptrack/misc_util.h
===================================================================
--- trunk/OpenMPT/mptrack/misc_util.h 2011-07-28 14:59:55 UTC (rev 931)
+++ trunk/OpenMPT/mptrack/misc_util.h 2011-07-28 20:51:57 UTC (rev 932)
@@ -4,9 +4,11 @@
#include <sstream>
#include <string>
#include <limits>
+#include "typedefs.h"
#if _HAS_TR1
#include <type_traits>
#endif
+#include <io.h> // for _taccess
//Convert object(typically number) to string
template<class T>
@@ -245,6 +247,9 @@
// Like std::max, but avoids conflict with max-macro.
template <class T> inline const T& Max(const T& a, const T& b) {return (std::max)(a, b);}
+ // Like std::min, but avoids conflict with min-macro.
+ template <class T> inline const T& Min(const T& a, const T& b) {return (std::min)(a, b);}
+
// Returns maximum value of given integer type.
template <class T> inline T MaxValueOfType(const T&) {static_assert(std::numeric_limits<T>::is_integer == true, "Only interger types are allowed."); return (std::numeric_limits<T>::max)();}
@@ -260,5 +265,12 @@
}}; // namespace Util::sdTime
+namespace Util { namespace sdOs
+{
+ /// Checks whether file or folder exists and whether it has the given mode.
+ enum FileMode {FileModeExists = 0, FileModeRead = 4, FileModeWrite = 2, FileModeReadWrite = 6};
+ inline bool IsPathFileAvailable(LPCTSTR pszFilePath, FileMode fm) {return (_taccess(pszFilePath, fm) == 0);}
+} } // namespace Util::sdOs
+
#endif
Modified: trunk/OpenMPT/mptrack/mptrack.rc
===================================================================
--- trunk/OpenMPT/mptrack/mptrack.rc 2011-07-28 14:59:55 UTC (rev 931)
+++ trunk/OpenMPT/mptrack/mptrack.rc 2011-07-28 20:51:57 UTC (rev 932)
@@ -13,7 +13,7 @@
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
-// Deutsch (Deutschland) resources
+// German (Germany) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_DEU)
#ifdef _WIN32
@@ -148,7 +148,6 @@
PUSHBUTTON "Add",IDC_BUTTON_ADD,174,78,50,14
END
-
IDD_EDITHISTORY DIALOGEX 0, 0, 316, 185
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Module edit history"
@@ -300,12 +299,12 @@
END
#endif // APSTUDIO_INVOKED
-#endif // Deutsch (Deutschland) resources
+#endif // German (Germany) resources
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
-// Englisch (USA) resources
+// English (U.S.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
@@ -1982,10 +1981,12 @@
MENUITEM "IT &Project", ID_NEW_ITPROJECT
MENUITEM "Open&MPT Module", ID_NEW_MPT
END
- MENUITEM "&Open...\tCtrl+O", 57601
+ MENUITEM "&Open...\tCtrl+O", ID_FILE_OPEN
+ MENUITEM "Open template", 65535
MENUITEM "&Close", ID_FILE_CLOSE
MENUITEM "&Save\tCtrl+S", ID_FILE_SAVE
MENUITEM "Save &As...", ID_FILE_SAVE_AS
+ MENUITEM "Save as Template...", ID_FILE_SAVEASTEMPLATE
MENUITEM "Export &unraped...", ID_FILE_SAVECOMPAT
MENUITEM "Export as &Wave...", ID_FILE_SAVEASWAVE
MENUITEM "Export as M&P3...", ID_FILE_SAVEASMP3
@@ -2070,6 +2071,8 @@
MENUITEM "&Search...", ID_HELP_SEARCH
MENUITEM "&Report a bug", ID_REPORT_BUG
MENUITEM SEPARATOR
+ MENUITEM "&Example modules", ID_EXAMPLE_MODULES
+ MENUITEM SEPARATOR
MENUITEM "&OpenMPT Website", ID_NETLINK_MODPLUG
MENUITEM "&Web Resources", ID_NETLINK_TOP_PICKS
MENUITEM SEPARATOR
@@ -2481,16 +2484,27 @@
IDS_TUNING_IMPORT_UNRECOGNIZED_FILE
"-Unable to import file ""%1%2"": unrecognized file.\n"
IDS_SOUNDTOUCH_LOADFAILURE "Unable to load OpenMPT_soundtouch_i16.dll."
+ IDS_UNABLE_TO_CREATE_USER_TEMPLATE_FOLDER
+ """Error: Unable to create template folder '%1'"""
+ IDS_FILE_DOES_NOT_EXIST "The file '%1' does not exist"
+ IDS_FILE_EXISTS_BUT_IS_NOT_READABLE
+ "The file '%1' exists but can't be read"
END
STRINGTABLE
BEGIN
ID_PANIC "Kill all VSTi and sample voices\nStop all hanging VSTi and sample voices"
ID_VIEW_EDITHISTORY "View the edit history of this module"
+ ID_FILE_SAVEASTEMPLATE "Save the active document as template module\nSave as Template"
END
STRINGTABLE
BEGIN
+ ID_FILE_OPENTEMPLATE "Open a template document\nOpen template document"
+END
+
+STRINGTABLE
+BEGIN
ID_VIEW_MIDIMAPPING "Configure the MIDI Mapping"
END
@@ -2510,12 +2524,12 @@
IDC_SAMPLE_XFADE "Crossfade Loop Points\nCrossfade between loop start and loop end to create seamless sample loops."
END
-#endif // Englisch (USA) resources
+#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
-// Englisch (GB) resources
+// English (U.K.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENG)
#ifdef _WIN32
@@ -2888,7 +2902,7 @@
//
IDR_BUILTIN_TUNINGS TUNING "res\\built-inTunings.tc"
-#endif // Englisch (GB) resources
+#endif // English (U.K.) resources
/////////////////////////////////////////////////////////////////////////////
Modified: trunk/OpenMPT/mptrack/resource.h
===================================================================
--- trunk/OpenMPT/mptrack/resource.h 2011-07-28 14:59:55 UTC (rev 931)
+++ trunk/OpenMPT/mptrack/resource.h 2011-07-28 20:51:57 UTC (rev 932)
@@ -67,6 +67,9 @@
#define IDS_TUNING_IMPORT_SCL_FAILURE 228
#define IDS_TUNING_IMPORT_UNRECOGNIZED_FILE 229
#define IDS_SOUNDTOUCH_LOADFAILURE 230
+#define IDS_UNABLE_TO_CREATE_USER_TEMPLATE_FOLDER 231
+#define IDS_FILE_DOES_NOT_EXIST 232
+#define IDS_FILE_EXISTS_BUT_IS_NOT_READABLE 233
#define IDB_MAINBAR 300
#define IDB_IMAGELIST 301
#define IDB_PATTERNS 302
@@ -1124,6 +1127,10 @@
#define ID_GROW_SELECTION 40001
#define ID_SHRINK_SELECTION 40002
#define ID_RUN_SCRIPT 40003
+#define ID_EXAMPLE_MODULES 40004
+#define ID_EXAMPLE_MODULES_LASTINRANGE 40053
+#define ID_FILE_OPENTEMPLATE 40054
+#define ID_FILE_OPENTEMPLATE_LASTINRANGE 40103
#define IDS_ERR_FILEOPEN 55001
#define IDS_ERR_FILETYPE 55002
#define IDS_ERR_SAVEINS 55003
@@ -1189,6 +1196,8 @@
#define ID_VIEW_MPTHACKS 60456
#define ID_PLUGINTOINSTRUMENT 60457
#define ID_INTERNETUPDATE 60458
+#define ID_HELP_EXAMPLEMODULES 60459
+#define ID_FILE_SAVEASTEMPLATE 60460
// Next default values for new objects
//
@@ -1196,7 +1205,7 @@
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_3D_CONTROLS 1
#define _APS_NEXT_RESOURCE_VALUE 530
-#define _APS_NEXT_COMMAND_VALUE 60459
+#define _APS_NEXT_COMMAND_VALUE 60461
#define _APS_NEXT_CONTROL_VALUE 2436
#define _APS_NEXT_SYMED_VALUE 901
#endif
Modified: trunk/OpenMPT/mptrack/test/test.cpp
===================================================================
--- trunk/OpenMPT/mptrack/test/test.cpp 2011-07-28 14:59:55 UTC (rev 931)
+++ trunk/OpenMPT/mptrack/test/test.cpp 2011-07-28 20:51:57 UTC (rev 932)
@@ -203,6 +203,23 @@
VERIFY_EQUAL(MODCOMMAND::IsPcNote(NOTE_MAX), false);
VERIFY_EQUAL(MODCOMMAND::IsPcNote(NOTE_PC), true);
VERIFY_EQUAL(MODCOMMAND::IsPcNote(NOTE_PCS), true);
+
+ VERIFY_EQUAL(CModSpecifications::ExtensionToType(_T(".mod")), MOD_TYPE_MOD);
+ VERIFY_EQUAL(CModSpecifications::ExtensionToType(_T("mod")), MOD_TYPE_MOD);
+ VERIFY_EQUAL(CModSpecifications::ExtensionToType(_T(".s3m")), MOD_TYPE_S3M);
+ VERIFY_EQUAL(CModSpecifications::ExtensionToType(_T("s3m")), MOD_TYPE_S3M);
+ VERIFY_EQUAL(CModSpecifications::ExtensionToType(_T(".xm")), MOD_TYPE_XM);
+ VERIFY_EQUAL(CModSpecifications::ExtensionToType(_T("xm")), MOD_TYPE_XM);
+ VERIFY_EQUAL(CModSpecifications::ExtensionToType(_T(".it")), MOD_TYPE_IT);
+ VERIFY_EQUAL(CModSpecifications::ExtensionToType(_T("it")), MOD_TYPE_IT);
+ VERIFY_EQUAL(CModSpecifications::ExtensionToType(_T(".itp")), MOD_TYPE_IT);
+ VERIFY_EQUAL(CModSpecifications::ExtensionToType(_T("itp")), MOD_TYPE_IT);
+ VERIFY_EQUAL(CModSpecifications::ExtensionToType(_T("mptm")), MOD_TYPE_MPT);
+ VERIFY_EQUAL(CModSpecifications::ExtensionToType(_T("invalidExtension")), MOD_TYPE_NONE);
+ VERIFY_EQUAL(CModSpecifications::ExtensionToType(_T("ita")), MOD_TYPE_NONE);
+ VERIFY_EQUAL(CModSpecifications::ExtensionToType(_T("s2m")), MOD_TYPE_NONE);
+ VERIFY_EQUAL(CModSpecifications::ExtensionToType(_T("")), MOD_TYPE_NONE);
+ VERIFY_EQUAL(CModSpecifications::ExtensionToType(LPCTSTR(nullptr)), MOD_TYPE_NONE);
}
Modified: trunk/OpenMPT/mptrack/tuningRatioMapWnd.h
===================================================================
--- trunk/OpenMPT/mptrack/tuningRatioMapWnd.h 2011-07-28 14:59:55 UTC (rev 931)
+++ trunk/OpenMPT/mptrack/tuningRatioMapWnd.h 2011-07-28 20:51:57 UTC (rev 932)
@@ -1,7 +1,7 @@
#ifndef TUNINGRATIOMAPWND_H
#define TUNINGRATIOMAPWND_H
-#include "../soundlib/tuningbase.h"
+#include "../soundlib/tuning.h"
class CTuningDialog;
Modified: trunk/OpenMPT/soundlib/SNDDEVX.H
===================================================================
--- trunk/OpenMPT/soundlib/SNDDEVX.H 2011-07-28 14:59:55 UTC (rev 931)
+++ trunk/OpenMPT/soundlib/SNDDEVX.H 2011-07-28 20:51:57 UTC (rev 932)
@@ -2,6 +2,7 @@
#define _SNDDEVX_H_
#include <mmsystem.h>
+#include "snddev.h"
#ifndef NO_DSOUND
#include <dsound.h>
Modified: trunk/OpenMPT/soundlib/mod_specifications.cpp
===================================================================
--- trunk/OpenMPT/soundlib/mod_specifications.cpp 2011-07-28 14:59:55 UTC (rev 931)
+++ trunk/OpenMPT/soundlib/mod_specifications.cpp 2011-07-28 20:51:57 UTC (rev 932)
@@ -1,6 +1,34 @@
#include <stdafx.h>
#include "mod_specifications.h"
+MODTYPE CModSpecifications::ExtensionToType(LPCTSTR pszExt)
+{
+ if (pszExt == nullptr)
+ return MOD_TYPE_NONE;
+ if (pszExt[0] == '.')
+ pszExt++;
+ char szExtA[CountOf(ModSpecs::mod.fileExtension)];
+ MemsetZero(szExtA);
+ size_t i = 0;
+ const size_t nLength = _tcslen(pszExt);
+ if (nLength >= CountOf(szExtA))
+ return MOD_TYPE_NONE;
+ for(i = 0; i<nLength; ++i)
+ szExtA[i] = static_cast<char>(pszExt[i]);
+ if (!lstrcmpiA(szExtA, ModSpecs::mod.fileExtension) || !lstrcmpiA(szExtA, ModSpecs::modEx.fileExtension))
+ return MOD_TYPE_MOD;
+ else if (!lstrcmpiA(szExtA, ModSpecs::s3m.fileExtension) || !lstrcmpiA(szExtA, ModSpecs::s3mEx.fileExtension))
+ return MOD_TYPE_S3M;
+ else if (!lstrcmpiA(szExtA, ModSpecs::xm.fileExtension) || !lstrcmpiA(szExtA, ModSpecs::xmEx.fileExtension))
+ return MOD_TYPE_XM;
+ else if (!lstrcmpiA(szExtA, ModSpecs::it.fileExtension) || !lstrcmpiA(szExtA, ModSpecs::itEx.fileExtension)
+ || !lstrcmpi(szExtA, _T("itp")))
+ return MOD_TYPE_IT;
+ else if (!lstrcmpiA(szExtA, ModSpecs::mptm.fileExtension))
+ return MOD_TYPE_MPT;
+ else
+ return MOD_TYPE_NONE;
+}
bool CModSpecifications::HasNote(MODCOMMAND::NOTE note) const
//------------------------------------------------------------
Modified: trunk/OpenMPT/soundlib/mod_specifications.h
===================================================================
--- trunk/OpenMPT/soundlib/mod_specifications.h 2011-07-28 14:59:55 UTC (rev 931)
+++ trunk/OpenMPT/soundlib/mod_specifications.h 2011-07-28 20:51:57 UTC (rev 932)
@@ -10,6 +10,10 @@
struct CModSpecifications
//=======================
{
+ /// Returns modtype corresponding to given file extension. The extension string
+ /// may begin with or without dot, e.g. both ".it" and "it" will be handled correctly.
+ static MODTYPE ExtensionToType(LPCTSTR pszExt);
+
// Return true if format supports given note.
bool HasNote(MODCOMMAND::NOTE note) const;
bool HasVolCommand(MODCOMMAND::VOLCMD volcmd) const;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sag...@us...> - 2011-07-28 15:00:02
|
Revision: 931
http://modplug.svn.sourceforge.net/modplug/?rev=931&view=rev
Author: saga-games
Date: 2011-07-28 14:59:55 +0000 (Thu, 28 Jul 2011)
Log Message:
-----------
[Imp] When using the channel search in the Find/Replace dialog, swapped channel numbers are now treated correctly
[Imp] Find/Replace dialog limits volume column parameters better now. It's still possible to do something like "Search for volume command d, replace by volume parameter 24", though...
[Ref] Macro config loading/saving has been moved to TrackerSettings
[Ref] More refactoring
Modified Paths:
--------------
trunk/OpenMPT/mptrack/Draw_pat.cpp
trunk/OpenMPT/mptrack/Mainfrm.h
trunk/OpenMPT/mptrack/Mptrack.cpp
trunk/OpenMPT/mptrack/PatternEditorDialogs.cpp
trunk/OpenMPT/mptrack/PatternEditorDialogs.h
trunk/OpenMPT/mptrack/TrackerSettings.cpp
trunk/OpenMPT/mptrack/TrackerSettings.h
trunk/OpenMPT/mptrack/misc_util.cpp
Modified: trunk/OpenMPT/mptrack/Draw_pat.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Draw_pat.cpp 2011-07-28 14:56:16 UTC (rev 930)
+++ trunk/OpenMPT/mptrack/Draw_pat.cpp 2011-07-28 14:59:55 UTC (rev 931)
@@ -17,7 +17,7 @@
#define COLHDR_HEIGHT 16 // Column header
#define COLUMN_HEIGHT 13
#define VUMETERS_HEIGHT 13 // Height of vu-meters
-#define PLUGNAME_HEIGHT 16 // Height of vu-meters
+#define PLUGNAME_HEIGHT 16 // Height of plugin names
#define VUMETERS_BMPWIDTH 32
#define VUMETERS_BMPHEIGHT 10
#define VUMETERS_MEDWIDTH 24
@@ -102,7 +102,7 @@
// Effect colour codes
// Effect number => Effect colour assignment
-const BYTE effectColors[] =
+const int effectColors[] =
{
0, 0, MODCOLOR_PITCH, MODCOLOR_PITCH,
MODCOLOR_PITCH, MODCOLOR_PITCH, MODCOLOR_VOLUME, MODCOLOR_VOLUME,
@@ -119,7 +119,7 @@
STATIC_ASSERT(CountOf(effectColors) == MAX_EFFECTS);
// Volume effect number => Effect colour assignment
-const BYTE volEffectColors[] =
+const int volEffectColors[] =
{
0, MODCOLOR_VOLUME, MODCOLOR_PANNING, MODCOLOR_VOLUME,
MODCOLOR_VOLUME, MODCOLOR_VOLUME, MODCOLOR_VOLUME, MODCOLOR_PITCH,
@@ -342,7 +342,7 @@
void CViewPattern::DrawNote(int x, int y, UINT note, CTuning* pTuning)
-//---------------------------------------------------------------------------
+//--------------------------------------------------------------------
{
PCPATTERNFONT pfnt = GetCurrentPatternFont();
Modified: trunk/OpenMPT/mptrack/Mainfrm.h
===================================================================
--- trunk/OpenMPT/mptrack/Mainfrm.h 2011-07-28 14:56:16 UTC (rev 930)
+++ trunk/OpenMPT/mptrack/Mainfrm.h 2011-07-28 14:59:55 UTC (rev 931)
@@ -165,7 +165,7 @@
// Pattern Setup (contains also non-pattern related settings)
// Feel free to replace the deprecated flags by new flags, but be sure to
-// update CMainFrame::LoadIniSettings() as well.
+// update TrackerSettings::LoadINISettings() / TrackerSettings::LoadRegistrySettings() as well.
#define PATTERN_PLAYNEWNOTE 0x01 // play new notes while recording
#define PATTERN_LARGECOMMENTS 0x02 // use large font in comments
#define PATTERN_STDHIGHLIGHT 0x04 // enable primary highlight (measures)
Modified: trunk/OpenMPT/mptrack/Mptrack.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Mptrack.cpp 2011-07-28 14:56:16 UTC (rev 930)
+++ trunk/OpenMPT/mptrack/Mptrack.cpp 2011-07-28 14:59:55 UTC (rev 931)
@@ -849,24 +849,6 @@
// Load Midi Library
if (m_szConfigFileName[0]) ImportMidiConfig(m_szConfigFileName);
- // Load default macro configuration
- for (UINT isfx=0; isfx<16; isfx++)
- {
- CHAR s[64], snam[32];
- wsprintf(snam, "SF%X", isfx);
- GetPrivateProfileString("Zxx Macros", snam, m_MidiCfg.szMidiSFXExt[isfx], s, CountOf(s), m_szConfigFileName);
- s[MACRO_LENGTH - 1] = 0;
- memcpy(m_MidiCfg.szMidiSFXExt[isfx], s, MACRO_LENGTH);
- }
- for (UINT izxx=0; izxx<128; izxx++)
- {
- CHAR s[64], snam[32];
- wsprintf(snam, "Z%02X", izxx|0x80);
- GetPrivateProfileString("Zxx Macros", snam, m_MidiCfg.szMidiZXXExt[izxx], s, CountOf(s), m_szConfigFileName);
- s[MACRO_LENGTH - 1] = 0;
- memcpy(m_MidiCfg.szMidiZXXExt[izxx], s, MACRO_LENGTH);
- }
-
// create main MDI Frame window
CMainFrame* pMainFrame = new CMainFrame(/*cmdInfo.m_csExtension*/);
if (!pMainFrame->LoadFrame(IDR_MAINFRAME)) return FALSE;
@@ -972,26 +954,7 @@
gpDLSBanks[i] = NULL;
}
}
- // Save default macro configuration
- if (m_szConfigFileName[0])
- {
- for (UINT isfx=0; isfx<16; isfx++)
- {
- CHAR s[64], snam[32];
- wsprintf(snam, "SF%X", isfx);
- memcpy(s, m_MidiCfg.szMidiSFXExt[isfx], MACRO_LENGTH);
- s[31] = 0;
- if (!WritePrivateProfileString("Zxx Macros", snam, s, m_szConfigFileName)) break;
- }
- for (UINT izxx=0; izxx<128; izxx++)
- {
- CHAR s[64], snam[32];
- wsprintf(snam, "Z%02X", izxx|0x80);
- memcpy(s, m_MidiCfg.szMidiZXXExt[izxx], MACRO_LENGTH);
- s[MACRO_LENGTH - 1] = 0;
- if (!WritePrivateProfileString("Zxx Macros", snam, s, m_szConfigFileName)) break;
- }
- }
+
// Uninitialize DX-Plugins
UninitializeDXPlugins();
Modified: trunk/OpenMPT/mptrack/PatternEditorDialogs.cpp
===================================================================
--- trunk/OpenMPT/mptrack/PatternEditorDialogs.cpp 2011-07-28 14:56:16 UTC (rev 930)
+++ trunk/OpenMPT/mptrack/PatternEditorDialogs.cpp 2011-07-28 14:59:55 UTC (rev 931)
@@ -260,6 +260,7 @@
}
}
ChangeEffect();
+ ChangeVolCmd();
OnCheckChannelSearch();
return TRUE;
}
@@ -285,6 +286,7 @@
int newpos;
if (oldcount) newpos = combo->GetCurSel() % newcount; else newpos = m_nParam % newcount;
combo->ResetContent();
+ combo->InitStorage(newcount, 4);
for (UINT i=0; i<newcount; i++)
{
wsprintf(s, (newcount == 256) ? "%02X" : "%X", i);
@@ -296,6 +298,43 @@
}
+void CFindReplaceTab::ChangeVolCmd()
+//----------------------------------
+{
+ int fxndx = -1;
+ CComboBox *combo;
+ if ((combo = (CComboBox *)GetDlgItem(IDC_COMBO3)) != NULL)
+ {
+ fxndx = combo->GetItemData(combo->GetCurSel());
+ }
+ // Update Param range
+ if (((combo = (CComboBox *)GetDlgItem(IDC_COMBO4)) != NULL) && (m_pModDoc))
+ {
+ DWORD rangeMin, rangeMax;
+ if(!m_pModDoc->GetVolCmdInfo(fxndx, nullptr, &rangeMin, &rangeMax))
+ {
+ rangeMin = 0;
+ rangeMax = 64;
+ }
+ UINT oldcount = combo->GetCount();
+ UINT newcount = rangeMax - rangeMin + 1;
+ if (oldcount != newcount)
+ {
+ CHAR s[16];
+ int newpos;
+ if (oldcount) newpos = combo->GetCurSel() % newcount; else newpos = m_nParam % newcount;
+ combo->ResetContent();
+ for (UINT i = rangeMin; i <= rangeMax; i++)
+ {
+ wsprintf(s, (rangeMax < 10) ? "%d" : "%02d", i);
+ combo->SetItemData(combo->AddString(s), i);
+ }
+ combo->SetCurSel(newpos);
+ }
+ }
+}
+
+
void CFindReplaceTab::OnCheckChannelSearch()
//------------------------------------------
{
@@ -389,7 +428,10 @@
{
m_nMinChannel = GetDlgItemInt(IDC_EDIT1) - 1;
m_nMaxChannel = GetDlgItemInt(IDC_EDIT2) - 1;
- if (m_nMaxChannel < m_nMinChannel) m_nMaxChannel = m_nMinChannel;
+ if (m_nMaxChannel < m_nMinChannel)
+ {
+ std::swap(m_nMinChannel, m_nMaxChannel);
+ }
}
CPropertyPage::OnOK();
}
Modified: trunk/OpenMPT/mptrack/PatternEditorDialogs.h
===================================================================
--- trunk/OpenMPT/mptrack/PatternEditorDialogs.h 2011-07-28 14:56:16 UTC (rev 930)
+++ trunk/OpenMPT/mptrack/PatternEditorDialogs.h 2011-07-28 14:59:55 UTC (rev 931)
@@ -67,6 +67,7 @@
protected:
void ChangeEffect();
+ void ChangeVolCmd();
public:
CFindReplaceTab(UINT nIDD, bool bReplaceTab, CModDoc *pModDoc):CPropertyPage(nIDD) { m_bReplace = bReplaceTab; m_pModDoc = pModDoc; }
@@ -79,7 +80,7 @@
void CheckOnChange(int nIDButton) { CheckDlgButton(nIDButton, BST_CHECKED); CheckReplace(nIDButton); };
afx_msg void OnNoteChanged() { CheckOnChange(IDC_CHECK1); };
afx_msg void OnInstrChanged() { CheckOnChange(IDC_CHECK2); };
- afx_msg void OnVolCmdChanged() { CheckOnChange(IDC_CHECK3); };
+ afx_msg void OnVolCmdChanged() { CheckOnChange(IDC_CHECK3); ChangeVolCmd(); };
afx_msg void OnVolumeChanged() { CheckOnChange(IDC_CHECK4); };
afx_msg void OnEffectChanged() { CheckOnChange(IDC_CHECK5); ChangeEffect(); };
afx_msg void OnParamChanged() { CheckOnChange(IDC_CHECK6); };
Modified: trunk/OpenMPT/mptrack/TrackerSettings.cpp
===================================================================
--- trunk/OpenMPT/mptrack/TrackerSettings.cpp 2011-07-28 14:56:16 UTC (rev 930)
+++ trunk/OpenMPT/mptrack/TrackerSettings.cpp 2011-07-28 14:59:55 UTC (rev 931)
@@ -17,7 +17,6 @@
#include "snddev.h"
#include "version.h"
#include "UpdateCheck.h"
-#include "Ctrl_pat.h"
#include "Mpdlgs.h"
#include "AutoSaver.h"
#include "TrackerSettings.h"
@@ -150,20 +149,20 @@
Chords[ichord].notes[0] = 0;
Chords[ichord].notes[1] = 0;
Chords[ichord].notes[2] = 0;
- // Major Chords
+
if (ichord < 12)
{
+ // Major Chords
Chords[ichord].notes[0] = (BYTE)(ichord+5);
Chords[ichord].notes[1] = (BYTE)(ichord+8);
Chords[ichord].notes[2] = (BYTE)(ichord+11);
- } else
+ } else if (ichord < 24)
+ {
// Minor Chords
- if (ichord < 24)
- {
- Chords[ichord].notes[0] = (BYTE)(ichord-8);
- Chords[ichord].notes[1] = (BYTE)(ichord-4);
- Chords[ichord].notes[2] = (BYTE)(ichord-1);
- }
+ Chords[ichord].notes[0] = (BYTE)(ichord-8);
+ Chords[ichord].notes[1] = (BYTE)(ichord-4);
+ Chords[ichord].notes[2] = (BYTE)(ichord-1);
+ }
}
gnPlugWindowX = 243;
@@ -178,17 +177,40 @@
void TrackerSettings::LoadSettings()
//----------------------------------
{
- CString storedVersion = CMainFrame::GetPrivateProfileCString("Version", "Version", "", theApp.GetConfigFileName());
+ const CString iniFile = theApp.GetConfigFileName();
+
+ CString storedVersion = CMainFrame::GetPrivateProfileCString("Version", "Version", "", iniFile);
// If version number stored in INI is 1.17.02.40 or later, always load setting from INI file.
// If it isn't, try loading from Registry first, then from the INI file.
if (storedVersion >= "1.17.02.40" || !LoadRegistrySettings())
{
- LoadINISettings();
+ LoadINISettings(iniFile);
}
+ // The following stuff was also stored in mptrack.ini while the registry was still being used...
+
// Load Chords
theApp.LoadChords(Chords);
+ // Load default macro configuration
+ MODMIDICFG macros;
+ theApp.GetDefaultMidiMacro(¯os);
+ for(int isfx = 0; isfx < 16; isfx++)
+ {
+ CHAR snam[8];
+ wsprintf(snam, "SF%X", isfx);
+ GetPrivateProfileString("Zxx Macros", snam, macros.szMidiSFXExt[isfx], macros.szMidiSFXExt[isfx], CountOf(macros.szMidiSFXExt[isfx]), iniFile);
+ SetNullTerminator(macros.szMidiSFXExt[isfx]);
+ }
+ for(int izxx = 0; izxx < 128; izxx++)
+ {
+ CHAR snam[8];
+ wsprintf(snam, "Z%02X", izxx | 0x80);
+ GetPrivateProfileString("Zxx Macros", snam, macros.szMidiZXXExt[izxx], macros.szMidiZXXExt[izxx], CountOf(macros.szMidiZXXExt[izxx]), iniFile);
+ SetNullTerminator(macros.szMidiZXXExt[izxx]);
+ }
+ theApp.SetDefaultMidiMacro(¯os);
+
// Default directory location
for(UINT i = 0; i < NUM_DIRS; i++)
{
@@ -198,10 +220,9 @@
}
-void TrackerSettings::LoadINISettings()
-//-------------------------------------
+void TrackerSettings::LoadINISettings(const CString &iniFile)
+//----------------------------------------------------------
{
- CString iniFile = theApp.GetConfigFileName();
//CHAR collectedString[INIBUFFERSIZE];
MptVersion::VersionNum vIniVersion;
@@ -392,7 +413,7 @@
CMainFrame::m_pAutoSaver->SetPath(szPath);
CMainFrame::m_pAutoSaver->SetFilenameTemplate(CMainFrame::GetPrivateProfileCString("AutoSave", "FileNameTemplate", "", iniFile));
- GetPrivateProfileString("Misc", "DefaultModType", gdefaultModType->fileExtension, szPath, INIBUFFERSIZE, iniFile);
+ GetPrivateProfileString("Misc", "DefaultModType", defaultModType->fileExtension, szPath, INIBUFFERSIZE, iniFile);
// for(size_t i = 0; i < CountOf(ModSpecs::Collection); i++)
// {
// if(!strcmp(szPath, ModSpecs::Collection[i]->fileExtension))
@@ -718,7 +739,21 @@
theApp.SaveChords(Chords);
- WritePrivateProfileString("Misc", "DefaultModType", gdefaultModType->fileExtension, iniFile);
+ // Save default macro configuration
+ MODMIDICFG macros;
+ theApp.GetDefaultMidiMacro(¯os);
+ for(int isfx = 0; isfx < 16; isfx++)
+ {
+ CHAR snam[8];
+ wsprintf(snam, "SF%X", isfx);
+ WritePrivateProfileString("Zxx Macros", snam, macros.szMidiSFXExt[isfx], iniFile);
+ }
+ for(int izxx = 0; izxx < 128; izxx++)
+ {
+ CHAR snam[8];
+ wsprintf(snam, "Z%02X", izxx | 0x80);
+ if (!WritePrivateProfileString("Zxx Macros", snam, macros.szMidiZXXExt[izxx], iniFile)) break;
+ }
CMainFrame::GetMainFrame()->SaveBarState("Toolbars");
}
Modified: trunk/OpenMPT/mptrack/TrackerSettings.h
===================================================================
--- trunk/OpenMPT/mptrack/TrackerSettings.h 2011-07-28 14:56:16 UTC (rev 930)
+++ trunk/OpenMPT/mptrack/TrackerSettings.h 2011-07-28 14:59:55 UTC (rev 931)
@@ -42,7 +42,7 @@
glInstrumentWindowHeight, glCommentsWindowHeight, glGraphWindowHeight; //rewbs.varWindowSize
CString gcsPreviousVersion;
CString gcsInstallGUID;
- CModSpecifications const *gdefaultModType;
+ CModSpecifications const *defaultModType;
// Audio Setup
DWORD m_dwSoundSetup, m_dwRate, m_dwQuality, m_nSrcMode, m_nBitsPerSample, m_nPreAmp, gbLoopSong, m_nChannels;
LONG m_nWaveDevice; // use the SNDDEV_GET_NUMBER and SNDDEV_GET_TYPE macros to decode
@@ -103,7 +103,7 @@
protected:
- void LoadINISettings();
+ void LoadINISettings(const CString &iniFile);
bool LoadRegistrySettings();
void SetDirectory(const LPCTSTR szFilenameFrom, Directory dir, TCHAR (&pDirs)[NUM_DIRS][_MAX_PATH], bool bStripFilename);
Modified: trunk/OpenMPT/mptrack/misc_util.cpp
===================================================================
--- trunk/OpenMPT/mptrack/misc_util.cpp 2011-07-28 14:56:16 UTC (rev 930)
+++ trunk/OpenMPT/mptrack/misc_util.cpp 2011-07-28 14:59:55 UTC (rev 931)
@@ -31,25 +31,24 @@
}
-// Returns error message corresponding to error code returned by GetLastError().
+// Returns WinAPI error message corresponding to error code returned by GetLastError().
CString GetErrorMessage(DWORD nErrorCode)
//---------------------------------------
{
- const size_t nBufferSize = 256;
- CString sMsg;
- LPTSTR pszBuf = sMsg.GetBuffer(nBufferSize);
+ LPVOID lpMsgBuf;
- FormatMessage( FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
+ FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
NULL,
nErrorCode,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
- pszBuf,
- nBufferSize,
+ (LPTSTR)&lpMsgBuf,
+ 0,
NULL );
- sMsg.ReleaseBuffer();
+ CString msg = (LPTSTR)lpMsgBuf;
+ LocalFree(lpMsgBuf);
- return sMsg;
+ return msg;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sag...@us...> - 2011-07-28 14:56:22
|
Revision: 930
http://modplug.svn.sourceforge.net/modplug/?rev=930&view=rev
Author: saga-games
Date: 2011-07-28 14:56:16 +0000 (Thu, 28 Jul 2011)
Log Message:
-----------
[Mod] Modern/Alternative tempo mode is not shown for XM/IT files anymore by default.
[Fix] Mod Conversion: Sample panning is now properly reset / disabled for MOD/S3M/XM files.
[Imp] Undo point is now also created when renaming a channel from the pattern view.
[Ref] Small refactoring here and there
Modified Paths:
--------------
trunk/OpenMPT/mptrack/ModConvert.cpp
trunk/OpenMPT/mptrack/Modedit.cpp
trunk/OpenMPT/mptrack/View_pat.cpp
trunk/OpenMPT/mptrack/dlg_misc.cpp
Modified: trunk/OpenMPT/mptrack/ModConvert.cpp
===================================================================
--- trunk/OpenMPT/mptrack/ModConvert.cpp 2011-07-26 19:04:08 UTC (rev 929)
+++ trunk/OpenMPT/mptrack/ModConvert.cpp 2011-07-28 14:56:16 UTC (rev 930)
@@ -174,18 +174,18 @@
// This is used for -> MOD/XM conversion
vector<vector<MODCOMMAND::PARAM> > cEffectMemory;
- cEffectMemory.resize(m_SndFile.GetNumChannels());
- for(size_t i = 0; i < m_SndFile.GetNumChannels(); i++)
+ cEffectMemory.resize(GetNumChannels());
+ for(size_t i = 0; i < GetNumChannels(); i++)
{
cEffectMemory[i].resize(MAX_EFFECTS, 0);
}
bool addBreak = false; // When converting to XM, avoid the E60 bug.
- CHANNELINDEX nChannel = m_SndFile.m_nChannels - 1;
+ CHANNELINDEX nChannel = GetNumChannels() - 1;
for (UINT len = m_SndFile.Patterns[nPat].GetNumRows() * m_SndFile.m_nChannels; len; m++, len--)
{
- nChannel = (nChannel + 1) % m_SndFile.m_nChannels; // 0...Channels - 1
+ nChannel = (nChannel + 1) % GetNumChannels(); // 0...Channels - 1
m_SndFile.ConvertCommand(m, nOldType, nNewType);
@@ -301,11 +301,10 @@
m_SndFile.Samples[nSmp].nFineTune = 0;
}
- // Frequency to Transpose, panning (S3M/IT/MPT to MOD/XM)
+ // Frequency to Transpose (S3M/IT/MPT to MOD/XM)
if(oldTypeIsS3M_IT_MPT && newTypeIsMOD_XM)
{
CSoundFile::FrequencyToTranspose(&m_SndFile.Samples[nSmp]);
- if (!(m_SndFile.Samples[nSmp].uFlags & CHN_PANNING)) m_SndFile.Samples[nSmp].nPan = 128;
// No relative note for MOD files
// TODO: Pattern notes could be transposed based on the previous relative tone?
if(newTypeIsMOD && m_SndFile.Samples[nSmp].RelativeTone != 0)
@@ -315,6 +314,21 @@
}
}
+ // All XM samples have default panning
+ if(newTypeIsXM)
+ {
+ if(!(m_SndFile.Samples[nSmp].uFlags & CHN_PANNING))
+ {
+ m_SndFile.Samples[nSmp].uFlags |= CHN_PANNING;
+ m_SndFile.Samples[nSmp].nPan = 128;
+ }
+ }
+ // S3M / MOD samples don't have panning.
+ if(newTypeIsMOD || newTypeIsS3M)
+ {
+ m_SndFile.Samples[nSmp].uFlags &= ~CHN_PANNING;
+ }
+
if(oldTypeIsXM && newTypeIsIT_MPT)
{
// Autovibrato settings (XM to IT, where sweep 0 means "no vibrato")
@@ -394,7 +408,7 @@
}
// Fix channel settings (pan/vol)
- for(CHANNELINDEX nChn = 0; nChn < m_SndFile.m_nChannels; nChn++)
+ for(CHANNELINDEX nChn = 0; nChn < GetNumChannels(); nChn++)
{
if(newTypeIsMOD_XM || newTypeIsS3M)
{
@@ -405,7 +419,7 @@
CHANGEMODTYPE_WARNING(wChannelVolSurround);
}
}
- if(newTypeIsXM && !oldTypeIsMOD_XM)
+ if(newTypeIsXM)
{
if(m_SndFile.ChnSettings[nChn].nPan != 128)
{
@@ -514,7 +528,7 @@
//rewbs.customKeys: update effect key commands
CInputHandler *ih = CMainFrame::GetMainFrame()->GetInputHandler();
- if (newTypeIsMOD_XM)
+ if(newTypeIsMOD_XM)
ih->SetXMEffects();
else
ih->SetITEffects();
Modified: trunk/OpenMPT/mptrack/Modedit.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Modedit.cpp 2011-07-26 19:04:08 UTC (rev 929)
+++ trunk/OpenMPT/mptrack/Modedit.cpp 2011-07-28 14:56:16 UTC (rev 930)
@@ -156,6 +156,12 @@
return CHANNELINDEX_INVALID;
}
+ if(m_SndFile.Patterns.Size() == 0)
+ {
+ // Nothing to do
+ return GetNumChannels();
+ }
+
bool first = true;
// Find highest valid pattern number for storing channel undo data with, since the pattern with the highest number will be undone first.
PATTERNINDEX highestPattern = 0;
@@ -645,14 +651,17 @@
bool CModDoc::RemoveSample(SAMPLEINDEX nSmp)
//------------------------------------------
{
- if ((nSmp) && (nSmp <= m_SndFile.m_nSamples))
+ if ((nSmp) && (nSmp <= m_SndFile.GetNumSamples()))
{
BEGIN_CRITICAL();
m_SndFile.DestroySample(nSmp);
m_SndFile.m_szNames[nSmp][0] = 0;
- while ((m_SndFile.m_nSamples > 1)
- && (!m_SndFile.m_szNames[m_SndFile.m_nSamples][0])
- && (!m_SndFile.Samples[m_SndFile.m_nSamples].pSample)) m_SndFile.m_nSamples--;
+ while ((m_SndFile.GetNumSamples() > 1)
+ && (!m_SndFile.m_szNames[m_SndFile.GetNumSamples()][0])
+ && (!m_SndFile.Samples[m_SndFile.GetNumSamples()].pSample))
+ {
+ m_SndFile.m_nSamples--;
+ }
END_CRITICAL();
SetModified();
return true;
@@ -664,14 +673,14 @@
bool CModDoc::RemoveInstrument(INSTRUMENTINDEX nIns)
//--------------------------------------------------
{
- if ((nIns) && (nIns <= m_SndFile.m_nInstruments) && (m_SndFile.Instruments[nIns]))
+ if ((nIns) && (nIns <= m_SndFile.GetNumInstruments()) && (m_SndFile.Instruments[nIns]))
{
- BOOL bIns = FALSE;
+ bool instrumentsLeft = false;
BEGIN_CRITICAL();
m_SndFile.DestroyInstrument(nIns);
if (nIns == m_SndFile.m_nInstruments) m_SndFile.m_nInstruments--;
- for (UINT i=1; i<MAX_INSTRUMENTS; i++) if (m_SndFile.Instruments[i]) bIns = TRUE;
- if (!bIns) m_SndFile.m_nInstruments = 0;
+ for (UINT i=1; i<MAX_INSTRUMENTS; i++) if (m_SndFile.Instruments[i]) instrumentsLeft = true;
+ if (!instrumentsLeft) m_SndFile.m_nInstruments = 0;
END_CRITICAL();
SetModified();
return true;
Modified: trunk/OpenMPT/mptrack/View_pat.cpp
===================================================================
--- trunk/OpenMPT/mptrack/View_pat.cpp 2011-07-26 19:04:08 UTC (rev 929)
+++ trunk/OpenMPT/mptrack/View_pat.cpp 2011-07-28 14:56:16 UTC (rev 930)
@@ -766,9 +766,9 @@
if (!p) return;
BeginWaitCursor();
- DWORD startSel = ((m_dwBeginSel>>16)<(m_dwEndSel>>16)) ? m_dwBeginSel : m_dwEndSel;
- DWORD endSel = ((m_dwBeginSel>>16)<(m_dwEndSel>>16)) ? m_dwEndSel : m_dwBeginSel;
- pModDoc->GetPatternUndo()->PrepareUndo(m_nPattern, 0, 0, pSndFile->m_nChannels, pSndFile->Patterns[m_nPattern].GetNumRows());
+ const DWORD startSel = (GetRowFromCursor(m_dwBeginSel) < GetRowFromCursor(m_dwEndSel)) ? m_dwBeginSel : m_dwEndSel;
+ const DWORD endSel = (GetRowFromCursor(m_dwBeginSel) < GetRowFromCursor(m_dwEndSel)) ? m_dwEndSel : m_dwBeginSel;
+ pModDoc->GetPatternUndo()->PrepareUndo(m_nPattern, 0, 0, pSndFile->GetNumChannels(), pSndFile->Patterns[m_nPattern].GetNumRows());
int finalDest = GetRowFromCursor(startSel) + (GetRowFromCursor(endSel) - GetRowFromCursor(startSel))*2;
for (int row = finalDest; row > (int)GetRowFromCursor(startSel); row -= 2)
@@ -816,9 +816,9 @@
if (!p) return;
BeginWaitCursor();
- DWORD startSel = ((m_dwBeginSel>>16)<(m_dwEndSel>>16)) ? m_dwBeginSel : m_dwEndSel;
- DWORD endSel = ((m_dwBeginSel>>16)<(m_dwEndSel>>16)) ? m_dwEndSel : m_dwBeginSel;
- pModDoc->GetPatternUndo()->PrepareUndo(m_nPattern, 0, 0, pSndFile->m_nChannels, pSndFile->Patterns[m_nPattern].GetNumRows());
+ const DWORD startSel = (GetRowFromCursor(m_dwBeginSel) < GetRowFromCursor(m_dwEndSel)) ? m_dwBeginSel : m_dwEndSel;
+ const DWORD endSel = (GetRowFromCursor(m_dwBeginSel) < GetRowFromCursor(m_dwEndSel)) ? m_dwEndSel : m_dwBeginSel;
+ pModDoc->GetPatternUndo()->PrepareUndo(m_nPattern, 0, 0, pSndFile->GetNumChannels(), pSndFile->Patterns[m_nPattern].GetNumRows());
int finalDest = GetRowFromCursor(startSel) + (GetRowFromCursor(endSel) - GetRowFromCursor(startSel))/2;
@@ -5613,6 +5613,9 @@
CChannelRenameDlg dlg(this, pSndFile->ChnSettings[nChn].szName, nChn + 1);
if(dlg.DoModal() != IDOK || dlg.bChanged == false) return;
+ // Backup old name.
+ pModDoc->GetPatternUndo()->PrepareUndo(m_nPattern, 0, 0, 1, 1, false, true);
+
strcpy(pSndFile->ChnSettings[nChn].szName, dlg.m_sName);
pModDoc->SetModified();
pModDoc->UpdateAllViews(NULL, HINT_MODCHANNELS);
@@ -5719,7 +5722,7 @@
for (UINT r=startRow; r<endRow+1; r++)
{
- p = pSndFile->Patterns[m_nPattern] + r * pSndFile->m_nChannels + startChan;
+ p = pSndFile->Patterns[m_nPattern] + r * pSndFile->GetNumChannels() + startChan;
for (UINT c = startChan; c < endChan + 1; c++, p++)
{
// If a note or an instr is present on the row, do the change, if required.
Modified: trunk/OpenMPT/mptrack/dlg_misc.cpp
===================================================================
--- trunk/OpenMPT/mptrack/dlg_misc.cpp 2011-07-26 19:04:08 UTC (rev 929)
+++ trunk/OpenMPT/mptrack/dlg_misc.cpp 2011-07-28 14:56:16 UTC (rev 930)
@@ -95,9 +95,14 @@
UpdateChannelCBox();
+ // Don't show new tempo modes for XM/IT, unless they are currently used
+ const bool showNewTempoModes = (m_pSndFile->GetType() == MOD_TYPE_MPT || (m_pSndFile->m_dwSongFlags & SONG_ITPROJECT) != 0);
+
m_TempoModeBox.SetItemData(m_TempoModeBox.AddString("Classic"), tempo_mode_classic);
- m_TempoModeBox.SetItemData(m_TempoModeBox.AddString("Alternative"), tempo_mode_alternative);
- m_TempoModeBox.SetItemData(m_TempoModeBox.AddString("Modern (accurate)"), tempo_mode_modern);
+ if(showNewTempoModes || m_pSndFile->m_nTempoMode == tempo_mode_alternative)
+ m_TempoModeBox.SetItemData(m_TempoModeBox.AddString("Alternative"), tempo_mode_alternative);
+ if(showNewTempoModes || m_pSndFile->m_nTempoMode == tempo_mode_modern)
+ m_TempoModeBox.SetItemData(m_TempoModeBox.AddString("Modern (accurate)"), tempo_mode_modern);
m_TempoModeBox.SetCurSel(0);
for(int i = m_TempoModeBox.GetCount(); i > 0; i--)
{
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|