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
(45) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: <sag...@us...> - 2009-10-18 16:54:29
|
Revision: 401
http://modplug.svn.sourceforge.net/modplug/?rev=401&view=rev
Author: saga-games
Date: 2009-10-18 16:54:18 +0000 (Sun, 18 Oct 2009)
Log Message:
-----------
[New] Treeview: Display playing samples / instruments (only those that are assigned to a sample). Can be enabled from setup screen.
[Fix] Treeview: Broke when changing sequence count of a module from 1 to 2
[Fix] AMF Loader: Missing break command
[Ref] More internal refactoring.
Modified Paths:
--------------
trunk/OpenMPT/mptrack/Ctrl_gen.cpp
trunk/OpenMPT/mptrack/Ctrl_ins.h
trunk/OpenMPT/mptrack/Ctrl_pat.cpp
trunk/OpenMPT/mptrack/Ctrl_pat.h
trunk/OpenMPT/mptrack/Mainfrm.h
trunk/OpenMPT/mptrack/Moddoc.cpp
trunk/OpenMPT/mptrack/Moddoc.h
trunk/OpenMPT/mptrack/Moptions.cpp
trunk/OpenMPT/mptrack/PatternRandomizerGUI.cpp
trunk/OpenMPT/mptrack/View_tre.cpp
trunk/OpenMPT/mptrack/View_tre.h
trunk/OpenMPT/mptrack/Vstplug.cpp
trunk/OpenMPT/mptrack/Vstplug.h
trunk/OpenMPT/mptrack/res/img_list.bmp
trunk/OpenMPT/soundlib/LOAD_AMF.CPP
trunk/OpenMPT/soundlib/Sndfile.cpp
trunk/OpenMPT/soundlib/Sndfile.h
Modified: trunk/OpenMPT/mptrack/Ctrl_gen.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Ctrl_gen.cpp 2009-10-16 19:53:27 UTC (rev 400)
+++ trunk/OpenMPT/mptrack/Ctrl_gen.cpp 2009-10-18 16:54:18 UTC (rev 401)
@@ -463,7 +463,7 @@
m_EditRestartPos.GetWindowText(s, sizeof(s));
if (s[0])
{
- UINT n = atoi(s);
+ ORDERINDEX n = (ORDERINDEX)atoi(s);
n = CLAMP(n, 0, m_pSndFile->Order.size());
for (ORDERINDEX i = 0; i <= n; i++)
if (m_pSndFile->Order[i] == m_pSndFile->Order.GetInvalidPatIndex()) return;
Modified: trunk/OpenMPT/mptrack/Ctrl_ins.h
===================================================================
--- trunk/OpenMPT/mptrack/Ctrl_ins.h 2009-10-16 19:53:27 UTC (rev 400)
+++ trunk/OpenMPT/mptrack/Ctrl_ins.h 2009-10-18 16:54:18 UTC (rev 401)
@@ -71,7 +71,7 @@
CSliderCtrl m_SliderVolSwing, m_SliderPanSwing, m_SliderCutSwing, m_SliderResSwing,
m_SliderCutOff, m_SliderResonance;
CNoteMapWnd m_NoteMap;
- UINT m_nInstrument;
+ INSTRUMENTINDEX m_nInstrument;
// -> CODE#0027
// -> DESC="per-instrument volume ramping setup (refered as attack)"
Modified: trunk/OpenMPT/mptrack/Ctrl_pat.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Ctrl_pat.cpp 2009-10-16 19:53:27 UTC (rev 400)
+++ trunk/OpenMPT/mptrack/Ctrl_pat.cpp 2009-10-18 16:54:18 UTC (rev 401)
@@ -1166,7 +1166,7 @@
{
m_pSndFile->Order.m_sName = str;
m_pModDoc->SetModified();
- m_pModDoc->UpdateAllViews(NULL, HINT_SEQNAMES, this);
+ m_pModDoc->UpdateAllViews(NULL, (m_pSndFile->Order.GetCurrentSequenceIndex() << HINT_SHIFT_SEQUENCE) | HINT_SEQNAMES, this);
}
}
}
Modified: trunk/OpenMPT/mptrack/Ctrl_pat.h
===================================================================
--- trunk/OpenMPT/mptrack/Ctrl_pat.h 2009-10-16 19:53:27 UTC (rev 400)
+++ trunk/OpenMPT/mptrack/Ctrl_pat.h 2009-10-18 16:54:18 UTC (rev 401)
@@ -154,7 +154,8 @@
CPatEdit m_EditSpacing, m_EditPatName, m_EditOrderListMargins;
CSpinButtonCtrl m_SpinInstrument, m_SpinSpacing, m_SpinOrderListMargins;
CModControlBar m_ToolBar;
- UINT m_nInstrument, m_nDetailLevel;
+ INSTRUMENTINDEX m_nInstrument;
+ UINT m_nDetailLevel;
BOOL m_bRecord, m_bVUMeters, m_bPluginNames;
// -> CODE#0012
// -> DESC="midi keyboard split"
Modified: trunk/OpenMPT/mptrack/Mainfrm.h
===================================================================
--- trunk/OpenMPT/mptrack/Mainfrm.h 2009-10-16 19:53:27 UTC (rev 400)
+++ trunk/OpenMPT/mptrack/Mainfrm.h 2009-10-18 16:54:18 UTC (rev 401)
@@ -170,49 +170,39 @@
#define NUM_VUMETER_PENS 32
// Pattern Setup (contains also non-pattern related settings)
-#define PATTERN_PLAYNEWNOTE 0x01
-#define PATTERN_LARGECOMMENTS 0x02
-#define PATTERN_STDHIGHLIGHT 0x04
-#define PATTERN_SMALLFONT 0x08
-#define PATTERN_CENTERROW 0x10
-#define PATTERN_WRAP 0x20
-#define PATTERN_EFFECTHILIGHT 0x40
-#define PATTERN_HEXDISPLAY 0x80
-#define PATTERN_FLATBUTTONS 0x100
-#define PATTERN_CREATEBACKUP 0x200
-#define PATTERN_SINGLEEXPAND 0x400
-#define PATTERN_AUTOSPACEBAR 0x800
-#define PATTERN_NOEXTRALOUD 0x1000
-#define PATTERN_DRAGNDROPEDIT 0x2000
-#define PATTERN_2NDHIGHLIGHT 0x4000
-#define PATTERN_MUTECHNMODE 0x8000
-#define PATTERN_SHOWPREVIOUS 0x10000
-#define PATTERN_CONTSCROLL 0x20000
-#define PATTERN_KBDNOTEOFF 0x40000
-#define PATTERN_FOLLOWSONGOFF 0x80000 //rewbs.noFollow
+#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
+#define PATTERN_SMALLFONT 0x08 // use small font in pattern editor
+#define PATTERN_CENTERROW 0x10 // always center active row
+#define PATTERN_WRAP 0x20 // wrap around cursor in editor
+#define PATTERN_EFFECTHILIGHT 0x40 // effect syntax highlighting
+#define PATTERN_HEXDISPLAY 0x80 // display row number in hex
+#define PATTERN_FLATBUTTONS 0x100 // flat toolbar buttons
+#define PATTERN_CREATEBACKUP 0x200 // create .bak files when saving
+#define PATTERN_SINGLEEXPAND 0x400 // single click to expand tree
+#define PATTERN_AUTOSPACEBAR 0x800 // space bar repeats previous action
+#define PATTERN_NOEXTRALOUD 0x1000 // no loud samples in sample editor
+#define PATTERN_DRAGNDROPEDIT 0x2000 // enable drag and drop editing
+#define PATTERN_2NDHIGHLIGHT 0x4000 // activate secondary highlight
+#define PATTERN_MUTECHNMODE 0x8000 // ignore muted channels
+#define PATTERN_SHOWPREVIOUS 0x10000 // show prev/next patterns
+#define PATTERN_CONTSCROLL 0x20000 // continous pattern scrolling
+#define PATTERN_KBDNOTEOFF 0x40000 // Record note-off events
+#define PATTERN_FOLLOWSONGOFF 0x80000 // follow song off by default
+#define PATTERN_MIDIRECORD 0x100000 // MIDI Record on by default
+//#define PATTERN_ALTERNTIVEBPMSPEED 0x200000 // deprecated
+#define PATTERN_HILITETIMESIGS 0x400000 // highlight on song signature
+#define PATTERN_OLDCTXMENUSTYLE 0x800000 // mpt 1.16 pattern context menu style
+#define PATTERN_SYNCMUTE 0x1000000 // maintain sample sync on mute
+#define PATTERN_AUTODELAY 0x2000000 // automatically insert delay commands in pattern when entering notes
+#define PATTERN_NOTEFADE 0x4000000 // alt. note fade behaviour when entering notes
+#define PATTERN_OVERFLOWPASTE 0x8000000 // continue paste in the next pattern instead of cutting off
+#define PATTERN_POSITIONAWARETIMER 0x10000000 // try to set the timer in the statusbar when jumping around in modules
+#define PATTERN_RESETCHANNELS 0x20000000 // reset channels when looping
+#define PATTERN_LIVEUPDATETREE 0x40000000 // update active sample / instr icons in treeview
-// -> CODE#0017
-// -> DESC="midi in record mode setup option"
-#define PATTERN_MIDIRECORD 0x100000
-// -! BEHAVIOUR_CHANGE#0017
-// -> CODE#0022
-// -> DESC="alternative BPM/Speed interpretation method"
-#define PATTERN_ALTERNTIVEBPMSPEED 0x200000
-// rewbs: this options is now available under song settings. It is therefore saved with the song.
-// -! NEW_FEATURE#0022
-
-#define PATTERN_HILITETIMESIGS 0x400000
-
-#define PATTERN_OLDCTXMENUSTYLE 0x800000
-#define PATTERN_SYNCMUTE 0x1000000
-#define PATTERN_AUTODELAY 0x2000000
-#define PATTERN_NOTEFADE 0x4000000
-#define PATTERN_OVERFLOWPASTE 0x8000000
-#define PATTERN_POSITIONAWARETIMER 0x10000000
-#define PATTERN_RESETCHANNELS 0x20000000
-
-
// Keyboard Setup
enum {
KEYBOARD_CUSTOM=0,
@@ -263,7 +253,9 @@
IMAGE_ASIO,
IMAGE_GRAPH,
IMAGE_SAMPLEMUTE,
- IMAGE_INSTRMUTE
+ IMAGE_INSTRMUTE,
+ IMAGE_SAMPLEACTIVE,
+ IMAGE_INSTRACTIVE,
};
//////////////////////////////////////////////////////////////////////////
Modified: trunk/OpenMPT/mptrack/Moddoc.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Moddoc.cpp 2009-10-16 19:53:27 UTC (rev 400)
+++ trunk/OpenMPT/mptrack/Moddoc.cpp 2009-10-18 16:54:18 UTC (rev 401)
@@ -199,7 +199,7 @@
BeginWaitCursor();
LPMIDILIBSTRUCT lpMidiLib = CTrackApp::GetMidiLibrary();
// Scan Instruments
- if (lpMidiLib) for (UINT nIns=1; nIns<=m_SndFile.m_nInstruments; nIns++) if (m_SndFile.Instruments[nIns])
+ if (lpMidiLib) for (INSTRUMENTINDEX nIns = 1; nIns <= m_SndFile.m_nInstruments; nIns++) if (m_SndFile.Instruments[nIns])
{
LPCSTR pszMidiMapName;
MODINSTRUMENT *pIns = m_SndFile.Instruments[nIns];
@@ -433,7 +433,7 @@
if(unsavedInstrument && ::MessageBox(NULL,"Do you want to save modified instruments ?",NULL,MB_ICONQUESTION | MB_YESNO | MB_APPLMODAL) == IDYES){
- for(UINT i = 0 ; i < m_SndFile.m_nInstruments ; i++){
+ 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;
@@ -1707,13 +1707,13 @@
m_SndFile.m_nRow = nRow;
} else
{
- for (UINT i=0; i<m_SndFile.Order.size(); i++)
+ for (ORDERINDEX nOrd = 0; nOrd < m_SndFile.Order.size(); nOrd++)
{
- if (m_SndFile.Order[i] == m_SndFile.Order.GetInvalidPatIndex()) break;
- if (m_SndFile.Order[i] == nPat)
+ if (m_SndFile.Order[nOrd] == m_SndFile.Order.GetInvalidPatIndex()) break;
+ if (m_SndFile.Order[nOrd] == nPat)
{
- m_SndFile.m_nCurrentPattern = i;
- m_SndFile.m_nNextPattern = i;
+ m_SndFile.m_nCurrentPattern = nOrd;
+ m_SndFile.m_nNextPattern = nOrd;
m_SndFile.m_nNextRow = nNextRow;
m_SndFile.m_nRow = nRow;
break;
Modified: trunk/OpenMPT/mptrack/Moddoc.h
===================================================================
--- trunk/OpenMPT/mptrack/Moddoc.h 2009-10-16 19:53:27 UTC (rev 400)
+++ trunk/OpenMPT/mptrack/Moddoc.h 2009-10-18 16:54:18 UTC (rev 401)
@@ -70,6 +70,7 @@
#define HINT_BITS_SAMPLE 12
#define HINT_BITS_INST 8
#define HINT_BITS_CHNTAB 8
+#define HINT_BITS_SEQUENCE 6
//Defines bit shift values used for setting/retrieving the additional hint data to/from hint parameter.
#define HINT_SHIFT_PAT (32 - HINT_BITS_PATTERN)
@@ -77,6 +78,7 @@
#define HINT_SHIFT_SMP (32 - HINT_BITS_SAMPLE)
#define HINT_SHIFT_INS (32 - HINT_BITS_INST)
#define HINT_SHIFT_CHNTAB (32 - HINT_BITS_CHNTAB)
+#define HINT_SHIFT_SEQUENCE (32 - HINT_BITS_SEQUENCE)
//Check that hint bit counts are not too large given the number of hint flags.
STATIC_ASSERT( ((-1 << HINT_SHIFT_PAT) & HINT_MASK_ITEM) == (-1 << HINT_SHIFT_PAT) );
@@ -84,6 +86,7 @@
STATIC_ASSERT( ((-1 << HINT_SHIFT_SMP) & HINT_MASK_ITEM) == (-1 << HINT_SHIFT_SMP) );
STATIC_ASSERT( ((-1 << HINT_SHIFT_INS) & HINT_MASK_ITEM) == (-1 << HINT_SHIFT_INS) );
STATIC_ASSERT( ((-1 << HINT_SHIFT_CHNTAB) & HINT_MASK_ITEM) == (-1 << HINT_SHIFT_CHNTAB) );
+STATIC_ASSERT( ((-1 << HINT_SHIFT_SEQUENCE) & HINT_MASK_ITEM) == (-1 << HINT_SHIFT_SEQUENCE) );
Modified: trunk/OpenMPT/mptrack/Moptions.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Moptions.cpp 2009-10-16 19:53:27 UTC (rev 400)
+++ trunk/OpenMPT/mptrack/Moptions.cpp 2009-10-18 16:54:18 UTC (rev 401)
@@ -661,17 +661,8 @@
OPTGEN_SHOWPREVIOUS,
OPTGEN_CONTSCROLL,
OPTGEN_KBDNOTEOFF,
- OPTGEN_FOLLOWSONGOFF, //rewbs.noFollow
-// -> CODE#0017
-// -> DESC="midi in record mode setup option"
+ OPTGEN_FOLLOWSONGOFF,
OPTGEN_MIDIRECORD,
-// -! BEHAVIOUR_CHANGE#0017
-
-// -> CODE#0022
-// -> DESC="alternative BPM/Speed interpretation method"
-// OPTGEN_ALTERNTIVEBPMSPEED,
-// rewbs: this options is now available under song settings. It is therefore saved with the song.
-// -! NEW_FEATURE#0022
OPTGEN_PATTERNCTXMENUSTYLE,
OPTGEN_SYNCMUTE,
OPTGEN_AUTODELAY,
@@ -679,6 +670,7 @@
OPTGEN_OVERFLOWPASTE,
OPTGEN_POSITIONAWARETIMER,
OPTGEN_RESETCHANNELS,
+ OPTGEN_LIVEUPDATETREE,
OPTGEN_MAXOPTIONS
};
@@ -699,18 +691,8 @@
{"Show Prev/Next patterns", "Displays grayed-out version of the previous/next patterns in the pattern editor. Does not work if \"always center active row\" is disabled."},
{"Continuous scroll", "Jumps to the next pattern when moving past the end of a pattern"},
{"Record note off", "Record note off when a key is released on the PC keyboard (Only works in instrument mode)."},
- {"Follow song off by default", "Ensure follow song is off when opening or starting a new song."}, //rewbs.noFollow
-// -> CODE#0017
-// -> DESC="midi in record mode setup option"
+ {"Follow song off by default", "Ensure follow song is off when opening or starting a new song."},
{"Midi record", "Enable midi in record by default."},
-// -! BEHAVIOUR_CHANGE#0017
-
-// -> CODE#0022
-// -> DESC="alternative BPM/Speed interpretation method"
-// {"Alternative BPM/Speed", "Alternative BPM/Speed interpretation where speed represents the number of tempo ticks per pattern row."},
-// rewbs: this options is now available under song settings. It is therefore saved with the song.
-// -! NEW_FEATURE#0022
-
{"Old style pattern context menu", "Check this option to hide unavailable items in the pattern editor context menu. Uncheck to grey-out unavailable items instead."},
{"Maintain sample sync on mute", "Samples continue to be processed when channels are muted (like in IT2 and FT2)"},
{"Automatic delay commands", "Automatically insert appropriate note-delay commands when recording notes during live playback."},
@@ -718,6 +700,7 @@
{"Overflow paste mode", "Wrap pasted pattern data into next pattern. This is useful for creating echo channels."},
{"Position aware timer", "If enabled, timer will show the playback position time if possible instead of running timer."},
{"Reset channels on loop", "If enabled, channels will be reset to their initial state when song looping is enabled.\nNote: This does not affect manual song loops (i.e. triggered by pattern commands)"},
+ {"Update sample status in tree", "If enabled, active samples and instruments will be indicated by a differnt icon in the treeview."}
};
@@ -763,26 +746,16 @@
case OPTGEN_SHOWPREVIOUS: bCheck = (CMainFrame::m_dwPatternSetup & PATTERN_SHOWPREVIOUS); break;
case OPTGEN_CONTSCROLL: bCheck = (CMainFrame::m_dwPatternSetup & PATTERN_CONTSCROLL); break;
case OPTGEN_KBDNOTEOFF: bCheck = (CMainFrame::m_dwPatternSetup & PATTERN_KBDNOTEOFF); break;
- case OPTGEN_FOLLOWSONGOFF: bCheck = (CMainFrame::m_dwPatternSetup & PATTERN_FOLLOWSONGOFF); break; //rewbs.noFollow
-
-// -> CODE#0017
-// -> DESC="midi in record mode setup option"
+ case OPTGEN_FOLLOWSONGOFF: bCheck = (CMainFrame::m_dwPatternSetup & PATTERN_FOLLOWSONGOFF); break;
case OPTGEN_MIDIRECORD: bCheck = (CMainFrame::m_dwPatternSetup & PATTERN_MIDIRECORD); break;
-// -! BEHAVIOUR_CHANGE#0017
-
-// -> CODE#0022
-// -> DESC="alternative BPM/Speed interpretation method"
-// case OPTGEN_ALTERNTIVEBPMSPEED: bCheck = (CMainFrame::m_dwPatternSetup & PATTERN_ALTERNTIVEBPMSPEED); break;
-// rewbs: this options is now available under song settings. It is therefore saved with the song.
-// -! NEW_FEATURE#0022
- case OPTGEN_PATTERNCTXMENUSTYLE: bCheck = (CMainFrame::m_dwPatternSetup & PATTERN_OLDCTXMENUSTYLE); break;
- case OPTGEN_SYNCMUTE: bCheck = (CMainFrame::m_dwPatternSetup & PATTERN_SYNCMUTE); break;
-
+ case OPTGEN_PATTERNCTXMENUSTYLE: bCheck = (CMainFrame::m_dwPatternSetup & PATTERN_OLDCTXMENUSTYLE); break;
+ case OPTGEN_SYNCMUTE: bCheck = (CMainFrame::m_dwPatternSetup & PATTERN_SYNCMUTE); break;
case OPTGEN_AUTODELAY: bCheck = (CMainFrame::m_dwPatternSetup & PATTERN_AUTODELAY); break;
case OPTGEN_PATNOTEFADE: bCheck = (CMainFrame::m_dwPatternSetup & PATTERN_NOTEFADE); break;
case OPTGEN_OVERFLOWPASTE: bCheck = (CMainFrame::m_dwPatternSetup & PATTERN_OVERFLOWPASTE); break;
case OPTGEN_POSITIONAWARETIMER: bCheck = (CMainFrame::m_dwPatternSetup & PATTERN_POSITIONAWARETIMER); break;
- case OPTGEN_RESETCHANNELS: bCheck = (CMainFrame::m_dwPatternSetup & PATTERN_RESETCHANNELS); break;
+ case OPTGEN_RESETCHANNELS: bCheck = (CMainFrame::m_dwPatternSetup & PATTERN_RESETCHANNELS); break;
+ case OPTGEN_LIVEUPDATETREE: bCheck = (CMainFrame::m_dwPatternSetup & PATTERN_LIVEUPDATETREE); break;
}
m_CheckList.SetCheck(i, (bCheck) ? TRUE : FALSE);
}
@@ -832,26 +805,16 @@
case OPTGEN_SHOWPREVIOUS: mask = PATTERN_SHOWPREVIOUS; break;
case OPTGEN_CONTSCROLL: mask = PATTERN_CONTSCROLL; break;
case OPTGEN_KBDNOTEOFF: mask = PATTERN_KBDNOTEOFF; break;
- case OPTGEN_FOLLOWSONGOFF: mask = PATTERN_FOLLOWSONGOFF; break; //rewbs.noFollow
-
-
-// -> CODE#0017
-// -> DESC="midi in record mode setup option"
+ case OPTGEN_FOLLOWSONGOFF: mask = PATTERN_FOLLOWSONGOFF; break;
case OPTGEN_MIDIRECORD: mask = PATTERN_MIDIRECORD; break;
-// -! BEHAVIOUR_CHANGE#0017
-
-// -> CODE#0022
-// -> DESC="alternative BPM/Speed interpretation method"
-// case OPTGEN_ALTERNTIVEBPMSPEED: mask = PATTERN_ALTERNTIVEBPMSPEED; break;
-// rewbs: this options is now available under song settings. It is therefore saved with the song.
-// -! NEW_FEATURE#0022
case OPTGEN_PATTERNCTXMENUSTYLE: mask = PATTERN_OLDCTXMENUSTYLE; break;
- case OPTGEN_SYNCMUTE: mask = PATTERN_SYNCMUTE; break;
- case OPTGEN_AUTODELAY: mask = PATTERN_AUTODELAY; break;
- case OPTGEN_PATNOTEFADE: mask = PATTERN_NOTEFADE; break;
- case OPTGEN_OVERFLOWPASTE: mask = PATTERN_OVERFLOWPASTE; break;
- case OPTGEN_POSITIONAWARETIMER: mask = PATTERN_POSITIONAWARETIMER; break;
- case OPTGEN_RESETCHANNELS: mask = PATTERN_RESETCHANNELS; break;
+ case OPTGEN_SYNCMUTE: mask = PATTERN_SYNCMUTE; break;
+ case OPTGEN_AUTODELAY: mask = PATTERN_AUTODELAY; break;
+ case OPTGEN_PATNOTEFADE: mask = PATTERN_NOTEFADE; break;
+ case OPTGEN_OVERFLOWPASTE: mask = PATTERN_OVERFLOWPASTE; break;
+ case OPTGEN_POSITIONAWARETIMER: mask = PATTERN_POSITIONAWARETIMER; break;
+ case OPTGEN_RESETCHANNELS: mask = PATTERN_RESETCHANNELS; break;
+ case OPTGEN_LIVEUPDATETREE: mask = PATTERN_LIVEUPDATETREE; break;
}
if (bCheck) CMainFrame::m_dwPatternSetup |= mask; else CMainFrame::m_dwPatternSetup &= ~mask;
Modified: trunk/OpenMPT/mptrack/PatternRandomizerGUI.cpp
===================================================================
--- trunk/OpenMPT/mptrack/PatternRandomizerGUI.cpp 2009-10-16 19:53:27 UTC (rev 400)
+++ trunk/OpenMPT/mptrack/PatternRandomizerGUI.cpp 2009-10-18 16:54:18 UTC (rev 401)
@@ -81,7 +81,7 @@
bool CPatternRandomizerGUI::isVisible() {
//----------------------------------
- return (bool)IsWindowVisible();
+ return IsWindowVisible() ? true : false;
}
Modified: trunk/OpenMPT/mptrack/View_tre.cpp
===================================================================
--- trunk/OpenMPT/mptrack/View_tre.cpp 2009-10-16 19:53:27 UTC (rev 400)
+++ trunk/OpenMPT/mptrack/View_tre.cpp 2009-10-18 16:54:18 UTC (rev 401)
@@ -699,22 +699,19 @@
{
const DWORD nPat = (lHint >> HINT_SHIFT_PAT);
- // only one seq remaining: update parent item || previously only one sequence
+ // (only one seq remaining || previously only one sequence): update parent item
if((pInfo->tiSequences.size() > 1 && pSndFile->Order.GetNumSequences() == 1) || (pInfo->tiSequences.size() == 1 && pSndFile->Order.GetNumSequences() > 1))
{
- if(pInfo->tiOrders.size() != pSndFile->Order.GetNumSequences())
+ for(size_t nSeq = 0; nSeq < pInfo->tiOrders.size(); nSeq++)
{
- for(size_t nSeq = 0; nSeq < pInfo->tiOrders.size(); nSeq++)
+ for(size_t nOrd = 0; nOrd < pInfo->tiOrders[nSeq].size(); nOrd++) if (pInfo->tiOrders[nSeq][nOrd])
{
- for(size_t nOrd = 0; nOrd < pInfo->tiOrders[nSeq].size(); nOrd++) if (pInfo->tiOrders[nSeq][nOrd])
- {
- DeleteItem(pInfo->tiOrders[nSeq][nOrd]); pInfo->tiOrders[nSeq][nOrd] = NULL;
- }
- DeleteItem(pInfo->tiSequences[nSeq]); pInfo->tiSequences[nSeq] = NULL;
+ if(pInfo->tiOrders[nSeq][nOrd]) DeleteItem(pInfo->tiOrders[nSeq][nOrd]); pInfo->tiOrders[nSeq][nOrd] = NULL;
}
- pInfo->tiOrders.resize(pSndFile->Order.GetNumSequences());
- pInfo->tiSequences.resize(pSndFile->Order.GetNumSequences(), NULL);
+ if(pInfo->tiSequences[nSeq]) DeleteItem(pInfo->tiSequences[nSeq]); pInfo->tiSequences[nSeq] = NULL;
}
+ pInfo->tiOrders.resize(pSndFile->Order.GetNumSequences());
+ pInfo->tiSequences.resize(pSndFile->Order.GetNumSequences(), NULL);
}
// If there are too many sequences, delete them.
@@ -734,8 +731,11 @@
HTREEITEM hAncestorNode = pInfo->hOrders;
+ SEQUENCEINDEX nSeqMin = 0, nSeqMax = pSndFile->Order.GetNumSequences() - 1;
+ SEQUENCEINDEX nHintParam = lHint >> HINT_SHIFT_SEQUENCE;
+ if ((hintFlagPart == HINT_SEQNAMES) && (nHintParam <= nSeqMax)) nSeqMin = nSeqMax = nHintParam;
// go through all sequences
- for(SEQUENCEINDEX nSeq = 0; nSeq < pSndFile->Order.GetNumSequences(); nSeq++)
+ for(SEQUENCEINDEX nSeq = nSeqMin; nSeq <= nSeqMax; nSeq++)
{
if(pSndFile->Order.GetNumSequences() > 1)
{
@@ -885,7 +885,8 @@
{
bool bSamplePresent = (pSndFile->Samples[nSmp].pSample) ? true : false;
int nImage = (bSamplePresent) ? IMAGE_SAMPLES : IMAGE_NOSAMPLE;
- if(pInfo->pModDoc->IsSampleMuted(nSmp) && bSamplePresent) nImage = IMAGE_SAMPLEMUTE;
+ if(pInfo->bIsSamplePlaying[nSmp - 1] && bSamplePresent) nImage = IMAGE_SAMPLEACTIVE;
+ if(pInfo->pModDoc->IsSampleMuted(nSmp)) nImage = IMAGE_SAMPLEMUTE;
wsprintf(s, "%3d: %s", nSmp, pSndFile->m_szNames[nSmp]);
if (!pInfo->tiSamples[nSmp])
@@ -952,6 +953,7 @@
}
int nImage = IMAGE_INSTRUMENTS;
+ if(pInfo->bIsInstrPlaying[nIns - 1]) nImage = IMAGE_INSTRACTIVE;
if(pInfo->pModDoc->IsInstrumentMuted(nIns)) nImage = IMAGE_INSTRMUTE;
if (!pInfo->tiInstruments[nIns])
@@ -2037,9 +2039,49 @@
DocInfo[nDocNdx]->nSeqSel = nNewSeq;
UpdateView(nDocNdx, HINT_MODSEQUENCE);
}
+
+ // Update sample / instrument playing status icons (will only detect instruments with samples, though)
+
+ if((CMainFrame::m_dwPatternSetup & PATTERN_LIVEUPDATETREE) == 0) return;
+ // TODO: Is there a way to find out if the treeview is actually visible? Or if the Sample and Instrument folders are collapsed?
+ /*static int nUpdateCount = 0;
+ nUpdateCount++;
+ if(nUpdateCount < 5) return; // don't update too often
+ nUpdateCount = 0;*/
+
+ memset(DocInfo[nDocNdx]->bIsSamplePlaying, false, MAX_SAMPLES * sizeof(bool));
+ memset(DocInfo[nDocNdx]->bIsInstrPlaying, false, MAX_INSTRUMENTS * sizeof(bool));
+
+ CSoundFile *pSndFile = pModDoc->GetSoundFile();
+ if(pSndFile == nullptr) return;
+
+ for(CHANNELINDEX nChn = 0; nChn < MAX_CHANNELS; nChn++)
+ {
+ if(pSndFile->Chn[nChn].nPos > 0)
+ {
+ for(SAMPLEINDEX nSmp = 1; nSmp <= pSndFile->m_nSamples; nSmp++)
+ {
+ if(pSndFile->Chn[nChn].pModSample == &pSndFile->Samples[nSmp])
+ {
+ DocInfo[nDocNdx]->bIsSamplePlaying[nSmp - 1] = true;
+ break;
+ }
+ }
+ for(INSTRUMENTINDEX nIns = 1; nIns <= pSndFile->m_nInstruments; nIns++)
+ {
+ if(pSndFile->Chn[nChn].pModInstrument == pSndFile->Instruments[nIns])
+ {
+ DocInfo[nDocNdx]->bIsInstrPlaying[nIns - 1] = true;
+ break;
+ }
+ }
+ }
+ }
+ UpdateView(nDocNdx, HINT_SAMPLEINFO | HINT_INSTRUMENT);
}
+
/////////////////////////////////////////////////////////////////////////////
// CViewModTree message handlers
Modified: trunk/OpenMPT/mptrack/View_tre.h
===================================================================
--- trunk/OpenMPT/mptrack/View_tre.h 2009-10-16 19:53:27 UTC (rev 400)
+++ trunk/OpenMPT/mptrack/View_tre.h 2009-10-18 16:54:18 UTC (rev 401)
@@ -56,7 +56,8 @@
vector<vector<HTREEITEM> > tiOrders;
vector<HTREEITEM> tiSequences;
HTREEITEM tiEffects[MAX_MIXPLUGINS];
-
+ bool bIsSamplePlaying[MAX_SAMPLES];
+ bool bIsInstrPlaying[MAX_INSTRUMENTS];
MODTREEDOCINFO(const CSoundFile* const pSndFile)
{
@@ -77,6 +78,8 @@
memset(tiSamples, 0, sizeof(tiSamples));
memset(tiInstruments, 0, sizeof(tiInstruments));
memset(tiEffects, 0, sizeof(tiEffects));
+ memset(bIsSamplePlaying, false, MAX_SAMPLES * sizeof(bool));
+ memset(bIsInstrPlaying, false, MAX_INSTRUMENTS * sizeof(bool));
}
};
Modified: trunk/OpenMPT/mptrack/Vstplug.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Vstplug.cpp 2009-10-16 19:53:27 UTC (rev 400)
+++ trunk/OpenMPT/mptrack/Vstplug.cpp 2009-10-18 16:54:18 UTC (rev 401)
@@ -3148,17 +3148,18 @@
//end rewbs.VSTcompliance
-BOOL CVstPlugin::isInstrument() // ericus 18/02/2005
+bool CVstPlugin::isInstrument() // ericus 18/02/2005
//-----------------------------
{
- if(m_pEffect) return ((m_pEffect->flags & effFlagsIsSynth) || (!m_pEffect->numInputs)); // rewbs.dryRatio
- return FALSE;
+ if(m_pEffect) return ((m_pEffect->flags & effFlagsIsSynth) || (!m_pEffect->numInputs)) ? true : false; // rewbs.dryRatio
+ return false;
}
-BOOL CVstPlugin::CanRecieveMidiEvents() {
-//---------------------------------------
+bool CVstPlugin::CanRecieveMidiEvents()
+//-------------------------------------
+{
CString s = "receiveVstMidiEvent";
- return (CVstPlugin::Dispatch(effCanDo, 0, 0, (char*)(LPCTSTR)s, 0));
+ return (CVstPlugin::Dispatch(effCanDo, 0, 0, (char*)(LPCTSTR)s, 0)) ? true : false;
}
bool CVstPlugin::KeysRequired()
Modified: trunk/OpenMPT/mptrack/Vstplug.h
===================================================================
--- trunk/OpenMPT/mptrack/Vstplug.h 2009-10-16 19:53:27 UTC (rev 400)
+++ trunk/OpenMPT/mptrack/Vstplug.h 2009-10-18 16:54:18 UTC (rev 401)
@@ -148,8 +148,8 @@
bool Bypass(); //rewbs.defaultPlugGUI
bool IsBypassed(); //rewbs.defaultPlugGUI
- BOOL isInstrument(); // ericus 18/02/2005
- BOOL CanRecieveMidiEvents();
+ bool isInstrument(); // ericus 18/02/2005
+ bool CanRecieveMidiEvents();
bool KeysRequired();
void GetOutputPlugList(CArray<CVstPlugin*,CVstPlugin*> &list);
Modified: trunk/OpenMPT/mptrack/res/img_list.bmp
===================================================================
(Binary files differ)
Modified: trunk/OpenMPT/soundlib/LOAD_AMF.CPP
===================================================================
--- trunk/OpenMPT/soundlib/LOAD_AMF.CPP 2009-10-16 19:53:27 UTC (rev 400)
+++ trunk/OpenMPT/soundlib/LOAD_AMF.CPP 2009-10-18 16:54:18 UTC (rev 401)
@@ -152,6 +152,7 @@
case 0x17: param = (param+64)&0x7F;
if (m->command) { if (!m->volcmd) { m->volcmd = VOLCMD_PANNING; m->vol = param/2; } command = 0; }
else { command = CMD_PANNING8; }
+ break;
// Unknown effects
default: command = param = 0;
}
Modified: trunk/OpenMPT/soundlib/Sndfile.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Sndfile.cpp 2009-10-16 19:53:27 UTC (rev 400)
+++ trunk/OpenMPT/soundlib/Sndfile.cpp 2009-10-18 16:54:18 UTC (rev 401)
@@ -1112,7 +1112,7 @@
void CSoundFile::SetCurrentPos(UINT nPos)
//---------------------------------------
{
- UINT nPattern;
+ ORDERINDEX nPattern;
BYTE resetMask = (!nPos) ? CHNRESET_SETPOS_FULL : CHNRESET_SETPOS_BASIC;
for (CHANNELINDEX i=0; i<MAX_CHANNELS; i++)
@@ -1178,13 +1178,13 @@
-void CSoundFile::SetCurrentOrder(UINT nPos)
-//-----------------------------------------
+void CSoundFile::SetCurrentOrder(ORDERINDEX nOrder)
+//-----------------------------------------------
{
//while ((nPos < Order.size()) && (Order[nPos] == 0xFE)) nPos++;
- while ((nPos < Order.size()) && (Order[nPos] == Order.GetIgnoreIndex())) nPos++;
- if ((nPos >= Order.size()) || (Order[nPos] >= Patterns.Size())) return;
- for (UINT j=0; j<MAX_CHANNELS; j++)
+ while ((nOrder < Order.size()) && (Order[nOrder] == Order.GetIgnoreIndex())) nOrder++;
+ if ((nOrder >= Order.size()) || (Order[nOrder] >= Patterns.Size())) return;
+ for (CHANNELINDEX j = 0; j < MAX_CHANNELS; j++)
{
Chn[j].nPeriod = 0;
Chn[j].nNote = NOTE_NONE;
@@ -1201,12 +1201,12 @@
}
Chn[j].nTremorCount = 0;
}
- if (!nPos)
+ if (!nOrder)
{
SetCurrentPos(0);
} else
{
- m_nNextPattern = nPos;
+ m_nNextPattern = nOrder;
m_nRow = m_nNextRow = 0;
m_nPattern = 0;
m_nTickCount = m_nMusicSpeed;
@@ -1304,8 +1304,8 @@
-void CSoundFile::LoopPattern(int nPat, int nRow)
-//----------------------------------------------
+void CSoundFile::LoopPattern(PATTERNINDEX nPat, ROWINDEX nRow)
+//------------------------------------------------------------
{
if ((nPat < 0) || (nPat >= Patterns.Size()) || (!Patterns[nPat]))
{
@@ -1324,8 +1324,8 @@
}
}
//rewbs.playSongFromCursor
-void CSoundFile::DontLoopPattern(int nPat, int nRow)
-//----------------------------------------------
+void CSoundFile::DontLoopPattern(PATTERNINDEX nPat, ROWINDEX nRow)
+//----------------------------------------------------------------
{
if ((nPat < 0) || (nPat >= Patterns.Size()) || (!Patterns[nPat])) nPat = 0;
if ((nRow < 0) || (nRow >= (int)PatternSize[nPat])) nRow = 0;
Modified: trunk/OpenMPT/soundlib/Sndfile.h
===================================================================
--- trunk/OpenMPT/soundlib/Sndfile.h 2009-10-16 19:53:27 UTC (rev 400)
+++ trunk/OpenMPT/soundlib/Sndfile.h 2009-10-18 16:54:18 UTC (rev 401)
@@ -306,8 +306,8 @@
virtual bool IsResumed()=0;
virtual void Resume()=0;
virtual void Suspend()=0;
- virtual BOOL isInstrument()=0;
- virtual BOOL CanRecieveMidiEvents()=0;
+ virtual bool isInstrument()=0;
+ virtual bool CanRecieveMidiEvents()=0;
virtual void SetDryRatio(UINT param)=0;
};
@@ -643,9 +643,9 @@
double GetCurrentBPM() const;
ORDERINDEX FindOrder(PATTERNINDEX nPat, UINT startFromOrder=0, bool direction = true); //rewbs.playSongFromCursor
- void DontLoopPattern(int nPat, int nRow=0); //rewbs.playSongFromCursor
+ void DontLoopPattern(PATTERNINDEX nPat, ROWINDEX nRow = 0); //rewbs.playSongFromCursor
void SetCurrentPos(UINT nPos);
- void SetCurrentOrder(UINT nOrder);
+ void SetCurrentOrder(ORDERINDEX nOrder);
void GetTitle(LPSTR s) const { lstrcpyn(s,m_szNames[0],32); }
LPCSTR GetTitle() const { return m_szNames[0]; }
CString GetSampleName(UINT nSample) const;
@@ -667,7 +667,7 @@
void SetRepeatCount(int n) { m_nRepeatCount = n; }
int GetRepeatCount() const { return m_nRepeatCount; }
BOOL IsPaused() const { return (m_dwSongFlags & SONG_PAUSED) ? TRUE : FALSE; }
- void LoopPattern(int nPat, int nRow=0);
+ void LoopPattern(PATTERNINDEX nPat, ROWINDEX nRow = 0);
void CheckCPUUsage(UINT nCPU);
BOOL SetPatternName(UINT nPat, LPCSTR lpszName);
BOOL GetPatternName(UINT nPat, LPSTR lpszName, UINT cbSize=MAX_PATTERNNAME) const;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sag...@us...> - 2009-10-16 19:53:35
|
Revision: 400
http://modplug.svn.sourceforge.net/modplug/?rev=400&view=rev
Author: saga-games
Date: 2009-10-16 19:53:27 +0000 (Fri, 16 Oct 2009)
Log Message:
-----------
[New] Treeview: Muted samples and instruments are shown with a different icon.
[Mod] INI Loader: removed version check for missing colours as rgbCustomColors is initalized properly anyway.
Modified Paths:
--------------
trunk/OpenMPT/mptrack/MainFrm.cpp
trunk/OpenMPT/mptrack/Mainfrm.h
trunk/OpenMPT/mptrack/View_tre.cpp
trunk/OpenMPT/mptrack/View_tre.h
trunk/OpenMPT/mptrack/res/img_list.bmp
Modified: trunk/OpenMPT/mptrack/MainFrm.cpp
===================================================================
--- trunk/OpenMPT/mptrack/MainFrm.cpp 2009-10-15 20:21:28 UTC (rev 399)
+++ trunk/OpenMPT/mptrack/MainFrm.cpp 2009-10-16 19:53:27 UTC (rev 400)
@@ -399,12 +399,6 @@
wsprintf(s, "Color%02d", ncol);
rgbCustomColors[ncol] = GetPrivateProfileDWord("Display", s, rgbCustomColors[ncol], iniFile);
}
- if(rgbCustomColors[MODCOLOR_SEPSHADOW] == rgbCustomColors[MODCOLOR_SEPFACE] == rgbCustomColors[MODCOLOR_SEPHILITE] == 0 && vIniVersion < MAKE_VERSION_NUMERIC(1,17,03,03))
- {
- rgbCustomColors[MODCOLOR_SEPSHADOW] = GetSysColor(COLOR_BTNSHADOW);
- rgbCustomColors[MODCOLOR_SEPFACE] = GetSysColor(COLOR_BTNFACE);
- rgbCustomColors[MODCOLOR_SEPHILITE] = GetSysColor(COLOR_BTNHIGHLIGHT);
- }
m_nWaveDevice = GetPrivateProfileLong("Sound Settings", "WaveDevice", (SNDDEV_DSOUND<<8), iniFile);
m_dwSoundSetup = GetPrivateProfileDWord("Sound Settings", "SoundSetup", SOUNDSETUP_SECONDARY, iniFile);
Modified: trunk/OpenMPT/mptrack/Mainfrm.h
===================================================================
--- trunk/OpenMPT/mptrack/Mainfrm.h 2009-10-15 20:21:28 UTC (rev 399)
+++ trunk/OpenMPT/mptrack/Mainfrm.h 2009-10-16 19:53:27 UTC (rev 400)
@@ -262,6 +262,8 @@
IMAGE_WAVEOUT,
IMAGE_ASIO,
IMAGE_GRAPH,
+ IMAGE_SAMPLEMUTE,
+ IMAGE_INSTRMUTE
};
//////////////////////////////////////////////////////////////////////////
Modified: trunk/OpenMPT/mptrack/View_tre.cpp
===================================================================
--- trunk/OpenMPT/mptrack/View_tre.cpp 2009-10-15 20:21:28 UTC (rev 399)
+++ trunk/OpenMPT/mptrack/View_tre.cpp 2009-10-16 19:53:27 UTC (rev 400)
@@ -277,7 +277,7 @@
VOID CModTree::AddDocument(CModDoc *pModDoc)
//------------------------------------------
{
- UINT nNewNdx = 0xFFFF;
+ UINT nNewNdx = MODTREE_MAX_DOCUMENTS;
// Check if document is already in the list
for (UINT i=0; i<MODTREE_MAX_DOCUMENTS; i++)
{
@@ -313,18 +313,14 @@
VOID CModTree::RemoveDocument(CModDoc *pModDoc)
//---------------------------------------------
{
- for (UINT i=0; i<MODTREE_MAX_DOCUMENTS; i++)
+ UINT nDocNdx = GetDocumentIDFromModDoc(pModDoc);
+ if(nDocNdx >= MODTREE_MAX_DOCUMENTS) return;
+ if (DocInfo[nDocNdx]->hSong)
{
- if ((DocInfo[i]) && (DocInfo[i]->pModDoc == pModDoc))
- {
- if (DocInfo[i]->hSong)
- {
- DeleteItem(DocInfo[i]->hSong);
- }
- delete DocInfo[i];
- DocInfo[i] = NULL;
- }
+ DeleteItem(DocInfo[nDocNdx]->hSong);
}
+ delete DocInfo[nDocNdx];
+ DocInfo[nDocNdx] = NULL;
}
@@ -349,6 +345,20 @@
}
+UINT CModTree::GetDocumentIDFromModDoc(CModDoc *pModDoc)
+//------------------------------------------------------
+{
+ // returns document ID (to access DocInfo[] info)
+ UINT nDocNdx = MODTREE_MAX_DOCUMENTS;
+ for (UINT i = 0; i < MODTREE_MAX_DOCUMENTS; i++)
+ {
+ if (DocInfo[i] && DocInfo[i]->pModDoc == pModDoc)
+ nDocNdx = i;
+ }
+ return nDocNdx;
+}
+
+
/////////////////////////////////////////////////////////////////////////////
// CViewModTree drawing
@@ -866,38 +876,40 @@
// Add Samples
if ((pInfo->hSamples) && (hintFlagPart != HINT_INSNAMES) && (hintFlagPart != HINT_PATNAMES))
{
- const UINT nSmp = (lHint >> HINT_SHIFT_SMP);
- UINT smin = 1, smax = MAX_SAMPLES-1;
+ const SAMPLEINDEX nSmp = (SAMPLEINDEX)(lHint >> HINT_SHIFT_SMP);
+ SAMPLEINDEX smin = 1, smax = MAX_SAMPLES - 1;
if ((hintFlagPart == HINT_SMPNAMES) && (nSmp) && (nSmp < MAX_SAMPLES)) { smin = smax = nSmp; }
- for (UINT iSmp=smin; iSmp<=smax; iSmp++)
+ for(SAMPLEINDEX nSmp = smin; nSmp <= smax; nSmp++)
{
- if (iSmp <= pSndFile->m_nSamples)
+ if (nSmp <= pSndFile->m_nSamples)
{
- bool bSamplePresent = (pSndFile->Samples[iSmp].pSample) ? true : false;
- UINT nImage = (bSamplePresent) ? IMAGE_SAMPLES : IMAGE_NOSAMPLE;
- wsprintf(s, "%3d: %s", iSmp, pSndFile->m_szNames[iSmp]);
- if (!pInfo->tiSamples[iSmp])
+ bool bSamplePresent = (pSndFile->Samples[nSmp].pSample) ? true : false;
+ int nImage = (bSamplePresent) ? IMAGE_SAMPLES : IMAGE_NOSAMPLE;
+ if(pInfo->pModDoc->IsSampleMuted(nSmp) && bSamplePresent) nImage = IMAGE_SAMPLEMUTE;
+
+ wsprintf(s, "%3d: %s", nSmp, pSndFile->m_szNames[nSmp]);
+ if (!pInfo->tiSamples[nSmp])
{
- pInfo->tiSamples[iSmp] = InsertItem(s, nImage, nImage, pInfo->hSamples, TVI_LAST);
+ pInfo->tiSamples[nSmp] = InsertItem(s, nImage, nImage, pInfo->hSamples, TVI_LAST);
} else
{
tvi.mask = TVIF_TEXT | TVIF_HANDLE | TVIF_IMAGE;
- tvi.hItem = pInfo->tiSamples[iSmp];
+ tvi.hItem = pInfo->tiSamples[nSmp];
tvi.pszText = stmp;
tvi.cchTextMax = sizeof(stmp);
tvi.iImage = tvi.iSelectedImage = nImage;
GetItem(&tvi);
- if ((strcmp(s, stmp)) || (tvi.iImage != (int)nImage))
+ if ((strcmp(s, stmp)) || (tvi.iImage != nImage))
{
- SetItem(pInfo->tiSamples[iSmp], TVIF_TEXT|TVIF_IMAGE|TVIF_SELECTEDIMAGE, s, nImage, nImage, 0, 0, 0);
+ SetItem(pInfo->tiSamples[nSmp], TVIF_TEXT|TVIF_IMAGE|TVIF_SELECTEDIMAGE, s, nImage, nImage, 0, 0, 0);
}
}
} else
{
- if (pInfo->tiSamples[iSmp])
+ if (pInfo->tiSamples[nSmp])
{
- DeleteItem(pInfo->tiSamples[iSmp]);
- pInfo->tiSamples[iSmp] = NULL;
+ DeleteItem(pInfo->tiSamples[nSmp]);
+ pInfo->tiSamples[nSmp] = NULL;
}
}
}
@@ -905,8 +917,8 @@
// Add Instruments
if ((pInfo->hInstruments) && (hintFlagPart != HINT_SMPNAMES) && (hintFlagPart != HINT_PATNAMES))
{
- UINT smin = 1, smax = MAX_INSTRUMENTS-1;
- const UINT nIns = (lHint >> HINT_SHIFT_INS);
+ INSTRUMENTINDEX smin = 1, smax = MAX_INSTRUMENTS - 1;
+ const INSTRUMENTINDEX nIns = (INSTRUMENTINDEX)(lHint >> HINT_SHIFT_INS);
if ((hintFlagPart == HINT_INSNAMES) && (nIns) && (nIns < MAX_INSTRUMENTS))
{
smin = smax = nIns;
@@ -924,35 +936,44 @@
}
}
}
- for (UINT iSmp=smin; iSmp<=smax; iSmp++)
+ for (INSTRUMENTINDEX nIns = smin; nIns <= smax; nIns++)
{
- if ((iSmp <= pSndFile->m_nInstruments) && (pSndFile->Instruments[iSmp]))
+ if ((nIns <= pSndFile->m_nInstruments) && (pSndFile->Instruments[nIns]))
{
-// -> CODE#0023
-// -> DESC="IT project files (.itp)"
-// wsprintf(s, "%3d: %s", iSmp, pSndFile->Instruments[iSmp]->name);
- BOOL pathOk = pSndFile->m_szInstrumentPath[iSmp-1][0] != '\0';
- BOOL instOk = pSndFile->instrumentModified[iSmp-1] == FALSE;
- wsprintf(s, pathOk ? (instOk ? "%3d: %s" : "%3d: * %s") : "%3d: ? %s", iSmp, pSndFile->Instruments[iSmp]->name);
-// -! NEW_FEATURE#0023
- if (!pInfo->tiInstruments[iSmp])
+ if((pSndFile->m_dwSongFlags & SONG_ITPROJECT) != 0)
{
- pInfo->tiInstruments[iSmp] = InsertItem(s, IMAGE_INSTRUMENTS, IMAGE_INSTRUMENTS, pInfo->hInstruments, TVI_LAST);
+ // path info for ITP instruments
+ BOOL pathOk = pSndFile->m_szInstrumentPath[nIns-1][0] != '\0';
+ BOOL instOk = pSndFile->instrumentModified[nIns-1] == FALSE;
+ wsprintf(s, pathOk ? (instOk ? "%3d: %s" : "%3d: * %s") : "%3d: ? %s", nIns, pSndFile->Instruments[nIns]->name);
} else
{
- tvi.mask = TVIF_TEXT | TVIF_HANDLE;
- tvi.hItem = pInfo->tiInstruments[iSmp];
+ wsprintf(s, "%3d: %s", nIns, pSndFile->Instruments[nIns]->name);
+ }
+
+ int nImage = IMAGE_INSTRUMENTS;
+ if(pInfo->pModDoc->IsInstrumentMuted(nIns)) nImage = IMAGE_INSTRMUTE;
+
+ if (!pInfo->tiInstruments[nIns])
+ {
+ pInfo->tiInstruments[nIns] = InsertItem(s, nImage, nImage, pInfo->hInstruments, TVI_LAST);
+ } else
+ {
+ tvi.mask = TVIF_TEXT | TVIF_HANDLE | TVIF_IMAGE;
+ tvi.hItem = pInfo->tiInstruments[nIns];
tvi.pszText = stmp;
tvi.cchTextMax = sizeof(stmp);
+ tvi.iImage = tvi.iSelectedImage = nImage;
GetItem(&tvi);
- if (strcmp(s, stmp)) SetItem(pInfo->tiInstruments[iSmp], TVIF_TEXT, s, 0, 0, 0, 0, 0);
+ if ((strcmp(s, stmp)) || (tvi.iImage != nImage))
+ SetItem(pInfo->tiInstruments[nIns], TVIF_TEXT|TVIF_IMAGE|TVIF_SELECTEDIMAGE, s, nImage, nImage, 0, 0, 0);
}
} else
{
- if (pInfo->tiInstruments[iSmp])
+ if (pInfo->tiInstruments[nIns])
{
- DeleteItem(pInfo->tiInstruments[iSmp]);
- pInfo->tiInstruments[iSmp] = NULL;
+ DeleteItem(pInfo->tiInstruments[nIns]);
+ pInfo->tiInstruments[nIns] = NULL;
}
}
}
@@ -2005,17 +2026,16 @@
VOID CModTree::UpdatePlayPos(CModDoc *pModDoc, PMPTNOTIFICATION pNotify)
//----------------------------------------------------------------------
{
- for (UINT i=0; i<MODTREE_MAX_DOCUMENTS; i++) if ((DocInfo[i]) && (DocInfo[i]->pModDoc == pModDoc))
+ UINT nDocNdx = GetDocumentIDFromModDoc(pModDoc);
+ if(nDocNdx >= MODTREE_MAX_DOCUMENTS) return;
+
+ ORDERINDEX nNewOrd = (pNotify) ? pNotify->nOrder : ORDERINDEX_INVALID;
+ SEQUENCEINDEX nNewSeq = (pModDoc->GetSoundFile() != nullptr) ? pModDoc->GetSoundFile()->Order.GetCurrentSequenceIndex() : SEQUENCEINDEX_INVALID;
+ if (nNewOrd != DocInfo[nDocNdx]->nOrdSel || nNewSeq != DocInfo[nDocNdx]->nSeqSel)
{
- ORDERINDEX nNewOrd = (pNotify) ? pNotify->nOrder : ORDERINDEX_INVALID;
- SEQUENCEINDEX nNewSeq = (pModDoc->GetSoundFile() != nullptr) ? pModDoc->GetSoundFile()->Order.GetCurrentSequenceIndex() : SEQUENCEINDEX_INVALID;
- if (nNewOrd != DocInfo[i]->nOrdSel || nNewSeq != DocInfo[i]->nSeqSel)
- {
- DocInfo[i]->nOrdSel = nNewOrd;
- DocInfo[i]->nSeqSel = nNewSeq;
- UpdateView(i, HINT_MODSEQUENCE);
- }
- break;
+ DocInfo[nDocNdx]->nOrdSel = nNewOrd;
+ DocInfo[nDocNdx]->nSeqSel = nNewSeq;
+ UpdateView(nDocNdx, HINT_MODSEQUENCE);
}
}
@@ -2604,15 +2624,18 @@
const DWORD dwItemNo = (DWORD)(qwItemType >> 16);
qwItemType &= 0xFFFF;
pModDoc = GetDocumentFromItem(hItem);
+
if (pModDoc)
{
if ((qwItemType == MODITEM_SAMPLE) && (!pModDoc->GetNumInstruments()))
{
pModDoc->MuteSample((SAMPLEINDEX)dwItemNo, (pModDoc->IsSampleMuted((SAMPLEINDEX)dwItemNo)) ? false : true);
+ UpdateView(GetDocumentIDFromModDoc(pModDoc), HINT_SMPNAMES | HINT_SAMPLEINFO);
} else
if ((qwItemType == MODITEM_INSTRUMENT) && (pModDoc->GetNumInstruments()))
{
pModDoc->MuteInstrument((INSTRUMENTINDEX)dwItemNo, (pModDoc->IsInstrumentMuted((INSTRUMENTINDEX)dwItemNo)) ? false : true);
+ UpdateView(GetDocumentIDFromModDoc(pModDoc), HINT_INSNAMES | HINT_INSTRUMENT);
}
if ((qwItemType == MODITEM_EFFECT))
@@ -2650,6 +2673,7 @@
for (SAMPLEINDEX nSmp = 1; nSmp <= pModDoc->GetNumSamples(); nSmp++)
{
pModDoc->MuteSample(nSmp, (nSmp == dwItemNo) ? false : true);
+ UpdateView(GetDocumentIDFromModDoc(pModDoc), HINT_SMPNAMES | HINT_SAMPLEINFO);
}
} else
if ((qwItemType == MODITEM_INSTRUMENT) && (nInstruments))
@@ -2657,6 +2681,7 @@
for (INSTRUMENTINDEX nIns = 1; nIns <= nInstruments; nIns++)
{
pModDoc->MuteInstrument(nIns, (nIns == dwItemNo) ? false : true);
+ UpdateView(GetDocumentIDFromModDoc(pModDoc), HINT_INSNAMES | HINT_INSTRUMENT);
}
}
}
@@ -2678,11 +2703,13 @@
{
for (SAMPLEINDEX nSmp = 1; nSmp <= pModDoc->GetNumSamples(); nSmp++)
{
- pModDoc->MuteSample(nSmp, FALSE);
+ pModDoc->MuteSample(nSmp, false);
+ UpdateView(GetDocumentIDFromModDoc(pModDoc), HINT_SMPNAMES | HINT_SAMPLEINFO);
}
for (INSTRUMENTINDEX nIns = 1; nIns <= pModDoc->GetNumInstruments(); nIns++)
{
- pModDoc->MuteInstrument(nIns, FALSE);
+ pModDoc->MuteInstrument(nIns, false);
+ UpdateView(GetDocumentIDFromModDoc(pModDoc), HINT_INSNAMES | HINT_INSTRUMENT);
}
}
}
Modified: trunk/OpenMPT/mptrack/View_tre.h
===================================================================
--- trunk/OpenMPT/mptrack/View_tre.h 2009-10-15 20:21:28 UTC (rev 399)
+++ trunk/OpenMPT/mptrack/View_tre.h 2009-10-16 19:53:27 UTC (rev 400)
@@ -174,6 +174,7 @@
static int CALLBACK ModTreeDrumCompareProc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort);
void ModTreeBuildTVIParam(TV_INSERTSTRUCT &tvis, LPCSTR lpszName, int iImage);
CModDoc *GetDocumentFromItem(HTREEITEM hItem);
+ UINT GetDocumentIDFromModDoc(CModDoc *pModDoc);
// Generated message map functions
protected:
Modified: trunk/OpenMPT/mptrack/res/img_list.bmp
===================================================================
(Binary files differ)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sag...@us...> - 2009-10-15 20:21:38
|
Revision: 399
http://modplug.svn.sourceforge.net/modplug/?rev=399&view=rev
Author: saga-games
Date: 2009-10-15 20:21:28 +0000 (Thu, 15 Oct 2009)
Log Message:
-----------
[Fix] Increased "filename" string in instrument header field to 32, since CHAR[12] is not really enough for 12 letters...
[Imp] Treeview: Update sequence names, indicate current sequence by bold text
[Imp] MOD Playing: Some more (minor) tweaks for Invert Loop. Thanks again, bubsy!
[Imp] Mod Conversion: Changing between MOD and XM format limits CMD_SPEED/CMD_TEMPO properly now.
[Ref] Renamed undo functions from "Undo" to "PatternUndo", to avoid confusion with other possibly upcoming undo functions (sample editor, etc)
[Ref] Some more internal refactoring
Modified Paths:
--------------
trunk/OpenMPT/mptrack/CleanupSong.cpp
trunk/OpenMPT/mptrack/Ctrl_pat.cpp
trunk/OpenMPT/mptrack/Ctrl_smp.h
trunk/OpenMPT/mptrack/EffectVis.cpp
trunk/OpenMPT/mptrack/Moddoc.cpp
trunk/OpenMPT/mptrack/Moddoc.h
trunk/OpenMPT/mptrack/Modedit.cpp
trunk/OpenMPT/mptrack/View_pat.cpp
trunk/OpenMPT/mptrack/View_smp.cpp
trunk/OpenMPT/mptrack/View_smp.h
trunk/OpenMPT/mptrack/View_tre.cpp
trunk/OpenMPT/soundlib/Load_med.cpp
trunk/OpenMPT/soundlib/Snd_fx.cpp
trunk/OpenMPT/soundlib/Sndfile.cpp
trunk/OpenMPT/soundlib/Sndfile.h
trunk/OpenMPT/soundlib/pattern.cpp
Modified: trunk/OpenMPT/mptrack/CleanupSong.cpp
===================================================================
--- trunk/OpenMPT/mptrack/CleanupSong.cpp 2009-10-13 20:20:48 UTC (rev 398)
+++ trunk/OpenMPT/mptrack/CleanupSong.cpp 2009-10-15 20:21:28 UTC (rev 399)
@@ -441,7 +441,7 @@
EndWaitCursor();
if ((nPatRemoved) || (bReordered))
{
- m_pModDoc->ClearUndo();
+ m_pModDoc->ClearPatternUndo();
if (nPatRemoved)
{
wsprintf(s, "%d pattern%s removed.\n", nPatRemoved, (nPatRemoved == 1) ? "" : "s");
Modified: trunk/OpenMPT/mptrack/Ctrl_pat.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Ctrl_pat.cpp 2009-10-13 20:20:48 UTC (rev 398)
+++ trunk/OpenMPT/mptrack/Ctrl_pat.cpp 2009-10-15 20:21:28 UTC (rev 399)
@@ -377,7 +377,7 @@
}
if (dwHintMask & (HINT_MODTYPE|HINT_UNDO))
{
- m_ToolBar.EnableButton(ID_EDIT_UNDO, m_pModDoc->CanUndo());
+ m_ToolBar.EnableButton(ID_EDIT_UNDO, m_pModDoc->CanPatternUndo());
}
}
@@ -1166,6 +1166,7 @@
{
m_pSndFile->Order.m_sName = str;
m_pModDoc->SetModified();
+ m_pModDoc->UpdateAllViews(NULL, HINT_SEQNAMES, this);
}
}
}
Modified: trunk/OpenMPT/mptrack/Ctrl_smp.h
===================================================================
--- trunk/OpenMPT/mptrack/Ctrl_smp.h 2009-10-13 20:20:48 UTC (rev 398)
+++ trunk/OpenMPT/mptrack/Ctrl_smp.h 2009-10-15 20:21:28 UTC (rev 399)
@@ -17,7 +17,7 @@
CSpinButtonCtrl m_SpinFineTune, m_SpinSample;
CComboBox m_ComboAutoVib, m_ComboLoopType, m_ComboSustainType, m_ComboZoom, m_CbnBaseNote;
CButton m_CheckPanning;
- UINT m_nSample;
+ SAMPLEINDEX m_nSample;
double m_dTimeStretchRatio; //rewbs.timeStretchMods
uint32 m_nStretchProcessStepLength;
uint32 m_nSequenceMs;
Modified: trunk/OpenMPT/mptrack/EffectVis.cpp
===================================================================
--- trunk/OpenMPT/mptrack/EffectVis.cpp 2009-10-13 20:20:48 UTC (rev 398)
+++ trunk/OpenMPT/mptrack/EffectVis.cpp 2009-10-15 20:21:28 UTC (rev 399)
@@ -578,7 +578,7 @@
rect.SetRect(x-NODEHALF, y-NODEHALF, x+NODEHALF+1, y+NODEHALF+1);
if (rect.PtInRect(point))
{
- m_pModDoc->PrepareUndo(m_nPattern, m_nChan, row, m_nChan+1, row+1);
+ m_pModDoc->PreparePatternUndo(m_nPattern, m_nChan, row, m_nChan+1, row+1);
m_nDragItem = row;
}
}
@@ -669,7 +669,7 @@
SetFocus();
SetCapture();
- m_pModDoc->PrepareUndo(m_nPattern, m_nChan, m_startRow, m_nChan+1, m_endRow);
+ m_pModDoc->PreparePatternUndo(m_nPattern, m_nChan, m_startRow, m_nChan+1, m_endRow);
m_dwStatus |= FXVSTATUS_LDRAGGING;
}
Modified: trunk/OpenMPT/mptrack/Moddoc.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Moddoc.cpp 2009-10-13 20:20:48 UTC (rev 398)
+++ trunk/OpenMPT/mptrack/Moddoc.cpp 2009-10-15 20:21:28 UTC (rev 399)
@@ -113,7 +113,7 @@
CModDoc::~CModDoc()
//-----------------
{
- ClearUndo();
+ ClearPatternUndo();
ClearLog();
}
Modified: trunk/OpenMPT/mptrack/Moddoc.h
===================================================================
--- trunk/OpenMPT/mptrack/Moddoc.h 2009-10-13 20:20:48 UTC (rev 398)
+++ trunk/OpenMPT/mptrack/Moddoc.h 2009-10-15 20:21:28 UTC (rev 399)
@@ -36,7 +36,8 @@
#define HINT_UNDO 0x10000
#define HINT_MIXPLUGINS 0x20000
#define HINT_SPEEDCHANGE 0x40000 //rewbs.envRowGrid
-#define HINT_MAXHINTFLAG HINT_SPEEDCHANGE
+#define HINT_SEQNAMES 0x80000
+#define HINT_MAXHINTFLAG HINT_SEQNAMES
//Bits 0-18 are reserved.
#define HINT_MASK_FLAGS (2*HINT_MAXHINTFLAG - 1) //When applied to hint parameter, should give the flag part.
#define HINT_MASK_ITEM (~HINT_MASK_FLAGS) //To nullify update hintbits from hint parameter.
@@ -89,6 +90,7 @@
// Undo
#define MAX_UNDO_LEVEL 100
+// Pattern Undo
typedef struct PATTERNUNDOBUFFER
{
UINT pattern, patternsize;
@@ -243,10 +245,10 @@
BOOL CopyEnvelope(UINT nIns, UINT nEnv);
BOOL PasteEnvelope(UINT nIns, UINT nEnv);
- BOOL ClearUndo();
- BOOL PrepareUndo(UINT pattern, UINT x, UINT y, UINT cx, UINT cy);
- UINT DoUndo();
- BOOL CanUndo();
+ BOOL ClearPatternUndo();
+ BOOL PreparePatternUndo(UINT pattern, UINT x, UINT y, UINT cx, UINT cy);
+ UINT DoPatternUndo();
+ BOOL CanPatternUndo();
LRESULT ActivateView(UINT nIdView, DWORD dwParam);
void UpdateAllViews(CView *pSender, LPARAM lHint=0L, CObject *pHint=NULL);
HWND GetEditPosition(ROWINDEX &row, PATTERNINDEX &pat, ORDERINDEX &ord); //rewbs.customKeys
Modified: trunk/OpenMPT/mptrack/Modedit.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Modedit.cpp 2009-10-13 20:20:48 UTC (rev 398)
+++ trunk/OpenMPT/mptrack/Modedit.cpp 2009-10-15 20:21:28 UTC (rev 399)
@@ -346,7 +346,7 @@
}
SetModified();
- ClearUndo();
+ ClearPatternUndo();
UpdateAllViews(NULL, HINT_MODTYPE | HINT_MODGENERAL);
EndWaitCursor();
return TRUE;
@@ -447,7 +447,7 @@
EndWaitCursor();
}
SetModified();
- ClearUndo();
+ ClearPatternUndo();
UpdateAllViews(NULL, HINT_MODTYPE);
return TRUE;
}
@@ -520,7 +520,7 @@
END_CRITICAL();
EndWaitCursor();
SetModified();
- ClearUndo();
+ ClearPatternUndo();
UpdateAllViews(NULL, HINT_MODTYPE);
return FALSE;
}
@@ -1121,7 +1121,7 @@
if ((hCpy) && ((p = (LPSTR)GlobalLock(hCpy)) != NULL))
{
- PrepareUndo(nPattern, 0, 0, m_SndFile.m_nChannels, m_SndFile.PatternSize[nPattern]);
+ PreparePatternUndo(nPattern, 0, 0, m_SndFile.m_nChannels, m_SndFile.PatternSize[nPattern]);
BYTE spdmax = (m_SndFile.m_nType & MOD_TYPE_MOD) ? 0x20 : 0x1F;
DWORD dwMemSize = GlobalSize(hCpy);
MODCOMMAND *m = m_SndFile.Patterns[nPattern];
@@ -1321,7 +1321,7 @@
nPattern = m_SndFile.Order[oNextOrder];
if(m_SndFile.Patterns.IsValidPat(nPattern) == false) goto PasteDone;
m = m_SndFile.Patterns[nPattern];
- PrepareUndo(nPattern, 0,0, m_SndFile.m_nChannels, m_SndFile.PatternSize[nPattern]);
+ PreparePatternUndo(nPattern, 0,0, m_SndFile.m_nChannels, m_SndFile.PatternSize[nPattern]);
oCurrentOrder = oNextOrder;
}
}
@@ -1531,10 +1531,10 @@
/////////////////////////////////////////////////////////////////////////////////////////
-// Undo Functions
+// Pattern Undo Functions
-BOOL CModDoc::ClearUndo()
-//-----------------------
+BOOL CModDoc::ClearPatternUndo()
+//------------------------------
{
for (UINT i=0; i<MAX_UNDO_LEVEL; i++)
{
@@ -1547,15 +1547,15 @@
}
-BOOL CModDoc::CanUndo()
-//---------------------
+BOOL CModDoc::CanPatternUndo()
+//----------------------------
{
return (PatternUndo[0].pbuffer) ? TRUE : FALSE;
}
-BOOL CModDoc::PrepareUndo(UINT pattern, UINT x, UINT y, UINT cx, UINT cy)
-//-----------------------------------------------------------------------
+BOOL CModDoc::PreparePatternUndo(UINT pattern, UINT x, UINT y, UINT cx, UINT cy)
+//------------------------------------------------------------------------------
{
MODCOMMAND *pUndo, *pPattern;
UINT nRows;
@@ -1604,8 +1604,8 @@
}
-UINT CModDoc::DoUndo()
-//--------------------
+UINT CModDoc::DoPatternUndo()
+//---------------------------
{
MODCOMMAND *pUndo, *pPattern;
UINT nPattern, nRows;
Modified: trunk/OpenMPT/mptrack/View_pat.cpp
===================================================================
--- trunk/OpenMPT/mptrack/View_pat.cpp 2009-10-13 20:20:48 UTC (rev 398)
+++ trunk/OpenMPT/mptrack/View_pat.cpp 2009-10-15 20:21:28 UTC (rev 399)
@@ -611,7 +611,7 @@
nChnEnd = GetChanFromCursor(dwEnd);
nRowEnd = GetRowFromCursor(dwEnd);
if( (nChnEnd < nChnBeg) || (nRowEnd < nRowBeg) ) return FALSE;
- if (pModDoc) return pModDoc->PrepareUndo(m_nPattern, nChnBeg, nRowBeg, nChnEnd-nChnBeg+1, nRowEnd-nRowBeg+1);
+ if (pModDoc) return pModDoc->PreparePatternUndo(m_nPattern, nChnBeg, nRowBeg, nChnEnd-nChnBeg+1, nRowEnd-nRowBeg+1);
return FALSE;
}
@@ -752,7 +752,7 @@
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->PrepareUndo(m_nPattern, 0, 0, pSndFile->m_nChannels, pSndFile->PatternSize[m_nPattern]);
+ pModDoc->PreparePatternUndo(m_nPattern, 0, 0, pSndFile->m_nChannels, pSndFile->PatternSize[m_nPattern]);
int finalDest = (startSel>>16)+((endSel>>16)-(startSel>>16))*2;
for (int row=finalDest; row>(int)(startSel >> 16); row-=2)
@@ -802,7 +802,7 @@
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->PrepareUndo(m_nPattern, 0, 0, pSndFile->m_nChannels, pSndFile->PatternSize[m_nPattern]);
+ pModDoc->PreparePatternUndo(m_nPattern, 0, 0, pSndFile->m_nChannels, pSndFile->PatternSize[m_nPattern]);
int finalDest = (startSel>>16)+((endSel>>16)-(startSel>>16))/2;
@@ -1560,7 +1560,7 @@
maxrow = pSndFile->PatternSize[m_nPattern];
if (colmax >= pSndFile->m_nChannels) colmax = pSndFile->m_nChannels-1;
if (colmin > colmax) return;
- pModDoc->PrepareUndo(m_nPattern, 0,0, pSndFile->m_nChannels, maxrow);
+ pModDoc->PreparePatternUndo(m_nPattern, 0,0, pSndFile->m_nChannels, maxrow);
for (UINT r=row; r<maxrow; r++)
{
MODCOMMAND *m = pSndFile->Patterns[m_nPattern] + r * pSndFile->m_nChannels + colmin;
@@ -1626,7 +1626,7 @@
maxrow = pSndFile->PatternSize[m_nPattern];
if (colmax >= pSndFile->m_nChannels) colmax = pSndFile->m_nChannels-1;
if (colmin > colmax) return;
- pModDoc->PrepareUndo(m_nPattern, 0,0, pSndFile->m_nChannels, maxrow);
+ pModDoc->PreparePatternUndo(m_nPattern, 0,0, pSndFile->m_nChannels, maxrow);
for (UINT r=maxrow; r>row; )
{
@@ -2384,7 +2384,7 @@
dx = (int)((m_dwDragPos & 0xFFF8) >> 3) - (int)((m_dwStartSel & 0xFFF8) >> 3);
dy = (int)(m_dwDragPos >> 16) - (int)(m_dwStartSel >> 16);
if ((!dx) && (!dy)) return;
- pModDoc->PrepareUndo(m_nPattern, 0,0, nChannels, nRows);
+ pModDoc->PreparePatternUndo(m_nPattern, 0,0, nChannels, nRows);
pNewPattern = CSoundFile::AllocatePattern(nRows, nChannels);
if (!pNewPattern) return;
x1 = (m_dwBeginSel & 0xFFF8) >> 3;
@@ -2563,7 +2563,7 @@
pSndFile->MoveChannel(pSndFile->m_nChannels-1, nChn);
pModDoc->SetModified();
- pModDoc->ClearUndo();
+ pModDoc->ClearPatternUndo();
pModDoc->UpdateAllViews(NULL, HINT_MODCHANNELS); //refresh channel headers
pModDoc->UpdateAllViews(NULL, HINT_MODTYPE); //updates(?) the channel number to general tab display
SetCurrentPattern(m_nPattern);
@@ -2586,7 +2586,7 @@
pSndFile->MoveChannel(pSndFile->m_nChannels-1, nChn);
pModDoc->SetModified();
- pModDoc->ClearUndo();
+ pModDoc->ClearPatternUndo();
pModDoc->UpdateAllViews(NULL, HINT_MODCHANNELS);
pModDoc->UpdateAllViews(NULL, HINT_MODTYPE);
SetCurrentPattern(m_nPattern);
@@ -2626,7 +2626,7 @@
if(nNumChnNew == vecChns.size())
{
pModDoc->SetModified();
- pModDoc->ClearUndo();
+ pModDoc->ClearPatternUndo();
pModDoc->UpdateAllViews(NULL, HINT_MODCHANNELS);
pModDoc->UpdateAllViews(NULL, HINT_MODTYPE);
SetCurrentPattern(m_nPattern);
@@ -2696,7 +2696,7 @@
CModDoc *pModDoc = GetDocument();
if ((pCmdUI) && (pModDoc))
{
- pCmdUI->Enable(pModDoc->CanUndo());
+ pCmdUI->Enable(pModDoc->CanPatternUndo());
}
}
@@ -2707,7 +2707,7 @@
CModDoc *pModDoc = GetDocument();
if (pModDoc && IsEditingEnabled_bmsg())
{
- UINT nPat = pModDoc->DoUndo();
+ UINT nPat = pModDoc->DoPatternUndo();
if (nPat < pModDoc->GetSoundFile()->Patterns.Size())
{
pModDoc->SetModified();
@@ -2966,7 +2966,7 @@
if(bUsePlaybackPosition == true)
SetEditPos(*pSndFile, nRow, nPattern, pSndFile->m_nRow, pSndFile->m_nPattern);
- pModDoc->PrepareUndo(nPattern, nChn, nRow, 1, 1);
+ pModDoc->PreparePatternUndo(nPattern, nChn, nRow, 1, 1);
MODCOMMAND *pRow = pSndFile->Patterns[nPattern].GetpModCommand(nRow, nChn);
@@ -3993,7 +3993,7 @@
}
// Create undo-point.
- pModDoc->PrepareUndo(nPat, nChn, nRow, 1, 1);
+ pModDoc->PreparePatternUndo(nPat, nChn, nRow, 1, 1);
// -- write sdx if playing live
if (usePlaybackPosition && nTick) { // avoid SD0 which will be mis-interpreted
@@ -4141,7 +4141,7 @@
//Param control 'note'
if((note == NOTE_PC || note == NOTE_PCS) && bRecordEnabled)
{
- pModDoc->PrepareUndo(m_nPattern, nChn, nRow, 1, 1);
+ pModDoc->PreparePatternUndo(m_nPattern, nChn, nRow, 1, 1);
pSndFile->Patterns[m_nPattern].GetpModCommand(nRow, nChn)->note = note;
const DWORD sel = (nRow << 16) | m_dwCursor;
pModDoc->SetModified();
@@ -4174,7 +4174,7 @@
// If record is enabled, create undo point.
if(bRecordEnabled)
- pModDoc->PrepareUndo(nPat, nChn, nRow, 1, 1);
+ pModDoc->PreparePatternUndo(nPat, nChn, nRow, 1, 1);
// -- write note and instrument data.
const bool isSplit = HandleSplit(p, note);
@@ -4331,7 +4331,7 @@
const CHANNELINDEX nChn = GetChanFromCursor(m_dwCursor);
UINT nPlayIns = 0;
// Simply backup the whole row.
- pModDoc->PrepareUndo(m_nPattern, nChn, m_nRow, pSndFile->GetNumChannels(), 1);
+ pModDoc->PreparePatternUndo(m_nPattern, nChn, m_nRow, pSndFile->GetNumChannels(), 1);
PatternRow prowbase = pSndFile->Patterns[m_nPattern].GetRow(m_nRow);
MODCOMMAND* p = &prowbase[nChn];
@@ -4825,7 +4825,7 @@
AppendMenu(hMenu, MF_STRING, ID_EDIT_PASTE, "Paste\t" + ih->GetKeyTextFromCommand(kcEditPaste));
AppendMenu(hMenu, MF_STRING, ID_EDIT_MIXPASTE, "Mix Paste\t" + ih->GetKeyTextFromCommand(kcEditMixPaste));
- DWORD greyed = pModDoc->CanUndo()?FALSE:MF_GRAYED;
+ DWORD greyed = pModDoc->CanPatternUndo()?FALSE:MF_GRAYED;
if (!greyed || !(CMainFrame::m_dwPatternSetup&PATTERN_OLDCTXMENUSTYLE)) {
AppendMenu(hMenu, MF_STRING|greyed, ID_EDIT_UNDO, "Undo\t" + ih->GetKeyTextFromCommand(kcEditUndo));
}
Modified: trunk/OpenMPT/mptrack/View_smp.cpp
===================================================================
--- trunk/OpenMPT/mptrack/View_smp.cpp 2009-10-13 20:20:48 UTC (rev 398)
+++ trunk/OpenMPT/mptrack/View_smp.cpp 2009-10-15 20:21:28 UTC (rev 399)
@@ -178,8 +178,8 @@
}
-BOOL CViewSample::SetCurrentSample(UINT nSmp)
-//-------------------------------------------
+BOOL CViewSample::SetCurrentSample(SAMPLEINDEX nSmp)
+//--------------------------------------------------
{
CModDoc *pModDoc = GetDocument();
CSoundFile *pSndFile;
Modified: trunk/OpenMPT/mptrack/View_smp.h
===================================================================
--- trunk/OpenMPT/mptrack/View_smp.h 2009-10-13 20:20:48 UTC (rev 398)
+++ trunk/OpenMPT/mptrack/View_smp.h 2009-10-15 20:21:28 UTC (rev 399)
@@ -15,7 +15,8 @@
CImageList m_bmpEnvBar;
CRect m_rcClient;
SIZE m_sizeTotal;
- UINT m_nSample, m_nZoom, m_nScrollPos, m_nScrollFactor, m_nBtnMouseOver;
+ SAMPLEINDEX m_nSample;
+ UINT m_nZoom, m_nScrollPos, m_nScrollFactor, m_nBtnMouseOver;
DWORD m_dwStatus, m_dwBeginSel, m_dwEndSel, m_dwBeginDrag, m_dwEndDrag;
DWORD m_dwMenuParam;
DWORD m_NcButtonState[SMP_LEFTBAR_BUTTONS];
@@ -28,7 +29,7 @@
public:
void UpdateScrollSize();
- BOOL SetCurrentSample(UINT nSmp);
+ BOOL SetCurrentSample(SAMPLEINDEX nSmp);
BOOL SetZoom(UINT nZoom);
LONG SampleToScreen(LONG n) const;
DWORD ScreenToSample(LONG x) const;
Modified: trunk/OpenMPT/mptrack/View_tre.cpp
===================================================================
--- trunk/OpenMPT/mptrack/View_tre.cpp 2009-10-13 20:20:48 UTC (rev 398)
+++ trunk/OpenMPT/mptrack/View_tre.cpp 2009-10-15 20:21:28 UTC (rev 399)
@@ -727,19 +727,29 @@
// go through all sequences
for(SEQUENCEINDEX nSeq = 0; nSeq < pSndFile->Order.GetNumSequences(); nSeq++)
{
- // TODO update sequence names
if(pSndFile->Order.GetNumSequences() > 1)
{
// more than one sequence -> add folder
CString sSeqName = pSndFile->Order.GetSequence(nSeq).m_sName;
if(sSeqName.IsEmpty()) sSeqName.Format("Sequence %d", nSeq);
+ UINT state = (nSeq == pSndFile->Order.GetCurrentSequenceIndex()) ? TVIS_BOLD : 0;
+
if(pInfo->tiSequences[nSeq] == NULL)
{
pInfo->tiSequences[nSeq] = InsertItem(sSeqName, IMAGE_FOLDER, IMAGE_FOLDER, pInfo->hOrders, TVI_LAST);
- } else
- {
+ }
+ // Update bold item
+ strcpy(stmp, sSeqName);
+ tvi.mask = TVIF_TEXT | TVIF_HANDLE | TVIF_STATE;
+ tvi.state = 0;
+ tvi.stateMask = TVIS_BOLD;
+ tvi.hItem = pInfo->tiSequences[nSeq];
+ tvi.pszText = stmp;
+ tvi.cchTextMax = sizeof(stmp);
+ GetItem(&tvi);
+ if(tvi.state != state || tvi.pszText != sSeqName)
+ SetItem(pInfo->tiSequences[nSeq], TVIF_TEXT | TVIF_STATE, sSeqName, 0, 0, state, TVIS_BOLD, 0);
- }
hAncestorNode = pInfo->tiSequences[nSeq];
}
@@ -2017,7 +2027,7 @@
void CModTree::OnUpdate(CModDoc *pModDoc, DWORD dwHint, CObject *pHint)
//---------------------------------------------------------------------
{
- dwHint &= (HINT_PATNAMES|HINT_SMPNAMES|HINT_INSNAMES|HINT_MODTYPE|HINT_MODGENERAL|HINT_MODSEQUENCE|HINT_MIXPLUGINS|HINT_MPTOPTIONS|HINT_MASK_ITEM);
+ dwHint &= (HINT_PATNAMES|HINT_SMPNAMES|HINT_INSNAMES|HINT_MODTYPE|HINT_MODGENERAL|HINT_MODSEQUENCE|HINT_MIXPLUGINS|HINT_MPTOPTIONS|HINT_MASK_ITEM|HINT_SEQNAMES);
if ((pHint != this) && (dwHint & HINT_MASK_FLAGS))
{
for (UINT i=0; i<MODTREE_MAX_DOCUMENTS; i++)
Modified: trunk/OpenMPT/soundlib/Load_med.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Load_med.cpp 2009-10-13 20:20:48 UTC (rev 398)
+++ trunk/OpenMPT/soundlib/Load_med.cpp 2009-10-15 20:21:28 UTC (rev 399)
@@ -810,7 +810,7 @@
if ((!dwBlockArr) || (dwBlockArr > dwMemLength - 4*wNumBlocks)) return true;
pdwTable = (LPDWORD)(lpStream + dwBlockArr);
playtransp += (version == '3') ? 24 : 48;
- for (UINT iBlk=0; iBlk<wNumBlocks; iBlk++)
+ for (PATTERNINDEX iBlk=0; iBlk<wNumBlocks; iBlk++)
{
UINT dwPos = BigEndian(pdwTable[iBlk]);
if ((!dwPos) || (dwPos >= dwMemLength) || (dwPos >= dwMemLength - 8)) continue;
Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Snd_fx.cpp 2009-10-13 20:20:48 UTC (rev 398)
+++ trunk/OpenMPT/soundlib/Snd_fx.cpp 2009-10-15 20:21:28 UTC (rev 399)
@@ -1172,6 +1172,9 @@
bPorta = false;
}
+ // Process Invert Loop (MOD Effect, called every row)
+ InvertLoop(&Chn[nChn]);
+
// Process special effects (note delay, pattern delay, pattern loop)
if ((cmd == CMD_MODCMDEX) || (cmd == CMD_S3MCMDEX))
{
@@ -1870,9 +1873,6 @@
break;
}
- // MOD Effect (called every row)
- InvertLoop(&Chn[nChn]);
-
} // for(...) end
// Navigation Effects
@@ -2695,18 +2695,17 @@
//--------------------------------------------------
{
// EFx implementation for MOD files (PT 1.1A and up: Invert Loop)
- // This effect trashes samples. Thanks to bubsy for making this work. :)
+ // This effect trashes samples. Thanks to 8bitbubsy for making this work. :)
if((m_nType & MOD_TYPE_MOD) == 0 || pChn->nEFxSpeed == 0) return;
- pChn->nEFxDelay += ModEFxTable[pChn->nEFxSpeed & 0x0F];
-
- if(pChn->nEFxDelay < 0x80) return; // only applied if the "delay" reaches 128
- pChn->nEFxDelay = 0;
-
// we obviously also need a sample for this
MODSAMPLE *pModSample = pChn->pEFxSample;
if(pModSample == nullptr || pModSample->pSample == nullptr || !(pModSample->uFlags & CHN_LOOP)) return;
+ pChn->nEFxDelay += ModEFxTable[pChn->nEFxSpeed & 0x0F];
+ if((pChn->nEFxDelay & 0x80) == 0) return; // only applied if the "delay" reaches 128
+ pChn->nEFxDelay = 0;
+
if (++pChn->nEFxOffset >= pModSample->nLoopEnd - pModSample->nLoopStart)
pChn->nEFxOffset = 0;
Modified: trunk/OpenMPT/soundlib/Sndfile.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Sndfile.cpp 2009-10-13 20:20:48 UTC (rev 398)
+++ trunk/OpenMPT/soundlib/Sndfile.cpp 2009-10-15 20:21:28 UTC (rev 399)
@@ -3469,6 +3469,25 @@
}
} // End if (oldTypeIsIT_MPT && newTypeIsS3M)
+ ///////////////////////////////////
+ // MOD <-> XM: Speed/Tempo update
+ if(oldTypeIsMOD && newTypeIsXM)
+ {
+ switch(m->command)
+ {
+ case CMD_SPEED:
+ m->param = min(m->param, 0x1F);
+ break;
+ }
+ } else if(oldTypeIsXM && newTypeIsMOD)
+ {
+ switch(m->command)
+ {
+ case CMD_TEMPO:
+ m->param = max(m->param, 0x21);
+ break;
+ }
+ }
///////////////////////////////////////////////////////////////////////
Modified: trunk/OpenMPT/soundlib/Sndfile.h
===================================================================
--- trunk/OpenMPT/soundlib/Sndfile.h 2009-10-13 20:20:48 UTC (rev 398)
+++ trunk/OpenMPT/soundlib/Sndfile.h 2009-10-15 20:21:28 UTC (rev 399)
@@ -113,7 +113,7 @@
unsigned char nPPC; //Pitch Centre?
CHAR name[32];
- CHAR filename[12];
+ CHAR filename[32];
BYTE nMixPlug; //rewbs.instroVSTi
// -> CODE#0027
@@ -566,8 +566,9 @@
BYTE m_nTempoMode; // rewbs.betterBPM
BYTE m_nMixLevels;
UINT m_nMusicSpeed, m_nMusicTempo;
- UINT m_nNextRow, m_nRow;
- UINT m_nPattern,m_nCurrentPattern,m_nNextPattern,m_nRestartPos, m_nSeqOverride;
+ ROWINDEX m_nNextRow, m_nRow;
+ PATTERNINDEX m_nPattern;
+ ORDERINDEX m_nCurrentPattern, m_nNextPattern, m_nRestartPos, m_nSeqOverride;
//NOTE: m_nCurrentPattern and m_nNextPattern refer to order index - not pattern index.
bool m_bPatternTransitionOccurred;
UINT m_nMasterVolume, m_nGlobalVolume, m_nSamplesToGlobalVolRampDest,
Modified: trunk/OpenMPT/soundlib/pattern.cpp
===================================================================
--- trunk/OpenMPT/soundlib/pattern.cpp 2009-10-13 20:20:48 UTC (rev 398)
+++ trunk/OpenMPT/soundlib/pattern.cpp 2009-10-15 20:21:28 UTC (rev 399)
@@ -132,7 +132,7 @@
if (!newPattern) return true;
const UINT nPattern = m_rPatternContainer.GetIndex(this);
- rModDoc.PrepareUndo(nPattern, 0,0, nChns, nRows);
+ rModDoc.PreparePatternUndo(nPattern, 0,0, nChns, nRows);
oldPattern = m_ModCommands;
for (UINT y=0; y<nRows; y++)
{
@@ -163,7 +163,7 @@
nRows = m_Rows;
nChns = sndFile.m_nChannels;
const UINT nPattern = m_rPatternContainer.GetIndex(this);
- rModDoc.PrepareUndo(nPattern, 0,0, nChns, nRows);
+ rModDoc.PreparePatternUndo(nPattern, 0,0, nChns, nRows);
nRows /= 2;
for (UINT y=0; y<nRows; y++)
{
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sag...@us...> - 2009-10-13 20:21:02
|
Revision: 398
http://modplug.svn.sourceforge.net/modplug/?rev=398&view=rev
Author: saga-games
Date: 2009-10-13 20:20:48 +0000 (Tue, 13 Oct 2009)
Log Message:
-----------
[New] Added song flag "PT 1.x Mode" (for .MOD files) that enabled on-the-fly sample swapping as ProTracker did it.
[Fix] Further fixes to "Invert Loop" command (thanks, bubsy)
[Ref] Moved effect conversion (from format x to y) to CSoundFile as this might be useful for other parts of the program as well.
[Ref] Commented song flags a bit more
Modified Paths:
--------------
trunk/OpenMPT/mptrack/Moddoc.h
trunk/OpenMPT/mptrack/Modedit.cpp
trunk/OpenMPT/mptrack/dlg_misc.cpp
trunk/OpenMPT/mptrack/dlg_misc.h
trunk/OpenMPT/mptrack/mptrack.rc
trunk/OpenMPT/mptrack/resource.h
trunk/OpenMPT/soundlib/Snd_defs.h
trunk/OpenMPT/soundlib/Snd_fx.cpp
trunk/OpenMPT/soundlib/Sndfile.cpp
trunk/OpenMPT/soundlib/Sndfile.h
Modified: trunk/OpenMPT/mptrack/Moddoc.h
===================================================================
--- trunk/OpenMPT/mptrack/Moddoc.h 2009-10-12 22:04:33 UTC (rev 397)
+++ trunk/OpenMPT/mptrack/Moddoc.h 2009-10-13 20:20:48 UTC (rev 398)
@@ -186,7 +186,7 @@
void SongProperties();
// operations
public:
- BOOL ChangeModType(UINT nNewType);
+ BOOL ChangeModType(MODTYPE wType);
BOOL ChangeNumChannels(UINT nNewChannels, const bool showCancelInRemoveDlg = true);
BOOL ConvertInstrumentsToSamples();
Modified: trunk/OpenMPT/mptrack/Modedit.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Modedit.cpp 2009-10-12 22:04:33 UTC (rev 397)
+++ trunk/OpenMPT/mptrack/Modedit.cpp 2009-10-13 20:20:48 UTC (rev 398)
@@ -37,15 +37,15 @@
//////////////////////////////////////////////////////////////////////
// Module type conversion
-BOOL CModDoc::ChangeModType(UINT nNewType)
-//----------------------------------------
+BOOL CModDoc::ChangeModType(MODTYPE nNewType)
+//-------------------------------------------
{
CHAR s[256];
UINT b64 = 0;
- const MODTYPE oldtype = m_SndFile.GetType();
+ const MODTYPE nOldType = m_SndFile.GetType();
- if (nNewType == oldtype && nNewType == MOD_TYPE_IT){
+ if (nNewType == nOldType && nNewType == MOD_TYPE_IT){
// Even if m_nType doesn't change, we might need to change extension in itp<->it case.
// This is because ITP is a HACK and doesn't genuinely change m_nType,
// but uses flages instead.
@@ -53,11 +53,11 @@
return TRUE;
}
- if(nNewType == oldtype) return TRUE;
+ if(nNewType == nOldType) return TRUE;
- const bool oldTypeIsMOD = (oldtype == MOD_TYPE_MOD), oldTypeIsXM = (oldtype == MOD_TYPE_XM),
- oldTypeIsS3M = (oldtype == MOD_TYPE_S3M), oldTypeIsIT = (oldtype == MOD_TYPE_IT),
- oldTypeIsMPT = (oldtype == MOD_TYPE_MPT), oldTypeIsMOD_XM = (oldTypeIsMOD || oldTypeIsXM),
+ const bool oldTypeIsMOD = (nOldType == MOD_TYPE_MOD), oldTypeIsXM = (nOldType == MOD_TYPE_XM),
+ oldTypeIsS3M = (nOldType == MOD_TYPE_S3M), oldTypeIsIT = (nOldType == MOD_TYPE_IT),
+ oldTypeIsMPT = (nOldType == MOD_TYPE_MPT), oldTypeIsMOD_XM = (oldTypeIsMOD || oldTypeIsXM),
oldTypeIsS3M_IT_MPT = (oldTypeIsS3M || oldTypeIsIT || oldTypeIsMPT),
oldTypeIsIT_MPT = (oldTypeIsIT || oldTypeIsMPT);
@@ -172,114 +172,13 @@
{
nChannel = (nChannel + 1) % m_SndFile.m_nChannels; // 0...Channels - 1
- //////////////////////////
- // Convert 8-bit Panning
- if(m->command == CMD_PANNING8)
- {
- if(newTypeIsS3M)
- {
- m->param = (m->param + 1) >> 1;
- }
- else if(oldTypeIsS3M)
- {
- if(m->param == 0xA4)
- {
- // surround remap
- m->command = (newTypeIsIT_MPT) ? CMD_S3MCMDEX : CMD_XFINEPORTAUPDOWN;
- m->param = 0x91;
- }
- else
- {
- m->param = min(m->param << 1, 0xFF);
- }
- }
- } // End if(m->command == CMD_PANNING8)
+ m_SndFile.ConvertCommand(m, nOldType, nNewType);
- //////////////////////////
- // Convert param control
- if(oldTypeIsMPT)
+ // Deal with effect memory for MOD/XM arpeggio
+ if (oldTypeIsS3M_IT_MPT && newTypeIsMOD_XM)
{
- if(m->note == NOTE_PC || m->note == NOTE_PCS)
- {
- m->param = min(MODCOMMAND::maxColumnValue, m->GetValueEffectCol()) * 0x7F / MODCOMMAND::maxColumnValue;
- m->command = (m->note == NOTE_PC) ? CMD_MIDI : CMD_SMOOTHMIDI;
- m->volcmd = VOLCMD_NONE;
- m->note = NOTE_NONE;
- }
- } // End if(oldTypeIsMPT)
-
- /////////////////////////////////////////
- // Convert MOD / XM to S3M / IT / MPTM
- if(oldTypeIsMOD_XM && newTypeIsS3M_IT_MPT)
- {
switch(m->command)
{
- case CMD_MODCMDEX:
- CSoundFile::MODExx2S3MSxx(m);
- break;
- case CMD_VOLUME:
- if (!m->volcmd)
- {
- m->volcmd = VOLCMD_VOLUME;
- m->vol = m->param;
- if (m->vol > 0x40) m->vol = 0x40;
- m->command = m->param = 0;
- }
- break;
- case CMD_PORTAMENTOUP:
- if (m->param > 0xDF) m->param = 0xDF;
- break;
- case CMD_PORTAMENTODOWN:
- if (m->param > 0xDF) m->param = 0xDF;
- break;
- case CMD_XFINEPORTAUPDOWN:
- switch(m->param & 0xF0)
- {
- case 0x10: m->command = CMD_PORTAMENTOUP; m->param = (m->param & 0x0F) | 0xE0; break;
- case 0x20: m->command = CMD_PORTAMENTODOWN; m->param = (m->param & 0x0F) | 0xE0; break;
- case 0x50:
- case 0x60:
- case 0x70:
- case 0x90:
- case 0xA0:
- m->command = CMD_S3MCMDEX;
- // surround remap (this is the "official" command)
- if(newTypeIsS3M && m->param == 0x91)
- {
- m->command = CMD_PANNING8;
- m->param = 0xA4;
- }
- break;
- }
- break;
- case CMD_KEYOFF:
- if(m->note == 0)
- {
- m->note = (newTypeIsS3M) ? NOTE_NOTECUT : NOTE_KEYOFF;
- m->command = CMD_S3MCMDEX;
- if(m->param == 0)
- m->instr = 0;
- m->param = 0xD0 | (m->param & 0x0F);
- }
- break;
- case CMD_PANNINGSLIDE:
- // swap L/R
- m->param = ((m->param & 0x0F) << 4) | (m->param >> 4);
- default:
- break;
- }
- } // End if(oldTypeIsMOD_XM && newTypeIsS3M_IT_MPT)
-
-
- /////////////////////////////////////////
- // Convert S3M / IT / MPTM to MOD / XM
- else if (oldTypeIsS3M_IT_MPT && newTypeIsMOD_XM)
- {
- if(m->note == NOTE_NOTECUT || m->note == NOTE_FADE)
- m->note = NOTE_KEYOFF;
-
- switch(m->command)
- {
case CMD_ARPEGGIO:
// No effect memory in XM / MOD
if(m->param == 0)
@@ -287,115 +186,14 @@
else
cEffectMemory[nChannel][CMD_ARPEGGIO] = m->param;
break;
- case CMD_S3MCMDEX:
- CSoundFile::S3MSxx2MODExx(m);
- break;
- case CMD_VOLUMESLIDE:
- if ((m->param & 0xF0) && ((m->param & 0x0F) == 0x0F))
- {
- m->command = CMD_MODCMDEX;
- m->param = (m->param >> 4) | 0xA0;
- } else
- if ((m->param & 0x0F) && ((m->param & 0xF0) == 0xF0))
- {
- m->command = CMD_MODCMDEX;
- m->param = (m->param & 0x0F) | 0xB0;
- }
- break;
- case CMD_PORTAMENTOUP:
- if (m->param >= 0xF0)
- {
- m->command = CMD_MODCMDEX;
- m->param = (m->param & 0x0F) | 0x10;
- } else
- if (m->param >= 0xE0)
- {
- m->command = CMD_MODCMDEX;
- m->param = (((m->param & 0x0F)+3) >> 2) | 0x10;
- } else m->command = CMD_PORTAMENTOUP;
- break;
- case CMD_PORTAMENTODOWN:
- if (m->param >= 0xF0)
- {
- m->command = CMD_MODCMDEX;
- m->param = (m->param & 0x0F) | 0x20;
- } else
- if (m->param >= 0xE0)
- {
- m->command = CMD_MODCMDEX;
- m->param = (((m->param & 0x0F)+3) >> 2) | 0x20;
- } else m->command = CMD_PORTAMENTODOWN;
- break;
- case CMD_SPEED:
- {
- UINT spdmax = (nNewType == MOD_TYPE_XM) ? 0x1F : 0x20;
- if (m->param > spdmax) m->param = spdmax;
- }
- break;
- case CMD_PANNINGSLIDE:
- // swap L/R
- m->param = ((m->param & 0x0F) << 4) | (m->param >> 4);
- // remove fine slides
- if((m->param > 0xF0) || ((m->param & 0x0F) == 0x0F && m->param != 0x0F))
- m->command = CMD_NONE;
- default:
- break;
}
- } // End if (oldTypeIsS3M_IT_MPT && newTypeIsMOD_XM)
+ }
-
- ///////////////////////
- // Convert IT to S3M
- else if (oldTypeIsIT_MPT && newTypeIsS3M)
+ // Adjust effect memory for MOD files
+ if(newTypeIsMOD)
{
- if(m->note == NOTE_KEYOFF || m->note == NOTE_FADE)
- m->note = NOTE_NOTECUT;
-
switch(m->command)
{
- case CMD_S3MCMDEX:
- if(m->param == 0x91)
- {
- // surround remap (this is the "official" command)
- m->command = CMD_PANNING8;
- m->param = 0xA4;
- }
- break;
- case CMD_SMOOTHMIDI:
- m->command = CMD_MIDI;
- break;
- default:
- break;
- }
- } // End if (oldTypeIsIT_MPT && newTypeIsS3M)
-
-
-
- ///////////////////////////////////////////////////
- // Convert MOD to anything - adjust effect memory
- if (oldTypeIsMOD)
- {
- switch(m->command)
- {
- case CMD_TONEPORTAVOL: // lacks memory -> 500 is the same as 300
- if(m->param == 0x00) m->command = CMD_TONEPORTAMENTO;
- break;
- case CMD_VIBRATOVOL: // lacks memory -> 600 is the same as 400
- if(m->param == 0x00) m->command = CMD_VIBRATO;
- break;
- }
- } // End if (oldTypeIsMOD && newTypeIsXM)
-
- /////////////////////////////////////////////////////////////////////////////////
- // Convert anything to MOD - remove volume column, adjust retrig, effect memory
- if (newTypeIsMOD)
- {
- if(m->command) switch(m->command)
- {
- case CMD_RETRIG:
- m->command = CMD_MODCMDEX;
- m->param = 0x90 | (m->param & 0x0F);
- break;
case CMD_PORTAMENTOUP:
case CMD_PORTAMENTODOWN:
case CMD_TONEPORTAVOL:
@@ -407,217 +205,9 @@
else
cEffectMemory[nChannel][m->command] = m->param;
break;
- }
- else switch(m->volcmd)
- {
- case VOLCMD_VOLUME:
- m->command = CMD_VOLUME;
- m->param = m->vol;
- break;
- case VOLCMD_PANNING:
- m->command = CMD_PANNING8;
- m->param = CLAMP(m->vol << 2, 0, 0xFF);
- break;
- case VOLCMD_VOLSLIDEDOWN:
- m->command = CMD_VOLUMESLIDE;
- m->param = m->vol;
- break;
- case VOLCMD_VOLSLIDEUP:
- m->command = CMD_VOLUMESLIDE;
- m->param = m->vol << 4;
- break;
- case VOLCMD_FINEVOLDOWN:
- m->command = CMD_MODCMDEX;
- m->param = 0xB0 | m->vol;
- break;
- case VOLCMD_FINEVOLUP:
- m->command = CMD_MODCMDEX;
- m->param = 0xA0 | m->vol;
- break;
- case VOLCMD_PORTADOWN:
- m->command = CMD_PORTAMENTODOWN;
- m->param = m->vol << 2;
- break;
- case VOLCMD_PORTAUP:
- m->command = CMD_PORTAMENTOUP;
- m->param = m->vol << 2;
- break;
- case VOLCMD_TONEPORTAMENTO:
- m->command = CMD_TONEPORTAMENTO;
- m->param = m->vol << 2;
- break;
- case VOLCMD_VIBRATODEPTH:
- m->command = CMD_VIBRATO;
- m->param = m->vol;
- break;
- case VOLCMD_VIBRATOSPEED:
- m->command = CMD_VIBRATO;
- m->param = m->vol << 4;
- break;
- // OpenMPT-specific commands
- case VOLCMD_OFFSET:
- m->command = CMD_OFFSET;
- m->param = m->vol << 3;
- break;
- case VOLCMD_VELOCITY:
- m->command = CMD_VOLUME;
- m->param = m->vol * 7;
- break;
- default:
- break;
}
- m->volcmd = CMD_NONE;
- } // End if (newTypeIsMOD)
-
- ///////////////////////////////////////////////////
- // Convert anything to S3M - adjust volume column
- if (newTypeIsS3M)
- {
- if(!m->command) switch(m->volcmd)
- {
- case VOLCMD_VOLSLIDEDOWN:
- m->command = CMD_VOLUMESLIDE;
- m->param = m->vol;
- m->volcmd = CMD_NONE;
- break;
- case VOLCMD_VOLSLIDEUP:
- m->command = CMD_VOLUMESLIDE;
- m->param = m->vol << 4;
- m->volcmd = CMD_NONE;
- break;
- case VOLCMD_FINEVOLDOWN:
- m->command = CMD_VOLUMESLIDE;
- m->param = 0xF0 | m->vol;
- m->volcmd = CMD_NONE;
- break;
- case VOLCMD_FINEVOLUP:
- m->command = CMD_VOLUMESLIDE;
- m->param = (m->vol << 4) | 0x0F;
- m->volcmd = CMD_NONE;
- break;
- case VOLCMD_PORTADOWN:
- m->command = CMD_PORTAMENTODOWN;
- m->param = m->vol << 2;
- m->volcmd = CMD_NONE;
- break;
- case VOLCMD_PORTAUP:
- m->command = CMD_PORTAMENTOUP;
- m->param = m->vol << 2;
- m->volcmd = CMD_NONE;
- break;
- case VOLCMD_TONEPORTAMENTO:
- m->command = CMD_TONEPORTAMENTO;
- m->param = m->vol << 2;
- m->volcmd = CMD_NONE;
- break;
- case VOLCMD_VIBRATODEPTH:
- m->command = CMD_VIBRATO;
- m->param = m->vol;
- m->volcmd = CMD_NONE;
- break;
- case VOLCMD_VIBRATOSPEED:
- m->command = CMD_VIBRATO;
- m->param = m->vol << 4;
- m->volcmd = CMD_NONE;
- break;
- case VOLCMD_PANSLIDELEFT:
- m->command = CMD_PANNINGSLIDE;
- m->param = m->vol << 4;
- m->volcmd = CMD_NONE;
- break;
- case VOLCMD_PANSLIDERIGHT:
- m->command = CMD_PANNINGSLIDE;
- m->param = m->vol;
- m->volcmd = CMD_NONE;
- break;
- // OpenMPT-specific commands
- case VOLCMD_OFFSET:
- m->command = CMD_OFFSET;
- m->param = m->vol << 3;
- m->volcmd = CMD_NONE;
- break;
- case VOLCMD_VELOCITY:
- m->volcmd = CMD_VOLUME;
- m->vol *= 7;
- break;
- default:
- break;
- }
- } // End if (newTypeIsS3M)
-
- //////////////////////////////////////////////////
- // Convert anything to XM - adjust volume column
- if (newTypeIsXM)
- {
- if(!m->command) switch(m->volcmd)
- {
- case VOLCMD_PORTADOWN:
- m->command = CMD_PORTAMENTODOWN;
- m->param = m->vol << 2;
- m->volcmd = CMD_NONE;
- break;
- case VOLCMD_PORTAUP:
- m->command = CMD_PORTAMENTOUP;
- m->param = m->vol << 2;
- m->volcmd = CMD_NONE;
- break;
- // OpenMPT-specific commands
- case VOLCMD_OFFSET:
- m->command = CMD_OFFSET;
- m->param = m->vol << 3;
- m->volcmd = CMD_NONE;
- break;
- case VOLCMD_VELOCITY:
- m->volcmd = CMD_VOLUME;
- m->vol *= 7;
- break;
- default:
- break;
- }
- } // End if (newTypeIsXM)
-
- ///////////////////////////////////////////////////
- // Convert anything to IT - adjust volume column
- if (newTypeIsIT_MPT)
- {
- if(!m->command) switch(m->volcmd)
- {
- case VOLCMD_VOLSLIDEDOWN:
- case VOLCMD_VOLSLIDEUP:
- case VOLCMD_FINEVOLDOWN:
- case VOLCMD_FINEVOLUP:
- case VOLCMD_PORTADOWN:
- case VOLCMD_PORTAUP:
- case VOLCMD_TONEPORTAMENTO:
- case VOLCMD_VIBRATODEPTH:
- // OpenMPT-specific commands
- case VOLCMD_OFFSET:
- case VOLCMD_VELOCITY:
- m->vol = min(m->vol, 9);
- break;
- case VOLCMD_PANSLIDELEFT:
- m->command = CMD_PANNINGSLIDE;
- m->param = m->vol << 4;
- m->volcmd = CMD_NONE;
- break;
- case VOLCMD_PANSLIDERIGHT:
- m->command = CMD_PANNINGSLIDE;
- m->param = m->vol;
- m->volcmd = CMD_NONE;
- break;
- case VOLCMD_VIBRATOSPEED:
- m->command = CMD_VIBRATO;
- m->param = m->vol << 4;
- m->volcmd = CMD_NONE;
- break;
- default:
- break;
- }
- } // End if (newTypeIsIT)
-
- if(!m_SndFile.GetModSpecifications().HasNote(m->note))
- m->note = NOTE_NONE;
+ }
}
}
@@ -704,6 +294,7 @@
}
if (!newTypeIsIT_MPT) m_SndFile.m_dwSongFlags &= ~(SONG_ITOLDEFFECTS|SONG_ITCOMPATMODE);
if (!newTypeIsS3M) m_SndFile.m_dwSongFlags &= ~SONG_FASTVOLSLIDES;
+ if (!newTypeIsMOD) m_SndFile.m_dwSongFlags &= ~SONG_PT1XMODE;
END_CRITICAL();
ChangeFileExtension(nNewType);
Modified: trunk/OpenMPT/mptrack/dlg_misc.cpp
===================================================================
--- trunk/OpenMPT/mptrack/dlg_misc.cpp 2009-10-12 22:04:33 UTC (rev 397)
+++ trunk/OpenMPT/mptrack/dlg_misc.cpp 2009-10-13 20:20:48 UTC (rev 398)
@@ -102,6 +102,7 @@
// -> CODE#0023
// -> DESC="IT project files (.itp)"
ON_COMMAND(IDC_CHECK6, OnCheck6)
+ ON_COMMAND(IDC_CHECK_PT1X, OnCheckPT1x)
ON_CBN_SELCHANGE(IDC_COMBO1,UpdateDialog)
// -! NEW_FEATURE#0023
//}}AFX_MSG_MAP
@@ -125,6 +126,7 @@
// -> CODE#0023
// -> DESC="IT project files (.itp)"
DDX_Control(pDX, IDC_CHECK6, m_CheckBox6);
+ DDX_Control(pDX, IDC_CHECK_PT1X, m_CheckBoxPT1x);
DDX_Control(pDX, IDC_EDIT_FLAGS, m_EditFlag);
// -! NEW_FEATURE#0023
//}}AFX_DATA_MAP
@@ -249,6 +251,7 @@
m_CheckBox3.SetCheck((m_pSndFile->m_dwSongFlags & SONG_ITOLDEFFECTS) ? MF_CHECKED : 0);
m_CheckBox4.SetCheck((m_pSndFile->m_dwSongFlags & SONG_ITCOMPATMODE) ? MF_CHECKED : 0);
m_CheckBox5.SetCheck((m_pSndFile->m_dwSongFlags & SONG_EXFILTERRANGE) ? MF_CHECKED : 0);
+ m_CheckBoxPT1x.SetCheck((m_pSndFile->m_dwSongFlags & SONG_PT1XMODE) ? MF_CHECKED : 0);
// -> CODE#0023
// -> DESC="IT project files (.itp)"
@@ -260,6 +263,7 @@
m_CheckBox3.EnableWindow((m_pSndFile->m_nType & (MOD_TYPE_IT|MOD_TYPE_MPT)) ? TRUE : FALSE);
m_CheckBox4.EnableWindow((m_pSndFile->m_nType & (MOD_TYPE_IT|MOD_TYPE_MPT)) ? TRUE : FALSE);
m_CheckBox5.EnableWindow((m_pSndFile->m_nType & (MOD_TYPE_XM|MOD_TYPE_IT|MOD_TYPE_MPT)) ? TRUE : FALSE);
+ m_CheckBoxPT1x.EnableWindow((m_pSndFile->m_nType & (MOD_TYPE_MOD)) ? TRUE : FALSE);
// -> CODE#0023
// -> DESC="IT project files (.itp)"
@@ -394,7 +398,16 @@
m_pSndFile->m_dwSongFlags &= ~SONG_ITPEMBEDIH;
}
+void CModTypeDlg::OnCheckPT1x()
+//-----------------------------
+{
+ if (m_CheckBoxPT1x.GetCheck())
+ m_pSndFile->m_dwSongFlags |= SONG_PT1XMODE;
+ else
+ m_pSndFile->m_dwSongFlags &= ~SONG_PT1XMODE;
+}
+
BOOL CModTypeDlg::VerifyData()
//---------------------------------
{
Modified: trunk/OpenMPT/mptrack/dlg_misc.h
===================================================================
--- trunk/OpenMPT/mptrack/dlg_misc.h 2009-10-12 22:04:33 UTC (rev 397)
+++ trunk/OpenMPT/mptrack/dlg_misc.h 2009-10-13 20:20:48 UTC (rev 398)
@@ -11,7 +11,7 @@
{
public:
CComboBox m_TypeBox, m_ChannelsBox, m_TempoModeBox, m_PlugMixBox;
- CButton m_CheckBox1, m_CheckBox2, m_CheckBox3, m_CheckBox4, m_CheckBox5;
+ CButton m_CheckBox1, m_CheckBox2, m_CheckBox3, m_CheckBox4, m_CheckBox5, m_CheckBoxPT1x;
CEdit m_EditFlag;
CSoundFile *m_pSndFile;
UINT m_nChannels, m_nType;
@@ -50,6 +50,7 @@
// -> DESC="IT project files (.itp)"
afx_msg void OnCheck6();
// -! NEW_FEATURE#0023
+ afx_msg void OnCheckPT1x();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
Modified: trunk/OpenMPT/mptrack/mptrack.rc
===================================================================
--- trunk/OpenMPT/mptrack/mptrack.rc 2009-10-12 22:04:33 UTC (rev 397)
+++ trunk/OpenMPT/mptrack/mptrack.rc 2009-10-13 20:20:48 UTC (rev 398)
@@ -628,6 +628,7 @@
LTEXT "Rows/beat",IDC_TEXT_ROWSPERBEAT,186,224,36,8
EDITTEXT IDC_ROWSPERMEASURE,156,240,24,12,ES_AUTOHSCROLL | ES_NUMBER
LTEXT "Rows/measure",IDC_TEXT_ROWSPERMEASURE,186,242,49,8
+ CONTROL "ProTracker 1.x Mode (MOD)",IDC_CHECK_PT1X,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,120,96,108,10
END
IDD_SHOWLOG DIALOG 0, 0, 300, 106
Modified: trunk/OpenMPT/mptrack/resource.h
===================================================================
--- trunk/OpenMPT/mptrack/resource.h 2009-10-12 22:04:33 UTC (rev 397)
+++ trunk/OpenMPT/mptrack/resource.h 2009-10-13 20:20:48 UTC (rev 398)
@@ -908,6 +908,7 @@
#define IDC_CHK_REMOVE_PLUGINS 2405
#define IDC_CHK_OPTIMIZE_SAMPLES 2406
#define IDC_CHK_MERGE_SEQUENCES 2408
+#define IDC_CHECK_PT1X 2409
#define ID_FILE_NEWMOD 32771
#define ID_FILE_NEWXM 32772
#define ID_FILE_NEWS3M 32773
@@ -1152,7 +1153,7 @@
#define _APS_3D_CONTROLS 1
#define _APS_NEXT_RESOURCE_VALUE 522
#define _APS_NEXT_COMMAND_VALUE 59231
-#define _APS_NEXT_CONTROL_VALUE 2409
+#define _APS_NEXT_CONTROL_VALUE 2410
#define _APS_NEXT_SYMED_VALUE 901
#endif
#endif
Modified: trunk/OpenMPT/soundlib/Snd_defs.h
===================================================================
--- trunk/OpenMPT/soundlib/Snd_defs.h 2009-10-12 22:04:33 UTC (rev 397)
+++ trunk/OpenMPT/soundlib/Snd_defs.h 2009-10-13 20:20:48 UTC (rev 398)
@@ -177,7 +177,7 @@
#define FLTMODE_UNCHANGED 0xFF
#define FLTMODE_LOWPASS 0
#define FLTMODE_HIGHPASS 1
-#define FLTMODE_BANDPASS 2
+#define FLTMODE_BANDPASS 2 // unused
#define RSF_16BIT 0x04
@@ -255,30 +255,31 @@
#define SYSMIX_SSE 0x20
// Module flags
-#define SONG_EMBEDMIDICFG 0x0001
-#define SONG_FASTVOLSLIDES 0x0002 // Old Scream Tracker 3.0 volume slides
-#define SONG_ITOLDEFFECTS 0x0004 // Old Impulse Tracker effect implementations
-#define SONG_ITCOMPATMODE 0x0008 // IT "Compatible Gxx"
-#define SONG_LINEARSLIDES 0x0010 // Linear slides vs. Amiga slides
-#define SONG_PATTERNLOOP 0x0020
-#define SONG_STEP 0x0040
-#define SONG_PAUSED 0x0080
-#define SONG_FADINGSONG 0x0100
-#define SONG_ENDREACHED 0x0200
-#define SONG_GLOBALFADE 0x0400
-#define SONG_CPUVERYHIGH 0x0800
-#define SONG_FIRSTTICK 0x1000
-#define SONG_MPTFILTERMODE 0x2000
-#define SONG_SURROUNDPAN 0x4000
-#define SONG_EXFILTERRANGE 0x8000
-#define SONG_AMIGALIMITS 0x10000
+#define SONG_EMBEDMIDICFG 0x0001 // Embed macros in file
+#define SONG_FASTVOLSLIDES 0x0002 // Old Scream Tracker 3.0 volume slides
+#define SONG_ITOLDEFFECTS 0x0004 // Old Impulse Tracker effect implementations
+#define SONG_ITCOMPATMODE 0x0008 // IT "Compatible Gxx"
+#define SONG_LINEARSLIDES 0x0010 // Linear slides vs. Amiga slides
+#define SONG_PATTERNLOOP 0x0020 // Loop current pattern (pattern editor)
+#define SONG_STEP 0x0040 // Song is in "step" mode (pattern editor)
+#define SONG_PAUSED 0x0080 // Song is paused
+#define SONG_FADINGSONG 0x0100 // Song is fading out
+#define SONG_ENDREACHED 0x0200 // Song is finished
+#define SONG_GLOBALFADE 0x0400 // Song is fading out
+#define SONG_CPUVERYHIGH 0x0800 // High CPU usage
+#define SONG_FIRSTTICK 0x1000 // Is set when the current tick is the first tick of the row
+#define SONG_MPTFILTERMODE 0x2000 // Local filter mode (reset filter on each note)
+#define SONG_SURROUNDPAN 0x4000 // Pan in the rear channels
+#define SONG_EXFILTERRANGE 0x8000 // Cutoff Filter has double frequency range (up to ~10Khz)
+#define SONG_AMIGALIMITS 0x10000 // Enforce amiga frequency limits
// -> CODE#0023
// -> DESC="IT project files (.itp)"
-#define SONG_ITPROJECT 0x20000
-#define SONG_ITPEMBEDIH 0x40000
+#define SONG_ITPROJECT 0x20000 // Is a project file
+#define SONG_ITPEMBEDIH 0x40000 // Embed instrument headers in project file
// -! NEW_FEATURE#0023
-#define SONG_BREAKTOROW 0x80000
-#define SONG_POSJUMP 0x100000
+#define SONG_BREAKTOROW 0x80000 // Break to row command encountered (internal flag, do not touch)
+#define SONG_POSJUMP 0x100000 // Position jump encountered (internal flag, do not touch)
+#define SONG_PT1XMODE 0x200000 // ProTracker 1.x playback mode
// Global Options (Renderer)
#define SNDMIX_REVERSESTEREO 0x0001
@@ -307,7 +308,7 @@
#define SNDMIX_DIRECTTODISK 0x10000
#define SNDMIX_ENABLEMMX 0x20000
#define SNDMIX_NOBACKWARDJUMPS 0x40000
-#define SNDMIX_MAXDEFAULTPAN 0x80000 // Used by the MOD loader
+#define SNDMIX_MAXDEFAULTPAN 0x80000 // Used by the MOD loader (currently unused)
#define SNDMIX_MUTECHNMODE 0x100000 // Notes are not played on muted channels
#define SNDMIX_EMULATE_MIX_BUGS 0x200000 // rewbs.emulateMixBugs
Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Snd_fx.cpp 2009-10-12 22:04:33 UTC (rev 397)
+++ trunk/OpenMPT/soundlib/Snd_fx.cpp 2009-10-13 20:20:48 UTC (rev 398)
@@ -1249,7 +1249,7 @@
if ((!note) && (instr)) //Case: instrument with no note data.
{
//IT compatibility: Instrument with no note.
- if(IsCompatibleMode(TRK_IMPULSETRACKER))
+ if(IsCompatibleMode(TRK_IMPULSETRACKER) || (m_dwSongFlags & SONG_PT1XMODE))
{
if(m_nInstruments)
{
@@ -2526,9 +2526,15 @@
// EEx: Pattern Delay
case 0xF0:
if((m_nType & MOD_TYPE_MOD) != 0) // MOD: Invert Loop
+ {
pChn->nEFxSpeed = param;
+ pChn->pEFxSample = pChn->pModSample;
+ if(m_dwSongFlags & SONG_FIRSTTICK) InvertLoop(pChn);
+ }
else // XM: Set Active Midi Macro
+ {
pChn->nActiveMacro = param;
+ }
break;
}
}
@@ -2633,7 +2639,7 @@
//------------------------------------------------------------------
{
// S9x and X9x commands (S3M/XM/IT only)
- if (m_nTickCount) return;
+ if(!(m_dwSongFlags & SONG_FIRSTTICK)) return;
switch(param & 0x0F)
{
// S90: Surround Off
@@ -2689,18 +2695,23 @@
//--------------------------------------------------
{
// EFx implementation for MOD files (PT 1.1A and up: Invert Loop)
- // This effect trashes samples.
+ // This effect trashes samples. Thanks to bubsy for making this work. :)
if((m_nType & MOD_TYPE_MOD) == 0 || pChn->nEFxSpeed == 0) return;
- pChn->nEFxDelay += ModEFxTable[pChn->nEFxSpeed];
- if(pChn->nEFxDelay < 0x80) return;
+ pChn->nEFxDelay += ModEFxTable[pChn->nEFxSpeed & 0x0F];
+
+ if(pChn->nEFxDelay < 0x80) return; // only applied if the "delay" reaches 128
pChn->nEFxDelay = 0;
- if (++pChn->nEFxOffset >= pChn->nLoopEnd - pChn->nLoopStart)
+
+ // we obviously also need a sample for this
+ MODSAMPLE *pModSample = pChn->pEFxSample;
+ if(pModSample == nullptr || pModSample->pSample == nullptr || !(pModSample->uFlags & CHN_LOOP)) return;
+
+ if (++pChn->nEFxOffset >= pModSample->nLoopEnd - pModSample->nLoopStart)
pChn->nEFxOffset = 0;
// TRASH IT!!! (Yes, the sample!)
- if(pChn->pSample != nullptr && (pChn->dwFlags & CHN_LOOP))
- pChn->pSample[pChn->nLoopStart + pChn->nEFxOffset] = ~pChn->pSample[pChn->nLoopStart + pChn->nEFxOffset];
+ pModSample->pSample[pModSample->nLoopStart + pChn->nEFxOffset] = ~pModSample->pSample[pModSample->nLoopStart + pChn->nEFxOffset];
}
Modified: trunk/OpenMPT/soundlib/Sndfile.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Sndfile.cpp 2009-10-12 22:04:33 UTC (rev 397)
+++ trunk/OpenMPT/soundlib/Sndfile.cpp 2009-10-13 20:20:48 UTC (rev 398)
@@ -3258,4 +3258,460 @@
case 0xB0: m->param = (m->param & 0x0F) | 0x60; break;
// rest are the same
}
+}
+
+// Convert a mod command from one format to another.
+void CSoundFile::ConvertCommand(MODCOMMAND *m, MODTYPE nOldType, MODTYPE nNewType)
+//--------------------------------------------------------------------------------
+{
+ // helper variables
+ const bool oldTypeIsMOD = (nOldType == MOD_TYPE_MOD), oldTypeIsXM = (nOldType == MOD_TYPE_XM),
+ oldTypeIsS3M = (nOldType == MOD_TYPE_S3M), oldTypeIsIT = (nOldType == MOD_TYPE_IT),
+ oldTypeIsMPT = (nOldType == MOD_TYPE_MPT), oldTypeIsMOD_XM = (oldTypeIsMOD || oldTypeIsXM),
+ oldTypeIsS3M_IT_MPT = (oldTypeIsS3M || oldTypeIsIT || oldTypeIsMPT),
+ oldTypeIsIT_MPT = (oldTypeIsIT || oldTypeIsMPT);
+
+ const bool newTypeIsMOD = (nNewType == MOD_TYPE_MOD), newTypeIsXM = (nNewType == MOD_TYPE_XM),
+ newTypeIsS3M = (nNewType == MOD_TYPE_S3M), newTypeIsIT = (nNewType == MOD_TYPE_IT),
+ newTypeIsMPT = (nNewType == MOD_TYPE_MPT), newTypeIsMOD_XM = (newTypeIsMOD || newTypeIsXM),
+ newTypeIsS3M_IT_MPT = (newTypeIsS3M || newTypeIsIT || newTypeIsMPT),
+ newTypeIsIT_MPT = (newTypeIsIT || newTypeIsMPT);
+
+ //////////////////////////
+ // Convert 8-bit Panning
+ if(m->command == CMD_PANNING8)
+ {
+ if(newTypeIsS3M)
+ {
+ m->param = (m->param + 1) >> 1;
+ }
+ else if(oldTypeIsS3M)
+ {
+ if(m->param == 0xA4)
+ {
+ // surround remap
+ m->command = (nNewType & (MOD_TYPE_IT|MOD_TYPE_MPT)) ? CMD_S3MCMDEX : CMD_XFINEPORTAUPDOWN;
+ m->param = 0x91;
+ }
+ else
+ {
+ m->param = min(m->param << 1, 0xFF);
+ }
+ }
+ } // End if(m->command == CMD_PANNING8)
+
+ //////////////////////////
+ // Convert param control
+ if(oldTypeIsMPT)
+ {
+ if(m->note == NOTE_PC || m->note == NOTE_PCS)
+ {
+ m->param = (BYTE)(min(MODCOMMAND::maxColumnValue, m->GetValueEffectCol()) * 0x7F / MODCOMMAND::maxColumnValue);
+ m->command = (m->note == NOTE_PC) ? CMD_MIDI : CMD_SMOOTHMIDI; // might be removed later
+ m->volcmd = VOLCMD_NONE;
+ m->note = NOTE_NONE;
+ }
+ } // End if(oldTypeIsMPT)
+
+ /////////////////////////////////////////
+ // Convert MOD / XM to S3M / IT / MPTM
+ if(oldTypeIsMOD_XM && newTypeIsS3M_IT_MPT)
+ {
+ switch(m->command)
+ {
+ case CMD_MODCMDEX:
+ MODExx2S3MSxx(m);
+ break;
+ case CMD_VOLUME:
+ if (!m->volcmd)
+ {
+ m->volcmd = VOLCMD_VOLUME;
+ m->vol = m->param;
+ if (m->vol > 0x40) m->vol = 0x40;
+ m->command = m->param = 0;
+ }
+ break;
+ case CMD_PORTAMENTOUP:
+ if (m->param > 0xDF) m->param = 0xDF;
+ break;
+ case CMD_PORTAMENTODOWN:
+ if (m->param > 0xDF) m->param = 0xDF;
+ break;
+ case CMD_XFINEPORTAUPDOWN:
+ switch(m->param & 0xF0)
+ {
+ case 0x10: m->command = CMD_PORTAMENTOUP; m->param = (m->param & 0x0F) | 0xE0; break;
+ case 0x20: m->command = CMD_PORTAMENTODOWN; m->param = (m->param & 0x0F) | 0xE0; break;
+ case 0x50:
+ case 0x60:
+ case 0x70:
+ case 0x90:
+ case 0xA0:
+ m->command = CMD_S3MCMDEX;
+ // surround remap (this is the "official" command)
+ if(nNewType & MOD_TYPE_S3M && m->param == 0x91)
+ {
+ m->command = CMD_PANNING8;
+ m->param = 0xA4;
+ }
+ break;
+ }
+ break;
+ case CMD_KEYOFF:
+ if(m->note == 0)
+ {
+ m->note = (newTypeIsS3M) ? NOTE_NOTECUT : NOTE_KEYOFF;
+ m->command = CMD_S3MCMDEX;
+ if(m->param == 0)
+ m->instr = 0;
+ m->param = 0xD0 | (m->param & 0x0F);
+ }
+ break;
+ case CMD_PANNINGSLIDE:
+ // swap L/R
+ m->param = ((m->param & 0x0F) << 4) | (m->param >> 4);
+ default:
+ break;
+ }
+ } // End if(oldTypeIsMOD_XM && newTypeIsS3M_IT_MPT)
+
+
+ /////////////////////////////////////////
+ // Convert S3M / IT / MPTM to MOD / XM
+ else if(oldTypeIsS3M_IT_MPT && newTypeIsMOD_XM)
+ {
+ if(m->note == NOTE_NOTECUT || m->note == NOTE_FADE)
+ m->note = NOTE_KEYOFF;
+
+ switch(m->command)
+ {
+ case CMD_S3MCMDEX:
+ S3MSxx2MODExx(m);
+ break;
+ case CMD_VOLUMESLIDE:
+ if ((m->param & 0xF0) && ((m->param & 0x0F) == 0x0F))
+ {
+ m->command = CMD_MODCMDEX;
+ m->param = (m->param >> 4) | 0xA0;
+ } else
+ if ((m->param & 0x0F) && ((m->param & 0xF0) == 0xF0))
+ {
+ m->command = CMD_MODCMDEX;
+ m->param = (m->param & 0x0F) | 0xB0;
+ }
+ break;
+ case CMD_PORTAMENTOUP:
+ if (m->param >= 0xF0)
+ {
+ m->command = CMD_MODCMDEX;
+ m->param = (m->param & 0x0F) | 0x10;
+ } else
+ if (m->param >= 0xE0)
+ {
+ m->command = CMD_MODCMDEX;
+ m->param = (((m->param & 0x0F)+3) >> 2) | 0x10;
+ } else m->command = CMD_PORTAMENTOUP;
+ break;
+ case CMD_PORTAMENTODOWN:
+ if (m->param >= 0xF0)
+ {
+ m->command = CMD_MODCMDEX;
+ m->param = (m->param & 0x0F) | 0x20;
+ } else
+ if (m->param >= 0xE0)
+ {
+ m->command = CMD_MODCMDEX;
+ m->param = (((m->param & 0x0F)+3) >> 2) | 0x20;
+ } else m->command = CMD_PORTAMENTODOWN;
+ break;
+ case CMD_SPEED:
+ {
+ m->param = min(m->param, (nNewType == MOD_TYPE_XM) ? 0x1F : 0x20);
+ }
+ break;
+ case CMD_TEMPO:
+ if(m->param < 0x20) m->command = CMD_NONE; // no tempo slides
+ break;
+ case CMD_PANNINGSLIDE:
+ // swap L/R
+ m->param = ((m->param & 0x0F) << 4) | (m->param >> 4);
+ // remove fine slides
+ if((m->param > 0xF0) || ((m->param & 0x0F) == 0x0F && m->param != 0x0F))
+ m->command = CMD_NONE;
+ default:
+ break;
+ }
+ } // End if(oldTypeIsS3M_IT_MPT && newTypeIsMOD_XM)
+
+
+ ///////////////////////
+ // Convert IT to S3M
+ else if (oldTypeIsIT_MPT && newTypeIsS3M)
+ {
+ if(m->note == NOTE_KEYOFF || m->note == NOTE_FADE)
+ m->note = NOTE_NOTECUT;
+
+ switch(m->command)
+ {
+ case CMD_S3MCMDEX:
+ if(m->param == 0x91)
+ {
+ // surround remap (this is the "official" command)
+ m->command = CMD_PANNING8;
+ m->param = 0xA4;
+ }
+ break;
+ case CMD_SMOOTHMIDI:
+ m->command = CMD_MIDI;
+ break;
+ default:
+ break;
+ }
+ } // End if (oldTypeIsIT_MPT && newTypeIsS3M)
+
+
+
+ ///////////////////////////////////////////////////////////////////////
+ // Convert MOD to anything - adjust effect memory, remove Invert Loop
+ if (oldTypeIsMOD)
+ {
+ switch(m->command)
+ {
+ case CMD_TONEPORTAVOL: // lacks memory -> 500 is the same as 300
+ if(m->param == 0x00) m->command = CMD_TONEPORTAMENTO;
+ break;
+ case CMD_VIBRATOVOL: // lacks memory -> 600 is the same as 400
+ if(m->param == 0x00) m->command = CMD_VIBRATO;
+ break;
+
+ case CMD_MODCMDEX: // This would turn into "Set Active Macro", so let's better remove it
+ if((m->param & 0xF0) == 0xF0) m->command = CMD_NONE;
+ break;
+ }
+ } // End if (oldTypeIsMOD && newTypeIsXM)
+
+ /////////////////////////////////////////////////////////////////////
+ // Convert anything to MOD - remove volume column, remove Set Macro
+ if (newTypeIsMOD)
+ {
+ if(m->command) switch(m->command)
+ {
+ case CMD_RETRIG: // MOD only has E9x
+ m->command = CMD_MODCMDEX;
+ m->param = 0x90 | (m->param & 0x0F);
+ break;
+ case CMD_MODCMDEX: // This would turn into "Invert Loop", so let's better remove it
+ if((m->param & 0xF0) == 0xF0) m->command = CMD_NONE;
+ break;
+ }
+
+ else switch(m->volcmd)
+ {
+ case VOLCMD_VOLUME:
+ m->command = CMD_VOLUME;
+ m->param = m->vol;
+ break;
+ case VOLCMD_PANNING:
+ m->command = CMD_PANNING8;
+ m->param = CLAMP(m->vol << 2, 0, 0xFF);
+ break;
+ case VOLCMD_VOLSLIDEDOWN:
+ m->command = CMD_VOLUMESLIDE;
+ m->param = m->vol;
+ break;
+ case VOLCMD_VOLSLIDEUP:
+ m->command = CMD_VOLUMESLIDE;
+ m->param = m->vol << 4;
+ break;
+ case VOLCMD_FINEVOLDOWN:
+ m->command = CMD_MODCMDEX;
+ m->param = 0xB0 | m->vol;
+ break;
+ case VOLCMD_FINEVOLUP:
+ m->command = CMD_MODCMDEX;
+ m->param = 0xA0 | m->vol;
+ break;
+ case VOLCMD_PORTADOWN:
+ m->command = CMD_PORTAMENTODOWN;
+ m->param = m->vol << 2;
+ break;
+ case VOLCMD_PORTAUP:
+ m->command = CMD_PORTAMENTOUP;
+ m->param = m->vol << 2;
+ break;
+ case VOLCMD_TONEPORTAMENTO:
+ m->command = CMD_TONEPORTAMENTO;
+ m->param = m->vol << 2;
+ break;
+ case VOLCMD_VIBRATODEPTH:
+ m->command = CMD_VIBRATO;
+ m->param = m->vol;
+ break;
+ case VOLCMD_VIBRATOSPEED:
+ m->command = CMD_VIBRATO;
+ m->param = m->vol << 4;
+ break;
+ // OpenMPT-specific commands
+ case VOLCMD_OFFSET:
+ m->command = CMD_OFFSET;
+ m->param = m->vol << 3;
+ break;
+ case VOLCMD_VELOCITY:
+ m->command = CMD_VOLUME;
+ m->param = m->vol * 7;
+ break;
+ default:
+ break;
+ }
+ m->volcmd = CMD_NONE;
+ } // End if (newTypeIsMOD)
+
+ ///////////////////////////////////////////////////
+ // Convert anything to S3M - adjust volume column
+ if (newTypeIsS3M)
+ {
+ if(!m->command) switch(m->volcmd)
+ {
+ case VOLCMD_VOLSLIDEDOWN:
+ m->command = CMD_VOLUMESLIDE;
+ m->param = m->vol;
+ m->volcmd = CMD_NONE;
+ break;
+ case VOLCMD_VOLSLIDEUP:
+ m->command = CMD_VOLUMESLIDE;
+ m->param = m->vol << 4;
+ m->volcmd = CMD_NONE;
+ break;
+ case VOLCMD_FINEVOLDOWN:
+ m->command = CMD_VOLUMESLIDE;
+ m->param = 0xF0 | m->vol;
+ m->volcmd = CMD_NONE;
+ break;
+ case VOLCMD_FINEVOLUP:
+ m->command = CMD_VOLUMESLIDE;
+ m->param = (m->vol << 4) | 0x0F;
+ m->volcmd = CMD_NONE;
+ break;
+ case VOLCMD_PORTADOWN:
+ m->command = CMD_PORTAMENTODOWN;
+ m->param = m->vol << 2;
+ m->volcmd = CMD_NONE;
+ break;
+ case VOLCMD_PORTAUP:
+ m->command = CMD_PORTAMENTOUP;
+ m->param = m->vol << 2;
+ m->volcmd = CMD_NONE;
+ break;
+ case VOLCMD_TONEPORTAMENTO:
+ m->command = CMD_TONEPORTAMENTO;
+ m->param = m->vol << 2;
+ m->volcmd = CMD_NONE;
+ break;
+ case VOLCMD_VIBRATODEPTH:
+ m->command = CMD_VIBRATO;
+ m->param = m->vol;
+ m->volcmd = CMD_NONE;
+ break;
+ case VOLCMD_VIBRATOSPEED:
+ m->command = CMD_VIBRATO;
+ m->param = m->vol << 4;
+ m->volcmd = CMD_NONE;
+ break;
+ case VOLCMD_PANSLIDELEFT:
+ m->command = CMD_PANNINGSLIDE;
+ m->param = m->vol << 4;
+ m->volcmd = CMD_NONE;
+ break;
+ case VOLCMD_PANSLIDERIGHT:
+ m->command = CMD_PANNINGSLIDE;
+ m->param = m->vol;
+ m->volcmd = CMD_NONE;
+ break;
+ // OpenMPT-specific commands
+ case VOLCMD_OFFSET:
+ m->command = CMD_OFFSET;
+ m->param = m->vol << 3;
+ m->volcmd = CMD_NONE;
+ break;
+ case VOLCMD_VELOCITY:
+ m->volcmd = CMD_VOLUME;
+ m->vol *= 7;
+ break;
+ default:
+ break;
+ }
+ } // End if (newTypeIsS3M)
+
+ //////////////////////////////////////////////////
+ // Convert anything to XM - adjust volume column
+ if (newTypeIsXM)
+ {
+ if(!m->command) switch(m->volcmd)
+ {
+ case VOLCMD_PORTADOWN:
+ m->command = CMD_PORTAMENTODOWN;
+ m->param = m->vol << 2;
+ m->volcmd = CMD_NONE;
+ break;
+ case VOLCMD_PORTAUP:
+ m->command = CMD_PORTAMENTOUP;
+ m->param = m->vol << 2;
+ m->volcmd = CMD_NONE;
+ break;
+ // OpenMPT-specific commands
+ case VOLCMD_OFFSET:
+ m->command = CMD_OFFSET;
+ m->param = m->vol << 3;
+ m->volcmd = CMD_NONE;
+ break;
+ case VOLCMD_VELOCITY:
+ m->volcmd = CMD_VOLUME;
+ m->vol *= 7;
+ break;
+ default:
+ break;
+ }
+ } // End if (newTypeIsXM)
+
+ ///////////////////////////////////////////////////
+ // Convert anything to IT - adjust volume column
+ if (newTypeIsIT_MPT)
+ {
+ if(!m->command) switch(m->volcmd)
+ {
+ case VOLCMD_VOLSLIDEDOWN:
+ case VOLCMD_VOLSLIDEUP:
+ case VOLCMD_FINEVOLDOWN:
+ case VOLCMD_FINEVOLUP:
+ case VOLCMD_PORTADOWN:
+ case VOLCMD_PORTAUP:
+ case VOLCMD_TONEPORTAMENTO:
+ case VOLCMD_VIBRATODEPTH:
+ // OpenMPT-specific commands
+ case VOLCMD_OFFSET:
+ case VOLCMD_VELOCITY:
+ m->vol = min(m->vol, 9);
+ break;
+ case VOLCMD_PANSLIDELEFT:
+ m->command = CMD_PANNINGSLIDE;
+ m->param = m->vol << 4;
+ m->volcmd = CMD_NONE;
+ break;
+ case VOLCMD_PANSLIDERIGHT:
+ m->command = CMD_PANNINGSLIDE;
+ m->param = m->vol;
+ m->volcmd = CMD_NONE;
+ break;
+ case VOLCMD_VIBRATOSPEED:
+ m->command = CMD_VIBRATO;
+ m->param = m->vol << 4;
+ m->volcmd = CMD_NONE;
+ break;
+ default:
+ break;
+ }
+ } // End if (newTypeIsIT)
+
+ if(!CSoundFile::GetModSpecifications(nNewType).HasNote(m->note))
+ m->note = NOTE_NONE;
}
\ No newline at end of file
Modified: trunk/OpenMPT/soundlib/Sndfile.h
===================================================================
--- trunk/OpenMPT/soundlib/Sndfile.h 2009-10-12 22:04:33 UTC (rev 397)
+++ trunk/OpenMPT/soundlib/Sndfile.h 2009-10-13 20:20:48 UTC (rev 398)
@@ -201,6 +201,7 @@
LONG nRestorePanOnNewNote; //If > 0, nPan should be set to nRestorePanOnNewNote - 1 on new note. Used to recover from panswing.
UINT nOldGlobalVolSlide;
DWORD nEFxOffset; // offset memory for Invert Loop (EFx, .MOD only)
+ MODSAMPLE *pEFxSample; // sample memory for Invert Loop (EFx, .MOD only)
// 8-bit members
BYTE nRestoreResonanceOnNewNote; //Like above
BYTE nRestoreCutoffOnNewNote; //Like above
@@ -741,8 +742,9 @@
void S3MSaveConvert(UINT *pcmd, UINT *pprm, BOOL bIT, BOOL bCompatibilityExport = false) const;
WORD ModSaveCommand(const MODCOMMAND *m, const bool bXM, const bool bCompatibilityExport = false) const;
- static void MODExx2S3MSxx(MODCOMMAND *m);
- static void S3MSxx2MODExx(MODCOMMAND *m);
+ static void ConvertCommand(MODCOMMAND *m, MODTYPE nOldType, MODTYPE nNewType); // Convert a complete MODCHANNEL item from one format to another
+ static void MODExx2S3MSxx(MODCOMMAND *m); // Convert Exx to Sxx
+ static void S3MSxx2MODExx(MODCOMMAND *m); // Convert Sxx to Exx
public:
// Real-time sound functions
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sag...@us...> - 2009-10-12 22:04:47
|
Revision: 397
http://modplug.svn.sourceforge.net/modplug/?rev=397&view=rev
Author: saga-games
Date: 2009-10-12 22:04:33 +0000 (Mon, 12 Oct 2009)
Log Message:
-----------
[Fix] Improvements to the "Invert Loop" effect (was only applied on rows with EFx)
Modified Paths:
--------------
trunk/OpenMPT/soundlib/Snd_fx.cpp
trunk/OpenMPT/soundlib/Sndfile.cpp
trunk/OpenMPT/soundlib/Sndfile.h
trunk/OpenMPT/soundlib/Sndmix.cpp
Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Snd_fx.cpp 2009-10-12 00:44:56 UTC (rev 396)
+++ trunk/OpenMPT/soundlib/Snd_fx.cpp 2009-10-12 22:04:33 UTC (rev 397)
@@ -34,6 +34,7 @@
extern signed char retrigTable1[16];
extern signed char retrigTable2[16];
extern short int ModRandomTable[64];
+extern BYTE ModEFxTable[16];
////////////////////////////////////////////////////////////
@@ -1869,10 +1870,11 @@
break;
}
+ // MOD Effect (called every row)
+ InvertLoop(&Chn[nChn]);
+ } // for(...) end
- }
-
// Navigation Effects
if(m_dwSongFlags & SONG_FIRSTTICK)
{
@@ -2522,8 +2524,12 @@
case 0xC0: NoteCut(nChn, param); break;
// EDx: Note Delay
// EEx: Pattern Delay
- // EFx: MOD: Invert Loop / Funk Repeat, XM: Set Active Midi Macro
- case 0xF0: pChn->nActiveMacro = param; break;
+ case 0xF0:
+ if((m_nType & MOD_TYPE_MOD) != 0) // MOD: Invert Loop
+ pChn->nEFxSpeed = param;
+ else // XM: Set Active Midi Macro
+ pChn->nActiveMacro = param;
+ break;
}
}
@@ -2679,6 +2685,25 @@
}
+inline void CSoundFile::InvertLoop(MODCHANNEL *pChn)
+//--------------------------------------------------
+{
+ // EFx implementation for MOD files (PT 1.1A and up: Invert Loop)
+ // This effect trashes samples.
+ if((m_nType & MOD_TYPE_MOD) == 0 || pChn->nEFxSpeed == 0) return;
+
+ pChn->nEFxDelay += ModEFxTable[pChn->nEFxSpeed];
+ if(pChn->nEFxDelay < 0x80) return;
+ pChn->nEFxDelay = 0;
+ if (++pChn->nEFxOffset >= pChn->nLoopEnd - pChn->nLoopStart)
+ pChn->nEFxOffset = 0;
+
+ // TRASH IT!!! (Yes, the sample!)
+ if(pChn->pSample != nullptr && (pChn->dwFlags & CHN_LOOP))
+ pChn->pSample[pChn->nLoopStart + pChn->nEFxOffset] = ~pChn->pSample[pChn->nLoopStart + pChn->nEFxOffset];
+}
+
+
void CSoundFile::ProcessMidiMacro(UINT nChn, LPCSTR pszMidiMacro, UINT param)
//---------------------------------------------------------------------------
{
@@ -3797,6 +3822,3 @@
pChn->m_CalculateFreq = true;
}
-
-
-
Modified: trunk/OpenMPT/soundlib/Sndfile.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Sndfile.cpp 2009-10-12 00:44:56 UTC (rev 396)
+++ trunk/OpenMPT/soundlib/Sndfile.cpp 2009-10-12 22:04:33 UTC (rev 397)
@@ -638,6 +638,7 @@
Chn[ich].dwFlags = ChnSettings[ich].dwFlags;
Chn[ich].nVolume = 256;
Chn[ich].nCutOff = 0x7F;
+ Chn[ich].nEFxSpeed = 0;
//IT compatibility 15. Retrigger
if(IsCompatibleMode(TRK_IMPULSETRACKER))
{
@@ -1467,6 +1468,7 @@
Chn[i].nRetrigCount = 0;
}
Chn[i].nTremorCount = 0;
+ Chn[i].nEFxSpeed = 0;
}
if(resetMask & 4)
Modified: trunk/OpenMPT/soundlib/Sndfile.h
===================================================================
--- trunk/OpenMPT/soundlib/Sndfile.h 2009-10-12 00:44:56 UTC (rev 396)
+++ trunk/OpenMPT/soundlib/Sndfile.h 2009-10-12 22:04:33 UTC (rev 397)
@@ -200,7 +200,7 @@
LONG nCutSwing, nResSwing;
LONG nRestorePanOnNewNote; //If > 0, nPan should be set to nRestorePanOnNewNote - 1 on new note. Used to recover from panswing.
UINT nOldGlobalVolSlide;
- DWORD nEFxOffset; // offset memory for either Funk Repeat or Invert Loop (EFx, .MOD only)
+ DWORD nEFxOffset; // offset memory for Invert Loop (EFx, .MOD only)
// 8-bit members
BYTE nRestoreResonanceOnNewNote; //Like above
BYTE nRestoreCutoffOnNewNote; //Like above
@@ -224,7 +224,7 @@
BYTE nRowCommand, nRowParam;
BYTE nLeftVU, nRightVU;
BYTE nActiveMacro, nFilterMode;
- BYTE nEFxDelay; // memory for either Funk Repeat or Invert Loop (EFx, .MOD only)
+ BYTE nEFxSpeed, nEFxDelay; // memory for Invert Loop (EFx, .MOD only)
uint16 m_RowPlugParam; //NOTE_PCs memory.
float m_nPlugParamValueStep; //rewbs.smoothVST
@@ -725,12 +725,12 @@
void WriteInstrumentPropertyForAllInstruments(__int32 code, __int16 size, FILE* f, MODINSTRUMENT* instruments[], UINT nInstruments);
void SaveExtendedInstrumentProperties(MODINSTRUMENT *instruments[], UINT nInstruments, FILE* f);
void SaveExtendedSongProperties(FILE* f);
- void LoadExtendedSongProperties(const MODTYPE modtype, LPCBYTE ptr, const LPCBYTE startpos, const size_t seachlimit, bool* pInterpretMptMade = NULL);
+ void LoadExtendedSongProperties(const MODTYPE modtype, LPCBYTE ptr, const LPCBYTE startpos, const size_t seachlimit, bool* pInterpretMptMade = false);
// Reads extended instrument properties(XM/IT/MPTM).
// If no errors occur and song extension tag is found, returns pointer to the beginning
// of the tag, else returns NULL.
- LPCBYTE LoadExtendedInstrumentProperties(const LPCBYTE pStart, const LPCBYTE pEnd, bool* pInterpretMptMade = NULL);
+ LPCBYTE LoadExtendedInstrumentProperties(const LPCBYTE pStart, const LPCBYTE pEnd, bool* pInterpretMptMade = false);
#endif // MODPLUG_NO_FILESAVE
// MOD Convert function
@@ -847,6 +847,7 @@
void ExtendedMODCommands(UINT nChn, UINT param);
void ExtendedS3MCommands(UINT nChn, UINT param);
void ExtendedChannelEffect(MODCHANNEL *, UINT param);
+ inline void InvertLoop(MODCHANNEL* pChn);
void ProcessMidiMacro(UINT nChn, LPCSTR pszMidiMacro, UINT param=0);
void ProcessSmoothMidiMacro(UINT nChn, LPCSTR pszMidiMacro, UINT param=0); //rewbs.smoothVST
void SetupChannelFilter(MODCHANNEL *pChn, bool bReset, int flt_modifier = 256) const;
Modified: trunk/OpenMPT/soundlib/Sndmix.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Sndmix.cpp 2009-10-12 00:44:56 UTC (rev 396)
+++ trunk/OpenMPT/soundlib/Sndmix.cpp 2009-10-12 22:04:33 UTC (rev 397)
@@ -78,7 +78,6 @@
extern signed char ft2VibratoTable[256]; // -64 .. +64
extern int MixSoundBuffer[MIXBUFFERSIZE*4];
extern int MixRearBuffer[MIXBUFFERSIZE*2];
-extern BYTE ModEFxTable[16];
#ifndef NO_REVERB
extern UINT gnReverbSend;
@@ -1692,24 +1691,6 @@
}
}
- // .MOD EFx implementation
- if((m_nType & MOD_TYPE_MOD) && pChn->nRowCommand == CMD_MODCMDEX && (pChn->nRowParam & 0xF0) == 0xF0)
- {
- pChn->nEFxDelay += ModEFxTable[pChn->nRowParam & 0x0F];
- if((pChn->dwFlags & CHN_LOOP) && (pChn->nEFxDelay & 0x80))
- {
- // invert loop code (PT 1.1A and up)
- pChn->nEFxDelay = 0;
-
- if (++pChn->nEFxOffset >= pChn->nLoopEnd - pChn->nLoopStart)
- pChn->nEFxOffset = 0;
-
- // TRASH IT!!! (Yes, the sample!)
- pChn->pSample[pChn->nLoopStart + pChn->nEFxOffset] = ~pChn->pSample[pChn->nLoopStart + pChn->nEFxOffset];
- }
- }
-
-
#ifdef MODPLUG_PLAYER
// Limit CPU -> > 80% -> don't ramp
if ((gnCPUUsage >= 80) && (!pChn->nRealVolume))
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sag...@us...> - 2009-10-12 00:45:09
|
Revision: 396
http://modplug.svn.sourceforge.net/modplug/?rev=396&view=rev
Author: saga-games
Date: 2009-10-12 00:44:56 +0000 (Mon, 12 Oct 2009)
Log Message:
-----------
[New] MOD Format: Support for the EFx command (Invert Loop). One has to pay attention when working with this command as it effictively trashes samples.
[Fix] IT Specs: Original IT specs concerning max orders/patterns were wrong. IT can handle up to 257 orders (as the last order is always ---, so it's actually 256 accessible orders), so the saving routines were also updated a bit.
[Fix] Instrument editor: When playing an instrument and disabling its envelopes at the same time, they're stopped (prevents filter envelope from turning into a pitch envelope)
[Imp] Instrument editor: Can now enter insanely high values into sample frequency input field (as they are supported by Impulse Tracker), allow only 65536 Hz for S3M files.
[Imp] Mod Creation: Ensure that the order length fits the current mod specifications (this was problematic when creating .MOD files)
[Imp] Playback: Added some more standard playback frequencies (176KHz, 192KHz)
[Imp] XM Loader: Allow to load modules with an empty order list (as they are, in fact, valid XM files)
[Ref] Some more internal refactoring.
Modified Paths:
--------------
trunk/OpenMPT/mptrack/Ctrl_smp.cpp
trunk/OpenMPT/mptrack/Draw_pat.cpp
trunk/OpenMPT/mptrack/EffectVis.cpp
trunk/OpenMPT/mptrack/Mod2wave.cpp
trunk/OpenMPT/mptrack/Moddoc.cpp
trunk/OpenMPT/mptrack/Moddoc.h
trunk/OpenMPT/mptrack/Mpdlgs.cpp
trunk/OpenMPT/mptrack/Mpdlgs.h
trunk/OpenMPT/mptrack/View_ins.cpp
trunk/OpenMPT/mptrack/dlg_misc.cpp
trunk/OpenMPT/mptrack/mod2wave.h
trunk/OpenMPT/soundlib/IT_DEFS.H
trunk/OpenMPT/soundlib/Load_it.cpp
trunk/OpenMPT/soundlib/Load_s3m.cpp
trunk/OpenMPT/soundlib/Load_xm.cpp
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
trunk/OpenMPT/soundlib/Tables.cpp
trunk/OpenMPT/soundlib/mod_specifications.h
Modified: trunk/OpenMPT/mptrack/Ctrl_smp.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Ctrl_smp.cpp 2009-10-11 17:35:03 UTC (rev 395)
+++ trunk/OpenMPT/mptrack/Ctrl_smp.cpp 2009-10-12 00:44:56 UTC (rev 396)
@@ -2652,7 +2652,7 @@
int n = GetDlgItemInt(IDC_EDIT5);
if (m_pSndFile->m_nType & (MOD_TYPE_IT|MOD_TYPE_S3M|MOD_TYPE_MPT))
{
- if ((n >= 2000) && (n <= 256000) && (n != (int)m_pSndFile->Samples[m_nSample].nC5Speed))
+ if ((n > 0) && (n <= (m_pSndFile->m_nType & MOD_TYPE_S3M) ? 65535 : 9999999) && (n != (int)m_pSndFile->Samples[m_nSample].nC5Speed))
{
m_pSndFile->Samples[m_nSample].nC5Speed = n;
int transp = CSoundFile::FrequencyToTranspose(n) >> 7;
@@ -2688,7 +2688,7 @@
{
LONG ft = CSoundFile::FrequencyToTranspose(m_pSndFile->Samples[m_nSample].nC5Speed) & 0x7f;
n = CSoundFile::TransposeToFrequency(n, ft);
- if ((n >= 500) && (n <= 256000) && (n != (int)m_pSndFile->Samples[m_nSample].nC5Speed))
+ if ((n > 0) && (n <= (m_pSndFile->m_nType & MOD_TYPE_S3M) ? 65535 : 9999999) && (n != (int)m_pSndFile->Samples[m_nSample].nC5Speed))
{
CHAR s[32];
m_pSndFile->Samples[m_nSample].nC5Speed = n;
@@ -3133,7 +3133,7 @@
UINT d = pSmp->nC5Speed;
if (d < 1) d = 8363;
d += (pos * m_nFinetuneStep);
- pSmp->nC5Speed = CLAMP(d, 579, 139921); // B-8, C-1
+ pSmp->nC5Speed = CLAMP(d, 1, 9999999); // 9999999 is max. in Impulse Tracker
int transp = CSoundFile::FrequencyToTranspose(pSmp->nC5Speed) >> 7;
int basenote = 60 - transp;
if (basenote < BASENOTE_MIN) basenote = BASENOTE_MIN;
Modified: trunk/OpenMPT/mptrack/Draw_pat.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Draw_pat.cpp 2009-10-11 17:35:03 UTC (rev 395)
+++ trunk/OpenMPT/mptrack/Draw_pat.cpp 2009-10-12 00:44:56 UTC (rev 396)
@@ -1519,7 +1519,7 @@
case 3:
case 4:
// display effect command
- if (!pModDoc->GetEffectName(s, m->command, m->param, FALSE, nChn)) s[0] = 0;
+ if (!pModDoc->GetEffectName(s, m->command, m->param, false, nChn)) s[0] = 0;
break;
}
}
Modified: trunk/OpenMPT/mptrack/EffectVis.cpp
===================================================================
--- trunk/OpenMPT/mptrack/EffectVis.cpp 2009-10-11 17:35:03 UTC (rev 395)
+++ trunk/OpenMPT/mptrack/EffectVis.cpp 2009-10-12 00:44:56 UTC (rev 396)
@@ -752,7 +752,7 @@
int k;
for (UINT i=0; i<numfx; i++)
{
- if (m_pModDoc->GetEffectInfo(i, s, TRUE))
+ if (m_pModDoc->GetEffectInfo(i, s, true))
{
k =m_cmbEffectList.AddString(s);
m_cmbEffectList.SetItemData(k, i);
Modified: trunk/OpenMPT/mptrack/Mod2wave.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Mod2wave.cpp 2009-10-11 17:35:03 UTC (rev 395)
+++ trunk/OpenMPT/mptrack/Mod2wave.cpp 2009-10-12 00:44:56 UTC (rev 396)
@@ -62,9 +62,9 @@
//-----------------------------------------------------------------------------------
{
m_bGivePlugsIdleTime = false;
- m_bNormalize = FALSE;
- m_bHighQuality = FALSE;
- m_bSelectPlay = FALSE;
+ m_bNormalize = false;
+ m_bHighQuality = false;
+ m_bSelectPlay = false;
if(nMinOrder != ORDERINDEX_INVALID && nMaxOrder != ORDERINDEX_INVALID)
{
// render selection
@@ -235,13 +235,13 @@
{
if (m_dwFileLimit) m_dwFileLimit = GetDlgItemInt(IDC_EDIT1, NULL, FALSE);
if (m_dwSongLimit) m_dwSongLimit = GetDlgItemInt(IDC_EDIT2, NULL, FALSE);
- m_bSelectPlay = IsDlgButtonChecked(IDC_RADIO2) ? TRUE : FALSE;
- m_nMinOrder = GetDlgItemInt(IDC_EDIT3, NULL, FALSE);
- m_nMaxOrder = GetDlgItemInt(IDC_EDIT4, NULL, FALSE);
- if (m_nMaxOrder < m_nMinOrder) m_bSelectPlay = FALSE;
- //m_bHighQuality = IsDlgButtonChecked(IDC_CHECK3) ? TRUE : FALSE; //rewbs.resamplerConf - we don't want this anymore.
- m_bNormalize = IsDlgButtonChecked(IDC_CHECK5) ? TRUE : FALSE;
- m_bGivePlugsIdleTime = IsDlgButtonChecked(IDC_GIVEPLUGSIDLETIME) ? TRUE : FALSE;
+ m_bSelectPlay = IsDlgButtonChecked(IDC_RADIO2) ? true : false;
+ m_nMinOrder = (ORDERINDEX)GetDlgItemInt(IDC_EDIT3, NULL, FALSE);
+ m_nMaxOrder = (ORDERINDEX)GetDlgItemInt(IDC_EDIT4, NULL, FALSE);
+ if (m_nMaxOrder < m_nMinOrder) m_bSelectPlay = false;
+ //m_bHighQuality = IsDlgButtonChecked(IDC_CHECK3) ? true : false; //rewbs.resamplerConf - we don't want this anymore.
+ m_bNormalize = IsDlgButtonChecked(IDC_CHECK5) ? true : false;
+ m_bGivePlugsIdleTime = IsDlgButtonChecked(IDC_GIVEPLUGSIDLETIME) ? true : false;
if (m_bGivePlugsIdleTime) {
if (MessageBox("You only need slow render if you are experiencing dropped notes with a Kontakt based sampler with Direct-From-Disk enabled.\nIt will make rendering *very* slow.\n\nAre you sure you want to enable slow render?",
"Really enable slow render?", MB_YESNO) == IDNO ) {
@@ -260,7 +260,7 @@
WaveFormat.Format.wFormatTag = WAVE_FORMAT_PCM;
WaveFormat.Format.nSamplesPerSec = m_CbnSampleRate.GetItemData(m_CbnSampleRate.GetCurSel());
if (WaveFormat.Format.nSamplesPerSec < 11025) WaveFormat.Format.nSamplesPerSec = 11025;
- if (WaveFormat.Format.nSamplesPerSec > 96000) WaveFormat.Format.nSamplesPerSec = 96000; //ericus' fix: 44100 -> 96000
+ if (WaveFormat.Format.nSamplesPerSec > MAX_SAMPLE_RATE) WaveFormat.Format.nSamplesPerSec = MAX_SAMPLE_RATE;
WaveFormat.Format.nChannels = (WORD)(dwFormat >> 8);
if ((WaveFormat.Format.nChannels != 1) && (WaveFormat.Format.nChannels != 4)) WaveFormat.Format.nChannels = 2;
WaveFormat.Format.wBitsPerSample = (WORD)(dwFormat & 0xFF);
@@ -627,7 +627,7 @@
if (oldVol > 128) m_pSndFile->SetMasterVolume(128);
} else
{
- m_bNormalize = FALSE;
+ m_bNormalize = false;
}
m_pSndFile->ResetChannels();
CSoundFile::InitPlayer(TRUE);
Modified: trunk/OpenMPT/mptrack/Moddoc.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Moddoc.cpp 2009-10-11 17:35:03 UTC (rev 395)
+++ trunk/OpenMPT/mptrack/Moddoc.cpp 2009-10-12 00:44:56 UTC (rev 396)
@@ -148,6 +148,8 @@
// Refresh mix levels now that the correct mod type has been set
m_SndFile.m_nMixLevels = m_SndFile.GetModSpecifications().defaultMixLevels;
m_SndFile.m_pConfig->SetMixLevels(m_SndFile.m_nMixLevels);
+ // ...and the order length
+ m_SndFile.Order.resize(m_SndFile.GetModSpecifications().ordersMax);
theApp.GetDefaultMidiMacro(&m_SndFile.m_MidiCfg);
ReinitRecordState();
@@ -1962,7 +1964,7 @@
#define MOD_TYPE_XMIT (MOD_TYPE_XM|MOD_TYPE_IT)
#define MOD_TYPE_XMITMPT (MOD_TYPE_XM|MOD_TYPE_IT|MOD_TYPE_MPT)
#define MOD_TYPE_ITMPT (MOD_TYPE_IT|MOD_TYPE_MPT)
-#define MAX_FXINFO 68 //rewbs.smoothVST, increased from 64... I wonder what this will break?
+#define MAX_FXINFO 69
const MPTEFFECTINFO gFXInfo[MAX_FXINFO] =
@@ -2012,6 +2014,7 @@
{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"},
@@ -2059,23 +2062,26 @@
}
-BOOL CModDoc::GetEffectName(LPSTR pszDescription, UINT command, UINT param, BOOL bXX, int nChn) //rewbs.xinfo: added chan arg
-//---------------------------------------------------------------------------------------------
+bool CModDoc::GetEffectName(LPSTR pszDescription, UINT command, UINT param, bool bXX, CHANNELINDEX nChn) //rewbs.xinfo: added chan arg
+//------------------------------------------------------------------------------------------------------
{
- BOOL bSupported;
- int fxndx = -1;
+ bool bSupported;
+ UINT fxndx = MAX_FXINFO;
pszDescription[0] = 0;
- UINT i = 0;
- for (i=0; i<MAX_FXINFO; i++)
+ for (UINT i = 0; i < MAX_FXINFO; i++)
{
if ((command == gFXInfo[i].dwEffect) // Effect
&& ((param & gFXInfo[i].dwParamMask) == gFXInfo[i].dwParamValue)) // Value
{
fxndx = i;
- break;
+ // if format is compatible, everything is fine. if not, let's still search
+ // for another command. this fixes searching for the EFx command, which
+ // does different things in MOD format.
+ if((m_SndFile.m_nType & gFXInfo[i].dwFormats) != 0)
+ break;
}
}
- if (fxndx < 0) return FALSE;
+ if (fxndx == MAX_FXINFO) return false;
bSupported = ((m_SndFile.m_nType & gFXInfo[fxndx].dwFormats) != 0);
if (gFXInfo[fxndx].pszName)
{
@@ -2084,13 +2090,13 @@
strcpy(pszDescription, " xx: ");
LPCSTR pszCmd = (m_SndFile.m_nType & (MOD_TYPE_MOD|MOD_TYPE_XM)) ? gszModCommands : gszS3mCommands;
pszDescription[0] = pszCmd[command];
- if ((gFXInfo[fxndx].dwParamMask & 0xF0) == 0xF0) pszDescription[1] = szHexChar[gFXInfo[i].dwParamValue >> 4];
- if ((gFXInfo[fxndx].dwParamMask & 0x0F) == 0x0F) pszDescription[2] = szHexChar[gFXInfo[i].dwParamValue & 0x0F];
+ if ((gFXInfo[fxndx].dwParamMask & 0xF0) == 0xF0) pszDescription[1] = szHexChar[gFXInfo[fxndx].dwParamValue >> 4];
+ if ((gFXInfo[fxndx].dwParamMask & 0x0F) == 0x0F) pszDescription[2] = szHexChar[gFXInfo[fxndx].dwParamValue & 0x0F];
}
strcat(pszDescription, gFXInfo[fxndx].pszName);
//rewbs.xinfo
//Get channel specific info
- if (nChn>=0 && nChn<m_SndFile.m_nChannels)
+ if (nChn < m_SndFile.m_nChannels)
{
CString chanSpec = "";
CString macroText= "_no macro_";
@@ -2098,15 +2104,15 @@
{
case CMD_MODCMDEX:
case CMD_S3MCMDEX:
- if ((param&0xF0) == 0xF0) //Set Macro
+ if ((param & 0xF0) == 0xF0 && !(m_SndFile.m_nType & MOD_TYPE_MOD)) //Set Macro
{
- macroText = &m_SndFile.m_MidiCfg.szMidiSFXExt[(param&0x0F)*32];
- chanSpec.Format(" to %d: ", param&0x0F);
+ macroText = &m_SndFile.m_MidiCfg.szMidiSFXExt[(param & 0x0F) * 32];
+ chanSpec.Format(" to %d: ", param & 0x0F);
}
break;
case CMD_MIDI:
case CMD_SMOOTHMIDI:
- if (param<0x80)
+ if (param < 0x80 && nChn != CHANNELINDEX_INVALID)
{
macroText = &m_SndFile.m_MidiCfg.szMidiSFXExt[m_SndFile.Chn[nChn].nActiveMacro*32];
chanSpec.Format(": currently %d: ", m_SndFile.Chn[nChn].nActiveMacro);
@@ -2170,15 +2176,18 @@
LONG CModDoc::GetIndexFromEffect(UINT command, UINT param)
//--------------------------------------------------------
{
- for (UINT i=0; i<MAX_FXINFO; i++)
+ UINT ndx = MAX_FXINFO;
+ for (UINT i = 0; i < MAX_FXINFO; i++)
{
if ((command == gFXInfo[i].dwEffect) // Effect
&& ((param & gFXInfo[i].dwParamMask) == gFXInfo[i].dwParamValue)) // Value
{
- return i;
+ ndx = i;
+ if((m_SndFile.m_nType & gFXInfo[i].dwFormats) != 0)
+ break; // found fitting format; this is correct for sure
}
}
- return -1;
+ return ndx;
}
@@ -2220,7 +2229,7 @@
}
-BOOL CModDoc::GetEffectInfo(UINT ndx, LPSTR s, BOOL bXX, DWORD *prangeMin, DWORD *prangeMax)
+bool CModDoc::GetEffectInfo(UINT ndx, LPSTR s, bool bXX, DWORD *prangeMin, DWORD *prangeMax)
//------------------------------------------------------------------------------------------
{
if (s) s[0] = 0;
@@ -2370,12 +2379,12 @@
}
-BOOL CModDoc::GetEffectNameEx(LPSTR pszName, UINT ndx, UINT param)
+bool CModDoc::GetEffectNameEx(LPSTR pszName, UINT ndx, UINT param)
//----------------------------------------------------------------
{
CHAR s[64];
if (pszName) pszName[0] = 0;
- if ((!pszName) || (ndx >= MAX_FXINFO) || (!gFXInfo[ndx].pszName)) return FALSE;
+ if ((!pszName) || (ndx >= MAX_FXINFO) || (!gFXInfo[ndx].pszName)) return false;
wsprintf(pszName, "%s: ", gFXInfo[ndx].pszName);
s[0] = 0;
@@ -2530,7 +2539,7 @@
case CMD_TREMOR:
if(param)
{
- BYTE ontime = param >> 4, offtime = param & 0x0F;
+ BYTE ontime = (BYTE)(param >> 4), offtime = (BYTE)(param & 0x0F);
if(m_SndFile.m_dwSongFlags & SONG_ITOLDEFFECTS)
{
ontime++;
@@ -2669,6 +2678,7 @@
strcat(s, " rows");
break;
case 0xF0: // macro
+ if(m_SndFile.m_nType & MOD_TYPE_MOD)
wsprintf(s, "SF%X", param & 0x0F); break;
default:
break;
@@ -2710,8 +2720,12 @@
case 0xE0: // pattern delay (rows)
strcat(s, " rows");
break;
- case 0xF0: // macro
- wsprintf(s, "SF%X", param & 0x0F); break;
+ case 0xF0:
+ if(m_SndFile.m_nType & MOD_TYPE_MOD)
+ wsprintf(s, "Speed %d", param & 0x0F); // invert loop
+ else
+ wsprintf(s, "SF%X", param & 0x0F); // macro
+ break;
default:
break;
}
@@ -2724,7 +2738,7 @@
}
}
strcat(pszName, s);
- return TRUE;
+ return true;
}
Modified: trunk/OpenMPT/mptrack/Moddoc.h
===================================================================
--- trunk/OpenMPT/mptrack/Moddoc.h 2009-10-11 17:35:03 UTC (rev 395)
+++ trunk/OpenMPT/mptrack/Moddoc.h 2009-10-12 00:44:56 UTC (rev 396)
@@ -162,13 +162,13 @@
HWND GetFollowWnd() const { return m_hWndFollow; }
void SetFollowWnd(HWND hwnd, DWORD dwType);
// Effects Description
- BOOL GetEffectName(LPSTR s, UINT command, UINT param, BOOL bXX=FALSE, int nChn=-1); // bXX: Nxx: ...
+ bool GetEffectName(LPSTR pszDescription, UINT 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);
+ 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 GetEffectMaskFromIndex(UINT ndx);
- BOOL GetEffectNameEx(LPSTR pszName, UINT ndx, UINT param);
+ bool GetEffectNameEx(LPSTR pszName, UINT ndx, UINT param);
BOOL IsExtendedEffect(UINT ndx) const;
UINT MapValueToPos(UINT ndx, UINT param);
UINT MapPosToValue(UINT ndx, UINT pos);
Modified: trunk/OpenMPT/mptrack/Mpdlgs.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Mpdlgs.cpp 2009-10-11 17:35:03 UTC (rev 395)
+++ trunk/OpenMPT/mptrack/Mpdlgs.cpp 2009-10-12 00:44:56 UTC (rev 396)
@@ -79,7 +79,9 @@
48000,
64000,
88200,
- 96000
+ 96000,
+ 176400,
+ 192000,
};
Modified: trunk/OpenMPT/mptrack/Mpdlgs.h
===================================================================
--- trunk/OpenMPT/mptrack/Mpdlgs.h 2009-10-11 17:35:03 UTC (rev 395)
+++ trunk/OpenMPT/mptrack/Mpdlgs.h 2009-10-12 00:44:56 UTC (rev 396)
@@ -1,7 +1,7 @@
#ifndef _MODPLUGDLGS_
#define _MODPLUGDLGS_
-#define NUMMIXRATE 14
+#define NUMMIXRATE 16
class CSoundFile;
class CMainFrame;
Modified: trunk/OpenMPT/mptrack/View_ins.cpp
===================================================================
--- trunk/OpenMPT/mptrack/View_ins.cpp 2009-10-11 17:35:03 UTC (rev 395)
+++ trunk/OpenMPT/mptrack/View_ins.cpp 2009-10-12 00:44:56 UTC (rev 396)
@@ -741,6 +741,11 @@
} else
{
pIns->dwFlags &= ~ENV_VOLUME;
+ for(CHANNELINDEX nChn = 0; nChn < MAX_CHANNELS; nChn++)
+ {
+ if(pSndFile->Chn[nChn].pModInstrument == pIns)
+ pSndFile->Chn[nChn].dwFlags &= ~CHN_VOLENV;
+ }
}
return true;
}
@@ -774,6 +779,11 @@
} else
{
pIns->dwFlags &= ~ENV_PANNING;
+ for(CHANNELINDEX nChn = 0; nChn < MAX_CHANNELS; nChn++)
+ {
+ if(pSndFile->Chn[nChn].pModInstrument == pIns)
+ pSndFile->Chn[nChn].dwFlags &= ~CHN_PANENV;
+ }
}
return true;
}
@@ -808,6 +818,11 @@
} else
{
pIns->dwFlags &= ~(ENV_PITCH|ENV_FILTER);
+ for(CHANNELINDEX nChn = 0; nChn < MAX_CHANNELS; nChn++)
+ {
+ if(pSndFile->Chn[nChn].pModInstrument == pIns)
+ pSndFile->Chn[nChn].dwFlags &= ~CHN_PITCHENV;
+ }
}
return true;
}
@@ -841,6 +856,12 @@
} else
{
pIns->dwFlags &= ~(ENV_PITCH|ENV_FILTER);
+ // prevent filter envelop from turning into a pitch envelope :)
+ for(CHANNELINDEX nChn = 0; nChn < MAX_CHANNELS; nChn++)
+ {
+ if(pSndFile->Chn[nChn].pModInstrument == pIns)
+ pSndFile->Chn[nChn].dwFlags &= ~CHN_PITCHENV;
+ }
}
return true;
}
Modified: trunk/OpenMPT/mptrack/dlg_misc.cpp
===================================================================
--- trunk/OpenMPT/mptrack/dlg_misc.cpp 2009-10-11 17:35:03 UTC (rev 395)
+++ trunk/OpenMPT/mptrack/dlg_misc.cpp 2009-10-12 00:44:56 UTC (rev 396)
@@ -756,7 +756,7 @@
UINT count = m_pModDoc->GetNumEffects();
for (UINT n=0; n<count; n++)
{
- m_pModDoc->GetEffectInfo(n, s, TRUE);
+ m_pModDoc->GetEffectInfo(n, s, true);
if (s[0]) combo->SetItemData(combo->AddString(s), n);
}
combo->SetCurSel(0);
@@ -1476,7 +1476,7 @@
if (!m_nCommand) combo->SetCurSel(0);
for (UINT i=0; i<numfx; i++)
{
- if (m_pModDoc->GetEffectInfo(i, s, TRUE))
+ if (m_pModDoc->GetEffectInfo(i, s, true))
{
int k = combo->AddString(s);
combo->SetItemData(k, i);
@@ -1497,7 +1497,7 @@
{
DWORD rangeMin = 0, rangeMax = 0;
LONG fxndx = m_pModDoc->GetIndexFromEffect(m_nCommand, m_nParam);
- BOOL bEnable = ((fxndx >= 0) && (m_pModDoc->GetEffectInfo(fxndx, NULL, FALSE, &rangeMin, &rangeMax)));
+ bool bEnable = ((fxndx >= 0) && (m_pModDoc->GetEffectInfo(fxndx, NULL, false, &rangeMin, &rangeMax)));
if (bEnable)
{
slider->EnableWindow(TRUE);
Modified: trunk/OpenMPT/mptrack/mod2wave.h
===================================================================
--- trunk/OpenMPT/mptrack/mod2wave.h 2009-10-11 17:35:03 UTC (rev 395)
+++ trunk/OpenMPT/mptrack/mod2wave.h 2009-10-12 00:44:56 UTC (rev 396)
@@ -13,7 +13,7 @@
WAVEFORMATEXTENSIBLE WaveFormat;
ULONGLONG m_dwFileLimit;
DWORD m_dwSongLimit;
- BOOL m_bSelectPlay, m_bNormalize, m_bHighQuality, m_bGivePlugsIdleTime;
+ bool m_bSelectPlay, m_bNormalize, m_bHighQuality, m_bGivePlugsIdleTime;
ORDERINDEX m_nMinOrder, m_nMaxOrder;
CComboBox m_CbnSampleRate, m_CbnSampleFormat;
CEdit m_EditMinOrder, m_EditMaxOrder;
@@ -49,19 +49,19 @@
LPCSTR m_lpszFileName;
DWORD m_dwFileLimit, m_dwSongLimit;
UINT m_nMaxPatterns;
- BOOL m_bAbort, m_bNormalize, m_bGivePlugsIdleTime;
+ bool m_bAbort, m_bNormalize, m_bGivePlugsIdleTime;
public:
- CDoWaveConvert(CSoundFile *sndfile, LPCSTR fname, PWAVEFORMATEX pwfx, BOOL bNorm, CWnd *parent=NULL):CDialog(IDD_PROGRESS, parent)
+ CDoWaveConvert(CSoundFile *sndfile, LPCSTR fname, PWAVEFORMATEX pwfx, bool bNorm, CWnd *parent = NULL):CDialog(IDD_PROGRESS, parent)
{ m_pSndFile = sndfile;
m_lpszFileName = fname;
m_pWaveFormat = pwfx;
- m_bAbort = FALSE;
+ m_bAbort = false;
m_bNormalize = bNorm;
m_dwFileLimit = m_dwSongLimit = 0;
m_nMaxPatterns = 0; }
BOOL OnInitDialog();
- void OnCancel() { m_bAbort = TRUE; }
+ void OnCancel() { m_bAbort = true; }
afx_msg void OnButton1();
DECLARE_MESSAGE_MAP()
};
Modified: trunk/OpenMPT/soundlib/IT_DEFS.H
===================================================================
--- trunk/OpenMPT/soundlib/IT_DEFS.H 2009-10-11 17:35:03 UTC (rev 395)
+++ trunk/OpenMPT/soundlib/IT_DEFS.H 2009-10-12 00:44:56 UTC (rev 396)
@@ -21,11 +21,11 @@
BYTE mv;
BYTE speed;
BYTE tempo;
- BYTE sep;
- BYTE zero;
+ BYTE sep; // panning separation (0...128)
+ BYTE pwd; // pitch wheel depth
WORD msglength;
DWORD msgoffset;
- DWORD reserved2;
+ DWORD reserved;
BYTE chnpan[64];
BYTE chnvol[64];
} ITFILEHEADER;
Modified: trunk/OpenMPT/soundlib/Load_it.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Load_it.cpp 2009-10-11 17:35:03 UTC (rev 395)
+++ trunk/OpenMPT/soundlib/Load_it.cpp 2009-10-12 00:44:56 UTC (rev 396)
@@ -1805,17 +1805,7 @@
header.highlight_minor = (BYTE)(m_nRowsPerBeat & 0xFF);
header.highlight_major = (BYTE)(m_nRowsPerMeasure & 0xFF);
- header.ordnum = 0;
- //while ((header.ordnum < MAX_ORDERS) /*&& (Order[header.ordnum] < 0xFF)*/) header.ordnum++; //rewbs.AllowSaveHiddenPatterns
- //if (header.ordnum < MAX_ORDERS) Order[header.ordnum++] = 0xFF;
- //Ericus' implementation is better.
-// -> CODE#0013
-// -> DESC="load/save the whole pattern order list"
-// while ((header.ordnum < MAX_ORDERS) && (Order[header.ordnum] < 0xFF)) header.ordnum++;
-// if (header.ordnum < MAX_ORDERS) Order[header.ordnum++] = 0xFF;
- header.ordnum = MAX_ORDERS;
- if(Order.size() < MAX_ORDERS) Order.resize(MAX_ORDERS, Order.GetInvalidPatIndex());
-
+
if(GetType() == MOD_TYPE_MPT)
{
if(!Order.NeedsExtraDatafield()) header.ordnum = Order.size();
@@ -1823,13 +1813,14 @@
//Crop unused orders from the end.
while(header.ordnum > 1 && Order[header.ordnum - 1] == Order.GetInvalidPatIndex()) header.ordnum--;
+ } else
+ {
+ // An additional "---" pattern is appended so Impulse Tracker won't ignore the last order item.
+ // Interestingly, this can exceed IT's 256 order limit.
+ header.ordnum = min(Order.GetLengthTailTrimmed(), ModSpecs::itEx.ordersMax) + 1;
}
-
-
- if(GetType() != MOD_TYPE_MPT)
- Order[MAX_ORDERS-1] = 0xFF;
-// -! CODE#0013
+
header.insnum = m_nInstruments;
header.smpnum = m_nSamples;
header.patnum = (GetType() == MOD_TYPE_MPT) ? Patterns.Size() : MAX_PATTERNS;
@@ -2486,14 +2477,10 @@
header.highlight_minor = (BYTE)(m_nRowsPerBeat & 0xFF);
header.highlight_major = (BYTE)(m_nRowsPerMeasure & 0xFF);
- header.ordnum = 0;
- header.ordnum=MAX_ORDERS;
- while (header.ordnum>0 && Order[header.ordnum-1]==0xFF) {
- header.ordnum--;
- }
- if(header.ordnum + 1 < MAX_ORDERS)
- header.ordnum++;
+ // An additional "---" pattern is appended so Impulse Tracker won't ignore the last order item.
+ // Interestingly, this can exceed IT's 256 order limit.
+ header.ordnum = min(Order.GetLengthTailTrimmed(), ModSpecs::it.ordersMax) + 1;
header.patnum = MAX_PATTERNS;
while ((header.patnum > 0) && (!Patterns[header.patnum-1])) {
Modified: trunk/OpenMPT/soundlib/Load_s3m.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Load_s3m.cpp 2009-10-11 17:35:03 UTC (rev 395)
+++ trunk/OpenMPT/soundlib/Load_s3m.cpp 2009-10-12 00:44:56 UTC (rev 396)
@@ -717,7 +717,7 @@
insex[i-1].vol = pSmp->nVolume / 4;
insex[i-1].flags = (pSmp->uFlags & CHN_LOOP) ? 1 : 0;
if (pSmp->nC5Speed)
- insex[i-1].finetune = pSmp->nC5Speed;
+ insex[i-1].finetune = min(pSmp->nC5Speed, 0xFFFF);
else
insex[i-1].finetune = TransposeToFrequency(pSmp->RelativeTone, pSmp->nFineTune);
UINT flags = RS_PCM8U;
Modified: trunk/OpenMPT/soundlib/Load_xm.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Load_xm.cpp 2009-10-11 17:35:03 UTC (rev 395)
+++ trunk/OpenMPT/soundlib/Load_xm.cpp 2009-10-12 00:44:56 UTC (rev 396)
@@ -276,7 +276,7 @@
m_nMinPeriod = 27;
m_nMaxPeriod = 54784;
- if ((!xmheader.orders) || (xmheader.orders > MAX_ORDERS)) return false;
+ if (xmheader.orders > MAX_ORDERS) return false;
if ((!xmheader.channels) || (xmheader.channels > MAX_BASECHANNELS)) return false;
if (xmheader.channels > 32) bMadeWithModPlug = true;
m_nRestartPos = xmheader.restartpos;
Modified: trunk/OpenMPT/soundlib/Snd_defs.h
===================================================================
--- trunk/OpenMPT/soundlib/Snd_defs.h 2009-10-11 17:35:03 UTC (rev 395)
+++ trunk/OpenMPT/soundlib/Snd_defs.h 2009-10-12 00:44:56 UTC (rev 396)
@@ -47,7 +47,7 @@
#define MAX_SAMPLE_LENGTH 0x10000000 // 0x04000000 (64MB -> now 256MB).
// Note: Sample size in bytes can be more than 256 MB.
// -! BEHAVIOUR_CHANGE#0006
-#define MAX_SAMPLE_RATE 100000
+#define MAX_SAMPLE_RATE 192000
#define MAX_ORDERS 256
#define MAX_PATTERNS 240
#define MAX_SAMPLES 4000
Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Snd_fx.cpp 2009-10-11 17:35:03 UTC (rev 395)
+++ trunk/OpenMPT/soundlib/Snd_fx.cpp 2009-10-12 00:44:56 UTC (rev 396)
@@ -2522,7 +2522,7 @@
case 0xC0: NoteCut(nChn, param); break;
// EDx: Note Delay
// EEx: Pattern Delay
- // EFx: MOD: Invert Loop, XM: Set Active Midi Macro
+ // EFx: MOD: Invert Loop / Funk Repeat, XM: Set Active Midi Macro
case 0xF0: pChn->nActiveMacro = param; break;
}
}
@@ -3150,11 +3150,11 @@
UINT nNote = pChn->nNewNote;
LONG nOldPeriod = pChn->nPeriod;
if ((nNote) && (nNote <= NOTE_MAX) && (pChn->nLength)) CheckNNA(nChn, 0, nNote, TRUE);
- BOOL bResetEnv = FALSE;
+ bool bResetEnv = false;
if (m_nType & (MOD_TYPE_XM|MOD_TYPE_MT2))
{
- if ((pChn->nRowInstr) && (param < 0x100)) { InstrumentChange(pChn, pChn->nRowInstr, FALSE, FALSE); bResetEnv = TRUE; }
- if (param < 0x100) bResetEnv = TRUE;
+ if ((pChn->nRowInstr) && (param < 0x100)) { InstrumentChange(pChn, pChn->nRowInstr, FALSE, FALSE); bResetEnv = true; }
+ if (param < 0x100) bResetEnv = true;
}
NoteChange(nChn, nNote, IsCompatibleMode(TRK_IMPULSETRACKER) ? true : false, bResetEnv);
if (m_nInstruments) {
Modified: trunk/OpenMPT/soundlib/Sndfile.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Sndfile.cpp 2009-10-11 17:35:03 UTC (rev 395)
+++ trunk/OpenMPT/soundlib/Sndfile.cpp 2009-10-12 00:44:56 UTC (rev 396)
@@ -707,12 +707,13 @@
// Load plugins only when m_pModDoc != 0. (can be == 0 for example when examining module samples in treeview.
string sNotFound;
- bool bSearchIDs[MAX_MIXPLUGINS] = {false};
+ bool bSearchIDs[MAX_MIXPLUGINS];
+ memset(bSearchIDs, false, MAX_MIXPLUGINS * sizeof(bool));
UINT iShowNotFound = 0;
if (gpMixPluginCreateProc && GetpModDoc())
{
- for (UINT iPlug = 0; iPlug < MAX_MIXPLUGINS; iPlug++)
+ for (PLUGINDEX iPlug = 0; iPlug < MAX_MIXPLUGINS; iPlug++)
{
if ((m_MixPlugins[iPlug].Info.dwPluginId1)
|| (m_MixPlugins[iPlug].Info.dwPluginId2))
@@ -726,8 +727,8 @@
else
{
// plugin not found - add to list
- BOOL bFound = false;
- for(UINT iPlugFind = 0; iPlugFind < iPlug; iPlugFind++)
+ bool bFound = false;
+ for(PLUGINDEX iPlugFind = 0; iPlugFind < iPlug; iPlugFind++)
if(m_MixPlugins[iPlugFind].Info.dwPluginId2 == m_MixPlugins[iPlug].Info.dwPluginId2)
{
bFound = true;
@@ -746,6 +747,7 @@
}
// Display a nice message so the user sees what plugins are missing
+ // TODO: Use IDD_MODLOADING_WARNINGS dialog (NON-MODAL!) to display all warnings that are encountered when loading a module.
if(iShowNotFound)
{
if(iShowNotFound == 1)
@@ -758,7 +760,7 @@
"\nWARNING: A browser window / tab is opened for every plugin. If you do not want that, you can visit http://www.kvraudio.com/search.php";
}
if (::MessageBox(0, sNotFound.c_str(), "OpenMPT - Plugins missing", MB_YESNO | MB_DEFBUTTON2 | MB_ICONQUESTION) == IDYES)
- for (UINT iPlug = 0; iPlug < MAX_MIXPLUGINS; iPlug++)
+ for (PLUGINDEX iPlug = 0; iPlug < MAX_MIXPLUGINS; iPlug++)
if (bSearchIDs[iPlug] == true)
{
CString sUrl;
@@ -771,7 +773,7 @@
m_pConfig->SetMixLevels(m_nMixLevels);
RecalculateGainForAllPlugs();
- if (m_nType && m_nType != MOD_TYPE_MPT)
+ if (m_nType && (m_nType != MOD_TYPE_MPT))
{
SetModSpecsPointer(m_pModSpecs, m_nType);
Order.resize(GetModSpecifications().ordersMax);
Modified: trunk/OpenMPT/soundlib/Sndfile.h
===================================================================
--- trunk/OpenMPT/soundlib/Sndfile.h 2009-10-11 17:35:03 UTC (rev 395)
+++ trunk/OpenMPT/soundlib/Sndfile.h 2009-10-12 00:44:56 UTC (rev 396)
@@ -200,6 +200,7 @@
LONG nCutSwing, nResSwing;
LONG nRestorePanOnNewNote; //If > 0, nPan should be set to nRestorePanOnNewNote - 1 on new note. Used to recover from panswing.
UINT nOldGlobalVolSlide;
+ DWORD nEFxOffset; // offset memory for either Funk Repeat or Invert Loop (EFx, .MOD only)
// 8-bit members
BYTE nRestoreResonanceOnNewNote; //Like above
BYTE nRestoreCutoffOnNewNote; //Like above
@@ -223,6 +224,7 @@
BYTE nRowCommand, nRowParam;
BYTE nLeftVU, nRightVU;
BYTE nActiveMacro, nFilterMode;
+ BYTE nEFxDelay; // memory for either Funk Repeat or Invert Loop (EFx, .MOD only)
uint16 m_RowPlugParam; //NOTE_PCs memory.
float m_nPlugParamValueStep; //rewbs.smoothVST
Modified: trunk/OpenMPT/soundlib/Sndmix.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Sndmix.cpp 2009-10-11 17:35:03 UTC (rev 395)
+++ trunk/OpenMPT/soundlib/Sndmix.cpp 2009-10-12 00:44:56 UTC (rev 396)
@@ -78,6 +78,7 @@
extern signed char ft2VibratoTable[256]; // -64 .. +64
extern int MixSoundBuffer[MIXBUFFERSIZE*4];
extern int MixRearBuffer[MIXBUFFERSIZE*2];
+extern BYTE ModEFxTable[16];
#ifndef NO_REVERB
extern UINT gnReverbSend;
@@ -1690,6 +1691,25 @@
}
}
}
+
+ // .MOD EFx implementation
+ if((m_nType & MOD_TYPE_MOD) && pChn->nRowCommand == CMD_MODCMDEX && (pChn->nRowParam & 0xF0) == 0xF0)
+ {
+ pChn->nEFxDelay += ModEFxTable[pChn->nRowParam & 0x0F];
+ if((pChn->dwFlags & CHN_LOOP) && (pChn->nEFxDelay & 0x80))
+ {
+ // invert loop code (PT 1.1A and up)
+ pChn->nEFxDelay = 0;
+
+ if (++pChn->nEFxOffset >= pChn->nLoopEnd - pChn->nLoopStart)
+ pChn->nEFxOffset = 0;
+
+ // TRASH IT!!! (Yes, the sample!)
+ pChn->pSample[pChn->nLoopStart + pChn->nEFxOffset] = ~pChn->pSample[pChn->nLoopStart + pChn->nEFxOffset];
+ }
+ }
+
+
#ifdef MODPLUG_PLAYER
// Limit CPU -> > 80% -> don't ramp
if ((gnCPUUsage >= 80) && (!pChn->nRealVolume))
Modified: trunk/OpenMPT/soundlib/Tables.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Tables.cpp 2009-10-11 17:35:03 UTC (rev 395)
+++ trunk/OpenMPT/soundlib/Tables.cpp 2009-10-12 00:44:56 UTC (rev 396)
@@ -101,6 +101,12 @@
1724,1628,1536,1450,1368,1292,1220,1150,1086,1026,968,914
};
+// Table for Invert Loop and Funk Repeat effects (EFx, .MOD only)
+BYTE ModEFxTable[16] =
+{
+ 0, 5, 6, 7, 8, 10, 11, 13,
+ 16, 19, 22, 26, 32, 43, 64, 128
+};
// S3M C-4 periods
WORD FreqS3MTable[16] =
Modified: trunk/OpenMPT/soundlib/mod_specifications.h
===================================================================
--- trunk/OpenMPT/soundlib/mod_specifications.h 2009-10-11 17:35:03 UTC (rev 395)
+++ trunk/OpenMPT/soundlib/mod_specifications.h 2009-10-12 00:44:56 UTC (rev 396)
@@ -257,8 +257,8 @@
true, //Has notecut.
true, //Has noteoff.
true, //Has notefade.
- 240, //Pattern max.
- 200, //Order max.
+ 200, //Pattern max.
+ 256, //Order max.
1, //Channel min
64, //Channel max
32, //Min tempo
@@ -286,7 +286,7 @@
true, //Has noteoff.
true, //Has notefade.
240, //Pattern max.
- 255, //Order max.
+ 256, //Order max.
1, //Channel min
127, //Channel max
32, //Min tempo
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sag...@us...> - 2009-10-11 17:35:14
|
Revision: 395
http://modplug.svn.sourceforge.net/modplug/?rev=395&view=rev
Author: saga-games
Date: 2009-10-11 17:35:03 +0000 (Sun, 11 Oct 2009)
Log Message:
-----------
[Ref] ChannelManagerDlg.cpp doesn't throw any warnings anymore.
Modified Paths:
--------------
trunk/OpenMPT/mptrack/ChannelManagerDlg.cpp
trunk/OpenMPT/mptrack/ChannelManagerDlg.h
trunk/OpenMPT/mptrack/Ctrl_pat.cpp
Modified: trunk/OpenMPT/mptrack/ChannelManagerDlg.cpp
===================================================================
--- trunk/OpenMPT/mptrack/ChannelManagerDlg.cpp 2009-10-11 16:07:45 UTC (rev 394)
+++ trunk/OpenMPT/mptrack/ChannelManagerDlg.cpp 2009-10-11 17:35:03 UTC (rev 395)
@@ -3,12 +3,6 @@
#include "moddoc.h"
#include "view_gen.h"
#include "ChannelManagerDlg.h"
-//#include "mptrack.h"
-//#include "childfrm.h"
-//#include "globals.h"
-//#include "dlg_misc.h"
-//#include "ctrl_pat.h"
-//#include "view_pat.h"
///////////////////////////////////////////////////////////
@@ -77,7 +71,7 @@
void CChannelManagerDlg::Update(void)
{
- if(!m_hWnd || show == FALSE) return;
+ if(!m_hWnd || show == false) return;
EnterCriticalSection(&applying);
nChannelsOld = 0;
@@ -88,9 +82,9 @@
BOOL CChannelManagerDlg::Show(void)
{
- if(this->m_hWnd != NULL && show == FALSE){
+ if(this->m_hWnd != NULL && show == false){
ShowWindow(SW_SHOW);
- show = TRUE;
+ show = true;
}
return show;
@@ -98,10 +92,10 @@
BOOL CChannelManagerDlg::Hide(void)
{
- if(this->m_hWnd != NULL && show == TRUE){
- ResetState(TRUE,TRUE,TRUE,TRUE,TRUE);
+ if(this->m_hWnd != NULL && show == true){
+ ResetState(true, true, true, true, true);
ShowWindow(SW_HIDE);
- show = FALSE;
+ show = false;
}
return show;
@@ -110,14 +104,14 @@
CChannelManagerDlg::CChannelManagerDlg(void)
{
InitializeCriticalSection(&applying);
- mouseTracking = FALSE;
- rightButton = FALSE;
- leftButton = FALSE;
+ mouseTracking = false;
+ rightButton = false;
+ leftButton = false;
parentCtrl = NULL;
- moveRect = FALSE;
+ moveRect = false;
nChannelsOld = 0;
bkgnd = NULL;
- show = FALSE;
+ show = false;
Create(IDD_CHANNELMANAGER, NULL);
ShowWindow(SW_HIDE);
@@ -149,15 +143,15 @@
TabCtrl_InsertItem(menu, 3, &tie);
currentTab = 0;
- for(int i = 0 ; i < MAX_BASECHANNELS ; i++){
- pattern[i] = i;
- removed[i] = FALSE;
- select[i] = FALSE;
- state[i] = FALSE;
- memory[0][i] = 0;
- memory[1][i] = 0;
- memory[2][i] = 0;
- memory[3][i] = i;
+ for(CHANNELINDEX nChn = 0; nChn < MAX_BASECHANNELS; nChn++){
+ pattern[nChn] = nChn;
+ removed[nChn] = false;
+ select[nChn] = false;
+ state[nChn] = false;
+ memory[0][nChn] = 0;
+ memory[1][nChn] = 0;
+ memory[2][nChn] = 0;
+ memory[3][nChn] = nChn;
}
::ShowWindow(::GetDlgItem(m_hWnd, IDC_BUTTON1),SW_HIDE);
@@ -184,16 +178,16 @@
EnterCriticalSection(&applying);
- UINT i,nChannels,newpat[MAX_BASECHANNELS],newMemory[4][MAX_BASECHANNELS];
+ CHANNELINDEX nChannels, newpat[MAX_BASECHANNELS], newMemory[4][MAX_BASECHANNELS];
// Count new number of channels , copy pattern pointers & manager internal store memory
nChannels = 0;
- for(i = 0 ; i < m_pSndFile->m_nChannels ; i++){
- if(!removed[pattern[i]]){
+ for(CHANNELINDEX nChn = 0; nChn < m_pSndFile->m_nChannels; nChn++){
+ if(!removed[pattern[nChn]]){
newMemory[0][nChannels] = memory[0][nChannels];
newMemory[1][nChannels] = memory[1][nChannels];
newMemory[2][nChannels] = memory[2][nChannels];
- newpat[nChannels++] = pattern[i];
+ newpat[nChannels++] = pattern[nChn];
}
}
@@ -202,9 +196,9 @@
//Creating new order-vector for ReArrangeChannels.
vector<CHANNELINDEX> newChnOrder; newChnOrder.reserve(nChannels);
- for(i = 0; i<nChannels; i++)
+ for(CHANNELINDEX nChn = 0; nChn < nChannels; nChn++)
{
- newChnOrder.push_back(newpat[i]);
+ newChnOrder.push_back(newpat[nChn]);
}
if(m_pSndFile->ReArrangeChannels(newChnOrder) != nChannels)
{
@@ -212,7 +206,7 @@
END_CRITICAL();
EndWaitCursor();
- ResetState(TRUE,TRUE,TRUE,TRUE,TRUE);
+ ResetState(true, true, true, true, true);
LeaveCriticalSection(&applying);
return;
@@ -220,13 +214,13 @@
// Update manager internal store memory
- for(i = 0 ; i < nChannels ; i++){
- if(i != newpat[i]){
- memory[0][i] = newMemory[0][newpat[i]];
- memory[1][i] = newMemory[1][newpat[i]];
- memory[2][i] = newMemory[2][newpat[i]];
+ for(CHANNELINDEX nChn = 0; nChn < nChannels; nChn++){
+ if(nChn != newpat[nChn]){
+ memory[0][nChn] = newMemory[0][newpat[nChn]];
+ memory[1][nChn] = newMemory[1][newpat[nChn]];
+ memory[2][nChn] = newMemory[2][newpat[nChn]];
}
- memory[3][i] = i;
+ memory[3][nChn] = nChn;
}
/*
@@ -241,7 +235,7 @@
END_CRITICAL();
EndWaitCursor();
- ResetState(TRUE,TRUE,TRUE,TRUE,TRUE);
+ ResetState(true, true, true, true, true);
LeaveCriticalSection(&applying);
// Update document & player
@@ -259,9 +253,9 @@
EnterCriticalSection(&applying);
if(bkgnd) DeleteObject((HBITMAP)bkgnd);
- ResetState(TRUE,TRUE,TRUE,TRUE,TRUE);
+ ResetState(true, true, true, true, true);
bkgnd = NULL;
- show = FALSE;
+ show = false;
LeaveCriticalSection(&applying);
@@ -276,7 +270,9 @@
CModDoc *pModDoc = pMainFrm ? pMainFrm->GetActiveDoc() : NULL;
CSoundFile * m_pSndFile = pModDoc ? pModDoc->GetSoundFile() : NULL;
- if(m_pSndFile) for(UINT i = 0 ; i < m_pSndFile->m_nChannels ; i++) select[i] = TRUE;
+ if(m_pSndFile)
+ for(CHANNELINDEX nChn = 0; nChn < m_pSndFile->m_nChannels; nChn++)
+ select[nChn] = true;
LeaveCriticalSection(&applying);
InvalidateRect(NULL, FALSE);
@@ -290,7 +286,9 @@
CModDoc *pModDoc = pMainFrm ? pMainFrm->GetActiveDoc() : NULL;
CSoundFile * m_pSndFile = pModDoc ? pModDoc->GetSoundFile() : NULL;
- if(m_pSndFile) for(UINT i = 0 ; i < m_pSndFile->m_nChannels ; i++) select[i] = !select[i];
+ if(m_pSndFile)
+ for(CHANNELINDEX nChn = 0 ; nChn < m_pSndFile->m_nChannels ; nChn++)
+ select[nChn] = !select[nChn];
LeaveCriticalSection(&applying);
InvalidateRect(NULL, FALSE);
@@ -306,55 +304,60 @@
if(pModDoc && m_pSndFile){
- UINT ii,i,r;
int nbOk = 0, nbSelect = 0;
switch(currentTab){
case 0:
- for(i = 0 ; i < m_pSndFile->m_nChannels ; i++){
- ii = pattern[i];
- if(!removed[ii]){
- if(select[ii]) nbSelect++;
- if(select[ii] && pModDoc->IsChannelSolo(ii)) nbOk++;
+ for(CHANNELINDEX nChn = 0; nChn < m_pSndFile->m_nChannels; nChn++)
+ {
+ CHANNELINDEX nThisChn = pattern[nChn];
+ if(!removed[nThisChn]){
+ if(select[nThisChn]) nbSelect++;
+ if(select[nThisChn] && pModDoc->IsChannelSolo(nThisChn)) nbOk++;
}
}
- for(i = 0 ; i < m_pSndFile->m_nChannels ; i++){
- ii = pattern[i];
- if(select[ii] && !removed[ii]){
- if(pModDoc->IsChannelMuted(ii)) pModDoc->MuteChannel(ii,FALSE);
- if(nbSelect == nbOk) pModDoc->SoloChannel(ii,!pModDoc->IsChannelSolo(ii));
- else pModDoc->SoloChannel(ii,TRUE);
+ for(CHANNELINDEX nChn = 0; nChn < m_pSndFile->m_nChannels; nChn++)
+ {
+ CHANNELINDEX nThisChn = pattern[nChn];
+ if(select[nThisChn] && !removed[nThisChn]){
+ if(pModDoc->IsChannelMuted(nThisChn)) pModDoc->MuteChannel(nThisChn, false);
+ if(nbSelect == nbOk) pModDoc->SoloChannel(nThisChn, !pModDoc->IsChannelSolo(nThisChn));
+ else pModDoc->SoloChannel(nThisChn, true);
}
- else if(!pModDoc->IsChannelSolo(ii)) pModDoc->MuteChannel(ii,TRUE);
+ else if(!pModDoc->IsChannelSolo(nThisChn)) pModDoc->MuteChannel(nThisChn, true);
}
break;
case 1:
- for(i = 0 ; i < m_pSndFile->m_nChannels ; i++){
- ii = pattern[i];
- if(!removed[ii]){
- if(select[ii]) nbSelect++;
- r = pModDoc->IsChannelRecord(ii);
- if(select[ii] && r == 1) nbOk++;
+ for(CHANNELINDEX nChn = 0; nChn < m_pSndFile->m_nChannels; nChn++)
+ {
+ CHANNELINDEX nThisChn = pattern[nChn];
+ if(!removed[nThisChn]){
+ if(select[nThisChn]) nbSelect++;
+ BYTE rec = pModDoc->IsChannelRecord(nThisChn);
+ if(select[nThisChn] && rec == 1) nbOk++;
}
}
- for(i = 0 ; i < m_pSndFile->m_nChannels ; i++){
- ii = pattern[i];
- if(!removed[ii] && select[ii]){
- if(select[ii] && nbSelect != nbOk && pModDoc->IsChannelRecord(ii) != 1) pModDoc->Record1Channel(ii);
- else if(nbSelect == nbOk) pModDoc->Record1Channel(ii,FALSE);
+ for(CHANNELINDEX nChn = 0; nChn < m_pSndFile->m_nChannels; nChn++)
+ {
+ CHANNELINDEX nThisChn = pattern[nChn];
+ if(!removed[nThisChn] && select[nThisChn]){
+ if(select[nThisChn] && nbSelect != nbOk && pModDoc->IsChannelRecord(nThisChn) != 1) pModDoc->Record1Channel(nThisChn);
+ else if(nbSelect == nbOk) pModDoc->Record1Channel(nThisChn, false);
}
}
break;
case 2:
- for(i = 0 ; i < m_pSndFile->m_nChannels ; i++){
- ii = pattern[i];
- if(select[ii] && !removed[ii]) pModDoc->NoFxChannel(ii,FALSE);
+ for(CHANNELINDEX nChn = 0; nChn < m_pSndFile->m_nChannels; nChn++)
+ {
+ CHANNELINDEX nThisChn = pattern[nChn];
+ if(select[nThisChn] && !removed[nThisChn]) pModDoc->NoFxChannel(nThisChn, false);
}
break;
case 3:
- for(i = 0 ; i < m_pSndFile->m_nChannels ; i++){
- ii = pattern[i];
- if(select[ii]) removed[ii] = !removed[ii];
+ for(CHANNELINDEX nChn = 0; nChn < m_pSndFile->m_nChannels; nChn++)
+ {
+ CHANNELINDEX nThisChn = pattern[nChn];
+ if(select[nThisChn]) removed[nThisChn] = !removed[nThisChn];
}
break;
default:
@@ -381,58 +384,62 @@
if(pModDoc && m_pSndFile){
- UINT i,ii,r;
int nbOk = 0, nbSelect = 0;
switch(currentTab){
case 0:
- for(i = 0 ; i < m_pSndFile->m_nChannels ; i++){
- ii = pattern[i];
- if(!removed[ii]){
- if(select[ii]) nbSelect++;
- if(select[ii] && pModDoc->IsChannelMuted(ii)) nbOk++;
+ for(CHANNELINDEX nChn = 0; nChn < m_pSndFile->m_nChannels; nChn++)
+ {
+ CHANNELINDEX nThisChn = pattern[nChn];
+ if(!removed[nThisChn]){
+ if(select[nThisChn]) nbSelect++;
+ if(select[nThisChn] && pModDoc->IsChannelMuted(nThisChn)) nbOk++;
}
}
- for(i = 0 ; i < m_pSndFile->m_nChannels ; i++){
- ii = pattern[i];
- if(select[ii] && !removed[ii]){
- if(pModDoc->IsChannelSolo(ii)) pModDoc->SoloChannel(ii,FALSE);
- if(nbSelect == nbOk) pModDoc->MuteChannel(ii,!pModDoc->IsChannelMuted(ii));
- else pModDoc->MuteChannel(ii,TRUE);
+ for(CHANNELINDEX nChn = 0; nChn < m_pSndFile->m_nChannels; nChn++)
+ {
+ CHANNELINDEX nThisChn = pattern[nChn];
+ if(select[nThisChn] && !removed[nThisChn]){
+ if(pModDoc->IsChannelSolo(nThisChn)) pModDoc->SoloChannel(nThisChn, false);
+ if(nbSelect == nbOk) pModDoc->MuteChannel(nThisChn, !pModDoc->IsChannelMuted(nThisChn));
+ else pModDoc->MuteChannel(nThisChn, true);
}
}
break;
case 1:
- for(i = 0 ; i < m_pSndFile->m_nChannels ; i++){
- ii = pattern[i];
- if(!removed[ii]){
- if(select[ii]) nbSelect++;
- r = pModDoc->IsChannelRecord(ii);
- if(select[ii] && r == 2) nbOk++;
+ for(CHANNELINDEX nChn = 0; nChn < m_pSndFile->m_nChannels; nChn++)
+ {
+ CHANNELINDEX nThisChn = pattern[nChn];
+ if(!removed[nThisChn]){
+ if(select[nThisChn]) nbSelect++;
+ BYTE rec = pModDoc->IsChannelRecord(nThisChn);
+ if(select[nThisChn] && rec == 2) nbOk++;
}
}
- for(i = 0 ; i < m_pSndFile->m_nChannels ; i++){
- ii = pattern[i];
- if(!removed[ii] && select[ii]){
- if(select[ii] && nbSelect != nbOk && pModDoc->IsChannelRecord(ii) != 2) pModDoc->Record2Channel(ii);
- else if(nbSelect == nbOk) pModDoc->Record2Channel(ii,FALSE);
+ for(CHANNELINDEX nChn = 0; nChn < m_pSndFile->m_nChannels; nChn++)
+ {
+ CHANNELINDEX nThisChn = pattern[nChn];
+ if(!removed[nThisChn] && select[nThisChn]){
+ if(select[nThisChn] && nbSelect != nbOk && pModDoc->IsChannelRecord(nThisChn) != 2) pModDoc->Record2Channel(nThisChn);
+ else if(nbSelect == nbOk) pModDoc->Record2Channel(nThisChn, false);
}
}
break;
case 2:
- for(i = 0 ; i < m_pSndFile->m_nChannels ; i++){
- ii = pattern[i];
- if(select[ii] && !removed[ii]) pModDoc->NoFxChannel(ii,TRUE);
+ for(CHANNELINDEX nChn = 0; nChn < m_pSndFile->m_nChannels; nChn++)
+ {
+ CHANNELINDEX nThisChn = pattern[nChn];
+ if(select[nThisChn] && !removed[nThisChn]) pModDoc->NoFxChannel(nThisChn, true);
}
break;
case 3:
- ResetState(FALSE,FALSE,FALSE,FALSE,TRUE);
+ ResetState(false, false, false, false, true);
break;
default:
break;
}
- if(currentTab !=3) ResetState();
+ if(currentTab != 3) ResetState();
LeaveCriticalSection(&applying);
pModDoc->UpdateAllViews(NULL,0xff,NULL);
@@ -451,21 +458,25 @@
switch(currentTab){
case 0:
- for(UINT i = 0 ; i < m_pSndFile->m_nChannels ; i++){
- UINT ii = pattern[i];
- memory[0][i] = 0;
- if(pModDoc->IsChannelMuted(ii)) memory[0][i] |= 1;
- if(pModDoc->IsChannelSolo(ii)) memory[0][i] |= 2;
+ for(CHANNELINDEX nChn = 0; nChn < m_pSndFile->m_nChannels; nChn++)
+ {
+ CHANNELINDEX nThisChn = pattern[nChn];
+ memory[0][nThisChn] = 0;
+ if(pModDoc->IsChannelMuted(nThisChn)) memory[0][nChn] |= 1;
+ if(pModDoc->IsChannelSolo(nThisChn)) memory[0][nChn] |= 2;
}
break;
case 1:
- for(UINT i = 0 ; i < m_pSndFile->m_nChannels ; i++) memory[1][i] = pModDoc->IsChannelRecord(pattern[i]);
+ for(CHANNELINDEX nChn = 0; nChn < m_pSndFile->m_nChannels; nChn++)
+ memory[1][nChn] = pModDoc->IsChannelRecord(pattern[nChn]);
break;
case 2:
- for(UINT i = 0 ; i < m_pSndFile->m_nChannels ; i++) memory[2][i] = pModDoc->IsChannelNoFx(pattern[i]);
+ for(CHANNELINDEX nChn = 0; nChn < m_pSndFile->m_nChannels; nChn++)
+ memory[2][nChn] = pModDoc->IsChannelNoFx(pattern[nChn]);
break;
case 3:
- for(UINT i = 0 ; i < m_pSndFile->m_nChannels ; i++) memory[3][i] = pattern[i];
+ for(CHANNELINDEX nChn = 0; nChn < m_pSndFile->m_nChannels; nChn++)
+ memory[3][nChn] = pattern[nChn];
break;
default:
break;
@@ -484,31 +495,35 @@
switch(currentTab){
case 0:
- for(UINT i = 0 ; i < m_pSndFile->m_nChannels ; i++){
- UINT ii = pattern[i];
- pModDoc->MuteChannel(ii,memory[0][i] & 1);
- pModDoc->SoloChannel(ii,memory[0][i] & 2);
+ for(CHANNELINDEX nChn = 0; nChn < m_pSndFile->m_nChannels; nChn++)
+ {
+ CHANNELINDEX nThisChn = pattern[nChn];
+ pModDoc->MuteChannel(nThisChn, (memory[0][nChn] & 1) != 0 ? true : false);
+ pModDoc->SoloChannel(nThisChn, (memory[0][nChn] & 2) != 0 ? true : false);
}
break;
case 1:
- pModDoc->ReinitRecordState(TRUE);
- for(UINT i = 0 ; i < m_pSndFile->m_nChannels ; i++){
- if(memory[1][i] != 2) pModDoc->Record1Channel(pattern[i],memory[1][i] == 1);
- if(memory[1][i] != 1) pModDoc->Record2Channel(pattern[i],memory[1][i] == 2);
+ pModDoc->ReinitRecordState(true);
+ for(CHANNELINDEX nChn = 0; nChn < m_pSndFile->m_nChannels; nChn++)
+ {
+ if(memory[1][nChn] != 2) pModDoc->Record1Channel(pattern[nChn], memory[1][nChn] == 1);
+ if(memory[1][nChn] != 1) pModDoc->Record2Channel(pattern[nChn], memory[1][nChn] == 2);
}
break;
case 2:
- for(UINT i = 0 ; i < m_pSndFile->m_nChannels ; i++) pModDoc->NoFxChannel(pattern[i],memory[2][i]);
+ for(CHANNELINDEX nChn = 0; nChn < m_pSndFile->m_nChannels; nChn++)
+ pModDoc->NoFxChannel(pattern[nChn], memory[2][nChn] != 0 ? true : false);
break;
case 3:
- for(UINT i = 0 ; i < m_pSndFile->m_nChannels ; i++) pattern[i] = memory[3][i];
- ResetState(FALSE,FALSE,FALSE,FALSE,TRUE);
+ for(CHANNELINDEX nChn = 0; nChn < m_pSndFile->m_nChannels; nChn++)
+ pattern[nChn] = memory[3][nChn];
+ ResetState(false, false, false, false, true);
break;
default:
break;
}
- if(currentTab !=3) ResetState();
+ if(currentTab != 3) ResetState();
LeaveCriticalSection(&applying);
pModDoc->UpdateAllViews(NULL,0xff,NULL);
@@ -604,7 +619,7 @@
void CChannelManagerDlg::OnSize(UINT nType,int cx,int cy)
{
CWnd::OnSize(nType,cx,cy);
- if(!m_hWnd || show == FALSE) return;
+ if(!m_hWnd || show == false) return;
CWnd * button;
CRect wnd,btn;
@@ -612,31 +627,31 @@
if((button = GetDlgItem(IDC_BUTTON1)) != 0){
button->GetWindowRect(&btn);
- button->SetWindowPos(NULL,btn.left-wnd.left-3,wnd.Height()-btn.Height()*2-4,0,0,SWP_NOSIZE | SWP_NOZORDER);
+ button->SetWindowPos(NULL, btn.left - wnd.left - 3, wnd.Height() - btn.Height() * 2 - 8, 0, 0, SWP_NOSIZE | SWP_NOZORDER);
}
if((button = GetDlgItem(IDC_BUTTON2)) != 0){
button->GetWindowRect(&btn);
- button->SetWindowPos(NULL,btn.left-wnd.left-3,wnd.Height()-btn.Height()*2-4,0,0,SWP_NOSIZE | SWP_NOZORDER);
+ button->SetWindowPos(NULL, btn.left - wnd.left - 3, wnd.Height() - btn.Height() * 2 - 8, 0, 0, SWP_NOSIZE | SWP_NOZORDER);
}
if((button = GetDlgItem(IDC_BUTTON3)) != 0){
button->GetWindowRect(&btn);
- button->SetWindowPos(NULL,btn.left-wnd.left-3,wnd.Height()-btn.Height()*2-4,0,0,SWP_NOSIZE | SWP_NOZORDER);
+ button->SetWindowPos(NULL, btn.left - wnd.left - 3, wnd.Height() - btn.Height() * 2 - 8, 0, 0, SWP_NOSIZE | SWP_NOZORDER);
}
if((button = GetDlgItem(IDC_BUTTON4)) != 0){
button->GetWindowRect(&btn);
- button->SetWindowPos(NULL,btn.left-wnd.left-3,wnd.Height()-btn.Height()*2-4,0,0,SWP_NOSIZE | SWP_NOZORDER);
+ button->SetWindowPos(NULL, btn.left - wnd.left - 3, wnd.Height() - btn.Height() * 2 - 8, 0, 0, SWP_NOSIZE | SWP_NOZORDER);
}
if((button = GetDlgItem(IDC_BUTTON5)) != 0){
button->GetWindowRect(&btn);
- button->SetWindowPos(NULL,btn.left-wnd.left-3,wnd.Height()-btn.Height()*2-4,0,0,SWP_NOSIZE | SWP_NOZORDER);
+ button->SetWindowPos(NULL, btn.left - wnd.left - 3, wnd.Height() - btn.Height() * 2 - 8, 0, 0, SWP_NOSIZE | SWP_NOZORDER);
}
if((button = GetDlgItem(IDC_BUTTON6)) != 0){
button->GetWindowRect(&btn);
- button->SetWindowPos(NULL,btn.left-wnd.left-3,wnd.Height()-btn.Height()*2-4,0,0,SWP_NOSIZE | SWP_NOZORDER);
+ button->SetWindowPos(NULL, btn.left - wnd.left - 3, wnd.Height() - btn.Height() * 2 - 8, 0, 0, SWP_NOSIZE | SWP_NOZORDER);
}
GetClientRect(&wnd);
- wnd.SetRect(wnd.left + 10,wnd.top + 38,wnd.right - 8,wnd.bottom - 30);
+ wnd.SetRect(wnd.left + 10, wnd.top + 38, wnd.right - 8, wnd.bottom - 30);
if(bkgnd) DeleteObject(bkgnd);
bkgnd = ::CreateCompatibleBitmap(::GetDC(m_hWnd),wnd.Width(),wnd.Height());
if(!moveRect && bkgnd){
@@ -656,7 +671,7 @@
CDialog::OnActivate(nState,pWndOther,bMinimized);
if(show && !bMinimized){
- ResetState(TRUE,TRUE,TRUE,TRUE,FALSE);
+ ResetState(true, true, true, true, false);
EnterCriticalSection(&applying);
nChannelsOld = 0;
LeaveCriticalSection(&applying);
@@ -672,7 +687,7 @@
void CChannelManagerDlg::OnPaint()
{
- if(!m_hWnd || show == FALSE) return;
+ if(!m_hWnd || show == false) return;
EnterCriticalSection(&applying);
@@ -690,25 +705,27 @@
}
CHAR s[256];
- UINT i,ii,c=0,l=0;
- UINT nColns = CM_NB_COLS;
- UINT nChannels = m_pSndFile->m_nChannels;
- UINT nLines = nChannels / nColns + (nChannels % nColns ? 1 : 0);
+ UINT c=0,l=0;
+ CHANNELINDEX nChannels = m_pSndFile->m_nChannels;
+ UINT nLines = nChannels / CM_NB_COLS + (nChannels % CM_NB_COLS ? 1 : 0);
CRect client,btn;
GetWindowRect(&btn);
GetClientRect(&client);
client.SetRect(client.left + 10,client.top + 38,client.right - 8,client.bottom - 30);
- UINT chnSizeX = (client.right - client.left) / (int)nColns;
+ UINT chnSizeX = (client.right - client.left) / CM_NB_COLS;
UINT chnSizeY = (client.bottom - client.top) / (int)nLines;
- if(chnSizeY != CM_BT_HEIGHT){
+ if(chnSizeY != CM_BT_HEIGHT)
+ {
+ // resize window
::EndPaint(m_hWnd,&pDC);
LeaveCriticalSection(&applying);
- CWnd::SetWindowPos(NULL,0,0,btn.Width(),btn.Height()+(CM_BT_HEIGHT-chnSizeY)*nLines,SWP_NOMOVE | SWP_NOZORDER);
+ CWnd::SetWindowPos(NULL, 0, 0, btn.Width(), btn.Height() + (CM_BT_HEIGHT - chnSizeY) * nLines, SWP_NOMOVE | SWP_NOZORDER);
return;
}
+
chnSizeY = CM_BT_HEIGHT;
if(currentTab == 3 && moveRect && bkgnd){
@@ -737,10 +754,11 @@
FrameRect(pDC.hdc,&r,CMainFrame::brushBlack);
}
*/
- for(i = 0 ; i < nChannels ; i++){
- ii = pattern[i];
- if(select[ii]){
- btn = move[ii];
+ for(CHANNELINDEX nChn = 0; nChn < nChannels; nChn++)
+ {
+ CHANNELINDEX nThisChn = pattern[nChn];
+ if(select[nThisChn]){
+ btn = move[nThisChn];
btn.left += mx - omx + 2;
btn.right += mx - omx + 1;
btn.top += my - omy + 2;
@@ -760,7 +778,8 @@
CRect intersection;
BOOL ok = intersection.IntersectRect(&pDC.rcPaint,&client);
- if(pDC.fErase || (ok && nChannelsOld != nChannels)){
+ if(pDC.fErase || (ok && nChannelsOld != nChannels))
+ {
FillRect(pDC.hdc,&intersection,CMainFrame::brushHighLight);
FrameRect(pDC.hdc,&client,CMainFrame::brushBlack);
nChannelsOld = nChannels;
@@ -771,14 +790,14 @@
HBRUSH red = CreateSolidBrush(RGB(192,96,96));
HBRUSH green = CreateSolidBrush(RGB(96,192,96));
- for(i = 0 ; i < nChannels ; i++){
+ for(CHANNELINDEX nChn = 0; nChn < nChannels; nChn++)
+ {
+ CHANNELINDEX nThisChn = pattern[nChn];
- ii = pattern[i];
-
- if(m_pSndFile->ChnSettings[ii].szName[0] >= 0x20)
- wsprintf(s, "%d: %s", (ii+1), m_pSndFile->ChnSettings[ii].szName);
+ if(m_pSndFile->ChnSettings[nThisChn].szName[0] >= 0x20)
+ wsprintf(s, "%d: %s", (nThisChn + 1), m_pSndFile->ChnSettings[nThisChn].szName);
else
- wsprintf(s, "Channel %d", ii+1);
+ wsprintf(s, "Channel %d", nThisChn + 1);
btn.left = client.left + c * chnSizeX + 3;
btn.right = btn.left + chnSizeX - 3;
@@ -786,7 +805,7 @@
btn.bottom = btn.top + chnSizeY - 3;
ok = intersection.IntersectRect(&pDC.rcPaint,&client);
- if(ok) DrawChannelButton(pDC.hdc, &btn, s, select[ii], removed[ii] ? FALSE : TRUE, DT_RIGHT | DT_VCENTER, NULL);
+ if(ok) DrawChannelButton(pDC.hdc, &btn, s, select[nThisChn], removed[nThisChn] ? FALSE : TRUE, DT_RIGHT | DT_VCENTER, NULL);
btn.right = btn.left + chnSizeX / 7;
@@ -797,29 +816,29 @@
switch(currentTab){
case 0:
- if(m_pSndFile->ChnSettings[ii].dwFlags & CHN_MUTE) FillRect(pDC.hdc,&btn,red);
- else if(m_pSndFile->ChnSettings[ii].dwFlags & CHN_SOLO) FillRect(pDC.hdc,&btn,green);
+ if(m_pSndFile->ChnSettings[nThisChn].dwFlags & CHN_MUTE) FillRect(pDC.hdc,&btn,red);
+ else if(m_pSndFile->ChnSettings[nThisChn].dwFlags & CHN_SOLO) FillRect(pDC.hdc,&btn,green);
else FillRect(pDC.hdc,&btn,CMainFrame::brushHighLight);
break;
case 1:
- UINT r;
- if(pModDoc) r = pModDoc->IsChannelRecord(ii);
+ BYTE r;
+ if(pModDoc) r = pModDoc->IsChannelRecord(nThisChn);
else r = 0;
if(r == 1) FillRect(pDC.hdc,&btn,green);
else if(r == 2) FillRect(pDC.hdc,&btn,red);
else FillRect(pDC.hdc,&btn,CMainFrame::brushHighLight);
break;
case 2:
- if(m_pSndFile->ChnSettings[ii].dwFlags & CHN_NOFX) FillRect(pDC.hdc,&btn,red);
+ if(m_pSndFile->ChnSettings[nThisChn].dwFlags & CHN_NOFX) FillRect(pDC.hdc,&btn,red);
else FillRect(pDC.hdc,&btn,green);
break;
case 3:
- if(removed[ii]) FillRect(pDC.hdc,&btn,red);
+ if(removed[nThisChn]) FillRect(pDC.hdc,&btn,red);
else FillRect(pDC.hdc,&btn,green);
break;
}
- if(!removed[ii]){
+ if(!removed[nThisChn]){
HGDIOBJ oldpen = ::SelectObject(pDC.hdc, CMainFrame::penLightGray);
::MoveToEx(pDC.hdc, btn.right, btn.top-2, NULL);
::LineTo(pDC.hdc, btn.right, btn.bottom+1);
@@ -828,7 +847,7 @@
FrameRect(pDC.hdc,&btn,CMainFrame::brushBlack);
c++;
- if(c >= nColns) { c = 0; l++; }
+ if(c >= CM_NB_COLS) { c = 0; l++; }
}
DeleteObject((HBRUSH)green);
@@ -844,13 +863,13 @@
nChannelsOld = 0;
}
-BOOL CChannelManagerDlg::ButtonHit(CPoint point, UINT * id, CRect * invalidate)
+bool CChannelManagerDlg::ButtonHit( CPoint point, CHANNELINDEX * id, CRect * invalidate )
{
CRect client;
GetClientRect(&client);
client.SetRect(client.left + 10,client.top + 38,client.right - 8,client.bottom - 30);
- if(!PtInRect(client,point)) return FALSE;
+ if(!PtInRect(client,point)) return false;
CMainFrame * pMainFrm = CMainFrame::GetMainFrame();
CModDoc *pModDoc = pMainFrm ? pMainFrm->GetActiveDoc() : NULL;
@@ -869,7 +888,7 @@
x = x / dx;
y = y / dy;
- int n = y * nColns + x;
+ CHANNELINDEX n = static_cast<CHANNELINDEX>(y * nColns + x);
if(n >= 0 && n < (int)m_pSndFile->m_nChannels){
if(id) *id = n;
if(invalidate){
@@ -878,41 +897,43 @@
invalidate->top = client.top + y * dy;
invalidate->bottom = invalidate->top + dy;
}
- return TRUE;
+ return true;
}
}
- return FALSE;
+ return false;
}
-void CChannelManagerDlg::ResetState(BOOL selection, BOOL move, BOOL button, BOOL internal, BOOL order)
+void CChannelManagerDlg::ResetState(bool bSelection, bool bMove, bool bButton, bool bInternal, bool bOrder)
{
- for(int i = 0 ; i < MAX_BASECHANNELS ; i++){
- if(selection)
- select[pattern[i]] = FALSE;
- if(button)
- state[pattern[i]] = FALSE;
- if(order){
- pattern[i] = i;
- removed[i] = FALSE;
+ for(CHANNELINDEX nChn = 0; nChn < MAX_BASECHANNELS; nChn++)
+ {
+ if(bSelection)
+ select[pattern[nChn]] = false;
+ if(bButton)
+ state[pattern[nChn]] = false;
+ if(bOrder){
+ pattern[nChn] = nChn;
+ removed[nChn] = false;
}
}
- if(move || internal){
- leftButton = FALSE;
- rightButton = FALSE;
+ if(bMove || bInternal)
+ {
+ leftButton = false;
+ rightButton = false;
}
- if(move) moveRect = FALSE;
- if(internal) mouseTracking = FALSE;
+ if(move) moveRect = false;
+ if(bInternal) mouseTracking = false;
- if(order) nChannelsOld = 0;
+ if(bOrder) nChannelsOld = 0;
}
LRESULT CChannelManagerDlg::OnMouseLeave(WPARAM /*wparam*/, LPARAM /*lparam*/)
{
- if(!m_hWnd || show == FALSE) return 0;
+ if(!m_hWnd || show == false) return 0;
EnterCriticalSection(&applying);
- mouseTracking = FALSE;
- ResetState(FALSE,TRUE,FALSE,TRUE);
+ mouseTracking = false;
+ ResetState(false, true, false, true);
LeaveCriticalSection(&applying);
return 0;
@@ -920,10 +941,10 @@
LRESULT CChannelManagerDlg::OnMouseHover(WPARAM /*wparam*/, LPARAM /*lparam*/)
{
- if(!m_hWnd || show == FALSE) return 0;
+ if(!m_hWnd || show == false) return 0;
EnterCriticalSection(&applying);
- mouseTracking = FALSE;
+ mouseTracking = false;
LeaveCriticalSection(&applying);
return 0;
@@ -931,17 +952,18 @@
void CChannelManagerDlg::OnMouseMove(UINT nFlags,CPoint point)
{
- if(!m_hWnd || show == FALSE) return;
+ if(!m_hWnd || show == false) return;
EnterCriticalSection(&applying);
- if(!mouseTracking){
+ if(!mouseTracking)
+ {
TRACKMOUSEEVENT tme;
tme.cbSize = sizeof(tme);
tme.hwndTrack = m_hWnd;
tme.dwFlags = TME_LEAVE|TME_HOVER;
tme.dwHoverTime = 1;
- mouseTracking = _TrackMouseEvent(&tme);
+ mouseTracking = _TrackMouseEvent(&tme) ? true : false;
}
if(!leftButton && !rightButton){
@@ -957,7 +979,7 @@
void CChannelManagerDlg::OnLButtonUp(UINT /*nFlags*/,CPoint point)
{
- if(!m_hWnd || show == FALSE) return;
+ if(!m_hWnd || show == false) return;
EnterCriticalSection(&applying);
@@ -966,54 +988,60 @@
CSoundFile * m_pSndFile = pModDoc ? pModDoc->GetSoundFile() : NULL;
if(moveRect && m_pSndFile){
- UINT n,i,k,newpat[MAX_BASECHANNELS];
+ CHANNELINDEX n, i, k;
+ CHANNELINDEX newpat[MAX_BASECHANNELS];
- k = 0xffff;
- BOOL hit = ButtonHit(point,&n,NULL);
- for(i = 0 ; i < m_pSndFile->m_nChannels ; i++) if(k == 0xffff && select[pattern[i]]) k = i;
+ k = CHANNELINDEX_INVALID;
+ bool hit = ButtonHit(point,&n,NULL);
+ for(CHANNELINDEX nChn = 0; nChn < m_pSndFile->m_nChannels; nChn++)
+ if(k == CHANNELINDEX_INVALID && select[pattern[nChn]]) k = nChn;
- if(hit && m_pSndFile && k != 0xffff){
+ if(hit && m_pSndFile && k != CHANNELINDEX_INVALID){
i = 0;
k = 0;
while(i < n){
while(i < n && select[pattern[i]]) i++;
if(i < n && !select[pattern[i]]){
newpat[k] = pattern[i];
- pattern[i] = 0xffff;
+ pattern[i] = CHANNELINDEX_INVALID;
k++;
i++;
}
}
- for(i = 0 ; i < m_pSndFile->m_nChannels ; i++){
- if(pattern[i] != 0xffff && select[pattern[i]]){
- newpat[k] = pattern[i];
- pattern[i] = 0xffff;
+ for(CHANNELINDEX nChn = 0; nChn < m_pSndFile->m_nChannels ; nChn++)
+ {
+ if(pattern[nChn] != CHANNELINDEX_INVALID && select[pattern[nChn]]){
+ newpat[k] = pattern[nChn];
+ pattern[nChn] = CHANNELINDEX_INVALID;
k++;
}
}
i = 0;
while(i < m_pSndFile->m_nChannels){
- while(i < m_pSndFile->m_nChannels && pattern[i] == 0xffff) i++;
- if(i < m_pSndFile->m_nChannels && pattern[i] != 0xffff){
+ while(i < m_pSndFile->m_nChannels && pattern[i] == CHANNELINDEX_INVALID) i++;
+ if(i < m_pSndFile->m_nChannels && pattern[i] != CHANNELINDEX_INVALID){
newpat[k] = pattern[i];
k++;
i++;
}
}
- for(i = 0 ; i < m_pSndFile->m_nChannels ; i++){
- pattern[i] = newpat[i];
- select[i] = FALSE;
+ for(CHANNELINDEX nChn = 0; nChn < m_pSndFile->m_nChannels; nChn++)
+ {
+ pattern[nChn] = newpat[nChn];
+ select[nChn] = false;
}
}
- moveRect = FALSE;
+ moveRect = false;
nChannelsOld = 0;
InvalidateRect(NULL,FALSE);
}
- leftButton = FALSE;
+ leftButton = false;
- for(int i = 0 ; i < MAX_BASECHANNELS ; i++) state[pattern[i]] = FALSE;
+ for(CHANNELINDEX nChn = 0; nChn < MAX_BASECHANNELS ; nChn++)
+ state[pattern[nChn]] = false;
+
if(pModDoc) pModDoc->UpdateAllViews(NULL,0xff,NULL);
LeaveCriticalSection(&applying);
@@ -1021,13 +1049,13 @@
void CChannelManagerDlg::OnLButtonDown(UINT nFlags,CPoint point)
{
- if(!m_hWnd || show == FALSE) return;
+ if(!m_hWnd || show == false) return;
EnterCriticalSection(&applying);
- if(!ButtonHit(point,NULL,NULL)) ResetState(TRUE,FALSE,FALSE,FALSE);
+ if(!ButtonHit(point,NULL,NULL)) ResetState(true, false, false, false);
- leftButton = TRUE;
+ leftButton = true;
MouseEvent(nFlags,point,CM_BT_LEFT);
omx = point.x;
omy = point.y;
@@ -1037,13 +1065,13 @@
void CChannelManagerDlg::OnRButtonUp(UINT /*nFlags*/,CPoint /*point*/)
{
- if(!m_hWnd || show == FALSE) return;
+ if(!m_hWnd || show == false) return;
EnterCriticalSection(&applying);
- ResetState(FALSE,FALSE,TRUE,FALSE);
+ ResetState(false, false, true, false);
- rightButton = FALSE;
+ rightButton = false;
CMainFrame * pMainFrm = CMainFrame::GetMainFrame();
CModDoc *pModDoc = pMainFrm->GetActiveDoc();
if(pModDoc) pModDoc->UpdateAllViews(NULL,0xff,NULL);
@@ -1053,18 +1081,18 @@
void CChannelManagerDlg::OnRButtonDown(UINT nFlags,CPoint point)
{
- if(!m_hWnd || show == FALSE) return;
+ if(!m_hWnd || show == false) return;
EnterCriticalSection(&applying);
- if(moveRect){
- ResetState(TRUE,TRUE,FALSE,FALSE,FALSE);
+ rightButton = true;
+ if(moveRect)
+ {
+ ResetState(true, true, false, false, false);
nChannelsOld = 0;
InvalidateRect(NULL, FALSE);
- rightButton = TRUE;
- }
- else{
- rightButton = TRUE;
+ } else
+ {
MouseEvent(nFlags,point,CM_BT_RIGHT);
omx = point.x;
omy = point.y;
@@ -1075,9 +1103,9 @@
void CChannelManagerDlg::MouseEvent(UINT nFlags,CPoint point,BYTE button)
{
- UINT n;
+ CHANNELINDEX n;
CRect client,invalidate;
- BOOL hit = ButtonHit(point,&n,&invalidate);
+ bool hit = ButtonHit(point, &n, &invalidate);
if(hit) n = pattern[n];
mx = point.x;
@@ -1093,60 +1121,64 @@
if(nFlags & MK_CONTROL){
if(button == CM_BT_LEFT){
if(!select[n] && !removed[n]) move[n] = invalidate;
- select[n] = TRUE;
+ select[n] = true;
}
- else if(button == CM_BT_RIGHT) select[n] = FALSE;
+ else if(button == CM_BT_RIGHT) select[n] = false;
}
else if(!removed[n] || currentTab == 3){
switch(currentTab){
case 0:
- if(button == CM_BT_LEFT){
+ if(button == CM_BT_LEFT)
+ {
if(!pModDoc->IsChannelSolo(n) || pModDoc->IsChannelMuted(n)){
GetClientRect(&client);
- pModDoc->MuteChannel(n,FALSE);
- pModDoc->SoloChannel(n,TRUE);
- for(UINT i = 0 ; i < m_pSndFile->m_nChannels ; i++) if(i != n) pModDoc->MuteChannel(i,TRUE);
+ pModDoc->MuteChannel(n, false);
+ pModDoc->SoloChannel(n, true);
+ for(CHANNELINDEX nChn = 0; nChn < m_pSndFile->m_nChannels; nChn++) if(nChn != n) pModDoc->MuteChannel(nChn, true);
client.SetRect(client.left + 10,client.top + 38,client.right - 8,client.bottom - 30);
invalidate = client;
}
- else pModDoc->SoloChannel(n,FALSE);
- }
- else{
- if(pModDoc->IsChannelSolo(n)) pModDoc->SoloChannel(n,FALSE);
+ else pModDoc->SoloChannel(n, false);
+ } else
+ {
+ if(pModDoc->IsChannelSolo(n)) pModDoc->SoloChannel(n, false);
pModDoc->MuteChannel(n,!pModDoc->IsChannelMuted(n));
}
pModDoc->SetModified();
pModDoc->UpdateAllViews(NULL, HINT_MODCHANNELS | ((n/CHANNELS_IN_TAB) << HINT_SHIFT_CHNTAB));
break;
case 1:
- UINT r;
- r = pModDoc->IsChannelRecord(n);
- if(!r || r != (button == CM_BT_LEFT ? 1 : 2)){
+ BYTE rec;
+ rec = pModDoc->IsChannelRecord(n);
+ if(!rec || rec != (button == CM_BT_LEFT ? 1 : 2)){
if(button == CM_BT_LEFT) pModDoc->Record1Channel(n);
else pModDoc->Record2Channel(n);
+ } else
+ {
+ pModDoc->Record1Channel(n, false);
+ pModDoc->Record2Channel(n, false);
}
- else{
- pModDoc->Record1Channel(n,FALSE);
- pModDoc->Record2Channel(n,FALSE);
- }
break;
case 2:
- if(button == CM_BT_LEFT) pModDoc->NoFxChannel(n,FALSE);
- else pModDoc->NoFxChannel(n,TRUE);
+ if(button == CM_BT_LEFT) pModDoc->NoFxChannel(n, false);
+ else pModDoc->NoFxChannel(n, true);
pModDoc->SetModified();
pModDoc->UpdateAllViews(NULL, HINT_MODCHANNELS | ((n/CHANNELS_IN_TAB) << HINT_SHIFT_CHNTAB));
break;
case 3:
- if(button == CM_BT_LEFT){
+ if(button == CM_BT_LEFT)
+ {
move[n] = invalidate;
- select[n] = TRUE;
+ select[n] = true;
}
- if(button == CM_BT_RIGHT){
- select[n] = FALSE;
+ if(button == CM_BT_RIGHT)
+ {
+ select[n] = false;
removed[n] = !removed[n];
}
- if(select[n] || button == 0){
+ if(select[n] || button == 0)
+ {
GetClientRect(&client);
client.SetRect(client.left + 10,client.top + 38,client.right - 8,client.bottom - 30);
if(!bkgnd) bkgnd = ::CreateCompatibleBitmap(::GetDC(m_hWnd),client.Width(),client.Height());
@@ -1158,13 +1190,13 @@
::DeleteDC(bdc);
}
invalidate = client;
- moveRect = TRUE;
+ moveRect = true;
}
break;
}
}
- state[n] = TRUE;
+ state[n] = false;
InvalidateRect(&invalidate, FALSE);
}
else{
Modified: trunk/OpenMPT/mptrack/ChannelManagerDlg.h
===================================================================
--- trunk/OpenMPT/mptrack/ChannelManagerDlg.h 2009-10-11 16:07:45 UTC (rev 394)
+++ trunk/OpenMPT/mptrack/ChannelManagerDlg.h 2009-10-11 17:35:03 UTC (rev 395)
@@ -30,27 +30,27 @@
~CChannelManagerDlg(void);
CRITICAL_SECTION applying;
- UINT memory[4][MAX_BASECHANNELS];
- UINT pattern[MAX_BASECHANNELS];
- BOOL removed[MAX_BASECHANNELS];
- BOOL select[MAX_BASECHANNELS];
- BOOL state[MAX_BASECHANNELS];
+ CHANNELINDEX memory[4][MAX_BASECHANNELS];
+ CHANNELINDEX pattern[MAX_BASECHANNELS];
+ bool removed[MAX_BASECHANNELS];
+ bool select[MAX_BASECHANNELS];
+ bool state[MAX_BASECHANNELS];
CRect move[MAX_BASECHANNELS];
void * parentCtrl;
- BOOL mouseTracking;
- int nChannelsOld;
- BOOL rightButton;
- BOOL leftButton;
+ bool mouseTracking;
+ CHANNELINDEX nChannelsOld;
+ bool rightButton;
+ bool leftButton;
int currentTab;
- BOOL moveRect;
+ bool moveRect;
HBITMAP bkgnd;
int omx,omy;
- BOOL show;
+ bool show;
int mx,my;
- BOOL ButtonHit(CPoint point, UINT * id, CRect * invalidate);
+ bool ButtonHit(CPoint point, CHANNELINDEX * id, CRect * invalidate);
void MouseEvent(UINT nFlags,CPoint point, BYTE button);
- void ResetState(BOOL selection = TRUE, BOOL move = TRUE, BOOL button = TRUE, BOOL internal = TRUE, BOOL order = FALSE);
+ void ResetState(bool bSelection = true, bool bMove = true, bool bButton = true, bool bInternal = true, bool bOrder = false);
//{{AFX_VIRTUAL(CChannelManagerDlg)
BOOL OnInitDialog();
Modified: trunk/OpenMPT/mptrack/Ctrl_pat.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Ctrl_pat.cpp 2009-10-11 16:07:45 UTC (rev 394)
+++ trunk/OpenMPT/mptrack/Ctrl_pat.cpp 2009-10-11 17:35:03 UTC (rev 395)
@@ -8,7 +8,6 @@
#include "ctrl_pat.h"
#include "view_pat.h"
#include "ChannelManagerDlg.h"
-#include ".\ctrl_pat.h"
//////////////////////////////////////////////////////////////
// CCtrlPatterns
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sag...@us...> - 2009-10-11 16:08:01
|
Revision: 394
http://modplug.svn.sourceforge.net/modplug/?rev=394&view=rev
Author: saga-games
Date: 2009-10-11 16:07:45 +0000 (Sun, 11 Oct 2009)
Log Message:
-----------
[Fix] J2B Loader: Fixed uncompress() call, added security check in RIFF AM loader
[Imp] All Loaders: Using a new template, SpaceToNullStringFixed, which filters out all null chars in song/sample/instrument/etc. names. This avoids "empty" instrument names that occured in a couple of .IT files before.
[Mod] Added IMF and J2B to glpszModExtensions
Modified Paths:
--------------
trunk/OpenMPT/mptrack/Mptrack.cpp
trunk/OpenMPT/mptrack/misc_util.h
trunk/OpenMPT/soundlib/LOAD_AMF.CPP
trunk/OpenMPT/soundlib/LOAD_DBM.CPP
trunk/OpenMPT/soundlib/LOAD_DMF.CPP
trunk/OpenMPT/soundlib/LOAD_DSM.CPP
trunk/OpenMPT/soundlib/Load_669.cpp
trunk/OpenMPT/soundlib/Load_ams.cpp
trunk/OpenMPT/soundlib/Load_far.cpp
trunk/OpenMPT/soundlib/Load_gdm.cpp
trunk/OpenMPT/soundlib/Load_imf.cpp
trunk/OpenMPT/soundlib/Load_it.cpp
trunk/OpenMPT/soundlib/Load_mdl.cpp
trunk/OpenMPT/soundlib/Load_med.cpp
trunk/OpenMPT/soundlib/Load_mod.cpp
trunk/OpenMPT/soundlib/Load_mt2.cpp
trunk/OpenMPT/soundlib/Load_mtm.cpp
trunk/OpenMPT/soundlib/Load_okt.cpp
trunk/OpenMPT/soundlib/Load_psm.cpp
trunk/OpenMPT/soundlib/Load_ptm.cpp
trunk/OpenMPT/soundlib/Load_s3m.cpp
trunk/OpenMPT/soundlib/Load_stm.cpp
trunk/OpenMPT/soundlib/Load_ult.cpp
trunk/OpenMPT/soundlib/Load_xm.cpp
trunk/OpenMPT/soundlib/Sndfile.cpp
trunk/OpenMPT/soundlib/load_j2b.cpp
Modified: trunk/OpenMPT/mptrack/Mptrack.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Mptrack.cpp 2009-10-10 00:03:35 UTC (rev 393)
+++ trunk/OpenMPT/mptrack/Mptrack.cpp 2009-10-11 16:07:45 UTC (rev 394)
@@ -1836,6 +1836,8 @@
"Storlek for all the IT compatibility hints and testcases|"
"as well as the IMF loader|"
"http://schismtracker.org/|"
+ "kode54 for the PSM and J2B loaders|"
+ "http://kode54.foobar2000.org/|"
"Pel K. Txnder for the scrolling credits control :)|"
"http://tinyurl.com/4yze8|"
"|The people at Modplug forums for crucial contribution|"
Modified: trunk/OpenMPT/mptrack/misc_util.h
===================================================================
--- trunk/OpenMPT/mptrack/misc_util.h 2009-10-10 00:03:35 UTC (rev 393)
+++ trunk/OpenMPT/mptrack/misc_util.h 2009-10-11 16:07:45 UTC (rev 394)
@@ -139,6 +139,7 @@
template <size_t size>
void NullToSpaceString(char (&buffer)[size])
{
+ STATIC_ASSERT(size > 0);
size_t pos = size;
while (pos-- > 0)
if (buffer[pos] == 0)
@@ -149,6 +150,7 @@
template <size_t size>
void SpaceToNullString(char (&buffer)[size])
{
+ STATIC_ASSERT(size > 0);
// First, remove any Nulls
NullToSpaceString(buffer);
size_t pos = size;
@@ -161,4 +163,22 @@
}
buffer[size - 1] = 0;
}
+
+// Convert a space-padded string to a 0-terminated string.
+// Additional parameter to specifify the max length of the final string,
+// not including null char (useful for e.g. mod loaders)
+template <size_t size>
+void SpaceToNullStringFixed(char (&buffer)[size], const size_t length)
+//--------------------------------------------------------------------
+{
+ STATIC_ASSERT(size > 0);
+ ASSERT(length < size);
+ // Remove Nulls in string
+ SpaceToNullString(buffer);
+ // Overwrite trailing chars
+ for(size_t pos = length; pos < size; pos++)
+ {
+ buffer[pos] = 0;
+ }
+}
#endif
Modified: trunk/OpenMPT/soundlib/LOAD_AMF.CPP
===================================================================
--- trunk/OpenMPT/soundlib/LOAD_AMF.CPP 2009-10-10 00:03:35 UTC (rev 393)
+++ trunk/OpenMPT/soundlib/LOAD_AMF.CPP 2009-10-11 16:07:45 UTC (rev 394)
@@ -196,7 +196,8 @@
for (UINT iSmp=0; iSmp<numsamples; iSmp++)
{
MODSAMPLE *psmp = &Samples[iSmp+1];
- memcpy(m_szNames[iSmp+1], lpStream+dwMemPos, 22);
+ memcpy(m_szNames[iSmp + 1], lpStream+dwMemPos, 22);
+ SpaceToNullStringFixed(m_szNames[iSmp + 1], 22);
psmp->nFineTune = MOD2XMFineTune(lpStream[dwMemPos+22]);
psmp->nVolume = lpStream[dwMemPos+23];
psmp->nGlobalVol = 64;
@@ -268,6 +269,7 @@
|| (pfh->numchannels < 1) || (pfh->numchannels > 32))
return false;
memcpy(m_szNames[0], pfh->title, 31);
+ SpaceToNullStringFixed(m_szNames[0], 31);
dwMemPos = sizeof(AMFFILEHEADER);
m_nType = MOD_TYPE_AMF;
m_nChannels = pfh->numchannels;
@@ -328,6 +330,8 @@
dwMemPos += sizeof(AMFSAMPLE);
memcpy(m_szNames[iIns+1], psh->samplename, 31);
memcpy(pSmp->filename, psh->filename, 13);
+ SpaceToNullStringFixed(m_szNames[iIns + 1], 31);
+ SpaceToNullStringFixed(pSmp->filename, 13);
pSmp->nLength = LittleEndian(psh->length);
pSmp->nC5Speed = LittleEndianW(psh->c2spd);
pSmp->nGlobalVol = 64;
Modified: trunk/OpenMPT/soundlib/LOAD_DBM.CPP
===================================================================
--- trunk/OpenMPT/soundlib/LOAD_DBM.CPP 2009-10-10 00:03:35 UTC (rev 393)
+++ trunk/OpenMPT/soundlib/LOAD_DBM.CPP 2009-10-11 16:07:45 UTC (rev 394)
@@ -119,7 +119,7 @@
if (m_nChannels < 1) m_nChannels = 1;
if (m_nChannels > 64) m_nChannels = 64;
memcpy(m_szNames[0], (pfh->songname[0]) ? pfh->songname : pfh->songname2, 32);
- m_szNames[0][31] = 0;
+ SpaceToNullStringFixed(m_szNames[0], 31);
Order.resize(nOrders, Order.GetInvalidPatIndex());
for (UINT iOrd=0; iOrd < nOrders; iOrd++)
{
@@ -155,10 +155,11 @@
psmp = ((nsmp) && (nsmp < MAX_SAMPLES)) ? &Samples[nsmp] : NULL;
memset(pIns, 0, sizeof(MODINSTRUMENT));
memcpy(pIns->name, pih->name, 30);
+ SpaceToNullStringFixed(pIns->name, 30);
if (psmp)
{
memcpy(m_szNames[nsmp], pih->name, 30);
- m_szNames[nsmp][30] = 0;
+ SpaceToNullStringFixed(m_szNames[nsmp], 30);
}
Instruments[iIns+1] = pIns;
pIns->nFadeOut = 1024; // ???
Modified: trunk/OpenMPT/soundlib/LOAD_DMF.CPP
===================================================================
--- trunk/OpenMPT/soundlib/LOAD_DMF.CPP 2009-10-10 00:03:35 UTC (rev 393)
+++ trunk/OpenMPT/soundlib/LOAD_DMF.CPP 2009-10-11 16:07:45 UTC (rev 394)
@@ -100,7 +100,7 @@
if ((pfh->id != 0x464d4444) || (!pfh->version) || (pfh->version & 0xF0)) return false;
dwMemPos = 66;
memcpy(m_szNames[0], pfh->songname, 30);
- m_szNames[0][30] = 0;
+ SpaceToNullStringFixed(m_szNames[0], 30);
m_nType = MOD_TYPE_DMF;
m_nChannels = 0;
#ifdef DMFLOG
@@ -395,7 +395,7 @@
{
UINT rlen = (namelen < 32) ? namelen : 31;
memcpy(m_szNames[iSmp], lpStream+dwPos+1, rlen);
- m_szNames[iSmp][rlen] = 0;
+ SpaceToNullStringFixed(m_szNames[iSmp], rlen);
}
dwPos += namelen + 1;
DMFSAMPLE *psh = (DMFSAMPLE *)(lpStream+dwPos);
@@ -439,7 +439,7 @@
pksize = *((LPDWORD)(lpStream+dwPos));
#ifdef DMFLOG
Log("sample %d: pos=0x%X pksize=%d ", iSmp, dwPos, pksize);
- Log("len=%d flags=0x%X [%08X]\n", Ins[iSmp].nLength, smplflags[ismpd], *((LPDWORD)(lpStream+dwPos+4)));
+ Log("len=%d flags=0x%X [%08X]\n", Samples[iSmp].nLength, smplflags[ismpd], *((LPDWORD)(lpStream+dwPos+4)));
#endif
dwPos += 4;
if (pksize > dwMemLength - dwPos)
Modified: trunk/OpenMPT/soundlib/LOAD_DSM.CPP
===================================================================
--- trunk/OpenMPT/soundlib/LOAD_DSM.CPP 2009-10-10 00:03:35 UTC (rev 393)
+++ trunk/OpenMPT/soundlib/LOAD_DSM.CPP 2009-10-11 16:07:45 UTC (rev 394)
@@ -121,6 +121,7 @@
}
}
memcpy(m_szNames[0], psong->songname, 28);
+ SpaceToNullStringFixed(m_szNames[0], 28);
nPat = 0;
nSmp = 1;
while (dwMemPos < dwMemLength - 8)
@@ -214,8 +215,10 @@
DWORD dwPos = dwMemPos + sizeof(DSMSAMPLE);
dwMemPos += 8 + pSmp->inst_len;
memcpy(m_szNames[nSmp], pSmp->samplename, 28);
+ SpaceToNullStringFixed(m_szNames[nSmp], 28);
MODSAMPLE *psmp = &Samples[nSmp];
memcpy(psmp->filename, pSmp->filename, 13);
+ SpaceToNullStringFixed(psmp->filename, 13);
psmp->nGlobalVol = 64;
psmp->nC5Speed = pSmp->c2spd;
psmp->uFlags = (WORD)((pSmp->flags & 1) ? CHN_LOOP : 0);
Modified: trunk/OpenMPT/soundlib/Load_669.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Load_669.cpp 2009-10-10 00:03:35 UTC (rev 393)
+++ trunk/OpenMPT/soundlib/Load_669.cpp 2009-10-11 16:07:45 UTC (rev 394)
@@ -68,9 +68,12 @@
m_nDefaultTempo = 125;
m_nDefaultSpeed = 6;
m_nChannels = 8;
+
memcpy(m_szNames[0], pfh->songmessage, 16);
+ SpaceToNullStringFixed(m_szNames[0], 16);
+
m_nSamples = pfh->samples;
- for (UINT nins=1; nins<=m_nSamples; nins++, psmp++)
+ for (SAMPLEINDEX nSmp = 1; nSmp <= m_nSamples; nSmp++, psmp++)
{
DWORD len = LittleEndian(*((DWORD *)(&psmp->length)));
DWORD loopstart = LittleEndian(*((DWORD *)(&psmp->loopstart)));
@@ -79,14 +82,15 @@
if ((loopend > len) && (!loopstart)) loopend = 0;
if (loopend > len) loopend = len;
if (loopstart + 4 >= loopend) loopstart = loopend = 0;
- Samples[nins].nLength = len;
- Samples[nins].nLoopStart = loopstart;
- Samples[nins].nLoopEnd = loopend;
- if (loopend) Samples[nins].uFlags |= CHN_LOOP;
- memcpy(m_szNames[nins], psmp->filename, 13);
- Samples[nins].nVolume = 256;
- Samples[nins].nGlobalVol = 64;
- Samples[nins].nPan = 128;
+ Samples[nSmp].nLength = len;
+ Samples[nSmp].nLoopStart = loopstart;
+ Samples[nSmp].nLoopEnd = loopend;
+ if (loopend) Samples[nSmp].uFlags |= CHN_LOOP;
+ memcpy(m_szNames[nSmp], psmp->filename, 13);
+ SpaceToNullStringFixed(m_szNames[nSmp], 13);
+ Samples[nSmp].nVolume = 256;
+ Samples[nSmp].nGlobalVol = 64;
+ Samples[nSmp].nPan = 128;
}
// Song Message
m_lpszSongComments = new char[109];
Modified: trunk/OpenMPT/soundlib/Load_ams.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Load_ams.cpp 2009-10-10 00:03:35 UTC (rev 393)
+++ trunk/OpenMPT/soundlib/Load_ams.cpp 2009-10-11 16:07:45 UTC (rev 394)
@@ -88,6 +88,7 @@
if (dwMemPos + tmp + 1 >= dwMemLength) return true;
tmp2 = (tmp < 32) ? tmp : 31;
if (tmp2) memcpy(m_szNames[0], lpStream+dwMemPos, tmp2);
+ SpaceToNullStringFixed(m_szNames[0], tmp2);
m_szNames[0][tmp2] = 0;
dwMemPos += tmp;
// Read sample names
@@ -97,9 +98,10 @@
tmp = lpStream[dwMemPos++];
tmp2 = (tmp < 32) ? tmp : 31;
if (tmp2) memcpy(m_szNames[sNam], lpStream+dwMemPos, tmp2);
+ SpaceToNullStringFixed(m_szNames[sNam], tmp2);
dwMemPos += tmp;
}
- // Skip Channel names
+ // Read Channel names
for (UINT cNam=0; cNam<m_nChannels; cNam++)
{
if (dwMemPos + 32 >= dwMemLength) return true;
@@ -107,6 +109,7 @@
if ((chnnamlen) && (chnnamlen < MAX_CHANNELNAME))
{
memcpy(ChnSettings[cNam].szName, lpStream + dwMemPos + 1, chnnamlen);
+ SpaceToNullStringFixed(ChnSettings[cNam].szName, chnnamlen);
}
dwMemPos += chnnamlen;
}
@@ -331,8 +334,8 @@
dwMemPos += sizeof(AMS2SONGHEADER);
if (pfh->titlelen)
{
- memcpy(m_szNames, pfh->szTitle, pfh->titlelen);
- m_szNames[0][pfh->titlelen] = 0;
+ memcpy(m_szNames[0], pfh->szTitle, pfh->titlelen);
+ SpaceToNullStringFixed(m_szNames[0], pfh->titlelen);
}
m_nType = MOD_TYPE_AMS;
m_nChannels = 32;
@@ -410,6 +413,7 @@
if ((psmp) && (smpnamelen) && (smpnamelen <= 22))
{
memcpy(m_szNames[smpmap[ismp]], lpStream+dwMemPos+1, smpnamelen);
+ SpaceToNullStringFixed(m_szNames[smpmap[ismp]], smpnamelen);
}
dwMemPos += smpnamelen + 1;
if (psmp)
@@ -452,6 +456,7 @@
if ((chnnamlen) && (chnnamlen < MAX_CHANNELNAME))
{
memcpy(ChnSettings[i].szName, lpStream+dwMemPos+1, chnnamlen);
+ SpaceToNullStringFixed(ChnSettings[i].szName, chnnamlen);
}
dwMemPos += chnnamlen + 1;
if (dwMemPos + chnnamlen + 256 >= dwMemLength) return TRUE;
@@ -487,7 +492,7 @@
{
char s[MAX_PATTERNNAME];
memcpy(s, lpStream+dwMemPos+3, patnamlen);
- s[patnamlen] = 0;
+ SpaceToNullStringFixed(s, patnamlen);
SetPatternName(ipat, s);
}
if(Patterns.Insert(ipat, numrows)) return TRUE;
Modified: trunk/OpenMPT/soundlib/Load_far.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Load_far.cpp 2009-10-10 00:03:35 UTC (rev 393)
+++ trunk/OpenMPT/soundlib/Load_far.cpp 2009-10-11 16:07:45 UTC (rev 394)
@@ -88,6 +88,8 @@
m_nDefaultGlobalVolume = 256;
memcpy(m_szNames[0], pmh1->songname, 31);
+ SpaceToNullStringFixed(m_szNames[0], 31);
+
// Channel Setting
for (UINT nchpan=0; nchpan<16; nchpan++)
{
@@ -248,6 +250,7 @@
dwMemPos += sizeof(FARSAMPLE);
m_nSamples = ismp + 1;
memcpy(m_szNames[ismp+1], pfs->samplename, 31);
+ SpaceToNullStringFixed(m_szNames[ismp + 1], 31);
const DWORD length = LittleEndian( pfs->length );
pSmp->nLength = length;
pSmp->nLoopStart = LittleEndian(pfs->reppos) ;
Modified: trunk/OpenMPT/soundlib/Load_gdm.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Load_gdm.cpp 2009-10-10 00:03:35 UTC (rev 393)
+++ trunk/OpenMPT/soundlib/Load_gdm.cpp 2009-10-11 16:07:45 UTC (rev 394)
@@ -80,11 +80,6 @@
(pHeader->DOSEOF[0] != 13 || pHeader->DOSEOF[1] != 10 || pHeader->DOSEOF[2] != 26) || //CR+LF+EOF
(LittleEndian(pHeader->ID2) != 0x53464D47)) return false; //GMFS
- // song name
- memset(m_szNames, 0, sizeof(m_szNames));
- memcpy(m_szNames[0], pHeader->SongTitle, 32);
- SetNullTerminator(m_szNames[0]);
-
// there are no other format versions...
if(pHeader->FormMajorVer != 1 || pHeader->FormMinorVer != 0)
{
@@ -94,6 +89,11 @@
// interesting question: Is TrackID, TrackMajorVer, TrackMinorVer relevant? The only TrackID should be 0 - 2GDM.exe, so the answer would be no.
+ // song name
+ memset(m_szNames, 0, sizeof(m_szNames));
+ memcpy(m_szNames[0], pHeader->SongTitle, 32);
+ SpaceToNullStringFixed(m_szNames[0], 31);
+
// read channel pan map... 0...15 = channel panning, 16 = surround channel, 255 = channel does not exist
m_nChannels = 32;
for(CHANNELINDEX i = 0; i < 32; i++)
@@ -179,15 +179,16 @@
// read samples
m_nSamples = pHeader->NOS + 1;
- for(UINT iSmp = 1; iSmp <= m_nSamples; iSmp++)
+ for(SAMPLEINDEX iSmp = 1; iSmp <= m_nSamples; iSmp++)
{
const PGDMSAMPLEHEADER pSample = (PGDMSAMPLEHEADER)(lpStream + iSamHeadOffset + (iSmp - 1) * sizeof(GDMSAMPLEHEADER));
// sample header
memcpy(m_szNames[iSmp], pSample->SamName, 32);
- SetNullTerminator(m_szNames[iSmp]);
+ SpaceToNullStringFixed(m_szNames[iSmp], 31);
memcpy(Samples[iSmp].filename, pSample->FileName, 12);
+ SpaceToNullStringFixed(Samples[iSmp].filename, 12);
Samples[iSmp].nC5Speed = LittleEndianW(pSample->C4Hertz);
Samples[iSmp].nGlobalVol = 256; // not supported in this format
Modified: trunk/OpenMPT/soundlib/Load_imf.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Load_imf.cpp 2009-10-10 00:03:35 UTC (rev 393)
+++ trunk/OpenMPT/soundlib/Load_imf.cpp 2009-10-11 16:07:45 UTC (rev 394)
@@ -288,8 +288,7 @@
// song name
memset(m_szNames, 0, sizeof(m_szNames));
memcpy(m_szNames[0], hdr.title, 31);
- m_szNames[0][31] = 0;
- SetNullTerminator(m_szNames[0]);
+ SpaceToNullStringFixed(m_szNames[0], 31);
if (hdr.flags & 1)
m_dwSongFlags |= SONG_LINEARSLIDES;
@@ -306,8 +305,8 @@
ChnSettings[nChn].nPan = hdr.channels[nChn].panning * 64 / 255;
ChnSettings[nChn].nPan *= 4;
- memcpy(&ChnSettings[nChn].szName[0], hdr.channels[nChn].name, 12);
- SetNullTerminator(ChnSettings[nChn].szName);
+ memcpy(ChnSettings[nChn].szName, hdr.channels[nChn].name, 12);
+ SpaceToNullStringFixed(ChnSettings[nChn].szName, 12);
// TODO: reverb/chorus?
switch (hdr.channels[nChn].status) {
@@ -475,8 +474,8 @@
pIns->nPPC = 5 * 12;
SetDefaultInstrumentValues(pIns);
- strncpy(pIns->name, imfins.name, 31);
- pIns->name[31] = 0;
+ memcpy(pIns->name, imfins.name, 31);
+ SpaceToNullStringFixed(pIns->name, 31);
if (imfins.smpnum) {
for (BYTE cNote = 0; cNote < 120; cNote++) {
@@ -512,9 +511,10 @@
return false;
}
- strncpy(pSample->filename, imfsmp.filename, 12);
- pSample->filename[12] = 0;
+ memcpy(pSample->filename, imfsmp.filename, 12);
+ SpaceToNullStringFixed(pSample->filename, 12);
strcpy(m_szNames[m_nSamples], pSample->filename);
+
blen = pSample->nLength = LittleEndian(imfsmp.length);
pSample->nLoopStart = LittleEndian(imfsmp.loop_start);
pSample->nLoopEnd = LittleEndian(imfsmp.loop_end);
Modified: trunk/OpenMPT/soundlib/Load_it.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Load_it.cpp 2009-10-10 00:03:35 UTC (rev 393)
+++ trunk/OpenMPT/soundlib/Load_it.cpp 2009-10-11 16:07:45 UTC (rev 394)
@@ -250,6 +250,8 @@
const ITOLDINSTRUMENT *pis = (const ITOLDINSTRUMENT *)p;
memcpy(pIns->name, pis->name, 26);
memcpy(pIns->filename, pis->filename, 12);
+ SpaceToNullStringFixed(pIns->name, 26);
+ SpaceToNullStringFixed(pIns->filename, 12);
pIns->nFadeOut = pis->fadeout << 6;
pIns->nGlobalVol = 64;
for (UINT j=0; j<NOTE_MAX; j++)
@@ -290,6 +292,8 @@
const ITINSTRUMENT *pis = (const ITINSTRUMENT *)p;
memcpy(pIns->name, pis->name, 26);
memcpy(pIns->filename, pis->filename, 12);
+ SpaceToNullStringFixed(pIns->name, 26);
+ SpaceToNullStringFixed(pIns->filename, 12);
if (pis->mpr<=128)
pIns->nMidiProgram = pis->mpr;
pIns->nMidiChannel = pis->mch;
@@ -941,8 +945,10 @@
if (pifh->flags & 0x20) m_dwSongFlags |= SONG_ITCOMPATMODE;
if ((pifh->flags & 0x80) || (pifh->special & 0x08)) m_dwSongFlags |= SONG_EMBEDMIDICFG;
if (pifh->flags & 0x1000) m_dwSongFlags |= SONG_EXFILTERRANGE;
+
memcpy(m_szNames[0], pifh->songname, 26);
- m_szNames[0][26] = 0;
+ SpaceToNullStringFixed(m_szNames[0], 26);
+
// Global Volume
if (pifh->globalvol)
{
@@ -1208,6 +1214,7 @@
{
MODSAMPLE *pSmp = &Samples[nsmp+1];
memcpy(pSmp->filename, pis->filename, 12);
+ SpaceToNullStringFixed(pSmp->filename, 12);
pSmp->uFlags = 0;
pSmp->nLength = 0;
pSmp->nLoopStart = pis->loopbegin;
@@ -1258,17 +1265,10 @@
// -! NEW_FEATURE#0027
}
}
- memcpy(m_szNames[nsmp+1], pis->name, 26);
+ memcpy(m_szNames[nsmp + 1], pis->name, 26);
+ SpaceToNullStringFixed(m_szNames[nsmp + 1], 26);
}
- for (UINT ncu=0; ncu<MAX_BASECHANNELS; ncu++)
- {
- if (ncu>=m_nChannels)
- {
- ChnSettings[ncu].nVolume = 64;
- ChnSettings[ncu].dwFlags &= ~CHN_MUTE;
- }
- }
m_nMinPeriod = 8;
m_nMaxPeriod = 0xF000;
@@ -1309,11 +1309,7 @@
}
UINT len = *((WORD *)(lpStream+patpos[npat]));
UINT rows = *((WORD *)(lpStream+patpos[npat]+2));
-// -> CODE#0008
-// -> DESC="#define to set pattern size"
-// if ((rows < 4) || (rows > 256)) continue;
if ((rows < GetModSpecifications().patternRowsMin) || (rows > GetModSpecifications().patternRowsMax)) continue;
-// -> BEHAVIOUR_CHANGE#0008
if (patpos[npat]+8+len > dwMemLength) continue;
if(Patterns.Insert(npat, rows)) continue;
Modified: trunk/OpenMPT/soundlib/Load_mdl.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Load_mdl.cpp 2009-10-10 00:03:35 UTC (rev 393)
+++ trunk/OpenMPT/soundlib/Load_mdl.cpp 2009-10-11 16:07:45 UTC (rev 394)
@@ -229,6 +229,8 @@
#endif
pmib = (MDLINFOBLOCK *)(lpStream+dwMemPos);
memcpy(m_szNames[0], pmib->songname, 31);
+ SpaceToNullStringFixed(m_szNames[0], 31);
+
norders = pmib->norders;
if (norders > MAX_ORDERS) norders = MAX_ORDERS;
m_nRestartPos = pmib->repeatpos;
@@ -328,6 +330,8 @@
MODINSTRUMENT *pIns = Instruments[nins];
memset(pIns, 0, sizeof(MODINSTRUMENT));
memcpy(pIns->name, lpStream+dwPos+2, 32);
+ SpaceToNullStringFixed(pIns->name, 31);
+
pIns->nGlobalVol = 64;
pIns->nPPC = 5*12;
SetDefaultInstrumentValues(pIns);
@@ -413,6 +417,8 @@
MODSAMPLE *pSmp = &Samples[nins];
memcpy(m_szNames[nins], lpStream+dwPos+1, 31);
memcpy(pSmp->filename, lpStream+dwPos+33, 8);
+ SpaceToNullStringFixed(m_szNames[nins], 31);
+ SpaceToNullStringFixed(pSmp->filename, 8);
const BYTE *p = lpStream+dwPos+41;
if (pmsh->version > 0)
{
Modified: trunk/OpenMPT/soundlib/Load_med.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Load_med.cpp 2009-10-10 00:03:35 UTC (rev 393)
+++ trunk/OpenMPT/soundlib/Load_med.cpp 2009-10-11 16:07:45 UTC (rev 394)
@@ -716,6 +716,7 @@
{
if (songnamelen > 31) songnamelen = 31;
memcpy(m_szNames[0], lpStream+songname, songnamelen);
+ SpaceToNullStringFixed(m_szNames[0], songnamelen);
}
// Sample Names
DWORD smpinfoex = BigEndian(pmex->iinfo);
@@ -733,6 +734,7 @@
for (UINT i=0; i<ientries; i++) if (i < m_nSamples)
{
memcpy(m_szNames[i+1], psznames + i*ientrysz, maxnamelen);
+ SpaceToNullStringFixed(m_szNames[i + 1], maxnamelen);
}
}
}
@@ -762,8 +764,8 @@
if (trknamelen > MAX_CHANNELNAME) trknamelen = MAX_CHANNELNAME;
if ((trknameofs) && (trknameofs < dwMemLength - trknamelen))
{
- memcpy(ChnSettings[i].szName, (LPCSTR)(lpStream+trknameofs), MAX_CHANNELNAME);
- SetNullTerminator(ChnSettings[i].szName);
+ memcpy(ChnSettings[i].szName, (LPCSTR)(lpStream+trknameofs), trknamelen);
+ SpaceToNullStringFixed(ChnSettings[i].szName, trknamelen);
}
}
}
Modified: trunk/OpenMPT/soundlib/Load_mod.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Load_mod.cpp 2009-10-10 00:03:35 UTC (rev 393)
+++ trunk/OpenMPT/soundlib/Load_mod.cpp 2009-10-11 16:07:45 UTC (rev 394)
@@ -256,7 +256,7 @@
UINT loopstart, looplen;
memcpy(m_szNames[i], pms->name, 22);
- m_szNames[i][22] = 0;
+ SpaceToNullStringFixed(m_szNames[i], 22);
psmp->uFlags = 0;
psmp->nLength = BigEndianW(pms->length)*2;
dwTotalSampleLen += psmp->nLength;
@@ -347,7 +347,8 @@
m_nDefaultTempo = 125;
m_nMinPeriod = 14 << 2;
m_nMaxPeriod = 3424 << 2;
- memcpy(m_szNames, lpStream, 20);
+ memcpy(m_szNames[0], lpStream, 20);
+ SpaceToNullStringFixed(m_szNames[0], 20);
// Setup channel pan positions and volume
SetupMODPanning();
Modified: trunk/OpenMPT/soundlib/Load_mt2.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Load_mt2.cpp 2009-10-10 00:03:35 UTC (rev 393)
+++ trunk/OpenMPT/soundlib/Load_mt2.cpp 2009-10-11 16:07:45 UTC (rev 394)
@@ -210,7 +210,8 @@
Order[iOrd] = (PATTERNINDEX)pfh->Orders[iOrd];
}
memcpy(m_szNames[0], pfh->szSongName, 32);
- m_szNames[0][31] = 0;
+ SpaceToNullStringFixed(m_szNames[0], 31);
+
dwMemPos = sizeof(MT2FILEHEADER);
nDrumDataLen = *(WORD *)(lpStream + dwMemPos);
dwDrumDataPos = dwMemPos + 2;
@@ -407,7 +408,7 @@
{
memset(pIns, 0, sizeof(MODINSTRUMENT));
memcpy(pIns->name, pmi->szName, 32);
- SetNullTerminator(pIns->name);
+ SpaceToNullStringFixed(pIns->name, 32);
pIns->nGlobalVol = 64;
pIns->nPan = 128;
for (UINT i=0; i<NOTE_MAX; i++)
@@ -539,6 +540,7 @@
if (iSmp < MAX_SAMPLES)
{
memcpy(m_szNames[iSmp], pms->szName, 31);
+ SpaceToNullStringFixed(m_szNames[iSmp], 31);
}
if (pms->dwDataLen > 0)
{
Modified: trunk/OpenMPT/soundlib/Load_mtm.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Load_mtm.cpp 2009-10-10 00:03:35 UTC (rev 393)
+++ trunk/OpenMPT/soundlib/Load_mtm.cpp 2009-10-11 16:07:45 UTC (rev 394)
@@ -59,19 +59,20 @@
|| (pmh->numsamples >= MAX_SAMPLES) || (!pmh->numsamples)
|| (!pmh->numtracks) || (!pmh->numchannels)
|| (!pmh->lastpattern) || (pmh->lastpattern > MAX_PATTERNS)) return false;
- strncpy(m_szNames[0], pmh->songname, 20);
- m_szNames[0][20] = 0;
- if (dwMemPos + 37*pmh->numsamples + 128 + 192*pmh->numtracks
+ memcpy(m_szNames[0], pmh->songname, 20);
+ SpaceToNullStringFixed(m_szNames[0], 20);
+
+ if (dwMemPos + 37 * pmh->numsamples + 128 + 192 * pmh->numtracks
+ 64 * (pmh->lastpattern+1) + pmh->commentsize >= dwMemLength) return false;
m_nType = MOD_TYPE_MTM;
m_nSamples = pmh->numsamples;
m_nChannels = pmh->numchannels;
// Reading instruments
- for (UINT i=1; i<=m_nSamples; i++)
+ for (SAMPLEINDEX i = 1; i <= m_nSamples; i++)
{
MTMSAMPLE *pms = (MTMSAMPLE *)(lpStream + dwMemPos);
- strncpy(m_szNames[i], pms->samplename, 22);
- m_szNames[i][22] = 0;
+ memcpy(m_szNames[i], pms->samplename, 22);
+ SpaceToNullStringFixed(m_szNames[i], 22);
Samples[i].nVolume = pms->volume << 2;
Samples[i].nGlobalVol = 64;
DWORD len = pms->length;
Modified: trunk/OpenMPT/soundlib/Load_okt.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Load_okt.cpp 2009-10-10 00:03:35 UTC (rev 393)
+++ trunk/OpenMPT/soundlib/Load_okt.cpp 2009-10-11 16:07:45 UTC (rev 394)
@@ -69,6 +69,7 @@
MODSAMPLE *pSmp = &Samples[smp];
memcpy(m_szNames[smp], psmp->name, 20);
+ SpaceToNullStringFixed(m_szNames[smp], 20);
pSmp->uFlags = 0;
pSmp->nLength = BigEndian(psmp->length) & ~1;
pSmp->nLoopStart = BigEndianW(psmp->loopstart);
Modified: trunk/OpenMPT/soundlib/Load_psm.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Load_psm.cpp 2009-10-10 00:03:35 UTC (rev 393)
+++ trunk/OpenMPT/soundlib/Load_psm.cpp 2009-10-11 16:07:45 UTC (rev 394)
@@ -169,7 +169,7 @@
{
case 0x4C544954: // "TITL" - Song Title
memcpy(m_szNames[0], lpStream + dwMemPos, (chunkSize < 31) ? chunkSize : 31);
- m_szNames[0][31] = 0;
+ SpaceToNullStringFixed(m_szNames[0], 31);
break;
case 0x54464453: // "SDFT" - Format info (song data starts here)
@@ -203,7 +203,7 @@
PSMSUBSONG subsong;
subsong.restartPos = (ORDERINDEX)Order.size(); // restart order "offset": current orderlist length
memcpy(subsong.songName, &pSong->songType, 9); // subsong name
- subsong.songName[9] = 0;
+ SpaceToNullStringFixed(subsong.songName, 9);
DWORD dwChunkPos = dwMemPos + sizeof(PSMSONGHEADER);
@@ -432,9 +432,9 @@
SAMPLEINDEX smp = (SAMPLEINDEX)(LittleEndianW(pSample->sampleNumber) + 1);
m_nSamples = max(m_nSamples, smp);
memcpy(m_szNames[smp], pSample->sampleName, 31);
- m_szNames[smp][31] = 0;
+ SpaceToNullStringFixed(m_szNames[smp], 31);
memcpy(Samples[smp].filename, pSample->fileName, 8);
- Samples[smp].filename[8] = 0;
+ SpaceToNullStringFixed(Samples[smp].filename, 8);
Samples[smp].nGlobalVol = 0x40;
Samples[smp].nC5Speed = LittleEndianW(pSample->C5Freq);
@@ -456,9 +456,9 @@
SAMPLEINDEX smp = (SAMPLEINDEX)(LittleEndianW(pSample->sampleNumber) + 1);
m_nSamples = max(m_nSamples, smp);
memcpy(m_szNames[smp], pSample->sampleName, 31);
- m_szNames[smp][31] = 0;
+ SpaceToNullStringFixed(m_szNames[smp], 31);
memcpy(Samples[smp].filename, pSample->fileName, 8);
- Samples[smp].filename[8] = 0;
+ SpaceToNullStringFixed(Samples[smp].filename, 8);
Samples[smp].nGlobalVol = 0x40;
Samples[smp].nC5Speed = LittleEndianW(pSample->C5Freq);
@@ -893,7 +893,7 @@
memset(m_szNames, 0, sizeof(m_szNames));
memcpy(m_szNames[0], shdr->songName, 31);
- m_szNames[0][31] = 0;
+ SpaceToNullStringFixed(m_szNames[0], 31);
// Read orders
dwMemPos = LittleEndian(shdr->orderOffset);
@@ -933,9 +933,9 @@
m_nSamples = max(m_nSamples, iSmp);
memcpy(m_szNames[iSmp], smphdr->name, 24);
- m_szNames[iSmp][24] = 0;
+ SpaceToNullStringFixed(m_szNames[iSmp], 24);
memcpy(Samples[iSmp].filename, smphdr->filename, 13);
- Samples[iSmp].filename[13] = 0;
+ SpaceToNullStringFixed(Samples[iSmp].filename, 13);
Samples[iSmp].nLength = LittleEndian(smphdr->length);
Samples[iSmp].nLoopStart = LittleEndian(smphdr->loopStart);
Modified: trunk/OpenMPT/soundlib/Load_ptm.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Load_ptm.cpp 2009-10-10 00:03:35 UTC (rev 393)
+++ trunk/OpenMPT/soundlib/Load_ptm.cpp 2009-10-11 16:07:45 UTC (rev 394)
@@ -89,7 +89,8 @@
|| (!pfh.npatterns) || (pfh.npatterns > 128)
|| (SIZEOF_PTMFILEHEADER+pfh.nsamples*SIZEOF_PTMSAMPLE >= (int)dwMemLength)) return false;
memcpy(m_szNames[0], pfh.songname, 28);
- m_szNames[0][28] = 0;
+ SpaceToNullStringFixed(m_szNames[0], 28);
+
m_nType = MOD_TYPE_PTM;
m_nChannels = pfh.nchannels;
m_nSamples = (pfh.nsamples < MAX_SAMPLES) ? pfh.nsamples : MAX_SAMPLES-1;
@@ -109,7 +110,9 @@
lstrcpyn(m_szNames[ismp+1], psmp->samplename, 28);
memcpy(pSmp->filename, psmp->filename, 12);
- pSmp->filename[12] = 0;
+ SpaceToNullStringFixed(m_szNames[ismp + 1], 28);
+ SpaceToNullStringFixed(pSmp->filename, 12);
+
pSmp->nGlobalVol = 64;
pSmp->nPan = 128;
pSmp->nVolume = psmp->volume << 2;
Modified: trunk/OpenMPT/soundlib/Load_s3m.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Load_s3m.cpp 2009-10-10 00:03:35 UTC (rev 393)
+++ trunk/OpenMPT/soundlib/Load_s3m.cpp 2009-10-11 16:07:45 UTC (rev 394)
@@ -266,6 +266,7 @@
m_nType = MOD_TYPE_S3M;
memset(m_szNames,0,sizeof(m_szNames));
memcpy(m_szNames[0], psfh.name, 28);
+ SpaceToNullStringFixed(m_szNames[0], 28);
// Speed
m_nDefaultSpeed = psfh.speed;
if (!m_nDefaultSpeed) m_nDefaultSpeed = 6;
@@ -335,12 +336,17 @@
{
UINT nInd = ((DWORD)ptr[iSmp-1])*16;
if ((!nInd) || (nInd + 0x50 > dwMemLength)) continue;
+
memcpy(s, lpStream+nInd, 0x50);
memcpy(Samples[iSmp].filename, s+1, 12);
+ SpaceToNullStringFixed(Samples[iSmp].filename, 12);
+
insflags[iSmp-1] = s[0x1F];
inspack[iSmp-1] = s[0x1E];
s[0x4C] = 0;
lstrcpy(m_szNames[iSmp], (LPCSTR)&s[0x30]);
+ SpaceToNullStringFixed(m_szNames[iSmp], 28);
+
if ((s[0]==1) && (s[0x4E]=='R') && (s[0x4F]=='S'))
{
Samples[iSmp].nLength = CLAMP(LittleEndian(*((LPDWORD)(s + 0x10))), 4, MAX_SAMPLE_LENGTH);
Modified: trunk/OpenMPT/soundlib/Load_stm.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Load_stm.cpp 2009-10-10 00:03:35 UTC (rev 393)
+++ trunk/OpenMPT/soundlib/Load_stm.cpp 2009-10-11 16:07:45 UTC (rev 394)
@@ -70,6 +70,7 @@
|| ((_strnicmp(phdr->trackername, "!SCREAM!", 8))
&& (_strnicmp(phdr->trackername, "BMOD2STM", 8)))) return false;
memcpy(m_szNames[0], phdr->songname, 20);
+ SpaceToNullStringFixed(m_szNames[0], 20);
// Read STM header
m_nType = MOD_TYPE_STM;
m_nSamples = 31;
@@ -97,6 +98,8 @@
STMSAMPLE *pStm = &phdr->sample[nIns]; // STM sample data
memcpy(pIns->filename, pStm->filename, 13);
memcpy(m_szNames[nIns+1], pStm->filename, 12);
+ SpaceToNullStringFixed(pIns->filename, 12);
+ SpaceToNullStringFixed(m_szNames[nIns + 1], 12);
pIns->nC5Speed = LittleEndianW(pStm->c2spd);
pIns->nGlobalVol = 64;
pIns->nVolume = pStm->volume << 2;
Modified: trunk/OpenMPT/soundlib/Load_ult.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Load_ult.cpp 2009-10-10 00:03:35 UTC (rev 393)
+++ trunk/OpenMPT/soundlib/Load_ult.cpp 2009-10-11 16:07:45 UTC (rev 394)
@@ -61,6 +61,7 @@
m_nDefaultSpeed = 6;
m_nDefaultTempo = 125;
memcpy(m_szNames[0], pmh->songtitle, 31);
+ SpaceToNullStringFixed(m_szNames[0], 31);
// read songtext
dwMemPos = sizeof(ULTHEADER);
if ((pmh->reserved) && (dwMemPos + pmh->reserved * 32 < dwMemLength))
@@ -91,6 +92,8 @@
MODSAMPLE *pSmp = &Samples[ins];
memcpy(m_szNames[ins], pus->samplename, 31);
memcpy(pSmp->filename, pus->dosname, 12);
+ SpaceToNullStringFixed(m_szNames[ins], 31);
+ SpaceToNullStringFixed(pSmp->filename, 12);
pSmp->nLoopStart = pus->loopstart;
pSmp->nLoopEnd = pus->loopend;
pSmp->nLength = pus->sizeend - pus->sizestart;
Modified: trunk/OpenMPT/soundlib/Load_xm.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Load_xm.cpp 2009-10-10 00:03:35 UTC (rev 393)
+++ trunk/OpenMPT/soundlib/Load_xm.cpp 2009-10-11 16:07:45 UTC (rev 394)
@@ -257,6 +257,7 @@
// look for null-terminated song name - that's most likely a tune made with modplug
for(int i = 0; i < 20; i++)
if(lpStream[17 + i] == 0) bProbablyMadeWithModPlug = true;
+ SpaceToNullStringFixed(m_szNames[0], 20);
// load and convert header
memcpy(&xmheader, lpStream + 58, sizeof(XMFILEHEADER));
@@ -323,6 +324,7 @@
Instruments[iIns]->nPluginVolumeHandling = PLUGIN_VOLUMEHANDLING_IGNORE;
memcpy(Instruments[iIns]->name, pih->name, 22);
+ SpaceToNullStringFixed(Instruments[iIns]->name, 22);
if ((nsamples = pih->samples) > 0)
{
@@ -524,7 +526,7 @@
if (!xmss.looplen) xmss.type &= ~3;
UINT imapsmp = samplemap[ins];
memcpy(m_szNames[imapsmp], xmss.name, 22);
- m_szNames[imapsmp][22] = 0;
+ SpaceToNullStringFixed(m_szNames[imapsmp], 22);
MODSAMPLE *pSmp = &Samples[imapsmp];
pSmp->nLength = (xmss.samplen > MAX_SAMPLE_LENGTH) ? MAX_SAMPLE_LENGTH : xmss.samplen;
pSmp->nLoopStart = xmss.loopstart;
@@ -553,7 +555,7 @@
pSmp->nVibDepth = xmsh.vibdepth;
pSmp->nVibRate = xmsh.vibrate;
memcpy(pSmp->filename, xmss.name, 22);
- pSmp->filename[21] = 0;
+ SpaceToNullStringFixed(pSmp->filename, 21);
}
#if 0
if ((xmsh.reserved2 > nsamples) && (xmsh.reserved2 <= 16))
Modified: trunk/OpenMPT/soundlib/Sndfile.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Sndfile.cpp 2009-10-10 00:03:35 UTC (rev 393)
+++ trunk/OpenMPT/soundlib/Sndfile.cpp 2009-10-11 16:07:45 UTC (rev 394)
@@ -30,7 +30,7 @@
#define UNRAR_SUPPORT
#define UNLHA_SUPPORT
#define ZIPPED_MOD_SUPPORT
-LPCSTR glpszModExtensions = "mod|s3m|xm|it|stm|nst|ult|669|wow|mtm|med|far|mdl|ams|dsm|amf|okt|dmf|ptm|psm|mt2|umx|gdm"
+LPCSTR glpszModExtensions = "mod|s3m|xm|it|stm|nst|ult|669|wow|mtm|med|far|mdl|ams|dsm|amf|okt|dmf|ptm|psm|mt2|umx|gdm|imf|j2b"
#ifndef NO_UNMO3_SUPPORT
"|mo3"
#endif
Modified: trunk/OpenMPT/soundlib/load_j2b.cpp
===================================================================
--- trunk/OpenMPT/soundlib/load_j2b.cpp 2009-10-10 00:03:35 UTC (rev 393)
+++ trunk/OpenMPT/soundlib/load_j2b.cpp 2009-10-11 16:07:45 UTC (rev 394)
@@ -238,6 +238,7 @@
bool bIsAM; // false: AMFF, true: AM
+ ASSERT_CAN_READ(4);
if(LittleEndian(*(DWORD *)(lpStream + dwMemPos)) == 0x46464D41) bIsAM = false; // "AMFF"
else if(LittleEndian(*(DWORD *)(lpStream + dwMemPos)) == 0x20204D41) bIsAM = true; // "AM "
else return false;
@@ -266,7 +267,7 @@
ASSERT_CAN_READ_CHUNK(mainchunk->channels);
memcpy(m_szNames[0], mainchunk->songname, 32);
- SetNullTerminator(m_szNames[0]);
+ SpaceToNullStringFixed(m_szNames[0], 31);
m_dwSongFlags = SONG_ITOLDEFFECTS | SONG_ITCOMPATMODE;
if(!(mainchunk->flags & 0x01)) m_dwSongFlags |= SONG_LINEARSLIDES;
if(mainchunk->channels < 1) return false;
@@ -277,30 +278,25 @@
m_nSamplePreAmp = m_nVSTiVolume = 48;
m_nType = MOD_TYPE_IT;
+ // It seems like there's no way to differentiate between
+ // Muted and Surround channels (they're all 0xA0) - might
+ // be a limitation in mod2j2b.
for(CHANNELINDEX nChn = 0; nChn < m_nChannels; nChn++)
{
+ ChnSettings[nChn].nVolume = 64;
+ ChnSettings[nChn].nPan = 128;
if(bIsAM)
{
if(lpStream[dwMemPos + nChn] > 128)
- {
- ChnSettings[nChn].nPan = 128;
- ChnSettings[nChn].nVolume = 0;
- } else
- {
+ ChnSettings[nChn].dwFlags = CHN_MUTE;
+ else
ChnSettings[nChn].nPan = lpStream[dwMemPos + nChn] << 1;
- ChnSettings[nChn].nVolume = 64;
- }
} else
{
if(lpStream[dwMemPos + nChn] >= 128)
- {
- ChnSettings[nChn].nPan = 128;
- ChnSettings[nChn].nVolume = 0;
- } else
- {
+ ChnSettings[nChn].dwFlags = CHN_MUTE;
+ else
ChnSettings[nChn].nPan = lpStream[dwMemPos + nChn] << 2;
- ChnSettings[nChn].nVolume = 64;
- }
}
}
dwMemPos += mainchunk->channels;
@@ -330,7 +326,7 @@
m_nSamples = max(m_nSamples, nSmp);
memcpy(m_szNames[nSmp], inschunk->name, 28);
- m_szNames[nSmp][28] = 0;
+ SpaceToNullStringFixed(m_szNames[nSmp], 28);
ASSERT_CAN_READ_CHUNK(sizeof(AMFFCHUNK_SAMPLE));
AMFFCHUNK_SAMPLE *smpchunk = (AMFFCHUNK_SAMPLE *)(lpStream + dwMemPos);
@@ -339,7 +335,7 @@
if(smpchunk->signature != 0x504D4153) break; // SAMP
memcpy(m_szNames[nSmp], smpchunk->name, 28);
- m_szNames[nSmp][28] = 0;
+ SpaceToNullStringFixed(m_szNames[nSmp], 28);
Samples[nSmp].nPan = smpchunk->pan << 2;
Samples[nSmp].nVolume = smpchunk->volume << 2;
@@ -389,7 +385,7 @@
m_nSamples = max(m_nSamples, nSmp);
memcpy(m_szNames[nSmp], instheadchunk->name, 32);
- m_szNames[nSmp][32] = 0;
+ SpaceToNullStringFixed(m_szNames[nSmp], 31);
ASSERT_CAN_READ_CHUNK(sizeof(RIFFCHUNK));
instchunk = (RIFFCHUNK *)(lpStream + dwMemPos);
@@ -407,7 +403,7 @@
if(smpchunk->signature != 0x504D4153) break; // SAMP
memcpy(m_szNames[nSmp], smpchunk->name, 32);
- m_szNames[nSmp][32] = 0;
+ SpaceToNullStringFixed(m_szNames[nSmp], 31);
if(LittleEndianW(smpchunk->pan) > 0x7FFF || LittleEndianW(smpchunk->volume) > 0x7FFF)
break;
@@ -429,7 +425,7 @@
if(LittleEndianW(smpchunk->flags) & 0x20)
Samples[nSmp].uFlags |= CHN_PANNING;
- dwMemPos += LittleEndian(smpchunk->headsize);
+ dwMemPos += LittleEndian(smpchunk->headsize) + 12; // doesn't include the 3 first DWORDs
dwMemPos += ReadSample(&Samples[nSmp], (LittleEndianW(smpchunk->flags) & 0x04) ? RS_PCM16S : RS_PCM8S, (LPCSTR)(lpStream + dwMemPos), dwMemLength - dwMemPos);
}
break;
@@ -471,7 +467,7 @@
// header is valid, now unpack the RIFF AM file using inflate
DWORD destSize = LittleEndian(header->unpacked_length);
Bytef *bOutput = new Bytef[destSize];
- int nRetVal = uncompress(bOutput, &destSize, &lpStream[dwMemPos], LittleEndian(header->unpacked_length));
+ int nRetVal = uncompress(bOutput, &destSize, &lpStream[dwMemPos], LittleEndian(header->packed_length));
bool bResult = false;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sag...@us...> - 2009-10-10 00:03:47
|
Revision: 393
http://modplug.svn.sourceforge.net/modplug/?rev=393&view=rev
Author: saga-games
Date: 2009-10-10 00:03:35 +0000 (Sat, 10 Oct 2009)
Log Message:
-----------
[Imp] Added *.j2b to format filter in the "open" dialog
[Ref] Minor rewriting of the j2b loader
Modified Paths:
--------------
trunk/OpenMPT/mptrack/Mptrack.cpp
trunk/OpenMPT/soundlib/Load_gdm.cpp
trunk/OpenMPT/soundlib/Sndfile.h
trunk/OpenMPT/soundlib/load_j2b.cpp
Modified: trunk/OpenMPT/mptrack/Mptrack.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Mptrack.cpp 2009-10-09 21:12:52 UTC (rev 392)
+++ trunk/OpenMPT/mptrack/Mptrack.cpp 2009-10-10 00:03:35 UTC (rev 393)
@@ -1390,13 +1390,20 @@
OFN_HIDEREADONLY | OFN_ENABLESIZING | OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST | OFN_FORCESHOWHIDDEN | OFN_ALLOWMULTISELECT,
// -> CODE#0023
// -> DESC="IT project files (.itp)"
+ "All Modules|*.mod;*.nst;*.wow;*.s3m;*.stm;*.669;*.mtm;*.xm;*.it;*.itp;*.mptm;*.ult;*.mdz;*.s3z;*.xmz;*.itz;mod.*;*.far;*.mdl;*.okt;*.dmf;*.ptm;*.mdr;*.med;*.ams;*.dbm;*.dsm;*.mid;*.rmi;*.smf;*.umx;*.amf;*.psm;*.mt2;*.gdm;*.imf;*.j2b"
#ifndef NO_MO3_SUPPORT
- "All Modules|*.mod;*.nst;*.wow;*.s3m;*.stm;*.669;*.mtm;*.xm;*.it;*.itp;*.mptm;*.ult;*.mdz;*.s3z;*.xmz;*.itz;mod.*;*.far;*.mdl;*.okt;*.dmf;*.ptm;*.mdr;*.med;*.ams;*.dbm;*.dsm;*.mid;*.rmi;*.smf;*.umx;*.amf;*.psm;*.mt2;*.gdm;*.imf;*.mo3|"
- "Compressed Modules (*.mdz;*.s3z;*.xmz;*.itz;*.mo3)|*.mdz;*.s3z;*.xmz;*.itz;*.mdr;*.zip;*.rar;*.lha;*.mo3|"
- #else
- "All Modules|*.mod;*.nst;*.wow;*.s3m;*.stm;*.669;*.mtm;*.xm;*.it;*.itp;*.mptm;*.ult;*.mdz;*.s3z;*.xmz;*.itz;mod.*;*.far;*.mdl;*.okt;*.dmf;*.ptm;*.mdr;*.med;*.ams;*.dbm;*.dsm;*.mid;*.rmi;*.smf;*.umx;*.amf;*.psm;*.mt2;*.gdm;*.imf|"
- "Compressed Modules (*.mdz;*.s3z;*.xmz;*.itz)|*.mdz;*.s3z;*.xmz;*.itz;*.mdr;*.zip;*.rar;*.lha|"
+ ";*.mo3"
#endif
+ "|"
+ "Compressed Modules (*.mdz;*.s3z;*.xmz;*.itz"
+ #ifndef NO_MO3_SUPPORT
+ ";*.mo3"
+ #endif
+ ")|*.mdz;*.s3z;*.xmz;*.itz;*.mdr;*.zip;*.rar;*.lha"
+ #ifndef NO_MO3_SUPPORT
+ ";*.mo3"
+ #endif
+ "|"
// -! NEW_FEATURE#0023
"ProTracker Modules (*.mod,*.nst)|*.mod;mod.*;*.mdz;*.nst;*.m15|"
"ScreamTracker Modules (*.s3m,*.stm)|*.s3m;*.stm;*.s3z|"
@@ -1407,7 +1414,7 @@
"Impulse Tracker Projects (*.itp)|*.itp;*.itpz|"
// -! NEW_FEATURE#0023
"OpenMPT Modules (*.mptm)|*.mptm;*.mptmz|"
- "Other Modules (mtm,okt,mdl,669,far,...)|*.mtm;*.669;*.ult;*.wow;*.far;*.mdl;*.okt;*.dmf;*.ptm;*.med;*.ams;*.dbm;*.dsm;*.umx;*.amf;*.psm;*.mt2;*.gdm;*.imf|"
+ "Other Modules (mtm,okt,mdl,669,far,...)|*.mtm;*.669;*.ult;*.wow;*.far;*.mdl;*.okt;*.dmf;*.ptm;*.med;*.ams;*.dbm;*.dsm;*.umx;*.amf;*.psm;*.mt2;*.gdm;*.imf;*.j2b|"
"Wave Files (*.wav)|*.wav|"
"Midi Files (*.mid,*.rmi)|*.mid;*.rmi;*.smf|"
"All Files (*.*)|*.*||",
Modified: trunk/OpenMPT/soundlib/Load_gdm.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Load_gdm.cpp 2009-10-09 21:12:52 UTC (rev 392)
+++ trunk/OpenMPT/soundlib/Load_gdm.cpp 2009-10-10 00:03:35 UTC (rev 393)
@@ -275,7 +275,7 @@
// read patterns
Patterns.ResizeArray(max(MAX_PATTERNS, pHeader->NOP + 1));
- BOOL bS3MCommandSet = (GetBestSaveFormat() & (MOD_TYPE_S3M | MOD_TYPE_IT | MOD_TYPE_MPT));
+ bool bS3MCommandSet = (GetBestSaveFormat() & (MOD_TYPE_S3M | MOD_TYPE_IT | MOD_TYPE_MPT)) != 0 ? true : false;
// we'll start at position iPatternsOffset and decode all patterns
for (PATTERNINDEX iPat = 0; iPat < pHeader->NOP + 1; iPat++)
Modified: trunk/OpenMPT/soundlib/Sndfile.h
===================================================================
--- trunk/OpenMPT/soundlib/Sndfile.h 2009-10-09 21:12:52 UTC (rev 392)
+++ trunk/OpenMPT/soundlib/Sndfile.h 2009-10-10 00:03:35 UTC (rev 393)
@@ -708,7 +708,7 @@
bool ReadMID(LPCBYTE lpStream, DWORD dwMemLength);
void SetupMODPanning(bool bForceSetup = false); // Setup LRRL panning, max channel volume
- bool Convert_RIFF_AM_Pattern(PATTERNINDEX nPat, const LPCBYTE lpStream, DWORD dwMemLength, bool bIsAM);
+ bool Convert_RIFF_AM_Pattern(PATTERNINDEX nPat, const LPCBYTE lpStream, DWORD dwMemLength, bool bIsAM); // used by ReadAM(...) to convert AM(FF) patterns
// Save Functions
#ifndef MODPLUG_NO_FILESAVE
Modified: trunk/OpenMPT/soundlib/load_j2b.cpp
===================================================================
--- trunk/OpenMPT/soundlib/load_j2b.cpp 2009-10-09 21:12:52 UTC (rev 392)
+++ trunk/OpenMPT/soundlib/load_j2b.cpp 2009-10-10 00:03:35 UTC (rev 393)
@@ -1,9 +1,9 @@
/*
- * Purpose: Load RIFF AM and RIFF AMFF modules.
- * Note: J2B is a compressed variant of RIFF AM and RIFF AMFF files used in Jazz Jackrabbit 2
- * Authors: Johannes Schultz
- * Chris Moeller (foo_dumb)
- * Luigi Elettrico (J2B To IT Convertor Class)
+ * Purpose: Load RIFF AM and RIFF AMFF modules (Galaxy Sound System).
+ * Note: J2B is a compressed variant of RIFF AM and RIFF AMFF files used in Jazz Jackrabbit 2.
+ * It seems like no other game used the AM(FF) format.
+ * Authors: Johannes Schultz (OpenMPT port)
+ * Chris Moeller (foo_dumb - this is almost a complete port of his code, thanks)
*
*/
@@ -17,12 +17,12 @@
// header for compressed j2b files
struct J2BHEADER
{
- DWORD signature; // MUSE
- DWORD deadbeaf; // 0xDEADBEAF or 0xDEADBABE
- DWORD j2blength;
- DWORD crc32;
- DWORD packed_length;
- DWORD unpacked_length;
+ DWORD signature; // MUSE
+ DWORD deadbeaf; // 0xDEADBEAF (AM) or 0xDEADBABE (AMFF)
+ DWORD j2blength; // complete filesize
+ DWORD crc32; // checksum of the compressed data block
+ DWORD packed_length; // length of the compressed data block
+ DWORD unpacked_length; // length of the decompressed module
};
// am(ff) stuff
@@ -97,7 +97,7 @@
bool CSoundFile::Convert_RIFF_AM_Pattern(PATTERNINDEX nPat, const LPCBYTE lpStream, DWORD dwMemLength, bool bIsAM)
//----------------------------------------------------------------------------------------------------------------
{
- // version 0 = AMFF, else = AM
+ // version false = AMFF, true = AM
#define ASSERT_CAN_READ(x) \
if( dwMemPos > dwMemLength || x > dwMemLength - dwMemPos ) return false;
@@ -252,7 +252,6 @@
ASSERT_CAN_READ(LittleEndian(chunkheader->chunksize));
DWORD dwChunkEnd = dwMemPos + LittleEndian(chunkheader->chunksize);
- if(bIsAM && (LittleEndian(chunkheader->chunksize) & 1)) dwChunkEnd++;
switch(LittleEndian(chunkheader->signature))
{
@@ -437,6 +436,8 @@
}
dwMemPos = dwChunkEnd;
+ // RIFF AM has a padding byte
+ if(bIsAM && (LittleEndian(chunkheader->chunksize) & 1)) dwMemPos++;
}
return true;
@@ -468,36 +469,16 @@
dwMemPos += sizeof(J2BHEADER);
// header is valid, now unpack the RIFF AM file using inflate
- z_stream strm;
- strm.zalloc = Z_NULL;
- strm.zfree = Z_NULL;
- strm.opaque = Z_NULL;
- strm.avail_in = 0;
- strm.next_in = Z_NULL;
- if(inflateInit(&strm) != Z_OK)
- return false;
+ DWORD destSize = LittleEndian(header->unpacked_length);
+ Bytef *bOutput = new Bytef[destSize];
+ int nRetVal = uncompress(bOutput, &destSize, &lpStream[dwMemPos], LittleEndian(header->unpacked_length));
- Bytef* bOutput = new Bytef[LittleEndian(header->unpacked_length) + 1];
-
- strm.avail_in = dwMemLength - dwMemPos;
- strm.next_in = (Bytef *)(lpStream + dwMemPos);
- strm.avail_out = LittleEndian(header->unpacked_length);
- strm.next_out = bOutput;
-
- int nRetVal = inflate(&strm, Z_NO_FLUSH);
- (void)inflateEnd(&strm);
-
- if(strm.avail_in != 0 || nRetVal == Z_STREAM_ERROR || nRetVal == Z_NEED_DICT || nRetVal == Z_DATA_ERROR || nRetVal == Z_MEM_ERROR || nRetVal != Z_STREAM_END)
- {
- return false;
- }
-
bool bResult = false;
- if(strm.total_out == LittleEndian(header->unpacked_length))
+ if(destSize == LittleEndian(header->unpacked_length) && nRetVal == Z_OK)
{
// Success, now load the RIFF AM(FF) module.
- bResult = ReadAM(bOutput, strm.total_out);
+ bResult = ReadAM(bOutput, destSize);
}
delete[] bOutput;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rel...@us...> - 2009-10-09 21:13:05
|
Revision: 392
http://modplug.svn.sourceforge.net/modplug/?rev=392&view=rev
Author: relabsoluness
Date: 2009-10-09 21:12:52 +0000 (Fri, 09 Oct 2009)
Log Message:
-----------
[Fix] Internal: Added zlib project to VC2003 solution and fixed build errors (zlib project(VC9) and VC2003 specific compilation errors).
Modified Paths:
--------------
trunk/OpenMPT/mptrack/CleanupSong.cpp
trunk/OpenMPT/mptrack/MPTRACK.sln
trunk/OpenMPT/mptrack/View_tre.h
trunk/OpenMPT/zlib/contrib/vstudio/vc7/zlibstat.vcproj
trunk/OpenMPT/zlib/contrib/vstudio/vc9/zlibstat.vcproj
Modified: trunk/OpenMPT/mptrack/CleanupSong.cpp
===================================================================
--- trunk/OpenMPT/mptrack/CleanupSong.cpp 2009-10-09 00:00:56 UTC (rev 391)
+++ trunk/OpenMPT/mptrack/CleanupSong.cpp 2009-10-09 21:12:52 UTC (rev 392)
@@ -261,8 +261,9 @@
if (pNMHDR->code == TTN_NEEDTEXTA)
{
- strncpy_s(pTTTA->szText, sizeof(pTTTA->szText), strTipText,
- strTipText.GetLength() + 1);
+ //strncpy_s(pTTTA->szText, sizeof(pTTTA->szText), strTipText,
+ // strTipText.GetLength() + 1);
+ strncpy(pTTTA->szText, strTipText, strTipText.GetLength() + 1);
}
else
{
Modified: trunk/OpenMPT/mptrack/MPTRACK.sln
===================================================================
--- trunk/OpenMPT/mptrack/MPTRACK.sln 2009-10-09 00:00:56 UTC (rev 391)
+++ trunk/OpenMPT/mptrack/MPTRACK.sln 2009-10-09 21:12:52 UTC (rev 392)
@@ -2,6 +2,7 @@
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mptrack", "mptrack.vcproj", "{DB18719C-9177-4632-A9E0-7E72E2E6B05E}"
ProjectSection(ProjectDependencies) = postProject
{1FF4AB04-B22F-4CB8-AA2A-0C5095B5FEE4} = {1FF4AB04-B22F-4CB8-AA2A-0C5095B5FEE4}
+ {3F7D3110-B3DD-4DE1-B608-C3F491009625} = {3F7D3110-B3DD-4DE1-B608-C3F491009625}
{71531076-78C7-488D-8FD6-9D841F20AADE} = {71531076-78C7-488D-8FD6-9D841F20AADE}
{CF3C2CA5-5D45-4635-BBA4-C1F435E10896} = {CF3C2CA5-5D45-4635-BBA4-C1F435E10896}
{3C7281B0-D0E2-48ED-AE4D-A181FC77D8F7} = {3C7281B0-D0E2-48ED-AE4D-A181FC77D8F7}
@@ -23,14 +24,20 @@
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "soundtouch", "..\soundtouch\soundtouch.vcproj", "{CF3C2CA5-5D45-4635-BBA4-C1F435E10896}"
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SoundTouch", "..\soundtouch\soundtouch.vcproj", "{CF3C2CA5-5D45-4635-BBA4-C1F435E10896}"
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zlibstat", "..\zlib\contrib\vstudio\vc7\zlibstat.vcproj", "{3F7D3110-B3DD-4DE1-B608-C3F491009625}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
Global
GlobalSection(SolutionConfiguration) = preSolution
Debug = Debug
Release = Release
+ ReleaseAxp = ReleaseAxp
+ ReleaseWithoutAsm = ReleaseWithoutAsm
EndGlobalSection
GlobalSection(ProjectDependencies) = postSolution
EndGlobalSection
@@ -39,26 +46,58 @@
{DB18719C-9177-4632-A9E0-7E72E2E6B05E}.Debug.Build.0 = Debug|Win32
{DB18719C-9177-4632-A9E0-7E72E2E6B05E}.Release.ActiveCfg = Release|Win32
{DB18719C-9177-4632-A9E0-7E72E2E6B05E}.Release.Build.0 = Release|Win32
+ {DB18719C-9177-4632-A9E0-7E72E2E6B05E}.ReleaseAxp.ActiveCfg = Release|Win32
+ {DB18719C-9177-4632-A9E0-7E72E2E6B05E}.ReleaseAxp.Build.0 = Release|Win32
+ {DB18719C-9177-4632-A9E0-7E72E2E6B05E}.ReleaseWithoutAsm.ActiveCfg = Release|Win32
+ {DB18719C-9177-4632-A9E0-7E72E2E6B05E}.ReleaseWithoutAsm.Build.0 = Release|Win32
{71531076-78C7-488D-8FD6-9D841F20AADE}.Debug.ActiveCfg = Debug|Win32
{71531076-78C7-488D-8FD6-9D841F20AADE}.Debug.Build.0 = Debug|Win32
{71531076-78C7-488D-8FD6-9D841F20AADE}.Release.ActiveCfg = Release|Win32
{71531076-78C7-488D-8FD6-9D841F20AADE}.Release.Build.0 = Release|Win32
+ {71531076-78C7-488D-8FD6-9D841F20AADE}.ReleaseAxp.ActiveCfg = Release|Win32
+ {71531076-78C7-488D-8FD6-9D841F20AADE}.ReleaseAxp.Build.0 = Release|Win32
+ {71531076-78C7-488D-8FD6-9D841F20AADE}.ReleaseWithoutAsm.ActiveCfg = Release|Win32
+ {71531076-78C7-488D-8FD6-9D841F20AADE}.ReleaseWithoutAsm.Build.0 = Release|Win32
{3C7281B0-D0E2-48ED-AE4D-A181FC77D8F7}.Debug.ActiveCfg = Debug|Win32
{3C7281B0-D0E2-48ED-AE4D-A181FC77D8F7}.Debug.Build.0 = Debug|Win32
{3C7281B0-D0E2-48ED-AE4D-A181FC77D8F7}.Release.ActiveCfg = Release|Win32
{3C7281B0-D0E2-48ED-AE4D-A181FC77D8F7}.Release.Build.0 = Release|Win32
+ {3C7281B0-D0E2-48ED-AE4D-A181FC77D8F7}.ReleaseAxp.ActiveCfg = Release|Win32
+ {3C7281B0-D0E2-48ED-AE4D-A181FC77D8F7}.ReleaseAxp.Build.0 = Release|Win32
+ {3C7281B0-D0E2-48ED-AE4D-A181FC77D8F7}.ReleaseWithoutAsm.ActiveCfg = Release|Win32
+ {3C7281B0-D0E2-48ED-AE4D-A181FC77D8F7}.ReleaseWithoutAsm.Build.0 = Release|Win32
{1FF4AB04-B22F-4CB8-AA2A-0C5095B5FEE4}.Debug.ActiveCfg = Debug|Win32
{1FF4AB04-B22F-4CB8-AA2A-0C5095B5FEE4}.Debug.Build.0 = Debug|Win32
{1FF4AB04-B22F-4CB8-AA2A-0C5095B5FEE4}.Release.ActiveCfg = Release|Win32
{1FF4AB04-B22F-4CB8-AA2A-0C5095B5FEE4}.Release.Build.0 = Release|Win32
+ {1FF4AB04-B22F-4CB8-AA2A-0C5095B5FEE4}.ReleaseAxp.ActiveCfg = Release|Win32
+ {1FF4AB04-B22F-4CB8-AA2A-0C5095B5FEE4}.ReleaseAxp.Build.0 = Release|Win32
+ {1FF4AB04-B22F-4CB8-AA2A-0C5095B5FEE4}.ReleaseWithoutAsm.ActiveCfg = Release|Win32
+ {1FF4AB04-B22F-4CB8-AA2A-0C5095B5FEE4}.ReleaseWithoutAsm.Build.0 = Release|Win32
{DCC2BB2F-6778-4FD3-9C00-D6CD8DC917B8}.Debug.ActiveCfg = Debug|Win32
{DCC2BB2F-6778-4FD3-9C00-D6CD8DC917B8}.Debug.Build.0 = Debug|Win32
{DCC2BB2F-6778-4FD3-9C00-D6CD8DC917B8}.Release.ActiveCfg = Release|Win32
{DCC2BB2F-6778-4FD3-9C00-D6CD8DC917B8}.Release.Build.0 = Release|Win32
+ {DCC2BB2F-6778-4FD3-9C00-D6CD8DC917B8}.ReleaseAxp.ActiveCfg = Release|Win32
+ {DCC2BB2F-6778-4FD3-9C00-D6CD8DC917B8}.ReleaseAxp.Build.0 = Release|Win32
+ {DCC2BB2F-6778-4FD3-9C00-D6CD8DC917B8}.ReleaseWithoutAsm.ActiveCfg = Release|Win32
+ {DCC2BB2F-6778-4FD3-9C00-D6CD8DC917B8}.ReleaseWithoutAsm.Build.0 = Release|Win32
{CF3C2CA5-5D45-4635-BBA4-C1F435E10896}.Debug.ActiveCfg = Debug|Win32
{CF3C2CA5-5D45-4635-BBA4-C1F435E10896}.Debug.Build.0 = Debug|Win32
{CF3C2CA5-5D45-4635-BBA4-C1F435E10896}.Release.ActiveCfg = Release|Win32
{CF3C2CA5-5D45-4635-BBA4-C1F435E10896}.Release.Build.0 = Release|Win32
+ {CF3C2CA5-5D45-4635-BBA4-C1F435E10896}.ReleaseAxp.ActiveCfg = Release|Win32
+ {CF3C2CA5-5D45-4635-BBA4-C1F435E10896}.ReleaseAxp.Build.0 = Release|Win32
+ {CF3C2CA5-5D45-4635-BBA4-C1F435E10896}.ReleaseWithoutAsm.ActiveCfg = Release|Win32
+ {CF3C2CA5-5D45-4635-BBA4-C1F435E10896}.ReleaseWithoutAsm.Build.0 = Release|Win32
+ {3F7D3110-B3DD-4DE1-B608-C3F491009625}.Debug.ActiveCfg = Debug|Win32
+ {3F7D3110-B3DD-4DE1-B608-C3F491009625}.Debug.Build.0 = Debug|Win32
+ {3F7D3110-B3DD-4DE1-B608-C3F491009625}.Release.ActiveCfg = Release|Win32
+ {3F7D3110-B3DD-4DE1-B608-C3F491009625}.Release.Build.0 = Release|Win32
+ {3F7D3110-B3DD-4DE1-B608-C3F491009625}.ReleaseAxp.ActiveCfg = ReleaseAxp|Win32
+ {3F7D3110-B3DD-4DE1-B608-C3F491009625}.ReleaseAxp.Build.0 = ReleaseAxp|Win32
+ {3F7D3110-B3DD-4DE1-B608-C3F491009625}.ReleaseWithoutAsm.ActiveCfg = ReleaseWithoutAsm|Win32
+ {3F7D3110-B3DD-4DE1-B608-C3F491009625}.ReleaseWithoutAsm.Build.0 = ReleaseWithoutAsm|Win32
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
EndGlobalSection
Modified: trunk/OpenMPT/mptrack/View_tre.h
===================================================================
--- trunk/OpenMPT/mptrack/View_tre.h 2009-10-09 00:00:56 UTC (rev 391)
+++ trunk/OpenMPT/mptrack/View_tre.h 2009-10-09 21:12:52 UTC (rev 392)
@@ -53,7 +53,7 @@
vector<HTREEITEM> tiPatterns;
HTREEITEM tiSamples[MAX_SAMPLES];
HTREEITEM tiInstruments[MAX_INSTRUMENTS];
- vector<vector<HTREEITEM>> tiOrders;
+ vector<vector<HTREEITEM> > tiOrders;
vector<HTREEITEM> tiSequences;
HTREEITEM tiEffects[MAX_MIXPLUGINS];
Modified: trunk/OpenMPT/zlib/contrib/vstudio/vc7/zlibstat.vcproj
===================================================================
--- trunk/OpenMPT/zlib/contrib/vstudio/vc7/zlibstat.vcproj 2009-10-09 00:00:56 UTC (rev 391)
+++ trunk/OpenMPT/zlib/contrib/vstudio/vc7/zlibstat.vcproj 2009-10-09 21:12:52 UTC (rev 392)
@@ -1,8 +1,9 @@
-<?xml version="1.0" encoding = "Windows-1252"?>
+<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
- Version="7.00"
+ Version="7.10"
Name="zlibstat"
+ ProjectGUID="{3F7D3110-B3DD-4DE1-B608-C3F491009625}"
SccProjectName=""
SccLocalPath="">
<Platforms>
@@ -23,7 +24,7 @@
AdditionalIncludeDirectories="..\..\..;..\..\masmx86"
PreprocessorDefinitions="WIN32;ZLIB_WINAPI"
ExceptionHandling="FALSE"
- RuntimeLibrary="5"
+ RuntimeLibrary="1"
PrecompiledHeaderFile=".\zlibstatDebug/zlibstat.pch"
AssemblerListingLocation=".\zlibstatDebug/"
ObjectFile=".\zlibstatDebug/"
@@ -51,6 +52,12 @@
Culture="1036"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="ReleaseAxp|Win32"
@@ -93,6 +100,12 @@
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Release|Win32"
@@ -108,7 +121,7 @@
PreprocessorDefinitions="WIN32;ZLIB_WINAPI;ASMV;ASMINF"
StringPooling="TRUE"
ExceptionHandling="FALSE"
- RuntimeLibrary="4"
+ RuntimeLibrary="0"
EnableFunctionLevelLinking="TRUE"
PrecompiledHeaderFile=".\zlibstat/zlibstat.pch"
AssemblerListingLocation=".\zlibstat/"
@@ -136,6 +149,12 @@
Culture="1036"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="ReleaseWithoutAsm|Win32"
@@ -179,8 +198,16 @@
Culture="1036"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
</Configurations>
+ <References>
+ </References>
<Files>
<Filter
Name="Source Files"
Modified: trunk/OpenMPT/zlib/contrib/vstudio/vc9/zlibstat.vcproj
===================================================================
--- trunk/OpenMPT/zlib/contrib/vstudio/vc9/zlibstat.vcproj 2009-10-09 00:00:56 UTC (rev 391)
+++ trunk/OpenMPT/zlib/contrib/vstudio/vc9/zlibstat.vcproj 2009-10-09 21:12:52 UTC (rev 392)
@@ -26,7 +26,7 @@
OutputDirectory="x86\ZlibStat$(ConfigurationName)"
IntermediateDirectory="x86\ZlibStat$(ConfigurationName)\Tmp"
ConfigurationType="4"
- InheritedPropertySheets="C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\VCProjectDefaults\UpgradeFromVC70.vsprops"
+ InheritedPropertySheets="UpgradeFromVC70.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
>
@@ -99,7 +99,7 @@
OutputDirectory="x86\ZlibStat$(ConfigurationName)"
IntermediateDirectory="x86\ZlibStat$(ConfigurationName)\Tmp"
ConfigurationType="4"
- InheritedPropertySheets="C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\VCProjectDefaults\UpgradeFromVC70.vsprops"
+ InheritedPropertySheets="UpgradeFromVC70.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
>
@@ -173,7 +173,7 @@
OutputDirectory="x86\ZlibStat$(ConfigurationName)"
IntermediateDirectory="x86\ZlibStat$(ConfigurationName)\Tmp"
ConfigurationType="4"
- InheritedPropertySheets="C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\VCProjectDefaults\UpgradeFromVC70.vsprops"
+ InheritedPropertySheets="UpgradeFromVC70.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sag...@us...> - 2009-10-09 00:01:11
|
Revision: 391
http://modplug.svn.sourceforge.net/modplug/?rev=391&view=rev
Author: saga-games
Date: 2009-10-09 00:00:56 +0000 (Fri, 09 Oct 2009)
Log Message:
-----------
[Fix] IT Compatibility: Out of range offset command with Old FX on
[New] Can now import RIFF AM and RIFF AMFF files, as well as J2B files, which are compressed AM(FF) files. Added zlib 1.2.3 for J2B support.
ATTENTION: The "zlibstat" project from from zlib/contrib/vstudio/ still has to be added to mptrack.sln (for VS7/8)!
Modified Paths:
--------------
trunk/OpenMPT/mptrack/MPTRACK_08.sln
trunk/OpenMPT/mptrack/Modedit.cpp
trunk/OpenMPT/mptrack/mptrack.vcproj
trunk/OpenMPT/mptrack/mptrack_08.vcproj
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/load_j2b.cpp
Added Paths:
-----------
trunk/OpenMPT/zlib/
trunk/OpenMPT/zlib/ChangeLog
trunk/OpenMPT/zlib/FAQ
trunk/OpenMPT/zlib/INDEX
trunk/OpenMPT/zlib/Makefile
trunk/OpenMPT/zlib/Makefile.in
trunk/OpenMPT/zlib/README
trunk/OpenMPT/zlib/adler32.c
trunk/OpenMPT/zlib/compress.c
trunk/OpenMPT/zlib/configure
trunk/OpenMPT/zlib/contrib/
trunk/OpenMPT/zlib/contrib/README.contrib
trunk/OpenMPT/zlib/contrib/masmx64/
trunk/OpenMPT/zlib/contrib/masmx64/bld_ml64.bat
trunk/OpenMPT/zlib/contrib/masmx64/gvmat64.asm
trunk/OpenMPT/zlib/contrib/masmx64/gvmat64.obj
trunk/OpenMPT/zlib/contrib/masmx64/inffas8664.c
trunk/OpenMPT/zlib/contrib/masmx64/inffasx64.asm
trunk/OpenMPT/zlib/contrib/masmx64/inffasx64.obj
trunk/OpenMPT/zlib/contrib/masmx64/readme.txt
trunk/OpenMPT/zlib/contrib/masmx86/
trunk/OpenMPT/zlib/contrib/masmx86/bld_ml32.bat
trunk/OpenMPT/zlib/contrib/masmx86/gvmat32.asm
trunk/OpenMPT/zlib/contrib/masmx86/gvmat32.obj
trunk/OpenMPT/zlib/contrib/masmx86/gvmat32c.c
trunk/OpenMPT/zlib/contrib/masmx86/inffas32.asm
trunk/OpenMPT/zlib/contrib/masmx86/inffas32.obj
trunk/OpenMPT/zlib/contrib/masmx86/mkasm.bat
trunk/OpenMPT/zlib/contrib/masmx86/readme.txt
trunk/OpenMPT/zlib/contrib/minizip/
trunk/OpenMPT/zlib/contrib/minizip/ChangeLogUnzip
trunk/OpenMPT/zlib/contrib/minizip/Makefile
trunk/OpenMPT/zlib/contrib/minizip/crypt.h
trunk/OpenMPT/zlib/contrib/minizip/ioapi.c
trunk/OpenMPT/zlib/contrib/minizip/ioapi.h
trunk/OpenMPT/zlib/contrib/minizip/iowin32.c
trunk/OpenMPT/zlib/contrib/minizip/iowin32.h
trunk/OpenMPT/zlib/contrib/minizip/miniunz.c
trunk/OpenMPT/zlib/contrib/minizip/minizip.c
trunk/OpenMPT/zlib/contrib/minizip/mztools.c
trunk/OpenMPT/zlib/contrib/minizip/mztools.h
trunk/OpenMPT/zlib/contrib/minizip/unzip.c
trunk/OpenMPT/zlib/contrib/minizip/unzip.h
trunk/OpenMPT/zlib/contrib/minizip/zip.c
trunk/OpenMPT/zlib/contrib/minizip/zip.h
trunk/OpenMPT/zlib/contrib/vstudio/
trunk/OpenMPT/zlib/contrib/vstudio/readme.txt
trunk/OpenMPT/zlib/contrib/vstudio/vc7/
trunk/OpenMPT/zlib/contrib/vstudio/vc7/miniunz.vcproj
trunk/OpenMPT/zlib/contrib/vstudio/vc7/minizip.vcproj
trunk/OpenMPT/zlib/contrib/vstudio/vc7/testzlib.vcproj
trunk/OpenMPT/zlib/contrib/vstudio/vc7/zlib.rc
trunk/OpenMPT/zlib/contrib/vstudio/vc7/zlibstat.vcproj
trunk/OpenMPT/zlib/contrib/vstudio/vc7/zlibvc.def
trunk/OpenMPT/zlib/contrib/vstudio/vc7/zlibvc.sln
trunk/OpenMPT/zlib/contrib/vstudio/vc7/zlibvc.vcproj
trunk/OpenMPT/zlib/contrib/vstudio/vc8/
trunk/OpenMPT/zlib/contrib/vstudio/vc8/miniunz.vcproj
trunk/OpenMPT/zlib/contrib/vstudio/vc8/minizip.vcproj
trunk/OpenMPT/zlib/contrib/vstudio/vc8/testzlib.vcproj
trunk/OpenMPT/zlib/contrib/vstudio/vc8/testzlibdll.vcproj
trunk/OpenMPT/zlib/contrib/vstudio/vc8/zlib.rc
trunk/OpenMPT/zlib/contrib/vstudio/vc8/zlibstat.vcproj
trunk/OpenMPT/zlib/contrib/vstudio/vc8/zlibvc.def
trunk/OpenMPT/zlib/contrib/vstudio/vc8/zlibvc.sln
trunk/OpenMPT/zlib/contrib/vstudio/vc8/zlibvc.vcproj
trunk/OpenMPT/zlib/contrib/vstudio/vc9/
trunk/OpenMPT/zlib/contrib/vstudio/vc9/miniunz.vcproj
trunk/OpenMPT/zlib/contrib/vstudio/vc9/minizip.vcproj
trunk/OpenMPT/zlib/contrib/vstudio/vc9/testzlib.vcproj
trunk/OpenMPT/zlib/contrib/vstudio/vc9/testzlibdll.vcproj
trunk/OpenMPT/zlib/contrib/vstudio/vc9/zlib.rc
trunk/OpenMPT/zlib/contrib/vstudio/vc9/zlibstat.vcproj
trunk/OpenMPT/zlib/contrib/vstudio/vc9/zlibvc.def
trunk/OpenMPT/zlib/contrib/vstudio/vc9/zlibvc.sln
trunk/OpenMPT/zlib/contrib/vstudio/vc9/zlibvc.vcproj
trunk/OpenMPT/zlib/crc32.c
trunk/OpenMPT/zlib/crc32.h
trunk/OpenMPT/zlib/deflate.c
trunk/OpenMPT/zlib/deflate.h
trunk/OpenMPT/zlib/example.c
trunk/OpenMPT/zlib/gzio.c
trunk/OpenMPT/zlib/infback.c
trunk/OpenMPT/zlib/inffast.c
trunk/OpenMPT/zlib/inffast.h
trunk/OpenMPT/zlib/inffixed.h
trunk/OpenMPT/zlib/inflate.c
trunk/OpenMPT/zlib/inflate.h
trunk/OpenMPT/zlib/inftrees.c
trunk/OpenMPT/zlib/inftrees.h
trunk/OpenMPT/zlib/minigzip.c
trunk/OpenMPT/zlib/trees.c
trunk/OpenMPT/zlib/trees.h
trunk/OpenMPT/zlib/uncompr.c
trunk/OpenMPT/zlib/zconf.h
trunk/OpenMPT/zlib/zconf.in.h
trunk/OpenMPT/zlib/zlib.3
trunk/OpenMPT/zlib/zlib.h
trunk/OpenMPT/zlib/zutil.c
trunk/OpenMPT/zlib/zutil.h
Modified: trunk/OpenMPT/mptrack/MPTRACK_08.sln
===================================================================
--- trunk/OpenMPT/mptrack/MPTRACK_08.sln 2009-10-07 17:12:37 UTC (rev 390)
+++ trunk/OpenMPT/mptrack/MPTRACK_08.sln 2009-10-09 00:00:56 UTC (rev 391)
@@ -1,9 +1,10 @@
Microsoft Visual Studio Solution File, Format Version 10.00
-# Visual C++ Express 2008
+# Visual Studio 2008
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mptrack", "mptrack_08.vcproj", "{21D95071-FB97-4E69-B3B1-050D0D4A5021}"
ProjectSection(ProjectDependencies) = postProject
{44316F22-904E-48AA-B841-5A3A6AC77319} = {44316F22-904E-48AA-B841-5A3A6AC77319}
{FAE39936-1DC7-40BB-AD3F-3B5B9E9AB0E8} = {FAE39936-1DC7-40BB-AD3F-3B5B9E9AB0E8}
+ {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8} = {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}
{CF3C2CA5-5D45-4635-BBA4-C1F435E10896} = {CF3C2CA5-5D45-4635-BBA4-C1F435E10896}
{FF541CE2-DAA1-4F84-9883-0A0F111BAA0B} = {FF541CE2-DAA1-4F84-9883-0A0F111BAA0B}
EndProjectSection
@@ -18,36 +19,57 @@
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SoundTouch", "..\soundtouch\soundtouch_08.vcproj", "{CF3C2CA5-5D45-4635-BBA4-C1F435E10896}"
EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zlibstat", "..\zlib\contrib\vstudio\vc9\zlibstat.vcproj", "{745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
+ ReleaseWithoutAsm|Win32 = ReleaseWithoutAsm|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{21D95071-FB97-4E69-B3B1-050D0D4A5021}.Debug|Win32.ActiveCfg = Debug|Win32
{21D95071-FB97-4E69-B3B1-050D0D4A5021}.Debug|Win32.Build.0 = Debug|Win32
{21D95071-FB97-4E69-B3B1-050D0D4A5021}.Release|Win32.ActiveCfg = Release|Win32
{21D95071-FB97-4E69-B3B1-050D0D4A5021}.Release|Win32.Build.0 = Release|Win32
+ {21D95071-FB97-4E69-B3B1-050D0D4A5021}.ReleaseWithoutAsm|Win32.ActiveCfg = Release|Win32
+ {21D95071-FB97-4E69-B3B1-050D0D4A5021}.ReleaseWithoutAsm|Win32.Build.0 = Release|Win32
{FAE39936-1DC7-40BB-AD3F-3B5B9E9AB0E8}.Debug|Win32.ActiveCfg = Debug|Win32
{FAE39936-1DC7-40BB-AD3F-3B5B9E9AB0E8}.Debug|Win32.Build.0 = Debug|Win32
{FAE39936-1DC7-40BB-AD3F-3B5B9E9AB0E8}.Release|Win32.ActiveCfg = Release|Win32
{FAE39936-1DC7-40BB-AD3F-3B5B9E9AB0E8}.Release|Win32.Build.0 = Release|Win32
+ {FAE39936-1DC7-40BB-AD3F-3B5B9E9AB0E8}.ReleaseWithoutAsm|Win32.ActiveCfg = Release|Win32
+ {FAE39936-1DC7-40BB-AD3F-3B5B9E9AB0E8}.ReleaseWithoutAsm|Win32.Build.0 = Release|Win32
{FF541CE2-DAA1-4F84-9883-0A0F111BAA0B}.Debug|Win32.ActiveCfg = Debug|Win32
{FF541CE2-DAA1-4F84-9883-0A0F111BAA0B}.Debug|Win32.Build.0 = Debug|Win32
{FF541CE2-DAA1-4F84-9883-0A0F111BAA0B}.Release|Win32.ActiveCfg = Release|Win32
{FF541CE2-DAA1-4F84-9883-0A0F111BAA0B}.Release|Win32.Build.0 = Release|Win32
+ {FF541CE2-DAA1-4F84-9883-0A0F111BAA0B}.ReleaseWithoutAsm|Win32.ActiveCfg = Release|Win32
+ {FF541CE2-DAA1-4F84-9883-0A0F111BAA0B}.ReleaseWithoutAsm|Win32.Build.0 = Release|Win32
{44316F22-904E-48AA-B841-5A3A6AC77319}.Debug|Win32.ActiveCfg = Debug|Win32
{44316F22-904E-48AA-B841-5A3A6AC77319}.Debug|Win32.Build.0 = Debug|Win32
{44316F22-904E-48AA-B841-5A3A6AC77319}.Release|Win32.ActiveCfg = Release|Win32
{44316F22-904E-48AA-B841-5A3A6AC77319}.Release|Win32.Build.0 = Release|Win32
+ {44316F22-904E-48AA-B841-5A3A6AC77319}.ReleaseWithoutAsm|Win32.ActiveCfg = Release|Win32
+ {44316F22-904E-48AA-B841-5A3A6AC77319}.ReleaseWithoutAsm|Win32.Build.0 = Release|Win32
{DCC2BB2F-6778-4FD3-9C00-D6CD8DC917B8}.Debug|Win32.ActiveCfg = Debug|Win32
{DCC2BB2F-6778-4FD3-9C00-D6CD8DC917B8}.Debug|Win32.Build.0 = Debug|Win32
{DCC2BB2F-6778-4FD3-9C00-D6CD8DC917B8}.Release|Win32.ActiveCfg = Release|Win32
{DCC2BB2F-6778-4FD3-9C00-D6CD8DC917B8}.Release|Win32.Build.0 = Release|Win32
+ {DCC2BB2F-6778-4FD3-9C00-D6CD8DC917B8}.ReleaseWithoutAsm|Win32.ActiveCfg = Release|Win32
+ {DCC2BB2F-6778-4FD3-9C00-D6CD8DC917B8}.ReleaseWithoutAsm|Win32.Build.0 = Release|Win32
{CF3C2CA5-5D45-4635-BBA4-C1F435E10896}.Debug|Win32.ActiveCfg = Debug|Win32
{CF3C2CA5-5D45-4635-BBA4-C1F435E10896}.Debug|Win32.Build.0 = Debug|Win32
{CF3C2CA5-5D45-4635-BBA4-C1F435E10896}.Release|Win32.ActiveCfg = Release|Win32
{CF3C2CA5-5D45-4635-BBA4-C1F435E10896}.Release|Win32.Build.0 = Release|Win32
+ {CF3C2CA5-5D45-4635-BBA4-C1F435E10896}.ReleaseWithoutAsm|Win32.ActiveCfg = Release|Win32
+ {CF3C2CA5-5D45-4635-BBA4-C1F435E10896}.ReleaseWithoutAsm|Win32.Build.0 = Release|Win32
+ {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Debug|Win32.ActiveCfg = Debug|Win32
+ {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Debug|Win32.Build.0 = Debug|Win32
+ {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Release|Win32.ActiveCfg = Release|Win32
+ {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Release|Win32.Build.0 = Release|Win32
+ {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.ReleaseWithoutAsm|Win32.ActiveCfg = ReleaseWithoutAsm|Win32
+ {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.ReleaseWithoutAsm|Win32.Build.0 = ReleaseWithoutAsm|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Modified: trunk/OpenMPT/mptrack/Modedit.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Modedit.cpp 2009-10-07 17:12:37 UTC (rev 390)
+++ trunk/OpenMPT/mptrack/Modedit.cpp 2009-10-09 00:00:56 UTC (rev 391)
@@ -215,20 +215,7 @@
switch(m->command)
{
case CMD_MODCMDEX:
- m->command = CMD_S3MCMDEX;
- switch(m->param & 0xF0)
- {
- case 0x10: m->command = CMD_PORTAMENTOUP; m->param |= 0xF0; break;
- case 0x20: m->command = CMD_PORTAMENTODOWN; m->param |= 0xF0; break;
- case 0x30: m->param = (m->param & 0x0F) | 0x10; break;
- case 0x40: m->param = (m->param & 0x0F) | 0x30; break;
- case 0x50: m->param = (m->param & 0x0F) | 0x20; break;
- case 0x60: m->param = (m->param & 0x0F) | 0xB0; break;
- case 0x70: m->param = (m->param & 0x0F) | 0x40; break;
- case 0x90: m->command = CMD_RETRIG; m->param = 0x80 | (m->param & 0x0F); break;
- case 0xA0: if (m->param & 0x0F) { m->command = CMD_VOLUMESLIDE; m->param = (m->param << 4) | 0x0F; } else m->command = 0; break;
- case 0xB0: if (m->param & 0x0F) { m->command = CMD_VOLUMESLIDE; m->param |= 0xF0; } else m->command = 0; break;
- }
+ CSoundFile::MODExx2S3MSxx(m);
break;
case CMD_VOLUME:
if (!m->volcmd)
@@ -301,20 +288,7 @@
cEffectMemory[nChannel][CMD_ARPEGGIO] = m->param;
break;
case CMD_S3MCMDEX:
- m->command = CMD_MODCMDEX;
- switch(m->param & 0xF0)
- {
- case 0x10: m->param = (m->param & 0x0F) | 0x30; break;
- case 0x20: m->param = (m->param & 0x0F) | 0x50; break;
- case 0x30: m->param = (m->param & 0x0F) | 0x40; break;
- case 0x40: m->param = (m->param & 0x0F) | 0x70; break;
- case 0x50:
- case 0x60:
- case 0x70:
- case 0x90:
- case 0xA0: m->command = CMD_XFINEPORTAUPDOWN; break;
- case 0xB0: m->param = (m->param & 0x0F) | 0x60; break;
- }
+ CSoundFile::S3MSxx2MODExx(m);
break;
case CMD_VOLUMESLIDE:
if ((m->param & 0xF0) && ((m->param & 0x0F) == 0x0F))
Modified: trunk/OpenMPT/mptrack/mptrack.vcproj
===================================================================
--- trunk/OpenMPT/mptrack/mptrack.vcproj 2009-10-07 17:12:37 UTC (rev 390)
+++ trunk/OpenMPT/mptrack/mptrack.vcproj 2009-10-09 00:00:56 UTC (rev 391)
@@ -289,6 +289,9 @@
RelativePath="..\soundlib\Load_it.cpp">
</File>
<File
+ RelativePath="..\soundlib\load_j2b.cpp">
+ </File>
+ <File
RelativePath="..\soundlib\Load_mdl.cpp">
</File>
<File
Modified: trunk/OpenMPT/mptrack/mptrack_08.vcproj
===================================================================
--- trunk/OpenMPT/mptrack/mptrack_08.vcproj 2009-10-07 17:12:37 UTC (rev 390)
+++ trunk/OpenMPT/mptrack/mptrack_08.vcproj 2009-10-09 00:00:56 UTC (rev 391)
@@ -389,6 +389,10 @@
>
</File>
<File
+ RelativePath="..\soundlib\load_j2b.cpp"
+ >
+ </File>
+ <File
RelativePath="..\soundlib\Load_mdl.cpp"
>
</File>
Modified: trunk/OpenMPT/soundlib/Snd_defs.h
===================================================================
--- trunk/OpenMPT/soundlib/Snd_defs.h 2009-10-07 17:12:37 UTC (rev 390)
+++ trunk/OpenMPT/soundlib/Snd_defs.h 2009-10-09 00:00:56 UTC (rev 391)
@@ -256,10 +256,10 @@
// Module flags
#define SONG_EMBEDMIDICFG 0x0001
-#define SONG_FASTVOLSLIDES 0x0002
-#define SONG_ITOLDEFFECTS 0x0004
-#define SONG_ITCOMPATMODE 0x0008
-#define SONG_LINEARSLIDES 0x0010
+#define SONG_FASTVOLSLIDES 0x0002 // Old Scream Tracker 3.0 volume slides
+#define SONG_ITOLDEFFECTS 0x0004 // Old Impulse Tracker effect implementations
+#define SONG_ITCOMPATMODE 0x0008 // IT "Compatible Gxx"
+#define SONG_LINEARSLIDES 0x0010 // Linear slides vs. Amiga slides
#define SONG_PATTERNLOOP 0x0020
#define SONG_STEP 0x0040
#define SONG_PAUSED 0x0080
Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Snd_fx.cpp 2009-10-07 17:12:37 UTC (rev 390)
+++ trunk/OpenMPT/soundlib/Snd_fx.cpp 2009-10-09 00:00:56 UTC (rev 391)
@@ -3051,8 +3051,12 @@
// Offset beyond sample size
if (!(m_nType & (MOD_TYPE_XM|MOD_TYPE_MT2)))
{
+ // IT Compatibility: Offset
if(IsCompatibleMode(TRK_IMPULSETRACKER))
- pChn->nPos = 0; // IT Compatibility: Reset to beginning of sample
+ if(m_dwSongFlags & SONG_ITOLDEFFECTS)
+ pChn->nPos = pChn->nLength; // Old FX: Clip to end of sample
+ else
+ pChn->nPos = 0; // Reset to beginning of sample
else
pChn->nPos = pChn->nLoopStart;
if ((m_dwSongFlags & SONG_ITOLDEFFECTS) && (pChn->nLength > 4))
Modified: trunk/OpenMPT/soundlib/Sndfile.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Sndfile.cpp 2009-10-07 17:12:37 UTC (rev 390)
+++ trunk/OpenMPT/soundlib/Sndfile.cpp 2009-10-09 00:00:56 UTC (rev 391)
@@ -593,6 +593,8 @@
#endif // MODPLUG_BASIC_SUPPORT
&& (!ReadGDM(lpStream, dwMemLength))
&& (!ReadIMF(lpStream, dwMemLength))
+ && (!ReadAM(lpStream, dwMemLength))
+ && (!ReadJ2B(lpStream, dwMemLength))
&& (!ReadMO3(lpStream, dwMemLength))
&& (!ReadMod(lpStream, dwMemLength))) m_nType = MOD_TYPE_NONE;
#ifdef ZIPPED_MOD_SUPPORT
@@ -3193,6 +3195,7 @@
return false;
}
+
void CSoundFile::SetupMODPanning(bool bForceSetup)
//------------------------------------------------
{
@@ -3208,3 +3211,47 @@
ChnSettings[nChn].nPan = (((nChn & 3) == 1) || ((nChn & 3) == 2)) ? 0xC0 : 0x40;
}
}
+
+// Convert an Exx command (MOD) to Sxx command (S3M)
+void CSoundFile::MODExx2S3MSxx(MODCOMMAND *m)
+//-------------------------------------------
+{
+ if(m->command != CMD_MODCMDEX) return;
+ m->command = CMD_S3MCMDEX;
+ switch(m->param & 0xF0)
+ {
+ case 0x10: m->command = CMD_PORTAMENTOUP; m->param |= 0xF0; break;
+ case 0x20: m->command = CMD_PORTAMENTODOWN; m->param |= 0xF0; break;
+ case 0x30: m->param = (m->param & 0x0F) | 0x10; break;
+ case 0x40: m->param = (m->param & 0x0F) | 0x30; break;
+ case 0x50: m->param = (m->param & 0x0F) | 0x20; break;
+ case 0x60: m->param = (m->param & 0x0F) | 0xB0; break;
+ case 0x70: m->param = (m->param & 0x0F) | 0x40; break;
+ case 0x90: m->command = CMD_RETRIG; m->param = 0x80 | (m->param & 0x0F); break;
+ case 0xA0: if (m->param & 0x0F) { m->command = CMD_VOLUMESLIDE; m->param = (m->param << 4) | 0x0F; } else m->command = 0; break;
+ case 0xB0: if (m->param & 0x0F) { m->command = CMD_VOLUMESLIDE; m->param |= 0xF0; } else m->command = 0; break;
+ // rest are the same
+ }
+}
+
+// Convert an Sxx command (S3M) to Exx command (MOD)
+void CSoundFile::S3MSxx2MODExx(MODCOMMAND *m)
+//-------------------------------------------
+{
+ if(m->command != CMD_S3MCMDEX) return;
+ m->command = CMD_MODCMDEX;
+ switch(m->param & 0xF0)
+ {
+ case 0x10: m->param = (m->param & 0x0F) | 0x30; break;
+ case 0x20: m->param = (m->param & 0x0F) | 0x50; break;
+ case 0x30: m->param = (m->param & 0x0F) | 0x40; break;
+ case 0x40: m->param = (m->param & 0x0F) | 0x70; break;
+ case 0x50:
+ case 0x60:
+ case 0x70:
+ case 0x90:
+ case 0xA0: m->command = CMD_XFINEPORTAUPDOWN; break;
+ case 0xB0: m->param = (m->param & 0x0F) | 0x60; break;
+ // rest are the same
+ }
+}
\ No newline at end of file
Modified: trunk/OpenMPT/soundlib/Sndfile.h
===================================================================
--- trunk/OpenMPT/soundlib/Sndfile.h 2009-10-07 17:12:37 UTC (rev 390)
+++ trunk/OpenMPT/soundlib/Sndfile.h 2009-10-09 00:00:56 UTC (rev 391)
@@ -699,14 +699,16 @@
bool ReadMT2(LPCBYTE lpStream, DWORD dwMemLength);
bool ReadPSM(LPCBYTE lpStream, DWORD dwMemLength);
bool ReadPSM16(LPCBYTE lpStream, DWORD dwMemLength);
- bool ReadJ2B(LPCBYTE lpStream, DWORD dwMemLength);
bool ReadUMX(LPCBYTE lpStream, DWORD dwMemLength);
bool ReadMO3(LPCBYTE lpStream, const DWORD dwMemLength);
bool ReadGDM(const LPCBYTE lpStream, const DWORD dwMemLength);
bool ReadIMF(const LPCBYTE lpStream, const DWORD dwMemLength);
+ bool ReadAM(const LPCBYTE lpStream, const DWORD dwMemLength);
+ bool ReadJ2B(const LPCBYTE lpStream, const DWORD dwMemLength);
bool ReadMID(LPCBYTE lpStream, DWORD dwMemLength);
void SetupMODPanning(bool bForceSetup = false); // Setup LRRL panning, max channel volume
+ bool Convert_RIFF_AM_Pattern(PATTERNINDEX nPat, const LPCBYTE lpStream, DWORD dwMemLength, bool bIsAM);
// Save Functions
#ifndef MODPLUG_NO_FILESAVE
@@ -737,6 +739,9 @@
void S3MSaveConvert(UINT *pcmd, UINT *pprm, BOOL bIT, BOOL bCompatibilityExport = false) const;
WORD ModSaveCommand(const MODCOMMAND *m, const bool bXM, const bool bCompatibilityExport = false) const;
+ static void MODExx2S3MSxx(MODCOMMAND *m);
+ static void S3MSxx2MODExx(MODCOMMAND *m);
+
public:
// Real-time sound functions
VOID SuspendPlugins(); //rewbs.VSTCompliance
Modified: trunk/OpenMPT/soundlib/load_j2b.cpp
===================================================================
--- trunk/OpenMPT/soundlib/load_j2b.cpp 2009-10-07 17:12:37 UTC (rev 390)
+++ trunk/OpenMPT/soundlib/load_j2b.cpp 2009-10-09 00:00:56 UTC (rev 391)
@@ -1,15 +1,507 @@
/*
- * This source code is public domain.
+ * Purpose: Load RIFF AM and RIFF AMFF modules.
+ * Note: J2B is a compressed variant of RIFF AM and RIFF AMFF files used in Jazz Jackrabbit 2
+ * Authors: Johannes Schultz
+ * Chris Moeller (foo_dumb)
+ * Luigi Elettrico (J2B To IT Convertor Class)
*
- * Authors: Olivier Lapicque <oli...@jp...>
-*/
+ */
-
-///////////////////////////////////////////////////
-//
-// J2B module loader
-//
-///////////////////////////////////////////////////
#include "stdafx.h"
#include "sndfile.h"
+#define ZLIB_WINAPI
+#include "../zlib/zlib.h"
+#pragma pack(1)
+
+// header for compressed j2b files
+struct J2BHEADER
+{
+ DWORD signature; // MUSE
+ DWORD deadbeaf; // 0xDEADBEAF or 0xDEADBABE
+ DWORD j2blength;
+ DWORD crc32;
+ DWORD packed_length;
+ DWORD unpacked_length;
+};
+
+// am(ff) stuff
+
+struct RIFFCHUNK
+{
+ DWORD signature; // "RIFF"
+ DWORD chunksize; // chunk size without header
+};
+
+// this header is used for both AM's "INIT" as well as AMFF's "MAIN" chunk
+struct AMFFCHUNK_MAIN
+{
+ char songname[64];
+ BYTE flags;
+ BYTE channels;
+ BYTE speed;
+ BYTE tempo;
+ DWORD unknown;
+ BYTE globalvolume;
+};
+
+struct AMFFCHUNK_INSTRUMENT
+{
+ BYTE unknown; // 0x00
+ BYTE sample; // sample number
+ char name[28];
+ char stuff[195]; // lots of NULs?
+};
+
+struct AMFFCHUNK_SAMPLE
+{
+ DWORD signature; // "SAMP"
+ DWORD chunksize; // header + sample size
+ char name[28];
+ BYTE pan;
+ BYTE volume;
+ WORD flags;
+ DWORD length;
+ DWORD loopstart;
+ DWORD loopend;
+ DWORD samplerate;
+ DWORD reserved1;
+ DWORD reserved2;
+};
+
+struct AMCHUNK_INSTRUMENT
+{
+ BYTE unknown; // 0x00
+ BYTE sample; // sample number
+ char name[32];
+};
+
+struct AMCHUNK_SAMPLE
+{
+ DWORD signature; // "SAMP"
+ DWORD chunksize; // header + sample size
+ DWORD headsize; // header size
+ char name[32];
+ WORD pan;
+ WORD volume;
+ WORD flags;
+ WORD unkown;
+ DWORD length;
+ DWORD loopstart;
+ DWORD loopend;
+ DWORD samplerate;
+};
+
+#pragma pack()
+
+bool CSoundFile::Convert_RIFF_AM_Pattern(PATTERNINDEX nPat, const LPCBYTE lpStream, DWORD dwMemLength, bool bIsAM)
+//----------------------------------------------------------------------------------------------------------------
+{
+ // version 0 = AMFF, else = AM
+ #define ASSERT_CAN_READ(x) \
+ if( dwMemPos > dwMemLength || x > dwMemLength - dwMemPos ) return false;
+
+ DWORD dwMemPos = 0;
+
+ ASSERT_CAN_READ(1);
+
+ ROWINDEX nRows = lpStream[0] + 1;
+
+ if(Patterns.Insert(nPat, nRows))
+ return false;
+
+ dwMemPos++;
+
+ MODCOMMAND *mrow = Patterns[nPat];
+ MODCOMMAND *m = mrow;
+ ROWINDEX nRow = 0;
+ BYTE flags;
+
+ while((nRow < nRows) && (dwMemPos < dwMemLength))
+ {
+ ASSERT_CAN_READ(1);
+ flags = lpStream[dwMemPos];
+ dwMemPos++;
+ if (flags == 0)
+ {
+ nRow++;
+ m = mrow = Patterns[nPat] + nRow * m_nChannels;
+ continue;
+ }
+
+ m = mrow + min((flags & 0x1F), m_nChannels - 1);
+
+ if(flags & 0xE0)
+ {
+ if (flags & 0x80) // effect
+ {
+ ASSERT_CAN_READ(2);
+ m->command = lpStream[dwMemPos + 1];
+ m->param = lpStream[dwMemPos];
+ dwMemPos += 2;
+ switch(m->command)
+ {
+ case 0x00: if (m->param) m->command = CMD_ARPEGGIO; break;
+ case 0x01: m->command = CMD_PORTAMENTOUP; break;
+ case 0x02: m->command = CMD_PORTAMENTODOWN; break;
+ case 0x03: m->command = CMD_TONEPORTAMENTO; break;
+ case 0x04: m->command = CMD_VIBRATO; break;
+ case 0x05: m->command = CMD_TONEPORTAVOL; if (m->param & 0xF0) m->param &= 0xF0; break;
+ case 0x06: m->command = CMD_VIBRATOVOL; if (m->param & 0xF0) m->param &= 0xF0; break;
+ case 0x07: m->command = CMD_TREMOLO; break;
+ case 0x08: m->command = CMD_PANNING8;
+ if(m->param <= 0x80) m->param = min(m->param << 1, 0xFF);
+ else if(m->param == 0xA4) {m->command = CMD_S3MCMDEX; m->param = 0x91;}
+ break;
+ case 0x09: m->command = CMD_OFFSET; break;
+ case 0x0A: m->command = CMD_VOLUMESLIDE; if (m->param & 0xF0) m->param &= 0xF0; break;
+ case 0x0B: m->command = CMD_POSITIONJUMP; break;
+ case 0x0C: m->command = CMD_VOLUME; break;
+ case 0x0D: m->command = CMD_PATTERNBREAK; m->param = ((m->param >> 4) * 10) + (m->param & 0x0F); break;
+ case 0x0E: m->command = CMD_MODCMDEX; MODExx2S3MSxx(m); break;
+ case 0x0F: m->command = (m->param <= 0x1F) ? CMD_SPEED : CMD_TEMPO; break;
+ case 'G' - 55: m->command = CMD_GLOBALVOLUME; break;
+ case 'H' - 55: m->command = CMD_GLOBALVOLSLIDE; if (m->param & 0xF0) m->param &= 0xF0; break;
+ case 'K' - 55: m->command = CMD_KEYOFF; break;
+ case 'L' - 55: m->command = CMD_SETENVPOSITION; break;
+ case 'M' - 55: m->command = CMD_CHANNELVOLUME; break;
+ case 'N' - 55: m->command = CMD_CHANNELVOLSLIDE; break;
+ case 'P' - 55: m->command = CMD_PANNINGSLIDE; if (m->param & 0xF0) m->param &= 0xF0; break;
+ case 'R' - 55: m->command = CMD_RETRIG; break;
+ case 'T' - 55: m->command = CMD_TREMOR; break;
+ case 'X' - 55:
+ switch(m->param & 0xF0)
+ {
+ case 0x10: m->command = CMD_PORTAMENTOUP; m->param = (m->param & 0x0F) | 0xE0; break;
+ case 0x20: m->command = CMD_PORTAMENTODOWN; m->param = (m->param & 0x0F) | 0xE0; break;
+ default: m->command = CMD_S3MCMDEX; break;
+ }
+ break;
+ default:
+#ifdef DEBUG
+ {
+ CHAR s[64];
+ wsprintf(s, "J2B: Unknown command: 0x%X, param 0x%X", m->command, m->param);
+ Log(s);
+ }
+#endif
+ m->command = CMD_NONE;
+ break;
+ }
+ }
+
+ if (flags & 0x40) // note + ins
+ {
+ ASSERT_CAN_READ(2);
+ m->instr = lpStream[dwMemPos];
+ m->note = lpStream[dwMemPos + 1];
+ if(m->note > NOTE_MAX) m->note = NOTE_NOTECUT;
+ dwMemPos += 2;
+ }
+
+ if (flags & 0x20) // volume
+ {
+ ASSERT_CAN_READ(1);
+ m->volcmd = VOLCMD_VOLUME;
+ if(!bIsAM)
+ m->vol = lpStream[dwMemPos];
+ else
+ m->vol = lpStream[dwMemPos] * 64 / 127;
+ dwMemPos++;
+ }
+ }
+ }
+
+ return true;
+
+ #undef ASSERT_CAN_READ
+}
+
+bool CSoundFile::ReadAM(const LPCBYTE lpStream, const DWORD dwMemLength)
+//------------------------------------------------------------------------
+{
+ #define ASSERT_CAN_READ(x) \
+ if( dwMemPos > dwMemLength || x > dwMemLength - dwMemPos ) return false;
+ #define ASSERT_CAN_READ_CHUNK(x) \
+ if( dwMemPos > dwChunkEnd || x > dwChunkEnd - dwMemPos ) break;
+
+ DWORD dwMemPos = 0;
+
+ ASSERT_CAN_READ(sizeof(RIFFCHUNK));
+ RIFFCHUNK *chunkheader = (RIFFCHUNK *)lpStream;
+
+ if(LittleEndian(chunkheader->signature) != 0x46464952 // "RIFF"
+ || LittleEndian(chunkheader->chunksize) != dwMemLength - sizeof(RIFFCHUNK)
+ ) return false;
+
+ dwMemPos += sizeof(RIFFCHUNK);
+
+ bool bIsAM; // false: AMFF, true: AM
+
+ if(LittleEndian(*(DWORD *)(lpStream + dwMemPos)) == 0x46464D41) bIsAM = false; // "AMFF"
+ else if(LittleEndian(*(DWORD *)(lpStream + dwMemPos)) == 0x20204D41) bIsAM = true; // "AM "
+ else return false;
+ dwMemPos += 4;
+
+ // go through all chunks now
+ while(dwMemPos < dwMemLength)
+ {
+ ASSERT_CAN_READ(sizeof(RIFFCHUNK));
+ chunkheader = (RIFFCHUNK *)(lpStream + dwMemPos);
+ dwMemPos += sizeof(RIFFCHUNK);
+ ASSERT_CAN_READ(LittleEndian(chunkheader->chunksize));
+
+ DWORD dwChunkEnd = dwMemPos + LittleEndian(chunkheader->chunksize);
+ if(bIsAM && (LittleEndian(chunkheader->chunksize) & 1)) dwChunkEnd++;
+
+ switch(LittleEndian(chunkheader->signature))
+ {
+ case 0x4E49414D: // "MAIN" - Song info (AMFF)
+ case 0x54494E49: // "INIT" - Song info (AM)
+ if((LittleEndian(chunkheader->signature) == 0x4E49414D && !bIsAM) || (LittleEndian(chunkheader->signature) == 0x54494E49 && bIsAM))
+ {
+ ASSERT_CAN_READ_CHUNK(sizeof(AMFFCHUNK_MAIN));
+ AMFFCHUNK_MAIN *mainchunk = (AMFFCHUNK_MAIN *)(lpStream + dwMemPos);
+ dwMemPos += sizeof(AMFFCHUNK_MAIN);
+
+ ASSERT_CAN_READ_CHUNK(mainchunk->channels);
+
+ memcpy(m_szNames[0], mainchunk->songname, 32);
+ SetNullTerminator(m_szNames[0]);
+ m_dwSongFlags = SONG_ITOLDEFFECTS | SONG_ITCOMPATMODE;
+ if(!(mainchunk->flags & 0x01)) m_dwSongFlags |= SONG_LINEARSLIDES;
+ if(mainchunk->channels < 1) return false;
+ m_nChannels = min(mainchunk->channels, MAX_BASECHANNELS);
+ m_nDefaultSpeed = mainchunk->speed;
+ m_nDefaultTempo = mainchunk->tempo;
+ m_nDefaultGlobalVolume = mainchunk->globalvolume << 1;
+ m_nSamplePreAmp = m_nVSTiVolume = 48;
+ m_nType = MOD_TYPE_IT;
+
+ for(CHANNELINDEX nChn = 0; nChn < m_nChannels; nChn++)
+ {
+ if(bIsAM)
+ {
+ if(lpStream[dwMemPos + nChn] > 128)
+ {
+ ChnSettings[nChn].nPan = 128;
+ ChnSettings[nChn].nVolume = 0;
+ } else
+ {
+ ChnSettings[nChn].nPan = lpStream[dwMemPos + nChn] << 1;
+ ChnSettings[nChn].nVolume = 64;
+ }
+ } else
+ {
+ if(lpStream[dwMemPos + nChn] >= 128)
+ {
+ ChnSettings[nChn].nPan = 128;
+ ChnSettings[nChn].nVolume = 0;
+ } else
+ {
+ ChnSettings[nChn].nPan = lpStream[dwMemPos + nChn] << 2;
+ ChnSettings[nChn].nVolume = 64;
+ }
+ }
+ }
+ dwMemPos += mainchunk->channels;
+ }
+ break;
+
+ case 0x5244524F: // "ORDR" - Order list
+ ASSERT_CAN_READ_CHUNK(1);
+ Order.ReadAsByte(&lpStream[dwMemPos + 1], lpStream[dwMemPos] + 1, dwChunkEnd - (dwMemPos + 1));
+ break;
+
+ case 0x54544150: // "PATT" - Pattern data for one pattern
+ ASSERT_CAN_READ_CHUNK(5);
+ Convert_RIFF_AM_Pattern(lpStream[dwMemPos], (LPCBYTE)(lpStream + dwMemPos + 5), LittleEndian(*(DWORD *)(lpStream + dwMemPos + 1)), bIsAM);
+ break;
+
+ case 0x54534E49: // "INST" - Instrument (only in RIFF AMFF)
+ if(!bIsAM)
+ {
+ ASSERT_CAN_READ_CHUNK(sizeof(AMFFCHUNK_INSTRUMENT));
+ AMFFCHUNK_INSTRUMENT *inschunk = (AMFFCHUNK_INSTRUMENT *)(lpStream + dwMemPos);
+ dwMemPos += sizeof(AMFFCHUNK_INSTRUMENT);
+
+ SAMPLEINDEX nSmp = inschunk->sample + 1;
+ if(nSmp > MAX_SAMPLES)
+ break;
+ m_nSamples = max(m_nSamples, nSmp);
+
+ memcpy(m_szNames[nSmp], inschunk->name, 28);
+ m_szNames[nSmp][28] = 0;
+
+ ASSERT_CAN_READ_CHUNK(sizeof(AMFFCHUNK_SAMPLE));
+ AMFFCHUNK_SAMPLE *smpchunk = (AMFFCHUNK_SAMPLE *)(lpStream + dwMemPos);
+ dwMemPos += sizeof(AMFFCHUNK_SAMPLE);
+
+ if(smpchunk->signature != 0x504D4153) break; // SAMP
+
+ memcpy(m_szNames[nSmp], smpchunk->name, 28);
+ m_szNames[nSmp][28] = 0;
+
+ Samples[nSmp].nPan = smpchunk->pan << 2;
+ Samples[nSmp].nVolume = smpchunk->volume << 2;
+ Samples[nSmp].nGlobalVol = 64;
+ Samples[nSmp].nLength = LittleEndian(smpchunk->length);
+ Samples[nSmp].nLoopStart = LittleEndian(smpchunk->loopstart);
+ Samples[nSmp].nLoopEnd = LittleEndian(smpchunk->loopend);
+ Samples[nSmp].nC5Speed = LittleEndian(smpchunk->samplerate);
+
+ if(LittleEndianW(smpchunk->flags) & 0x04)
+ Samples[nSmp].uFlags |= CHN_16BIT;
+ if(LittleEndianW(smpchunk->flags) & 0x08)
+ Samples[nSmp].uFlags |= CHN_LOOP;
+ if(LittleEndianW(smpchunk->flags) & 0x10)
+ Samples[nSmp].uFlags |= CHN_PINGPONGLOOP;
+ if(LittleEndianW(smpchunk->flags) & 0x20)
+ Samples[nSmp].uFlags |= CHN_PANNING;
+
+ dwMemPos += ReadSample(&Samples[nSmp], (LittleEndianW(smpchunk->flags) & 0x04) ? RS_PCM16S : RS_PCM8S, (LPCSTR)(lpStream + dwMemPos), dwMemLength - dwMemPos);
+ }
+ break;
+
+ case 0x46464952: // "RIFF" - Instrument (only in RIFF AM)
+ if(bIsAM)
+ {
+ ASSERT_CAN_READ_CHUNK(4);
+ if(LittleEndian(*(DWORD *)(lpStream + dwMemPos)) != 0x20204941) break; // "AI "
+ dwMemPos += 4;
+
+ ASSERT_CAN_READ_CHUNK(sizeof(RIFFCHUNK));
+ RIFFCHUNK *instchunk = (RIFFCHUNK *)(lpStream + dwMemPos);
+ dwMemPos += sizeof(RIFFCHUNK);
+ ASSERT_CAN_READ_CHUNK(LittleEndian(instchunk->chunksize));
+ if(LittleEndian(instchunk->signature) != 0x54534E49) break; // "INST"
+
+ ASSERT_CAN_READ_CHUNK(4);
+ DWORD dwHeadlen = LittleEndian(*(DWORD *)(lpStream + dwMemPos));
+ dwMemPos +=4 ;
+
+ ASSERT_CAN_READ_CHUNK(sizeof(AMCHUNK_INSTRUMENT));
+ AMCHUNK_INSTRUMENT *instheadchunk = (AMCHUNK_INSTRUMENT *)(lpStream + dwMemPos);
+ dwMemPos += dwHeadlen;
+
+ SAMPLEINDEX nSmp = instheadchunk->sample + 1;
+ if(nSmp > MAX_SAMPLES)
+ break;
+ m_nSamples = max(m_nSamples, nSmp);
+
+ memcpy(m_szNames[nSmp], instheadchunk->name, 32);
+ m_szNames[nSmp][32] = 0;
+
+ ASSERT_CAN_READ_CHUNK(sizeof(RIFFCHUNK));
+ instchunk = (RIFFCHUNK *)(lpStream + dwMemPos);
+ dwMemPos += sizeof(RIFFCHUNK);
+ ASSERT_CAN_READ_CHUNK(LittleEndian(instchunk->chunksize));
+ if(LittleEndian(instchunk->signature) != 0x46464952) break; // yet another "RIFF"...
+
+ ASSERT_CAN_READ_CHUNK(4);
+ if(LittleEndian(*(DWORD *)(lpStream + dwMemPos)) != 0x20205341) break; // "AS " (ain't this boring?)
+ dwMemPos += 4;
+
+ ASSERT_CAN_READ_CHUNK(sizeof(AMCHUNK_SAMPLE));
+ AMCHUNK_SAMPLE *smpchunk = (AMCHUNK_SAMPLE *)(lpStream + dwMemPos);
+
+ if(smpchunk->signature != 0x504D4153) break; // SAMP
+
+ memcpy(m_szNames[nSmp], smpchunk->name, 32);
+ m_szNames[nSmp][32] = 0;
+
+ if(LittleEndianW(smpchunk->pan) > 0x7FFF || LittleEndianW(smpchunk->volume) > 0x7FFF)
+ break;
+
+ Samples[nSmp].nPan = LittleEndianW(smpchunk->pan) * 256 / 32767;
+ Samples[nSmp].nVolume = LittleEndianW(smpchunk->volume) * 256 / 32767;
+ Samples[nSmp].nGlobalVol = 64;
+ Samples[nSmp].nLength = LittleEndian(smpchunk->length);
+ Samples[nSmp].nLoopStart = LittleEndian(smpchunk->loopstart);
+ Samples[nSmp].nLoopEnd = LittleEndian(smpchunk->loopend);
+ Samples[nSmp].nC5Speed = LittleEndian(smpchunk->samplerate);
+
+ if(LittleEndianW(smpchunk->flags) & 0x04)
+ Samples[nSmp].uFlags |= CHN_16BIT;
+ if(LittleEndianW(smpchunk->flags) & 0x08)
+ Samples[nSmp].uFlags |= CHN_LOOP;
+ if(LittleEndianW(smpchunk->flags) & 0x10)
+ Samples[nSmp].uFlags |= CHN_PINGPONGLOOP;
+ if(LittleEndianW(smpchunk->flags) & 0x20)
+ Samples[nSmp].uFlags |= CHN_PANNING;
+
+ dwMemPos += LittleEndian(smpchunk->headsize);
+ dwMemPos += ReadSample(&Samples[nSmp], (LittleEndianW(smpchunk->flags) & 0x04) ? RS_PCM16S : RS_PCM8S, (LPCSTR)(lpStream + dwMemPos), dwMemLength - dwMemPos);
+ }
+ break;
+
+ }
+ dwMemPos = dwChunkEnd;
+ }
+
+ return true;
+
+ #undef ASSERT_CAN_READ
+ #undef ASSERT_CAN_READ_CHUNK
+}
+
+bool CSoundFile::ReadJ2B(const LPCBYTE lpStream, const DWORD dwMemLength)
+//-----------------------------------------------------------------------
+{
+ #define ASSERT_CAN_READ(x) \
+ if( dwMemPos > dwMemLength || x > dwMemLength - dwMemPos ) return false;
+
+ DWORD dwMemPos = 0;
+
+ ASSERT_CAN_READ(sizeof(J2BHEADER));
+ J2BHEADER *header = (J2BHEADER *)lpStream;
+
+ if(LittleEndian(header->signature) != 0x4553554D // "MUSE"
+ || (LittleEndian(header->deadbeaf) != 0xAFBEADDE // 0xDEADBEAF (RIFF AM)
+ && LittleEndian(header->deadbeaf) != 0xBEBAADDE) // 0xDEADBABE (RIFF AMFF)
+ || LittleEndian(header->j2blength) != dwMemLength
+ || LittleEndian(header->packed_length) != dwMemLength - sizeof(J2BHEADER)
+ || LittleEndian(header->packed_length) == 0
+ || LittleEndian(header->crc32) != crc32(0, (lpStream + sizeof(J2BHEADER)), dwMemLength - sizeof(J2BHEADER))
+ ) return false;
+
+ dwMemPos += sizeof(J2BHEADER);
+
+ // header is valid, now unpack the RIFF AM file using inflate
+ z_stream strm;
+ strm.zalloc = Z_NULL;
+ strm.zfree = Z_NULL;
+ strm.opaque = Z_NULL;
+ strm.avail_in = 0;
+ strm.next_in = Z_NULL;
+ if(inflateInit(&strm) != Z_OK)
+ return false;
+
+ Bytef* bOutput = new Bytef[LittleEndian(header->unpacked_length) + 1];
+
+ strm.avail_in = dwMemLength - dwMemPos;
+ strm.next_in = (Bytef *)(lpStream + dwMemPos);
+ strm.avail_out = LittleEndian(header->unpacked_length);
+ strm.next_out = bOutput;
+
+ int nRetVal = inflate(&strm, Z_NO_FLUSH);
+ (void)inflateEnd(&strm);
+
+ if(strm.avail_in != 0 || nRetVal == Z_STREAM_ERROR || nRetVal == Z_NEED_DICT || nRetVal == Z_DATA_ERROR || nRetVal == Z_MEM_ERROR || nRetVal != Z_STREAM_END)
+ {
+ return false;
+ }
+
+ bool bResult = false;
+
+ if(strm.total_out == LittleEndian(header->unpacked_length))
+ {
+ // Success, now load the RIFF AM(FF) module.
+ bResult = ReadAM(bOutput, strm.total_out);
+ }
+ delete[] bOutput;
+
+ return bResult;
+
+ #undef ASSERT_CAN_READ
+}
Added: trunk/OpenMPT/zlib/ChangeLog
===================================================================
--- trunk/OpenMPT/zlib/ChangeLog (rev 0)
+++ trunk/OpenMPT/zlib/ChangeLog 2009-10-09 00:00:56 UTC (rev 391)
@@ -0,0 +1,855 @@
+
+ ChangeLog file for zlib
+
+Changes in 1.2.3 (18 July 2005)
+- Apply security vulnerability fixes to contrib/infback9 as well
+- Clean up some text files (carriage returns, trailing space)
+- Update testzlib, vstudio, masmx64, and masmx86 in contrib [Vollant]
+
+Changes in 1.2.2.4 (11 July 2005)
+- Add inflatePrime() function for starting inflation at bit boundary
+- Avoid some Visual C warnings in deflate.c
+- Avoid more silly Visual C warnings in inflate.c and inftrees.c for 64-bit
+ compile
+- Fix some spelling errors in comments [Betts]
+- Correct inflateInit2() error return documentation in zlib.h
+- Added zran.c example of compressed data random access to examples
+ directory, shows use of inflatePrime()
+- Fix cast for assignments to strm->state in inflate.c and infback.c
+- Fix zlibCompileFlags() in zutil.c to use 1L for long shifts [Oberhumer]
+- Move declarations of gf2 functions to right place in crc32.c [Oberhumer]
+- Add cast in trees.c t avoid a warning [Oberhumer]
+- Avoid some warnings in fitblk.c, gun.c, gzjoin.c in examples [Oberhumer]
+- Update make_vms.com [Zinser]
+- Initialize state->write in inflateReset() since copied in inflate_fast()
+- Be more strict on incomplete code sets in inflate_table() and increase
+ ENOUGH and MAXD -- this repairs a possible security vulnerability for
+ invalid inflate input. Thanks to Tavis Ormandy and Markus Oberhumer for
+ discovering the vulnerability and providing test cases.
+- Add ia64 support to configure for HP-UX [Smith]
+- Add error return to gzread() for format or i/o error [Levin]
+- Use malloc.h for OS/2 [Necasek]
+
+Changes in 1.2.2.3 (27 May 2005)
+- Replace 1U constants in inflate.c and inftrees.c for 64-bit compile
+- Typecast fread() return values in gzio.c [Vollant]
+- Remove trailing space in minigzip.c outmode (VC++ can't deal with it)
+- Fix crc check bug in gzread() after gzungetc() [Heiner]
+- Add the deflateTune() function to adjust internal compression parameters
+- Add a fast gzip decompressor, gun.c, to examples (use of inflateBack)
+- Remove an incorrect assertion in examples/zpipe.c
+- Add C++ wrapper in infback9.h [Donais]
+- Fix bug in inflateCopy() when decoding fixed codes
+- Note in zlib.h how much deflateSetDictionary() actually uses
+- Remove USE_DICT_HEAD in deflate.c (would mess up inflate if used)
+- Add _WIN32_WCE to define WIN32 in zconf.in.h [Spencer]
+- Don't include stderr.h or errno.h for _WIN32_WCE in zutil.h [Spencer]
+- Add gzdirect() function to indicate transparent reads
+- Update contrib/minizip [Vollant]
+- Fix compilation of deflate.c when both ASMV and FASTEST [Oberhumer]
+- Add casts in crc32.c to avoid warnings [Oberhumer]
+- Add contrib/masmx64 [Vollant]
+- Update contrib/asm586, asm686, masmx86, testzlib, vstudio [Vollant]
+
+Changes in 1.2.2.2 (30 December 2004)
+- Replace structure assignments in deflate.c and inflate.c with zmemcpy to
+ avoid implicit memcpy calls (portability for no-library compilation)
+- Increase sprintf() buffer size in gzdopen() to allow for large numbers
+- Add INFLATE_STRICT to check distances against zlib header
+- Improve WinCE errno handling and comments [Chang]
+- Remove comment about no gzip header processing in FAQ
+- Add Z_FIXED strategy option to deflateInit2() to force fixed trees
+- Add updated make_vms.com [Coghlan], update README
+- Create a new "examples" directory, move gzappend.c there, add zpipe.c,
+ fitblk.c, gzlog.[ch], gzjoin.c, and zlib_how.html.
+- Add FAQ entry and comments in deflate.c on uninitialized memory access
+- Add Solaris 9 make options in configure [Gilbert]
+- Allow strerror() usage in gzio.c for STDC
+- Fix DecompressBuf in contrib/delphi/ZLib.pas [ManChesTer]
+- Update contrib/masmx86/inffas32.asm and gvmat32.asm [Vollant]
+- Use z_off_t for adler32_combine() and crc32_combine() lengths
+- Make adler32() much faster for small len
+- Use OS_CODE in deflate() default gzip header
+
+Changes in 1.2.2.1 (31 October 2004)
+- Allow inflateSetDictionary() call for raw inflate
+- Fix inflate header crc check bug for file names and comments
+- Add deflateSetHeader() and gz_header structure for custom gzip headers
+- Add inflateGetheader() to retrieve gzip headers
+- Add crc32_combine() and adler32_combine() functions
+- Add alloc_func, free_func, in_func, out_func to Z_PREFIX list
+- Use zstreamp consistently in zlib.h (inflate_back functions)
+- Remove GUNZIP condition from definition of inflate_mode in inflate.h
+ and in contrib/inflate86/inffast.S [Truta, Anderson]
+- Add support for AMD64 in contrib/inflate86/inffas86.c [Anderson]
+- Update projects/README.projects and projects/visualc6 [Truta]
+- Update win32/DLL_FAQ.txt [Truta]
+- Avoid warning under NO_GZCOMPRESS in gzio.c; fix typo [Truta]
+- Deprecate Z_ASCII; use Z_TEXT instead [Truta]
+- Use a new algorithm for setting strm->data_type in trees.c [Truta]
+- Do not define an exit() prototype in zutil.c unless DEBUG defined
+- Remove prototype of exit() from zutil.c, example.c, minigzip.c [Truta]
+- Add comment in zlib.h for Z_NO_FLUSH parameter to deflate()
+- Fix Darwin build version identification [Peterson]
+
+Changes in 1.2.2 (3 October 2004)
+- Update zlib.h comments on gzip in-memory processing
+- Set adler to 1 in inflateReset() to support Java test suite [Walles]
+- Add contrib/dotzlib [Ravn]
+- Update win32/DLL_FAQ.txt [Truta]
+- Update contrib/minizip [Vollant]
+- Move contrib/visual-basic.txt to old/ [Truta]
+- Fix assembler builds in projects/visualc6/ [Truta]
+
+Changes in 1.2.1.2 (9 September 2004)
+- Update INDEX file
+- Fix trees.c to update strm->data_type (no one ever noticed!)
+- Fix bug in error case in inflate.c, infback.c, and infback9.c [Brown]
+- Add "volatile" to crc table flag declaration (for DYNAMIC_CRC_TABLE)
+- Add limited multitasking protection to DYNAMIC_CRC_TABLE
+- Add NO_vsnprintf for VMS in zutil.h [Mozilla]
+- Don't declare strerror() under VMS [Mozilla]
+- Add comment to DYNAMIC_CRC_TABLE to use get_crc_table() to initialize
+- Update contrib/ada [Anisimkov]
+- Update contrib/minizip [Vollant]
+- Fix configure to not hardcode directories for Darwin [Peterson]
+- Fix gzio.c to not return error on empty files [Brown]
+- Fix indentation; update version in contrib/delphi/ZLib.pas and
+ contrib/pascal/zlibpas.pas [Truta]
+- Update mkasm.bat in contrib/masmx86 [Truta]
+- Update contrib/untgz [Truta]
+- Add projects/README.projects [Truta]
+- Add project for MS Visual C++ 6.0 in projects/visualc6 [Cadieux, Truta]
+- Update win32/DLL_FAQ.txt [Truta]
+- Update list of Z_PREFIX symbols in zconf.h [Randers-Pehrson, Truta]
+- Remove an unnecessary assignment to curr in inftrees.c [Truta]
+- Add OS/2 to exe builds in configure [Poltorak]
+- Remove err dummy parameter in zlib.h [Kientzle]
+
+Changes in 1.2.1.1 (9 January 2004)
+- Update email address in README
+- Several FAQ updates
+- Fix a big fat bug in inftrees.c that prevented decoding valid
+ dynamic blocks with only literals and no distance codes --
+ Thanks to "Hot Emu" for the bug report and sample file
+- Add a note to puff.c on no distance codes case.
+
+Changes in 1.2.1 (17 November 2003)
+- Remove a tab in contrib/gzappend/gzappend.c
+- Update some interfaces in contrib for new zlib functions
+- Update zlib version number in some contrib entries
+- Add Windows CE definition for ptrdiff_t in zutil.h [Mai, Truta]
+- Support shared libraries on Hurd and KFreeBSD [Brown]
+- Fix error in NO_DIVIDE option of adler32.c
+
+Changes in 1.2.0.8 (4 November 2003)
+- Update version in contrib/delphi/ZLib.pas and contrib/pascal/zlibpas.pas
+- Add experimental NO_DIVIDE #define in adler32.c
+ - Possibly faster on some processors (let me know if it is)
+- Correct Z_BLOCK to not return on first inflate call if no wrap
+- Fix strm->data_type on inflate() return to correctly indicate EOB
+- Add deflatePrime() function for appending in the middle of a byte
+- Add contrib/gzappend for an example of appending to a stream
+- Update win32/DLL_FAQ.txt [Truta]
+- Delete Turbo C comment in README [Truta]
+- Improve some indentation in zconf.h [Truta]
+- Fix infinite loop on bad input in configure script [Church]
+- Fix gzeof() for concatenated gzip files [Johnson]
+- Add example to contrib/visual-basic.txt [Michael B.]
+- Add -p to mkdir's in Makefile.in [vda]
+- Fix configure to properly detect presence or lack of printf functions
+- Add AS400 support [Monnerat]
+- Add a little Cygwin support [Wilson]
+
+Changes in 1.2.0.7 (21 September 2003)
+- Correct some debug formats in contrib/infback9
+- Cast a type in a debug statement in trees.c
+- Change search and replace delimiter in configure from % to # [Beebe]
+- Update contrib/untgz to 0.2 with various fixes [Truta]
+- Add build support for Amiga [Nikl]
+- Remove some directories in old that have been updated to 1.2
+- Add dylib building for Mac OS X in configure and Makefile.in
+- Remove old distribution stuff from Makefile
+- Update README to point to DLL_FAQ.txt, and add comment on Mac OS X
+- Update links in README
+
+Changes in 1.2.0.6 (13 September 2003)
+- Minor FAQ updates
+- Update contrib/minizip to 1.00 [Vollant]
+- Remove test of gz functions in example.c when GZ_COMPRESS defined [Truta]
+- Update POSTINC comment for 68060 [Nikl]
+- Add contrib/infback9 with deflate64 decoding (unsupported)
+- For MVS define NO_vsnprintf and undefine FAR [van Burik]
+- Add pragma for fdopen on MVS [van Burik]
+
+Changes in 1.2.0.5 (8 September 2003)
+- Add OF to inflateBackEnd() declaration in zlib.h
+- Remember start when using gzdopen in the middle of a file
+- Use internal off_t counters in gz* functions to properly handle seeks
+- Perform more rigorous check for distance-too-far in inffast.c
+- Add Z_BLOCK flush option to return from inflate at block boundary
+- Set strm->data_type on return from inflate
+ - Indicate bits unused, if at block boundary, and if in last block
+- Replace size_t with ptrdiff_t in crc32.c, and check for correct size
+- Add condition so old NO_DEFLATE define still works for compatibility
+- FAQ update regarding the Windows DLL [Truta]
+- INDEX update: add qnx entry, remove aix entry [Truta]
+- Install zlib.3 into mandir [Wilson]
+- Move contrib/zlib_dll_FAQ.txt to win32/DLL_FAQ.txt; update [Truta]
+- Adapt the zlib interface to the new DLL convention guidelines [Truta]
+- Introduce ZLIB_WINAPI macro to allow the export of functions using
+ the WINAPI calling convention, for Visual Basic [Vollant, Truta]
+- Update msdos and win32 scripts and makefiles [Truta]
+- Export symbols by name, not by ordinal, in win32/zlib.def [Truta]
+- Add contrib/ada [Anisimkov]
+- Move asm files from contrib/vstudio/vc70_32 to contrib/asm386 [Truta]
+- Rename contrib/asm386 to contrib/masmx86 [Truta, Vollant]
+- Add contrib/masm686 [Truta]
+- Fix offsets in contrib/inflate86 and contrib/masmx86/inffas32.asm
+ [Truta, Vollant]
+- Update contrib/delphi; rename to contrib/pascal; add example [Truta]
+- Remove contrib/delphi2; add a new contrib/delphi [Truta]
+- Avoid inclusion of the nonstandard <memory.h> in contrib/iostream,
+ and fix some method prototypes [Truta]
+- Fix the ZCR_SEED2 constant to avoid warnings in contrib/minizip
+ [Truta]
+- Avoid the use of backslash (\) in contrib/minizip [Vollant]
+- Fix file time handling in contrib/untgz; update makefiles [Truta]
+- Update contrib/vstudio/vc70_32 to comply with the new DLL guidelines
+ [Vollant]
+- Remove contrib/vstudio/vc15_16 [Vollant]
+- Rename contrib/vstudio/vc70_32 to contrib/vstudio/vc7 [Truta]
+- Update README.contrib [Truta]
+- Invert the assignment order of match_head and s->prev[...] in
+ INSERT_STRING [Truta]
+- Compare TOO_FAR with 32767 instead of 32768, to avoid 16-bit warnings
+ [Truta]
+- Compare function pointers with 0, not with NULL or Z_NULL [Truta]
+- Fix prototype of syncsearch in inflate.c [Truta]
+- Introduce ASMINF macro to be enabled when using an ASM implementation
+ of inflate_fast [Truta]
+- Change NO_DEFLATE to NO_GZCOMPRESS [Truta]
+- Modify test_gzio in example.c to take a single file name as a
+ parameter [Truta]
+- Exit the example.c program if gzopen fails [Truta]
+- Add type casts around strlen in example.c [Truta]
+- Remove casting to sizeof in minigzip.c; give a proper type
+ to the variable compared with SUFFIX_LEN [Truta]
+- Update definitions of STDC and STDC99 in zconf.h [Truta]
+- Synchronize zconf.h with the new Windows DLL interface [Truta]
+- Use SYS16BIT instead of __32BIT__ to distinguish between
+ 16- and 32-bit platforms [Truta]
+- Use far memory allocators in small 16-bit memory models for
+ Turbo C [Truta]
+- Add info about the use of ASMV, ASMINF and ZLIB_WINAPI in
+ zlibCompileFlags [Truta]
+- Cygwin has vsnprintf [Wilson]
+- In Windows16, OS_CODE is 0, as in MSDOS [Truta]
+- In Cygwin, OS_CODE is 3 (Unix), not 11 (Windows32) [Wilson]
+
+Changes in 1.2.0.4 (10 August 2003)
+- Minor FAQ updates
+- Be more strict when checking inflateInit2's windowBits parameter
+- Change NO_GUNZIP compile option to NO_GZIP to cover deflate as well
+- Add gzip wrapper option to deflateInit2 using windowBits
+- Add updated QNX rule in configure and qnx directory [Bonnefoy]
+- Make inflate distance-too-far checks more rigorous
+- Clean up FAR usage in inflate
+- Add casting to sizeof() in gzio.c and minigzip.c
+
+Changes in 1.2.0.3 (19 July 2003)
+- Fix silly error in gzungetc() implementation [Vollant]
+- Update contrib/minizip and contrib/vstudio [Vollant]
+- Fix printf format in example.c
+- Correct cdecl support in zconf.in.h [Anisimkov]
+- Minor FAQ updates
+
+Changes in 1.2.0.2 (13 July 2003)
+- Add ZLIB_VERNUM in zlib.h for numerical preprocessor comparisons
+- Attempt to avoid warnings in crc32.c for pointer-int conversion
+- Add AIX to configure, remove aix directory [Bakker]
+- Add some casts to minigzip.c
+- Improve checking after insecure sprintf() or vsprintf() calls
+- Remove #elif's from crc32.c
+- Change leave label to inf_leave in inflate.c and infback.c to avoid
+ library conflicts
+- Remove inflate gzip decoding by default--only enable gzip decoding by
+ special request for stricter backward compatibility
+- Add zlibCompileFlags() function to return compilation information
+- More typecasting in deflate.c to avoid warnings
+- Remove leading underscore from _Capital #defines [Truta]
+- Fix configure to link shared library when testing
+- Add some Windows CE target adjustments [Mai]
+- Remove #define ZLIB_DLL in zconf.h [Vollant]
+- Add zlib.3 [Rodgers]
+- Update RFC URL in deflate.c and algorithm.txt [Mai]
+- Add zlib_dll_FAQ.txt to contrib [Truta]
+- Add UL to some constants [Truta]
+- Update minizip and vstudio [Vollant]
+- Remove vestigial NEED_DUMMY_RETURN from zconf.in.h
+- Expand use of NO_DUMMY_DECL to avoid all dummy structures
+- Added iostream3 to contrib [Schwardt]
+- Replace rewind() with fseek() for WinCE [Truta]
+- Improve setting of zlib format compression level flags
+ - Report 0 for huffman and rle strategies and for level == 0 or 1
+ - Report 2 only for level == 6
+- Only deal with 64K limit when necessary at compile time [Truta]
+- Allow TOO_FAR check to be turned off at compile time [Truta]
+- Add gzclearerr() function [Souza]
+- Add gzungetc() function
+
+Changes in 1.2.0.1 (17 March 2003)
+- Add Z_RLE strategy for run-length encoding [Truta]
+ - When Z_RLE requested, restrict matches to distance one
+ - Update zlib.h, minigzip.c, gzopen(), gzdopen() for Z_RLE
+- Correct FASTEST compilation to allow level == 0
+- Clean up what gets compiled for FASTEST
+- Incorporate changes to zconf.in.h [Vollant]
+ - Refine detection of Turbo C need for dummy returns
+ - Refine ZLIB_DLL compilation
+ - Include additional header file on VMS for off_t typedef
+- Try to use _vsnprintf where it supplants vsprintf [Vollant]
+- Add some casts in inffast.c
+- Enchance comments in zlib.h on what happens if gzprintf() tries to
+ write more than 4095 bytes before compression
+- Remove unused state from inflateBackEnd()
+- Remove exit(0) from minigzip.c, example.c
+- Get rid of all those darn tabs
+- Add "check" target to Makefile.in that does the same thing as "test"
+- Add "mostlyclean" and "maintainer-clean" targets to Makefile.in
+- Update contrib/inflate86 [Anderson]
+- Update contrib/testzlib, contrib/vstudio, contrib/minizip [Vollant]
+- Add msdos and win32 directories with makefiles [Truta]
+- More additions and improvements to the FAQ
+
+Changes in 1.2.0 (9 March 2003)
+- New and improved inflate code
+ - About 20% faster
+ - Does not allocate 32K window unless and until needed
+ - Automatically detects and decompresses gzip streams
+ - Raw inflate no longer needs an extra dummy byte at end
+ - Added inflateBack functions using a callback interface--even faster
+ than inflate, useful for file utilities (gzip, zip)
+ - Added inflateCopy() function to record state for random access on
+ externally generated deflate streams (e.g. in gzip files)
+ - More readable code (I hope)
+- New and improved crc32()
+ - About 50% faster, thanks to suggestions from Rodney Brown
+- Add deflateBound() and compressBound() functions
+- Fix memory leak in deflateInit2()
+- Permit setting dictionary for raw deflate (for parallel deflate)
+- Fix const declaration for gzwrite()
+- Check for some malloc() failures in gzio.c
+- Fix bug in gzopen() on single-byte file 0x1f
+- Fix bug in gzread() on concatenated file with 0x1f at end of buffer
+ and next buffer doesn't start with 0x8b
+- Fix uncompress() to return Z_DATA_ERROR on truncated input
+- Free memory at end of example.c
+- Remove MAX #define in trees.c (conflicted with some libraries)
+- Fix static const's in deflate.c, gzio.c, and zutil.[ch]
+- Declare malloc() and free() in gzio.c if STDC not defined
+- Use malloc() instead of calloc() in zutil.c if int big enough
+- Define STDC for AIX
+- Add aix/ with approach for compiling shared library on AIX
+- Add HP-UX support for shared libraries in configure
+- Add OpenUNIX support for shared libraries in configure
+- Use $cc instead of gcc to build shared library
+- Make prefix directory if needed when installing
+- Correct Macintosh avoidance of typedef Byte in zconf.h
+- Correct Turbo C memory allocation when under Linux
+- Use libz.a instead of -lz in Makefile (assure use of compiled library)
+- Update configure to check for snprintf or vsnprintf functions and their
+ return value, warn during make if using an insecure function
+- Fix configure problem with compile-time knowledge of HAVE_UNISTD_H that
+ is lost when library is used--resolution is to build new zconf.h
+- Documentation improvements (in zlib.h):
+ - Document raw deflate and inflate
+ - Update RFCs URL
+ - Point out that zlib and gzip formats are different
+ - Note that Z_BUF_ERROR is not fatal
+ - Document string limit for gzprintf() and possible buffer overflow
+ - Note requirement on avail_out when flushing
+ - Note permitted values of flush parameter of inflate()
+- Add some FAQs (and even answers) to the FAQ
+- Add contrib/inflate86/ for x86 faster inflate
+- Add contrib/blast/ for PKWare Data Compression Library decompression
+- Add contrib/puff/ simple inflate for deflate format description
+
+Changes in 1.1.4 (11 March 2002)
+- ZFREE was repeated on same allocation on some error conditions.
+ This creates a security problem described in
+ http://www.zlib.org/advisory-2002-03-11.txt
+- Returned incorrect error (Z_MEM_ERROR) on some invalid data
+- Avoid accesses before window for invalid distances with inflate window
+ less than 32K.
+- force windowBits > 8 to avoid a bug in the encoder for a window size
+ of 256 bytes. (A complete fix will be available in 1.1.5).
+
+Changes in 1.1.3 (9 July 1998)
+- fix "an inflate input buffer bug that shows up on rare but persistent
+ occasions" (Mark)
+- fix gzread and gztell for concatenated .gz files (Didier Le Botlan)
+- fix gzseek(..., SEEK_SET) in write mode
+- fix crc check after a gzeek (Frank Faubert)
+- fix miniunzip when the last entry in a zip file is itself a zip file
+ (J Lillge)
+- add contrib/asm586 and contrib/asm686 (Brian Raiter)
+ See http://www.muppetlabs.com/~breadbox/software/assembly.html
+- add support for Delphi 3 in contrib/delphi (Bob Dellaca)
+- add support for C++Builder 3 and Delphi 3 in contrib/delphi2 (Davide Moretti)
+- do not exit prematurely in untgz if 0 at start of block (Magnus Holmgren)
+- use macro EXTERN instead of extern to support DLL for BeOS (Sander Stoks)
+- added a FAQ file
+
+- Support gzdopen on Mac with Metrowerks (Jason Linhart)
+- Do not redefine Byte on Mac (Brad Pettit & Jason Linhart)
+- define SEEK_END too if SEEK_SET is not defined (Albert Chin-A-Young)
+- avoid some warnings with Borland C (Tom Tanner)
+- fix a problem in contrib/minizip/zip.c for 16-bit MSDOS (Gilles Vollant)
+- emulate utime() for WIN32 in contrib/untgz (Gilles Vollant)
+- allow several arguments to configure (Tim Mooney, Frodo Looijaard)
+- use libdir and includedir in Makefile.in (Tim Mooney)
+- support shared libraries on OSF1 V4 (Tim Mooney)
+- remove so_locations in "make clean" (Tim Mooney)
+- fix maketree.c compilation error (Glenn, Mark)
+- Python interface to zlib now in Python 1.5 (Jeremy Hylton)
+- new Makefile.riscos (Rich Walker)
+- initialize static descriptors in trees.c for embedded targets (Nick Smith)
+- use "foo-gz" in example.c for RISCOS and VMS (Nick Smith)
+- add the OS/2 files in Makefile.in too (Andrew Zabolotny)
+- fix fdopen and halloc macros for Microsoft C 6.0 (Tom Lane)
+- fix maketree.c to allow clean compilation of inffixed.h (Mark)
+- fix parameter check in deflateCopy (Gunther Nikl)
+- cleanup trees.c, use compressed_len only in debug mode (Christian Spieler)
+- Many portability patches by Christian Spieler:
+ . zutil.c, zutil.h: added "const" for zmem*
+ . Make_vms.com: fixed some typos
+ . Make_vms.com: msdos/Makefile.*: removed zutil.h from some dependency lists
+ . msdos/Makefile.msc: remove "default rtl link library" info from obj files
+ . msdos/Makefile.*: use model-dependent name for the built zlib library
+ . msdos/Makefile.emx, nt/Makefile.emx, nt/Makefile.gcc:
+ new makefiles, for emx (DOS/OS2), emx&rsxnt and mingw32 (Windows 9x / NT)
+- use define instead of typedef for Bytef also for MSC small/medium (Tom Lane)
+- replace __far with _far for better portability (Christian Spieler, Tom Lane)
+- fix test for errno.h in configure (Tim Newsham)
+
+Changes in 1.1.2 (19 March 98)
+- added contrib/minzip, mini zip and unzip based on zlib (Gilles Vollant)
+ See http://www.winimage.com/zLibDll/unzip.html
+- preinitialize the inflate tables for fixed codes, to make the code
+ completely thread safe (Mark)
+- some simplifications and slight speed-up to the inflate code (Mark)
+- fix gzeof on non-compressed files (Allan Schrum)
+- add -std1 option in configure for OSF1 to fix gzprintf (Martin Mokrejs)
+- use default value of 4K for Z_BUFSIZE for 16-bit MSDOS (Tim Wegner + Glenn)
+- added os2/Makefile.def and os2/zlib.def (Andrew Zabolotny)
+- add shared lib support for UNIX_SV4.2MP (MATSUURA Takanori)
+- do not wrap extern "C" around system includes (Tom Lane)
+- mention zlib binding for TCL in README (Andreas Kupries)
+- added amiga/Makefile.pup for Amiga powerUP SAS/C PPC (Andreas Kleinert)
+- allow "make install prefix=..." even after configure (Glenn Randers-Pehrson)
+- allow "configure --prefix $HOME" (Tim Mooney)
+- remove warnings in example.c and gzio.c (Glenn Randers-Pehrson)
+- move Makefile.sas to amiga/Makefile.sas
+
+Changes in 1.1.1 (27 Feb 98)
+- fix macros _tr_tally_* in deflate.h for debug mode (Glenn Randers-Pehrson)
+- remove block truncation heuristic which had very marginal effect for zlib
+ (smaller lit_bufsize than in gzip 1.2.4) and degraded a little the
+ compression ratio on some files. This also allows inlining _tr_tally for
+ matches in deflate_slow.
+- added msdos/Makefile.w32 for WIN32 Microsoft Visual C++ (Bob Frazier)
+
+Changes in 1.1.0 (24 Feb 98)
+- do not return STREAM_END prematurely in inflate (John Bowler)
+- revert to the zlib 1.0.8 inflate to avoid the gcc 2.8.0 bug (Jeremy Buhler)
+- compile with -DFASTEST to get compression code optimized for speed only
+- in minigzip, try mmap'ing the input file first (Miguel Albrecht)
+- increase siz...
[truncated message content] |
|
From: <sag...@us...> - 2009-10-07 17:12:54
|
Revision: 390
http://modplug.svn.sourceforge.net/modplug/?rev=390&view=rev
Author: saga-games
Date: 2009-10-07 17:12:37 +0000 (Wed, 07 Oct 2009)
Log Message:
-----------
[Imp] Treeview: Should behave correctly when number of sequences changed from 1 or to 1.
[Mod] Mod Creation: When clicking on the "new" buton, the newly created module will be of the same type as the currently active document. Should probably be an option.
Modified Paths:
--------------
trunk/OpenMPT/mptrack/Modedit.cpp
trunk/OpenMPT/mptrack/Mptrack.cpp
trunk/OpenMPT/mptrack/View_tre.cpp
trunk/OpenMPT/soundlib/Sndfile.cpp
trunk/OpenMPT/soundlib/Sndfile.h
Modified: trunk/OpenMPT/mptrack/Modedit.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Modedit.cpp 2009-10-06 12:44:31 UTC (rev 389)
+++ trunk/OpenMPT/mptrack/Modedit.cpp 2009-10-07 17:12:37 UTC (rev 390)
@@ -773,6 +773,10 @@
}
}
}
+ if(m_SndFile.Order.GetLengthTailTrimmed() > specs.ordersMax)
+ {
+ AddToLog("WARNING: Order list has been trimmed!");
+ }
m_SndFile.Order.resize(specs.ordersMax);
}
Modified: trunk/OpenMPT/mptrack/Mptrack.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Mptrack.cpp 2009-10-06 12:44:31 UTC (rev 389)
+++ trunk/OpenMPT/mptrack/Mptrack.cpp 2009-10-07 17:12:37 UTC (rev 390)
@@ -1265,7 +1265,46 @@
void CTrackApp::OnFileNew()
//-------------------------
{
- if (m_bInitialized) OnFileNewIT();
+ if (!m_bInitialized) return;
+
+ // Default module type
+ MODTYPE nNewType = MOD_TYPE_IT;
+ bool bIsProject = false;
+
+ // Get active document to make the new module of the same type
+ CModDoc *pModDoc = CMainFrame::GetMainFrame()->GetActiveDoc();
+ if(pModDoc != nullptr)
+ {
+ CSoundFile *pSndFile = pModDoc->GetSoundFile();
+ if(pSndFile != nullptr)
+ {
+ nNewType = pSndFile->GetBestSaveFormat();
+ bIsProject = ((pSndFile->m_dwSongFlags & SONG_ITPROJECT) != 0) ? true: false;
+ }
+ }
+
+ switch(nNewType)
+ {
+ case MOD_TYPE_MOD:
+ OnFileNewMOD();
+ break;
+ case MOD_TYPE_S3M:
+ OnFileNewS3M();
+ break;
+ case MOD_TYPE_XM:
+ OnFileNewXM();
+ break;
+ case MOD_TYPE_IT:
+ if(bIsProject)
+ OnFileNewITProject();
+ else
+ OnFileNewIT();
+ break;
+ case MOD_TYPE_MPT:
+ default:
+ OnFileNewMPT();
+ break;
+ }
}
Modified: trunk/OpenMPT/mptrack/View_tre.cpp
===================================================================
--- trunk/OpenMPT/mptrack/View_tre.cpp 2009-10-06 12:44:31 UTC (rev 389)
+++ trunk/OpenMPT/mptrack/View_tre.cpp 2009-10-07 17:12:37 UTC (rev 390)
@@ -688,6 +688,25 @@
if ((pInfo->hOrders) && (hintFlagPart != HINT_INSNAMES) && (hintFlagPart != HINT_SMPNAMES))
{
const DWORD nPat = (lHint >> HINT_SHIFT_PAT);
+
+ // only one seq remaining: update parent item || previously only one sequence
+ if((pInfo->tiSequences.size() > 1 && pSndFile->Order.GetNumSequences() == 1) || (pInfo->tiSequences.size() == 1 && pSndFile->Order.GetNumSequences() > 1))
+ {
+ if(pInfo->tiOrders.size() != pSndFile->Order.GetNumSequences())
+ {
+ for(size_t nSeq = 0; nSeq < pInfo->tiOrders.size(); nSeq++)
+ {
+ for(size_t nOrd = 0; nOrd < pInfo->tiOrders[nSeq].size(); nOrd++) if (pInfo->tiOrders[nSeq][nOrd])
+ {
+ DeleteItem(pInfo->tiOrders[nSeq][nOrd]); pInfo->tiOrders[nSeq][nOrd] = NULL;
+ }
+ DeleteItem(pInfo->tiSequences[nSeq]); pInfo->tiSequences[nSeq] = NULL;
+ }
+ pInfo->tiOrders.resize(pSndFile->Order.GetNumSequences());
+ pInfo->tiSequences.resize(pSndFile->Order.GetNumSequences(), NULL);
+ }
+ }
+
// If there are too many sequences, delete them.
for(size_t nSeq = pSndFile->Order.GetNumSequences(); nSeq < pInfo->tiSequences.size(); nSeq++) if (pInfo->tiSequences[nSeq])
{
@@ -703,23 +722,6 @@
pInfo->tiOrders.resize(pSndFile->Order.GetNumSequences());
}
- // TODO what to do when seq count changed from 2 to 1 or from 1 to 2?
-
- /* // number of sequences changed: wipe tree first (is this necessary?)
- if(pInfo->tiOrders.size() != pSndFile->Order.GetNumSequences())
- {
- for(size_t nSeq = 0; nSeq < pInfo->tiOrders.size(); nSeq++)
- {
- for(size_t nOrd = 0; nOrd < pInfo->tiOrders[nSeq].size(); nOrd++) if (pInfo->tiOrders[nSeq][nOrd])
- {
- DeleteItem(pInfo->tiOrders[nSeq][nOrd]); pInfo->tiOrders[nSeq][nOrd] = NULL;
- }
- DeleteItem(pInfo->tiSequences[nSeq]); pInfo->tiSequences[nSeq] = NULL;
- }
- pInfo->tiOrders.resize(pSndFile->Order.GetNumSequences());
- pInfo->tiSequences.resize(pSndFile->Order.GetNumSequences(), NULL);
- }*/
-
HTREEITEM hAncestorNode = pInfo->hOrders;
// go through all sequences
Modified: trunk/OpenMPT/soundlib/Sndfile.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Sndfile.cpp 2009-10-06 12:44:31 UTC (rev 389)
+++ trunk/OpenMPT/soundlib/Sndfile.cpp 2009-10-07 17:12:37 UTC (rev 390)
@@ -1359,8 +1359,8 @@
//end rewbs.playSongFromCursor
-UINT CSoundFile::GetBestSaveFormat() const
-//----------------------------------------
+MODTYPE CSoundFile::GetBestSaveFormat() const
+//-------------------------------------------
{
if ((!m_nSamples) || (!m_nChannels)) return MOD_TYPE_NONE;
if (!m_nType) return MOD_TYPE_NONE;
@@ -1376,8 +1376,8 @@
}
-UINT CSoundFile::GetSaveFormats() const
-//-------------------------------------
+MODTYPE CSoundFile::GetSaveFormats() const
+//----------------------------------------
{
UINT n = 0;
if ((!m_nSamples) || (!m_nChannels) || (m_nType == MOD_TYPE_NONE)) return 0;
@@ -2650,7 +2650,7 @@
CHAR szName[MAX_PATTERNNAME] = "";
if (nPat >= Patterns.Size()) return FALSE;
if (lpszName) lstrcpyn(szName, lpszName, MAX_PATTERNNAME);
- szName[MAX_PATTERNNAME-1] = 0;
+ SpaceToNullString(szName); //szName[MAX_PATTERNNAME-1] = 0;
if (!m_lpszPatternNames) m_nPatternNames = 0;
if (nPat >= m_nPatternNames)
{
Modified: trunk/OpenMPT/soundlib/Sndfile.h
===================================================================
--- trunk/OpenMPT/soundlib/Sndfile.h 2009-10-06 12:44:31 UTC (rev 389)
+++ trunk/OpenMPT/soundlib/Sndfile.h 2009-10-07 17:12:37 UTC (rev 390)
@@ -730,8 +730,8 @@
#endif // MODPLUG_NO_FILESAVE
// MOD Convert function
- UINT GetBestSaveFormat() const;
- UINT GetSaveFormats() const;
+ MODTYPE GetBestSaveFormat() const;
+ MODTYPE GetSaveFormats() const;
void ConvertModCommand(MODCOMMAND *) const;
void S3MConvert(MODCOMMAND *m, BOOL bIT) const;
void S3MSaveConvert(UINT *pcmd, UINT *pprm, BOOL bIT, BOOL bCompatibilityExport = false) const;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sag...@us...> - 2009-10-06 12:44:39
|
Revision: 389
http://modplug.svn.sourceforge.net/modplug/?rev=389&view=rev
Author: saga-games
Date: 2009-10-06 12:44:31 +0000 (Tue, 06 Oct 2009)
Log Message:
-----------
[Fix] Pattern Editor: PC Notes are now deleted properly (last column)
[Imp] Treeview: Can now dragondrop orders, even between sequences
[Imp] Mod Conversion: Trim sequence if it's too long
[New] New cleanup feature: Merge sequences
[Mod] Redesigned cleanup dialog again...
[Ref] Removed more compiler warnings
Modified Paths:
--------------
trunk/OpenMPT/mptrack/CleanupSong.cpp
trunk/OpenMPT/mptrack/CleanupSong.h
trunk/OpenMPT/mptrack/Moddoc.h
trunk/OpenMPT/mptrack/Modedit.cpp
trunk/OpenMPT/mptrack/View_gen.cpp
trunk/OpenMPT/mptrack/View_pat.cpp
trunk/OpenMPT/mptrack/View_tre.cpp
trunk/OpenMPT/mptrack/mptrack.rc
trunk/OpenMPT/mptrack/resource.h
Modified: trunk/OpenMPT/mptrack/CleanupSong.cpp
===================================================================
--- trunk/OpenMPT/mptrack/CleanupSong.cpp 2009-10-05 20:51:54 UTC (rev 388)
+++ trunk/OpenMPT/mptrack/CleanupSong.cpp 2009-10-06 12:44:31 UTC (rev 389)
@@ -18,31 +18,30 @@
// Default checkbox state
bool CModCleanupDlg::m_bCheckBoxes[CU_MAX_CLEANUP_OPTIONS] =
{
- // remove unused
- true, true, // pat/smp
- true, true, // ins/plg
- // remove all
- false, false, // pat/ord
- false, false, // smp/ins
- false, // plg
- // misc
- true, true, // pat/smp
- true, false, // opt/reset
+ true, false, true, // patterns
+ false, false, // orders
+ true, false, false, true, // samples
+ true, false, // instruments
+ true, false, // plugins
+ false, // misc
};
// Checkbox -> Control ID LUT
WORD const CModCleanupDlg::m_nCleanupIDtoDlgID[CU_MAX_CLEANUP_OPTIONS] =
{
- // remove unused
- IDC_CHK_CLEANUP_PATTERNS, IDC_CHK_CLEANUP_SAMPLES,
- IDC_CHK_CLEANUP_INSTRUMENTS, IDC_CHK_CLEANUP_PLUGINS,
- // remove all
- IDC_CHK_REMOVE_PATTERNS, IDC_CHK_REMOVE_ORDERS,
- IDC_CHK_REMOVE_SAMPLES, IDC_CHK_REMOVE_INSTRUMENTS,
- IDC_CHK_REMOVE_PLUGINS,
+ // patterns
+ IDC_CHK_CLEANUP_PATTERNS, IDC_CHK_REMOVE_PATTERNS, IDC_CHK_REARRANGE_PATTERNS,
+ // orders
+ IDC_CHK_MERGE_SEQUENCES, IDC_CHK_REMOVE_ORDERS,
+ // samples
+ IDC_CHK_CLEANUP_SAMPLES, IDC_CHK_REMOVE_SAMPLES, IDC_CHK_REARRANGE_SAMPLES,
+ IDC_CHK_OPTIMIZE_SAMPLES,
+ // instruments
+ IDC_CHK_CLEANUP_INSTRUMENTS, IDC_CHK_REMOVE_INSTRUMENTS,
+ // plugins
+ IDC_CHK_CLEANUP_PLUGINS, IDC_CHK_REMOVE_PLUGINS,
// misc
- IDC_CHK_REARRANGE_PATTERNS, IDC_CHK_REARRANGE_SAMPLES,
- IDC_CHK_OPTIMIZE_SAMPLES, IDC_CHK_RESET_VARIABLES,
+ IDC_CHK_RESET_VARIABLES,
};
///////////////////////////////////////////////////////////////////////
@@ -52,6 +51,9 @@
//{{AFX_MSG_MAP(CModTypeDlg)
ON_COMMAND(IDC_BTN_CLEANUP_SONG, OnPresetCleanupSong)
ON_COMMAND(IDC_BTN_COMPO_CLEANUP, OnPresetCompoCleanup)
+
+ ON_NOTIFY_EX_RANGE(TTN_NEEDTEXTW, 0, 0xFFFF, &CModCleanupDlg::OnToolTipNotify)
+ ON_NOTIFY_EX_RANGE(TTN_NEEDTEXTA, 0, 0xFFFF, &CModCleanupDlg::OnToolTipNotify)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
@@ -67,15 +69,19 @@
CSoundFile *pSndFile = m_pModDoc->GetSoundFile();
if(pSndFile == nullptr) return FALSE;
- GetDlgItem(m_nCleanupIDtoDlgID[CU_CLEANUP_INSTRUMENTS])->EnableWindow((pSndFile->m_nInstruments > 0) ? TRUE :FALSE);
+ GetDlgItem(m_nCleanupIDtoDlgID[CU_MERGE_SEQUENCES])->EnableWindow((pSndFile->m_nType & MOD_TYPE_MPT) ? TRUE : FALSE);
- GetDlgItem(m_nCleanupIDtoDlgID[CU_REMOVE_INSTRUMENTS])->EnableWindow((pSndFile->m_nInstruments > 0) ? TRUE :FALSE);
- GetDlgItem(m_nCleanupIDtoDlgID[CU_REMOVE_SAMPLES])->EnableWindow((pSndFile->m_nSamples > 0) ? TRUE :FALSE);
+ GetDlgItem(m_nCleanupIDtoDlgID[CU_REMOVE_SAMPLES])->EnableWindow((pSndFile->m_nSamples > 0) ? TRUE : FALSE);
+ GetDlgItem(m_nCleanupIDtoDlgID[CU_REARRANGE_SAMPLES])->EnableWindow((pSndFile->m_nSamples > 1) ? TRUE : FALSE);
- GetDlgItem(m_nCleanupIDtoDlgID[CU_REARRANGE_SAMPLES])->EnableWindow((pSndFile->m_nSamples > 1) ? TRUE :FALSE);
+ GetDlgItem(m_nCleanupIDtoDlgID[CU_CLEANUP_INSTRUMENTS])->EnableWindow((pSndFile->m_nInstruments > 0) ? TRUE : FALSE);
+ GetDlgItem(m_nCleanupIDtoDlgID[CU_REMOVE_INSTRUMENTS])->EnableWindow((pSndFile->m_nInstruments > 0) ? TRUE : FALSE);
+
+ EnableToolTips(TRUE);
return TRUE;
}
+
void CModCleanupDlg::OnOK()
//-------------------------
{
@@ -88,6 +94,7 @@
m_pModDoc->ClearLog();
// Orders
+ if(m_bCheckBoxes[CU_MERGE_SEQUENCES]) bModified |= MergeSequences();
if(m_bCheckBoxes[CU_REMOVE_ORDERS]) bModified |= RemoveAllOrders();
// Patterns
@@ -136,46 +143,137 @@
void CModCleanupDlg::OnPresetCleanupSong()
//----------------------------------------
{
- // remove unused
+ // patterns
CheckDlgButton(IDC_CHK_CLEANUP_PATTERNS, MF_CHECKED);
- CheckDlgButton(IDC_CHK_CLEANUP_SAMPLES, MF_CHECKED);
- CheckDlgButton(IDC_CHK_CLEANUP_INSTRUMENTS, MF_CHECKED);
- CheckDlgButton(IDC_CHK_CLEANUP_PLUGINS, MF_CHECKED);
- // remove all
CheckDlgButton(IDC_CHK_REMOVE_PATTERNS, MF_UNCHECKED);
+ CheckDlgButton(IDC_CHK_REARRANGE_PATTERNS, MF_UNCHECKED);
+ // orders
+ CheckDlgButton(IDC_CHK_MERGE_SEQUENCES, MF_UNCHECKED);
CheckDlgButton(IDC_CHK_REMOVE_ORDERS, MF_UNCHECKED);
+ // samples
+ CheckDlgButton(IDC_CHK_CLEANUP_SAMPLES, MF_CHECKED);
CheckDlgButton(IDC_CHK_REMOVE_SAMPLES, MF_UNCHECKED);
+ CheckDlgButton(IDC_CHK_REARRANGE_SAMPLES, MF_CHECKED);
+ CheckDlgButton(IDC_CHK_OPTIMIZE_SAMPLES, MF_CHECKED);
+ // instruments
+ CheckDlgButton(IDC_CHK_CLEANUP_INSTRUMENTS, MF_CHECKED);
CheckDlgButton(IDC_CHK_REMOVE_INSTRUMENTS, MF_UNCHECKED);
+ // plugins
+ CheckDlgButton(IDC_CHK_CLEANUP_PLUGINS, MF_CHECKED);
CheckDlgButton(IDC_CHK_REMOVE_PLUGINS, MF_UNCHECKED);
// misc
- CheckDlgButton(IDC_CHK_REARRANGE_PATTERNS, MF_CHECKED);
- CheckDlgButton(IDC_CHK_REARRANGE_SAMPLES, MF_CHECKED);
- CheckDlgButton(IDC_CHK_OPTIMIZE_SAMPLES, MF_CHECKED);
CheckDlgButton(IDC_CHK_SAMPLEPACK, MF_UNCHECKED);
}
void CModCleanupDlg::OnPresetCompoCleanup()
//----------------------------------------
{
- // remove unused
+ // patterns
CheckDlgButton(IDC_CHK_CLEANUP_PATTERNS, MF_UNCHECKED);
- CheckDlgButton(IDC_CHK_CLEANUP_SAMPLES, MF_UNCHECKED);
- CheckDlgButton(IDC_CHK_CLEANUP_INSTRUMENTS, MF_UNCHECKED);
- CheckDlgButton(IDC_CHK_CLEANUP_PLUGINS, MF_UNCHECKED);
- // remove all
CheckDlgButton(IDC_CHK_REMOVE_PATTERNS, MF_CHECKED);
+ CheckDlgButton(IDC_CHK_REARRANGE_PATTERNS, MF_UNCHECKED);
+ // orders
+ CheckDlgButton(IDC_CHK_MERGE_SEQUENCES, MF_UNCHECKED);
CheckDlgButton(IDC_CHK_REMOVE_ORDERS, MF_CHECKED);
+ // samples
+ CheckDlgButton(IDC_CHK_CLEANUP_SAMPLES, MF_UNCHECKED);
CheckDlgButton(IDC_CHK_REMOVE_SAMPLES, MF_UNCHECKED);
+ CheckDlgButton(IDC_CHK_REARRANGE_SAMPLES, MF_CHECKED);
+ CheckDlgButton(IDC_CHK_OPTIMIZE_SAMPLES, MF_UNCHECKED);
+ // instruments
+ CheckDlgButton(IDC_CHK_CLEANUP_INSTRUMENTS, MF_UNCHECKED);
CheckDlgButton(IDC_CHK_REMOVE_INSTRUMENTS, MF_CHECKED);
+ // plugins
+ CheckDlgButton(IDC_CHK_CLEANUP_PLUGINS, MF_UNCHECKED);
CheckDlgButton(IDC_CHK_REMOVE_PLUGINS, MF_CHECKED);
// misc
- CheckDlgButton(IDC_CHK_REARRANGE_PATTERNS, MF_UNCHECKED);
- CheckDlgButton(IDC_CHK_REARRANGE_SAMPLES, MF_CHECKED);
- CheckDlgButton(IDC_CHK_OPTIMIZE_SAMPLES, MF_UNCHECKED);
CheckDlgButton(IDC_CHK_SAMPLEPACK, MF_CHECKED);
}
+BOOL CModCleanupDlg::OnToolTipNotify(UINT id, NMHDR* pNMHDR, LRESULT* pResult)
+{
+ UNREFERENCED_PARAMETER(id);
+ UNREFERENCED_PARAMETER(pResult);
+ // need to handle both ANSI and UNICODE versions of the message
+ TOOLTIPTEXTA* pTTTA = (TOOLTIPTEXTA*)pNMHDR;
+ TOOLTIPTEXTW* pTTTW = (TOOLTIPTEXTW*)pNMHDR;
+ CStringA strTipText = "";
+ UINT_PTR nID = pNMHDR->idFrom;
+ if (pNMHDR->code == TTN_NEEDTEXTA && (pTTTA->uFlags & TTF_IDISHWND) ||
+ pNMHDR->code == TTN_NEEDTEXTW && (pTTTW->uFlags & TTF_IDISHWND))
+ {
+ // idFrom is actually the HWND of the tool
+ nID = ::GetDlgCtrlID((HWND)nID);
+ }
+
+ switch(nID)
+ {
+ // patterns
+ case IDC_CHK_CLEANUP_PATTERNS:
+ strTipText = "Remove all unused patterns and rearrange them.";
+ break;
+ case IDC_CHK_REMOVE_PATTERNS:
+ strTipText = "Remove all patterns.";
+ break;
+ case IDC_CHK_REARRANGE_PATTERNS:
+ strTipText = "Number the patterns given by their order in the sequence.";
+ break;
+ // orders
+ case IDC_CHK_REMOVE_ORDERS:
+ strTipText = "Reset the order list.";
+ break;
+ case IDC_CHK_MERGE_SEQUENCES:
+ strTipText = "Merge multiple sequences into one.";
+ break;
+ // samples
+ case IDC_CHK_CLEANUP_SAMPLES:
+ strTipText = "Remove all unused samples.";
+ break;
+ case IDC_CHK_REMOVE_SAMPLES:
+ strTipText = "Remove all samples.";
+ break;
+ case IDC_CHK_REARRANGE_SAMPLES:
+ strTipText = "Reorder sample list by removing empty samples.";
+ break;
+ case IDC_CHK_OPTIMIZE_SAMPLES:
+ strTipText = "Remove unused data after the sample loop end.";
+ break;
+ // instruments
+ case IDC_CHK_CLEANUP_INSTRUMENTS:
+ strTipText = "Remove all unused instruments.";
+ break;
+ case IDC_CHK_REMOVE_INSTRUMENTS:
+ strTipText = "Remove all instruments and convert them to samples.";
+ break;
+ // plugins
+ case IDC_CHK_CLEANUP_PLUGINS:
+ strTipText = "Remove all unused plugins.";
+ break;
+ case IDC_CHK_REMOVE_PLUGINS:
+ strTipText = "Remove all plugins.";
+ break;
+ // misc
+ case IDC_CHK_SAMPLEPACK:
+ strTipText = "Convert the module to .IT and reset song, sample and instrument variables";
+ break;
+ }
+
+ if (pNMHDR->code == TTN_NEEDTEXTA)
+ {
+ strncpy_s(pTTTA->szText, sizeof(pTTTA->szText), strTipText,
+ strTipText.GetLength() + 1);
+ }
+ else
+ {
+ ::MultiByteToWideChar(CP_ACP , 0, strTipText, strTipText.GetLength() + 1,
+ pTTTW->szText, sizeof(pTTTW->szText)/(sizeof pTTTW->szText[0]));
+ }
+
+ return TRUE;
+}
+
+
///////////////////////////////////////////////////////////////////////
// Actual cleanup implementations
@@ -807,8 +905,12 @@
CSoundFile *pSndFile = m_pModDoc->GetSoundFile();
if(pSndFile == nullptr) return false;
+ pSndFile->Order.SetSequence(0);
+ while(pSndFile->Order.GetNumSequences() > 1)
+ {
+ pSndFile->Order.RemoveSequence(1);
+ }
pSndFile->Order.Init();
- pSndFile->Order.SetSequence(0);
pSndFile->Order[0] = 0;
pSndFile->SetCurrentOrder(0);
return true;
@@ -876,3 +978,10 @@
m_pModDoc->RemovePlugs(keepMask);
return true;
}
+
+// Remove all plugins
+bool CModCleanupDlg::MergeSequences()
+//-------------------------------------
+{
+ return m_pModDoc->MergeSequences();
+}
Modified: trunk/OpenMPT/mptrack/CleanupSong.h
===================================================================
--- trunk/OpenMPT/mptrack/CleanupSong.h 2009-10-05 20:51:54 UTC (rev 388)
+++ trunk/OpenMPT/mptrack/CleanupSong.h 2009-10-06 12:44:31 UTC (rev 389)
@@ -10,21 +10,25 @@
enum ENUM_CLEANUP_OPTIONS
{
- // remove unused
+ // patterns
CU_CLEANUP_PATTERNS = 0,
- CU_CLEANUP_SAMPLES,
- CU_CLEANUP_INSTRUMENTS,
- CU_CLEANUP_PLUGINS,
- // remove all
CU_REMOVE_PATTERNS,
+ CU_REARRANGE_PATTERNS,
+ // orders
+ CU_MERGE_SEQUENCES,
CU_REMOVE_ORDERS,
+ // samples
+ CU_CLEANUP_SAMPLES,
CU_REMOVE_SAMPLES,
+ CU_REARRANGE_SAMPLES,
+ CU_OPTIMIZE_SAMPLES,
+ // instruments
+ CU_CLEANUP_INSTRUMENTS,
CU_REMOVE_INSTRUMENTS,
+ // plugins
+ CU_CLEANUP_PLUGINS,
CU_REMOVE_PLUGINS,
// misc
- CU_REARRANGE_PATTERNS,
- CU_REARRANGE_SAMPLES,
- CU_OPTIMIZE_SAMPLES,
CU_RESET_VARIABLES,
CU_MAX_CLEANUP_OPTIONS
@@ -40,20 +44,25 @@
static bool m_bCheckBoxes[CU_MAX_CLEANUP_OPTIONS]; // Checkbox state
static const WORD m_nCleanupIDtoDlgID[CU_MAX_CLEANUP_OPTIONS]; // Checkbox -> Control ID LUT
- // Actual cleanup implementations
+ // Actual cleanup implementations:
+ // Patterns
bool RemoveUnusedPatterns(bool bRemove = true); // Remove unused patterns / rearrange patterns
- bool RemoveUnusedSamples(); // Remove unused samples
- bool RemoveUnusedInstruments(); // Remove unused instruments
- bool RemoveUnusedPlugins(); // Remove ununsed plugins
- // Zap
bool RemoveAllPatterns();
+ // Orders
+ bool MergeSequences();
bool RemoveAllOrders();
+ // Samples
+ bool RemoveUnusedSamples(); // Remove unused samples
bool RemoveAllSamples();
+ bool RearrangeSamples(); // Rearrange sample list
+ bool OptimizeSamples(); // Remove unused sample data
+ // Instruments
+ bool RemoveUnusedInstruments(); // Remove unused instruments
bool RemoveAllInstruments(bool bConfirm = true);
+ // Plugins
+ bool RemoveUnusedPlugins(); // Remove ununsed plugins
bool RemoveAllPlugins();
// Misc
- bool RearrangeSamples(); // Rearrange sample list
- bool OptimizeSamples(); // Remove unused sample data
bool ResetVariables(); // Turn module into samplepack (convert to IT, remove patterns, etc.)
public:
@@ -66,6 +75,8 @@
virtual void OnCancel();
//}}AFX_VIRTUAL
+ BOOL OnToolTipNotify(UINT id, NMHDR* pNMHDR, LRESULT* pResult);
+
//{{AFX_MSG(CModCleanupDlg)
afx_msg void OnPresetCleanupSong();
afx_msg void OnPresetCompoCleanup();
Modified: trunk/OpenMPT/mptrack/Moddoc.h
===================================================================
--- trunk/OpenMPT/mptrack/Moddoc.h 2009-10-05 20:51:54 UTC (rev 388)
+++ trunk/OpenMPT/mptrack/Moddoc.h 2009-10-06 12:44:31 UTC (rev 389)
@@ -258,6 +258,8 @@
BOOL RemoveChannels(BOOL bChnMask[MAX_CHANNELS]);
+ bool MergeSequences();
+
bool m_bHasValidPath; //becomes true if document is loaded or saved.
// Fix: save pattern scrollbar position when switching to other tab
CSize GetOldPatternScrollbarsPos() const { return m_szOldPatternScrollbarsPos; };
Modified: trunk/OpenMPT/mptrack/Modedit.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Modedit.cpp 2009-10-05 20:51:54 UTC (rev 388)
+++ trunk/OpenMPT/mptrack/Modedit.cpp 2009-10-06 12:44:31 UTC (rev 389)
@@ -100,75 +100,6 @@
-Alternative tempomodes
-For more info, see e.g. SaveExtendedSongProperties(), SaveExtendedInstrumentProperties()
*/
-
- // Merge multiple sequences
- m_SndFile.Order.SetSequence(0);
- m_SndFile.Order.resize(m_SndFile.Order.GetLengthTailTrimmed());
- SEQUENCEINDEX removedSequences = 0; // sequence count
- vector <SEQUENCEINDEX> patternsFixed; // pattern fixed by other sequence already?
- patternsFixed.resize(m_SndFile.Patterns.Size(), SEQUENCEINDEX_INVALID);
- // Set up vector
- for(ORDERINDEX nOrd = 0; nOrd < m_SndFile.Order.GetLengthTailTrimmed(); nOrd++)
- {
- PATTERNINDEX nPat = m_SndFile.Order[nOrd];
- if(!m_SndFile.Patterns.IsValidPat(nPat)) continue;
- patternsFixed[nPat] = 0;
- }
-
- while(m_SndFile.Order.GetNumSequences() > 1)
- {
- removedSequences++;
- const ORDERINDEX nFirstOrder = m_SndFile.Order.GetLengthTailTrimmed() + 1; // +1 for separator item
- if(nFirstOrder + m_SndFile.Order.GetSequence(1).GetLengthTailTrimmed() > m_SndFile.GetModSpecifications(nNewType).ordersMax)
- {
- wsprintf(s, "WARNING: Cannot merge Sequence %d (too long!)\n", removedSequences);
- AddToLog(s);
- m_SndFile.Order.RemoveSequence(1);
- continue;
- }
- m_SndFile.Order.Append(m_SndFile.Order.GetInvalidPatIndex()); // Separator item
- for(ORDERINDEX nOrd = 0; nOrd < m_SndFile.Order.GetSequence(1).GetLengthTailTrimmed(); nOrd++)
- {
- PATTERNINDEX nPat = m_SndFile.Order.GetSequence(1)[nOrd];
- m_SndFile.Order.Append(nPat);
-
- // Try to fix patterns (Bxx commands)
- if(!m_SndFile.Patterns.IsValidPat(nPat)) continue;
-
- MODCOMMAND *m = m_SndFile.Patterns[nPat];
- for (UINT len = 0; len < m_SndFile.PatternSize[nPat] * m_SndFile.m_nChannels; m++, len++)
- {
- if(m->command == CMD_POSITIONJUMP)
- {
- if(patternsFixed[nPat] != SEQUENCEINDEX_INVALID && patternsFixed[nPat] != removedSequences)
- {
- // Oops, some other sequence uses this pattern already.
- const PATTERNINDEX nNewPat = m_SndFile.Patterns.Insert(m_SndFile.PatternSize[nPat]);
- if(nNewPat != SEQUENCEINDEX_INVALID)
- {
- // could create new pattern - copy data over and continue from here.
- m_SndFile.Order[nFirstOrder + nOrd] = nNewPat;
- MODCOMMAND *pSrc = m_SndFile.Patterns[nPat];
- MODCOMMAND *pDest = m_SndFile.Patterns[nNewPat];
- memcpy(pDest, pSrc, m_SndFile.PatternSize[nPat] * m_SndFile.m_nChannels * sizeof(MODCOMMAND));
- m = pDest + len;
- patternsFixed.resize(max(nNewPat + 1, (PATTERNINDEX)patternsFixed.size()), SEQUENCEINDEX_INVALID);
- nPat = nNewPat;
- } else
- {
- // cannot create new pattern: notify the user
- wsprintf(s, "CONFLICT: Pattern break commands in Pattern %d might be broken since it has been used in several sequences!", nPat);
- AddToLog(s);
- }
- }
- m->param += nFirstOrder;
- patternsFixed[nPat] = removedSequences;
- }
- }
-
- }
- m_SndFile.Order.RemoveSequence(1);
- }
}
// Check if conversion to 64 rows is necessary
@@ -802,6 +733,9 @@
END_CRITICAL();
ChangeFileExtension(nNewType);
+ // Multisequences not suppported by other formats
+ if(!(m_SndFile.m_nType & MOD_TYPE_MPT)) MergeSequences();
+
//rewbs.cutomKeys: update effect key commands
CInputHandler *ih = CMainFrame::GetMainFrame()->GetInputHandler();
if (newTypeIsMOD_XM) {
@@ -826,6 +760,22 @@
if(bTrimmedEnvelopes == true)
AddToLog("WARNING: Instrument envelopes have been shortened.\n");
+ // Order list too long -> remove unnecessary order items first.
+ if(m_SndFile.Order.GetLengthTailTrimmed() > specs.ordersMax)
+ {
+ for(ORDERINDEX nOrd = m_SndFile.Order.GetLengthTailTrimmed() - 1; nOrd >= 0; nOrd--)
+ {
+ if(m_SndFile.Patterns.IsValidPat(m_SndFile.Order[nOrd]) == false)
+ {
+ for(ORDERINDEX nMoveOrd = nOrd; nMoveOrd < m_SndFile.Order.GetLengthTailTrimmed(); nMoveOrd++)
+ {
+ m_SndFile.Order[nMoveOrd] = m_SndFile.Order[nMoveOrd + 1];
+ }
+ }
+ }
+ m_SndFile.Order.resize(specs.ordersMax);
+ }
+
SetModified();
ClearUndo();
UpdateAllViews(NULL, HINT_MODTYPE | HINT_MODGENERAL);
@@ -1371,22 +1321,34 @@
bool CModDoc::MoveOrder(ORDERINDEX nSourceNdx, ORDERINDEX nDestNdx, bool bUpdate, bool bCopy, SEQUENCEINDEX nSourceSeq, SEQUENCEINDEX nDestSeq)
//---------------------------------------------------------------------------------------------------------------------------------------------
{
- if ((nSourceNdx >= m_SndFile.Order.size()) || (nDestNdx >= m_SndFile.Order.size())) return false;
+ if (max(nSourceNdx, nDestNdx) >= m_SndFile.Order.size()) return false;
if (nDestNdx >= m_SndFile.GetModSpecifications().ordersMax) return false;
- ORDERINDEX n = m_SndFile.Order[nSourceNdx];
+
+ if(nSourceSeq == SEQUENCEINDEX_INVALID) nSourceSeq = m_SndFile.Order.GetCurrentSequenceIndex();
+ if(nDestSeq == SEQUENCEINDEX_INVALID) nDestSeq = m_SndFile.Order.GetCurrentSequenceIndex();
+ if (max(nSourceSeq, nDestSeq) >= m_SndFile.Order.GetNumSequences()) return false;
+ PATTERNINDEX nSourcePat = m_SndFile.Order.GetSequence(nSourceSeq)[nSourceNdx];
+
+ // save current working sequence
+ SEQUENCEINDEX nWorkingSeq = m_SndFile.Order.GetCurrentSequenceIndex();
+
// Delete source
if (!bCopy)
{
- for (ORDERINDEX i = nSourceNdx; i < m_SndFile.Order.size() - 1; i++) m_SndFile.Order[i] = m_SndFile.Order[i+1];
+ m_SndFile.Order.SetSequence(nSourceSeq);
+ for (ORDERINDEX i = nSourceNdx; i < m_SndFile.Order.size() - 1; i++) m_SndFile.Order[i] = m_SndFile.Order[i + 1];
if (nSourceNdx < nDestNdx) nDestNdx--;
}
// Insert at dest
- for (ORDERINDEX j = m_SndFile.Order.size() - 1; j > nDestNdx; j--) m_SndFile.Order[j] = m_SndFile.Order[j-1];
- m_SndFile.Order[nDestNdx] = n;
+ m_SndFile.Order.SetSequence(nDestSeq);
+ for (ORDERINDEX nOrd = m_SndFile.Order.size() - 1; nOrd > nDestNdx; nOrd--) m_SndFile.Order[nOrd] = m_SndFile.Order[nOrd - 1];
+ m_SndFile.Order[nDestNdx] = nSourcePat;
if (bUpdate)
{
UpdateAllViews(NULL, HINT_MODSEQUENCE, NULL);
}
+
+ m_SndFile.Order.SetSequence(nWorkingSeq);
return true;
}
@@ -2147,4 +2109,80 @@
}
}
+// Merge multiple sequences
+bool CModDoc::MergeSequences()
+//----------------------------
+{
+ if(m_SndFile.Order.GetNumSequences() <= 1) return false;
+ CHAR s[256];
+ m_SndFile.Order.SetSequence(0);
+ m_SndFile.Order.resize(m_SndFile.Order.GetLengthTailTrimmed());
+ SEQUENCEINDEX removedSequences = 0; // sequence count
+ vector <SEQUENCEINDEX> patternsFixed; // pattern fixed by other sequence already?
+ patternsFixed.resize(m_SndFile.Patterns.Size(), SEQUENCEINDEX_INVALID);
+ // Set up vector
+ for(ORDERINDEX nOrd = 0; nOrd < m_SndFile.Order.GetLengthTailTrimmed(); nOrd++)
+ {
+ PATTERNINDEX nPat = m_SndFile.Order[nOrd];
+ if(!m_SndFile.Patterns.IsValidPat(nPat)) continue;
+ patternsFixed[nPat] = 0;
+ }
+
+ while(m_SndFile.Order.GetNumSequences() > 1)
+ {
+ removedSequences++;
+ const ORDERINDEX nFirstOrder = m_SndFile.Order.GetLengthTailTrimmed() + 1; // +1 for separator item
+ if(nFirstOrder + m_SndFile.Order.GetSequence(1).GetLengthTailTrimmed() > m_SndFile.GetModSpecifications().ordersMax)
+ {
+ wsprintf(s, "WARNING: Cannot merge Sequence %d (too long!)\n", removedSequences);
+ AddToLog(s);
+ m_SndFile.Order.RemoveSequence(1);
+ continue;
+ }
+ m_SndFile.Order.Append(m_SndFile.Order.GetInvalidPatIndex()); // Separator item
+ for(ORDERINDEX nOrd = 0; nOrd < m_SndFile.Order.GetSequence(1).GetLengthTailTrimmed(); nOrd++)
+ {
+ PATTERNINDEX nPat = m_SndFile.Order.GetSequence(1)[nOrd];
+ m_SndFile.Order.Append(nPat);
+
+ // Try to fix patterns (Bxx commands)
+ if(!m_SndFile.Patterns.IsValidPat(nPat)) continue;
+
+ MODCOMMAND *m = m_SndFile.Patterns[nPat];
+ for (UINT len = 0; len < m_SndFile.PatternSize[nPat] * m_SndFile.m_nChannels; m++, len++)
+ {
+ if(m->command == CMD_POSITIONJUMP)
+ {
+ if(patternsFixed[nPat] != SEQUENCEINDEX_INVALID && patternsFixed[nPat] != removedSequences)
+ {
+ // Oops, some other sequence uses this pattern already.
+ const PATTERNINDEX nNewPat = m_SndFile.Patterns.Insert(m_SndFile.PatternSize[nPat]);
+ if(nNewPat != SEQUENCEINDEX_INVALID)
+ {
+ // could create new pattern - copy data over and continue from here.
+ m_SndFile.Order[nFirstOrder + nOrd] = nNewPat;
+ MODCOMMAND *pSrc = m_SndFile.Patterns[nPat];
+ MODCOMMAND *pDest = m_SndFile.Patterns[nNewPat];
+ memcpy(pDest, pSrc, m_SndFile.PatternSize[nPat] * m_SndFile.m_nChannels * sizeof(MODCOMMAND));
+ m = pDest + len;
+ patternsFixed.resize(max(nNewPat + 1, (PATTERNINDEX)patternsFixed.size()), SEQUENCEINDEX_INVALID);
+ nPat = nNewPat;
+ } else
+ {
+ // cannot create new pattern: notify the user
+ wsprintf(s, "CONFLICT: Pattern break commands in Pattern %d might be broken since it has been used in several sequences!", nPat);
+ AddToLog(s);
+ }
+ }
+ m->param += nFirstOrder;
+ patternsFixed[nPat] = removedSequences;
+ }
+ }
+
+ }
+ m_SndFile.Order.RemoveSequence(1);
+ }
+ return true;
+}
+
Modified: trunk/OpenMPT/mptrack/View_gen.cpp
===================================================================
--- trunk/OpenMPT/mptrack/View_gen.cpp 2009-10-05 20:51:54 UTC (rev 388)
+++ trunk/OpenMPT/mptrack/View_gen.cpp 2009-10-06 12:44:31 UTC (rev 389)
@@ -562,14 +562,14 @@
}
void CViewGlobals::OnMute(const CHANNELINDEX chnMod4, const UINT itemID)
-//---------------------------------------------------------
+//----------------------------------------------------------------------
{
CModDoc *pModDoc = GetDocument();
if (pModDoc)
{
- const BOOL b = (IsDlgButtonChecked(itemID)) ? TRUE : FALSE;
- const UINT nChn = m_nActiveTab * 4 + chnMod4;
+ const bool b = (IsDlgButtonChecked(itemID)) ? true : false;
+ const CHANNELINDEX nChn = (CHANNELINDEX)(m_nActiveTab * 4) + chnMod4;
pModDoc->MuteChannel(nChn, b);
pModDoc->UpdateAllViews(this, HINT_MODCHANNELS | (m_nActiveTab << HINT_SHIFT_CHNTAB));
}
@@ -582,14 +582,14 @@
void CViewGlobals::OnSurround(const CHANNELINDEX chnMod4, const UINT itemID)
-//--------------------------------------------------------------
+//--------------------------------------------------------------------------
{
CModDoc *pModDoc = GetDocument();
if (pModDoc)
{
- const BOOL b = (IsDlgButtonChecked(itemID)) ? TRUE : FALSE;
- const UINT nChn = m_nActiveTab * 4 + chnMod4;
+ const bool b = (IsDlgButtonChecked(itemID)) ? true : false;
+ const CHANNELINDEX nChn = (CHANNELINDEX)(m_nActiveTab * 4) + chnMod4;
pModDoc->SurroundChannel(nChn, b);
pModDoc->UpdateAllViews(this, HINT_MODCHANNELS | (m_nActiveTab << HINT_SHIFT_CHNTAB));
}
@@ -601,10 +601,10 @@
void CViewGlobals::OnSurround4() {OnSurround(3, IDC_CHECK8);}
void CViewGlobals::OnEditVol(const CHANNELINDEX chnMod4, const UINT itemID)
-//------------------------------------------------------------
+//-------------------------------------------------------------------------
{
CModDoc *pModDoc = GetDocument();
- const UINT nChn = m_nActiveTab * 4 + chnMod4;
+ const CHANNELINDEX nChn = (CHANNELINDEX)(m_nActiveTab * 4) + chnMod4;
const int vol = GetDlgItemIntEx(itemID);
if ((pModDoc) && (vol >= 0) && (vol <= 64) && (!m_nLockCount))
{
@@ -623,10 +623,10 @@
void CViewGlobals::OnEditPan(const CHANNELINDEX chnMod4, const UINT itemID)
-//--------------------------------------------------------
+//-------------------------------------------------------------------------
{
CModDoc *pModDoc = GetDocument();
- const UINT nChn = m_nActiveTab * 4 + chnMod4;
+ const CHANNELINDEX nChn = (CHANNELINDEX)(m_nActiveTab * 4) + chnMod4;
const int pan = GetDlgItemIntEx(itemID);
if ((pModDoc) && (pan >= 0) && (pan <= 256) && (!m_nLockCount))
{
@@ -650,26 +650,26 @@
{
CHAR s[64];
CModDoc *pModDoc;
- UINT nChn;
+ CHANNELINDEX nChn;
CFormView::OnHScroll(nSBCode, nPos, pScrollBar);
pModDoc = GetDocument();
- nChn = m_nActiveTab * 4;
+ nChn = (CHANNELINDEX)(m_nActiveTab * 4);
if ((pModDoc) && (!IsLocked()) && (nChn < MAX_BASECHANNELS))
{
BOOL bUpdate = FALSE;
short int pos;
LockControls();
- const UINT nLoopLimit = min(4, pModDoc->GetSoundFile()->GetNumChannels() - nChn);
- for (UINT iCh=0; iCh<nLoopLimit; iCh++)
+ const CHANNELINDEX nLoopLimit = min(4, pModDoc->GetSoundFile()->GetNumChannels() - nChn);
+ for (CHANNELINDEX iCh = 0; iCh < nLoopLimit; iCh++)
{
// Volume sliders
pos = (short int)m_sbVolume[iCh].GetPos();
if ((pos >= 0) && (pos <= 64))
{
- if (pModDoc->SetChannelGlobalVolume(nChn+iCh, pos))
+ if (pModDoc->SetChannelGlobalVolume(nChn + iCh, pos))
{
SetDlgItemInt(IDC_EDIT1+iCh*2, pos);
bUpdate = TRUE;
Modified: trunk/OpenMPT/mptrack/View_pat.cpp
===================================================================
--- trunk/OpenMPT/mptrack/View_pat.cpp 2009-10-05 20:51:54 UTC (rev 388)
+++ trunk/OpenMPT/mptrack/View_pat.cpp 2009-10-06 12:44:31 UTC (rev 389)
@@ -4486,6 +4486,8 @@
case 4: p->param = 0; break; //Param
default: p->Clear(); //If not specified, delete them all! :)
}
+ if((field == 3 || field == 4) && (p->note == NOTE_PC || p->note == NOTE_PCS))
+ p->command = p->param = 0;
if(IsEditingEnabled_bmsg())
{
Modified: trunk/OpenMPT/mptrack/View_tre.cpp
===================================================================
--- trunk/OpenMPT/mptrack/View_tre.cpp 2009-10-05 20:51:54 UTC (rev 388)
+++ trunk/OpenMPT/mptrack/View_tre.cpp 2009-10-06 12:44:31 UTC (rev 389)
@@ -771,8 +771,17 @@
}
} else
{
- wsprintf(s, "[%02d] Skip", iOrd);
+ if(pSndFile->Order.GetSequence(nSeq)[iOrd] == pSndFile->Order.GetIgnoreIndex())
+ {
+ // +++ Item
+ wsprintf(s, "[%02d] Skip", iOrd);
+ } else
+ {
+ // --- Item
+ wsprintf(s, "[%02d] Stop", iOrd);
+ }
}
+
if (pInfo->tiOrders[nSeq][iOrd])
{
tvi.mask = TVIF_TEXT | TVIF_HANDLE | TVIF_STATE;
@@ -1930,11 +1939,27 @@
switch(dwDropType)
{
case MODITEM_ORDER:
+ case MODITEM_SEQUENCE:
if ((dwDragType == MODITEM_ORDER) && (pModDoc) && (m_nDocNdx == m_nDragDocNdx))
{
if (bDoDrop)
{
- if (dwItemDrag != qwItemDrop) pModDoc->MoveOrder((ORDERINDEX)dwItemDrag, (ORDERINDEX)qwItemDrop, true);
+ SEQUENCEINDEX nSeqFrom = (SEQUENCEINDEX)(dwItemDrag >> 16), nSeqTo = (SEQUENCEINDEX)(qwItemDrop >> 16);
+ ORDERINDEX nOrdFrom = (ORDERINDEX)(dwItemDrag & 0xFFFF), nOrdTo = (ORDERINDEX)(qwItemDrop & 0xFFFF);
+ if(dwDropType == MODITEM_SEQUENCE)
+ {
+ // drop on sequence -> attach
+ nSeqTo = (SEQUENCEINDEX)(qwItemDrop & 0xFFFF);
+ nOrdTo = pModDoc->GetSoundFile()->Order.GetSequence(nSeqTo).GetLengthTailTrimmed();
+ }
+
+ if (nSeqFrom != nSeqTo || nOrdFrom != nOrdTo)
+ {
+ if(pModDoc->MoveOrder(nOrdFrom, nOrdTo, true, false, nSeqFrom, nSeqTo) == true)
+ {
+ pModDoc->SetModified();
+ }
+ }
}
return TRUE;
}
@@ -2607,20 +2632,19 @@
pModDoc = GetDocumentFromItem(hItem);
if (pModDoc)
{
- SAMPLEINDEX nSamples = pModDoc->GetNumSamples();
INSTRUMENTINDEX nInstruments = pModDoc->GetNumInstruments();
if ((qwItemType == MODITEM_SAMPLE) && (!nInstruments))
{
- for (SAMPLEINDEX i=1; i<=nSamples; i++)
+ for (SAMPLEINDEX nSmp = 1; nSmp <= pModDoc->GetNumSamples(); nSmp++)
{
- pModDoc->MuteSample(i, (i == dwItemNo) ? false : true);
+ pModDoc->MuteSample(nSmp, (nSmp == dwItemNo) ? false : true);
}
} else
if ((qwItemType == MODITEM_INSTRUMENT) && (nInstruments))
{
- for (INSTRUMENTINDEX i=1; i<=nInstruments; i++)
+ for (INSTRUMENTINDEX nIns = 1; nIns <= nInstruments; nIns++)
{
- pModDoc->MuteInstrument(i, (i == dwItemNo) ? false : true);
+ pModDoc->MuteInstrument(nIns, (nIns == dwItemNo) ? false : true);
}
}
}
@@ -2638,17 +2662,15 @@
pModDoc = GetDocumentFromItem(hItem);
if (pModDoc)
{
- SAMPLEINDEX nSamples = pModDoc->GetNumSamples();
- INSTRUMENTINDEX nInstruments = pModDoc->GetNumInstruments();
if ((qwItemType == MODITEM_SAMPLE) || (qwItemType == MODITEM_INSTRUMENT))
{
- for (SAMPLEINDEX i=1; i<=nSamples; i++)
+ for (SAMPLEINDEX nSmp = 1; nSmp <= pModDoc->GetNumSamples(); nSmp++)
{
- pModDoc->MuteSample(i, FALSE);
+ pModDoc->MuteSample(nSmp, FALSE);
}
- for (INSTRUMENTINDEX j=1; j<=nInstruments; j++)
+ for (INSTRUMENTINDEX nIns = 1; nIns <= pModDoc->GetNumInstruments(); nIns++)
{
- pModDoc->MuteInstrument(j, FALSE);
+ pModDoc->MuteInstrument(nIns, FALSE);
}
}
}
Modified: trunk/OpenMPT/mptrack/mptrack.rc
===================================================================
--- trunk/OpenMPT/mptrack/mptrack.rc 2009-10-05 20:51:54 UTC (rev 388)
+++ trunk/OpenMPT/mptrack/mptrack.rc 2009-10-06 12:44:31 UTC (rev 389)
@@ -36,32 +36,38 @@
LTEXT "The following problems have been encountered when loading this module:",IDC_STATIC,6,6,237,8
END
-IDD_CLEANUP_SONG DIALOGEX 0, 0, 262, 209
+IDD_CLEANUP_SONG DIALOGEX 0, 0, 370, 281
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Cleanup"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
- DEFPUSHBUTTON "OK",IDOK,204,6,50,14
- PUSHBUTTON "Cancel",IDCANCEL,204,24,50,14
- GROUPBOX "Remove unused...",IDC_STATIC,6,6,192,42
- CONTROL "Patterns",IDC_CHK_CLEANUP_PATTERNS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,18,90,10
- CONTROL "Samples",IDC_CHK_CLEANUP_SAMPLES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,102,18,90,10
- CONTROL "Instruments",IDC_CHK_CLEANUP_INSTRUMENTS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,30,90,10
- CONTROL "Plugins",IDC_CHK_CLEANUP_PLUGINS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,102,30,90,10
- GROUPBOX "Remove all...",IDC_STATIC,6,54,192,54
- CONTROL "Patterns",IDC_CHK_REMOVE_PATTERNS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,66,90,10
- CONTROL "Orders",IDC_CHK_REMOVE_ORDERS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,102,66,90,10
- CONTROL "Samples",IDC_CHK_REMOVE_SAMPLES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,78,90,10
- CONTROL "Instruments",IDC_CHK_REMOVE_INSTRUMENTS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,102,78,90,10
- CONTROL "Plugins",IDC_CHK_REMOVE_PLUGINS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,90,90,10
- GROUPBOX "Misc.",IDC_STATIC,6,114,192,42
- CONTROL "Rearrange patterns",IDC_CHK_REARRANGE_PATTERNS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,126,90,10
- CONTROL "Rearrange samples",IDC_CHK_REARRANGE_SAMPLES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,102,126,90,10
- CONTROL "Optimize sample loops",IDC_CHK_OPTIMIZE_SAMPLES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,138,90,10
- CONTROL "Reset all variables",IDC_CHK_RESET_VARIABLES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,102,138,90,10
- GROUPBOX "Presets",IDC_STATIC,6,162,192,36
- PUSHBUTTON "Remove all unused stuff",IDC_BTN_CLEANUP_SONG,12,174,96,18
- PUSHBUTTON "Compo cleanup",IDC_BTN_COMPO_CLEANUP,114,174,78,18
+ DEFPUSHBUTTON "OK",IDOK,306,6,60,14
+ PUSHBUTTON "Cancel",IDCANCEL,306,24,60,14
+ CONTROL "Remove unused",IDC_CHK_CLEANUP_PATTERNS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,18,90,10
+ CONTROL "Remove all",IDC_CHK_REMOVE_PATTERNS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,108,18,90,10
+ CONTROL "Rearrange",IDC_CHK_REARRANGE_PATTERNS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,204,18,90,10
+ CONTROL "Merge sequences",IDC_CHK_MERGE_SEQUENCES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,54,90,10
+ CONTROL "Remove all orders",IDC_CHK_REMOVE_ORDERS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,108,54,90,10
+ CONTROL "Remove unused",IDC_CHK_CLEANUP_SAMPLES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,90,90,10
+ CONTROL "Remove all",IDC_CHK_REMOVE_SAMPLES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,108,90,90,10
+ CONTROL "Rearrange",IDC_CHK_REARRANGE_SAMPLES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,204,90,90,10
+ CONTROL "Remove data after loop end",IDC_CHK_OPTIMIZE_SAMPLES,
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,102,108,10
+ CONTROL "Remove unused",IDC_CHK_CLEANUP_INSTRUMENTS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,138,90,10
+ CONTROL "Remove all (convert to samples)",IDC_CHK_REMOVE_INSTRUMENTS,
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,108,138,120,10
+ CONTROL "Remove unused",IDC_CHK_CLEANUP_PLUGINS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,174,90,10
+ CONTROL "Remove all",IDC_CHK_REMOVE_PLUGINS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,108,174,90,10
+ CONTROL "Reset all variables",IDC_CHK_RESET_VARIABLES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,210,90,10
+ PUSHBUTTON "Remove all unused stuff",IDC_BTN_CLEANUP_SONG,18,246,90,18
+ PUSHBUTTON "Compo cleanup",IDC_BTN_COMPO_CLEANUP,120,246,90,18
+ GROUPBOX "Patterns",IDC_STATIC,6,6,294,30
+ GROUPBOX "Orders / Sequences",IDC_STATIC,6,42,294,30
+ GROUPBOX "Samples",IDC_STATIC,6,78,294,42
+ GROUPBOX "Instruments",IDC_STATIC,6,126,294,30
+ GROUPBOX "Plugins",IDC_STATIC,6,162,294,30
+ GROUPBOX "Miscellaneous",IDC_STATIC,6,198,294,30
+ GROUPBOX "Presets",IDC_STATIC,6,234,294,36
END
@@ -84,9 +90,9 @@
IDD_CLEANUP_SONG, DIALOG
BEGIN
LEFTMARGIN, 7
- RIGHTMARGIN, 255
+ RIGHTMARGIN, 363
TOPMARGIN, 7
- BOTTOMMARGIN, 202
+ BOTTOMMARGIN, 274
END
END
#endif // APSTUDIO_INVOKED
Modified: trunk/OpenMPT/mptrack/resource.h
===================================================================
--- trunk/OpenMPT/mptrack/resource.h 2009-10-05 20:51:54 UTC (rev 388)
+++ trunk/OpenMPT/mptrack/resource.h 2009-10-06 12:44:31 UTC (rev 389)
@@ -907,6 +907,7 @@
#define IDC_CHK_REMOVE_SAMPLES 2404
#define IDC_CHK_REMOVE_PLUGINS 2405
#define IDC_CHK_OPTIMIZE_SAMPLES 2406
+#define IDC_CHK_MERGE_SEQUENCES 2408
#define ID_FILE_NEWMOD 32771
#define ID_FILE_NEWXM 32772
#define ID_FILE_NEWS3M 32773
@@ -1151,7 +1152,7 @@
#define _APS_3D_CONTROLS 1
#define _APS_NEXT_RESOURCE_VALUE 522
#define _APS_NEXT_COMMAND_VALUE 59231
-#define _APS_NEXT_CONTROL_VALUE 2407
+#define _APS_NEXT_CONTROL_VALUE 2409
#define _APS_NEXT_SYMED_VALUE 901
#endif
#endif
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sag...@us...> - 2009-10-05 20:52:02
|
Revision: 388
http://modplug.svn.sourceforge.net/modplug/?rev=388&view=rev
Author: saga-games
Date: 2009-10-05 20:51:54 +0000 (Mon, 05 Oct 2009)
Log Message:
-----------
[Imp] Improved cleanup dialog, with new options (remove all *, optimize samples)
Modified Paths:
--------------
trunk/OpenMPT/mptrack/CleanupSong.cpp
trunk/OpenMPT/mptrack/CleanupSong.h
trunk/OpenMPT/mptrack/Mptrack.cpp
trunk/OpenMPT/mptrack/View_pat.cpp
trunk/OpenMPT/mptrack/mptrack.rc
trunk/OpenMPT/mptrack/resource.h
Modified: trunk/OpenMPT/mptrack/CleanupSong.cpp
===================================================================
--- trunk/OpenMPT/mptrack/CleanupSong.cpp 2009-10-05 17:02:19 UTC (rev 387)
+++ trunk/OpenMPT/mptrack/CleanupSong.cpp 2009-10-05 20:51:54 UTC (rev 388)
@@ -18,19 +18,31 @@
// Default checkbox state
bool CModCleanupDlg::m_bCheckBoxes[CU_MAX_CLEANUP_OPTIONS] =
{
- true, true,
- true, true,
- true, false,
- true, false,
+ // remove unused
+ true, true, // pat/smp
+ true, true, // ins/plg
+ // remove all
+ false, false, // pat/ord
+ false, false, // smp/ins
+ false, // plg
+ // misc
+ true, true, // pat/smp
+ true, false, // opt/reset
};
// Checkbox -> Control ID LUT
WORD const CModCleanupDlg::m_nCleanupIDtoDlgID[CU_MAX_CLEANUP_OPTIONS] =
{
- IDC_CHK_CLEANUP_PATTERNS, IDC_CHK_REARRANGE_PATTERNS,
- IDC_CHK_CLEANUP_SAMPLES, IDC_CHK_REARRANGE_SAMPLES,
- IDC_CHK_CLEANUP_INSTRUMENTS, IDC_CHK_REMOVE_INSTRUMENTS,
- IDC_CHK_CLEANUP_PLUGINS, IDC_CHK_SAMPLEPACK,
+ // remove unused
+ IDC_CHK_CLEANUP_PATTERNS, IDC_CHK_CLEANUP_SAMPLES,
+ IDC_CHK_CLEANUP_INSTRUMENTS, IDC_CHK_CLEANUP_PLUGINS,
+ // remove all
+ IDC_CHK_REMOVE_PATTERNS, IDC_CHK_REMOVE_ORDERS,
+ IDC_CHK_REMOVE_SAMPLES, IDC_CHK_REMOVE_INSTRUMENTS,
+ IDC_CHK_REMOVE_PLUGINS,
+ // misc
+ IDC_CHK_REARRANGE_PATTERNS, IDC_CHK_REARRANGE_SAMPLES,
+ IDC_CHK_OPTIMIZE_SAMPLES, IDC_CHK_RESET_VARIABLES,
};
///////////////////////////////////////////////////////////////////////
@@ -38,18 +50,8 @@
BEGIN_MESSAGE_MAP(CModCleanupDlg, CDialog)
//{{AFX_MSG_MAP(CModTypeDlg)
- /*ON_COMMAND(IDC_CHK_CLEANUP_PATTERNS, OnCheckCleanupPatterns)
- ON_COMMAND(IDC_CHK_REARRANGE_PATTERNS, OnCheckRearrangePatterns)
- ON_COMMAND(IDC_CHK_CLEANUP_SAMPLES, OnCheckCleanupSamples)
- ON_COMMAND(IDC_CHK_REARRANGE_SAMPLES, OnCheckRearrangeSamples)
- ON_COMMAND(IDC_CHK_CLEANUP_INSTRUMENTS, OnCheckCleanupInstruments)
- ON_COMMAND(IDC_CHK_REMOVE_INSTRUMENTS, OnCheckRemoveInstruments)
- ON_COMMAND(IDC_CHK_CLEANUP_PLUGINS, OnCheckCleanupPlugins)
- ON_COMMAND(IDC_CHK_SAMPLEPACK, OnCheckCreateSamplepack)*/
-
ON_COMMAND(IDC_BTN_CLEANUP_SONG, OnPresetCleanupSong)
ON_COMMAND(IDC_BTN_COMPO_CLEANUP, OnPresetCompoCleanup)
- // -! NEW_FEATURE#0023
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
@@ -66,7 +68,10 @@
if(pSndFile == nullptr) return FALSE;
GetDlgItem(m_nCleanupIDtoDlgID[CU_CLEANUP_INSTRUMENTS])->EnableWindow((pSndFile->m_nInstruments > 0) ? TRUE :FALSE);
+
GetDlgItem(m_nCleanupIDtoDlgID[CU_REMOVE_INSTRUMENTS])->EnableWindow((pSndFile->m_nInstruments > 0) ? TRUE :FALSE);
+ GetDlgItem(m_nCleanupIDtoDlgID[CU_REMOVE_SAMPLES])->EnableWindow((pSndFile->m_nSamples > 0) ? TRUE :FALSE);
+
GetDlgItem(m_nCleanupIDtoDlgID[CU_REARRANGE_SAMPLES])->EnableWindow((pSndFile->m_nSamples > 1) ? TRUE :FALSE);
return TRUE;
}
@@ -82,25 +87,36 @@
bool bModified = false;
m_pModDoc->ClearLog();
+ // Orders
+ if(m_bCheckBoxes[CU_REMOVE_ORDERS]) bModified |= RemoveAllOrders();
+
// Patterns
+ if(m_bCheckBoxes[CU_REMOVE_PATTERNS]) bModified |= RemoveAllPatterns();
if(m_bCheckBoxes[CU_CLEANUP_PATTERNS]) bModified |= RemoveUnusedPatterns();
if(m_bCheckBoxes[CU_REARRANGE_PATTERNS]) bModified |= RemoveUnusedPatterns(false);
+
// Instruments
if(m_pModDoc->GetSoundFile()->m_nInstruments > 0)
{
+ if(m_bCheckBoxes[CU_REMOVE_INSTRUMENTS]) bModified |= RemoveAllInstruments();
if(m_bCheckBoxes[CU_CLEANUP_INSTRUMENTS]) bModified |= RemoveUnusedInstruments();
- if(m_bCheckBoxes[CU_REMOVE_INSTRUMENTS]) bModified |= RemoveAllInstruments();
}
+
// Samples
+ if(m_bCheckBoxes[CU_REMOVE_SAMPLES]) bModified |= RemoveAllSamples();
if(m_bCheckBoxes[CU_CLEANUP_SAMPLES]) bModified |= RemoveUnusedSamples();
+ if(m_bCheckBoxes[CU_OPTIMIZE_SAMPLES]) bModified |= OptimizeSamples();
if(m_pModDoc->GetSoundFile()->m_nSamples > 1)
{
if(m_bCheckBoxes[CU_REARRANGE_SAMPLES]) bModified |= RearrangeSamples();
}
+
// Plugins
+ if(m_bCheckBoxes[CU_REMOVE_PLUGINS]) bModified |= RemoveAllPlugins();
if(m_bCheckBoxes[CU_CLEANUP_PLUGINS]) bModified |= RemoveUnusedPlugins();
+
// Create samplepack
- if(m_bCheckBoxes[CU_CREATE_SAMPLEPACK]) bModified |= CreateSamplepack();
+ if(m_bCheckBoxes[CU_RESET_VARIABLES]) bModified |= ResetVariables();
if(bModified) m_pModDoc->SetModified();
m_pModDoc->UpdateAllViews(NULL, HINT_MODTYPE|HINT_MODSEQUENCE|HINT_MODGENERAL);
@@ -120,26 +136,42 @@
void CModCleanupDlg::OnPresetCleanupSong()
//----------------------------------------
{
+ // remove unused
CheckDlgButton(IDC_CHK_CLEANUP_PATTERNS, MF_CHECKED);
- CheckDlgButton(IDC_CHK_REARRANGE_PATTERNS, MF_CHECKED);
CheckDlgButton(IDC_CHK_CLEANUP_SAMPLES, MF_CHECKED);
- CheckDlgButton(IDC_CHK_REARRANGE_SAMPLES, MF_CHECKED);
CheckDlgButton(IDC_CHK_CLEANUP_INSTRUMENTS, MF_CHECKED);
+ CheckDlgButton(IDC_CHK_CLEANUP_PLUGINS, MF_CHECKED);
+ // remove all
+ CheckDlgButton(IDC_CHK_REMOVE_PATTERNS, MF_UNCHECKED);
+ CheckDlgButton(IDC_CHK_REMOVE_ORDERS, MF_UNCHECKED);
+ CheckDlgButton(IDC_CHK_REMOVE_SAMPLES, MF_UNCHECKED);
CheckDlgButton(IDC_CHK_REMOVE_INSTRUMENTS, MF_UNCHECKED);
- CheckDlgButton(IDC_CHK_CLEANUP_PLUGINS, MF_CHECKED);
+ CheckDlgButton(IDC_CHK_REMOVE_PLUGINS, MF_UNCHECKED);
+ // misc
+ CheckDlgButton(IDC_CHK_REARRANGE_PATTERNS, MF_CHECKED);
+ CheckDlgButton(IDC_CHK_REARRANGE_SAMPLES, MF_CHECKED);
+ CheckDlgButton(IDC_CHK_OPTIMIZE_SAMPLES, MF_CHECKED);
CheckDlgButton(IDC_CHK_SAMPLEPACK, MF_UNCHECKED);
}
void CModCleanupDlg::OnPresetCompoCleanup()
//----------------------------------------
{
+ // remove unused
CheckDlgButton(IDC_CHK_CLEANUP_PATTERNS, MF_UNCHECKED);
- CheckDlgButton(IDC_CHK_REARRANGE_PATTERNS, MF_UNCHECKED);
CheckDlgButton(IDC_CHK_CLEANUP_SAMPLES, MF_UNCHECKED);
- CheckDlgButton(IDC_CHK_REARRANGE_SAMPLES, MF_CHECKED);
CheckDlgButton(IDC_CHK_CLEANUP_INSTRUMENTS, MF_UNCHECKED);
- CheckDlgButton(IDC_CHK_REMOVE_INSTRUMENTS, MF_UNCHECKED);
CheckDlgButton(IDC_CHK_CLEANUP_PLUGINS, MF_UNCHECKED);
+ // remove all
+ CheckDlgButton(IDC_CHK_REMOVE_PATTERNS, MF_CHECKED);
+ CheckDlgButton(IDC_CHK_REMOVE_ORDERS, MF_CHECKED);
+ CheckDlgButton(IDC_CHK_REMOVE_SAMPLES, MF_UNCHECKED);
+ CheckDlgButton(IDC_CHK_REMOVE_INSTRUMENTS, MF_CHECKED);
+ CheckDlgButton(IDC_CHK_REMOVE_PLUGINS, MF_CHECKED);
+ // misc
+ CheckDlgButton(IDC_CHK_REARRANGE_PATTERNS, MF_UNCHECKED);
+ CheckDlgButton(IDC_CHK_REARRANGE_SAMPLES, MF_CHECKED);
+ CheckDlgButton(IDC_CHK_OPTIMIZE_SAMPLES, MF_UNCHECKED);
CheckDlgButton(IDC_CHK_SAMPLEPACK, MF_CHECKED);
}
@@ -235,7 +267,7 @@
if ((bRemove) && (bWaste))
{
EndWaitCursor();
- wsprintf(s, "%d pattern(s) present in file, but not used in the song\nDo you want to reorder the sequence list and remove these patterns?", bWaste);
+ wsprintf(s, "%d pattern%s present in file, but not used in the song\nDo you want to reorder the sequence list and remove these patterns?", bWaste, (bWaste == 1) ? "" : "s");
if (m_wParent->MessageBox(s, "Pattern Cleanup", MB_YESNO) != IDYES) return false;
BeginWaitCursor();
}
@@ -313,7 +345,7 @@
m_pModDoc->ClearUndo();
if (nPatRemoved)
{
- wsprintf(s, "%d pattern(s) removed.\n", nPatRemoved);
+ wsprintf(s, "%d pattern%s removed.\n", nPatRemoved, (nPatRemoved == 1) ? "" : "s");
m_pModDoc->AddToLog(s);
}
return true;
@@ -331,7 +363,7 @@
CHAR s[512];
BOOL bIns[MAX_SAMPLES];
- UINT nExt = 0, nLoopOpt = 0;
+ UINT nExt = 0;
UINT nRemoved = 0;
BeginWaitCursor();
@@ -391,8 +423,8 @@
EndWaitCursor();
if (nExt && !((pSndFile->m_nType & MOD_TYPE_IT) && (pSndFile->m_dwSongFlags&SONG_ITPROJECT)))
{ //We don't remove an instrument's unused samples in an ITP.
- wsprintf(s, "OpenMPT detected %d sample(s) referenced by an instrument,\n"
- "but not used in the song. Do you want to remove them ?", nExt);
+ wsprintf(s, "OpenMPT detected %d sample%s referenced by an instrument,\n"
+ "but not used in the song. Do you want to remove them ?", nExt, (nExt == 1) ? "" : "s");
if (::MessageBox(NULL, s, "Sample Cleanup", MB_YESNO | MB_ICONQUESTION) == IDYES)
{
for (SAMPLEINDEX j = 1; j < MAX_SAMPLES; j++)
@@ -406,48 +438,53 @@
nRemoved++;
}
}
+ wsprintf(s, "%d unused sample%s removed\n" ,nRemoved, (nRemoved == 1) ? "" : "s");
+ m_pModDoc->AddToLog(s);
+ return true;
}
}
- for (SAMPLEINDEX ilo=1; ilo<=pSndFile->m_nSamples; ilo++) if (pSndFile->Samples[ilo].pSample)
+ return false;
+}
+
+
+// Remove unused sample data
+bool CModCleanupDlg::OptimizeSamples()
+//------------------------------------
+{
+ CSoundFile *pSndFile = m_pModDoc->GetSoundFile();
+ if(pSndFile == nullptr) return false;
+
+ UINT nLoopOpt = 0;
+
+ for (SAMPLEINDEX nSmp=1; nSmp <= pSndFile->m_nSamples; nSmp++)
{
- if ((pSndFile->Samples[ilo].uFlags & CHN_LOOP)
- && (pSndFile->Samples[ilo].nLength > pSndFile->Samples[ilo].nLoopEnd + 2)) nLoopOpt++;
+ if(pSndFile->Samples[nSmp].pSample && (pSndFile->Samples[nSmp].uFlags & CHN_LOOP)
+ && (pSndFile->Samples[nSmp].nLength > pSndFile->Samples[nSmp].nLoopEnd + 2)) nLoopOpt++;
}
- if (nLoopOpt)
+ if (nLoopOpt == 0) return false;
+
+ CHAR s[512];
+ wsprintf(s, "OpenMPT detected %d sample%s with unused data after the loop end point,\n"
+ "Do you want to optimize it, and remove this unused data?", nLoopOpt, (nLoopOpt == 1) ? "" : "s");
+ if (::MessageBox(NULL, s, "Sample Optimization", MB_YESNO | MB_ICONQUESTION) == IDYES)
{
- wsprintf(s, "OpenMPT detected %d sample(s) with unused data after the loop end point,\n"
- "Do you want to optimize it, and remove this unused data ?", nLoopOpt);
- if (::MessageBox(NULL, s, "Sample Cleanup", MB_YESNO | MB_ICONQUESTION) == IDYES)
+ for (SAMPLEINDEX nSmp = 1; nSmp <= pSndFile->m_nSamples; nSmp++)
{
- for (UINT j=1; j<=pSndFile->m_nSamples; j++)
+ if ((pSndFile->Samples[nSmp].uFlags & CHN_LOOP)
+ && (pSndFile->Samples[nSmp].nLength > pSndFile->Samples[nSmp].nLoopEnd + 2))
{
- if ((pSndFile->Samples[j].uFlags & CHN_LOOP)
- && (pSndFile->Samples[j].nLength > pSndFile->Samples[j].nLoopEnd + 2))
- {
- UINT lmax = pSndFile->Samples[j].nLoopEnd + 2;
- if ((lmax < pSndFile->Samples[j].nLength) && (lmax >= 16)) pSndFile->Samples[j].nLength = lmax;
- }
+ UINT lmax = pSndFile->Samples[nSmp].nLoopEnd + 2;
+ if ((lmax < pSndFile->Samples[nSmp].nLength) && (lmax >= 16)) pSndFile->Samples[nSmp].nLength = lmax;
}
- } else nLoopOpt = 0;
- }
- if ((nRemoved) || (nLoopOpt))
- {
- if (nRemoved)
- {
- wsprintf(s, "%d unused sample(s) removed\n" ,nRemoved);
- m_pModDoc->AddToLog(s);
}
- if (nLoopOpt)
- {
- wsprintf(s, "%d sample loop(s) optimized\n" ,nLoopOpt);
- m_pModDoc->AddToLog(s);
- }
+ wsprintf(s, "%d sample loop%s optimized\n" ,nLoopOpt, (nLoopOpt == 1) ? "" : "s");
+ m_pModDoc->AddToLog(s);
return true;
}
- return false;
+
+ return false;
}
-
// Rearrange sample list
bool CModCleanupDlg::RearrangeSamples()
//-------------------------------------
@@ -478,16 +515,16 @@
if(!nRemap)
return false;
- BEGIN_CRITICAL();
-
// Now, move everything around
for(SAMPLEINDEX i = 1; i <= pSndFile->m_nSamples; i++)
{
if(nSampleMap[i] != i)
{
// This gotta be moved
+ BEGIN_CRITICAL();
pSndFile->MoveSample(i, nSampleMap[i]);
pSndFile->Samples[i].pSample = nullptr;
+ END_CRITICAL();
if(nSampleMap[i] > 0) strcpy(pSndFile->m_szNames[nSampleMap[i]], pSndFile->m_szNames[i]);
memset(pSndFile->m_szNames[i], 0, sizeof(pSndFile->m_szNames[i]));
@@ -517,8 +554,6 @@
pSndFile->m_nSamples -= nRemap;
- END_CRITICAL();
-
return true;
}
@@ -626,7 +661,7 @@
}
if (nRemoved)
{
- wsprintf(s, "%d unused instrument(s) removed\n", nRemoved);
+ wsprintf(s, "%d unused instrument%s removed\n", nRemoved, (nRemoved == 1) ? "" : "s");
m_pModDoc->AddToLog(s);
return true;
}
@@ -634,42 +669,6 @@
}
-// Remove all instruments
-bool CModCleanupDlg::RemoveAllInstruments(bool bConfirm)
-//-----------------------------------------------
-{
- CSoundFile *pSndFile = m_pModDoc->GetSoundFile();
- if(pSndFile == nullptr) return false;
-
- if (!pSndFile->m_nInstruments)
- return false;
-
- char removeSamples = -1;
- if(bConfirm)
- {
- if (CMainFrame::GetMainFrame()->MessageBox("This will remove all the instruments in the song,\n"
- "Do you want to continue?", "Removing all instruments", MB_YESNO | MB_ICONQUESTION) != IDYES) return false;
- if (CMainFrame::GetMainFrame()->MessageBox("Do you want to convert all instruments to samples ?\n",
- "Removing all instruments", MB_YESNO | MB_ICONQUESTION) == IDYES)
- {
- m_pModDoc->ConvertInstrumentsToSamples();
- }
-
- if (::MessageBox(NULL, "Remove samples associated with an instrument if they are unused?", "Removing all instruments", MB_YESNO | MB_ICONQUESTION) == IDYES) {
- removeSamples = 1;
- }
- }
-
- for (INSTRUMENTINDEX i = 1; i <= pSndFile->m_nInstruments; i++)
- {
- pSndFile->DestroyInstrument(i, removeSamples);
- }
-
- pSndFile->m_nInstruments = 0;
- return true;
-}
-
-
// Remove ununsed plugins
bool CModCleanupDlg::RemoveUnusedPlugins()
//--------------------------------------
@@ -719,15 +718,15 @@
}
-// Turn module into samplepack (convert to IT, remove patterns, etc.)
-bool CModCleanupDlg::CreateSamplepack()
-//-------------------------------------
+// Reset variables (convert to IT, reset global/smp/ins vars, etc.)
+bool CModCleanupDlg::ResetVariables()
+//-----------------------------------
{
CSoundFile *pSndFile = m_pModDoc->GetSoundFile();
if(pSndFile == nullptr) return false;
//jojo.compocleanup
- if(::MessageBox(NULL, TEXT("WARNING: Turning this module into as samplepack means that OpenMPT will convert the module to IT format, remove all patterns and reset song, sample and instrument attributes to default values. Continue?"), TEXT("Samplepack creation"), MB_YESNO | MB_ICONWARNING) == IDNO)
+ if(::MessageBox(NULL, TEXT("WARNING: OpenMPT will convert the module to IT format and reset all song, sample and instrument attributes to default values. Continue?"), TEXT("Resetting variables"), MB_YESNO | MB_ICONWARNING) == IDNO)
return false;
// Stop play.
@@ -742,15 +741,6 @@
pSndFile->m_nTempoMode = tempo_mode_classic;
pSndFile->m_dwSongFlags = SONG_LINEARSLIDES | SONG_EXFILTERRANGE;
- // clear order list
- pSndFile->Order.Init();
- pSndFile->Order[0] = 0;
-
- // remove all patterns
- pSndFile->Patterns.Init();
- pSndFile->Patterns.Insert(0, 64);
- pSndFile->SetCurrentOrder(0);
-
// Global vars
pSndFile->m_nDefaultTempo = 125;
pSndFile->m_nDefaultSpeed = 6;
@@ -759,43 +749,27 @@
pSndFile->m_nVSTiVolume = 48;
pSndFile->m_nRestartPos = 0;
- // Set 4 default channels.
- pSndFile->ReArrangeChannels(vector<CHANNELINDEX>(4, MAX_BASECHANNELS));
-
- // remove plugs
- bool keepMask[MAX_MIXPLUGINS]; memset(keepMask, 0, sizeof(keepMask));
- m_pModDoc->RemovePlugs(keepMask);
-
- // instruments
- if(pSndFile->m_nInstruments && ::MessageBox(NULL, "Keep instruments?", TEXT("Samplepack creation"), MB_YESNO | MB_ICONQUESTION) == IDNO)
+ // reset instruments (if there are any)
+ for(INSTRUMENTINDEX i = 1; i <= pSndFile->m_nInstruments; i++)
{
- // remove instruments
- RemoveAllInstruments(false);
- }
- else
- {
- // reset instruments (if there are any)
- for(INSTRUMENTINDEX i = 1; i <= pSndFile->m_nInstruments; i++)
- {
- pSndFile->Instruments[i]->nFadeOut = 256;
- pSndFile->Instruments[i]->nGlobalVol = 64;
- pSndFile->Instruments[i]->nPan = 128;
- pSndFile->Instruments[i]->dwFlags &= ~ENV_SETPANNING;
- pSndFile->Instruments[i]->nMixPlug = 0;
+ pSndFile->Instruments[i]->nFadeOut = 256;
+ pSndFile->Instruments[i]->nGlobalVol = 64;
+ pSndFile->Instruments[i]->nPan = 128;
+ pSndFile->Instruments[i]->dwFlags &= ~ENV_SETPANNING;
+ pSndFile->Instruments[i]->nMixPlug = 0;
- pSndFile->Instruments[i]->nVolSwing = 0;
- pSndFile->Instruments[i]->nPanSwing = 0;
- pSndFile->Instruments[i]->nCutSwing = 0;
- pSndFile->Instruments[i]->nResSwing = 0;
+ pSndFile->Instruments[i]->nVolSwing = 0;
+ pSndFile->Instruments[i]->nPanSwing = 0;
+ pSndFile->Instruments[i]->nCutSwing = 0;
+ pSndFile->Instruments[i]->nResSwing = 0;
- //might be a good idea to leave those enabled...
- /*
- pSndFile->Instruments[i]->dwFlags &= ~ENV_VOLUME;
- pSndFile->Instruments[i]->dwFlags &= ~ENV_PANNING;
- pSndFile->Instruments[i]->dwFlags &= ~ENV_PITCH;
- pSndFile->Instruments[i]->dwFlags &= ~ENV_FILTER;
- */
- }
+ //might be a good idea to leave those enabled...
+ /*
+ pSndFile->Instruments[i]->dwFlags &= ~ENV_VOLUME;
+ pSndFile->Instruments[i]->dwFlags &= ~ENV_PANNING;
+ pSndFile->Instruments[i]->dwFlags &= ~ENV_PITCH;
+ pSndFile->Instruments[i]->dwFlags &= ~ENV_FILTER;
+ */
}
// reset samples
@@ -811,3 +785,94 @@
return true;
}
+
+// Remove all patterns
+bool CModCleanupDlg::RemoveAllPatterns()
+//--------------------------------------
+{
+ CSoundFile *pSndFile = m_pModDoc->GetSoundFile();
+ if(pSndFile == nullptr) return false;
+
+ if (pSndFile->Patterns.Size() == 0) return false;
+ pSndFile->Patterns.Init();
+ pSndFile->Patterns.Insert(0, 64);
+ pSndFile->SetCurrentOrder(0);
+ return true;
+}
+
+// Remove all orders
+bool CModCleanupDlg::RemoveAllOrders()
+//------------------------------------
+{
+ CSoundFile *pSndFile = m_pModDoc->GetSoundFile();
+ if(pSndFile == nullptr) return false;
+
+ pSndFile->Order.Init();
+ pSndFile->Order.SetSequence(0);
+ pSndFile->Order[0] = 0;
+ pSndFile->SetCurrentOrder(0);
+ return true;
+}
+
+// Remove all samples
+bool CModCleanupDlg::RemoveAllSamples()
+//------------------------------------
+{
+ CSoundFile *pSndFile = m_pModDoc->GetSoundFile();
+ if(pSndFile == nullptr) return false;
+
+ if (pSndFile->m_nSamples == 0) return false;
+ for (SAMPLEINDEX nSmp = 1; nSmp <= pSndFile->m_nSamples; nSmp++)
+ {
+ if (pSndFile->Samples[nSmp].pSample)
+ {
+ BEGIN_CRITICAL();
+ pSndFile->DestroySample(nSmp);
+ END_CRITICAL();
+ }
+ }
+ ctrlSmp::ResetSamples(*pSndFile, ctrlSmp::SmpResetInit);
+ pSndFile->m_nSamples = 1;
+ return true;
+}
+
+// Remove all instruments
+bool CModCleanupDlg::RemoveAllInstruments(bool bConfirm)
+//------------------------------------------------------
+{
+ CSoundFile *pSndFile = m_pModDoc->GetSoundFile();
+ if(pSndFile == nullptr) return false;
+
+ if (pSndFile->m_nInstruments == 0) return false;
+
+ char removeSamples = -1;
+ if(bConfirm)
+ {
+ if (CMainFrame::GetMainFrame()->MessageBox("Do you want to convert all instruments to samples ?\n",
+ "Removing all instruments", MB_YESNO | MB_ICONQUESTION) == IDYES)
+ {
+ m_pModDoc->ConvertInstrumentsToSamples();
+ }
+
+ if (::MessageBox(NULL, "Remove samples associated with an instrument if they are unused?", "Removing all instruments", MB_YESNO | MB_ICONQUESTION) == IDYES) {
+ removeSamples = 1;
+ }
+ }
+
+ for (INSTRUMENTINDEX i = 1; i <= pSndFile->m_nInstruments; i++)
+ {
+ pSndFile->DestroyInstrument(i, removeSamples);
+ }
+
+ pSndFile->m_nInstruments = 0;
+ return true;
+}
+
+// Remove all plugins
+bool CModCleanupDlg::RemoveAllPlugins()
+//-------------------------------------
+{
+ bool keepMask[MAX_MIXPLUGINS]; memset(keepMask, false, sizeof(keepMask));
+ m_pModDoc->RemovePlugs(keepMask);
+ return true;
+}
Modified: trunk/OpenMPT/mptrack/CleanupSong.h
===================================================================
--- trunk/OpenMPT/mptrack/CleanupSong.h 2009-10-05 17:02:19 UTC (rev 387)
+++ trunk/OpenMPT/mptrack/CleanupSong.h 2009-10-05 20:51:54 UTC (rev 388)
@@ -10,14 +10,23 @@
enum ENUM_CLEANUP_OPTIONS
{
+ // remove unused
CU_CLEANUP_PATTERNS = 0,
- CU_REARRANGE_PATTERNS,
CU_CLEANUP_SAMPLES,
- CU_REARRANGE_SAMPLES,
CU_CLEANUP_INSTRUMENTS,
+ CU_CLEANUP_PLUGINS,
+ // remove all
+ CU_REMOVE_PATTERNS,
+ CU_REMOVE_ORDERS,
+ CU_REMOVE_SAMPLES,
CU_REMOVE_INSTRUMENTS,
- CU_CLEANUP_PLUGINS,
- CU_CREATE_SAMPLEPACK,
+ CU_REMOVE_PLUGINS,
+ // misc
+ CU_REARRANGE_PATTERNS,
+ CU_REARRANGE_SAMPLES,
+ CU_OPTIMIZE_SAMPLES,
+ CU_RESET_VARIABLES,
+
CU_MAX_CLEANUP_OPTIONS
};
@@ -34,11 +43,18 @@
// Actual cleanup implementations
bool RemoveUnusedPatterns(bool bRemove = true); // Remove unused patterns / rearrange patterns
bool RemoveUnusedSamples(); // Remove unused samples
- bool RearrangeSamples(); // Rearrange sample list
bool RemoveUnusedInstruments(); // Remove unused instruments
- bool RemoveAllInstruments(bool bConfirm = true); // Remove all instruments
bool RemoveUnusedPlugins(); // Remove ununsed plugins
- bool CreateSamplepack(); // Turn module into samplepack (convert to IT, remove patterns, etc.)
+ // Zap
+ bool RemoveAllPatterns();
+ bool RemoveAllOrders();
+ bool RemoveAllSamples();
+ bool RemoveAllInstruments(bool bConfirm = true);
+ bool RemoveAllPlugins();
+ // Misc
+ bool RearrangeSamples(); // Rearrange sample list
+ bool OptimizeSamples(); // Remove unused sample data
+ bool ResetVariables(); // Turn module into samplepack (convert to IT, remove patterns, etc.)
public:
CModCleanupDlg(CModDoc *pModDoc, CWnd *parent):CDialog(IDD_CLEANUP_SONG, parent) { m_pModDoc = pModDoc; m_wParent = parent; }
@@ -51,15 +67,6 @@
//}}AFX_VIRTUAL
//{{AFX_MSG(CModCleanupDlg)
- /*afx_msg void OnCheckCleanupPatterns();
- afx_msg void OnCheckRearrangePatterns();
- afx_msg void OnCheckCleanupSamples();
- afx_msg void OnCheckRearrangeSamples();
- afx_msg void OnCheckCleanupInstruments();
- afx_msg void OnCheckRemoveInstruments();
- afx_msg void OnCheckCleanupPlugins();
- afx_msg void OnCheckCreateSamplepack();*/
-
afx_msg void OnPresetCleanupSong();
afx_msg void OnPresetCompoCleanup();
//}}AFX_MSG
Modified: trunk/OpenMPT/mptrack/Mptrack.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Mptrack.cpp 2009-10-05 17:02:19 UTC (rev 387)
+++ trunk/OpenMPT/mptrack/Mptrack.cpp 2009-10-05 20:51:54 UTC (rev 388)
@@ -93,8 +93,8 @@
"no more documents can be opened or if the file type was not "
"recognised. If the former is true, it's "
"recommended to close some documents as otherwise crash is likely"
- "(currently there are %d document(s) open).")),
- lpszPathName, nOdc);
+ "(currently there %s %d document%s open).")),
+ lpszPathName, (nOdc == 1) ? "is" : "are", nOdc, (nOdc == 1) ? "" : "s");
AfxMessageBox(str);
}
}
Modified: trunk/OpenMPT/mptrack/View_pat.cpp
===================================================================
--- trunk/OpenMPT/mptrack/View_pat.cpp 2009-10-05 17:02:19 UTC (rev 387)
+++ trunk/OpenMPT/mptrack/View_pat.cpp 2009-10-05 20:51:54 UTC (rev 388)
@@ -5133,7 +5133,7 @@
{
const uint32 minutes = static_cast<uint32>(t/60.0);
const float seconds = t - minutes*60;
- msg.Format("Estimate for playback time at order %d(pattern %d), row %d: %d minute(s) %.2f seconds", currentOrder, m_nPattern, m_nRow, minutes, seconds);
+ msg.Format("Estimate for playback time at order %d(pattern %d), row %d: %d minute%s %.2f seconds", currentOrder, m_nPattern, m_nRow, minutes, (minutes == 1) ? "" : "s", seconds);
}
}
else
Modified: trunk/OpenMPT/mptrack/mptrack.rc
===================================================================
--- trunk/OpenMPT/mptrack/mptrack.rc 2009-10-05 17:02:19 UTC (rev 387)
+++ trunk/OpenMPT/mptrack/mptrack.rc 2009-10-05 20:51:54 UTC (rev 388)
@@ -36,27 +36,32 @@
LTEXT "The following problems have been encountered when loading this module:",IDC_STATIC,6,6,237,8
END
-IDD_CLEANUP_SONG DIALOGEX 0, 0, 298, 161
+IDD_CLEANUP_SONG DIALOGEX 0, 0, 262, 209
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Cleanup"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
- DEFPUSHBUTTON "OK",IDOK,240,6,50,14
- PUSHBUTTON "Cancel",IDCANCEL,240,24,50,14
- GROUPBOX "Items to be cleaned up",IDC_STATIC,6,6,228,90
- CONTROL "Remove unused patterns",IDC_CHK_CLEANUP_PATTERNS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,24,102,12
- CONTROL "Rearrange patterns",IDC_CHK_REARRANGE_PATTERNS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,126,24,102,12
- CONTROL "Remove unused samples",IDC_CHK_CLEANUP_SAMPLES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,42,102,12
- CONTROL "Rearrange samples",IDC_CHK_REARRANGE_SAMPLES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,126,42,102,12
- CONTROL "Remove unused instruments",IDC_CHK_CLEANUP_INSTRUMENTS,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,60,102,12
- CONTROL "Remove all instruments",IDC_CHK_REMOVE_INSTRUMENTS,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,126,60,102,12
- CONTROL "Remove unused plugins",IDC_CHK_CLEANUP_PLUGINS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,78,102,12
- CONTROL "Turn into samplepack",IDC_CHK_SAMPLEPACK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,126,78,102,12
- GROUPBOX "Presets",IDC_STATIC,6,102,228,48
- PUSHBUTTON "Remove all unused stuff",IDC_BTN_CLEANUP_SONG,18,120,96,18
- PUSHBUTTON "Compo cleanup",IDC_BTN_COMPO_CLEANUP,126,120,96,18
+ DEFPUSHBUTTON "OK",IDOK,204,6,50,14
+ PUSHBUTTON "Cancel",IDCANCEL,204,24,50,14
+ GROUPBOX "Remove unused...",IDC_STATIC,6,6,192,42
+ CONTROL "Patterns",IDC_CHK_CLEANUP_PATTERNS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,18,90,10
+ CONTROL "Samples",IDC_CHK_CLEANUP_SAMPLES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,102,18,90,10
+ CONTROL "Instruments",IDC_CHK_CLEANUP_INSTRUMENTS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,30,90,10
+ CONTROL "Plugins",IDC_CHK_CLEANUP_PLUGINS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,102,30,90,10
+ GROUPBOX "Remove all...",IDC_STATIC,6,54,192,54
+ CONTROL "Patterns",IDC_CHK_REMOVE_PATTERNS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,66,90,10
+ CONTROL "Orders",IDC_CHK_REMOVE_ORDERS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,102,66,90,10
+ CONTROL "Samples",IDC_CHK_REMOVE_SAMPLES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,78,90,10
+ CONTROL "Instruments",IDC_CHK_REMOVE_INSTRUMENTS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,102,78,90,10
+ CONTROL "Plugins",IDC_CHK_REMOVE_PLUGINS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,90,90,10
+ GROUPBOX "Misc.",IDC_STATIC,6,114,192,42
+ CONTROL "Rearrange patterns",IDC_CHK_REARRANGE_PATTERNS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,126,90,10
+ CONTROL "Rearrange samples",IDC_CHK_REARRANGE_SAMPLES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,102,126,90,10
+ CONTROL "Optimize sample loops",IDC_CHK_OPTIMIZE_SAMPLES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,138,90,10
+ CONTROL "Reset all variables",IDC_CHK_RESET_VARIABLES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,102,138,90,10
+ GROUPBOX "Presets",IDC_STATIC,6,162,192,36
+ PUSHBUTTON "Remove all unused stuff",IDC_BTN_CLEANUP_SONG,12,174,96,18
+ PUSHBUTTON "Compo cleanup",IDC_BTN_COMPO_CLEANUP,114,174,78,18
END
@@ -79,9 +84,9 @@
IDD_CLEANUP_SONG, DIALOG
BEGIN
LEFTMARGIN, 7
- RIGHTMARGIN, 291
+ RIGHTMARGIN, 255
TOPMARGIN, 7
- BOTTOMMARGIN, 154
+ BOTTOMMARGIN, 202
END
END
#endif // APSTUDIO_INVOKED
Modified: trunk/OpenMPT/mptrack/resource.h
===================================================================
--- trunk/OpenMPT/mptrack/resource.h 2009-10-05 17:02:19 UTC (rev 387)
+++ trunk/OpenMPT/mptrack/resource.h 2009-10-05 20:51:54 UTC (rev 388)
@@ -899,8 +899,14 @@
#define IDC_CHK_REARRANGE_SAMPLES 2397
#define IDC_CHK_REMOVE_INSTRUMENTS 2398
#define IDC_CHK_SAMPLEPACK 2399
+#define IDC_CHK_RESET_VARIABLES 2399
#define IDC_BTN_CLEANUP_SONG 2400
#define IDC_BTN_COMPO_CLEANUP 2401
+#define IDC_CHK_REMOVE_ORDERS 2402
+#define IDC_CHK_REMOVE_PATTERNS 2403
+#define IDC_CHK_REMOVE_SAMPLES 2404
+#define IDC_CHK_REMOVE_PLUGINS 2405
+#define IDC_CHK_OPTIMIZE_SAMPLES 2406
#define ID_FILE_NEWMOD 32771
#define ID_FILE_NEWXM 32772
#define ID_FILE_NEWS3M 32773
@@ -1145,7 +1151,7 @@
#define _APS_3D_CONTROLS 1
#define _APS_NEXT_RESOURCE_VALUE 522
#define _APS_NEXT_COMMAND_VALUE 59231
-#define _APS_NEXT_CONTROL_VALUE 2402
+#define _APS_NEXT_CONTROL_VALUE 2407
#define _APS_NEXT_SYMED_VALUE 901
#endif
#endif
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sag...@us...> - 2009-10-05 17:02:33
|
Revision: 387
http://modplug.svn.sourceforge.net/modplug/?rev=387&view=rev
Author: saga-games
Date: 2009-10-05 17:02:19 +0000 (Mon, 05 Oct 2009)
Log Message:
-----------
[Fix] PSM16 Loader: It was possible to load corrupted modules with > MAX_BASECHANNELS channels (up to 0xFFFF).
[Fix] Instrument tab: Update plugin list properly when cleaning up plugins while being on the plugin tab (possibly also improves instrument tab behaviour when working with multiple windows)
[Imp] Cleanup: Moved all cleanup functions to a separate sourcecode file, moved cleanup functions from a submenu to an own dialog
Modified Paths:
--------------
trunk/OpenMPT/mptrack/Ctrl_ins.cpp
trunk/OpenMPT/mptrack/Ctrl_ins.h
trunk/OpenMPT/mptrack/Moddoc.cpp
trunk/OpenMPT/mptrack/Moddoc.h
trunk/OpenMPT/mptrack/Modedit.cpp
trunk/OpenMPT/mptrack/dlg_misc.cpp
trunk/OpenMPT/mptrack/mptrack.rc
trunk/OpenMPT/mptrack/mptrack.vcproj
trunk/OpenMPT/mptrack/mptrack_08.vcproj
trunk/OpenMPT/mptrack/resource.h
trunk/OpenMPT/soundlib/Load_psm.cpp
Added Paths:
-----------
trunk/OpenMPT/mptrack/CleanupSong.cpp
trunk/OpenMPT/mptrack/CleanupSong.h
Added: trunk/OpenMPT/mptrack/CleanupSong.cpp
===================================================================
--- trunk/OpenMPT/mptrack/CleanupSong.cpp (rev 0)
+++ trunk/OpenMPT/mptrack/CleanupSong.cpp 2009-10-05 17:02:19 UTC (rev 387)
@@ -0,0 +1,813 @@
+/*
+ *
+ * CleanupSong.cpp
+ * ---------------
+ * Purpose: Interface for cleaning up modules (rearranging, removing unused items)
+ *
+ * Authors: Olivier Lapicque
+ * OpenMPT Devs
+ *
+ */
+
+#include "stdafx.h"
+#include "moddoc.h"
+#include "Mainfrm.h"
+#include "modsmp_ctrl.h"
+#include "CleanupSong.h"
+
+// Default checkbox state
+bool CModCleanupDlg::m_bCheckBoxes[CU_MAX_CLEANUP_OPTIONS] =
+{
+ true, true,
+ true, true,
+ true, false,
+ true, false,
+};
+
+// Checkbox -> Control ID LUT
+WORD const CModCleanupDlg::m_nCleanupIDtoDlgID[CU_MAX_CLEANUP_OPTIONS] =
+{
+ IDC_CHK_CLEANUP_PATTERNS, IDC_CHK_REARRANGE_PATTERNS,
+ IDC_CHK_CLEANUP_SAMPLES, IDC_CHK_REARRANGE_SAMPLES,
+ IDC_CHK_CLEANUP_INSTRUMENTS, IDC_CHK_REMOVE_INSTRUMENTS,
+ IDC_CHK_CLEANUP_PLUGINS, IDC_CHK_SAMPLEPACK,
+};
+
+///////////////////////////////////////////////////////////////////////
+// CModCleanupDlg
+
+BEGIN_MESSAGE_MAP(CModCleanupDlg, CDialog)
+ //{{AFX_MSG_MAP(CModTypeDlg)
+ /*ON_COMMAND(IDC_CHK_CLEANUP_PATTERNS, OnCheckCleanupPatterns)
+ ON_COMMAND(IDC_CHK_REARRANGE_PATTERNS, OnCheckRearrangePatterns)
+ ON_COMMAND(IDC_CHK_CLEANUP_SAMPLES, OnCheckCleanupSamples)
+ ON_COMMAND(IDC_CHK_REARRANGE_SAMPLES, OnCheckRearrangeSamples)
+ ON_COMMAND(IDC_CHK_CLEANUP_INSTRUMENTS, OnCheckCleanupInstruments)
+ ON_COMMAND(IDC_CHK_REMOVE_INSTRUMENTS, OnCheckRemoveInstruments)
+ ON_COMMAND(IDC_CHK_CLEANUP_PLUGINS, OnCheckCleanupPlugins)
+ ON_COMMAND(IDC_CHK_SAMPLEPACK, OnCheckCreateSamplepack)*/
+
+ ON_COMMAND(IDC_BTN_CLEANUP_SONG, OnPresetCleanupSong)
+ ON_COMMAND(IDC_BTN_COMPO_CLEANUP, OnPresetCompoCleanup)
+ // -! NEW_FEATURE#0023
+ //}}AFX_MSG_MAP
+END_MESSAGE_MAP()
+
+BOOL CModCleanupDlg::OnInitDialog()
+//---------------------------------
+{
+ CDialog::OnInitDialog();
+ for(int i = 0; i < CU_MAX_CLEANUP_OPTIONS; i++)
+ {
+ CheckDlgButton(m_nCleanupIDtoDlgID[i], (m_bCheckBoxes[i]) ? MF_CHECKED : MF_UNCHECKED);
+ }
+
+ CSoundFile *pSndFile = m_pModDoc->GetSoundFile();
+ if(pSndFile == nullptr) return FALSE;
+
+ GetDlgItem(m_nCleanupIDtoDlgID[CU_CLEANUP_INSTRUMENTS])->EnableWindow((pSndFile->m_nInstruments > 0) ? TRUE :FALSE);
+ GetDlgItem(m_nCleanupIDtoDlgID[CU_REMOVE_INSTRUMENTS])->EnableWindow((pSndFile->m_nInstruments > 0) ? TRUE :FALSE);
+ GetDlgItem(m_nCleanupIDtoDlgID[CU_REARRANGE_SAMPLES])->EnableWindow((pSndFile->m_nSamples > 1) ? TRUE :FALSE);
+ return TRUE;
+}
+
+void CModCleanupDlg::OnOK()
+//-------------------------
+{
+ for(int i = 0; i < CU_MAX_CLEANUP_OPTIONS; i++)
+ {
+ m_bCheckBoxes[i] = IsDlgButtonChecked(m_nCleanupIDtoDlgID[i]) ? true : false;
+ }
+
+ bool bModified = false;
+ m_pModDoc->ClearLog();
+
+ // Patterns
+ if(m_bCheckBoxes[CU_CLEANUP_PATTERNS]) bModified |= RemoveUnusedPatterns();
+ if(m_bCheckBoxes[CU_REARRANGE_PATTERNS]) bModified |= RemoveUnusedPatterns(false);
+ // Instruments
+ if(m_pModDoc->GetSoundFile()->m_nInstruments > 0)
+ {
+ if(m_bCheckBoxes[CU_CLEANUP_INSTRUMENTS]) bModified |= RemoveUnusedInstruments();
+ if(m_bCheckBoxes[CU_REMOVE_INSTRUMENTS]) bModified |= RemoveAllInstruments();
+ }
+ // Samples
+ if(m_bCheckBoxes[CU_CLEANUP_SAMPLES]) bModified |= RemoveUnusedSamples();
+ if(m_pModDoc->GetSoundFile()->m_nSamples > 1)
+ {
+ if(m_bCheckBoxes[CU_REARRANGE_SAMPLES]) bModified |= RearrangeSamples();
+ }
+ // Plugins
+ if(m_bCheckBoxes[CU_CLEANUP_PLUGINS]) bModified |= RemoveUnusedPlugins();
+ // Create samplepack
+ if(m_bCheckBoxes[CU_CREATE_SAMPLEPACK]) bModified |= CreateSamplepack();
+
+ if(bModified) m_pModDoc->SetModified();
+ m_pModDoc->UpdateAllViews(NULL, HINT_MODTYPE|HINT_MODSEQUENCE|HINT_MODGENERAL);
+ m_pModDoc->ShowLog("Cleanup", this);
+ CDialog::OnOK();
+}
+
+
+void CModCleanupDlg::OnCancel()
+//-------------------------
+{
+ CDialog::OnCancel();
+}
+
+
+
+void CModCleanupDlg::OnPresetCleanupSong()
+//----------------------------------------
+{
+ CheckDlgButton(IDC_CHK_CLEANUP_PATTERNS, MF_CHECKED);
+ CheckDlgButton(IDC_CHK_REARRANGE_PATTERNS, MF_CHECKED);
+ CheckDlgButton(IDC_CHK_CLEANUP_SAMPLES, MF_CHECKED);
+ CheckDlgButton(IDC_CHK_REARRANGE_SAMPLES, MF_CHECKED);
+ CheckDlgButton(IDC_CHK_CLEANUP_INSTRUMENTS, MF_CHECKED);
+ CheckDlgButton(IDC_CHK_REMOVE_INSTRUMENTS, MF_UNCHECKED);
+ CheckDlgButton(IDC_CHK_CLEANUP_PLUGINS, MF_CHECKED);
+ CheckDlgButton(IDC_CHK_SAMPLEPACK, MF_UNCHECKED);
+}
+
+void CModCleanupDlg::OnPresetCompoCleanup()
+//----------------------------------------
+{
+ CheckDlgButton(IDC_CHK_CLEANUP_PATTERNS, MF_UNCHECKED);
+ CheckDlgButton(IDC_CHK_REARRANGE_PATTERNS, MF_UNCHECKED);
+ CheckDlgButton(IDC_CHK_CLEANUP_SAMPLES, MF_UNCHECKED);
+ CheckDlgButton(IDC_CHK_REARRANGE_SAMPLES, MF_CHECKED);
+ CheckDlgButton(IDC_CHK_CLEANUP_INSTRUMENTS, MF_UNCHECKED);
+ CheckDlgButton(IDC_CHK_REMOVE_INSTRUMENTS, MF_UNCHECKED);
+ CheckDlgButton(IDC_CHK_CLEANUP_PLUGINS, MF_UNCHECKED);
+ CheckDlgButton(IDC_CHK_SAMPLEPACK, MF_CHECKED);
+}
+
+
+///////////////////////////////////////////////////////////////////////
+// Actual cleanup implementations
+
+// Remove unused patterns / rearrange patterns
+bool CModCleanupDlg::RemoveUnusedPatterns(bool bRemove)
+//-----------------------------------------------------
+{
+ CSoundFile *pSndFile = m_pModDoc->GetSoundFile();
+ if(pSndFile == nullptr) return false;
+
+ if(pSndFile->GetType() == MOD_TYPE_MPT && pSndFile->Order.GetNumSequences() > 1)
+ { // Multiple sequences are not taken into account in the code below. For now just make
+ // removing unused patterns disabled in this case.
+ AfxMessageBox(IDS_PATTERN_CLEANUP_UNAVAILABLE, MB_ICONINFORMATION);
+ return false;
+ }
+ const PATTERNINDEX maxPatIndex = pSndFile->Patterns.Size();
+ const ORDERINDEX maxOrdIndex = pSndFile->Order.size();
+ vector<PATTERNINDEX> nPatMap(maxPatIndex, 0);
+ vector<ROWINDEX> nPatRows(maxPatIndex, 0);
+ vector<MODCOMMAND*> pPatterns(maxPatIndex, nullptr);
+ vector<bool> bPatUsed(maxPatIndex, false);
+
+ bool bSubtunesDetected = false;
+ // detect subtunes (separated by "---")
+ for(SEQUENCEINDEX nSeq = 0; nSeq < pSndFile->Order.GetNumSequences(); nSeq++)
+ {
+ if(pSndFile->Order.GetSequence(nSeq).GetLengthFirstEmpty() != pSndFile->Order.GetSequence(nSeq).GetLengthTailTrimmed())
+ bSubtunesDetected = true;
+ }
+
+ // Flag to tell whether keeping sequence items which are after the first empty('---') order.
+ bool bKeepSubSequences = false;
+
+ if(bSubtunesDetected)
+ { // There are used sequence items after first '---'; ask user whether to remove those.
+ if (m_wParent->MessageBox(
+ _TEXT("Do you want to remove sequence items which are after the first '---' item?"),
+ _TEXT("Sequence Cleanup"), MB_YESNO) != IDYES
+ )
+ bKeepSubSequences = true;
+ }
+
+ CHAR s[512];
+ bool bEnd = false, bReordered = false;
+ UINT nPatRemoved = 0, nMinToRemove;
+ PATTERNINDEX nPats;
+
+ BeginWaitCursor();
+ PATTERNINDEX maxpat = 0;
+ for (ORDERINDEX nOrd = 0; nOrd < maxOrdIndex; nOrd++)
+ {
+ PATTERNINDEX n = pSndFile->Order[nOrd];
+ if (n < maxPatIndex)
+ {
+ if (n >= maxpat) maxpat = n + 1;
+ if (!bEnd || bKeepSubSequences) bPatUsed[n] = true;
+ } else if (n == pSndFile->Order.GetInvalidPatIndex()) bEnd = true;
+ }
+ nMinToRemove = 0;
+ if (!bRemove)
+ {
+ PATTERNINDEX imax = maxPatIndex;
+ while (imax > 0)
+ {
+ imax--;
+ if ((pSndFile->Patterns[imax]) && (bPatUsed[imax])) break;
+ }
+ nMinToRemove = imax + 1;
+ }
+ for (PATTERNINDEX nPat = maxpat; nPat < maxPatIndex; nPat++) if ((pSndFile->Patterns[nPat]) && (nPat >= nMinToRemove))
+ {
+ MODCOMMAND *m = pSndFile->Patterns[nPat];
+ UINT ncmd = pSndFile->m_nChannels * pSndFile->PatternSize[nPat];
+ for (UINT i=0; i<ncmd; i++)
+ {
+ if ((m[i].note) || (m[i].instr) || (m[i].volcmd) || (m[i].command)) goto NotEmpty;
+ }
+ pSndFile->Patterns.Remove(nPat);
+ nPatRemoved++;
+NotEmpty:
+ ;
+ }
+ UINT bWaste = 0;
+ for (UINT ichk=0; ichk < maxPatIndex; ichk++)
+ {
+ if ((pSndFile->Patterns[ichk]) && (!bPatUsed[ichk])) bWaste++;
+ }
+ if ((bRemove) && (bWaste))
+ {
+ EndWaitCursor();
+ wsprintf(s, "%d pattern(s) present in file, but not used in the song\nDo you want to reorder the sequence list and remove these patterns?", bWaste);
+ if (m_wParent->MessageBox(s, "Pattern Cleanup", MB_YESNO) != IDYES) return false;
+ BeginWaitCursor();
+ }
+
+ for (UINT i = 0; i < maxPatIndex; i++) nPatMap[i] = PATTERNINDEX_INVALID;
+ nPats = 0;
+ ORDERINDEX imap = 0;
+ for (imap = 0; imap < maxOrdIndex; imap++)
+ {
+ PATTERNINDEX n = pSndFile->Order[imap];
+ if (n < maxPatIndex)
+ {
+ if (nPatMap[n] > maxPatIndex) nPatMap[n] = nPats++;
+ pSndFile->Order[imap] = nPatMap[n];
+ } else if (n == pSndFile->Order.GetInvalidPatIndex() && (bKeepSubSequences == false)) break;
+ }
+ // Add unused patterns at the end
+ if ((!bRemove) || (!bWaste))
+ {
+ for (UINT iadd=0; iadd<maxPatIndex; iadd++)
+ {
+ if ((pSndFile->Patterns[iadd]) && (nPatMap[iadd] >= maxPatIndex))
+ {
+ nPatMap[iadd] = nPats++;
+ }
+ }
+ }
+ while (imap < maxOrdIndex)
+ {
+ pSndFile->Order[imap++] = pSndFile->Order.GetInvalidPatIndex();
+ }
+ // Reorder patterns & Delete unused patterns
+ BEGIN_CRITICAL();
+ {
+ UINT npatnames = pSndFile->m_nPatternNames;
+ LPSTR lpszpatnames = pSndFile->m_lpszPatternNames;
+ pSndFile->m_nPatternNames = 0;
+ pSndFile->m_lpszPatternNames = NULL;
+ for (PATTERNINDEX i = 0; i < maxPatIndex; i++)
+ {
+ PATTERNINDEX k = nPatMap[i];
+ if (k < maxPatIndex)
+ {
+ if (i != k) bReordered = true;
+ // Remap pattern names
+ if (i < npatnames)
+ {
+ UINT noldpatnames = pSndFile->m_nPatternNames;
+ LPSTR lpszoldpatnames = pSndFile->m_lpszPatternNames;
+ pSndFile->m_nPatternNames = npatnames;
+ pSndFile->m_lpszPatternNames = lpszpatnames;
+ pSndFile->GetPatternName(i, s);
+ pSndFile->m_nPatternNames = noldpatnames;
+ pSndFile->m_lpszPatternNames = lpszoldpatnames;
+ if (s[0]) pSndFile->SetPatternName(k, s);
+ }
+ nPatRows[k] = pSndFile->PatternSize[i];
+ pPatterns[k] = pSndFile->Patterns[i];
+ } else
+ if (pSndFile->Patterns[i])
+ {
+ pSndFile->Patterns.Remove(i);
+ nPatRemoved++;
+ }
+ }
+ for (PATTERNINDEX j = 0; j < maxPatIndex;j++)
+ {
+ pSndFile->Patterns[j].SetData(pPatterns[j], nPatRows[j]);
+ }
+ }
+ END_CRITICAL();
+ EndWaitCursor();
+ if ((nPatRemoved) || (bReordered))
+ {
+ m_pModDoc->ClearUndo();
+ if (nPatRemoved)
+ {
+ wsprintf(s, "%d pattern(s) removed.\n", nPatRemoved);
+ m_pModDoc->AddToLog(s);
+ }
+ return true;
+ }
+ return false;
+}
+
+
+// Remove unused samples
+bool CModCleanupDlg::RemoveUnusedSamples()
+//---------------------------------
+{
+ CSoundFile *pSndFile = m_pModDoc->GetSoundFile();
+ if(pSndFile == nullptr) return false;
+
+ CHAR s[512];
+ BOOL bIns[MAX_SAMPLES];
+ UINT nExt = 0, nLoopOpt = 0;
+ UINT nRemoved = 0;
+
+ BeginWaitCursor();
+ for (SAMPLEINDEX nSmp = pSndFile->m_nSamples; nSmp >= 1; nSmp--) if (pSndFile->Samples[nSmp].pSample)
+ {
+ if (!pSndFile->IsSampleUsed(nSmp))
+ {
+ BEGIN_CRITICAL();
+ pSndFile->DestroySample(nSmp);
+ if ((nSmp == pSndFile->m_nSamples) && (nSmp > 1)) pSndFile->m_nSamples--;
+ END_CRITICAL();
+ nRemoved++;
+ }
+ }
+ if (pSndFile->m_nInstruments)
+ {
+ memset(bIns, 0, sizeof(bIns));
+ for (UINT ipat=0; ipat<pSndFile->Patterns.Size(); ipat++)
+ {
+ MODCOMMAND *p = pSndFile->Patterns[ipat];
+ if (p)
+ {
+ UINT jmax = pSndFile->PatternSize[ipat] * pSndFile->m_nChannels;
+ for (UINT j=0; j<jmax; j++, p++)
+ {
+ if ((p->note) && (p->note <= NOTE_MAX))
+ {
+ if ((p->instr) && (p->instr < MAX_INSTRUMENTS))
+ {
+ MODINSTRUMENT *pIns = pSndFile->Instruments[p->instr];
+ if (pIns)
+ {
+ UINT n = pIns->Keyboard[p->note-1];
+ if (n < MAX_SAMPLES) bIns[n] = TRUE;
+ }
+ } else
+ {
+ for (UINT k=1; k<=pSndFile->m_nInstruments; k++)
+ {
+ MODINSTRUMENT *pIns = pSndFile->Instruments[k];
+ if (pIns)
+ {
+ UINT n = pIns->Keyboard[p->note-1];
+ if (n < MAX_SAMPLES) bIns[n] = TRUE;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ for (UINT ichk=1; ichk<MAX_SAMPLES; ichk++)
+ {
+ if ((!bIns[ichk]) && (pSndFile->Samples[ichk].pSample)) nExt++;
+ }
+ }
+ EndWaitCursor();
+ if (nExt && !((pSndFile->m_nType & MOD_TYPE_IT) && (pSndFile->m_dwSongFlags&SONG_ITPROJECT)))
+ { //We don't remove an instrument's unused samples in an ITP.
+ wsprintf(s, "OpenMPT detected %d sample(s) referenced by an instrument,\n"
+ "but not used in the song. Do you want to remove them ?", nExt);
+ if (::MessageBox(NULL, s, "Sample Cleanup", MB_YESNO | MB_ICONQUESTION) == IDYES)
+ {
+ for (SAMPLEINDEX j = 1; j < MAX_SAMPLES; j++)
+ {
+ if ((!bIns[j]) && (pSndFile->Samples[j].pSample))
+ {
+ BEGIN_CRITICAL();
+ pSndFile->DestroySample(j);
+ if ((j == pSndFile->m_nSamples) && (j > 1)) pSndFile->m_nSamples--;
+ END_CRITICAL();
+ nRemoved++;
+ }
+ }
+ }
+ }
+ for (SAMPLEINDEX ilo=1; ilo<=pSndFile->m_nSamples; ilo++) if (pSndFile->Samples[ilo].pSample)
+ {
+ if ((pSndFile->Samples[ilo].uFlags & CHN_LOOP)
+ && (pSndFile->Samples[ilo].nLength > pSndFile->Samples[ilo].nLoopEnd + 2)) nLoopOpt++;
+ }
+ if (nLoopOpt)
+ {
+ wsprintf(s, "OpenMPT detected %d sample(s) with unused data after the loop end point,\n"
+ "Do you want to optimize it, and remove this unused data ?", nLoopOpt);
+ if (::MessageBox(NULL, s, "Sample Cleanup", MB_YESNO | MB_ICONQUESTION) == IDYES)
+ {
+ for (UINT j=1; j<=pSndFile->m_nSamples; j++)
+ {
+ if ((pSndFile->Samples[j].uFlags & CHN_LOOP)
+ && (pSndFile->Samples[j].nLength > pSndFile->Samples[j].nLoopEnd + 2))
+ {
+ UINT lmax = pSndFile->Samples[j].nLoopEnd + 2;
+ if ((lmax < pSndFile->Samples[j].nLength) && (lmax >= 16)) pSndFile->Samples[j].nLength = lmax;
+ }
+ }
+ } else nLoopOpt = 0;
+ }
+ if ((nRemoved) || (nLoopOpt))
+ {
+ if (nRemoved)
+ {
+ wsprintf(s, "%d unused sample(s) removed\n" ,nRemoved);
+ m_pModDoc->AddToLog(s);
+ }
+ if (nLoopOpt)
+ {
+ wsprintf(s, "%d sample loop(s) optimized\n" ,nLoopOpt);
+ m_pModDoc->AddToLog(s);
+ }
+ return true;
+ }
+ return false;
+}
+
+
+// Rearrange sample list
+bool CModCleanupDlg::RearrangeSamples()
+//-------------------------------------
+{
+ CSoundFile *pSndFile = m_pModDoc->GetSoundFile();
+ if(pSndFile == nullptr) return false;
+
+ if(pSndFile->m_nSamples < 2)
+ return false;
+
+ SAMPLEINDEX nRemap = 0; // remap count
+ SAMPLEINDEX nSampleMap[MAX_SAMPLES + 1]; // map old => new
+ for(SAMPLEINDEX i = 0; i <= MAX_SAMPLES; i++)
+ nSampleMap[i] = i;
+
+ // First, find out which sample slots are unused and create the new sample map
+ for(SAMPLEINDEX i = 1 ; i <= pSndFile->m_nSamples; i++) {
+ if(!pSndFile->Samples[i].pSample)
+ {
+ // Move all following samples
+ nRemap++;
+ nSampleMap[i] = 0;
+ for(UINT j = i + 1; j <= pSndFile->m_nSamples; j++)
+ nSampleMap[j]--;
+ }
+ }
+
+ if(!nRemap)
+ return false;
+
+ BEGIN_CRITICAL();
+
+ // Now, move everything around
+ for(SAMPLEINDEX i = 1; i <= pSndFile->m_nSamples; i++)
+ {
+ if(nSampleMap[i] != i)
+ {
+ // This gotta be moved
+ pSndFile->MoveSample(i, nSampleMap[i]);
+ pSndFile->Samples[i].pSample = nullptr;
+ if(nSampleMap[i] > 0) strcpy(pSndFile->m_szNames[nSampleMap[i]], pSndFile->m_szNames[i]);
+ memset(pSndFile->m_szNames[i], 0, sizeof(pSndFile->m_szNames[i]));
+
+ // Also update instrument mapping (if module is in instrument mode)
+ for(INSTRUMENTINDEX iInstr = 1; iInstr <= pSndFile->m_nInstruments; iInstr++){
+ if(pSndFile->Instruments[iInstr]){
+ MODINSTRUMENT *p = pSndFile->Instruments[iInstr];
+ for(WORD iNote = 0; iNote < 128; iNote++)
+ if(p->Keyboard[iNote] == i) p->Keyboard[iNote] = nSampleMap[i];
+ }
+ }
+ }
+ }
+
+ // Go through the patterns and remap samples (if module is in sample mode)
+ if(!pSndFile->m_nInstruments)
+ {
+ for (PATTERNINDEX nPat = 0; nPat < pSndFile->Patterns.Size(); nPat++) if (pSndFile->Patterns[nPat])
+ {
+ MODCOMMAND *m = pSndFile->Patterns[nPat];
+ for(UINT len = pSndFile->PatternSize[nPat] * pSndFile->m_nChannels; len; m++, len--)
+ {
+ if(m->instr <= pSndFile->m_nSamples) m->instr = (BYTE)nSampleMap[m->instr];
+ }
+ }
+ }
+
+ pSndFile->m_nSamples -= nRemap;
+
+ END_CRITICAL();
+
+ return true;
+
+}
+
+
+// Remove unused instruments
+bool CModCleanupDlg::RemoveUnusedInstruments()
+//--------------------------------------------
+{
+ CSoundFile *pSndFile = m_pModDoc->GetSoundFile();
+ if(pSndFile == nullptr) return false;
+
+ INSTRUMENTINDEX usedmap[MAX_INSTRUMENTS];
+ INSTRUMENTINDEX swapmap[MAX_INSTRUMENTS];
+ INSTRUMENTINDEX swapdest[MAX_INSTRUMENTS];
+ CHAR s[512];
+ UINT nRemoved = 0;
+ INSTRUMENTINDEX nSwap, nIndex;
+ bool bReorg = false;
+
+ if (!pSndFile->m_nInstruments) return false;
+
+ char removeSamples = -1;
+ if ( !((pSndFile->m_nType & MOD_TYPE_IT) && (pSndFile->m_dwSongFlags&SONG_ITPROJECT))) { //never remove an instrument's samples in ITP.
+ if(::MessageBox(NULL, "Remove samples associated with an instrument if they are unused?", "Removing unused instruments", MB_YESNO | MB_ICONQUESTION) == IDYES) {
+ removeSamples = 1;
+ }
+ } else {
+ ::MessageBox(NULL, "This is an IT project file, so no samples associated with a used instrument will be removed.", "Removing unused instruments", MB_OK | MB_ICONINFORMATION);
+ }
+
+ BeginWaitCursor();
+ memset(usedmap, 0, sizeof(usedmap));
+
+ for(INSTRUMENTINDEX i = pSndFile->m_nInstruments; i >= 1; i--)
+ {
+ if (!pSndFile->IsInstrumentUsed(i))
+ {
+ BEGIN_CRITICAL();
+ // -> CODE#0003
+ // -> DESC="remove instrument's samples"
+ // pSndFile->DestroyInstrument(i);
+ pSndFile->DestroyInstrument(i, removeSamples);
+ // -! BEHAVIOUR_CHANGE#0003
+ if ((i == pSndFile->m_nInstruments) && (i>1)) pSndFile->m_nInstruments--; else bReorg = true;
+ END_CRITICAL();
+ nRemoved++;
+ } else
+ {
+ usedmap[i] = 1;
+ }
+ }
+ EndWaitCursor();
+ if ((bReorg) && (pSndFile->m_nInstruments > 1)
+ && (::MessageBox(NULL, "Do you want to reorganize the remaining instruments?", "Removing unused instruments", MB_YESNO | MB_ICONQUESTION) == IDYES))
+ {
+ BeginWaitCursor();
+ BEGIN_CRITICAL();
+ nSwap = 0;
+ nIndex = 1;
+ for (INSTRUMENTINDEX nIns = 1; nIns <= pSndFile->m_nInstruments; nIns++)
+ {
+ if (usedmap[nIns])
+ {
+ while (nIndex<nIns)
+ {
+ if ((!usedmap[nIndex]) && (!pSndFile->Instruments[nIndex]))
+ {
+ swapmap[nSwap] = nIns;
+ swapdest[nSwap] = nIndex;
+ pSndFile->Instruments[nIndex] = pSndFile->Instruments[nIns];
+ pSndFile->Instruments[nIns] = nullptr;
+ usedmap[nIndex] = 1;
+ usedmap[nIns] = 0;
+ nSwap++;
+ nIndex++;
+ break;
+ }
+ nIndex++;
+ }
+ }
+ }
+ while ((pSndFile->m_nInstruments > 1) && (!pSndFile->Instruments[pSndFile->m_nInstruments])) pSndFile->m_nInstruments--;
+ END_CRITICAL();
+ if (nSwap > 0)
+ {
+ for (PATTERNINDEX iPat = 0; iPat < pSndFile->Patterns.Size(); iPat++) if (pSndFile->Patterns[iPat])
+ {
+ MODCOMMAND *p = pSndFile->Patterns[iPat];
+ UINT nLen = pSndFile->m_nChannels * pSndFile->PatternSize[iPat];
+ while (nLen--)
+ {
+ if (p->instr)
+ {
+ for (UINT k=0; k<nSwap; k++)
+ {
+ if (p->instr == swapmap[k]) p->instr = (BYTE)swapdest[k];
+ }
+ }
+ p++;
+ }
+ }
+ }
+ EndWaitCursor();
+ }
+ if (nRemoved)
+ {
+ wsprintf(s, "%d unused instrument(s) removed\n", nRemoved);
+ m_pModDoc->AddToLog(s);
+ return true;
+ }
+ return false;
+}
+
+
+// Remove all instruments
+bool CModCleanupDlg::RemoveAllInstruments(bool bConfirm)
+//-----------------------------------------------
+{
+ CSoundFile *pSndFile = m_pModDoc->GetSoundFile();
+ if(pSndFile == nullptr) return false;
+
+ if (!pSndFile->m_nInstruments)
+ return false;
+
+ char removeSamples = -1;
+ if(bConfirm)
+ {
+ if (CMainFrame::GetMainFrame()->MessageBox("This will remove all the instruments in the song,\n"
+ "Do you want to continue?", "Removing all instruments", MB_YESNO | MB_ICONQUESTION) != IDYES) return false;
+ if (CMainFrame::GetMainFrame()->MessageBox("Do you want to convert all instruments to samples ?\n",
+ "Removing all instruments", MB_YESNO | MB_ICONQUESTION) == IDYES)
+ {
+ m_pModDoc->ConvertInstrumentsToSamples();
+ }
+
+ if (::MessageBox(NULL, "Remove samples associated with an instrument if they are unused?", "Removing all instruments", MB_YESNO | MB_ICONQUESTION) == IDYES) {
+ removeSamples = 1;
+ }
+ }
+
+ for (INSTRUMENTINDEX i = 1; i <= pSndFile->m_nInstruments; i++)
+ {
+ pSndFile->DestroyInstrument(i, removeSamples);
+ }
+
+ pSndFile->m_nInstruments = 0;
+ return true;
+}
+
+
+// Remove ununsed plugins
+bool CModCleanupDlg::RemoveUnusedPlugins()
+//--------------------------------------
+{
+ CSoundFile *pSndFile = m_pModDoc->GetSoundFile();
+ if(pSndFile == nullptr) return false;
+
+ bool usedmap[MAX_MIXPLUGINS];
+ memset(usedmap, false, sizeof(usedmap));
+
+ for (PLUGINDEX nPlug = 0; nPlug < MAX_MIXPLUGINS; nPlug++) {
+
+ //Is the plugin assigned to a channel?
+ for (CHANNELINDEX nChn = 0; nChn < pSndFile->GetNumChannels(); nChn++) {
+ if (pSndFile->ChnSettings[nChn].nMixPlugin == nPlug + 1u) {
+ usedmap[nPlug] = true;
+ break;
+ }
+ }
+
+ //Is the plugin used by an instrument?
+ for (INSTRUMENTINDEX nIns=1; nIns<=pSndFile->GetNumInstruments(); nIns++) {
+ if (pSndFile->Instruments[nIns] && (pSndFile->Instruments[nIns]->nMixPlug == nPlug+1)) {
+ usedmap[nPlug] = true;
+ break;
+ }
+ }
+
+ //Is the plugin assigned to master?
+ if (pSndFile->m_MixPlugins[nPlug].Info.dwInputRouting & MIXPLUG_INPUTF_MASTEREFFECT) {
+ usedmap[nPlug] = true;
+ }
+
+ //all outputs of used plugins count as used
+ if (usedmap[nPlug]!=0) {
+ if (pSndFile->m_MixPlugins[nPlug].Info.dwOutputRouting & 0x80) {
+ int output = pSndFile->m_MixPlugins[nPlug].Info.dwOutputRouting & 0x7f;
+ usedmap[output] = true;
+ }
+ }
+
+ }
+
+ UINT nRemoved = m_pModDoc->RemovePlugs(usedmap);
+
+ return (nRemoved > 0) ? true : false;
+}
+
+
+// Turn module into samplepack (convert to IT, remove patterns, etc.)
+bool CModCleanupDlg::CreateSamplepack()
+//-------------------------------------
+{
+ CSoundFile *pSndFile = m_pModDoc->GetSoundFile();
+ if(pSndFile == nullptr) return false;
+
+ //jojo.compocleanup
+ if(::MessageBox(NULL, TEXT("WARNING: Turning this module into as samplepack means that OpenMPT will convert the module to IT format, remove all patterns and reset song, sample and instrument attributes to default values. Continue?"), TEXT("Samplepack creation"), MB_YESNO | MB_ICONWARNING) == IDNO)
+ return false;
+
+ // Stop play.
+ CMainFrame::GetMainFrame()->StopMod(m_pModDoc);
+
+ BeginWaitCursor();
+ BEGIN_CRITICAL();
+
+ // convert to IT...
+ m_pModDoc->ChangeModType(MOD_TYPE_IT);
+ pSndFile->m_nMixLevels = mixLevels_original;
+ pSndFile->m_nTempoMode = tempo_mode_classic;
+ pSndFile->m_dwSongFlags = SONG_LINEARSLIDES | SONG_EXFILTERRANGE;
+
+ // clear order list
+ pSndFile->Order.Init();
+ pSndFile->Order[0] = 0;
+
+ // remove all patterns
+ pSndFile->Patterns.Init();
+ pSndFile->Patterns.Insert(0, 64);
+ pSndFile->SetCurrentOrder(0);
+
+ // Global vars
+ pSndFile->m_nDefaultTempo = 125;
+ pSndFile->m_nDefaultSpeed = 6;
+ pSndFile->m_nDefaultGlobalVolume = 256;
+ pSndFile->m_nSamplePreAmp = 48;
+ pSndFile->m_nVSTiVolume = 48;
+ pSndFile->m_nRestartPos = 0;
+
+ // Set 4 default channels.
+ pSndFile->ReArrangeChannels(vector<CHANNELINDEX>(4, MAX_BASECHANNELS));
+
+ // remove plugs
+ bool keepMask[MAX_MIXPLUGINS]; memset(keepMask, 0, sizeof(keepMask));
+ m_pModDoc->RemovePlugs(keepMask);
+
+ // instruments
+ if(pSndFile->m_nInstruments && ::MessageBox(NULL, "Keep instruments?", TEXT("Samplepack creation"), MB_YESNO | MB_ICONQUESTION) == IDNO)
+ {
+ // remove instruments
+ RemoveAllInstruments(false);
+ }
+ else
+ {
+ // reset instruments (if there are any)
+ for(INSTRUMENTINDEX i = 1; i <= pSndFile->m_nInstruments; i++)
+ {
+ pSndFile->Instruments[i]->nFadeOut = 256;
+ pSndFile->Instruments[i]->nGlobalVol = 64;
+ pSndFile->Instruments[i]->nPan = 128;
+ pSndFile->Instruments[i]->dwFlags &= ~ENV_SETPANNING;
+ pSndFile->Instruments[i]->nMixPlug = 0;
+
+ pSndFile->Instruments[i]->nVolSwing = 0;
+ pSndFile->Instruments[i]->nPanSwing = 0;
+ pSndFile->Instruments[i]->nCutSwing = 0;
+ pSndFile->Instruments[i]->nResSwing = 0;
+
+ //might be a good idea to leave those enabled...
+ /*
+ pSndFile->Instruments[i]->dwFlags &= ~ENV_VOLUME;
+ pSndFile->Instruments[i]->dwFlags &= ~ENV_PANNING;
+ pSndFile->Instruments[i]->dwFlags &= ~ENV_PITCH;
+ pSndFile->Instruments[i]->dwFlags &= ~ENV_FILTER;
+ */
+ }
+ }
+
+ // reset samples
+ ctrlSmp::ResetSamples(*pSndFile, ctrlSmp::SmpResetCompo);
+
+ // Set modflags.
+ pSndFile->SetModFlag(MSF_MIDICC_BUGEMULATION, false);
+ pSndFile->SetModFlag(MSF_OLDVOLSWING, false);
+ pSndFile->SetModFlag(MSF_COMPATIBLE_PLAY, true);
+
+ END_CRITICAL();
+ EndWaitCursor();
+
+ return true;
+}
Added: trunk/OpenMPT/mptrack/CleanupSong.h
===================================================================
--- trunk/OpenMPT/mptrack/CleanupSong.h (rev 0)
+++ trunk/OpenMPT/mptrack/CleanupSong.h 2009-10-05 17:02:19 UTC (rev 387)
@@ -0,0 +1,67 @@
+/*
+ *
+ * CleanupSong.h
+ * ---------------
+ * Purpose: Header file for CleanupSong.cpp
+ *
+ */
+
+#pragma once
+
+enum ENUM_CLEANUP_OPTIONS
+{
+ CU_CLEANUP_PATTERNS = 0,
+ CU_REARRANGE_PATTERNS,
+ CU_CLEANUP_SAMPLES,
+ CU_REARRANGE_SAMPLES,
+ CU_CLEANUP_INSTRUMENTS,
+ CU_REMOVE_INSTRUMENTS,
+ CU_CLEANUP_PLUGINS,
+ CU_CREATE_SAMPLEPACK,
+ CU_MAX_CLEANUP_OPTIONS
+};
+
+//==================================
+class CModCleanupDlg: public CDialog
+//==================================
+{
+private:
+ CModDoc *m_pModDoc;
+ CWnd *m_wParent;
+ static bool m_bCheckBoxes[CU_MAX_CLEANUP_OPTIONS]; // Checkbox state
+ static const WORD m_nCleanupIDtoDlgID[CU_MAX_CLEANUP_OPTIONS]; // Checkbox -> Control ID LUT
+
+ // Actual cleanup implementations
+ bool RemoveUnusedPatterns(bool bRemove = true); // Remove unused patterns / rearrange patterns
+ bool RemoveUnusedSamples(); // Remove unused samples
+ bool RearrangeSamples(); // Rearrange sample list
+ bool RemoveUnusedInstruments(); // Remove unused instruments
+ bool RemoveAllInstruments(bool bConfirm = true); // Remove all instruments
+ bool RemoveUnusedPlugins(); // Remove ununsed plugins
+ bool CreateSamplepack(); // Turn module into samplepack (convert to IT, remove patterns, etc.)
+
+public:
+ CModCleanupDlg(CModDoc *pModDoc, CWnd *parent):CDialog(IDD_CLEANUP_SONG, parent) { m_pModDoc = pModDoc; m_wParent = parent; }
+
+protected:
+ //{{AFX_VIRTUAL(CModCleanupDlg)
+ virtual BOOL OnInitDialog();
+ virtual void OnOK();
+ virtual void OnCancel();
+ //}}AFX_VIRTUAL
+
+ //{{AFX_MSG(CModCleanupDlg)
+ /*afx_msg void OnCheckCleanupPatterns();
+ afx_msg void OnCheckRearrangePatterns();
+ afx_msg void OnCheckCleanupSamples();
+ afx_msg void OnCheckRearrangeSamples();
+ afx_msg void OnCheckCleanupInstruments();
+ afx_msg void OnCheckRemoveInstruments();
+ afx_msg void OnCheckCleanupPlugins();
+ afx_msg void OnCheckCreateSamplepack();*/
+
+ afx_msg void OnPresetCleanupSong();
+ afx_msg void OnPresetCompoCleanup();
+ //}}AFX_MSG
+ DECLARE_MESSAGE_MAP()
+};
\ No newline at end of file
Modified: trunk/OpenMPT/mptrack/Ctrl_ins.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Ctrl_ins.cpp 2009-10-04 18:13:30 UTC (rev 386)
+++ trunk/OpenMPT/mptrack/Ctrl_ins.cpp 2009-10-05 17:02:19 UTC (rev 387)
@@ -932,34 +932,8 @@
}
}
- //rewbs.instroVSTi
- //Update plugin list
- m_CbnMixPlug.Clear();
- m_CbnMixPlug.ResetContent();
- CHAR s[64];
- for (UINT plug=0; plug<=MAX_MIXPLUGINS; plug++)
- {
- s[0] = 0;
- if (!plug)
- {
- strcpy(s, "No plugin");
- }
- else
- {
- PSNDMIXPLUGIN p = &(m_pSndFile->m_MixPlugins[plug-1]);
- p->Info.szLibraryName[63] = 0;
- if (p->Info.szLibraryName[0])
- wsprintf(s, "FX%d: %s", plug, p->Info.szName);
- else
- wsprintf(s, "FX%d: undefined", plug);
- }
+ UpdatePluginList();
- m_CbnMixPlug.SetItemData(m_CbnMixPlug.AddString(s), plug);
- }
- MODINSTRUMENT *pIns = m_pSndFile->Instruments[m_nInstrument];
- if ((pIns) && (pIns->nMixPlug < MAX_MIXPLUGINS)) m_CbnMixPlug.SetCurSel(pIns->nMixPlug);
- //end rewbs.instroVSTi
-
SetCurrentInstrument((lParam > 0) ? lParam : m_nInstrument);
// Initial Update
@@ -1236,6 +1210,11 @@
}
m_NoteMap.InvalidateRect(NULL, FALSE);
}
+ if(dwHintMask & (HINT_MIXPLUGINS|HINT_MODTYPE))
+ {
+ UpdatePluginList();
+ }
+
if (!m_bInitialized)
{
// First update
@@ -2818,3 +2797,33 @@
m_ComboTuning.AddString("Control tunings...");
m_ComboTuning.SetCurSel(0);
}
+
+void CCtrlInstruments::UpdatePluginList()
+//---------------------------------------
+{
+ //Update plugin list
+ m_CbnMixPlug.Clear();
+ m_CbnMixPlug.ResetContent();
+ CHAR s[64];
+ for (PLUGINDEX nPlug = 0; nPlug <= MAX_MIXPLUGINS; nPlug++)
+ {
+ s[0] = 0;
+ if (!nPlug)
+ {
+ strcpy(s, "No plugin");
+ }
+ else
+ {
+ PSNDMIXPLUGIN p = &(m_pSndFile->m_MixPlugins[nPlug-1]);
+ p->Info.szLibraryName[63] = 0;
+ if (p->Info.szLibraryName[0])
+ wsprintf(s, "FX%d: %s", nPlug, p->Info.szName);
+ else
+ wsprintf(s, "FX%d: undefined", nPlug);
+ }
+
+ m_CbnMixPlug.SetItemData(m_CbnMixPlug.AddString(s), nPlug);
+ }
+ MODINSTRUMENT *pIns = m_pSndFile->Instruments[m_nInstrument];
+ if ((pIns) && (pIns->nMixPlug < MAX_MIXPLUGINS)) m_CbnMixPlug.SetCurSel(pIns->nMixPlug);
+}
Modified: trunk/OpenMPT/mptrack/Ctrl_ins.h
===================================================================
--- trunk/OpenMPT/mptrack/Ctrl_ins.h 2009-10-04 18:13:30 UTC (rev 386)
+++ trunk/OpenMPT/mptrack/Ctrl_ins.h 2009-10-05 17:02:19 UTC (rev 387)
@@ -84,6 +84,8 @@
void UpdateTuningComboBox();
void BuildTuningComboBox();
+ void UpdatePluginList();
+
//Pitch/Tempo lock
CEdit m_EditPitchTempoLock;
CButton m_CheckPitchTempoLock;
Modified: trunk/OpenMPT/mptrack/Moddoc.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Moddoc.cpp 2009-10-04 18:13:30 UTC (rev 386)
+++ trunk/OpenMPT/mptrack/Moddoc.cpp 2009-10-05 17:02:19 UTC (rev 387)
@@ -14,6 +14,7 @@
#include "vstplug.h"
#include "version.h"
#include "modsmp_ctrl.h"
+#include "CleanupSong.h"
#ifdef _DEBUG
#define new DEBUG_NEW
@@ -52,27 +53,14 @@
ON_COMMAND(ID_INSERT_PATTERN, OnInsertPattern)
ON_COMMAND(ID_INSERT_SAMPLE, OnInsertSample)
ON_COMMAND(ID_INSERT_INSTRUMENT, OnInsertInstrument)
- ON_COMMAND(ID_CLEANUP_SAMPLES, OnCleanupSamples)
- ON_COMMAND(ID_CLEANUP_INSTRUMENTS, OnCleanupInstruments)
- ON_COMMAND(ID_CLEANUP_PLUGS, OnCleanupPlugs)
- ON_COMMAND(ID_CLEANUP_PATTERNS, OnCleanupPatterns)
- ON_COMMAND(ID_CLEANUP_SONG, OnCleanupSong)
- ON_COMMAND(ID_CLEANUP_REARRANGE, OnRearrangePatterns)
- ON_COMMAND(ID_CLEANUP_COMPO, OnCompoCleanup)
- ON_COMMAND(ID_INSTRUMENTS_REMOVEALL,OnRemoveAllInstruments)
-// -> CODE#0020
-// -> DESC="rearrange sample list"
- ON_COMMAND(ID_REARRANGE_SAMPLES, RearrangeSamples)
-// -! NEW_FEATURE#0020
+ ON_COMMAND(ID_EDIT_CLEANUP, OnShowCleanup)
+
ON_COMMAND(ID_ESTIMATESONGLENGTH, OnEstimateSongLength)
ON_COMMAND(ID_APPROX_BPM, OnApproximateBPM)
ON_COMMAND(ID_PATTERN_PLAY, OnPatternPlay) //rewbs.patPlayAllViews
ON_COMMAND(ID_PATTERN_PLAYNOLOOP, OnPatternPlayNoLoop) //rewbs.patPlayAllViews
ON_COMMAND(ID_PATTERN_RESTART, OnPatternRestart) //rewbs.patPlayAllViews
ON_UPDATE_COMMAND_UI(ID_INSERT_INSTRUMENT, OnUpdateXMITMPTOnly)
- ON_UPDATE_COMMAND_UI(ID_INSTRUMENTS_REMOVEALL, OnUpdateInstrumentOnly)
- ON_UPDATE_COMMAND_UI(ID_CLEANUP_INSTRUMENTS, OnUpdateInstrumentOnly)
- ON_UPDATE_COMMAND_UI(ID_REARRANGE_SAMPLES, OnUpdateSampleCount)
ON_UPDATE_COMMAND_UI(ID_VIEW_INSTRUMENTS, OnUpdateXMITMPTOnly)
ON_UPDATE_COMMAND_UI(ID_VIEW_COMMENTS, OnUpdateXMITMPTOnly)
ON_UPDATE_COMMAND_UI(ID_VIEW_MIDIMAPPING, OnUpdateHasMIDIMappings)
@@ -1835,89 +1823,14 @@
//end rewbs.graph
-void CModDoc::OnCleanupSamples()
-//------------------------------
-{
- ClearLog();
- RemoveUnusedSamples();
- UpdateAllViews(NULL, HINT_MODTYPE);
- ShowLog("Sample Cleanup", CMainFrame::GetMainFrame());
-}
-
-
-void CModDoc::OnCleanupInstruments()
-//----------------------------------
-{
- ClearLog();
- RemoveUnusedInstruments();
- UpdateAllViews(NULL, HINT_MODTYPE);
- ShowLog("Instrument Cleanup", CMainFrame::GetMainFrame());
-}
-
-void CModDoc::OnCleanupPlugs()
-//----------------------------------
-{
- ClearLog();
- RemoveUnusedPlugs();
- UpdateAllViews(NULL, HINT_MODTYPE);
- ShowLog("Plugin Cleanup", CMainFrame::GetMainFrame());
-}
-
-
-
-void CModDoc::OnCleanupPatterns()
-//-------------------------------
-{
- ClearLog();
- RemoveUnusedPatterns();
- UpdateAllViews(NULL, HINT_MODTYPE|HINT_MODSEQUENCE);
- ShowLog("Pattern Cleanup", CMainFrame::GetMainFrame());
-}
-
-
-void CModDoc::OnCleanupSong()
+void CModDoc::OnShowCleanup()
//---------------------------
{
- ClearLog();
- RemoveUnusedPatterns();
- RemoveUnusedInstruments();
- RemoveUnusedSamples();
- RemoveUnusedPlugs();
- UpdateAllViews(NULL, HINT_MODTYPE|HINT_MODSEQUENCE);
- ShowLog("Song Cleanup", CMainFrame::GetMainFrame());
+ CModCleanupDlg dlg(this, CMainFrame::GetMainFrame());
+ dlg.DoModal();
}
-void CModDoc::OnRearrangePatterns()
-//---------------------------------
-{
- ClearLog();
- RemoveUnusedPatterns(FALSE);
- UpdateAllViews(NULL, HINT_MODTYPE|HINT_MODSEQUENCE);
- ShowLog("Pattern Rearrange", CMainFrame::GetMainFrame());
-}
-
-void CModDoc::OnCompoCleanup()
-//------------------------------
-{
- CompoCleanup();
- UpdateAllViews(NULL, HINT_MODTYPE);
-}
-
-
-
-void CModDoc::OnUpdateInstrumentOnly(CCmdUI *p)
-//---------------------------------------------
-{
- if (p) p->Enable((m_SndFile.m_nInstruments) ? TRUE : FALSE);
-}
-
-void CModDoc::OnUpdateSampleCount(CCmdUI *p)
-//------------------------------------------
-{
- if (p) p->Enable((m_SndFile.m_nSamples > 1) ? TRUE : FALSE);
-}
-
void CModDoc::OnUpdateHasMIDIMappings(CCmdUI *p)
//----------------------------------------------
{
@@ -1977,13 +1890,7 @@
}
-void CModDoc::OnRemoveAllInstruments()
-//------------------------------------
-{
- RemoveAllInstruments();
-}
-
void CModDoc::OnEstimateSongLength()
//----------------------------------
{
Modified: trunk/OpenMPT/mptrack/Moddoc.h
===================================================================
--- trunk/OpenMPT/mptrack/Moddoc.h 2009-10-04 18:13:30 UTC (rev 386)
+++ trunk/OpenMPT/mptrack/Moddoc.h 2009-10-05 17:02:19 UTC (rev 387)
@@ -189,15 +189,8 @@
BOOL ChangeModType(UINT nNewType);
BOOL ChangeNumChannels(UINT nNewChannels, const bool showCancelInRemoveDlg = true);
- BOOL ConvertInstrumentsToSamples();;
- BOOL RemoveUnusedSamples();
- BOOL RemoveUnusedInstruments();
- void RemoveAllInstruments(bool bConfirm = true);
- BOOL RemoveUnusedPlugs();
+ BOOL ConvertInstrumentsToSamples();
UINT RemovePlugs(const bool (&keepMask)[MAX_MIXPLUGINS]);
- BOOL RemoveUnusedPatterns(BOOL bRemove=TRUE);
- void RearrangeSamples();
- BOOL CompoCleanup();
PATTERNINDEX InsertPattern(ORDERINDEX nOrd = -1, ROWINDEX nRows = 64);
SAMPLEINDEX InsertSample(bool bLimit = false);
@@ -242,7 +235,7 @@
BOOL IsChildSample(UINT nIns, UINT nSmp) const;
UINT FindSampleParent(UINT nSmp) const;
UINT FindInstrumentChild(UINT nIns) const;
- bool MoveOrder(ORDERINDEX nSourceNdx, ORDERINDEX nDestNdx, bool bUpdate = true, bool bCopy = false);
+ bool MoveOrder(ORDERINDEX nSourceNdx, ORDERINDEX nDestNdx, bool bUpdate = true, bool bCopy = false, SEQUENCEINDEX nSourceSeq = SEQUENCEINDEX_INVALID, SEQUENCEINDEX nDestSeq = SEQUENCEINDEX_INVALID);
BOOL ExpandPattern(PATTERNINDEX nPattern);
BOOL ShrinkPattern(PATTERNINDEX nPattern);
BOOL CopyPattern(PATTERNINDEX nPattern, DWORD dwBeginSel, DWORD dwEndSel);
@@ -332,20 +325,11 @@
afx_msg void OnInsertPattern();
afx_msg void OnInsertSample();
afx_msg void OnInsertInstrument();
- afx_msg void OnCleanupSamples();
- afx_msg void OnCleanupInstruments();
- afx_msg void OnCleanupPlugs();
- afx_msg void OnCleanupPatterns();
- afx_msg void OnCleanupSong();
- afx_msg void OnRearrangePatterns();
- afx_msg void OnCompoCleanup();
- afx_msg void OnRemoveAllInstruments();
+ afx_msg void OnShowCleanup();
afx_msg void OnEstimateSongLength();
afx_msg void OnApproximateBPM();
afx_msg void OnUpdateXMITMPTOnly(CCmdUI *p);
afx_msg void OnUpdateHasMIDIMappings(CCmdUI *p);
- afx_msg void OnUpdateInstrumentOnly(CCmdUI *pCmdUI);
- afx_msg void OnUpdateSampleCount(CCmdUI *pCmdUI);
afx_msg void OnUpdateMP3Encode(CCmdUI *pCmdUI);
afx_msg void OnPatternRestart(); //rewbs.customKeys
afx_msg void OnPatternPlay(); //rewbs.customKeys
Modified: trunk/OpenMPT/mptrack/Modedit.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Modedit.cpp 2009-10-04 18:13:30 UTC (rev 386)
+++ trunk/OpenMPT/mptrack/Modedit.cpp 2009-10-05 17:02:19 UTC (rev 387)
@@ -1007,251 +1007,6 @@
}
-BOOL CModDoc::RemoveUnusedPatterns(BOOL bRemove)
-//----------------------------------------------
-{
- if (GetSoundFile()->GetType() == MOD_TYPE_MPT && GetSoundFile()->Order.GetNumSequences() > 1)
- { // Multiple sequences are not taken into account in the code below. For now just make
- // removing unused patterns disabled in this case.
- AfxMessageBox(IDS_PATTERN_CLEANUP_UNAVAILABLE, MB_ICONINFORMATION);
- return FALSE;
- }
- const UINT maxPatIndex = m_SndFile.Patterns.Size();
- const UINT maxOrdIndex = m_SndFile.Order.size();
- vector<UINT> nPatMap(maxPatIndex, 0);
- vector<UINT> nPatRows(maxPatIndex, 0);
- vector<MODCOMMAND*> pPatterns(maxPatIndex, NULL);
- vector<BOOL> bPatUsed(maxPatIndex, false);
-
- bool bSubtunesDetected = false;
- // detect subtunes (separated by "---")
- for(SEQUENCEINDEX nSeq = 0; nSeq < m_SndFile.Order.GetNumSequences(); nSeq++)
- {
- if(m_SndFile.Order.GetSequence(nSeq).GetLengthFirstEmpty() != m_SndFile.Order.GetSequence(nSeq).GetLengthTailTrimmed())
- bSubtunesDetected = true;
- }
-
- // Flag to tell whether keeping sequence items which are after the first empty('---') order.
- bool bKeepSubSequences = false;
-
- if(bSubtunesDetected)
- { // There are used sequence items after first '---'; ask user whether to remove those.
- if (CMainFrame::GetMainFrame()->MessageBox(
- _TEXT("Do you want to remove sequence items which are after the first '---' item?"),
- _TEXT("Sequence Cleanup"), MB_YESNO) != IDYES
- )
- bKeepSubSequences = true;
- }
-
- CHAR s[512];
- BOOL bEnd = FALSE, bReordered = FALSE;
- UINT nPatRemoved = 0, nMinToRemove, nPats;
-
- BeginWaitCursor();
- UINT maxpat = 0;
- for (UINT iord=0; iord<maxOrdIndex; iord++)
- {
- UINT n = m_SndFile.Order[iord];
- if (n < maxPatIndex)
- {
- if (n >= maxpat) maxpat = n+1;
- if (!bEnd || bKeepSubSequences) bPatUsed[n] = TRUE;
- } else if (n == m_SndFile.Order.GetInvalidPatIndex()) bEnd = TRUE;
- }
- nMinToRemove = 0;
- if (!bRemove)
- {
- UINT imax = maxPatIndex;
- while (imax > 0)
- {
- imax--;
- if ((m_SndFile.Patterns[imax]) && (bPatUsed[imax])) break;
- }
- nMinToRemove = imax+1;
- }
- for (UINT ipat=maxpat; ipat<maxPatIndex; ipat++) if ((m_SndFile.Patterns[ipat]) && (ipat >= nMinToRemove))
- {
- MODCOMMAND *m = m_SndFile.Patterns[ipat];
- UINT ncmd = m_SndFile.m_nChannels * m_SndFile.PatternSize[ipat];
- for (UINT i=0; i<ncmd; i++)
- {
- if ((m[i].note) || (m[i].instr) || (m[i].volcmd) || (m[i].command)) goto NotEmpty;
- }
- m_SndFile.Patterns.Remove(ipat);
- nPatRemoved++;
- NotEmpty:
- ;
- }
- UINT bWaste = 0;
- for (UINT ichk=0; ichk < maxPatIndex; ichk++)
- {
- if ((m_SndFile.Patterns[ichk]) && (!bPatUsed[ichk])) bWaste++;
- }
- if ((bRemove) && (bWaste))
- {
- EndWaitCursor();
- wsprintf(s, "%d pattern(s) present in file, but not used in the song\nDo you want to reorder the sequence list and remove these patterns?", bWaste);
- if (CMainFrame::GetMainFrame()->MessageBox(s, "Pattern Cleanup", MB_YESNO) != IDYES) return TRUE;
- BeginWaitCursor();
- }
- for (UINT irst=0; irst<maxPatIndex; irst++) nPatMap[irst] = 0xFFFF;
- nPats = 0;
- UINT imap = 0;
- for (imap=0; imap<maxOrdIndex; imap++)
- {
- UINT n = m_SndFile.Order[imap];
- if (n < maxPatIndex)
- {
- if (nPatMap[n] > maxPatIndex) nPatMap[n] = nPats++;
- m_SndFile.Order[imap] = nPatMap[n];
- } else if (n == m_SndFile.Order.GetInvalidPatIndex() && (bKeepSubSequences == false)) break;
- }
- // Add unused patterns at the end
- if ((!bRemove) || (!bWaste))
- {
- for (UINT iadd=0; iadd<maxPatIndex; iadd++)
- {
- if ((m_SndFile.Patterns[iadd]) && (nPatMap[iadd] >= maxPatIndex))
- {
- nPatMap[iadd] = nPats++;
- }
- }
- }
- while (imap < maxOrdIndex)
- {
- m_SndFile.Order[imap++] = m_SndFile.Order.GetInvalidPatIndex();
- }
- BEGIN_CRITICAL();
- // Reorder patterns & Delete unused patterns
- {
- UINT npatnames = m_SndFile.m_nPatternNames;
- LPSTR lpszpatnames = m_SndFile.m_lpszPatternNames;
- m_SndFile.m_nPatternNames = 0;
- m_SndFile.m_lpszPatternNames = NULL;
- for (UINT i=0; i<maxPatIndex; i++)
- {
- UINT k = nPatMap[i];
- if (k < maxPatIndex)
- {
- if (i != k) bReordered = TRUE;
- // Remap pattern names
- if (i < npatnames)
- {
- UINT noldpatnames = m_SndFile.m_nPatternNames;
- LPSTR lpszoldpatnames = m_SndFile.m_lpszPatternNames;
- m_SndFile.m_nPatternNames = npatnames;
- m_SndFile.m_lpszPatternNames = lpszpatnames;
- m_SndFile.GetPatternName(i, s);
- m_SndFile.m_nPatternNames = noldpatnames;
- m_SndFile.m_lpszPatternNames = lpszoldpatnames;
- if (s[0]) m_SndFile.SetPatternName(k, s);
- }
- nPatRows[k] = m_SndFile.PatternSize[i];
- pPatterns[k] = m_SndFile.Patterns[i];
- } else
- if (m_SndFile.Patterns[i])
- {
- m_SndFile.Patterns.Remove(i);
- nPatRemoved++;
- }
- }
- for (UINT j=0; j<maxPatIndex;j++)
- {
- m_SndFile.Patterns[j].SetData(pPatterns[j], nPatRows[j]);
- }
- }
- END_CRITICAL();
- EndWaitCursor();
- if ((nPatRemoved) || (bReordered))
- {
- ClearUndo();
- SetModified();
- if (nPatRemoved)
- {
- wsprintf(s, "%d pattern(s) removed.\n", nPatRemoved);
- AddToLog(s);
- }
- return TRUE;
- }
- return FALSE;
-}
-
-
-
-
-void CModDoc::RearrangeSamples()
-//------------------------------
-{
- if(m_SndFile.m_nSamples < 2)
- return;
-
- UINT nRemap = 0; // remap count
- UINT nSampleMap[MAX_SAMPLES + 1]; // map old => new
- for(UINT i = 0; i <= MAX_SAMPLES; i++)
- nSampleMap[i] = i;
-
- // First, find out which sample slots are unused and create the new sample map
- for(SAMPLEINDEX i = 1 ; i <= m_SndFile.m_nSamples; i++) {
- if(!m_SndFile.Samples[i].pSample)
- {
- // Move all following samples
- nRemap++;
- nSampleMap[i] = 0;
- for(UINT j = i + 1; j <= m_SndFile.m_nSamples; j++)
- nSampleMap[j]--;
- }
- }
-
- if(!nRemap)
- return;
-
- BEGIN_CRITICAL();
-
- // Now, move everything around
- for(SAMPLEINDEX i = 1; i <= m_SndFile.m_nSamples; i++)
- {
- if(nSampleMap[i] != i)
- {
- // This gotta be moved
- m_SndFile.MoveSample(i, nSampleMap[i]);
- m_SndFile.Samples[i].pSample = nullptr;
- if(nSampleMap[i] > 0) strcpy(m_SndFile.m_szNames[nSampleMap[i]], m_SndFile.m_szNames[i]);
- memset(m_SndFile.m_szNames[i], 0, sizeof(m_SndFile.m_szNames[i]));
-
- // Also update instrument mapping (if module is in instrument mode)
- for(INSTRUMENTINDEX iInstr = 1; iInstr <= m_SndFile.m_nInstruments; iInstr++){
- if(m_SndFile.Instruments[iInstr]){
- MODINSTRUMENT *p = m_SndFile.Instruments[iInstr];
- for(WORD iNote = 0; iNote < 128; iNote++)
- if(p->Keyboard[iNote] == i) p->Keyboard[iNote] = nSampleMap[i];
- }
- }
- }
- }
-
- // Go through the patterns and remap samples (if module is in sample mode)
- if(!m_SndFile.m_nInstruments)
- {
- for (PATTERNINDEX nPat = 0; nPat < m_SndFile.Patterns.Size(); nPat++) if (m_SndFile.Patterns[nPat])
- {
- MODCOMMAND *m = m_SndFile.Patterns[nPat];
- for(UINT len = m_SndFile.PatternSize[nPat] * m_SndFile.m_nChannels; len; m++, len--)
- {
- if(m->instr <= m_SndFile.m_nSamples) m->instr = nSampleMap[m->instr];
- }
- }
- }
-
- m_SndFile.m_nSamples -= nRemap;
-
- END_CRITICAL();
-
- SetModified();
- UpdateAllViews(NULL, HINT_MODTYPE);
-
-}
-
-
BOOL CModDoc::ConvertInstrumentsToSamples()
//-----------------------------------------
{
@@ -1278,130 +1033,7 @@
}
-BOOL CModDoc::RemoveUnusedSamples()
-//---------------------------------
-{
- CHAR s[512];
- BOOL bIns[MAX_SAMPLES];
- UINT nExt = 0, nLoopOpt = 0;
- UINT nRemoved = 0;
-
- BeginWaitCursor();
- for (UINT i=m_SndFile.m_nSamples; i>=1; i--) if (m_SndFile.Samples[i].pSample)
- {
- if (!m_SndFile.IsSampleUsed(i))
- {
- BEGIN_CRITICAL();
- m_SndFile.DestroySample(i);
- if ((i == m_SndFile.m_nSamples) && (i > 1)) m_SndFile.m_nSamples--;
- END_CRITICAL();
- nRemoved++;
- }
- }
- if (m_SndFile.m_nInstruments)
- {
- memset(bIns, 0, sizeof(bIns));
- for (UINT ipat=0; ipat<m_SndFile.Patterns.Size(); ipat++)
- {
- MODCOMMAND *p = m_SndFile.Patterns[ipat];
- if (p)
- {
- UINT jmax = m_SndFile.PatternSize[ipat] * m_SndFile.m_nChannels;
- for (UINT j=0; j<jmax; j++, p++)
- {
- if ((p->note) && (p->note <= NOTE_MAX))
- {
- if ((p->instr) && (p->instr < MAX_INSTRUMENTS))
- {
- MODINSTRUMENT *pIns = m_SndFile.Instruments[p->instr];
- if (pIns)
- {
- UINT n = pIns->Keyboard[p->note-1];
- if (n < MAX_SAMPLES) bIns[n] = TRUE;
- }
- } else
- {
- for (UINT k=1; k<=m_SndFile.m_nInstruments; k++)
- {
- MODINSTRUMENT *pIns = m_SndFile.Instruments[k];
- if (pIns)
- {
- UINT n = pIns->Keyboard[p->note-1];
- if (n < MAX_SAMPLES) bIns[n] = TRUE;
- }
- }
- }
- }
- }
- }
- }
- for (UINT ichk=1; ichk<MAX_SAMPLES; ichk++)
- {
- if ((!bIns[ichk]) && (m_SndFile.Samples[ichk].pSample)) nExt++;
- }
- }
- EndWaitCursor();
- if (nExt && !((m_SndFile.m_nType & MOD_TYPE_IT) && (m_SndFile.m_dwSongFlags&SONG_ITPROJECT)))
- { //We don't remove an instrument's unused samples in an ITP.
- wsprintf(s, "OpenMPT detected %d sample(s) referenced by an instrument,\n"
- "but not used in the song. Do you want to remove them ?", nExt);
- if (::MessageBox(NULL, s, "Sample Cleanup", MB_YESNO | MB_ICONQUESTION) == IDYES)
- {
- for (UINT j=1; j<MAX_SAMPLES; j++)
- {
- if ((!bIns[j]) && (m_SndFile.Samples[j].pSample))
- {
- BEGIN_CRITICAL();
- m_SndFile.DestroySample(j);
- if ((j == m_SndFile.m_nSamples) && (j > 1)) m_SndFile.m_nSamples--;
- END_CRITICAL();
- nRemoved++;
- }
- }
- }
- }
- for (UINT ilo=1; ilo<=m_SndFile.m_nSamples; ilo++) if (m_SndFile.Samples[ilo].pSample)
- {
- if ((m_SndFile.Samples[ilo].uFlags & CHN_LOOP)
- && (m_SndFile.Samples[ilo].nLength > m_SndFile.Samples[ilo].nLoopEnd + 2)) nLoopOpt++;
- }
- if (nLoopOpt)
- {
- wsprintf(s, "OpenMPT detected %d sample(s) with unused data after the loop end point,\n"
- "Do you want to optimize it, and remove this unused data ?", nLoopOpt);
- if (::MessageBox(NULL, s, "Sample Cleanup", MB_YESNO | MB_ICONQUESTION) == IDYES)
- {
- for (UINT j=1; j<=m_SndFile.m_nSamples; j++)
- {
- if ((m_SndFile.Samples[j].uFlags & CHN_LOOP)
- && (m_SndFile.Samples[j].nLength > m_SndFile.Samples[j].nLoopEnd + 2))
- {
- UINT lmax = m_SndFile.Samples[j].nLoopEnd + 2;
- if ((lmax < m_SndFile.Samples[j].nLength) && (lmax >= 16)) m_SndFile.Samples[j].nLength = lmax;
- }
- }
- } else nLoopOpt = 0;
- }
- if ((nRemoved) || (nLoopOpt))
- {
- if (nRemoved)
- {
- wsprintf(s, "%d unused sample(s) removed\n" ,nRemoved);
- AddToLog(s);
- }
- if (nLoopOpt)
- {
- wsprintf(s, "%d sample loop(s) optimized\n" ,nLoopOpt);
- AddToLog(s);
- }
- SetModified();
- return TRUE;
- }
- return FALSE;
-}
-
-
UINT CModDoc::RemovePlugs(const bool (&keepMask)[MAX_MIXPLUGINS])
//---------------------------------------------------------------
{
@@ -1443,288 +1075,6 @@
}
-BOOL CModDoc::RemoveUnusedPlugs()
-//-------------------------------
-{
- bool usedmap[MAX_MIXPLUGINS];
- memset(usedmap, false, sizeof(usedmap));
-
- for (PLUGINDEX nPlug=0; nPlug < MAX_MIXPLUGINS; nPlug++) {
-
- //Is the plugin assigned to a channel?
- for (CHANNELINDEX nChn = 0; nChn < m_SndFile.GetNumChannels(); nChn++) {
- if (m_SndFile.ChnSettings[nChn].nMixPlugin == nPlug + 1u) {
- usedmap[nPlug]=true;
- break;
- }
- }
-
- //Is the plugin used by an instrument?
- for (INSTRUMENTINDEX nIns=1; nIns<=m_SndFile.GetNumInstruments(); nIns++) {
- if (m_SndFile.Instruments[nIns] && (m_SndFile.Instruments[nIns]->nMixPlug == nPlug+1)) {
- usedmap[nPlug]=true;
- break;
- }
- }
-
- //Is the plugin assigned to master?
- if (m_SndFile.m_MixPlugins[nPlug].Info.dwInputRouting & MIXPLUG_INPUTF_MASTEREFFECT) {
- usedmap[nPlug]=true;
- }
-
- //all outputs of used plugins count as used
- if (usedmap[nPlug]!=0) {
- if (m_SndFile.m_MixPlugins[nPlug].Info.dwOutputRouting & 0x80) {
- int output = m_SndFile.m_MixPlugins[nPlug].Info.dwOutputRouting & 0x7f;
- usedmap[output]=true;
- }
- }
-
- }
-
- UINT nRemoved = RemovePlugs(usedmap);
-
- if (nRemoved) {
- SetModified();
- }
-
- return nRemoved;
-}
-
-
-void CModDoc::RemoveAllInstruments(bool bConfirm)
-//-----------------------------------------------
-{
- if (!m_SndFile.m_nInstruments)
- return;
-
- char removeSamples = -1;
- if(bConfirm)
- {
- if (CMainFrame::GetMainFrame()->MessageBox("This will remove all the instruments in the song,\n"
- "Do you want to continue?", "Warning", MB_YESNO | MB_ICONQUESTION) != IDYES) return;
- if (CMainFrame::GetMainFrame()->MessageBox("Do you want to convert all instruments to samples ?\n",
- NULL, MB_YESNO | MB_ICONQUESTION) == IDYES)
- {
- ConvertInstrumentsToSamples();
- }
-
- if (::MessageBox(NULL, "Remove samples associated with an instrument if they are unused?", "Removing instrument", MB_YESNO | MB_ICONQUESTION) == IDYES) {
- removeSamples = 1;
- }
- }
-
- for (INSTRUMENTINDEX i = 1; i <= m_SndFile.m_nInstruments; i++)
- {
- m_SndFile.DestroyInstrument(i,removeSamples);
- }
-
- m_SndFile.m_nInstruments = 0;
- SetModified();
- UpdateAllViews(NULL, HINT_MODTYPE);
-}
-
-
-BOOL CModDoc::RemoveUnusedInstruments()
-//-------------------------------------
-{
- BYTE usedmap[MAX_INSTRUMENTS];
- BYTE swapmap[MAX_INSTRUMENTS];
- BYTE swapdest[MAX_INSTRUMENTS];
- CHAR s[512];
- UINT nRemoved = 0;
- UINT nSwap, nIndex;
- bool bReorg = false;
-
- if (!m_SndFile.m_nInstruments) return FALSE;
-
- char removeSamples = -1;
- if ( !((m_SndFile.m_nType & MOD_TYPE_IT) && (m_SndFile.m_dwSongFlags&SONG_ITPROJECT))) { //never remove an instrument's samples in ITP.
- if(::MessageBox(NULL, "Remove samples associated with an instrument if they are unused?", "Removing instrument", MB_YESNO | MB_ICONQUESTION) == IDYES) {
- removeSamples = 1;
- }
- } else {
- MessageBox(NULL, "This is an IT project, so no samples associated with a used instrument will be removed.", "Removing Instruments", MB_OK | MB_ICONINFORMATION);
- }
-
- BeginWaitCursor();
- memset(usedmap, 0, sizeof(usedmap));
-
- for(INSTRUMENTINDEX i = m_SndFile.m_nInstruments; i >= 1; i--)
- {
- if (!m_SndFile.IsInstrumentUsed(i))
- {
- BEGIN_CRITICAL();
-// -> CODE#0003
-// -> DESC="remove instrument's samples"
-// m_SndFile.DestroyInstrument(i);
- m_SndFile.DestroyInstrument(i, removeSamples);
-// -! BEHAVIOUR_CHANGE#0003
- if ((i == m_SndFile.m_nInstruments) && (i>1)) m_SndFile.m_nInstruments--; else bReorg = true;
- END_CRITICAL();
- nRemoved++;
- } else
- {
- usedmap[i] = 1;
- }
- }
- EndWaitCursor();
- if ((bReorg) && (m_SndFile.m_nInstruments > 1)
- && (::MessageBox(NULL, "Do you want to reorganize the remaining instruments?", "Instrument Cleanup", MB_YESNO | MB_ICONQUESTION) == IDYES))
- {
- BeginWaitCursor();
- BEGIN_CRITICAL();
- nSwap = 0;
- nIndex = 1;
- for (UINT j=1; j<=m_SndFile.m_nInstruments; j++)
- {
- if (usedmap[j])
- {
- while (nIndex<j)
- {
- if ((!usedmap[nIndex]) && (!m_SndFile.Instruments[nIndex]))
- {
- swapmap[nSwap] = j;
- swapdest[nSwap] = nIndex;
- m_SndFile.Instruments[nIndex] = m_SndFile.Instruments[j];
- m_SndFile.Instruments[j] = NULL;
- usedmap[nIndex] = 1;
- usedmap[j] = 0;
- nSwap++;
- nIndex++;
- break;
- }
- nIndex++;
- }
- }
- }
- while ((m_SndFile.m_nInstruments > 1) && (!m_SndFile.Instruments[m_SndFile.m_nInstruments])) m_SndFile.m_nInstruments--;
- END_CRITICAL();
- if (nSwap > 0)
- {
- for (UINT iPat=0; iPat<m_SndFile.Patterns.Size(); iPat++) if (m_SndFile.Patterns[iPat])
- {
- MODCOMMAND *p = m_SndFile.Patterns[iPat];
- UINT nLen = m_SndFile.m_nChannels * m_SndFile.PatternSize[iPat];
- while (nLen--)
- {
- if (p->instr)
- {
- for (UINT k=0; k<nSwap; k++)
- {
- if (p->instr == swapmap[k]) p->instr = swapdest[k];
- }
- }
- p++;
- }
- }
- }
- EndWaitCursor();
- }
- if (nRemoved)
- {
- wsprintf(s, "%d unused instrument(s) removed\n", nRemoved);
- AddToLog(s);
- SetModified();
- return TRUE;
- }
- return FALSE;
-}
-
-
-BOOL CModDoc::CompoCleanup()
-//--------------------------
-{
- //jojo.compocleanup
- if(::MessageBox(NULL, TEXT("WARNING: Compo cleanup will convert module to IT format, remove all patterns and reset song, sample and instrument attributes to default values. Continue?"), TEXT("Compo Cleanup"), MB_YESNO | MB_ICONWARNING) == IDNO)
- return FALSE;
-
- // Stop play.
- CMainFrame::GetMainFrame()->StopMod(this);
-
- BeginWaitCursor();
- BEGIN_CRITICAL();
-
- // convert to IT...
- ChangeModType(MOD_TYPE_IT);
- m_SndFile.m_nMixLevels = mixLevels_original;
- m_SndFile.m_nTempoMode = tempo_mode_classic;
- m_SndFile.m_dwSongFlags = SONG_LINEARSLIDES | SONG_EXFILTERRANGE;
-
- // clear order list
- m_SndFile.Order.Init();
- m_SndFile.Order[0] = 0;
-
- // remove all patterns
- m_SndFile.Patterns.Init();
- m_SndFile.Patterns.Insert(0, 64);
- m_SndFile.SetCurrentOrder(0);
-
- // Global vars
- m_SndFile.m_nDefaultTempo = 125;
- m_SndFile.m_nDefaultSpeed = 6;
- m_SndFile.m_nDefaultGlobalVolume = 256;
- m_SndFile.m_nSamplePreAmp = 48;
- m_SndFile.m_nVSTiVolume = 48;
- m_SndFile.m_nRestartPos = 0;
-
- // Set 4 default channels.
- m_SndFile.ReArrangeChannels(vector<CHANNELINDEX>(4, MAX_BASECHANNELS));
-
- //remove plugs
- bool keepMask[MAX_MIXPLUGINS]; memset(keepMask, 0, sizeof(keepMask));
- RemovePlugs(keepMask);
-
- // instruments
- if(m_SndFile.m_nInstruments && ::MessageBox(NULL, "Remove instruments?", "Compo Cleanup", MB_YESNO | MB_ICONQUESTION) == IDYES)
- {
- // remove instruments
- RemoveAllInstruments(false);
- }
- else
- {
- // reset instruments
- for(UINT i = 1; i <= m_SndFile.m_nInstruments; i++)
- {
- m_SndFile.Instruments[i]->nFadeOut = 256;
- m_SndFile.Instruments[i]->nGlobalVol = 64;
- m_SndFile.Instruments[i]->nPan = 128;
- m_SndFile.Instruments[i]->dwFlags &= ~ENV_SETPANNING;
- m_SndFile.Instruments[i]->nMixPlug = 0;
-
- m_SndFile.Instruments[i]->nVolSwing = 0;
- m_SndFile.Instruments[i]->nPanSwing = 0;
- m_SndFile.Instruments[i]->nCutSwing = 0;
- m_SndFile.Instruments[i]->nResSwing = 0;
-
- //might be a good idea to leave those enabled...
- /*
- m_SndFile.Instruments[i]->dwFlags &= ~ENV_VOLUME;
- m_SndFile.Instruments[i]->dwFlags &= ~ENV_PANNING;
- m_SndFile.Instruments[i]->dwFlags &= ~ENV_PITCH;
- m_SndFile.Instruments[i]->dwFlags &= ~ENV_FILTER;
- */
- }
- }
-
- // reset samples
- ctrlSmp::ResetSamples(m_SndFile, ctrlSmp::SmpResetCompo);
-
- // Set modflags.
- m_SndFile.SetModFlag(MSF_MIDICC_BUGEMULATION, false);
- m_SndFile.SetModFlag(MSF_OLDVOLSWING, false);
- m_SndFile.SetModFlag(MSF_COMPATIBLE_PLAY, true);
-
- END_CRITICAL();
- EndWaitCursor();
-
- UpdateAllViews(NULL, HINT_MODGENERAL, this);
-
- SetModified();
- return TRUE;
-}
-
-
BOOL CModDoc::AdjustEndOfSample(UINT nSample)
//-------------------------------------------
{
@@ -2018,8 +1368,8 @@
}
-bool CModDoc::MoveOrder(ORDERINDEX nSourceNdx, ORDERINDEX nDestNdx, bool bUpdate, bool bCopy)
-//-------------------------------------------------------------------------------------------
+bool CModDoc::MoveOrder(ORDERINDEX nSourceNdx, ORDERINDEX nDestNdx, bool bUpdate, bool bCopy, SEQUENCEINDEX nSourceSeq, SEQUENCEINDEX nDestSeq)
+//---------------------------------------------------------------------------------------------------------------------------------------------
{
if ((nSourceNdx >= m_SndFile.Order.size()) || (nDestNdx >= m_SndFile.Order.size())) return false;
if (nDestNdx >= m_SndFile.GetModSpecifications().ordersMax) return false;
Modified: trunk/OpenMPT/mptrack/dlg_misc.cpp
===================================================================
--- trunk/OpenMPT/mptrack/dlg_misc.cpp 2009-10-04 18:13:30 UTC (rev 386)
+++ trunk/OpenMPT/mptrack/dlg_misc.cpp 2009-10-05 17:02:19 UTC (rev 387)
@@ -7,7 +7,6 @@
#include "ChildFrm.h"
#include "vstplug.h"
#include "ChannelManagerDlg.h"
-#include ".\dlg_misc.h"
#include "midi.h"
#include "version.h"
Modified: trunk/OpenMPT/mptrack/mptrack.rc
===================================================================
--- trunk/OpenMPT/mptrack/mptrack.rc 2009-10-04 18:13:30 UTC (rev 386)
+++ trunk/OpenMPT/mptrack/mptrack.rc 2009-10-05 17:02:19 UTC (rev 387)
@@ -36,7 +36,30 @@
LTEXT "The following problems have been encountered when loading this module:",IDC_STATIC,6,6,237,8
END
+IDD_CLEANUP_SONG DIALOGEX 0, 0, 298, 161
+STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "Cleanup"
+FONT 8, "MS Shell Dlg", 400, 0, 0x1
+BEGIN
+ DEFPUSHBUTTON "OK",IDOK,240,6,50,14
+ PUSHBUTTON "Cancel",IDCANCEL,240,24,50,14
+ GROUPBOX "Items to be cleaned up",IDC_STATIC,6,6,228,90
+ CONTROL "Remove unused patterns",IDC_CHK_CLEANUP_PATTERNS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,24,102,12
+ CONTROL "Rearrange patterns",IDC_CHK_REARRANGE_PATTERNS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,126,24,102,12
+ CONTROL "Remove unused samples",IDC_CHK_CLEANUP_SAMPLES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,42,102,12
+ CONTROL "Rearrange samples",IDC_CHK_REARRANGE_SAMPLES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,126,42,102,12
+ CONTROL "Remove unused instruments",IDC_CHK_CLEANUP_INSTRUMENTS,
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,60,102,12
+ CONTROL "Remove all instruments",IDC_CHK_REMOVE_INSTRUMENTS,
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,126,60,102,12
+ CONTROL "Remove unused plugins",IDC_CHK_CLEANUP_PLUGINS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,78,102,12
+ CONTROL "Turn into samplepack",IDC_CHK_SAMPLEPACK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,126,78,102,12
+ GROUPBOX "Presets",IDC_STATIC,6,102,228,48
+ PUSHBUTTON "Remove all unused stuff",IDC_BTN_CLEANUP_SONG,18,120,96,18
+ PUSHBUTTON "Compo cleanup",IDC_BTN_COM...
[truncated message content] |
|
From: <sag...@us...> - 2009-10-04 18:13:42
|
Revision: 386
http://modplug.svn.sourceforge.net/modplug/?rev=386&view=rev
Author: saga-games
Date: 2009-10-04 18:13:30 +0000 (Sun, 04 Oct 2009)
Log Message:
-----------
[Fix] Mod Creation: MOD Panning scheme is set up correctly now.
[Fix] Treeview: Removing orders works correctly now.
[Imp] Treeview: Show whole sequence (don't stop on first "---" item)
[Imp] Pattern editor: If "record note off" is enabled and Note Off commands are not supported by the current format, try Note Cut and volume commands
[Ref] Fixed various compiler warnings
Modified Paths:
--------------
trunk/OpenMPT/mptrack/Ctrl_seq.cpp
trunk/OpenMPT/mptrack/Moddoc.cpp
trunk/OpenMPT/mptrack/Moddoc.h
trunk/OpenMPT/mptrack/Modedit.cpp
trunk/OpenMPT/mptrack/View_pat.cpp
trunk/OpenMPT/mptrack/View_tre.cpp
trunk/OpenMPT/mptrack/View_tre.h
trunk/OpenMPT/soundlib/Load_med.cpp
trunk/OpenMPT/soundlib/Load_mod.cpp
trunk/OpenMPT/soundlib/Sndfile.cpp
trunk/OpenMPT/soundlib/Sndfile.h
Modified: trunk/OpenMPT/mptrack/Ctrl_seq.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Ctrl_seq.cpp 2009-10-04 12:50:16 UTC (rev 385)
+++ trunk/OpenMPT/mptrack/Ctrl_seq.cpp 2009-10-04 18:13:30 UTC (rev 386)
@@ -266,7 +266,7 @@
InvalidateSelection();
if ((m_pParent) && (m_pModDoc) && (bEdit))
{
- UINT n = pSndFile->Order[m_nScrollPos];
+ PATTERNINDEX n = pSndFile->Order[m_nScrollPos];
if ((n < pSndFile->Patterns.Size()) && (pSndFile->Patterns[n]) && !bShiftClick)
{
BOOL bIsPlaying = (pMainFrm->GetModPlaying() == m_pModDoc);
@@ -1000,7 +1000,7 @@
for(int i = 0; i <= (selection.nOrdHi - selection.nOrdLo); i++)
{
- m_pModDoc->RemoveOrder(selection.nOrdLo);
+ m_pModDoc->RemoveOrder(pSndFile->Order.GetCurrentSequenceIndex(), selection.nOrdLo);
}
InvalidateRect(NULL, FALSE);
m_pModDoc->UpdateAllViews(NULL, HINT_MODSEQUENCE, this);
Modified: trunk/OpenMPT/mptrack/Moddoc.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Moddoc.cpp 2009-10-04 12:50:16 UTC (rev 385)
+++ trunk/OpenMPT/mptrack/Moddoc.cpp 2009-10-04 18:13:30 UTC (rev 386)
@@ -657,16 +657,15 @@
m_SndFile.m_nSamplePreAmp = m_SndFile.m_nVSTiVolume = 128;
}
- for (UINT init=0; init<MAX_BASECHANNELS; init++)
+ for (CHANNELINDEX nChn=0; nChn < MAX_BASECHANNELS; nChn++)
{
- m_SndFile.ChnSettings[init].dwFlags = 0;
- m_SndFile.ChnSettings[init].nVolume = 64;
- if (m_SndFile.m_nType & (MOD_TYPE_XM|MOD_TYPE_IT | MOD_TYPE_MPT))
- m_SndFile.ChnSettings[init].nPan = 128;
- else
- m_SndFile.ChnSettings[init].nPan = (init & 0x01) ? 64 : 192;
- m_SndFile.Chn[init].nGlobalVol = 64;
+ m_SndFile.ChnSettings[nChn].dwFlags = 0;
+ m_SndFile.ChnSettings[nChn].nVolume = 64;
+ m_SndFile.ChnSettings[nChn].nPan = 128;
+ m_SndFile.Chn[nChn].nGlobalVol = 64;
}
+ // Setup LRRL panning scheme for MODs
+ m_SndFile.SetupMODPanning();
}
if (!m_SndFile.m_nSamples)
{
Modified: trunk/OpenMPT/mptrack/Moddoc.h
===================================================================
--- trunk/OpenMPT/mptrack/Moddoc.h 2009-10-04 12:50:16 UTC (rev 385)
+++ trunk/OpenMPT/mptrack/Moddoc.h 2009-10-04 18:13:30 UTC (rev 386)
@@ -203,10 +203,10 @@
SAMPLEINDEX InsertSample(bool bLimit = false);
INSTRUMENTINDEX InsertInstrument(LONG lSample = 0, LONG lDuplicate = 0);
void InitializeInstrument(MODINSTRUMENT *pIns, UINT nsample=0);
- bool RemoveOrder(ORDERINDEX n);
- bool RemovePattern(PATTERNINDEX n);
- bool RemoveSample(SAMPLEINDEX n);
- bool RemoveInstrument(INSTRUMENTINDEX n);
+ bool RemoveOrder(SEQUENCEINDEX nSeq, ORDERINDEX nOrd);
+ bool RemovePattern(PATTERNINDEX nPat);
+ bool RemoveSample(SAMPLEINDEX nSmp);
+ bool RemoveInstrument(INSTRUMENTINDEX nIns);
UINT PlayNote(UINT note, UINT nins, UINT nsmp, BOOL bpause, LONG nVol=-1, LONG loopstart=0, LONG loopend=0, int nCurrentChn=-1, const uint32 nStartPos = uint32_max); //rewbs.vstiLive: added current chan param
BOOL NoteOff(UINT note, BOOL bFade=FALSE, UINT nins=-1, UINT nCurrentChn=-1); //rewbs.vstiLive: add params
Modified: trunk/OpenMPT/mptrack/Modedit.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Modedit.cpp 2009-10-04 12:50:16 UTC (rev 385)
+++ trunk/OpenMPT/mptrack/Modedit.cpp 2009-10-04 18:13:30 UTC (rev 386)
@@ -152,7 +152,7 @@
MODCOMMAND *pDest = m_SndFile.Patterns[nNewPat];
memcpy(pDest, pSrc, m_SndFile.PatternSize[nPat] * m_SndFile.m_nChannels * sizeof(MODCOMMAND));
m = pDest + len;
- patternsFixed.resize(max(nNewPat + 1, patternsFixed.size()), SEQUENCEINDEX_INVALID);
+ patternsFixed.resize(max(nNewPat + 1, (PATTERNINDEX)patternsFixed.size()), SEQUENCEINDEX_INVALID);
nPat = nNewPat;
} else
{
@@ -923,6 +923,7 @@
}
m_SndFile.m_nChannels = nNewChannels;
+ m_SndFile.SetupMODPanning();
END_CRITICAL();
EndWaitCursor();
}
@@ -1939,34 +1940,37 @@
}
-bool CModDoc::RemoveOrder(ORDERINDEX n)
-//-------------------------------
+bool CModDoc::RemoveOrder(SEQUENCEINDEX nSeq, ORDERINDEX nOrd)
+//------------------------------------------------------------
{
- if (n < m_SndFile.Order.size())
+ if (nSeq >= m_SndFile.Order.GetNumSequences() || nOrd >= m_SndFile.Order.GetSequence(nSeq).size())
+ return false;
+
+ BEGIN_CRITICAL();
+ SEQUENCEINDEX nOldSeq = m_SndFile.Order.GetCurrentSequenceIndex();
+ m_SndFile.Order.SetSequence(nSeq);
+ for (ORDERINDEX i = nOrd; i < m_SndFile.Order.GetSequence(nSeq).size() - 1; i++)
{
- BEGIN_CRITICAL();
- for (ORDERINDEX i=n; i<m_SndFile.Order.size()-1; i++)
- {
- m_SndFile.Order[i] = m_SndFile.Order[i+1];
- }
- m_SndFile.Order[m_SndFile.Order.size()-1] = m_SndFile.Order.GetInvalidPatIndex();
- END_CRITICAL();
- SetModified();
- return true;
+ m_SndFile.Order[i] = m_SndFile.Order[i + 1];
}
- return false;
+ m_SndFile.Order[m_SndFile.Order.GetLastIndex()] = m_SndFile.Order.GetInvalidPatIndex();
+ m_SndFile.Order.SetSequence(nOldSeq);
+ END_CRITICAL();
+ SetModified();
+ return true;
}
-bool CModDoc::RemovePattern(PATTERNINDEX n)
-//---------------------------------
+
+bool CModDoc::RemovePattern(PATTERNINDEX nPat)
+//--------------------------------------------
{
- if ((n < m_SndFile.Patterns.Size()) && (m_SndFile.Patterns[n]))
+ if ((nPat < m_SndFile.Patterns.Size()) && (m_SndFile.Patterns[nPat]))
{
BEGIN_CRITICAL();
- LPVOID p = m_SndFile.Patterns[n];
- m_SndFile.Patterns[n] = nullptr;
- m_SndFile.SetPatternName(n, "");
+ LPVOID p = m_SndFile.Patterns[nPat];
+ m_SndFile.Patterns[nPat] = nullptr;
+ m_SndFile.SetPatternName(nPat, "");
CSoundFile::FreePattern(p);
END_CRITICAL();
SetModified();
@@ -1976,14 +1980,14 @@
}
-bool CModDoc::RemoveSample(SAMPLEINDEX n)
-//--------------------------------
+bool CModDoc::RemoveSample(SAMPLEINDEX nSmp)
+//------------------------------------------
{
- if ((n) && (n <= m_SndFile.m_nSamples))
+ if ((nSmp) && (nSmp <= m_SndFile.m_nSamples))
{
BEGIN_CRITICAL();
- m_SndFile.DestroySample(n);
- m_SndFile.m_szNames[n][0] = 0;
+ 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--;
@@ -1995,15 +1999,15 @@
}
-bool CModDoc::RemoveInstrument(INSTRUMENTINDEX n)
-//------------------------------------
+bool CModDoc::RemoveInstrument(INSTRUMENTINDEX nIns)
+//--------------------------------------------------
{
- if ((n) && (n <= m_SndFile.m_nInstruments) && (m_SndFile.Instruments[n]))
+ if ((nIns) && (nIns <= m_SndFile.m_nInstruments) && (m_SndFile.Instruments[nIns]))
{
BOOL bIns = FALSE;
BEGIN_CRITICAL();
- m_SndFile.DestroyInstrument(n);
- if (n == m_SndFile.m_nInstruments) m_SndFile.m_nInstruments--;
+ 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;
END_CRITICAL();
Modified: trunk/OpenMPT/mptrack/View_pat.cpp
===================================================================
--- trunk/OpenMPT/mptrack/View_pat.cpp 2009-10-04 12:50:16 UTC (rev 385)
+++ trunk/OpenMPT/mptrack/View_pat.cpp 2009-10-04 18:13:30 UTC (rev 386)
@@ -3999,12 +3999,27 @@
if (usePlaybackPosition && nTick) { // avoid SD0 which will be mis-interpreted
if (p->command == 0) { //make sure we don't overwrite any existing commands.
p->command = (pSndFile->TypeIsS3M_IT_MPT()) ? CMD_S3MCMDEX : CMD_MODCMDEX;
- p->param = 0xD0 + min(0xF, nTick);
+ p->param = 0xD0 | min(0xF, nTick);
}
}
//Enter note off
- p->note = NOTE_KEYOFF;
+ if(pModDoc->GetSoundFile()->GetModSpecifications().hasNoteOff) // ===
+ p->note = NOTE_KEYOFF;
+ else if(pModDoc->GetSoundFile()->GetModSpecifications().hasNoteCut) // ^^^
+ p->note = NOTE_NOTECUT;
+ else { // we don't have anything to cut (MOD format) - use volume or ECx
+ if(usePlaybackPosition && nTick) // ECx
+ {
+ p->command = (pSndFile->TypeIsS3M_IT_MPT()) ? CMD_S3MCMDEX : CMD_MODCMDEX;
+ p->param = 0xC0 | min(0xF, nTick);
+ } else // C00
+ {
+ p->note = NOTE_NONE;
+ p->command = CMD_VOLUME;
+ p->param = 0;
+ }
+ }
p->instr = (bChordMode) ? 0 : ins; //p->instr = 0;
//Writing the instrument as well - probably someone finds this annoying :)
p->volcmd = 0;
Modified: trunk/OpenMPT/mptrack/View_tre.cpp
===================================================================
--- trunk/OpenMPT/mptrack/View_tre.cpp 2009-10-04 12:50:16 UTC (rev 385)
+++ trunk/OpenMPT/mptrack/View_tre.cpp 2009-10-04 18:13:30 UTC (rev 386)
@@ -742,65 +742,52 @@
}
// If there are items past the new sequence length, delete them.
- for(size_t nOrd = pSndFile->Order.GetSequence(nSeq).GetLength(); nOrd < pInfo->tiOrders[nSeq].size(); nOrd++) if (pInfo->tiOrders[nSeq][nOrd])
+ for(size_t nOrd = pSndFile->Order.GetSequence(nSeq).GetLengthTailTrimmed(); nOrd < pInfo->tiOrders[nSeq].size(); nOrd++) if (pInfo->tiOrders[nSeq][nOrd])
{
DeleteItem(pInfo->tiOrders[nSeq][nOrd]); pInfo->tiOrders[nSeq][nOrd] = NULL;
}
- if (pInfo->tiOrders[nSeq].size() < pSndFile->Order.GetSequence(nSeq).GetLength()) // Resize tiOrders if needed.
- pInfo->tiOrders[nSeq].resize(pSndFile->Order.GetSequence(nSeq).GetLength(), NULL);
- UINT imin = 0, imax = pSndFile->Order.GetSequence(nSeq).GetLastIndex();
+ if (pInfo->tiOrders[nSeq].size() < pSndFile->Order.GetSequence(nSeq).GetLengthTailTrimmed()) // Resize tiOrders if needed.
+ pInfo->tiOrders[nSeq].resize(pSndFile->Order.GetSequence(nSeq).GetLengthTailTrimmed(), NULL);
const bool patNamesOnly = (hintFlagPart == HINT_PATNAMES);
//if (hintFlagPart == HINT_PATNAMES) && (dwHintParam < pSndFile->Order.size())) imin = imax = dwHintParam;
- bool bEnded = false;
- for (UINT iOrd=imin; iOrd<=imax; iOrd++)
+ for (ORDERINDEX iOrd = 0; iOrd < pSndFile->Order.GetSequence(nSeq).GetLengthTailTrimmed(); iOrd++)
{
- if (pSndFile->Order.GetSequence(nSeq)[iOrd] == pSndFile->Order.GetInvalidPatIndex()) bEnded = true;
- if (bEnded)
+ if(patNamesOnly && pSndFile->Order.GetSequence(nSeq)[iOrd] != nPat)
+ continue;
+ UINT state = (iOrd == pInfo->nOrdSel && nSeq == pInfo->nSeqSel) ? TVIS_BOLD : 0;
+ if (pSndFile->Order.GetSequence(nSeq)[iOrd] < pSndFile->Patterns.Size())
{
- if (pInfo->tiOrders[nSeq][iOrd])
+ stmp[0] = 0;
+ pSndFile->GetPatternName(pSndFile->Order.GetSequence(nSeq)[iOrd], stmp, sizeof(stmp));
+ if (stmp[0])
{
- DeleteItem(pInfo->tiOrders[nSeq][iOrd]);
- pInfo->tiOrders[nSeq][iOrd] = NULL;
- }
- } else
- {
- if(patNamesOnly && pSndFile->Order.GetSequence(nSeq)[iOrd] != nPat)
- continue;
- UINT state = (iOrd == pInfo->nOrdSel && nSeq == pInfo->nSeqSel) ? TVIS_BOLD : 0;
- if (pSndFile->Order.GetSequence(nSeq)[iOrd] < pSndFile->Patterns.Size())
- {
- stmp[0] = 0;
- pSndFile->GetPatternName(pSndFile->Order.GetSequence(nSeq)[iOrd], stmp, sizeof(stmp));
- if (stmp[0])
- {
- wsprintf(s, (CMainFrame::m_dwPatternSetup & PATTERN_HEXDISPLAY) ? "[%02Xh] %d: %s" : "[%02d] %d: %s",
- iOrd, pSndFile->Order.GetSequence(nSeq)[iOrd], stmp);
- } else
- {
- wsprintf(s, (CMainFrame::m_dwPatternSetup & PATTERN_HEXDISPLAY) ? "[%02Xh] Pattern %d" : "[%02d] Pattern %d",
- iOrd, pSndFile->Order.GetSequence(nSeq)[iOrd]);
- }
+ wsprintf(s, (CMainFrame::m_dwPatternSetup & PATTERN_HEXDISPLAY) ? "[%02Xh] %d: %s" : "[%02d] %d: %s",
+ iOrd, pSndFile->Order.GetSequence(nSeq)[iOrd], stmp);
} else
{
- wsprintf(s, "[%02d] Skip", iOrd);
+ wsprintf(s, (CMainFrame::m_dwPatternSetup & PATTERN_HEXDISPLAY) ? "[%02Xh] Pattern %d" : "[%02d] Pattern %d",
+ iOrd, pSndFile->Order.GetSequence(nSeq)[iOrd]);
}
- if (pInfo->tiOrders[nSeq][iOrd])
- {
- tvi.mask = TVIF_TEXT | TVIF_HANDLE | TVIF_STATE;
- tvi.state = 0;
- tvi.stateMask = TVIS_BOLD;
- tvi.hItem = pInfo->tiOrders[nSeq][iOrd];
- tvi.pszText = stmp;
- tvi.cchTextMax = sizeof(stmp);
- GetItem(&tvi);
- if ((strcmp(s, stmp)) || (tvi.state != state))
- SetItem(pInfo->tiOrders[nSeq][iOrd], TVIF_TEXT | TVIF_STATE, s, 0, 0, state, TVIS_BOLD, 0);
- } else
- {
- pInfo->tiOrders[nSeq][iOrd] = InsertItem(s, IMAGE_PARTITION, IMAGE_PARTITION, hAncestorNode, TVI_LAST);
- }
+ } else
+ {
+ wsprintf(s, "[%02d] Skip", iOrd);
}
+ if (pInfo->tiOrders[nSeq][iOrd])
+ {
+ tvi.mask = TVIF_TEXT | TVIF_HANDLE | TVIF_STATE;
+ tvi.state = 0;
+ tvi.stateMask = TVIS_BOLD;
+ tvi.hItem = pInfo->tiOrders[nSeq][iOrd];
+ tvi.pszText = stmp;
+ tvi.cchTextMax = sizeof(stmp);
+ GetItem(&tvi);
+ if ((strcmp(s, stmp)) || (tvi.state != state))
+ SetItem(pInfo->tiOrders[nSeq][iOrd], TVIF_TEXT | TVIF_STATE, s, 0, 0, state, TVIS_BOLD, 0);
+ } else
+ {
+ pInfo->tiOrders[nSeq][iOrd] = InsertItem(s, IMAGE_PARTITION, IMAGE_PARTITION, hAncestorNode, TVI_LAST);
+ }
}
}
}
@@ -1035,7 +1022,6 @@
// find sequence this item belongs to
for(SEQUENCEINDEX nSeq = 0; nSeq < pSong->tiOrders.size(); nSeq++)
{
- ASSERT(pSong->tiOrders[nSeq].size() == pSndFile->Order.size());
for(ORDERINDEX nOrd = 0; nOrd < pSong->tiOrders[nSeq].size(); nOrd++)
{
if (hItem == pSong->tiOrders[nSeq][nOrd])
@@ -1338,7 +1324,7 @@
switch(qwItemType & 0xFFFF)
{
case MODITEM_ORDER:
- if ((pModDoc) && (pModDoc->RemoveOrder((ORDERINDEX)dwItem)))
+ if ((pModDoc) && (pModDoc->RemoveOrder((SEQUENCEINDEX)(dwItem >> 16), (ORDERINDEX)(dwItem & 0xFFFF))))
{
pModDoc->UpdateAllViews(NULL, HINT_MODSEQUENCE, NULL);
}
Modified: trunk/OpenMPT/mptrack/View_tre.h
===================================================================
--- trunk/OpenMPT/mptrack/View_tre.h 2009-10-04 12:50:16 UTC (rev 385)
+++ trunk/OpenMPT/mptrack/View_tre.h 2009-10-04 18:13:30 UTC (rev 386)
@@ -45,8 +45,10 @@
struct MODTREEDOCINFO
{
CModDoc *pModDoc;
+ // Module information
SEQUENCEINDEX nSeqSel;
ORDERINDEX nOrdSel;
+ // Tree state variables
HTREEITEM hSong, hPatterns, hSamples, hInstruments, hComments, hOrders, hEffects;
vector<HTREEITEM> tiPatterns;
HTREEITEM tiSamples[MAX_SAMPLES];
Modified: trunk/OpenMPT/soundlib/Load_med.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Load_med.cpp 2009-10-04 12:50:16 UTC (rev 385)
+++ trunk/OpenMPT/soundlib/Load_med.cpp 2009-10-04 18:13:30 UTC (rev 386)
@@ -912,12 +912,8 @@
}
}
}
- // Setup channel pan positions
- for (UINT iCh=0; iCh<m_nChannels; iCh++)
- {
- ChnSettings[iCh].nPan = (((iCh&3) == 1) || ((iCh&3) == 2)) ? 0xC0 : 0x40;
- ChnSettings[iCh].nVolume = 64;
- }
+ // Setup channel pan positions and volume
+ SetupMODPanning(true);
return true;
}
Modified: trunk/OpenMPT/soundlib/Load_mod.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Load_mod.cpp 2009-10-04 12:50:16 UTC (rev 385)
+++ trunk/OpenMPT/soundlib/Load_mod.cpp 2009-10-04 18:13:30 UTC (rev 386)
@@ -348,15 +348,9 @@
m_nMinPeriod = 14 << 2;
m_nMaxPeriod = 3424 << 2;
memcpy(m_szNames, lpStream, 20);
- // Setting channels pan
- for (UINT ich=0; ich<m_nChannels; ich++)
- {
- ChnSettings[ich].nVolume = 64;
- if (gdwSoundSetup & SNDMIX_MAXDEFAULTPAN)
- ChnSettings[ich].nPan = (((ich&3)==1) || ((ich&3)==2)) ? 256 : 0;
- else
- ChnSettings[ich].nPan = (((ich&3)==1) || ((ich&3)==2)) ? 0xC0 : 0x40; // this should be inverted for Amiga playback
- }
+ // Setup channel pan positions and volume
+ SetupMODPanning();
+
// Reading channels
for (UINT ipat=0; ipat<nbp; ipat++)
{
Modified: trunk/OpenMPT/soundlib/Sndfile.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Sndfile.cpp 2009-10-04 12:50:16 UTC (rev 385)
+++ trunk/OpenMPT/soundlib/Sndfile.cpp 2009-10-04 18:13:30 UTC (rev 386)
@@ -516,12 +516,9 @@
memset(&m_SongEQ, 0, sizeof(m_SongEQ));
ResetMidiCfg();
//for (UINT npt=0; npt<Patterns.Size(); npt++) PatternSize[npt] = 64;
- for (UINT nch=0; nch<MAX_BASECHANNELS; nch++)
+ for (CHANNELINDEX nChn = 0; nChn < MAX_BASECHANNELS; nChn++)
{
- ChnSettings[nch].nPan = 128;
- ChnSettings[nch].nVolume = 64;
- ChnSettings[nch].dwFlags = 0;
- ChnSettings[nch].szName[0] = 0;
+ InitChannel(nChn);
}
if (lpStream)
{
@@ -1337,19 +1334,21 @@
//m_nSeqOverride = 0;
}
-ORDERINDEX CSoundFile::FindOrder(PATTERNINDEX pat, UINT startFromOrder, bool direction)
+ORDERINDEX CSoundFile::FindOrder(PATTERNINDEX nPat, UINT startFromOrder, bool direction)
//-------------------------------------------------------------------------------------
{
- int foundAtOrder = ORDERINDEX_INVALID;
- int candidateOrder = 0;
+ ORDERINDEX foundAtOrder = ORDERINDEX_INVALID;
+ ORDERINDEX candidateOrder = 0;
- for (UINT p=0; p<Order.size(); p++) {
- if (direction) {
- candidateOrder = (startFromOrder+p)%Order.size(); //wrap around MAX_ORDERS
+ for (ORDERINDEX p = 0; p < Order.size(); p++)
+ {
+ if (direction)
+ {
+ candidateOrder = (startFromOrder + p) % Order.size(); //wrap around MAX_ORDERS
} else {
- candidateOrder = (startFromOrder-p+Order.size())%Order.size(); //wrap around 0 and MAX_ORDERS
+ candidateOrder = (startFromOrder - p + Order.size()) % Order.size(); //wrap around 0 and MAX_ORDERS
}
- if (Order[candidateOrder] == pat) {
+ if (Order[candidateOrder] == nPat) {
foundAtOrder = candidateOrder;
break;
}
@@ -1418,25 +1417,25 @@
}
-bool CSoundFile::InitChannel(UINT nch)
-//-------------------------------------
+bool CSoundFile::InitChannel(CHANNELINDEX nChn)
+//---------------------------------------------
{
- if(nch >= MAX_BASECHANNELS) return true;
+ if(nChn >= MAX_BASECHANNELS) return true;
- ChnSettings[nch].nPan = 128;
- ChnSettings[nch].nVolume = 64;
- ChnSettings[nch].dwFlags = 0;
- ChnSettings[nch].nMixPlugin = 0;
- ChnSettings[nch].szName[0] = 0;
+ ChnSettings[nChn].nPan = 128;
+ ChnSettings[nChn].nVolume = 64;
+ ChnSettings[nChn].dwFlags = 0;
+ ChnSettings[nChn].nMixPlugin = 0;
+ ChnSettings[nChn].szName[0] = 0;
- ResetChannelState(nch, CHNRESET_TOTAL);
+ ResetChannelState(nChn, CHNRESET_TOTAL);
if(m_pModDoc)
{
- m_pModDoc->Record1Channel(nch,FALSE);
- m_pModDoc->Record2Channel(nch,FALSE);
+ m_pModDoc->Record1Channel(nChn, false);
+ m_pModDoc->Record2Channel(nChn, false);
}
- m_bChannelMuteTogglePending[nch] = false;
+ m_bChannelMuteTogglePending[nChn] = false;
return false;
}
@@ -1525,7 +1524,7 @@
//added to position i. If index of some current channel is missing from the
//newOrder-vector, then the channel gets removed.
- UINT nRemainingChannels = newOrder.size();
+ CHANNELINDEX nRemainingChannels = newOrder.size();
if(nRemainingChannels > GetModSpecifications().channelsMax || nRemainingChannels < GetModSpecifications().channelsMin)
{
@@ -1536,13 +1535,12 @@
}
BEGIN_CRITICAL();
- UINT i = 0;
- for (i=0; i<Patterns.Size(); i++)
+ for (PATTERNINDEX nPat = 0; nPat < Patterns.Size(); nPat++)
{
- if (Patterns[i])
+ if (Patterns[nPat])
{
- MODCOMMAND *p = Patterns[i];
- MODCOMMAND *newp = CSoundFile::AllocatePattern(PatternSize[i], nRemainingChannels);
+ MODCOMMAND *p = Patterns[nPat];
+ MODCOMMAND *newp = CSoundFile::AllocatePattern(PatternSize[nPat], nRemainingChannels);
if (!newp)
{
END_CRITICAL();
@@ -1550,18 +1548,18 @@
return 0;
}
MODCOMMAND *tmpsrc = p, *tmpdest = newp;
- for (UINT j=0; j<PatternSize[i]; j++) //Scrolling rows
+ for (ROWINDEX nRow = 0; nRow<PatternSize[nPat]; nRow++) //Scrolling rows
{
- for (UINT k=0; k<nRemainingChannels; k++, tmpdest++) //Scrolling channels.
+ for (CHANNELINDEX nChn = 0; nChn < nRemainingChannels; nChn++, tmpdest++) //Scrolling channels.
{
- if(newOrder[k] < m_nChannels) //Case: getting old channel to the new channel order.
- *tmpdest = tmpsrc[j*m_nChannels+newOrder[k]];
+ if(newOrder[nChn] < m_nChannels) //Case: getting old channel to the new channel order.
+ *tmpdest = tmpsrc[nRow*m_nChannels+newOrder[nChn]];
else //Case: figure newOrder[k] is not the index of any current channel, so adding a new channel.
*tmpdest = MODCOMMAND::Empty();
}
}
- Patterns[i] = newp;
+ Patterns[nPat] = newp;
CSoundFile::FreePattern(p);
}
}
@@ -1571,36 +1569,38 @@
UINT recordStates[MAX_BASECHANNELS];
bool chnMutePendings[MAX_BASECHANNELS];
- for(i = 0 ; i < m_nChannels ; i++)
+ for(CHANNELINDEX nChn = 0; nChn < m_nChannels; nChn++)
{
- settings[i] = ChnSettings[i];
- chns[i] = Chn[i];
+ settings[nChn] = ChnSettings[nChn];
+ chns[nChn] = Chn[nChn];
if(m_pModDoc)
- recordStates[i] = m_pModDoc->IsChannelRecord(i);
- chnMutePendings[i] = m_bChannelMuteTogglePending[i];
+ recordStates[nChn] = m_pModDoc->IsChannelRecord(nChn);
+ chnMutePendings[nChn] = m_bChannelMuteTogglePending[nChn];
}
if(m_pModDoc)
m_pModDoc->ReinitRecordState();
- for (UINT i=0; i<nRemainingChannels; i++)
+ for (CHANNELINDEX nChn = 0; nChn < nRemainingChannels; nChn++)
{
- if(newOrder[i] < m_nChannels)
+ if(newOrder[nChn] < m_nChannels)
{
- ChnSettings[i] = settings[newOrder[i]];
- Chn[i] = chns[newOrder[i]];
+ ChnSettings[nChn] = settings[newOrder[nChn]];
+ Chn[nChn] = chns[newOrder[nChn]];
if(m_pModDoc)
{
- if(recordStates[newOrder[i]] == 1) m_pModDoc->Record1Channel(i,TRUE);
- if(recordStates[newOrder[i]] == 2) m_pModDoc->Record2Channel(i,TRUE);
+ if(recordStates[newOrder[nChn]] == 1) m_pModDoc->Record1Channel(nChn, true);
+ if(recordStates[newOrder[nChn]] == 2) m_pModDoc->Record2Channel(nChn, true);
}
- m_bChannelMuteTogglePending[i] = chnMutePendings[newOrder[i]];
+ m_bChannelMuteTogglePending[nChn] = chnMutePendings[newOrder[nChn]];
}
else
{
- InitChannel(i);
+ InitChannel(nChn);
}
}
+ // Reset MOD panning (won't affect other module formats)
+ SetupMODPanning();
m_nChannels = nRemainingChannels;
END_CRITICAL();
@@ -2747,12 +2747,12 @@
//-------------------------------------------------
{
if (!pbIns) return false;
- for (UINT j=1; j<MAX_SAMPLES; j++)
+ for (SAMPLEINDEX nSmp=1; nSmp<MAX_SAMPLES; nSmp++)
{
- if ((!pbIns[j]) && (Samples[j].pSample))
+ if ((!pbIns[nSmp]) && (Samples[nSmp].pSample))
{
- DestroySample(j);
- if ((j == m_nSamples) && (j > 1)) m_nSamples--;
+ DestroySample(nSmp);
+ if ((nSmp == m_nSamples) && (nSmp > 1)) m_nSamples--;
}
}
return true;
@@ -3004,6 +3004,7 @@
const MODTYPE oldtype = m_nType;
m_nType = newType;
SetModSpecsPointer(m_pModSpecs, m_nType);
+ SetupMODPanning(); // Setup LRRL panning scheme if needed
m_ModFlags = m_ModFlags & GetModFlagMask(oldtype, newType);
@@ -3191,3 +3192,19 @@
return false;
}
+
+void CSoundFile::SetupMODPanning(bool bForceSetup)
+//------------------------------------------------
+{
+ // Setup LRRL panning, max channel volume
+ if((m_nType & MOD_TYPE_MOD) == 0 && bForceSetup == false) return;
+
+ for (CHANNELINDEX nChn = 0; nChn < MAX_BASECHANNELS; nChn++)
+ {
+ ChnSettings[nChn].nVolume = 64;
+ if (gdwSoundSetup & SNDMIX_MAXDEFAULTPAN)
+ ChnSettings[nChn].nPan = (((nChn & 3) == 1) || ((nChn & 3) == 2)) ? 256 : 0;
+ else
+ ChnSettings[nChn].nPan = (((nChn & 3) == 1) || ((nChn & 3) == 2)) ? 0xC0 : 0x40;
+ }
+}
Modified: trunk/OpenMPT/soundlib/Sndfile.h
===================================================================
--- trunk/OpenMPT/soundlib/Sndfile.h 2009-10-04 12:50:16 UTC (rev 385)
+++ trunk/OpenMPT/soundlib/Sndfile.h 2009-10-04 18:13:30 UTC (rev 386)
@@ -638,7 +638,7 @@
static const CModSpecifications& GetModSpecifications(const MODTYPE type);
double GetCurrentBPM() const;
- ORDERINDEX FindOrder(PATTERNINDEX pat, UINT startFromOrder=0, bool direction=true); //rewbs.playSongFromCursor
+ ORDERINDEX FindOrder(PATTERNINDEX nPat, UINT startFromOrder=0, bool direction = true); //rewbs.playSongFromCursor
void DontLoopPattern(int nPat, int nRow=0); //rewbs.playSongFromCursor
void SetCurrentPos(UINT nPos);
void SetCurrentOrder(UINT nOrder);
@@ -670,7 +670,7 @@
CHANNELINDEX ReArrangeChannels(const vector<CHANNELINDEX>& fromToArray);
bool MoveChannel(UINT chn_from, UINT chn_to);
- bool InitChannel(UINT nch);
+ bool InitChannel(CHANNELINDEX nChn);
void ResetChannelState(CHANNELINDEX chn, BYTE resetStyle);
// Module Loaders
@@ -705,6 +705,9 @@
bool ReadGDM(const LPCBYTE lpStream, const DWORD dwMemLength);
bool ReadIMF(const LPCBYTE lpStream, const DWORD dwMemLength);
bool ReadMID(LPCBYTE lpStream, DWORD dwMemLength);
+
+ void SetupMODPanning(bool bForceSetup = false); // Setup LRRL panning, max channel volume
+
// Save Functions
#ifndef MODPLUG_NO_FILESAVE
UINT WriteSample(FILE *f, MODSAMPLE *pSmp, UINT nFlags, UINT nMaxLen=0);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sag...@us...> - 2009-10-04 12:50:26
|
Revision: 385
http://modplug.svn.sourceforge.net/modplug/?rev=385&view=rev
Author: saga-games
Date: 2009-10-04 12:50:16 +0000 (Sun, 04 Oct 2009)
Log Message:
-----------
[Imp] Treeview: Double-clicking order items and pattern items should work now, dragondrop is not fully functional yet.
[Mod] Updated DE_jojo.mkb (Reset Channel shortcut, Note Cut / Off / Fade are now "old style".
[Mod] Pattern editor: It is impossible to enter something into the voluem column in mod format now.
[Ref] More refactoring (not much).
Modified Paths:
--------------
trunk/OpenMPT/mptrack/Ctrl_pat.cpp
trunk/OpenMPT/mptrack/Ctrl_pat.h
trunk/OpenMPT/mptrack/Ctrl_seq.cpp
trunk/OpenMPT/mptrack/Moddoc.h
trunk/OpenMPT/mptrack/Modedit.cpp
trunk/OpenMPT/mptrack/View_pat.cpp
trunk/OpenMPT/mptrack/View_tre.cpp
trunk/OpenMPT/mptrack/View_tre.h
trunk/OpenMPT/packageTemplate/extraKeymaps/DE_jojo.mkb
Modified: trunk/OpenMPT/mptrack/Ctrl_pat.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Ctrl_pat.cpp 2009-10-02 15:49:41 UTC (rev 384)
+++ trunk/OpenMPT/mptrack/Ctrl_pat.cpp 2009-10-04 12:50:16 UTC (rev 385)
@@ -337,7 +337,8 @@
}
- } else {
+ } else
+ {
UINT nmax = m_pSndFile->m_nSamples;
while ((nmax > 1) && (m_pSndFile->Samples[nmax].pSample == NULL) && (!m_pSndFile->m_szNames[nmax][0])) nmax--;
for (UINT i=1; i<=nmax; i++) if ((m_pSndFile->m_szNames[i][0]) || (m_pSndFile->Samples[i].pSample)) {
@@ -413,7 +414,7 @@
break;
case CTRLMSG_SETCURRENTPATTERN:
- SetCurrentPattern(lParam);
+ SetCurrentPattern((PATTERNINDEX)lParam);
break;
case CTRLMSG_SETCURRENTORDER:
@@ -535,10 +536,10 @@
}
-void CCtrlPatterns::SetCurrentPattern(UINT nPat)
-//----------------------------------------------
+void CCtrlPatterns::SetCurrentPattern(PATTERNINDEX nPat)
+//------------------------------------------------------
{
- SendViewMessage(VIEWMSG_SETCURRENTPATTERN, nPat);
+ SendViewMessage(VIEWMSG_SETCURRENTPATTERN, (LPARAM)nPat);
}
@@ -576,10 +577,7 @@
void CCtrlPatterns::OnActivatePage(LPARAM lParam)
//-----------------------------------------------
{
- CModDoc *pModDoc = GetDocument();
- CSoundFile* pSndFile = pModDoc ? pModDoc->GetSoundFile() : NULL;
-
- if ((pModDoc) && (m_pParent))
+ if ((m_pModDoc) && (m_pParent))
{
int nIns = m_pParent->GetInstrumentChange();
if (nIns > 0)
@@ -588,30 +586,37 @@
}
m_pParent->InstrumentChanged(-1);
}
- if ((lParam >= 0) && (lParam < m_pSndFile->Patterns.Size()))
+ if (!(lParam & 0x8000) && m_pSndFile)
{
- if (pSndFile)
+ // Pattern item
+ PATTERNINDEX nPat = (PATTERNINDEX)(lParam & 0x7FFF);
+ if(m_pSndFile->Patterns.IsValidIndex(nPat))
{
- for (ORDERINDEX i=0; i<pSndFile->Order.size(); i++)
+ for (SEQUENCEINDEX nSeq = 0; nSeq < m_pSndFile->Order.GetNumSequences(); nSeq++)
{
- if (pSndFile->Order[i] == (UINT)lParam)
+ for (ORDERINDEX nOrd = 0; nOrd < m_pSndFile->Order.GetSequence(nSeq).GetLengthTailTrimmed(); nOrd++)
{
- m_OrderList.SetCurSel(i, TRUE);
- break;
+ if (m_pSndFile->Order.GetSequence(nSeq)[nOrd] == nPat)
+ {
+ m_OrderList.SelectSequence(nSeq);
+ m_OrderList.SetCurSel(nOrd, true);
+ break;
+ }
}
- if (pSndFile->Order[i] == pSndFile->Order.GetInvalidPatIndex()) break;
}
}
- SetCurrentPattern(lParam);
+ SetCurrentPattern(nPat);
}
- else if ((lParam >= 0x8000) && (lParam < int(pSndFile->Order.size()) + 0x8000))
+ else if ((lParam & 0x8000) && m_pSndFile)
{
- if (pSndFile)
+ // Order item
+ ORDERINDEX nOrd = (ORDERINDEX)(lParam & 0x7FFF);
+ SEQUENCEINDEX nSeq = (SEQUENCEINDEX)(lParam >> 16);
+ if((nSeq < m_pSndFile->Order.GetNumSequences()) && (nOrd < m_pSndFile->Order.GetSequence(nSeq).size()))
{
- lParam &= 0x7FFF;
- m_OrderList.OnSelectSequence(pSndFile->Order.GetCurrentSequenceIndex()); // new sequence already set in view_tre.cpp, GetModItem()
- m_OrderList.SetCurSel((ORDERINDEX)lParam);
- SetCurrentPattern(pSndFile->Order[lParam]);
+ m_OrderList.SelectSequence(nSeq);
+ m_OrderList.SetCurSel(nOrd);
+ SetCurrentPattern(m_pSndFile->Order[nOrd]);
}
}
if (m_hWndView)
Modified: trunk/OpenMPT/mptrack/Ctrl_pat.h
===================================================================
--- trunk/OpenMPT/mptrack/Ctrl_pat.h 2009-10-02 15:49:41 UTC (rev 384)
+++ trunk/OpenMPT/mptrack/Ctrl_pat.h 2009-10-04 12:50:16 UTC (rev 385)
@@ -81,6 +81,9 @@
// is not interpreted to be in margins regardless of the margin value.
bool IsOrderInMargins(int order, int startOrder);
+ // Set given sqeuence and update orderlist display.
+ void SelectSequence(const SEQUENCEINDEX nSeq);
+
public:
//{{AFX_VIRTUAL(COrderList)
virtual BOOL PreTranslateMessage(MSG *pMsg);
@@ -164,7 +167,7 @@
LONG* GetSplitPosRef() {return &CMainFrame::glPatternWindowHeight;} //rewbs.varWindowSize
public:
- void SetCurrentPattern(UINT nPat);
+ void SetCurrentPattern(PATTERNINDEX nPat);
BOOL SetCurrentInstrument(UINT nIns);
BOOL GetFollowSong() { return IsDlgButtonChecked(IDC_PATTERN_FOLLOWSONG); }
BOOL GetLoopPattern() {return IsDlgButtonChecked(IDC_PATTERN_LOOP);}
Modified: trunk/OpenMPT/mptrack/Ctrl_seq.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Ctrl_seq.cpp 2009-10-02 15:49:41 UTC (rev 384)
+++ trunk/OpenMPT/mptrack/Ctrl_seq.cpp 2009-10-04 12:50:16 UTC (rev 385)
@@ -786,37 +786,7 @@
void COrderList::OnSelectSequence(UINT nid)
//-----------------------------------------
{
- BEGIN_CRITICAL();
- CMainFrame::GetMainFrame()->ResetNotificationBuffer();
- const SEQUENCEINDEX nId = static_cast<SEQUENCEINDEX>(nid - ID_SEQUENCE_ITEM);
- CSoundFile& rSf = *m_pModDoc->GetSoundFile();
- if (nId == MAX_SEQUENCES + 1)
- {
- CString strParam; strParam.Format(TEXT("%u: %s"), rSf.Order.GetCurrentSequenceIndex(), rSf.Order.m_sName);
- CString str;
- AfxFormatString1(str, IDS_CONFIRM_SEQUENCE_DELETE, strParam);
- if (AfxMessageBox(str, MB_YESNO | MB_ICONQUESTION) == IDYES)
- rSf.Order.RemoveSequence();
- else
- {
- END_CRITICAL();
- return;
- }
- }
- else if (nId == MAX_SEQUENCES)
- rSf.Order.AddSequence();
- else if (nId < rSf.Order.GetNumSequences())
- rSf.Order.SetSequence(nId);
- ORDERINDEX nPosCandidate = rSf.Order.GetLengthTailTrimmed() - 1;
- SetCurSel(min(m_nScrollPos, nPosCandidate), true, false, true);
- if (m_pParent)
- m_pParent->SetCurrentPattern(rSf.Order[m_nScrollPos]);
-
- UpdateScrollInfo();
- END_CRITICAL();
- UpdateView(HINT_MODSEQUENCE);
- m_pModDoc->SetModified();
- m_pModDoc->UpdateAllViews(NULL, HINT_MODSEQUENCE, this);
+ SelectSequence(static_cast<SEQUENCEINDEX>(nid - ID_SEQUENCE_ITEM));
}
@@ -1168,3 +1138,38 @@
m_nOrderlistMargins = static_cast<BYTE>(i);
return GetMargins();
}
+
+void COrderList::SelectSequence(const SEQUENCEINDEX nSeq)
+//-------------------------------------------------------
+{
+ BEGIN_CRITICAL();
+ CMainFrame::GetMainFrame()->ResetNotificationBuffer();
+ CSoundFile& rSf = *m_pModDoc->GetSoundFile();
+ if (nSeq == MAX_SEQUENCES + 1)
+ {
+ CString strParam; strParam.Format(TEXT("%u: %s"), rSf.Order.GetCurrentSequenceIndex(), rSf.Order.m_sName);
+ CString str;
+ AfxFormatString1(str, IDS_CONFIRM_SEQUENCE_DELETE, strParam);
+ if (AfxMessageBox(str, MB_YESNO | MB_ICONQUESTION) == IDYES)
+ rSf.Order.RemoveSequence();
+ else
+ {
+ END_CRITICAL();
+ return;
+ }
+ }
+ else if (nSeq == MAX_SEQUENCES)
+ rSf.Order.AddSequence();
+ else if (nSeq < rSf.Order.GetNumSequences())
+ rSf.Order.SetSequence(nSeq);
+ ORDERINDEX nPosCandidate = rSf.Order.GetLengthTailTrimmed() - 1;
+ SetCurSel(min(m_nScrollPos, nPosCandidate), true, false, true);
+ if (m_pParent)
+ m_pParent->SetCurrentPattern(rSf.Order[m_nScrollPos]);
+
+ UpdateScrollInfo();
+ END_CRITICAL();
+ UpdateView(HINT_MODSEQUENCE);
+ m_pModDoc->SetModified();
+ m_pModDoc->UpdateAllViews(NULL, HINT_MODSEQUENCE, this);
+}
Modified: trunk/OpenMPT/mptrack/Moddoc.h
===================================================================
--- trunk/OpenMPT/mptrack/Moddoc.h 2009-10-02 15:49:41 UTC (rev 384)
+++ trunk/OpenMPT/mptrack/Moddoc.h 2009-10-04 12:50:16 UTC (rev 385)
@@ -242,7 +242,7 @@
BOOL IsChildSample(UINT nIns, UINT nSmp) const;
UINT FindSampleParent(UINT nSmp) const;
UINT FindInstrumentChild(UINT nIns) const;
- bool MoveOrder(UINT nSourceNdx, UINT nDestNdx, bool bUpdate = true, bool bCopy = false);
+ bool MoveOrder(ORDERINDEX nSourceNdx, ORDERINDEX nDestNdx, bool bUpdate = true, bool bCopy = false);
BOOL ExpandPattern(PATTERNINDEX nPattern);
BOOL ShrinkPattern(PATTERNINDEX nPattern);
BOOL CopyPattern(PATTERNINDEX nPattern, DWORD dwBeginSel, DWORD dwEndSel);
Modified: trunk/OpenMPT/mptrack/Modedit.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Modedit.cpp 2009-10-02 15:49:41 UTC (rev 384)
+++ trunk/OpenMPT/mptrack/Modedit.cpp 2009-10-04 12:50:16 UTC (rev 385)
@@ -1022,13 +1022,18 @@
vector<MODCOMMAND*> pPatterns(maxPatIndex, NULL);
vector<BOOL> bPatUsed(maxPatIndex, false);
- const ORDERINDEX nLengthSub0 = m_SndFile.Order.GetLengthFirstEmpty();
- const ORDERINDEX nLengthUsed = m_SndFile.Order.GetLengthTailTrimmed();
+ bool bSubtunesDetected = false;
+ // detect subtunes (separated by "---")
+ for(SEQUENCEINDEX nSeq = 0; nSeq < m_SndFile.Order.GetNumSequences(); nSeq++)
+ {
+ if(m_SndFile.Order.GetSequence(nSeq).GetLengthFirstEmpty() != m_SndFile.Order.GetSequence(nSeq).GetLengthTailTrimmed())
+ bSubtunesDetected = true;
+ }
// Flag to tell whether keeping sequence items which are after the first empty('---') order.
bool bKeepSubSequences = false;
- if(nLengthUsed != nLengthSub0)
+ if(bSubtunesDetected)
{ // There are used sequence items after first '---'; ask user whether to remove those.
if (CMainFrame::GetMainFrame()->MessageBox(
_TEXT("Do you want to remove sequence items which are after the first '---' item?"),
@@ -2009,8 +2014,8 @@
}
-bool CModDoc::MoveOrder(UINT nSourceNdx, UINT nDestNdx, bool bUpdate, bool bCopy)
-//-------------------------------------------------------------------------------
+bool CModDoc::MoveOrder(ORDERINDEX nSourceNdx, ORDERINDEX nDestNdx, bool bUpdate, bool bCopy)
+//-------------------------------------------------------------------------------------------
{
if ((nSourceNdx >= m_SndFile.Order.size()) || (nDestNdx >= m_SndFile.Order.size())) return false;
if (nDestNdx >= m_SndFile.GetModSpecifications().ordersMax) return false;
Modified: trunk/OpenMPT/mptrack/View_pat.cpp
===================================================================
--- trunk/OpenMPT/mptrack/View_pat.cpp 2009-10-02 15:49:41 UTC (rev 384)
+++ trunk/OpenMPT/mptrack/View_pat.cpp 2009-10-04 12:50:16 UTC (rev 385)
@@ -3707,6 +3707,7 @@
{
CSoundFile *pSndFile = pModDoc->GetSoundFile();
+ if(pSndFile->m_nType & MOD_TYPE_MOD) return; // no volume column
PrepareUndo(m_dwBeginSel, m_dwEndSel);
@@ -3745,7 +3746,7 @@
case kcSetVolumeITVelocity: if (pSndFile->m_nType & (MOD_TYPE_IT | MOD_TYPE_MPT)) volcmd = VOLCMD_VELOCITY; break; //rewbs.velocity
case kcSetVolumeITOffset: if (pSndFile->m_nType & (MOD_TYPE_IT | MOD_TYPE_MPT)) volcmd = VOLCMD_OFFSET; break; //rewbs.volOff
}
- if ((pSndFile->m_nType & MOD_TYPE_MOD) && (volcmd > VOLCMD_PANNING)) volcmd = vol = 0;
+ //if ((pSndFile->m_nType & MOD_TYPE_MOD) && (volcmd > VOLCMD_PANNING)) volcmd = vol = 0;
UINT max = 64;
if (volcmd > VOLCMD_PANNING)
Modified: trunk/OpenMPT/mptrack/View_tre.cpp
===================================================================
--- trunk/OpenMPT/mptrack/View_tre.cpp 2009-10-02 15:49:41 UTC (rev 384)
+++ trunk/OpenMPT/mptrack/View_tre.cpp 2009-10-04 12:50:16 UTC (rev 385)
@@ -6,7 +6,6 @@
#include "dlsbank.h"
#include "dlg_misc.h"
#include "vstplug.h"
-#include ".\view_tre.h"
#ifndef TVS_SINGLEEXPAND
#define TVS_SINGLEEXPAND 0x400
@@ -704,6 +703,8 @@
pInfo->tiOrders.resize(pSndFile->Order.GetNumSequences());
}
+ // TODO what to do when seq count changed from 2 to 1 or from 1 to 2?
+
/* // number of sequences changed: wipe tree first (is this necessary?)
if(pInfo->tiOrders.size() != pSndFile->Order.GetNumSequences())
{
@@ -728,11 +729,14 @@
if(pSndFile->Order.GetNumSequences() > 1)
{
// more than one sequence -> add folder
+ CString sSeqName = pSndFile->Order.GetSequence(nSeq).m_sName;
+ if(sSeqName.IsEmpty()) sSeqName.Format("Sequence %d", nSeq);
if(pInfo->tiSequences[nSeq] == NULL)
{
- CString sSeqName = pSndFile->Order.GetSequence(nSeq).m_sName;
- if(sSeqName.IsEmpty()) sSeqName.Format("Sequence %d", nSeq);
pInfo->tiSequences[nSeq] = InsertItem(sSeqName, IMAGE_FOLDER, IMAGE_FOLDER, pInfo->hOrders, TVI_LAST);
+ } else
+ {
+
}
hAncestorNode = pInfo->tiSequences[nSeq];
}
@@ -861,7 +865,7 @@
{
if (iSmp <= pSndFile->m_nSamples)
{
- BOOL bSamplePresent = (pSndFile->Samples[iSmp].pSample) ? TRUE : FALSE;
+ bool bSamplePresent = (pSndFile->Samples[iSmp].pSample) ? true : false;
UINT nImage = (bSamplePresent) ? IMAGE_SAMPLES : IMAGE_NOSAMPLE;
wsprintf(s, "%3d: %s", iSmp, pSndFile->m_szNames[iSmp]);
if (!pInfo->tiSamples[iSmp])
@@ -948,7 +952,7 @@
}
-DWORD CModTree::GetModItem(HTREEITEM hItem)
+uint64 CModTree::GetModItem(HTREEITEM hItem)
//-----------------------------------------
{
LPARAM lParam;
@@ -1025,8 +1029,8 @@
if (hItem == pSong->hSamples) return MODITEM_HDR_SAMPLES;
if (hItem == pSong->hInstruments) return MODITEM_HDR_INSTRUMENTS;
if (hItem == pSong->hComments) return MODITEM_COMMENTS;
- // Order List? (either "order list" or "sequence x" item as parent)
- if ((hItemParent == pSong->hOrders && pSong->tiSequences.size() == 1) || (hItemParentParent == pSong->hOrders))
+ // Order List or Sequence item?
+ if ((hItemParent == pSong->hOrders) || (hItemParentParent == pSong->hOrders))
{
// find sequence this item belongs to
for(SEQUENCEINDEX nSeq = 0; nSeq < pSong->tiOrders.size(); nSeq++)
@@ -1036,16 +1040,10 @@
{
if (hItem == pSong->tiOrders[nSeq][nOrd])
{
- if(pSong->pModDoc->GetSoundFile() != nullptr)
- {
- pSong->pModDoc->GetSoundFile()->Order.SetSequence(nSeq);
- // TODO this is buggy
- //OnSelectSequence must be called? Or send a message?
- }
- //if(nSeq != pSong->nSeqSel) // sequence change
- // return (MODITEM_ORDER_SEQUENCE | (nOrd << 16));
- //else // same sequence
- return (MODITEM_ORDER | (nOrd << 16));
+ return (MODITEM_ORDER | (nOrd << 16) | (((uint64)nSeq) << 32));
+ } else if(hItem == pSong->tiSequences[nSeq])
+ {
+ return (MODITEM_SEQUENCE | (nSeq << 16));
}
}
}
@@ -1111,11 +1109,11 @@
{
if (hItem)
{
- DWORD dwItemType = GetModItem(hItem);
- DWORD dwItem = dwItemType >> 16;
+ uint64 qwItemType = GetModItem(hItem);
+ DWORD dwItem = (DWORD)(qwItemType >> 16);
PMODTREEDOCINFO pInfo = DocInfo[m_nDocNdx];
CModDoc *pModDoc = (pInfo) ? pInfo->pModDoc : NULL;
- switch(dwItemType & 0xFFFF)
+ switch(qwItemType & 0xFFFF)
{
case MODITEM_COMMENTS:
if (pModDoc) pModDoc->ActivateView(IDD_CONTROL_COMMENTS, 0);
@@ -1155,7 +1153,7 @@
return TRUE;
default:
- if (dwItemType & 0x8000)
+ if (qwItemType & 0x8000)
{
PlayItem(hItem);
return TRUE;
@@ -1171,11 +1169,11 @@
{
if (hItem)
{
- DWORD dwItemType = GetModItem(hItem);
- DWORD dwItem = dwItemType >> 16;
+ uint64 qwItemType = GetModItem(hItem);
+ DWORD dwItem = (DWORD)(qwItemType >> 16);
PMODTREEDOCINFO pInfo = DocInfo[m_nDocNdx];
CModDoc *pModDoc = (pInfo) ? pInfo->pModDoc : NULL;
- switch(dwItemType & 0xFFFF)
+ switch(qwItemType & 0xFFFF)
{
case MODITEM_SAMPLE:
if (pModDoc)
@@ -1234,7 +1232,7 @@
CMainFrame *pMainFrm = CMainFrame::GetMainFrame();
if (pMainFrm)
{
- if ((dwItemType & 0xFFFF) == MODITEM_INSLIB_INSTRUMENT)
+ if ((qwItemType & 0xFFFF) == MODITEM_INSLIB_INSTRUMENT)
{
pMainFrm->PlaySoundFile(&m_SongFile, n, 0, nParam);
} else
@@ -1265,21 +1263,21 @@
break;
default:
- if (dwItemType & 0x8000)
+ if (qwItemType & 0x8000)
{
CMainFrame *pMainFrm = CMainFrame::GetMainFrame();
- UINT bank = (dwItemType & 0x3F000000) >> 24;
+ UINT bank = (qwItemType & 0x3F000000) >> 24;
if ((bank < MAX_DLS_BANKS) && (CTrackApp::gpDLSBanks[bank]) && (pMainFrm))
{
CDLSBank *pDLSBank = CTrackApp::gpDLSBanks[bank];
- UINT rgn = 0, instr = (dwItemType & 0x00007FFF);
+ UINT rgn = 0, instr = (qwItemType & 0x00007FFF);
// Drum
- if (dwItemType & 0x80000000)
+ if (qwItemType & 0x80000000)
{
- rgn = (dwItemType & 0x007F0000) >> 16;
+ rgn = (qwItemType & 0x007F0000) >> 16;
} else
// Melodic
- if (dwItemType & 0x40000000)
+ if (qwItemType & 0x40000000)
{
if ((!nParam) || (nParam > NOTE_MAX)) nParam = NOTE_MIDDLEC;
rgn = pDLSBank->GetRegionFromKey(instr, nParam-1);
@@ -1333,54 +1331,54 @@
BOOL CModTree::DeleteTreeItem(HTREEITEM hItem)
//--------------------------------------------
{
- DWORD dwItemType = GetModItem(hItem);
- WORD nItem = WORD(dwItemType >> 16);
+ uint64 qwItemType = GetModItem(hItem);
+ DWORD dwItem = (DWORD)(qwItemType >> 16);
PMODTREEDOCINFO pInfo = DocInfo[m_nDocNdx];
CModDoc *pModDoc = (pInfo) ? pInfo->pModDoc : NULL;
- switch(dwItemType & 0xFFFF)
+ switch(qwItemType & 0xFFFF)
{
case MODITEM_ORDER:
- if ((pModDoc) && (pModDoc->RemoveOrder(nItem)))
+ if ((pModDoc) && (pModDoc->RemoveOrder((ORDERINDEX)dwItem)))
{
pModDoc->UpdateAllViews(NULL, HINT_MODSEQUENCE, NULL);
}
break;
case MODITEM_PATTERN:
- if ((pModDoc) && (pModDoc->RemovePattern(nItem)))
+ if ((pModDoc) && (pModDoc->RemovePattern((PATTERNINDEX)dwItem)))
{
//pModDoc->UpdateAllViews(NULL, (dwItem << 16)|HINT_PATTERNDATA|HINT_PATNAMES);
- pModDoc->UpdateAllViews(NULL, (UINT(nItem) << HINT_SHIFT_PAT) | HINT_PATTERNDATA|HINT_PATNAMES);
+ pModDoc->UpdateAllViews(NULL, (UINT(dwItem) << HINT_SHIFT_PAT) | HINT_PATTERNDATA|HINT_PATNAMES);
}
break;
case MODITEM_SAMPLE:
- if ((pModDoc) && (pModDoc->RemoveSample(nItem)))
+ if ((pModDoc) && (pModDoc->RemoveSample((SAMPLEINDEX)dwItem)))
{
//pModDoc->UpdateAllViews(NULL, (dwItem << 16) | HINT_SMPNAMES|HINT_SAMPLEDATA|HINT_SAMPLEINFO);
- pModDoc->UpdateAllViews(NULL, (UINT(nItem) << HINT_SHIFT_SMP) | HINT_SMPNAMES|HINT_SAMPLEDATA|HINT_SAMPLEINFO);
+ pModDoc->UpdateAllViews(NULL, (UINT(dwItem) << HINT_SHIFT_SMP) | HINT_SMPNAMES|HINT_SAMPLEDATA|HINT_SAMPLEINFO);
}
break;
case MODITEM_INSTRUMENT:
- if ((pModDoc) && (pModDoc->RemoveInstrument(nItem)))
+ if ((pModDoc) && (pModDoc->RemoveInstrument((INSTRUMENTINDEX)dwItem)))
{
//pModDoc->UpdateAllViews(NULL, (dwItem << 16)|HINT_MODTYPE|HINT_ENVELOPE|HINT_INSTRUMENT);
- pModDoc->UpdateAllViews(NULL, (UINT(nItem) << HINT_SHIFT_INS) | HINT_MODTYPE|HINT_ENVELOPE|HINT_INSTRUMENT);
+ pModDoc->UpdateAllViews(NULL, (UINT(dwItem) << HINT_SHIFT_INS) | HINT_MODTYPE|HINT_ENVELOPE|HINT_INSTRUMENT);
}
break;
case MODITEM_MIDIINSTRUMENT:
- SetMidiInstrument(nItem, "");
+ SetMidiInstrument(dwItem, "");
RefreshMidiLibrary();
break;
case MODITEM_MIDIPERCUSSION:
- SetMidiPercussion(nItem, "");
+ SetMidiPercussion(dwItem, "");
RefreshMidiLibrary();
break;
case MODITEM_DLSBANK_FOLDER:
- CTrackApp::RemoveDLSBank(nItem);
+ CTrackApp::RemoveDLSBank(dwItem);
RefreshDlsBanks();
break;
@@ -1408,12 +1406,12 @@
BOOL CModTree::OpenTreeItem(HTREEITEM hItem)
//------------------------------------------
{
- DWORD dwItemType = GetModItem(hItem);
+ uint64 qwItemType = GetModItem(hItem);
//DWORD dwItem = dwItemType >> 16;
//PMODTREEDOCINFO pInfo = DocInfo[m_nDocNdx];
//CModDoc *pModDoc = (pInfo) ? pInfo->pModDoc : NULL;
- switch(dwItemType & 0xFFFF)
+ switch(qwItemType & 0xFFFF)
{
case MODITEM_INSLIB_SONG:
{
@@ -1853,9 +1851,9 @@
PMODTREEDOCINFO pInfo = DocInfo[m_nDragDocNdx];
pdropinfo->pModDoc = (pInfo) ? pInfo->pModDoc : NULL;
pdropinfo->dwDropType = DRAGONDROP_NOTHING;
- pdropinfo->dwDropItem = m_dwItemDrag >> 16;
+ pdropinfo->dwDropItem = (DWORD)(m_qwItemDrag >> 16);
pdropinfo->lDropParam = 0;
- switch(m_dwItemDrag & 0xFFFF)
+ switch(m_qwItemDrag & 0xFFFF)
{
case MODITEM_ORDER:
pdropinfo->dwDropType = DRAGONDROP_ORDER;
@@ -1883,7 +1881,7 @@
if (s[0] >= '0') n += (s[0] - '0');
if ((s[1] >= '0') && (s[1] <= '9')) n = n*10 + (s[1] - '0');
if ((s[2] >= '0') && (s[2] <= '9')) n = n*10 + (s[2] - '0');
- pdropinfo->dwDropType = ((m_dwItemDrag & 0xFFFF) == MODITEM_INSLIB_SAMPLE) ? DRAGONDROP_SAMPLE : DRAGONDROP_INSTRUMENT;
+ pdropinfo->dwDropType = ((m_qwItemDrag & 0xFFFF) == MODITEM_INSLIB_SAMPLE) ? DRAGONDROP_SAMPLE : DRAGONDROP_INSTRUMENT;
pdropinfo->dwDropItem = n;
pdropinfo->pModDoc = NULL;
pdropinfo->lDropParam = (LPARAM)&m_SongFile;
@@ -1918,14 +1916,14 @@
break;
default:
- if (m_dwItemDrag & 0xC0000000)
+ if (m_qwItemDrag & 0xC0000000)
{
pdropinfo->dwDropType = DRAGONDROP_DLS;
// dwDropItem = DLS Bank #
- pdropinfo->dwDropItem = (m_dwItemDrag & 0x3F000000) >> 24; // bank #
+ pdropinfo->dwDropItem = (DWORD)((m_qwItemDrag & 0x3F000000) >> 24); // bank #
// Melodic: (Instrument)
// Drums: (0x80000000) | (Region << 16) | (Instrument)
- pdropinfo->lDropParam = (m_dwItemDrag & 0x80FF7FFF); //
+ pdropinfo->lDropParam = (LPARAM)((m_qwItemDrag & 0x80FF7FFF)); //
break;
}
}
@@ -1936,13 +1934,13 @@
BOOL CModTree::CanDrop(HTREEITEM hItem, BOOL bDoDrop)
//---------------------------------------------------
{
- DWORD dwItemDrop = GetModItem(hItem);
- DWORD dwItemDrag = m_dwItemDrag >> 16;
- DWORD dwDragType = m_dwItemDrag & 0xFFFF;
- DWORD dwDropType = dwItemDrop & 0xFFFF;
+ uint64 qwItemDrop = GetModItem(hItem);
+ DWORD dwItemDrag = (DWORD)(m_qwItemDrag >> 16);
+ DWORD dwDragType = m_qwItemDrag & 0xFFFF;
+ DWORD dwDropType = (DWORD)(qwItemDrop & 0xFFFF);
PMODTREEDOCINFO pInfo = DocInfo[m_nDocNdx];
CModDoc *pModDoc = (pInfo) ? pInfo->pModDoc : NULL;
- dwItemDrop >>= 16;
+ qwItemDrop >>= 16;
switch(dwDropType)
{
case MODITEM_ORDER:
@@ -1950,7 +1948,7 @@
{
if (bDoDrop)
{
- if (dwItemDrag != dwItemDrop) pModDoc->MoveOrder(dwItemDrag, dwItemDrop, true);
+ if (dwItemDrag != qwItemDrop) pModDoc->MoveOrder((ORDERINDEX)dwItemDrag, (ORDERINDEX)qwItemDrop, true);
}
return TRUE;
}
@@ -1969,9 +1967,9 @@
CHAR szFullPath[_MAX_PATH] = "";
InsLibGetFullPath(m_hItemDrag, szFullPath);
if (dwDropType == MODITEM_MIDIINSTRUMENT)
- SetMidiInstrument(dwItemDrop, szFullPath);
+ SetMidiInstrument((DWORD)qwItemDrop, szFullPath);
else
- SetMidiPercussion(dwItemDrop, szFullPath);
+ SetMidiPercussion((DWORD)qwItemDrop, szFullPath);
}
return TRUE;
}
@@ -2046,9 +2044,9 @@
{
if (!ItemHasChildren(m_hItemDrag)) SelectItem(m_hItemDrag);
}
- m_dwItemDrag = GetModItem(m_hItemDrag);
+ m_qwItemDrag = GetModItem(m_hItemDrag);
m_nDragDocNdx = m_nDocNdx;
- switch(m_dwItemDrag & 0xFFFF)
+ switch(m_qwItemDrag & 0xFFFF)
{
case MODITEM_ORDER:
case MODITEM_PATTERN:
@@ -2062,7 +2060,7 @@
bDrag = TRUE;
break;
default:
- if (m_dwItemDrag & 0x8000) bDrag = TRUE;
+ if (m_qwItemDrag & 0x8000) bDrag = TRUE;
}
if (bDrag)
{
@@ -2158,13 +2156,13 @@
{
UINT nDefault = 0;
BOOL bSep = FALSE;
- DWORD dwItemType;
+ uint64 qwItemType;
- dwItemType = GetModItem(hItem);
- const uint16 nItemNo = HIWORD(dwItemType);
- dwItemType &= 0xFFFF;
+ qwItemType = GetModItem(hItem);
+ const DWORD dwItemNo = (DWORD)(qwItemType >> 16);
+ qwItemType &= 0xFFFF;
SelectItem(hItem);
- switch(dwItemType)
+ switch(qwItemType)
{
case MODITEM_COMMENTS:
nDefault = ID_MODTREE_EXECUTE;
@@ -2176,9 +2174,17 @@
nDefault = ID_MODTREE_EXECUTE;
AppendMenu(hMenu, MF_STRING, nDefault, "&Edit Pattern");
AppendMenu(hMenu, MF_STRING, ID_MODTREE_REMOVE,
- (dwItemType == MODITEM_ORDER) ? "&Delete from list" : "&Delete Pattern");
+ (qwItemType == MODITEM_ORDER) ? "&Delete from list" : "&Delete Pattern");
break;
+ case MODITEM_SEQUENCE:
+ // TODO: Right-click menu for sequences
+ //nDefault = ID_MODTREE_EXECUTE;
+ //AppendMenu(hMenu, MF_STRING, nDefault, "&Switch to Seqeuence");
+ //AppendMenu(hMenu, MF_STRING, ID_MODTREE_REMOVE, "&Delete Sequence");
+ //AppendMenu(hMenu, MF_STRING, ID_MODTREE_REMOVE, "D&uplicate Sequence");
+ break;
+
case MODITEM_SAMPLE:
{
CModDoc *pModDoc = GetDocumentFromItem(hItem);
@@ -2189,7 +2195,7 @@
if ((pModDoc) && (!pModDoc->GetNumInstruments()))
{
AppendMenu(hMenu, MF_SEPARATOR, NULL, "");
- AppendMenu(hMenu, (pModDoc->IsSampleMuted(nItemNo) ? MF_CHECKED:0)|MF_STRING, ID_MODTREE_MUTE, "&Mute Sample");
+ AppendMenu(hMenu, (pModDoc->IsSampleMuted((SAMPLEINDEX)dwItemNo) ? MF_CHECKED:0)|MF_STRING, ID_MODTREE_MUTE, "&Mute Sample");
AppendMenu(hMenu, MF_STRING, ID_MODTREE_SOLO, "&Solo Sample");
AppendMenu(hMenu, MF_STRING, ID_MODTREE_UNMUTEALL, "&Unmute all");
}
@@ -2206,7 +2212,7 @@
if ((pModDoc) && (pModDoc->GetNumInstruments()))
{
AppendMenu(hMenu, MF_SEPARATOR, NULL, "");
- AppendMenu(hMenu, (pModDoc->IsInstrumentMuted(nItemNo) ? MF_CHECKED:0)|MF_STRING, ID_MODTREE_MUTE, "&Mute Instrument");
+ AppendMenu(hMenu, (pModDoc->IsInstrumentMuted((INSTRUMENTINDEX)dwItemNo) ? MF_CHECKED:0)|MF_STRING, ID_MODTREE_MUTE, "&Mute Instrument");
AppendMenu(hMenu, MF_STRING, ID_MODTREE_SOLO, "&Solo Instrument");
AppendMenu(hMenu, MF_STRING, ID_MODTREE_UNMUTEALL, "&Unmute all");
// -> CODE#0023
@@ -2227,7 +2233,7 @@
CModDoc *pModDoc = GetDocumentFromItem(hItem);
CSoundFile *pSndFile = pModDoc ? pModDoc->GetSoundFile() : NULL;
if (pSndFile) {
- PSNDMIXPLUGIN pPlugin = &pSndFile->m_MixPlugins[nItemNo];
+ PSNDMIXPLUGIN pPlugin = &pSndFile->m_MixPlugins[dwItemNo];
if (pPlugin) {
bool bypassed = ((pPlugin->Info.dwInputRouting&MIXPLUG_INPUTF_BYPASS) != 0);
AppendMenu(hMenu, (bypassed?MF_CHECKED:0)|MF_STRING, ID_MODTREE_MUTE, "&Bypass");
@@ -2286,7 +2292,7 @@
break;
default:
- if (dwItemType & 0x8000)
+ if (qwItemType & 0x8000)
{
nDefault = ID_MODTREE_PLAY;
AppendMenu(hMenu, MF_STRING, ID_MODTREE_PLAY, "&Play Instrument");
@@ -2294,9 +2300,9 @@
break;
}
if (nDefault) SetMenuDefaultItem(hMenu, nDefault, FALSE);
- if ((dwItemType == MODITEM_INSLIB_FOLDER)
- || (dwItemType == MODITEM_INSLIB_SONG)
- || (dwItemType == MODITEM_HDR_INSTRUMENTLIB))
+ if ((qwItemType == MODITEM_INSLIB_FOLDER)
+ || (qwItemType == MODITEM_INSLIB_SONG)
+ || (qwItemType == MODITEM_HDR_INSTRUMENTLIB))
{
if ((bSep) || (nDefault)) AppendMenu(hMenu, MF_SEPARATOR, NULL, "");
AppendMenu(hMenu, (m_bShowAllFiles) ? (MF_STRING|MF_CHECKED) : MF_STRING, ID_MODTREE_SHOWALLFILES, "Show All Files");
@@ -2325,8 +2331,8 @@
HTREEITEM hItem = HitTest(pt, &flags);
if (hItem != NULL)
{
- DWORD dwItem = GetModItem(hItem);
- switch(dwItem & 0xFFFF)
+ uint64 qwItem = GetModItem(hItem);
+ switch(qwItem & 0xFFFF)
{
case MODITEM_INSLIB_FOLDER:
case MODITEM_INSLIB_SONG:
@@ -2341,8 +2347,8 @@
if (pFrame)
{
pFrame->SendMessage(WM_MOD_INSTRSELECTED,
- ((dwItem & 0xffff) == MODITEM_INSTRUMENT) ? TRUE : FALSE,
- dwItem >> 16);
+ ((qwItem & 0xffff) == MODITEM_INSTRUMENT) ? TRUE : FALSE,
+ (LPARAM)(qwItem >> 16));
}
}
break;
@@ -2415,7 +2421,7 @@
// Bug?
if (!(nFlags & (MK_LBUTTON|MK_RBUTTON)))
{
- m_dwItemDrag = 0;
+ m_qwItemDrag = 0;
m_hItemDrag = NULL;
OnEndDrag(TREESTATUS_DRAGGING);
return;
@@ -2568,29 +2574,29 @@
//-----------------------------
{
HTREEITEM hItem = GetSelectedItem();
- DWORD dwItemType;
+ uint64 qwItemType;
CModDoc *pModDoc;
- dwItemType = GetModItem(hItem);
- const uint16 nItemNo = HIWORD(dwItemType);
- dwItemType &= 0xFFFF;
+ qwItemType = GetModItem(hItem);
+ const DWORD dwItemNo = (DWORD)(qwItemType >> 16);
+ qwItemType &= 0xFFFF;
pModDoc = GetDocumentFromItem(hItem);
if (pModDoc)
{
- if ((dwItemType == MODITEM_SAMPLE) && (!pModDoc->GetNumInstruments()))
+ if ((qwItemType == MODITEM_SAMPLE) && (!pModDoc->GetNumInstruments()))
{
- pModDoc->MuteSample(nItemNo, (pModDoc->IsSampleMuted(nItemNo)) ? FALSE : TRUE);
+ pModDoc->MuteSample((SAMPLEINDEX)dwItemNo, (pModDoc->IsSampleMuted((SAMPLEINDEX)dwItemNo)) ? false : true);
} else
- if ((dwItemType == MODITEM_INSTRUMENT) && (pModDoc->GetNumInstruments()))
+ if ((qwItemType == MODITEM_INSTRUMENT) && (pModDoc->GetNumInstruments()))
{
- pModDoc->MuteInstrument(nItemNo, (pModDoc->IsInstrumentMuted(nItemNo)) ? FALSE : TRUE);
+ pModDoc->MuteInstrument((INSTRUMENTINDEX)dwItemNo, (pModDoc->IsInstrumentMuted((INSTRUMENTINDEX)dwItemNo)) ? false : true);
}
- if ((dwItemType == MODITEM_EFFECT))
+ if ((qwItemType == MODITEM_EFFECT))
{
CSoundFile *pSndFile = pModDoc ? pModDoc->GetSoundFile() : NULL;
if (pSndFile) {
- PSNDMIXPLUGIN pPlugin = &pSndFile->m_MixPlugins[nItemNo];
+ PSNDMIXPLUGIN pPlugin = &pSndFile->m_MixPlugins[dwItemNo];
if (pPlugin) {
CVstPlugin *pVstPlugin = (CVstPlugin *)pPlugin->pMixPlugin;
if (pVstPlugin) pVstPlugin->Bypass();
@@ -2606,29 +2612,29 @@
//-----------------------------
{
HTREEITEM hItem = GetSelectedItem();
- DWORD dwItemType;
+ uint64 qwItemType;
CModDoc *pModDoc;
- dwItemType = GetModItem(hItem);
- const uint16 nItemNo = HIWORD(dwItemType);
- dwItemType &= 0xFFFF;
+ qwItemType = GetModItem(hItem);
+ const DWORD dwItemNo = (DWORD)(qwItemType >> 16);
+ qwItemType &= 0xFFFF;
pModDoc = GetDocumentFromItem(hItem);
if (pModDoc)
{
SAMPLEINDEX nSamples = pModDoc->GetNumSamples();
INSTRUMENTINDEX nInstruments = pModDoc->GetNumInstruments();
- if ((dwItemType == MODITEM_SAMPLE) && (!nInstruments))
+ if ((qwItemType == MODITEM_SAMPLE) && (!nInstruments))
{
for (SAMPLEINDEX i=1; i<=nSamples; i++)
{
- pModDoc->MuteSample(i, (i == nItemNo) ? FALSE : TRUE);
+ pModDoc->MuteSample(i, (i == dwItemNo) ? false : true);
}
} else
- if ((dwItemType == MODITEM_INSTRUMENT) && (nInstruments))
+ if ((qwItemType == MODITEM_INSTRUMENT) && (nInstruments))
{
for (INSTRUMENTINDEX i=1; i<=nInstruments; i++)
{
- pModDoc->MuteInstrument(i, (i == nItemNo) ? FALSE : TRUE);
+ pModDoc->MuteInstrument(i, (i == dwItemNo) ? false : true);
}
}
}
@@ -2639,16 +2645,16 @@
//----------------------------------
{
HTREEITEM hItem = GetSelectedItem();
- DWORD dwItemType;
+ uint64 qwItemType;
CModDoc *pModDoc;
- dwItemType = GetModItem(hItem) & 0xFFFF;
+ qwItemType = GetModItem(hItem) & 0xFFFF;
pModDoc = GetDocumentFromItem(hItem);
if (pModDoc)
{
SAMPLEINDEX nSamples = pModDoc->GetNumSamples();
INSTRUMENTINDEX nInstruments = pModDoc->GetNumInstruments();
- if ((dwItemType == MODITEM_SAMPLE) || (dwItemType == MODITEM_INSTRUMENT))
+ if ((qwItemType == MODITEM_SAMPLE) || (qwItemType == MODITEM_INSTRUMENT))
{
for (SAMPLEINDEX i=1; i<=nSamples; i++)
{
@@ -2668,9 +2674,9 @@
void CModTree::OnSetItemPath()
{
HTREEITEM hItem = GetSelectedItem();
- DWORD dwItemType = GetModItem(hItem);
- DWORD dwItem = dwItemType >> 16;
- dwItemType &= 0xFFFF;
+ uint64 qwItemType = GetModItem(hItem);
+ DWORD dwItem = (DWORD)(qwItemType >> 16);
+ qwItemType &= 0xFFFF;
CModDoc *pModDoc = GetDocumentFromItem(hItem);
CSoundFile *pSndFile = pModDoc ? pModDoc->GetSoundFile() : NULL;
@@ -2700,15 +2706,15 @@
void CModTree::OnSaveItem()
{
HTREEITEM hItem = GetSelectedItem();
- DWORD dwItemType = GetModItem(hItem);
- const uint16 nItem = HIWORD(dwItemType);
- dwItemType &= 0xFFFF;
+ uint64 qwItemType = GetModItem(hItem);
+ const DWORD dwItem = HIWORD(qwItemType);
+ qwItemType &= 0xFFFF;
CModDoc *pModDoc = GetDocumentFromItem(hItem);
CSoundFile *pSndFile = pModDoc ? pModDoc->GetSoundFile() : NULL;
- if(pSndFile && nItem){
+ if(pSndFile && dwItem){
- if(pSndFile->m_szInstrumentPath[nItem-1][0] == '\0'){
+ if(pSndFile->m_szInstrumentPath[dwItem-1][0] == '\0'){
CHAR pszFileNames[_MAX_PATH];
CFileDialog dlg(FALSE, (pSndFile->m_nType & (MOD_TYPE_IT|MOD_TYPE_MPT)) ? "iti" : "xi", NULL,
@@ -2724,23 +2730,23 @@
dlg.m_ofn.lpstrFile = pszFileNames;
dlg.m_ofn.nMaxFile = _MAX_PATH;
- if(dlg.DoModal() == IDOK) strcpy(pSndFile->m_szInstrumentPath[nItem-1], pszFileNames);
+ if(dlg.DoModal() == IDOK) strcpy(pSndFile->m_szInstrumentPath[dwItem - 1], pszFileNames);
dlg.m_ofn.lpstrFile = NULL;
dlg.m_ofn.nMaxFile = 0;
}
- if(pSndFile->m_szInstrumentPath[nItem-1][0] != '\0'){
- int size = strlen(pSndFile->m_szInstrumentPath[nItem-1]);
- BOOL iti = _stricmp(&pSndFile->m_szInstrumentPath[nItem-1][size-3],"iti") == 0;
- BOOL xi = _stricmp(&pSndFile->m_szInstrumentPath[nItem-1][size-2],"xi") == 0;
+ if(pSndFile->m_szInstrumentPath[dwItem - 1][0] != '\0'){
+ int size = strlen(pSndFile->m_szInstrumentPath[dwItem - 1]);
+ BOOL iti = _stricmp(&pSndFile->m_szInstrumentPath[dwItem - 1][size-3],"iti") == 0;
+ BOOL xi = _stricmp(&pSndFile->m_szInstrumentPath[dwItem - 1][size-2],"xi") == 0;
if(iti || (!iti && !xi && pSndFile->m_nType & (MOD_TYPE_IT|MOD_TYPE_MPT)))
- pSndFile->SaveITIInstrument(nItem, pSndFile->m_szInstrumentPath[nItem-1]);
+ pSndFile->SaveITIInstrument((INSTRUMENTINDEX)dwItem, pSndFile->m_szInstrumentPath[dwItem - 1]);
if(xi || (!xi && !iti && pSndFile->m_nType == MOD_TYPE_XM))
- pSndFile->SaveXIInstrument(nItem, pSndFile->m_szInstrumentPath[nItem-1]);
+ pSndFile->SaveXIInstrument((INSTRUMENTINDEX)dwItem, pSndFile->m_szInstrumentPath[dwItem - 1]);
- pSndFile->instrumentModified[nItem-1] = FALSE;
+ pSndFile->instrumentModified[dwItem - 1] = FALSE;
}
if(pModDoc) pModDoc->UpdateAllViews(NULL, HINT_MODTYPE);
@@ -2799,8 +2805,8 @@
{
UINT flags;
HTREEITEM hItem = HitTest(point, &flags);
- DWORD dwItemType = GetModItem(hItem);
- switch(dwItemType & 0xFFFF)
+ uint64 qwItemType = GetModItem(hItem);
+ switch(qwItemType & 0xFFFF)
{
case MODITEM_MIDIINSTRUMENT:
case MODITEM_MIDIPERCUSSION:
@@ -2810,7 +2816,7 @@
EnsureVisible(hItem);
}
m_hItemDrag = hItem;
- m_dwItemDrag = dwItemType;
+ m_qwItemDrag = qwItemType;
return DROPEFFECT_LINK;
// Folders:
case MODITEM_HDR_MIDILIB:
@@ -2842,8 +2848,8 @@
DragQueryFile(hDropInfo, 0, szFileName, _MAX_PATH);
if (szFileName[0])
{
- DWORD dwItem = m_dwItemDrag >> 16;
- switch(m_dwItemDrag & 0xFFFF)
+ DWORD dwItem = (DWORD)(m_qwItemDrag >> 16);
+ switch(m_qwItemDrag & 0xFFFF)
{
case MODITEM_MIDIINSTRUMENT:
bOk = SetMidiInstrument(dwItem, szFileName);
@@ -2918,10 +2924,10 @@
//------------------------------------
{
HTREEITEM hItem = GetSelectedItem();
- DWORD dwItemType = GetModItem(hItem);
- if ((dwItemType & 0xFFFF) == MODITEM_DLSBANK_FOLDER)
+ uint64 qwItemType = GetModItem(hItem);
+ if ((qwItemType & 0xFFFF) == MODITEM_DLSBANK_FOLDER)
{
- UINT nBank = dwItemType >> 16;
+ UINT nBank = (UINT)(qwItemType >> 16);
if ((nBank < MAX_DLS_BANKS) && (CTrackApp::gpDLSBanks[nBank]))
{
CSoundBankProperties dlg(CTrackApp::gpDLSBanks[nBank], this);
Modified: trunk/OpenMPT/mptrack/View_tre.h
===================================================================
--- trunk/OpenMPT/mptrack/View_tre.h 2009-10-02 15:49:41 UTC (rev 384)
+++ trunk/OpenMPT/mptrack/View_tre.h 2009-10-04 12:50:16 UTC (rev 385)
@@ -32,6 +32,7 @@
MODITEM_INSLIB_SONG,
MODITEM_DLSBANK_FOLDER,
MODITEM_DLSBANK_INSTRUMENT,
+ MODITEM_SEQUENCE,
};
#define TREESTATUS_RDRAG 0x01
@@ -109,7 +110,7 @@
CModTree *m_pDataTree;
DWORD m_dwStatus;
HWND m_hDropWnd;
- DWORD m_dwItemDrag;
+ uint64 m_qwItemDrag;
BOOL m_bShowAllFiles;
UINT m_nDocNdx, m_nDragDocNdx;
HTREEITEM m_hItemDrag, m_hItemDrop;
@@ -135,7 +136,7 @@
VOID RefreshInstrumentLibrary();
VOID EmptyInstrumentLibrary();
VOID FillInstrumentLibrary();
- DWORD GetModItem(HTREEITEM hItem);
+ uint64 GetModItem(HTREEITEM hItem);
BOOL SetMidiInstrument(UINT nIns, LPCSTR lpszFileName);
BOOL SetMidiPercussion(UINT nPerc, LPCSTR lpszFileName);
BOOL ExecuteItem(HTREEITEM hItem);
Modified: trunk/OpenMPT/packageTemplate/extraKeymaps/DE_jojo.mkb
===================================================================
--- trunk/OpenMPT/packageTemplate/extraKeymaps/DE_jojo.mkb 2009-10-02 15:49:41 UTC (rev 384)
+++ trunk/OpenMPT/packageTemplate/extraKeymaps/DE_jojo.mkb 2009-10-04 12:50:16 UTC (rev 385)
@@ -18,7 +18,7 @@
0:1027:0:118:5 //Play pattern from start: F7 (KeyDown|KeyHold)
0:1026:2:118:5 //Play pattern from cursor: Ctrl+F7 (KeyDown|KeyHold)
0:1376:0:120:1 //Toggle Midi Record: F9 (KeyDown)
-0:1359:2:90:1 //Undo: Ctrl+Z (KeyDown)
+0:1359:2:90:5 //Undo: Ctrl+Z (KeyDown|KeyHold)
0:1360:2:88:1 //Cut: Ctrl+X (KeyDown)
0:1361:2:67:1 //Copy: Ctrl+C (KeyDown)
0:1361:2:45:1 //Copy: Ctrl+EINFG (KeyDown)
@@ -77,6 +77,7 @@
2:1662:6:80:1 //Toggle channel's plugin editor: Ctrl+Alt+P (KeyDown)
2:1062:0:93:1 //Show note properties: ANWENDUNG (KeyDown)
2:1780:2:80:1 //Show playback time at current row: Ctrl+P (KeyDown)
+2:1786:2:82:1 //Reset channel: Ctrl+R (KeyDown)
2:1007:2:81:5 //Transpose +1: Ctrl+Q (KeyDown|KeyHold)
2:1008:2:65:5 //Transpose -1: Ctrl+A (KeyDown|KeyHold)
2:1009:3:81:5 //Transpose +12: Shift+Ctrl+Q (KeyDown|KeyHold)
@@ -155,9 +156,9 @@
3:1221:0:57:1 //Set octave 9: 9 (KeyDown)
3:1221:0:105:1 //Set octave 9: 9 (ZEHNERTASTATUR) (KeyDown)
3:1316:1:16:1 //Chord Modifier: Shift+UMSCHALT (KeyDown)
-3:1200:0:220:1 //Note Cut: ZIRKUMFLEX (KeyDown)
-3:1201:0:221:1 //Note Off: AKUT (KeyDown)
-3:1791:0:219:1 //Note Fade: \xDF (KeyDown)
+3:1667:0:220:1 //Note Cut (don't remember instrument): ZIRKUMFLEX (KeyDown)
+3:1668:0:221:1 //Note Off (don't remember instrument): AKUT (KeyDown)
+3:1792:0:219:1 //Note Fade (don't remember instrument): \xDF (KeyDown)
3:1788:0:226:1 //Parameter control(MPTm only): < (KeyDown)
3:1789:1:226:1 //Parameter control(smooth)(MPTm only): Shift+< (KeyDown)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sag...@us...> - 2009-10-02 16:47:41
|
Revision: 384
http://modplug.svn.sourceforge.net/modplug/?rev=384&view=rev
Author: saga-games
Date: 2009-10-02 15:49:41 +0000 (Fri, 02 Oct 2009)
Log Message:
-----------
[Imp] Tree view: Show sequences in song treeview. Still slightly buggy, e.g. when removing everything but one sequence or when adding a sequence when there's only one sequence.
[Mod] Pattern editor: Slight redesign of the pattern control area
[Ref] Some minor internal changes
Modified Paths:
--------------
trunk/OpenMPT/mptrack/Ctrl_pat.cpp
trunk/OpenMPT/mptrack/Mainfrm.h
trunk/OpenMPT/mptrack/Modedit.cpp
trunk/OpenMPT/mptrack/View_tre.cpp
trunk/OpenMPT/mptrack/View_tre.h
trunk/OpenMPT/mptrack/mptrack.rc
trunk/OpenMPT/mptrack/resource.h
Modified: trunk/OpenMPT/mptrack/Ctrl_pat.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Ctrl_pat.cpp 2009-09-29 23:13:53 UTC (rev 383)
+++ trunk/OpenMPT/mptrack/Ctrl_pat.cpp 2009-10-02 15:49:41 UTC (rev 384)
@@ -296,6 +296,7 @@
::EnableWindow(::GetDlgItem(m_hWnd, IDC_PATINSTROPLUGGUI2), false);
// Show/hide multisequence controls according the current modtype.
+ GetDlgItem(IDC_STATIC_SEQUENCE_NAME_FRAME)->ShowWindow( (m_pSndFile->GetType() == MOD_TYPE_MPT) ? SW_SHOW : SW_HIDE);
GetDlgItem(IDC_STATIC_SEQUENCE_NAME)->ShowWindow( (m_pSndFile->GetType() == MOD_TYPE_MPT) ? SW_SHOW : SW_HIDE);
GetDlgItem(IDC_EDIT_SEQUENCE_NAME)->ShowWindow( (m_pSndFile->GetType() == MOD_TYPE_MPT) ? SW_SHOW : SW_HIDE);
}
@@ -608,6 +609,7 @@
if (pSndFile)
{
lParam &= 0x7FFF;
+ m_OrderList.OnSelectSequence(pSndFile->Order.GetCurrentSequenceIndex()); // new sequence already set in view_tre.cpp, GetModItem()
m_OrderList.SetCurSel((ORDERINDEX)lParam);
SetCurrentPattern(pSndFile->Order[lParam]);
}
Modified: trunk/OpenMPT/mptrack/Mainfrm.h
===================================================================
--- trunk/OpenMPT/mptrack/Mainfrm.h 2009-09-29 23:13:53 UTC (rev 383)
+++ trunk/OpenMPT/mptrack/Mainfrm.h 2009-10-02 15:49:41 UTC (rev 384)
@@ -326,7 +326,9 @@
{
DWORD dwType;
DWORD dwLatency;
- UINT nOrder, nPattern, nRow; // Always valid
+ ORDERINDEX nOrder; // Always valid
+ PATTERNINDEX nPattern; // dito
+ ROWINDEX nRow; // dito
DWORD dwPos[MAX_CHANNELS]; // sample/envelope pos for each channel if >= 0
} MPTNOTIFICATION, *PMPTNOTIFICATION;
Modified: trunk/OpenMPT/mptrack/Modedit.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Modedit.cpp 2009-09-29 23:13:53 UTC (rev 383)
+++ trunk/OpenMPT/mptrack/Modedit.cpp 2009-10-02 15:49:41 UTC (rev 384)
@@ -1736,9 +1736,9 @@
PATTERNINDEX CModDoc::InsertPattern(ORDERINDEX nOrd, ROWINDEX nRows)
//------------------------------------------------------------------
{
- const int i = m_SndFile.Patterns.Insert(nRows);
- if(i < 0)
- return PATTERNINDEX_INVALID;
+ const PATTERNINDEX i = m_SndFile.Patterns.Insert(nRows);
+ if(i == PATTERNINDEX_INVALID)
+ return i;
//Increasing orderlist size if given order is beyond current limit,
//or if the last order already has a pattern.
Modified: trunk/OpenMPT/mptrack/View_tre.cpp
===================================================================
--- trunk/OpenMPT/mptrack/View_tre.cpp 2009-09-29 23:13:53 UTC (rev 383)
+++ trunk/OpenMPT/mptrack/View_tre.cpp 2009-10-02 15:49:41 UTC (rev 384)
@@ -296,7 +296,8 @@
if (pInfo)
{
pInfo->pModDoc = pModDoc;
- pInfo->nOrdSel = (UINT)-1;
+ pInfo->nSeqSel = SEQUENCEINDEX_INVALID;
+ pInfo->nOrdSel = ORDERINDEX_INVALID;
DocInfo[nNewNdx] = pInfo;
UpdateView(nNewNdx, HINT_MODTYPE);
if (pInfo->hSong)
@@ -688,62 +689,114 @@
if ((pInfo->hOrders) && (hintFlagPart != HINT_INSNAMES) && (hintFlagPart != HINT_SMPNAMES))
{
const DWORD nPat = (lHint >> HINT_SHIFT_PAT);
- // If there are items past the new sequence length, delete them.
- for(size_t i = pSndFile->Order.GetLength(); i < pInfo->tiOrders.size(); i++) if (pInfo->tiOrders[i])
- {DeleteItem(pInfo->tiOrders[i]); pInfo->tiOrders[i] = NULL;}
- if (pInfo->tiOrders.size() < pSndFile->Order.GetLength()) // Resize tiOrders if needed.
- pInfo->tiOrders.resize(pSndFile->Order.GetLength(), NULL);
- UINT imin=0, imax = pSndFile->Order.GetLastIndex();
- const bool patNamesOnly = (hintFlagPart == HINT_PATNAMES);
- //if (hintFlagPart == HINT_PATNAMES) && (dwHintParam < pSndFile->Order.size())) imin = imax = dwHintParam;
- BOOL bEnded = FALSE;
- for (UINT iOrd=imin; iOrd<=imax; iOrd++)
+ // If there are too many sequences, delete them.
+ for(size_t nSeq = pSndFile->Order.GetNumSequences(); nSeq < pInfo->tiSequences.size(); nSeq++) if (pInfo->tiSequences[nSeq])
{
- if (pSndFile->Order[iOrd] == pSndFile->Order.GetInvalidPatIndex()) bEnded = TRUE;
- if (bEnded)
+ for(size_t nOrd = 0; nOrd < pInfo->tiOrders[nSeq].size(); nOrd++) if (pInfo->tiOrders[nSeq][nOrd])
{
- if (pInfo->tiOrders[iOrd])
+ DeleteItem(pInfo->tiOrders[nSeq][nOrd]); pInfo->tiOrders[nSeq][nOrd] = NULL;
+ }
+ DeleteItem(pInfo->tiSequences[nSeq]); pInfo->tiSequences[nSeq] = NULL;
+ }
+ if (pInfo->tiSequences.size() < pSndFile->Order.GetNumSequences()) // Resize tiSequences if needed.
+ {
+ pInfo->tiSequences.resize(pSndFile->Order.GetNumSequences(), NULL);
+ pInfo->tiOrders.resize(pSndFile->Order.GetNumSequences());
+ }
+
+ /* // number of sequences changed: wipe tree first (is this necessary?)
+ if(pInfo->tiOrders.size() != pSndFile->Order.GetNumSequences())
+ {
+ for(size_t nSeq = 0; nSeq < pInfo->tiOrders.size(); nSeq++)
+ {
+ for(size_t nOrd = 0; nOrd < pInfo->tiOrders[nSeq].size(); nOrd++) if (pInfo->tiOrders[nSeq][nOrd])
{
- DeleteItem(pInfo->tiOrders[iOrd]);
- pInfo->tiOrders[iOrd] = NULL;
+ DeleteItem(pInfo->tiOrders[nSeq][nOrd]); pInfo->tiOrders[nSeq][nOrd] = NULL;
}
- } else
+ DeleteItem(pInfo->tiSequences[nSeq]); pInfo->tiSequences[nSeq] = NULL;
+ }
+ pInfo->tiOrders.resize(pSndFile->Order.GetNumSequences());
+ pInfo->tiSequences.resize(pSndFile->Order.GetNumSequences(), NULL);
+ }*/
+
+ HTREEITEM hAncestorNode = pInfo->hOrders;
+
+ // go through all sequences
+ for(SEQUENCEINDEX nSeq = 0; nSeq < pSndFile->Order.GetNumSequences(); nSeq++)
+ {
+ // TODO update sequence names
+ if(pSndFile->Order.GetNumSequences() > 1)
{
- if(patNamesOnly && pSndFile->Order[iOrd] != nPat)
- continue;
- UINT state = (iOrd == pInfo->nOrdSel) ? TVIS_BOLD : 0;
- if (pSndFile->Order[iOrd] < pSndFile->Patterns.Size())
+ // more than one sequence -> add folder
+ if(pInfo->tiSequences[nSeq] == NULL)
{
- stmp[0] = 0;
- pSndFile->GetPatternName(pSndFile->Order[iOrd], stmp, sizeof(stmp));
- if (stmp[0])
+ CString sSeqName = pSndFile->Order.GetSequence(nSeq).m_sName;
+ if(sSeqName.IsEmpty()) sSeqName.Format("Sequence %d", nSeq);
+ pInfo->tiSequences[nSeq] = InsertItem(sSeqName, IMAGE_FOLDER, IMAGE_FOLDER, pInfo->hOrders, TVI_LAST);
+ }
+ hAncestorNode = pInfo->tiSequences[nSeq];
+ }
+
+ // If there are items past the new sequence length, delete them.
+ for(size_t nOrd = pSndFile->Order.GetSequence(nSeq).GetLength(); nOrd < pInfo->tiOrders[nSeq].size(); nOrd++) if (pInfo->tiOrders[nSeq][nOrd])
+ {
+ DeleteItem(pInfo->tiOrders[nSeq][nOrd]); pInfo->tiOrders[nSeq][nOrd] = NULL;
+ }
+ if (pInfo->tiOrders[nSeq].size() < pSndFile->Order.GetSequence(nSeq).GetLength()) // Resize tiOrders if needed.
+ pInfo->tiOrders[nSeq].resize(pSndFile->Order.GetSequence(nSeq).GetLength(), NULL);
+ UINT imin = 0, imax = pSndFile->Order.GetSequence(nSeq).GetLastIndex();
+ const bool patNamesOnly = (hintFlagPart == HINT_PATNAMES);
+
+ //if (hintFlagPart == HINT_PATNAMES) && (dwHintParam < pSndFile->Order.size())) imin = imax = dwHintParam;
+ bool bEnded = false;
+ for (UINT iOrd=imin; iOrd<=imax; iOrd++)
+ {
+ if (pSndFile->Order.GetSequence(nSeq)[iOrd] == pSndFile->Order.GetInvalidPatIndex()) bEnded = true;
+ if (bEnded)
+ {
+ if (pInfo->tiOrders[nSeq][iOrd])
{
- wsprintf(s, (CMainFrame::m_dwPatternSetup & PATTERN_HEXDISPLAY) ? "[%02Xh] %d: %s" : "[%02d] %d: %s",
- iOrd, pSndFile->Order[iOrd], stmp);
+ DeleteItem(pInfo->tiOrders[nSeq][iOrd]);
+ pInfo->tiOrders[nSeq][iOrd] = NULL;
+ }
+ } else
+ {
+ if(patNamesOnly && pSndFile->Order.GetSequence(nSeq)[iOrd] != nPat)
+ continue;
+ UINT state = (iOrd == pInfo->nOrdSel && nSeq == pInfo->nSeqSel) ? TVIS_BOLD : 0;
+ if (pSndFile->Order.GetSequence(nSeq)[iOrd] < pSndFile->Patterns.Size())
+ {
+ stmp[0] = 0;
+ pSndFile->GetPatternName(pSndFile->Order.GetSequence(nSeq)[iOrd], stmp, sizeof(stmp));
+ if (stmp[0])
+ {
+ wsprintf(s, (CMainFrame::m_dwPatternSetup & PATTERN_HEXDISPLAY) ? "[%02Xh] %d: %s" : "[%02d] %d: %s",
+ iOrd, pSndFile->Order.GetSequence(nSeq)[iOrd], stmp);
+ } else
+ {
+ wsprintf(s, (CMainFrame::m_dwPatternSetup & PATTERN_HEXDISPLAY) ? "[%02Xh] Pattern %d" : "[%02d] Pattern %d",
+ iOrd, pSndFile->Order.GetSequence(nSeq)[iOrd]);
+ }
} else
{
- wsprintf(s, (CMainFrame::m_dwPatternSetup & PATTERN_HEXDISPLAY) ? "[%02Xh] Pattern %d" : "[%02d] Pattern %d",
- iOrd, pSndFile->Order[iOrd]);
+ wsprintf(s, "[%02d] Skip", iOrd);
}
- } else
- {
- wsprintf(s, "[%02d] Skip", iOrd);
+ if (pInfo->tiOrders[nSeq][iOrd])
+ {
+ tvi.mask = TVIF_TEXT | TVIF_HANDLE | TVIF_STATE;
+ tvi.state = 0;
+ tvi.stateMask = TVIS_BOLD;
+ tvi.hItem = pInfo->tiOrders[nSeq][iOrd];
+ tvi.pszText = stmp;
+ tvi.cchTextMax = sizeof(stmp);
+ GetItem(&tvi);
+ if ((strcmp(s, stmp)) || (tvi.state != state))
+ SetItem(pInfo->tiOrders[nSeq][iOrd], TVIF_TEXT | TVIF_STATE, s, 0, 0, state, TVIS_BOLD, 0);
+ } else
+ {
+ pInfo->tiOrders[nSeq][iOrd] = InsertItem(s, IMAGE_PARTITION, IMAGE_PARTITION, hAncestorNode, TVI_LAST);
+ }
}
- if (pInfo->tiOrders[iOrd])
- {
- tvi.mask = TVIF_TEXT | TVIF_HANDLE | TVIF_STATE;
- tvi.state = 0;
- tvi.stateMask = TVIS_BOLD;
- tvi.hItem = pInfo->tiOrders[iOrd];
- tvi.pszText = stmp;
- tvi.cchTextMax = sizeof(stmp);
- GetItem(&tvi);
- if ((strcmp(s, stmp)) || (tvi.state != state))
- SetItem(pInfo->tiOrders[iOrd], TVIF_TEXT | TVIF_STATE, s, 0, 0, state, TVIS_BOLD, 0);
- } else
- {
- pInfo->tiOrders[iOrd] = InsertItem(s, IMAGE_PARTITION, IMAGE_PARTITION, pInfo->hOrders, TVI_LAST);
- }
}
}
}
@@ -899,7 +952,7 @@
//-----------------------------------------
{
LPARAM lParam;
- HTREEITEM hItemParent, hRootParent;
+ HTREEITEM hItemParent, hItemParentParent, hRootParent;
if (!hItem) return 0;
// First, test root items
@@ -908,9 +961,10 @@
// Test DLS Banks
lParam = GetItemData(hItem);
hItemParent = GetParentItem(hItem);
+ hItemParentParent = GetParentItem(hItemParent);
hRootParent = hItemParent;
CModDoc *pModDoc = GetDocumentFromItem(hItem);
- CSoundFile *pSndFile = pModDoc ? pModDoc->GetSoundFile() : NULL;
+ CSoundFile *pSndFile = pModDoc ? pModDoc->GetSoundFile() : nullptr;
if ((hRootParent != NULL) && (m_pDataTree))
{
HTREEITEM h;
@@ -971,13 +1025,29 @@
if (hItem == pSong->hSamples) return MODITEM_HDR_SAMPLES;
if (hItem == pSong->hInstruments) return MODITEM_HDR_INSTRUMENTS;
if (hItem == pSong->hComments) return MODITEM_COMMENTS;
- // Order List ?
- if (hItemParent == pSong->hOrders)
+ // Order List? (either "order list" or "sequence x" item as parent)
+ if ((hItemParent == pSong->hOrders && pSong->tiSequences.size() == 1) || (hItemParentParent == pSong->hOrders))
{
- ASSERT(pSong->tiOrders.size() == pSndFile->Order.size());
- for (UINT i=0; i<pSong->tiOrders.size(); i++)
+ // find sequence this item belongs to
+ for(SEQUENCEINDEX nSeq = 0; nSeq < pSong->tiOrders.size(); nSeq++)
{
- if (hItem == pSong->tiOrders[i]) return (MODITEM_ORDER | (i << 16));
+ ASSERT(pSong->tiOrders[nSeq].size() == pSndFile->Order.size());
+ for(ORDERINDEX nOrd = 0; nOrd < pSong->tiOrders[nSeq].size(); nOrd++)
+ {
+ if (hItem == pSong->tiOrders[nSeq][nOrd])
+ {
+ if(pSong->pModDoc->GetSoundFile() != nullptr)
+ {
+ pSong->pModDoc->GetSoundFile()->Order.SetSequence(nSeq);
+ // TODO this is buggy
+ //OnSelectSequence must be called? Or send a message?
+ }
+ //if(nSeq != pSong->nSeqSel) // sequence change
+ // return (MODITEM_ORDER_SEQUENCE | (nOrd << 16));
+ //else // same sequence
+ return (MODITEM_ORDER | (nOrd << 16));
+ }
+ }
}
}
// Pattern ?
@@ -1568,7 +1638,13 @@
|| (!lstrcmpi(s, ".dmf"))
|| (!lstrcmpi(s, ".mt2"))
|| (!lstrcmpi(s, ".med"))
- || (!lstrcmpi(s, ".wow")))))
+ || (!lstrcmpi(s, ".wow"))
+ || (!lstrcmpi(s, ".gdm"))
+ || (!lstrcmpi(s, ".imf"))
+#ifndef NO_MO3_SUPPORT
+ || (!lstrcmpi(s, ".mo3"))
+#endif
+ )))
{
if (m_pDataTree)
{
@@ -1910,10 +1986,12 @@
{
for (UINT i=0; i<MODTREE_MAX_DOCUMENTS; i++) if ((DocInfo[i]) && (DocInfo[i]->pModDoc == pModDoc))
{
- UINT nNewOrd = (pNotify) ? pNotify->nOrder : (UINT)-1;
- if (nNewOrd != DocInfo[i]->nOrdSel)
+ ORDERINDEX nNewOrd = (pNotify) ? pNotify->nOrder : ORDERINDEX_INVALID;
+ SEQUENCEINDEX nNewSeq = (pModDoc->GetSoundFile() != nullptr) ? pModDoc->GetSoundFile()->Order.GetCurrentSequenceIndex() : SEQUENCEINDEX_INVALID;
+ if (nNewOrd != DocInfo[i]->nOrdSel || nNewSeq != DocInfo[i]->nSeqSel)
{
DocInfo[i]->nOrdSel = nNewOrd;
+ DocInfo[i]->nSeqSel = nNewSeq;
UpdateView(i, HINT_MODSEQUENCE);
}
break;
Modified: trunk/OpenMPT/mptrack/View_tre.h
===================================================================
--- trunk/OpenMPT/mptrack/View_tre.h 2009-09-29 23:13:53 UTC (rev 383)
+++ trunk/OpenMPT/mptrack/View_tre.h 2009-10-02 15:49:41 UTC (rev 384)
@@ -44,24 +44,32 @@
struct MODTREEDOCINFO
{
CModDoc *pModDoc;
- UINT nOrdSel;
+ SEQUENCEINDEX nSeqSel;
+ ORDERINDEX nOrdSel;
HTREEITEM hSong, hPatterns, hSamples, hInstruments, hComments, hOrders, hEffects;
vector<HTREEITEM> tiPatterns;
HTREEITEM tiSamples[MAX_SAMPLES];
HTREEITEM tiInstruments[MAX_INSTRUMENTS];
- vector<HTREEITEM> tiOrders;
+ vector<vector<HTREEITEM>> tiOrders;
+ vector<HTREEITEM> tiSequences;
HTREEITEM tiEffects[MAX_MIXPLUGINS];
MODTREEDOCINFO(const CSoundFile* const pSndFile)
{
pModDoc = NULL;
- nOrdSel = 0;
+ nSeqSel = SEQUENCEINDEX_INVALID;
+ nOrdSel = ORDERINDEX_INVALID;
hSong = hPatterns = hSamples = hInstruments = hComments = hOrders = hEffects = NULL;
if(pSndFile != NULL)
{
tiPatterns.resize(pSndFile->Patterns.Size(), NULL);
- tiOrders.resize(pSndFile->Order.GetLength(), NULL);
+ tiOrders.resize(pSndFile->Order.GetNumSequences());
+ for(SEQUENCEINDEX i = 0; i < tiOrders.size(); i++)
+ {
+ //tiOrders[i].resize(pSndFile->Order.GetSequence(i)->GetLength(), NULL);
+ }
+ tiSequences.resize(pSndFile->Order.GetNumSequences(), NULL);
}
memset(tiSamples, 0, sizeof(tiSamples));
memset(tiInstruments, 0, sizeof(tiInstruments));
Modified: trunk/OpenMPT/mptrack/mptrack.rc
===================================================================
--- trunk/OpenMPT/mptrack/mptrack.rc 2009-09-29 23:13:53 UTC (rev 383)
+++ trunk/OpenMPT/mptrack/mptrack.rc 2009-10-02 15:49:41 UTC (rev 384)
@@ -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
@@ -55,12 +55,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
@@ -351,40 +351,41 @@
LTEXT "Song Message:",IDC_STATIC,4,2,76,8
END
-IDD_CONTROL_PATTERNS DIALOGEX 0, 0, 585, 156
+IDD_CONTROL_PATTERNS DIALOGEX 0, 0, 585, 114
STYLE DS_SETFONT | WS_CHILD
FONT 8, "MS Sans Serif", 0, 0, 0x1
BEGIN
- CONTROL "Follow Song",IDC_PATTERN_FOLLOWSONG,"Button",BS_AUTOCHECKBOX | BS_LEFTTEXT | BS_FLAT,432,34,55,10
- COMBOBOX IDC_COMBO_INSTRUMENT,22,74,95,137,CBS_DROPDOWNLIST | WS_VSCROLL
- CTEXT "Row spacing",IDC_STATIC,172,32,54,12,SS_CENTERIMAGE,WS_EX_STATICEDGE
- EDITTEXT IDC_EDIT_SPACING,225,32,28,12,ES_AUTOHSCROLL | ES_NUMBER | NOT WS_TABSTOP
- CONTROL "Spin1",IDC_SPIN_SPACING,"msctls_updown32",UDS_WRAP | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_NOTHOUSANDS,245,32,11,11
- PUSHBUTTON "<<",IDC_BUTTON2,2,99,14,15,NOT WS_TABSTOP,WS_EX_STATICEDGE
- PUSHBUTTON ">>",IDC_BUTTON1,14,99,14,15,NOT WS_TABSTOP,WS_EX_STATICEDGE
- CTEXT "Pattern name",IDC_STATIC,9,32,52,12,SS_CENTERIMAGE,WS_EX_STATICEDGE
- EDITTEXT IDC_EDIT_PATTERNNAME,60,32,107,12,ES_AUTOHSCROLL
+ CONTROL "Follow Song",IDC_PATTERN_FOLLOWSONG,"Button",BS_AUTOCHECKBOX | BS_FLAT,321,31,55,10
+ COMBOBOX IDC_COMBO_INSTRUMENT,19,61,96,137,CBS_DROPDOWNLIST | WS_VSCROLL
+ CTEXT "Row spacing",IDC_STATIC,171,32,42,8,SS_CENTERIMAGE
+ EDITTEXT IDC_EDIT_SPACING,219,30,28,12,ES_AUTOHSCROLL | ES_NUMBER | NOT WS_TABSTOP
+ CONTROL "Spin1",IDC_SPIN_SPACING,"msctls_updown32",UDS_WRAP | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_NOTHOUSANDS,239,30,11,11
+ PUSHBUTTON "<<",IDC_BUTTON2,3,84,14,15,NOT WS_TABSTOP,WS_EX_STATICEDGE
+ PUSHBUTTON ">>",IDC_BUTTON1,15,84,14,15,NOT WS_TABSTOP,WS_EX_STATICEDGE
+ CTEXT "Pattern name",IDC_STATIC,9,32,43,8,SS_CENTERIMAGE
+ EDITTEXT IDC_EDIT_PATTERNNAME,57,30,107,12,ES_AUTOHSCROLL
CONTROL "Toolbar1",IDC_TOOLBAR1,"ToolbarWindow32",WS_GROUP | 0x4d,2,4,372,18
- CONTROL "Spin1",IDC_SPIN_INSTRUMENT,"msctls_updown32",0x0,9,74,9,12
- COMBOBOX IDC_COMBO_SPLITINSTRUMENT,209,74,95,125,CBS_DROPDOWNLIST | WS_VSCROLL
- COMBOBOX IDC_COMBO_SPLITNOTE,173,74,32,137,CBS_DROPDOWNLIST | WS_VSCROLL
- LTEXT "Note",IDC_STATIC,173,65,35,8
- LTEXT "Instrument",IDC_STATIC,209,65,58,8
- CONTROL "Transpose",IDC_PATTERN_OCTAVELINK,"Button",BS_AUTOCHECKBOX | BS_LEFTTEXT | BS_FLAT,438,76,49,10
- COMBOBOX IDC_COMBO_OCTAVEMODIFIER,382,74,52,137,CBS_DROPDOWNLIST | WS_VSCROLL
- COMBOBOX IDC_COMBO_SPLITVOLUME,342,74,36,146,CBS_DROPDOWNLIST | WS_VSCROLL
- LTEXT "Volume",IDC_STATIC,342,65,25,8
- PUSHBUTTON "Plugin",IDC_PATINSTROPLUGGUI,122,74,33,13,0,WS_EX_STATICEDGE
- PUSHBUTTON "Plugin",IDC_PATINSTROPLUGGUI2,308,74,30,13,0,WS_EX_STATICEDGE
- GROUPBOX "Main instrument",IDC_STATIC,2,53,160,40
- GROUPBOX "Keyboard Split",IDC_STATIC,167,53,328,40
- LTEXT "Octave shift",IDC_STATIC,382,65,52,8
- GROUPBOX "",IDC_STATIC,2,22,493,27
- CONTROL "Loop Pattern",IDC_PATTERN_LOOP,"Button",BS_AUTOCHECKBOX | BS_LEFTTEXT | BS_FLAT | WS_TABSTOP,370,34,55,10
- EDITTEXT IDC_EDIT_ORDERLIST_MARGINS,2,113,28,12,ES_AUTOHSCROLL | ES_READONLY
- CONTROL "",IDC_SPIN_ORDERLIST_MARGINS,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_NOTHOUSANDS,15,118,11,11
- EDITTEXT IDC_EDIT_SEQUENCE_NAME,317,32,47,12,ES_AUTOHSCROLL
- CTEXT "Sequence name",IDC_STATIC_SEQUENCE_NAME,261,32,55,12,SS_CENTERIMAGE,WS_EX_STATICEDGE
+ CONTROL "Spin1",IDC_SPIN_INSTRUMENT,"msctls_updown32",0x0,7,61,11,12
+ COMBOBOX IDC_COMBO_SPLITINSTRUMENT,243,60,96,125,CBS_DROPDOWNLIST | WS_VSCROLL
+ COMBOBOX IDC_COMBO_SPLITNOTE,189,60,32,137,CBS_DROPDOWNLIST | WS_VSCROLL
+ LTEXT "Note",IDC_STATIC,171,62,16,8
+ LTEXT "Instr.",IDC_STATIC,225,62,16,8
+ CONTROL "Transpose",IDC_PATTERN_OCTAVELINK,"Button",BS_AUTOCHECKBOX | BS_FLAT,513,61,49,10
+ COMBOBOX IDC_COMBO_OCTAVEMODIFIER,465,60,44,137,CBS_DROPDOWNLIST | WS_VSCROLL
+ COMBOBOX IDC_COMBO_SPLITVOLUME,399,60,30,146,CBS_DROPDOWNLIST | WS_VSCROLL
+ LTEXT "Vol.",IDC_STATIC,381,62,13,8
+ PUSHBUTTON "Plugin",IDC_PATINSTROPLUGGUI,121,61,33,13,0,WS_EX_STATICEDGE
+ PUSHBUTTON "Plugin",IDC_PATINSTROPLUGGUI2,345,60,30,13,0,WS_EX_STATICEDGE
+ GROUPBOX "Main instrument",IDC_STATIC,3,48,154,30
+ GROUPBOX "Keyboard Split",IDC_STATIC,165,48,402,30
+ LTEXT "Oct. shift",IDC_STATIC,435,62,29,8
+ GROUPBOX "",IDC_STATIC,3,22,376,24
+ CONTROL "Loop Pattern",IDC_PATTERN_LOOP,"Button",BS_AUTOCHECKBOX | BS_FLAT | WS_TABSTOP,261,31,57,10
+ EDITTEXT IDC_EDIT_ORDERLIST_MARGINS,3,98,28,12,ES_AUTOHSCROLL | ES_READONLY
+ CONTROL "",IDC_SPIN_ORDERLIST_MARGINS,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_NOTHOUSANDS,16,103,11,11
+ EDITTEXT IDC_EDIT_SEQUENCE_NAME,453,30,108,12,ES_AUTOHSCROLL
+ CTEXT "Sequence name",IDC_STATIC_SEQUENCE_NAME,393,32,53,8,SS_CENTERIMAGE
+ GROUPBOX "",IDC_STATIC_SEQUENCE_NAME_FRAME,387,22,180,24
END
IDD_CONTROL_SAMPLES DIALOGEX 0, 0, 544, 106
@@ -1428,7 +1429,7 @@
RIGHTMARGIN, 573
VERTGUIDE, 39
VERTGUIDE, 134
- BOTTOMMARGIN, 146
+ BOTTOMMARGIN, 104
HORZGUIDE, 37
HORZGUIDE, 61
HORZGUIDE, 73
@@ -2218,12 +2219,12 @@
"Removing unused patterns is not available when using multiple sequences."
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
@@ -2592,7 +2593,7 @@
//
IDR_BUILTIN_TUNINGS TUNING "res\\built-inTunings.tc"
-#endif // English (U.K.) resources
+#endif // Englisch (GB) resources
/////////////////////////////////////////////////////////////////////////////
Modified: trunk/OpenMPT/mptrack/resource.h
===================================================================
--- trunk/OpenMPT/mptrack/resource.h 2009-09-29 23:13:53 UTC (rev 383)
+++ trunk/OpenMPT/mptrack/resource.h 2009-10-02 15:49:41 UTC (rev 384)
@@ -889,6 +889,7 @@
#define IDC_SAVE_COLORSCHEME 2388
#define IDC_EDIT_SEQUENCE_NAME 2389
#define IDC_STATIC_SEQUENCE_NAME 2390
+#define IDC_STATIC_SEQUENCE_NAME_FRAME 2391
#define ID_FILE_NEWMOD 32771
#define ID_FILE_NEWXM 32772
#define ID_FILE_NEWS3M 32773
@@ -1132,7 +1133,7 @@
#define _APS_3D_CONTROLS 1
#define _APS_NEXT_RESOURCE_VALUE 521
#define _APS_NEXT_COMMAND_VALUE 59230
-#define _APS_NEXT_CONTROL_VALUE 2391
+#define _APS_NEXT_CONTROL_VALUE 2392
#define _APS_NEXT_SYMED_VALUE 901
#endif
#endif
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sag...@us...> - 2009-09-29 23:14:08
|
Revision: 383
http://modplug.svn.sourceforge.net/modplug/?rev=383&view=rev
Author: saga-games
Date: 2009-09-29 23:13:53 +0000 (Tue, 29 Sep 2009)
Log Message:
-----------
[Fix] Pattern Editor: Copying only the param column of PC notes overwrote the value column when pasting them
[Mod] Pattern Editor: When interpolating PC notes, the plugin number and note type won't get overriden if the note type is already PC or PCs. I find this more logical.
Modified Paths:
--------------
trunk/OpenMPT/mptrack/Modedit.cpp
trunk/OpenMPT/mptrack/View_pat.cpp
Modified: trunk/OpenMPT/mptrack/Modedit.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Modedit.cpp 2009-09-29 22:30:10 UTC (rev 382)
+++ trunk/OpenMPT/mptrack/Modedit.cpp 2009-09-29 23:13:53 UTC (rev 383)
@@ -2349,7 +2349,7 @@
if(m[col].note == NOTE_PCS || m[col].note == NOTE_PC)
{
- if(s[8] != '.')
+ if(s[8] != '.' && s[8] > ' ')
{
char val[4];
memcpy(val, s+8, 3);
Modified: trunk/OpenMPT/mptrack/View_pat.cpp
===================================================================
--- trunk/OpenMPT/mptrack/View_pat.cpp 2009-09-29 22:30:10 UTC (rev 382)
+++ trunk/OpenMPT/mptrack/View_pat.cpp 2009-09-29 23:13:53 UTC (rev 383)
@@ -2293,10 +2293,13 @@
case EFFECT_COLUMN:
if(doPCinterpolation)
{ // With PC/PCs notes, copy PCs note and plug index to all rows where
- // effect interpolation is done.
+ // effect interpolation is done, if no PC note is there.
const uint16 val = static_cast<uint16>(vsrc + ((vdest - vsrc) * (int)i + verr) / distance);
- pcmd->note = PCnote;
- pcmd->instr = PCinst;
+ if(pcmd->note != NOTE_PC && pcmd->note != NOTE_PCS)
+ {
+ pcmd->note = PCnote;
+ pcmd->instr = PCinst;
+ }
pcmd->SetValueVolCol(PCparam);
pcmd->SetValueEffectCol(val);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sag...@us...> - 2009-09-29 22:30:25
|
Revision: 382
http://modplug.svn.sourceforge.net/modplug/?rev=382&view=rev
Author: saga-games
Date: 2009-09-29 22:30:10 +0000 (Tue, 29 Sep 2009)
Log Message:
-----------
[Imp] Mod Conversion: Detect and fix patterns with Bxx effect properly when merging sequences
[Fix] Pattern Editor: Entering Note Fade notes didn't work the "old style" way.
[Ref] Some minor code cleanup
Modified Paths:
--------------
trunk/OpenMPT/mptrack/Modedit.cpp
trunk/OpenMPT/mptrack/View_pat.cpp
trunk/OpenMPT/soundlib/Load_gdm.cpp
trunk/OpenMPT/soundlib/Load_psm.cpp
trunk/OpenMPT/soundlib/Sndfile.cpp
trunk/OpenMPT/soundlib/Sndfile.h
trunk/OpenMPT/soundlib/patternContainer.cpp
trunk/OpenMPT/soundlib/patternContainer.h
Modified: trunk/OpenMPT/mptrack/Modedit.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Modedit.cpp 2009-09-29 12:43:52 UTC (rev 381)
+++ trunk/OpenMPT/mptrack/Modedit.cpp 2009-09-29 22:30:10 UTC (rev 382)
@@ -104,11 +104,22 @@
// Merge multiple sequences
m_SndFile.Order.SetSequence(0);
m_SndFile.Order.resize(m_SndFile.Order.GetLengthTailTrimmed());
- SEQUENCEINDEX removedSequences = 0;
+ SEQUENCEINDEX removedSequences = 0; // sequence count
+ vector <SEQUENCEINDEX> patternsFixed; // pattern fixed by other sequence already?
+ patternsFixed.resize(m_SndFile.Patterns.Size(), SEQUENCEINDEX_INVALID);
+ // Set up vector
+ for(ORDERINDEX nOrd = 0; nOrd < m_SndFile.Order.GetLengthTailTrimmed(); nOrd++)
+ {
+ PATTERNINDEX nPat = m_SndFile.Order[nOrd];
+ if(!m_SndFile.Patterns.IsValidPat(nPat)) continue;
+ patternsFixed[nPat] = 0;
+ }
+
while(m_SndFile.Order.GetNumSequences() > 1)
{
removedSequences++;
- if(m_SndFile.Order.GetLengthTailTrimmed() + 1 + m_SndFile.Order.GetSequence(1).GetLengthTailTrimmed() > m_SndFile.GetModSpecifications(nNewType).ordersMax)
+ const ORDERINDEX nFirstOrder = m_SndFile.Order.GetLengthTailTrimmed() + 1; // +1 for separator item
+ if(nFirstOrder + m_SndFile.Order.GetSequence(1).GetLengthTailTrimmed() > m_SndFile.GetModSpecifications(nNewType).ordersMax)
{
wsprintf(s, "WARNING: Cannot merge Sequence %d (too long!)\n", removedSequences);
AddToLog(s);
@@ -118,7 +129,43 @@
m_SndFile.Order.Append(m_SndFile.Order.GetInvalidPatIndex()); // Separator item
for(ORDERINDEX nOrd = 0; nOrd < m_SndFile.Order.GetSequence(1).GetLengthTailTrimmed(); nOrd++)
{
- m_SndFile.Order.Append(m_SndFile.Order.GetSequence(1)[nOrd]);
+ PATTERNINDEX nPat = m_SndFile.Order.GetSequence(1)[nOrd];
+ m_SndFile.Order.Append(nPat);
+
+ // Try to fix patterns (Bxx commands)
+ if(!m_SndFile.Patterns.IsValidPat(nPat)) continue;
+
+ MODCOMMAND *m = m_SndFile.Patterns[nPat];
+ for (UINT len = 0; len < m_SndFile.PatternSize[nPat] * m_SndFile.m_nChannels; m++, len++)
+ {
+ if(m->command == CMD_POSITIONJUMP)
+ {
+ if(patternsFixed[nPat] != SEQUENCEINDEX_INVALID && patternsFixed[nPat] != removedSequences)
+ {
+ // Oops, some other sequence uses this pattern already.
+ const PATTERNINDEX nNewPat = m_SndFile.Patterns.Insert(m_SndFile.PatternSize[nPat]);
+ if(nNewPat != SEQUENCEINDEX_INVALID)
+ {
+ // could create new pattern - copy data over and continue from here.
+ m_SndFile.Order[nFirstOrder + nOrd] = nNewPat;
+ MODCOMMAND *pSrc = m_SndFile.Patterns[nPat];
+ MODCOMMAND *pDest = m_SndFile.Patterns[nNewPat];
+ memcpy(pDest, pSrc, m_SndFile.PatternSize[nPat] * m_SndFile.m_nChannels * sizeof(MODCOMMAND));
+ m = pDest + len;
+ patternsFixed.resize(max(nNewPat + 1, patternsFixed.size()), SEQUENCEINDEX_INVALID);
+ nPat = nNewPat;
+ } else
+ {
+ // cannot create new pattern: notify the user
+ wsprintf(s, "CONFLICT: Pattern break commands in Pattern %d might be broken since it has been used in several sequences!", nPat);
+ AddToLog(s);
+ }
+ }
+ m->param += nFirstOrder;
+ patternsFixed[nPat] = removedSequences;
+ }
+ }
+
}
m_SndFile.Order.RemoveSequence(1);
}
Modified: trunk/OpenMPT/mptrack/View_pat.cpp
===================================================================
--- trunk/OpenMPT/mptrack/View_pat.cpp 2009-09-29 12:43:52 UTC (rev 381)
+++ trunk/OpenMPT/mptrack/View_pat.cpp 2009-09-29 22:30:10 UTC (rev 382)
@@ -4180,7 +4180,7 @@
}
// -- old style note cut/off: erase instrument number
- if (oldStyle && ((p->note==NOTE_NOTECUT) || (p->note==NOTE_KEYOFF))) {
+ if (oldStyle && ((p->note == NOTE_NOTECUT) || (p->note == NOTE_KEYOFF) || (p->note == NOTE_FADE))) {
p->instr=0;
}
Modified: trunk/OpenMPT/soundlib/Load_gdm.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Load_gdm.cpp 2009-09-29 12:43:52 UTC (rev 381)
+++ trunk/OpenMPT/soundlib/Load_gdm.cpp 2009-09-29 22:30:10 UTC (rev 382)
@@ -96,7 +96,7 @@
// read channel pan map... 0...15 = channel panning, 16 = surround channel, 255 = channel does not exist
m_nChannels = 32;
- for(int i = 0; i < 32; i++)
+ for(CHANNELINDEX i = 0; i < 32; i++)
{
if(pHeader->PanMap[i] < 16)
{
Modified: trunk/OpenMPT/soundlib/Load_psm.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Load_psm.cpp 2009-09-29 12:43:52 UTC (rev 381)
+++ trunk/OpenMPT/soundlib/Load_psm.cpp 2009-09-29 22:30:10 UTC (rev 382)
@@ -847,7 +847,7 @@
DWORD length; // in bytes
DWORD loopStart; // in samples?
DWORD loopEnd; // in samples?
- CHAR finetune; // 0 ... 15 (useless?)
+ CHAR finetune; // 0 ... 15 (useless? also, why is this almost always 70?)
BYTE volume; // default volume
WORD c2freq;
};
Modified: trunk/OpenMPT/soundlib/Sndfile.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Sndfile.cpp 2009-09-29 12:43:52 UTC (rev 381)
+++ trunk/OpenMPT/soundlib/Sndfile.cpp 2009-09-29 22:30:10 UTC (rev 382)
@@ -1045,10 +1045,10 @@
}
-UINT CSoundFile::GetNumPatterns() const
+ORDERINDEX CSoundFile::GetNumPatterns() const
//-------------------------------------
{
- UINT i = 0;
+ ORDERINDEX i = 0;
while ((i < Order.size()) && (Order[i] < Order.GetInvalidPatIndex())) i++;
return i;
}
Modified: trunk/OpenMPT/soundlib/Sndfile.h
===================================================================
--- trunk/OpenMPT/soundlib/Sndfile.h 2009-09-29 12:43:52 UTC (rev 381)
+++ trunk/OpenMPT/soundlib/Sndfile.h 2009-09-29 22:30:10 UTC (rev 382)
@@ -623,9 +623,9 @@
BOOL SetMasterVolume(UINT vol, BOOL bAdjustAGC=FALSE);
UINT GetMasterVolume() const { return m_nMasterVolume; }
- UINT GetNumPatterns() const;
- UINT GetNumInstruments() const {return m_nInstruments;}
- UINT GetNumSamples() const { return m_nSamples; }
+ ORDERINDEX GetNumPatterns() const;
+ INSTRUMENTINDEX GetNumInstruments() const {return m_nInstruments;}
+ SAMPLEINDEX GetNumSamples() const { return m_nSamples; }
UINT GetCurrentPos() const;
UINT GetCurrentPattern() const { return m_nPattern; }
ORDERINDEX GetCurrentOrder() const { return static_cast<ORDERINDEX>(m_nCurrentPattern); }
Modified: trunk/OpenMPT/soundlib/patternContainer.cpp
===================================================================
--- trunk/OpenMPT/soundlib/patternContainer.cpp 2009-09-29 12:43:52 UTC (rev 381)
+++ trunk/OpenMPT/soundlib/patternContainer.cpp 2009-09-29 22:30:10 UTC (rev 382)
@@ -5,14 +5,14 @@
#include "../mptrack/serialization_utils.h"
#include "../mptrack/version.h"
-int CPatternContainer::Insert(const ROWINDEX rows)
+PATTERNINDEX CPatternContainer::Insert(const ROWINDEX rows)
//---------------------------------------------
{
PATTERNINDEX i = 0;
for(i = 0; i<m_Patterns.size(); i++)
if(!m_Patterns[i]) break;
if(Insert(i, rows))
- return -1;
+ return PATTERNINDEX_INVALID;
else return i;
}
Modified: trunk/OpenMPT/soundlib/patternContainer.h
===================================================================
--- trunk/OpenMPT/soundlib/patternContainer.h 2009-09-29 12:43:52 UTC (rev 381)
+++ trunk/OpenMPT/soundlib/patternContainer.h 2009-09-29 22:30:10 UTC (rev 382)
@@ -38,9 +38,9 @@
//ignoring request.
bool Insert(const PATTERNINDEX index, const ROWINDEX rows);
- //Insert pattern to position with the lowest index, and return that index, -1
+ //Insert pattern to position with the lowest index, and return that index, PATTERNINDEX_INVALID
//on failure.
- int Insert(const ROWINDEX rows);
+ PATTERNINDEX Insert(const ROWINDEX rows);
//Remove pattern from given position. Currently it actually makes the pattern
//'invisible' - the pattern data is cleared but the actual pattern object won't get removed.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sag...@us...> - 2009-09-29 13:27:55
|
Revision: 381
http://modplug.svn.sourceforge.net/modplug/?rev=381&view=rev
Author: saga-games
Date: 2009-09-29 12:43:52 +0000 (Tue, 29 Sep 2009)
Log Message:
-----------
[Imp] Mod Conversion: If possible, all MPTM sequences will be merged into the first seqeucne.
Modified Paths:
--------------
trunk/OpenMPT/mptrack/Modedit.cpp
Modified: trunk/OpenMPT/mptrack/Modedit.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Modedit.cpp 2009-09-27 19:55:54 UTC (rev 380)
+++ trunk/OpenMPT/mptrack/Modedit.cpp 2009-09-29 12:43:52 UTC (rev 381)
@@ -80,6 +80,7 @@
-User definable tunings.
-Extended pattern range
-Extended sequence
+ -Multiple sequences
Extended features in IT/XM/S3M/MOD(not all listed below are available in all of those formats):
-plugs
@@ -100,6 +101,27 @@
-For more info, see e.g. SaveExtendedSongProperties(), SaveExtendedInstrumentProperties()
*/
+ // Merge multiple sequences
+ m_SndFile.Order.SetSequence(0);
+ m_SndFile.Order.resize(m_SndFile.Order.GetLengthTailTrimmed());
+ SEQUENCEINDEX removedSequences = 0;
+ while(m_SndFile.Order.GetNumSequences() > 1)
+ {
+ removedSequences++;
+ if(m_SndFile.Order.GetLengthTailTrimmed() + 1 + m_SndFile.Order.GetSequence(1).GetLengthTailTrimmed() > m_SndFile.GetModSpecifications(nNewType).ordersMax)
+ {
+ wsprintf(s, "WARNING: Cannot merge Sequence %d (too long!)\n", removedSequences);
+ AddToLog(s);
+ m_SndFile.Order.RemoveSequence(1);
+ continue;
+ }
+ m_SndFile.Order.Append(m_SndFile.Order.GetInvalidPatIndex()); // Separator item
+ for(ORDERINDEX nOrd = 0; nOrd < m_SndFile.Order.GetSequence(1).GetLengthTailTrimmed(); nOrd++)
+ {
+ m_SndFile.Order.Append(m_SndFile.Order.GetSequence(1)[nOrd]);
+ }
+ m_SndFile.Order.RemoveSequence(1);
+ }
}
// Check if conversion to 64 rows is necessary
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rel...@us...> - 2009-09-27 19:56:10
|
Revision: 380
http://modplug.svn.sourceforge.net/modplug/?rev=380&view=rev
Author: relabsoluness
Date: 2009-09-27 19:55:54 +0000 (Sun, 27 Sep 2009)
Log Message:
-----------
[Fix] MIDI mapping: Pattern record checkbox wasn't updated properly.
[Fix] Sample map: was broken when dealing with sample indexes greater than 255.
[Mod] Version: Changed version number.
[Ref] Minor code cleanup.
Modified Paths:
--------------
trunk/OpenMPT/mptrack/MIDIMappingDialog.cpp
trunk/OpenMPT/mptrack/MainFrm.cpp
trunk/OpenMPT/mptrack/Moddoc.cpp
trunk/OpenMPT/mptrack/View_tre.cpp
trunk/OpenMPT/mptrack/dlg_misc.cpp
trunk/OpenMPT/mptrack/dlg_misc.h
trunk/OpenMPT/mptrack/version.h
Modified: trunk/OpenMPT/mptrack/MIDIMappingDialog.cpp
===================================================================
--- trunk/OpenMPT/mptrack/MIDIMappingDialog.cpp 2009-09-24 15:24:32 UTC (rev 379)
+++ trunk/OpenMPT/mptrack/MIDIMappingDialog.cpp 2009-09-27 19:55:54 UTC (rev 380)
@@ -134,8 +134,9 @@
if(i < 0 || (size_t)i >= m_rMIDIMapper.GetCount()) return;
m_Setting = m_rMIDIMapper.GetDirective(i);
CMIDIMappingDirective& activeSetting = m_Setting;
- CheckDlgButton(IDC_CHECKACTIVE, activeSetting.IsActive() ? MF_CHECKED : MF_UNCHECKED);
- CheckDlgButton(IDC_CHECKCAPTURE, activeSetting.GetCaptureMIDI() ? MF_CHECKED : MF_UNCHECKED);
+ CheckDlgButton(IDC_CHECKACTIVE, activeSetting.IsActive() ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(IDC_CHECKCAPTURE, activeSetting.GetCaptureMIDI() ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(IDC_CHECK_PATRECORD, activeSetting.GetAllowPatternEdit() ? BST_CHECKED : BST_UNCHECKED);
m_ChannelCBox.SetCurSel(activeSetting.GetChannel());
Modified: trunk/OpenMPT/mptrack/MainFrm.cpp
===================================================================
--- trunk/OpenMPT/mptrack/MainFrm.cpp 2009-09-24 15:24:32 UTC (rev 379)
+++ trunk/OpenMPT/mptrack/MainFrm.cpp 2009-09-27 19:55:54 UTC (rev 380)
@@ -399,7 +399,7 @@
wsprintf(s, "Color%02d", ncol);
rgbCustomColors[ncol] = GetPrivateProfileDWord("Display", s, rgbCustomColors[ncol], iniFile);
}
- if(rgbCustomColors[MODCOLOR_SEPSHADOW] == rgbCustomColors[MODCOLOR_SEPFACE] == rgbCustomColors[MODCOLOR_SEPHILITE] == 0 && vIniVersion < MAKE_VERSION_NUMERIC(1,17,03,02))
+ if(rgbCustomColors[MODCOLOR_SEPSHADOW] == rgbCustomColors[MODCOLOR_SEPFACE] == rgbCustomColors[MODCOLOR_SEPHILITE] == 0 && vIniVersion < MAKE_VERSION_NUMERIC(1,17,03,03))
{
rgbCustomColors[MODCOLOR_SEPSHADOW] = GetSysColor(COLOR_BTNSHADOW);
rgbCustomColors[MODCOLOR_SEPFACE] = GetSysColor(COLOR_BTNFACE);
Modified: trunk/OpenMPT/mptrack/Moddoc.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Moddoc.cpp 2009-09-24 15:24:32 UTC (rev 379)
+++ trunk/OpenMPT/mptrack/Moddoc.cpp 2009-09-27 19:55:54 UTC (rev 380)
@@ -3159,7 +3159,7 @@
END_CRITICAL();
// set playback timer in the status bar
- SetElapsedTime(static_cast<ORDERINDEX>(nOrd), nRow, true);
+ SetElapsedTime(nOrd, nRow, true);
if (pModPlaying != this)
{
@@ -3214,7 +3214,7 @@
END_CRITICAL();
// set playback timer in the status bar
- SetElapsedTime(static_cast<ORDERINDEX>(nOrd), nRow, true);
+ SetElapsedTime(nOrd, nRow, true);
if (pModPlaying != this) {
pMainFrm->PlayMod(this, followSonghWnd, m_dwNotifyType|MPTNOTIFY_POSITION|MPTNOTIFY_VUMETERS); //rewbs.fix2977
@@ -3272,7 +3272,7 @@
END_CRITICAL();
// set playback timer in the status bar
- SetElapsedTime(static_cast<ORDERINDEX>(nOrd), nRow, true);
+ SetElapsedTime(nOrd, nRow, true);
if (pModPlaying != this) {
pMainFrm->PlayMod(this, followSonghWnd, m_dwNotifyType|MPTNOTIFY_POSITION|MPTNOTIFY_VUMETERS); //rewbs.fix2977
Modified: trunk/OpenMPT/mptrack/View_tre.cpp
===================================================================
--- trunk/OpenMPT/mptrack/View_tre.cpp 2009-09-24 15:24:32 UTC (rev 379)
+++ trunk/OpenMPT/mptrack/View_tre.cpp 2009-09-27 19:55:54 UTC (rev 380)
@@ -2080,10 +2080,10 @@
{
UINT nDefault = 0;
BOOL bSep = FALSE;
- DWORD dwItemType, dwItemNo;
+ DWORD dwItemType;
dwItemType = GetModItem(hItem);
- dwItemNo = dwItemType >> 16;
+ const uint16 nItemNo = HIWORD(dwItemType);
dwItemType &= 0xFFFF;
SelectItem(hItem);
switch(dwItemType)
@@ -2111,7 +2111,7 @@
if ((pModDoc) && (!pModDoc->GetNumInstruments()))
{
AppendMenu(hMenu, MF_SEPARATOR, NULL, "");
- AppendMenu(hMenu, (pModDoc->IsSampleMuted(dwItemNo) ? MF_CHECKED:0)|MF_STRING, ID_MODTREE_MUTE, "&Mute Sample");
+ AppendMenu(hMenu, (pModDoc->IsSampleMuted(nItemNo) ? MF_CHECKED:0)|MF_STRING, ID_MODTREE_MUTE, "&Mute Sample");
AppendMenu(hMenu, MF_STRING, ID_MODTREE_SOLO, "&Solo Sample");
AppendMenu(hMenu, MF_STRING, ID_MODTREE_UNMUTEALL, "&Unmute all");
}
@@ -2128,7 +2128,7 @@
if ((pModDoc) && (pModDoc->GetNumInstruments()))
{
AppendMenu(hMenu, MF_SEPARATOR, NULL, "");
- AppendMenu(hMenu, (pModDoc->IsInstrumentMuted(dwItemNo) ? MF_CHECKED:0)|MF_STRING, ID_MODTREE_MUTE, "&Mute Instrument");
+ AppendMenu(hMenu, (pModDoc->IsInstrumentMuted(nItemNo) ? MF_CHECKED:0)|MF_STRING, ID_MODTREE_MUTE, "&Mute Instrument");
AppendMenu(hMenu, MF_STRING, ID_MODTREE_SOLO, "&Solo Instrument");
AppendMenu(hMenu, MF_STRING, ID_MODTREE_UNMUTEALL, "&Unmute all");
// -> CODE#0023
@@ -2149,7 +2149,7 @@
CModDoc *pModDoc = GetDocumentFromItem(hItem);
CSoundFile *pSndFile = pModDoc ? pModDoc->GetSoundFile() : NULL;
if (pSndFile) {
- PSNDMIXPLUGIN pPlugin = &pSndFile->m_MixPlugins[dwItemNo];
+ PSNDMIXPLUGIN pPlugin = &pSndFile->m_MixPlugins[nItemNo];
if (pPlugin) {
bool bypassed = ((pPlugin->Info.dwInputRouting&MIXPLUG_INPUTF_BYPASS) != 0);
AppendMenu(hMenu, (bypassed?MF_CHECKED:0)|MF_STRING, ID_MODTREE_MUTE, "&Bypass");
@@ -2490,29 +2490,29 @@
//-----------------------------
{
HTREEITEM hItem = GetSelectedItem();
- DWORD dwItemType, dwItemNo;
+ DWORD dwItemType;
CModDoc *pModDoc;
dwItemType = GetModItem(hItem);
- dwItemNo = dwItemType >> 16;
+ const uint16 nItemNo = HIWORD(dwItemType);
dwItemType &= 0xFFFF;
pModDoc = GetDocumentFromItem(hItem);
if (pModDoc)
{
if ((dwItemType == MODITEM_SAMPLE) && (!pModDoc->GetNumInstruments()))
{
- pModDoc->MuteSample(dwItemNo, (pModDoc->IsSampleMuted(dwItemNo)) ? FALSE : TRUE);
+ pModDoc->MuteSample(nItemNo, (pModDoc->IsSampleMuted(nItemNo)) ? FALSE : TRUE);
} else
if ((dwItemType == MODITEM_INSTRUMENT) && (pModDoc->GetNumInstruments()))
{
- pModDoc->MuteInstrument(dwItemNo, (pModDoc->IsInstrumentMuted(dwItemNo)) ? FALSE : TRUE);
+ pModDoc->MuteInstrument(nItemNo, (pModDoc->IsInstrumentMuted(nItemNo)) ? FALSE : TRUE);
}
if ((dwItemType == MODITEM_EFFECT))
{
CSoundFile *pSndFile = pModDoc ? pModDoc->GetSoundFile() : NULL;
if (pSndFile) {
- PSNDMIXPLUGIN pPlugin = &pSndFile->m_MixPlugins[dwItemNo];
+ PSNDMIXPLUGIN pPlugin = &pSndFile->m_MixPlugins[nItemNo];
if (pPlugin) {
CVstPlugin *pVstPlugin = (CVstPlugin *)pPlugin->pMixPlugin;
if (pVstPlugin) pVstPlugin->Bypass();
@@ -2528,11 +2528,11 @@
//-----------------------------
{
HTREEITEM hItem = GetSelectedItem();
- DWORD dwItemType, dwItemNo;
+ DWORD dwItemType;
CModDoc *pModDoc;
dwItemType = GetModItem(hItem);
- dwItemNo = dwItemType >> 16;
+ const uint16 nItemNo = HIWORD(dwItemType);
dwItemType &= 0xFFFF;
pModDoc = GetDocumentFromItem(hItem);
if (pModDoc)
@@ -2541,16 +2541,16 @@
INSTRUMENTINDEX nInstruments = pModDoc->GetNumInstruments();
if ((dwItemType == MODITEM_SAMPLE) && (!nInstruments))
{
- for (UINT i=1; i<=nSamples; i++)
+ for (SAMPLEINDEX i=1; i<=nSamples; i++)
{
- pModDoc->MuteSample(i, (i == dwItemNo) ? FALSE : TRUE);
+ pModDoc->MuteSample(i, (i == nItemNo) ? FALSE : TRUE);
}
} else
if ((dwItemType == MODITEM_INSTRUMENT) && (nInstruments))
{
- for (UINT i=1; i<=nInstruments; i++)
+ for (INSTRUMENTINDEX i=1; i<=nInstruments; i++)
{
- pModDoc->MuteInstrument(i, (i == dwItemNo) ? FALSE : TRUE);
+ pModDoc->MuteInstrument(i, (i == nItemNo) ? FALSE : TRUE);
}
}
}
@@ -2572,11 +2572,11 @@
INSTRUMENTINDEX nInstruments = pModDoc->GetNumInstruments();
if ((dwItemType == MODITEM_SAMPLE) || (dwItemType == MODITEM_INSTRUMENT))
{
- for (UINT i=1; i<=nSamples; i++)
+ for (SAMPLEINDEX i=1; i<=nSamples; i++)
{
pModDoc->MuteSample(i, FALSE);
}
- for (UINT j=1; j<=nInstruments; j++)
+ for (INSTRUMENTINDEX j=1; j<=nInstruments; j++)
{
pModDoc->MuteInstrument(j, FALSE);
}
@@ -2623,14 +2623,14 @@
{
HTREEITEM hItem = GetSelectedItem();
DWORD dwItemType = GetModItem(hItem);
- DWORD dwItem = dwItemType >> 16;
+ const uint16 nItem = HIWORD(dwItemType);
dwItemType &= 0xFFFF;
CModDoc *pModDoc = GetDocumentFromItem(hItem);
CSoundFile *pSndFile = pModDoc ? pModDoc->GetSoundFile() : NULL;
- if(pSndFile && dwItem){
+ if(pSndFile && nItem){
- if(pSndFile->m_szInstrumentPath[dwItem-1][0] == '\0'){
+ if(pSndFile->m_szInstrumentPath[nItem-1][0] == '\0'){
CHAR pszFileNames[_MAX_PATH];
CFileDialog dlg(FALSE, (pSndFile->m_nType & (MOD_TYPE_IT|MOD_TYPE_MPT)) ? "iti" : "xi", NULL,
@@ -2646,23 +2646,23 @@
dlg.m_ofn.lpstrFile = pszFileNames;
dlg.m_ofn.nMaxFile = _MAX_PATH;
- if(dlg.DoModal() == IDOK) strcpy(pSndFile->m_szInstrumentPath[dwItem-1], pszFileNames);
+ if(dlg.DoModal() == IDOK) strcpy(pSndFile->m_szInstrumentPath[nItem-1], pszFileNames);
dlg.m_ofn.lpstrFile = NULL;
dlg.m_ofn.nMaxFile = 0;
}
- if(pSndFile->m_szInstrumentPath[dwItem-1][0] != '\0'){
- int size = strlen(pSndFile->m_szInstrumentPath[dwItem-1]);
- BOOL iti = _stricmp(&pSndFile->m_szInstrumentPath[dwItem-1][size-3],"iti") == 0;
- BOOL xi = _stricmp(&pSndFile->m_szInstrumentPath[dwItem-1][size-2],"xi") == 0;
+ if(pSndFile->m_szInstrumentPath[nItem-1][0] != '\0'){
+ int size = strlen(pSndFile->m_szInstrumentPath[nItem-1]);
+ BOOL iti = _stricmp(&pSndFile->m_szInstrumentPath[nItem-1][size-3],"iti") == 0;
+ BOOL xi = _stricmp(&pSndFile->m_szInstrumentPath[nItem-1][size-2],"xi") == 0;
if(iti || (!iti && !xi && pSndFile->m_nType & (MOD_TYPE_IT|MOD_TYPE_MPT)))
- pSndFile->SaveITIInstrument(dwItem, pSndFile->m_szInstrumentPath[dwItem-1]);
+ pSndFile->SaveITIInstrument(nItem, pSndFile->m_szInstrumentPath[nItem-1]);
if(xi || (!xi && !iti && pSndFile->m_nType == MOD_TYPE_XM))
- pSndFile->SaveXIInstrument(dwItem, pSndFile->m_szInstrumentPath[dwItem-1]);
+ pSndFile->SaveXIInstrument(nItem, pSndFile->m_szInstrumentPath[nItem-1]);
- pSndFile->instrumentModified[dwItem-1] = FALSE;
+ pSndFile->instrumentModified[nItem-1] = FALSE;
}
if(pModDoc) pModDoc->UpdateAllViews(NULL, HINT_MODTYPE);
Modified: trunk/OpenMPT/mptrack/dlg_misc.cpp
===================================================================
--- trunk/OpenMPT/mptrack/dlg_misc.cpp 2009-09-24 15:24:32 UTC (rev 379)
+++ trunk/OpenMPT/mptrack/dlg_misc.cpp 2009-09-27 19:55:54 UTC (rev 380)
@@ -2787,7 +2787,7 @@
KeyboardMap[iNote] = pIns->Keyboard[iNote];
} else
{
- KeyboardMap[iNote] = (BYTE)nSample;
+ KeyboardMap[iNote] = (WORD)nSample;
}
/* rewbs.note: I don't think we need this with cust keys.
// -> CODE#0009
Modified: trunk/OpenMPT/mptrack/dlg_misc.h
===================================================================
--- trunk/OpenMPT/mptrack/dlg_misc.h 2009-09-24 15:24:32 UTC (rev 379)
+++ trunk/OpenMPT/mptrack/dlg_misc.h 2009-09-27 19:55:54 UTC (rev 380)
@@ -535,7 +535,7 @@
CSliderCtrl m_SbOctave;
CSoundFile *m_pSndFile;
UINT m_nInstrument;
- BYTE KeyboardMap[NOTE_MAX];
+ WORD KeyboardMap[NOTE_MAX];
public:
CSampleMapDlg(CSoundFile *pSndFile, UINT nInstr, CWnd *parent=NULL):CDialog(IDD_EDITSAMPLEMAP, parent)
Modified: trunk/OpenMPT/mptrack/version.h
===================================================================
--- trunk/OpenMPT/mptrack/version.h 2009-09-24 15:24:32 UTC (rev 379)
+++ trunk/OpenMPT/mptrack/version.h 2009-09-27 19:55:54 UTC (rev 380)
@@ -15,7 +15,7 @@
#define VER_MAJORMAJOR 1
#define VER_MAJOR 17
#define VER_MINOR 03
-#define VER_MINORMINOR 02
+#define VER_MINORMINOR 03
//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...> - 2009-09-24 15:24:42
|
Revision: 379
http://modplug.svn.sourceforge.net/modplug/?rev=379&view=rev
Author: saga-games
Date: 2009-09-24 15:24:32 +0000 (Thu, 24 Sep 2009)
Log Message:
-----------
[New] Can now import PSM16 files.
[Fix] Pattern editor: If the current pattern is the last possible pattern in the sequence, no "next pattern" is displayed
[Fix] Color Setup: When loading colour presets that have less colours are defined than required, the missing colours will be replaced by those from the "MPT" preset.
[Fix] IT Specs: As the last order in an IT file has to be "---", any other order item got overwritten when saving IT files with 256 orders. As a consequence, the maximum order count has been reduced by one.
Modified Paths:
--------------
trunk/OpenMPT/mptrack/Draw_pat.cpp
trunk/OpenMPT/mptrack/Moptions.cpp
trunk/OpenMPT/soundlib/Load_psm.cpp
trunk/OpenMPT/soundlib/Sndfile.h
trunk/OpenMPT/soundlib/mod_specifications.h
Modified: trunk/OpenMPT/mptrack/Draw_pat.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Draw_pat.cpp 2009-09-23 15:04:06 UTC (rev 378)
+++ trunk/OpenMPT/mptrack/Draw_pat.cpp 2009-09-24 15:24:32 UTC (rev 379)
@@ -616,6 +616,7 @@
const ORDERINDEX startOrder= static_cast<ORDERINDEX>(SendCtrlMessage(CTRLMSG_GETCURRENTORDER));
ORDERINDEX nNextOrder;
nNextOrder = pSndFile->Order.GetNextOrderIgnoringSkips(startOrder);
+ if(nNextOrder == startOrder) nNextOrder = ORDERINDEX_INVALID;
//Ignore skip items(+++) from sequence.
const ORDERINDEX ordCount = pSndFile->Order.GetLength();
Modified: trunk/OpenMPT/mptrack/Moptions.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Moptions.cpp 2009-09-23 15:04:06 UTC (rev 378)
+++ trunk/OpenMPT/mptrack/Moptions.cpp 2009-09-24 15:24:32 UTC (rev 379)
@@ -590,6 +590,8 @@
TCHAR sFilename[MAX_PATH];
strcpy(sFilename, dlg.GetPathName());
+ // Ensure that all colours are reset (for outdated colour schemes)
+ OnPresetMPT();
for(int i = 0; i < MAX_MODCOLORS; i++)
{
TCHAR sKeyName[16];
Modified: trunk/OpenMPT/soundlib/Load_psm.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Load_psm.cpp 2009-09-23 15:04:06 UTC (rev 378)
+++ trunk/OpenMPT/soundlib/Load_psm.cpp 2009-09-24 15:24:32 UTC (rev 379)
@@ -1,5 +1,5 @@
/*
- * Purpose: Load new PSM (ProTracker Studio) modules
+ * Purpose: Load PSM16 and new PSM (ProTracker Studio) modules
* Authors: Johannes Schultz
*
* This is partly based on http://www.shikadi.net/moddingwiki/ProTracker_Studio_Module
@@ -7,11 +7,11 @@
* gave me a few clues. :)
*
* What's playing?
- * - Epic Pinball - Perfect! (the old tunes in PSM16 format are not supported)
+ * - Epic Pinball - Perfect! (I don't have an old version with the PSM16 tunes to compare, though - some of them differ from the new PSM tunes)
* - Extreme Pinball - Perfect! (subtunes included!)
* - Jazz Jackrabbit - Perfect!
* - One Must Fall! - Perfect! (it helped a lot to have the original MTM files...)
- * - Silverball - Currently not supported (old PSM16 format)
+ * - Silverball - Seems to work (I don't have all tables so I can't compare)
* - Sinaria - Seems to work (never played the game, so I can't really tell...)
*
* Effect conversion should be about right...
@@ -23,7 +23,14 @@
#pragma pack(1)
-struct PSMHEADER
+////////////////////////////////////////////////////////////
+//
+// New PSM support starts here. PSM16 structs are below.
+//
+
+
+
+struct PSMNEWHEADER
{
DWORD formatID; // "PSM " (new format)
DWORD fileSize; // Filesize - 12
@@ -98,6 +105,7 @@
// Portamento effect conversion (depending on format version)
inline BYTE convert_psm_porta(BYTE param, bool bNewFormat)
+//--------------------------------------------------------
{
return ((bNewFormat) ? (param) : ((param < 4) ? (param | 0xF0) : (param >> 2)));
}
@@ -111,12 +119,16 @@
DWORD dwMemPos = 0;
bool bNewFormat = false; // The game "Sinaria" uses a slightly modified PSM structure
- ASSERT_CAN_READ(12);
- PSMHEADER shdr;
- memcpy(&shdr, lpStream, sizeof(PSMHEADER));
- if(LittleEndian(shdr.formatID) != 0x204d5350 // "PSM "
- || LittleEndian(shdr.fileSize) != dwMemLength - 12
- || LittleEndian(shdr.fileInfoID) != 0x454C4946 // "FILE"
+ ASSERT_CAN_READ(sizeof(PSMNEWHEADER));
+ PSMNEWHEADER *shdr = (PSMNEWHEADER *)lpStream;
+
+ if(LittleEndian(shdr->formatID) == 0xFE4D5350) // "PSM\xFE" - PSM16 format
+ return ReadPSM16(lpStream, dwMemLength);
+
+ // Check header
+ if(LittleEndian(shdr->formatID) != 0x204D5350 // "PSM "
+ || LittleEndian(shdr->fileSize) != dwMemLength - 12
+ || LittleEndian(shdr->fileInfoID) != 0x454C4946 // "FILE"
) return false;
// Yep, this seems to be a valid file.
@@ -727,7 +739,6 @@
dwRowOffset += 2;
}
-
}
row_data += m_nChannels;
@@ -791,3 +802,399 @@
#undef ASSERT_CAN_READ
}
+
+////////////////////////////////
+//
+// PSM16 support starts here.
+//
+
+#pragma pack(1)
+
+struct PSM16HEADER
+{
+ DWORD formatID; // "PSM\xFE" (PSM16)
+ CHAR songName[59]; // Song title, padded with nulls
+ BYTE lineEnd; // $1A
+ BYTE songType; // Song Type bitfield
+ BYTE formatVersion; // $10
+ BYTE patternVersion; // 0 or 1
+ BYTE songSpeed; //
+ BYTE songTempo; // 32 ... 255
+ BYTE masterVolume; // 0 ... 255
+ WORD songLength; // 0 ... 255 (number of patterns to play in the song)
+ WORD songOrders; // 0 ... 255 (same as previous value as no subsongs are present)
+ WORD numPatterns; // 1 ... 255
+ WORD numSamples; // 1 ... 255
+ WORD numChannelsPlay; // 0 ... 32 (max. number of channels to play)
+ WORD numChannelsReal; // 0 ... 32 (max. number of channels to process)
+ DWORD orderOffset;
+ DWORD panOffset;
+ DWORD patOffset;
+ DWORD smpOffset;
+ DWORD commentsOffset;
+ DWORD patSize; // Size of all patterns
+ CHAR filler[40];
+};
+
+struct PSM16SMPHEADER
+{
+ CHAR filename[13]; // null-terminated
+ CHAR name[24]; // dito
+ DWORD offset; // in file
+ DWORD memoffset; // not used
+ WORD sampleNumber; // 1 ... 255
+ BYTE flags; // sample flag bitfield
+ DWORD length; // in bytes
+ DWORD loopStart; // in samples?
+ DWORD loopEnd; // in samples?
+ CHAR finetune; // 0 ... 15 (useless?)
+ BYTE volume; // default volume
+ WORD c2freq;
+};
+
+struct PSM16PATHEADER
+{
+ WORD size; // includes header bytes
+ BYTE numRows; // 1 ... 64
+ BYTE numChans; // 1 ... 31
+};
+
+#pragma pack()
+
+
+bool CSoundFile::ReadPSM16(const LPCBYTE lpStream, const DWORD dwMemLength)
+//-----------------------------------------------------------------------
+{
+ #define ASSERT_CAN_READ(x) \
+ if( dwMemPos > dwMemLength || x > dwMemLength - dwMemPos ) return false;
+
+ DWORD dwMemPos = 0;
+
+ ASSERT_CAN_READ(sizeof(PSM16HEADER));
+ PSM16HEADER *shdr = (PSM16HEADER *)lpStream;
+
+ // Check header
+ if((LittleEndian(shdr->formatID) != 0xFE4D5350) // "PSM\xFE"
+ || (shdr->lineEnd != 0x1A)
+ || (shdr->formatVersion != 0x10 && shdr->formatVersion != 0x01) // why is this sometimes 0x01?
+ || (shdr->patternVersion != 0) // 255ch pattern version not supported (did anyone use this?)
+ || ((shdr->songType & 3) != 0)
+ || (min(shdr->numChannelsPlay, shdr->numChannelsReal) == 0)
+ ) return false;
+
+ // Seems to be valid!
+
+ m_nType = MOD_TYPE_S3M;
+ m_nChannels = max(shdr->numChannelsPlay, shdr->numChannelsReal);
+ m_nMasterVolume = shdr->masterVolume;
+ m_nDefaultGlobalVolume = 256;
+ m_nDefaultSpeed = shdr->songSpeed;
+ m_nDefaultTempo = shdr->songTempo;
+
+ memset(m_szNames, 0, sizeof(m_szNames));
+ memcpy(m_szNames[0], shdr->songName, 31);
+ m_szNames[0][31] = 0;
+
+ // Read orders
+ dwMemPos = LittleEndian(shdr->orderOffset);
+ ASSERT_CAN_READ((DWORD)LittleEndianW(shdr->songOrders) + 2);
+ if(LittleEndian(shdr->orderOffset) > 4 && LittleEndian(*(DWORD *)(lpStream + dwMemPos - 4)) == 0x44524f50) // PORD
+ {
+ Order.ReadAsByte(lpStream + dwMemPos, LittleEndianW(shdr->songOrders), dwMemLength - dwMemPos);
+ }
+
+ // Read pan positions
+ dwMemPos = LittleEndian(shdr->panOffset);
+ ASSERT_CAN_READ(32);
+ if(LittleEndian(shdr->panOffset) > 4 && LittleEndian(*(DWORD *)(lpStream + dwMemPos - 4)) == 0x4E415050) // PPAN
+ {
+ for(CHANNELINDEX i = 0; i < 32; i++)
+ {
+ ChnSettings[i].nPan = lpStream[dwMemPos + i] << 4;
+ ChnSettings[i].nVolume = 64;
+ ChnSettings[i].dwFlags = (i >= shdr->numChannelsPlay) ? CHN_MUTE : 0;
+ }
+ }
+
+ // Read samples
+ dwMemPos = LittleEndian(shdr->smpOffset);
+ ASSERT_CAN_READ(0);
+ if(LittleEndian(shdr->smpOffset) > 4 && LittleEndian(*(DWORD *)(lpStream + dwMemPos - 4)) == 0x48415350) // PSAH
+ {
+ SAMPLEINDEX iSmpCount = 0;
+ m_nSamples = LittleEndianW(shdr->numSamples);
+ while(iSmpCount < LittleEndianW(shdr->numSamples))
+ {
+ ASSERT_CAN_READ(sizeof(PSM16SMPHEADER));
+ PSM16SMPHEADER *smphdr = (PSM16SMPHEADER *)(lpStream + dwMemPos);
+ dwMemPos += sizeof(PSM16SMPHEADER);
+
+ SAMPLEINDEX iSmp = LittleEndianW(smphdr->sampleNumber);
+ m_nSamples = max(m_nSamples, iSmp);
+
+ memcpy(m_szNames[iSmp], smphdr->name, 24);
+ m_szNames[iSmp][24] = 0;
+ memcpy(Samples[iSmp].filename, smphdr->filename, 13);
+ Samples[iSmp].filename[13] = 0;
+
+ Samples[iSmp].nLength = LittleEndian(smphdr->length);
+ Samples[iSmp].nLoopStart = LittleEndian(smphdr->loopStart);
+ Samples[iSmp].nLoopEnd = LittleEndian(smphdr->loopEnd);
+ Samples[iSmp].nC5Speed = LittleEndianW(smphdr->c2freq);
+ Samples[iSmp].nVolume = smphdr->volume << 2;
+ Samples[iSmp].nGlobalVol = 256;
+
+ UINT iSampleFormat = RS_PCM8S;
+ if(smphdr->flags & 0x04) // 16-Bit
+ {
+ Samples[iSmp].uFlags |= CHN_16BIT;
+ Samples[iSmp].nLength >>= 1;
+ iSampleFormat = RS_PCM16S;
+ }
+ if(smphdr->flags & 0x08) // Signed/Unsigned
+ {
+ if(Samples[iSmp].uFlags & CHN_16BIT)
+ iSampleFormat = RS_PCM16U;
+ else
+ iSampleFormat = RS_PCM8U;
+ }
+ if(smphdr->flags & 0x10) // Delta/Raw
+ {
+ if(Samples[iSmp].uFlags & CHN_16BIT)
+ iSampleFormat = RS_PCM16D;
+ else
+ iSampleFormat = RS_PCM8D;
+ }
+ if(smphdr->flags & 0x20) // Bidi Loop
+ {
+ Samples[iSmp].uFlags |= CHN_PINGPONGLOOP;
+ }
+ if(smphdr->flags & 0x80) // Loop
+ {
+ Samples[iSmp].uFlags |= CHN_LOOP;
+ }
+ if((smphdr->flags & 0x7F) == 0)
+ iSampleFormat = RS_PCM8D;
+
+ ReadSample(&Samples[iSmp], iSampleFormat, reinterpret_cast<LPCSTR>(lpStream + LittleEndianW(smphdr->offset)), dwMemLength - LittleEndianW(smphdr->offset));
+
+ iSmpCount++;
+ }
+ }
+
+ // Read patterns
+ dwMemPos = LittleEndian(shdr->patOffset);
+ ASSERT_CAN_READ(LittleEndian(shdr->patSize));
+ if(LittleEndian(shdr->patOffset) > 4 && LittleEndian(*(DWORD *)(lpStream + dwMemPos - 4)) == 0x54415050) // PPAT
+ {
+ DWORD dwPatEndPos = LittleEndian(shdr->patOffset) + LittleEndian(shdr->patSize);
+
+ for(PATTERNINDEX nPat = 0; nPat < LittleEndianW(shdr->numPatterns); nPat++)
+ {
+ ASSERT_CAN_READ(sizeof(PSM16PATHEADER));
+ PSM16PATHEADER *phdr = (PSM16PATHEADER *)(lpStream + dwMemPos);
+ ASSERT_CAN_READ(LittleEndianW(phdr->size));
+
+ DWORD dwNextPattern = dwMemPos + ((LittleEndianW(phdr->size) + 15) & ~15);
+ dwMemPos += sizeof(PSM16PATHEADER);
+
+ if(Patterns.Insert(nPat, phdr->numRows))
+ {
+ CString s;
+ s.Format(TEXT("Allocating patterns failed starting from pattern %u"), nPat);
+ MessageBox(NULL, s, TEXT("OpenMPT PSM16 import"), MB_ICONERROR);
+ break;
+ }
+
+ MODCOMMAND *row_data;
+ ROWINDEX iRow = 0;
+
+ while(dwMemPos < dwNextPattern && iRow < phdr->numRows)
+ {
+ ASSERT_CAN_READ(1);
+ BYTE bChnFlag = lpStream[dwMemPos++];
+ if(bChnFlag == 0)
+ {
+ iRow++;
+ continue;
+ }
+
+ row_data = Patterns[nPat] + iRow * m_nChannels + min(bChnFlag & 0x1F, m_nChannels - 1);
+
+ if(bChnFlag & 0x80)
+ {
+ // note + instr present
+ ASSERT_CAN_READ(2);
+ row_data->note = lpStream[dwMemPos++] + 37;
+ row_data->instr = lpStream[dwMemPos++];
+ }
+ if(bChnFlag & 0x40)
+ {
+ // volume present
+ ASSERT_CAN_READ(1);
+ row_data->volcmd = VOLCMD_VOLUME;
+ row_data->vol = lpStream[dwMemPos++];
+ }
+ if(bChnFlag & 0x20)
+ {
+ // effect present - convert
+ ASSERT_CAN_READ(2);
+ BYTE command = lpStream[dwMemPos++], param = lpStream[dwMemPos++];
+
+ switch(command)
+ {
+ // Volslides
+ case 0x01: // fine volslide up
+ command = CMD_VOLUMESLIDE;
+ param = (param << 4) | 0x0F;
+ break;
+ case 0x02: // volslide up
+ command = CMD_VOLUMESLIDE;
+ param = (param << 4) & 0xF0;
+ break;
+ case 0x03: // fine voslide down
+ command = CMD_VOLUMESLIDE;
+ param = 0xF0 | param;
+ break;
+ case 0x04: // volslide down
+ command = CMD_VOLUMESLIDE;
+ param = param & 0x0F;
+ break;
+
+ // Portamento
+ case 0x0A: // fine portamento up
+ command = CMD_PORTAMENTOUP;
+ param |= 0xF0;
+ break;
+ case 0x0B: // portamento down
+ command = CMD_PORTAMENTOUP;
+ break;
+ case 0x0C: // fine portamento down
+ command = CMD_PORTAMENTODOWN;
+ param |= 0xF0;
+ break;
+ case 0x0D: // portamento down
+ command = CMD_PORTAMENTODOWN;
+ break;
+ case 0x0E: // tone portamento
+ command = CMD_TONEPORTAMENTO;
+ break;
+ case 0x0F: // glissando control
+ command = CMD_S3MCMDEX;
+ param |= 0x10;
+ break;
+ case 0x10: // tone portamento + volslide up
+ command = CMD_TONEPORTAVOL;
+ param <<= 4;
+ break;
+ case 0x11: // tone portamento + volslide down
+ command = CMD_TONEPORTAVOL;
+ param &= 0x0F;
+ break;
+
+ // Vibrato
+ case 0x14: // vibrato
+ command = CMD_VIBRATO;
+ break;
+ case 0x15: // vibrato waveform
+ command = CMD_S3MCMDEX;
+ param |= 0x30;
+ break;
+ case 0x16: // vibrato + volslide up
+ command = CMD_VIBRATOVOL;
+ param <<= 4;
+ break;
+ case 0x17: // vibrato + volslide down
+ command = CMD_VIBRATOVOL;
+ param &= 0x0F;
+ break;
+
+ // Tremolo
+ case 0x1E: // tremolo
+ command = CMD_TREMOLO;
+ break;
+ case 0x1F: // tremolo waveform
+ command = CMD_S3MCMDEX;
+ param |= 0x40;
+ break;
+
+ // Sample commands
+ case 0x28: // 3-byte offset - we only support the middle byte.
+ ASSERT_CAN_READ(2);
+ command = CMD_OFFSET;
+ param = lpStream[dwMemPos++];
+ dwMemPos++;
+ break;
+ case 0x29: // retrigger
+ command = CMD_RETRIG;
+ param &= 0x0F;
+ break;
+ case 0x2A: // note cut
+ command = CMD_S3MCMDEX;
+ param |= 0xC0;
+ break;
+ case 0x2B: // note delay
+ command = CMD_S3MCMDEX;
+ param |= 0xD0;
+ break;
+
+ // Position change
+ case 0x32: // position jump
+ command = CMD_POSITIONJUMP;
+ break;
+ case 0x33: // pattern break
+ command = CMD_PATTERNBREAK;
+ break;
+ case 0x34: // loop pattern
+ command = CMD_S3MCMDEX;
+ param |= 0xB0;
+ break;
+ case 0x35: // pattern delay
+ command = CMD_S3MCMDEX;
+ param |= 0xE0;
+ break;
+
+ // speed change
+ case 0x3C: // set speed
+ command = CMD_SPEED;
+ break;
+ case 0x3D: // set tempo
+ command = CMD_TEMPO;
+ break;
+
+ // misc commands
+ case 0x46: // arpeggio
+ command = CMD_ARPEGGIO;
+ break;
+ case 0x47: // set finetune
+ command = CMD_S3MCMDEX;
+ param |= 0x20;
+ break;
+ case 0x48: // set balance (panning?)
+ command = CMD_PANNING8;
+ param = (param << 4) + 8;
+ break;
+
+ default:
+ command = CMD_NONE;
+ break;
+ }
+
+ row_data->command = command;
+ row_data->param = param;
+ }
+ }
+ // Pattern break for short patterns (so saving the modules as S3M won't break it)
+ if(phdr->numRows != 64)
+ TryWriteEffect(nPat, phdr->numRows - 1, CMD_PATTERNBREAK, 0, false, CHANNELINDEX_INVALID, false, false);
+
+ dwMemPos = dwNextPattern;
+ if(dwMemPos > dwPatEndPos) break;
+ }
+ }
+
+ return true;
+
+ #undef ASSERT_CAN_READ
+
+}
Modified: trunk/OpenMPT/soundlib/Sndfile.h
===================================================================
--- trunk/OpenMPT/soundlib/Sndfile.h 2009-09-23 15:04:06 UTC (rev 378)
+++ trunk/OpenMPT/soundlib/Sndfile.h 2009-09-24 15:24:32 UTC (rev 379)
@@ -698,6 +698,7 @@
bool ReadAMF(LPCBYTE lpStream, const DWORD dwMemLength);
bool ReadMT2(LPCBYTE lpStream, DWORD dwMemLength);
bool ReadPSM(LPCBYTE lpStream, DWORD dwMemLength);
+ bool ReadPSM16(LPCBYTE lpStream, DWORD dwMemLength);
bool ReadJ2B(LPCBYTE lpStream, DWORD dwMemLength);
bool ReadUMX(LPCBYTE lpStream, DWORD dwMemLength);
bool ReadMO3(LPCBYTE lpStream, const DWORD dwMemLength);
Modified: trunk/OpenMPT/soundlib/mod_specifications.h
===================================================================
--- trunk/OpenMPT/soundlib/mod_specifications.h 2009-09-23 15:04:06 UTC (rev 378)
+++ trunk/OpenMPT/soundlib/mod_specifications.h 2009-09-24 15:24:32 UTC (rev 379)
@@ -286,7 +286,7 @@
true, //Has noteoff.
true, //Has notefade.
240, //Pattern max.
- 256, //Order max.
+ 255, //Order max.
1, //Channel min
127, //Channel max
32, //Min tempo
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sag...@us...> - 2009-09-23 15:04:17
|
Revision: 378
http://modplug.svn.sourceforge.net/modplug/?rev=378&view=rev
Author: saga-games
Date: 2009-09-23 15:04:06 +0000 (Wed, 23 Sep 2009)
Log Message:
-----------
[New] Colour setup: Can now specify the blend colour for prev/next patterns.
Modified Paths:
--------------
trunk/OpenMPT/mptrack/Draw_pat.cpp
trunk/OpenMPT/mptrack/MainFrm.cpp
trunk/OpenMPT/mptrack/Mainfrm.h
trunk/OpenMPT/mptrack/Moptions.cpp
trunk/OpenMPT/mptrack/dlg_misc.cpp
Modified: trunk/OpenMPT/mptrack/Draw_pat.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Draw_pat.cpp 2009-09-23 11:57:10 UTC (rev 377)
+++ trunk/OpenMPT/mptrack/Draw_pat.cpp 2009-09-23 15:04:06 UTC (rev 378)
@@ -131,7 +131,7 @@
b = hilightcolor(GetBValue(CMainFrame::rgbCustomColors[MODCOLOR_BACKHILIGHT]),
GetBValue(CMainFrame::rgbCustomColors[MODCOLOR_BACKNORMAL]));
m_Dib.SetColor(MODCOLOR_2NDHIGHLIGHT, RGB(r,g,b));
- m_Dib.SetBlendColor(GetSysColor(COLOR_BTNFACE));
+ m_Dib.SetBlendColor(CMainFrame::rgbCustomColors[MODCOLOR_BLENDCOLOR]);
}
Modified: trunk/OpenMPT/mptrack/MainFrm.cpp
===================================================================
--- trunk/OpenMPT/mptrack/MainFrm.cpp 2009-09-23 11:57:10 UTC (rev 377)
+++ trunk/OpenMPT/mptrack/MainFrm.cpp 2009-09-23 15:04:06 UTC (rev 378)
@@ -257,6 +257,8 @@
0x00FF00, 0x00FFFF, 0x0000FF,
// Channel separators
GetSysColor(COLOR_BTNSHADOW), GetSysColor(COLOR_BTNFACE), GetSysColor(COLOR_BTNHIGHLIGHT),
+ // Blend colour
+ GetSysColor(COLOR_BTNFACE),
};
// Directory Arrays (Default + Last)
Modified: trunk/OpenMPT/mptrack/Mainfrm.h
===================================================================
--- trunk/OpenMPT/mptrack/Mainfrm.h 2009-09-23 11:57:10 UTC (rev 377)
+++ trunk/OpenMPT/mptrack/Mainfrm.h 2009-09-23 15:04:06 UTC (rev 378)
@@ -160,6 +160,7 @@
MODCOLOR_SEPSHADOW,
MODCOLOR_SEPFACE,
MODCOLOR_SEPHILITE,
+ MODCOLOR_BLENDCOLOR,
MAX_MODCOLORS,
// Internal color codes
MODCOLOR_2NDHIGHLIGHT,
Modified: trunk/OpenMPT/mptrack/Moptions.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Moptions.cpp 2009-09-23 11:57:10 UTC (rev 377)
+++ trunk/OpenMPT/mptrack/Moptions.cpp 2009-09-23 15:04:06 UTC (rev 378)
@@ -106,6 +106,7 @@
{"Note Highlight", 0, MODCOLOR_NOTE, MODCOLOR_INSTRUMENT, MODCOLOR_VOLUME, "Note:", "Instrument:", "Volume:"},
{"Effect Highlight",0, MODCOLOR_PANNING, MODCOLOR_PITCH, MODCOLOR_GLOBALS, "Panning Effects:", "Pitch Effects:", "Global Effects:"},
{"Channel Separator",0, MODCOLOR_SEPSHADOW, MODCOLOR_SEPFACE, MODCOLOR_SEPHILITE, "Shadow:", "Face:", "Highlight:"},
+ {"Next/Prev Pattern",0, MODCOLOR_BLENDCOLOR, 0, 0, "Blend color:", NULL, NULL},
{"Sample Editor", 1, MODCOLOR_SAMPLE, 0, 0, "Sample Data:", NULL, NULL},
{"Instrument Editor",2, MODCOLOR_ENVELOPES, 0, 0, "Envelopes:", NULL, NULL},
{"VU-Meters", 0, MODCOLOR_VUMETER_HI, MODCOLOR_VUMETER_MED, MODCOLOR_VUMETER_LO, "Hi:", "Med:", "Lo:"}
@@ -487,6 +488,7 @@
CustomColors[MODCOLOR_SEPSHADOW] = GetSysColor(COLOR_BTNSHADOW);
CustomColors[MODCOLOR_SEPFACE] = GetSysColor(COLOR_BTNFACE);
CustomColors[MODCOLOR_SEPHILITE] = GetSysColor(COLOR_BTNHIGHLIGHT);
+ CustomColors[MODCOLOR_BLENDCOLOR] = GetSysColor(COLOR_BTNFACE);
OnPreviewChanged();
}
@@ -514,6 +516,7 @@
CustomColors[MODCOLOR_SEPSHADOW] = RGB(0x18, 0x28, 0x2C);
CustomColors[MODCOLOR_SEPFACE] = RGB(0x49, 0x75, 0x82);
CustomColors[MODCOLOR_SEPHILITE] = RGB(0x8A, 0xDB, 0xF3);
+ CustomColors[MODCOLOR_BLENDCOLOR] = RGB(0x27, 0x41, 0x47);
OnPreviewChanged();
}
@@ -541,6 +544,7 @@
CustomColors[MODCOLOR_SEPSHADOW] = RGB(0xB6, 0x96, 0x79);
CustomColors[MODCOLOR_SEPFACE] = RGB(0xB6, 0x96, 0x79);
CustomColors[MODCOLOR_SEPHILITE] = RGB(0xB6, 0x96, 0x79);
+ CustomColors[MODCOLOR_BLENDCOLOR] = RGB(0x35, 0x27, 0x24);
OnPreviewChanged();
}
@@ -568,6 +572,7 @@
CustomColors[MODCOLOR_SEPSHADOW] = RGB(0x80, 0x80, 0x80);
CustomColors[MODCOLOR_SEPFACE] = RGB(0xD4, 0xD0, 0xC8);
CustomColors[MODCOLOR_SEPHILITE] = RGB(0xFF, 0xFF, 0xFF);
+ CustomColors[MODCOLOR_BLENDCOLOR] = 0x00d0dbe1;
OnPreviewChanged();
}
Modified: trunk/OpenMPT/mptrack/dlg_misc.cpp
===================================================================
--- trunk/OpenMPT/mptrack/dlg_misc.cpp 2009-09-23 11:57:10 UTC (rev 377)
+++ trunk/OpenMPT/mptrack/dlg_misc.cpp 2009-09-23 15:04:06 UTC (rev 378)
@@ -2193,7 +2193,7 @@
m_CbnMacroCC.ShowWindow(TRUE);
m_CbnMacroPlug.ShowWindow(FALSE);
m_CbnMacroPlug.ShowWindow(FALSE);
- SetDlgItemText(IDC_GENMACROLABEL, "Midi CC");
+ SetDlgItemText(IDC_GENMACROLABEL, "MIDI CC");
m_CbnMacroCC.SetCurSel(m_pModDoc->MacroToMidiCC(&(m_MidiCfg.szMidiSFXExt[sfx*32])));
} else {
m_CbnMacroCC.EnableWindow(FALSE);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sag...@us...> - 2009-09-23 11:57:27
|
Revision: 377
http://modplug.svn.sourceforge.net/modplug/?rev=377&view=rev
Author: saga-games
Date: 2009-09-23 11:57:10 +0000 (Wed, 23 Sep 2009)
Log Message:
-----------
[New] Pattern Editor: Sticky channels that always remain on the left side of the pattern editor. Still very buggy and a lot has to be done. Help is appreciated.
Modified Paths:
--------------
branches/devBranch_1_17_04/mptrack/Draw_pat.cpp
branches/devBranch_1_17_04/mptrack/View_pat.cpp
branches/devBranch_1_17_04/mptrack/View_pat.h
branches/devBranch_1_17_04/mptrack/resource.h
branches/devBranch_1_17_04/soundlib/Sndfile.cpp
branches/devBranch_1_17_04/soundlib/Sndfile.h
Modified: branches/devBranch_1_17_04/mptrack/Draw_pat.cpp
===================================================================
--- branches/devBranch_1_17_04/mptrack/Draw_pat.cpp 2009-09-23 11:51:18 UTC (rev 376)
+++ branches/devBranch_1_17_04/mptrack/Draw_pat.cpp 2009-09-23 11:57:10 UTC (rev 377)
@@ -446,16 +446,24 @@
HDC hdc;
UINT xofs, yofs, nColumnWidth, ncols, nrows, ncolhdr;
int xpaint, ypaint, mixPlug;
+ static CHANNELINDEX nOldChannels;
+ if ((pModDoc = GetDocument()) == nullptr) return;
+ pSndFile = pModDoc->GetSoundFile();
+ if(pSndFile != nullptr && nOldChannels != pSndFile->m_nChannels)
+ {
+ // number of channels changed -> recalc
+ ResetStickyChannels();
+ nOldChannels = pSndFile->m_nChannels;
+ }
+
ASSERT(pDC);
UpdateSizes();
- if ((pModDoc = GetDocument()) == NULL) return;
GetClientRect(&rcClient);
hdc = pDC->m_hDC;
oldpen = ::SelectObject(hdc, CMainFrame::penDarkGray);
xofs = GetXScrollPos();
yofs = GetYScrollPos();
- pSndFile = pModDoc->GetSoundFile();
nColumnWidth = m_szCell.cx;
nrows = (pSndFile->Patterns[m_nPattern]) ? pSndFile->PatternSize[m_nPattern] : 0;
ncols = pSndFile->GetNumChannels();
@@ -475,16 +483,22 @@
rect.SetRect(xpaint, ypaint, xpaint+nColumnWidth, ypaint + m_szHeader.cy);
if (ncolhdr < ncols)
{
+ CHANNELINDEX nRealChannel;
+ if(ncolhdr - xofs < m_nStickyChannelCount) // sticky channel
+ nRealChannel = m_nChannelOrder[ncolhdr - xofs];
+ else
+ nRealChannel = m_nChannelOrder[ncolhdr]; // normal channel
+ ASSERT(nRealChannel < MAX_BASECHANNELS);
// -> CODE#0012
// -> DESC="midi keyboard split"
- const char *pszfmt = pSndFile->m_bChannelMuteTogglePending[ncolhdr]? "[Channel %d]" : "Channel %d";
+ const char *pszfmt = pSndFile->m_bChannelMuteTogglePending[nRealChannel]? "[Channel %d]" : "Channel %d";
// const char *pszfmt = pModDoc->IsChannelRecord(ncolhdr) ? "Channel %d " : "Channel %d";
// -! NEW_FEATURE#0012
- if ((pSndFile->m_nType & (MOD_TYPE_XM|MOD_TYPE_IT|MOD_TYPE_MPT)) && ((BYTE)pSndFile->ChnSettings[ncolhdr].szName[0] >= 0x20))
- pszfmt = pSndFile->m_bChannelMuteTogglePending[ncolhdr]?"%d: [%s]":"%d: %s";
- else if (m_nDetailLevel < 2) pszfmt = pSndFile->m_bChannelMuteTogglePending[ncolhdr]?"[Ch%d]":"Ch%d";
- else if (m_nDetailLevel < 3) pszfmt = pSndFile->m_bChannelMuteTogglePending[ncolhdr]?"[Chn %d]":"Chn %d";
- wsprintf(s, pszfmt, ncolhdr+1, pSndFile->ChnSettings[ncolhdr].szName);
+ if ((pSndFile->m_nType & (MOD_TYPE_XM|MOD_TYPE_IT|MOD_TYPE_MPT)) && ((BYTE)pSndFile->ChnSettings[nRealChannel].szName[0] >= 0x20))
+ pszfmt = pSndFile->m_bChannelMuteTogglePending[nRealChannel]?"%d: [%s]":"%d: %s";
+ else if (m_nDetailLevel < 2) pszfmt = pSndFile->m_bChannelMuteTogglePending[nRealChannel]?"[Ch%d]":"Ch%d";
+ else if (m_nDetailLevel < 3) pszfmt = pSndFile->m_bChannelMuteTogglePending[nRealChannel]?"[Chn %d]":"Chn %d";
+ wsprintf(s, pszfmt, nRealChannel + 1, pSndFile->ChnSettings[nRealChannel].szName);
// -> CODE#0012
// -> DESC="midi keyboard split"
// DrawButtonRect(hdc, &rect, s,
@@ -492,15 +506,15 @@
// ((m_bInItemRect) && ((m_nDragItem & DRAGITEM_MASK) == DRAGITEM_CHNHEADER) && ((m_nDragItem & 0xFFFF) == ncolhdr)) ? TRUE : FALSE, DT_CENTER);
// rect.bottom = rect.top + COLHDR_HEIGHT;
DrawButtonRect(hdc, &rect, s,
- (pSndFile->ChnSettings[ncolhdr].dwFlags & CHN_MUTE) ? TRUE : FALSE,
- ((m_bInItemRect) && ((m_nDragItem & DRAGITEM_MASK) == DRAGITEM_CHNHEADER) && ((m_nDragItem & 0xFFFF) == ncolhdr)) ? TRUE : FALSE,
- pModDoc->IsChannelRecord(ncolhdr) ? DT_RIGHT : DT_CENTER);
+ (pSndFile->ChnSettings[nRealChannel].dwFlags & CHN_MUTE) ? TRUE : FALSE,
+ ((m_bInItemRect) && ((m_nDragItem & DRAGITEM_MASK) == DRAGITEM_CHNHEADER) && ((m_nDragItem & 0xFFFF) == nRealChannel)) ? TRUE : FALSE,
+ pModDoc->IsChannelRecord(nRealChannel) ? DT_RIGHT : DT_CENTER);
rect.bottom = rect.top + COLHDR_HEIGHT;
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(nRealChannel))
{
// rect.DeflateRect(1, 1);
// InvertRect(hdc, &rect);
@@ -512,7 +526,7 @@
DrawButtonRect(hdc, &insRect, s, FALSE, FALSE, DT_CENTER);
FrameRect(hdc,&insRect,CMainFrame::brushBlack);
}
- else if (pModDoc->IsChannelRecord2(ncolhdr))
+ else if (pModDoc->IsChannelRecord2(nRealChannel))
{
FrameRect(hdc,&rect,CMainFrame::brushGray);
InvertRect(hdc, &rect);
@@ -525,8 +539,8 @@
if (m_dwStatus & PATSTATUS_VUMETERS)
{
- OldVUMeters[ncolhdr] = 0;
- DrawChannelVUMeter(hdc, rect.left + 1, rect.bottom, ncolhdr);
+ OldVUMeters[nRealChannel] = 0;
+ DrawChannelVUMeter(hdc, rect.left + 1, rect.bottom, nRealChannel);
rect.top+=VUMETERS_HEIGHT;
rect.bottom+=VUMETERS_HEIGHT;
}
@@ -534,14 +548,14 @@
{
rect.top+=PLUGNAME_HEIGHT;
rect.bottom+=PLUGNAME_HEIGHT;
- mixPlug=pSndFile->ChnSettings[ncolhdr].nMixPlugin;
+ mixPlug=pSndFile->ChnSettings[nRealChannel].nMixPlugin;
if (mixPlug) {
wsprintf(s, "%d: %s", mixPlug, (pSndFile->m_MixPlugins[mixPlug-1]).pMixPlugin?(pSndFile->m_MixPlugins[mixPlug-1]).Info.szName:"[empty]");
} else {
wsprintf(s, "---");
}
DrawButtonRect(hdc, &rect, s, FALSE,
- ((m_bInItemRect) && ((m_nDragItem & DRAGITEM_MASK) == DRAGITEM_PLUGNAME) && ((m_nDragItem & 0xFFFF) == ncolhdr)) ? TRUE : FALSE, DT_CENTER);
+ ((m_bInItemRect) && ((m_nDragItem & DRAGITEM_MASK) == DRAGITEM_PLUGNAME) && ((m_nDragItem & 0xFFFF) == nRealChannel)) ? TRUE : FALSE, DT_CENTER);
}
} else break;
ncolhdr++;
@@ -797,7 +811,13 @@
MODCOMMAND *m;
int x, bk_col, tx_col, col_sel, fx_col;
- m = (pPattern) ? &pPattern[row*ncols+col] : &m0;
+ CHANNELINDEX nRealChannel;
+ if(col - xofs < m_nStickyChannelCount) // sticky channel
+ nRealChannel = m_nChannelOrder[col - xofs];
+ else // normal channel
+ nRealChannel = m_nChannelOrder[col];
+
+ m = (pPattern) ? &pPattern[row*ncols+nRealChannel] : &m0;
dwSpeedUpMask = 0;
if ((bSpeedUp) && (bColSel[col] & 0x40) && (pPattern) && (row))
{
Modified: branches/devBranch_1_17_04/mptrack/View_pat.cpp
===================================================================
--- branches/devBranch_1_17_04/mptrack/View_pat.cpp 2009-09-23 11:51:18 UTC (rev 376)
+++ branches/devBranch_1_17_04/mptrack/View_pat.cpp 2009-09-23 11:57:10 UTC (rev 377)
@@ -66,6 +66,7 @@
ON_COMMAND(ID_EDIT_SPLITRECSELECT, OnSplitRecordSelect)
// -! NEW_FEATURE#0012
ON_COMMAND(ID_EDIT_UNDO, OnEditUndo)
+ ON_COMMAND(ID_PATTERN_CHNTOGGLESTICKY, OnChannelTogglySticky)
ON_COMMAND(ID_PATTERN_CHNRESET, OnChannelReset)
ON_COMMAND(ID_PATTERN_MUTE, OnMuteFromClick) //rewbs.customKeys
ON_COMMAND(ID_PATTERN_SOLO, OnSoloFromClick) //rewbs.customKeys
@@ -133,6 +134,7 @@
m_nDetailLevel = 4;
m_pEditWnd = NULL;
m_pGotoWnd = NULL;
+ memset(m_nChannelOrder, 0, sizeof(m_nChannelOrder));
m_Dib.Init(CMainFrame::bmpNotes);
UpdateColors();
}
@@ -147,6 +149,7 @@
// -> DESC="midi keyboard split"
memset(splitActiveNoteChannel, 0xFF, sizeof(splitActiveNoteChannel));
memset(activeNoteChannel, 0xFF, sizeof(activeNoteChannel));
+ ResetStickyChannels();
oldrow = -1;
oldchn = -1;
oldsplitchn = -1;
@@ -1405,6 +1408,17 @@
}
}
+void CViewPattern::OnChannelTogglySticky()
+//---------------------------------------
+{
+ // Toggle "sticky" state (channel will always be visible)
+ const CHANNELINDEX nChn = GetChanFromCursor(m_nMenuParam);
+ CSoundFile* pSndFile;
+ if(GetDocument() == nullptr || (pSndFile = GetDocument()->GetSoundFile()) == nullptr) return;
+ pSndFile->ChnSettings[nChn].bIsSticky = !pSndFile->ChnSettings[nChn].bIsSticky;
+ ResetStickyChannels();
+}
+
void CViewPattern::OnChannelReset()
//---------------------------------
{
@@ -3006,8 +3020,8 @@
}
-ModCommandPos CViewPattern::GetEditPos(CSoundFile& rSf, const bool bLiveRecord) const
-//-----------------------------------------------------------------------------------
+ModCommandPos CViewPattern::GetEditPos(CSoundFile& rSf, const bool bLiveRecord)
+//-----------------------------------------------------------------------------
{
ModCommandPos editpos;
if(bLiveRecord)
@@ -4658,6 +4672,8 @@
AppendMenu(hMenu, MF_STRING, ID_PATTERN_CHNRESET, "Reset Channel\t" + ih->GetKeyTextFromCommand(kcChannelReset));
+ AppendMenu(hMenu, MF_STRING | (pSndFile->ChnSettings[nChn].bIsSticky ? MF_CHECKED : 0), ID_PATTERN_CHNTOGGLESTICKY, "Sticky Channel");
+
return true;
}
@@ -4984,7 +5000,7 @@
ROWINDEX CViewPattern::GetRowFromCursor(DWORD cursor) {return cursor >> 16;}
//---------------------------------------------------
-CHANNELINDEX CViewPattern::GetChanFromCursor(DWORD cursor) {return static_cast<CHANNELINDEX>((cursor & 0xFFFF) >> 3);}
+CHANNELINDEX CViewPattern::GetChanFromCursor(DWORD cursor) {return m_nChannelOrder[(cursor & 0xFFFF) >> 3];}
//-------------------------------------------------------
UINT CViewPattern::GetColTypeFromCursor(DWORD cursor) {return cursor & 0x07;}
@@ -5141,3 +5157,33 @@
iRow = m_nRow;
}
}
+
+void CViewPattern::ResetStickyChannels()
+//--------------------------------------
+{
+ // precalc sticky channels, i.e. channels that are always visible
+ CSoundFile *pSndFile;
+ if(GetDocument() == nullptr || (pSndFile = GetDocument()->GetSoundFile()) == nullptr) return;
+
+ CHANNELINDEX iChn = 0;
+ for(CHANNELINDEX i = 0; i < pSndFile->m_nChannels; i++)
+ {
+ if(pSndFile->ChnSettings[i].bIsSticky == true)
+ {
+ m_nChannelOrder[iChn] = i;
+ iChn++;
+ }
+ }
+ m_nStickyChannelCount = iChn;
+ for(CHANNELINDEX i = 0; i < pSndFile->m_nChannels; i++)
+ {
+ if(pSndFile->ChnSettings[i].bIsSticky == false)
+ {
+ m_nChannelOrder[iChn] = i;
+ iChn++;
+ }
+ }
+ ASSERT(iChn == pSndFile->m_nChannels);
+ InvalidateChannelsHeaders();
+ InvalidatePattern();
+}
\ No newline at end of file
Modified: branches/devBranch_1_17_04/mptrack/View_pat.h
===================================================================
--- branches/devBranch_1_17_04/mptrack/View_pat.h 2009-09-23 11:51:18 UTC (rev 376)
+++ branches/devBranch_1_17_04/mptrack/View_pat.h 2009-09-23 11:57:10 UTC (rev 377)
@@ -110,6 +110,9 @@
int oldrow,oldchn,oldsplitchn;
// -! NEW_FEATURE#0012
+ CHANNELINDEX m_nChannelOrder[MAX_BASECHANNELS]; // for sticky channels
+ CHANNELINDEX m_nStickyChannelCount;
+
// -> CODE#0018
// -> DESC="route PC keyboard inputs to midi in mechanism"
int ignorekey;
@@ -240,6 +243,7 @@
afx_msg void OnEditGoto();
afx_msg void OnEditFindNext();
afx_msg void OnEditUndo();
+ afx_msg void OnChannelTogglySticky();
afx_msg void OnChannelReset();
afx_msg void OnMuteFromClick(); //rewbs.customKeys
afx_msg void OnSoloFromClick(); //rewbs.customKeys
@@ -331,9 +335,9 @@
UINT GetSelectionEndChan();
UINT ListChansWhereColSelected(UINT colType, CArray<UINT,UINT> &chans);
- static ROWINDEX GetRowFromCursor(DWORD cursor);
- static CHANNELINDEX GetChanFromCursor(DWORD cursor);
- static UINT GetColTypeFromCursor(DWORD cursor);
+ ROWINDEX GetRowFromCursor(DWORD cursor);
+ CHANNELINDEX GetChanFromCursor(DWORD cursor);
+ UINT GetColTypeFromCursor(DWORD cursor);
bool IsInterpolationPossible(UINT startRow, UINT endRow, UINT chan, UINT colType, CSoundFile* pSndFile);
void Interpolate(UINT type);
@@ -350,7 +354,7 @@
const ROWINDEX iRowCandidate, const PATTERNINDEX iPatCandidate) const;
// Returns edit position.
- ModCommandPos GetEditPos(CSoundFile& rSf, const bool bLiveRecord) const;
+ ModCommandPos GetEditPos(CSoundFile& rSf, const bool bLiveRecord);
// Returns pointer to modcommand at given position. If the position is not valid, returns pointer
// to a dummy command.
@@ -360,6 +364,8 @@
//Like IsEditingEnabled(), but shows some notification when editing is not enabled.
bool IsEditingEnabled_bmsg();
+
+ void ResetStickyChannels();
public:
Modified: branches/devBranch_1_17_04/mptrack/resource.h
===================================================================
--- branches/devBranch_1_17_04/mptrack/resource.h 2009-09-23 11:51:18 UTC (rev 376)
+++ branches/devBranch_1_17_04/mptrack/resource.h 2009-09-23 11:57:10 UTC (rev 377)
@@ -1124,6 +1124,7 @@
#define ID_NOTEMAP_COPY_NOTE 59227
#define ID_CLEANUP_REARRANGESAMPLES 59228
#define ID_ORDERLIST_RENDER 59229
+#define ID_PATTERN_CHNTOGGLESTICKY 59230
// Next default values for new objects
//
@@ -1131,7 +1132,7 @@
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_3D_CONTROLS 1
#define _APS_NEXT_RESOURCE_VALUE 521
-#define _APS_NEXT_COMMAND_VALUE 59230
+#define _APS_NEXT_COMMAND_VALUE 59231
#define _APS_NEXT_CONTROL_VALUE 2391
#define _APS_NEXT_SYMED_VALUE 901
#endif
Modified: branches/devBranch_1_17_04/soundlib/Sndfile.cpp
===================================================================
--- branches/devBranch_1_17_04/soundlib/Sndfile.cpp 2009-09-23 11:51:18 UTC (rev 376)
+++ branches/devBranch_1_17_04/soundlib/Sndfile.cpp 2009-09-23 11:57:10 UTC (rev 377)
@@ -1418,7 +1418,7 @@
}
-bool CSoundFile::InitChannel(UINT nch)
+bool CSoundFile::InitChannel(CHANNELINDEX nch)
//-------------------------------------
{
if(nch >= MAX_BASECHANNELS) return true;
@@ -1427,6 +1427,7 @@
ChnSettings[nch].nVolume = 64;
ChnSettings[nch].dwFlags = 0;
ChnSettings[nch].nMixPlugin = 0;
+ ChnSettings[nch].bIsSticky = false;
ChnSettings[nch].szName[0] = 0;
ResetChannelState(nch, CHNRESET_TOTAL);
@@ -1608,8 +1609,8 @@
return static_cast<CHANNELINDEX>(m_nChannels);
}
-bool CSoundFile::MoveChannel(UINT chnFrom, UINT chnTo)
-//-----------------------------------------------------
+bool CSoundFile::MoveChannel(CHANNELINDEX chnFrom, CHANNELINDEX chnTo)
+//--------------------------------------------------------------------
{
//Implementation of move channel using ReArrangeChannels(...). So this function
//only creates correct newOrder-vector used in the ReArrangeChannels(...).
@@ -1630,7 +1631,7 @@
if(chnFrom < chnTo)
{
CHANNELINDEX temp = newOrder[chnFrom];
- for(UINT i = chnFrom; i<chnTo; i++)
+ for(CHANNELINDEX i = chnFrom; i<chnTo; i++)
{
newOrder[i] = newOrder[i+1];
}
@@ -1639,7 +1640,7 @@
else //case chnFrom > chnTo(can't be equal, since it has been examined earlier.)
{
CHANNELINDEX temp = newOrder[chnFrom];
- for(UINT i = chnFrom; i>=chnTo+1; i--)
+ for(CHANNELINDEX i = chnFrom; i>=chnTo+1; i--)
{
newOrder[i] = newOrder[i-1];
}
Modified: branches/devBranch_1_17_04/soundlib/Sndfile.h
===================================================================
--- branches/devBranch_1_17_04/soundlib/Sndfile.h 2009-09-23 11:51:18 UTC (rev 376)
+++ branches/devBranch_1_17_04/soundlib/Sndfile.h 2009-09-23 11:57:10 UTC (rev 377)
@@ -259,10 +259,11 @@
struct MODCHANNELSETTINGS
{
- UINT nPan;
- UINT nVolume;
- DWORD dwFlags;
+ UINT nPan; // 0...256
+ UINT nVolume; // 0...64
+ DWORD dwFlags; // Suround/Mute
UINT nMixPlugin;
+ bool bIsSticky; // Channel will always be visible in the pattern editor
CHAR szName[MAX_CHANNELNAME];
};
@@ -668,9 +669,9 @@
BOOL SetPatternName(UINT nPat, LPCSTR lpszName);
BOOL GetPatternName(UINT nPat, LPSTR lpszName, UINT cbSize=MAX_PATTERNNAME) const;
CHANNELINDEX ReArrangeChannels(const vector<CHANNELINDEX>& fromToArray);
- bool MoveChannel(UINT chn_from, UINT chn_to);
+ bool MoveChannel(CHANNELINDEX chnFrom, CHANNELINDEX chnTo);
- bool InitChannel(UINT nch);
+ bool InitChannel(CHANNELINDEX nch);
void ResetChannelState(CHANNELINDEX chn, BYTE resetStyle);
// Module Loaders
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|