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...> - 2011-02-16 13:26:33
|
Revision: 801
http://modplug.svn.sourceforge.net/modplug/?rev=801&view=rev
Author: saga-games
Date: 2011-02-16 13:26:26 +0000 (Wed, 16 Feb 2011)
Log Message:
-----------
[Fix] AMF / MED Loaders: Ignore short loops (http://bugs.openmpt.org/view.php?id=70) - probably caused by bad MOD conversions, at least in the AMF example?
Modified Paths:
--------------
trunk/OpenMPT/soundlib/LOAD_AMF.CPP
trunk/OpenMPT/soundlib/Load_med.cpp
Modified: trunk/OpenMPT/soundlib/LOAD_AMF.CPP
===================================================================
--- trunk/OpenMPT/soundlib/LOAD_AMF.CPP 2011-02-14 18:35:31 UTC (rev 800)
+++ trunk/OpenMPT/soundlib/LOAD_AMF.CPP 2011-02-16 13:26:26 UTC (rev 801)
@@ -210,6 +210,7 @@
psmp->nLength = LittleEndian(*((LPDWORD)(lpStream+dwMemPos+25)));
psmp->nLoopStart = LittleEndian(*((LPDWORD)(lpStream+dwMemPos+29)));
psmp->nLoopEnd = psmp->nLoopStart + LittleEndian(*((LPDWORD)(lpStream+dwMemPos+33)));
+ if (psmp->nLoopEnd <= 2) psmp->nLoopEnd = 0;
if ((psmp->nLoopEnd > psmp->nLoopStart) && (psmp->nLoopEnd <= psmp->nLength))
{
psmp->uFlags = CHN_LOOP;
Modified: trunk/OpenMPT/soundlib/Load_med.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Load_med.cpp 2011-02-14 18:35:31 UTC (rev 800)
+++ trunk/OpenMPT/soundlib/Load_med.cpp 2011-02-16 13:26:26 UTC (rev 801)
@@ -621,6 +621,7 @@
if (pSmp->nVolume > 256) pSmp->nVolume = 256;
pSmp->RelativeTone = -12 * pmsh->sample[iSHdr].strans;
pSmp->nPan = 128;
+ if (pSmp->nLoopEnd <= 2) pSmp->nLoopEnd = 0;
if (pSmp->nLoopEnd) pSmp->uFlags |= CHN_LOOP;
}
// Common Flags
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sag...@us...> - 2011-02-14 18:35:38
|
Revision: 800
http://modplug.svn.sourceforge.net/modplug/?rev=800&view=rev
Author: saga-games
Date: 2011-02-14 18:35:31 +0000 (Mon, 14 Feb 2011)
Log Message:
-----------
[Fix] Wave Export: Rendering an order selection was a bit broken since rev. 797
[Imp] Changes to song end detection in "loop once" mode.
[Mod] OpenMPT: Version is now 1.19.00.24
Modified Paths:
--------------
trunk/OpenMPT/mptrack/Mod2wave.cpp
trunk/OpenMPT/mptrack/Moddoc.cpp
trunk/OpenMPT/mptrack/version.h
trunk/OpenMPT/soundlib/Sndmix.cpp
Modified: trunk/OpenMPT/mptrack/Mod2wave.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Mod2wave.cpp 2011-02-14 18:33:16 UTC (rev 799)
+++ trunk/OpenMPT/mptrack/Mod2wave.cpp 2011-02-14 18:35:31 UTC (rev 800)
@@ -690,7 +690,6 @@
DWORD dwOrds = m_pSndFile->Order.GetLengthFirstEmpty();
if ((m_nMaxPatterns < dwOrds) && (dwOrds > 0)) l = (l*m_nMaxPatterns) / dwOrds;
}
- m_pSndFile->InitializeVisitedRows(true);
if (l < max) max = l;
Modified: trunk/OpenMPT/mptrack/Moddoc.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Moddoc.cpp 2011-02-14 18:33:16 UTC (rev 799)
+++ trunk/OpenMPT/mptrack/Moddoc.cpp 2011-02-14 18:35:31 UTC (rev 800)
@@ -1609,12 +1609,13 @@
}
// Render song (or current channel, or current sample/instrument)
+ m_SndFile.InitializeVisitedRows(true);
m_SndFile.SetCurrentPos(0);
m_SndFile.m_dwSongFlags &= ~SONG_PATTERNLOOP;
if (wsdlg.m_bSelectPlay)
{
m_SndFile.SetCurrentOrder(wsdlg.m_nMinOrder);
- m_SndFile.GetLength(true, wsdlg.m_nMinOrder, 0);
+ m_SndFile.GetLength(true, wsdlg.m_nMinOrder, 0); // adjust playback variables / visited rows vector
m_SndFile.m_nCurrentPattern = wsdlg.m_nMinOrder;
m_SndFile.m_nMaxOrderPosition = wsdlg.m_nMaxOrder + 1;
}
@@ -2393,7 +2394,7 @@
}
UINT CModDoc::GetEffectMaskFromIndex(UINT ndx)
-//-------------------------------------------------------
+//--------------------------------------------
{
if (ndx >= MAX_FXINFO) {
return 0;
Modified: trunk/OpenMPT/mptrack/version.h
===================================================================
--- trunk/OpenMPT/mptrack/version.h 2011-02-14 18:33:16 UTC (rev 799)
+++ trunk/OpenMPT/mptrack/version.h 2011-02-14 18:35:31 UTC (rev 800)
@@ -15,7 +15,7 @@
#define VER_MAJORMAJOR 1
#define VER_MAJOR 19
#define VER_MINOR 00
-#define VER_MINORMINOR 23
+#define VER_MINORMINOR 24
//Creates version number from version parts that appears in version string.
//For example MAKE_VERSION_NUMERIC(1,17,02,28) gives version number of
Modified: trunk/OpenMPT/soundlib/Sndmix.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Sndmix.cpp 2011-02-14 18:33:16 UTC (rev 799)
+++ trunk/OpenMPT/soundlib/Sndmix.cpp 2011-02-14 18:35:31 UTC (rev 800)
@@ -773,7 +773,6 @@
const bool overrideLoopCheck = (m_nRepeatCount != -1) && (m_dwSongFlags & SONG_PATTERNLOOP);
if(!overrideLoopCheck && IsRowVisited(m_nCurrentPattern, m_nRow, true))
{
- InitializeVisitedRows(true);
if(m_nRepeatCount)
{
// repeat count == -1 means repeat infinitely.
@@ -781,7 +780,8 @@
{
m_nRepeatCount--;
}
- // We shouldn't forget that we actually just visited this row (InitializeVisitedRows cleared it).
+ // Forget all but the current row.
+ InitializeVisitedRows(true);
SetRowVisited(m_nCurrentPattern, m_nRow);
} else
{
@@ -793,7 +793,12 @@
#endif // MODPLUG_TRACKER
{
// This is really the song's end!
+ InitializeVisitedRows(true);
return FALSE;
+ } else
+ {
+ // Ok, this is really dirty, but we have to update the visited rows vector...
+ GetLength(true, m_nCurrentPattern, m_nRow);
}
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sag...@us...> - 2011-02-14 18:33:23
|
Revision: 799
http://modplug.svn.sourceforge.net/modplug/?rev=799&view=rev
Author: saga-games
Date: 2011-02-14 18:33:16 +0000 (Mon, 14 Feb 2011)
Log Message:
-----------
[Mod] Pattern Editor: When removing a channel (via context menu) that contains no data in any pattern, no warning is shown anymore.
[Ref] Added IsChannelUnued() to CModDoc, refactored CheckUnusedChannels().
Modified Paths:
--------------
trunk/OpenMPT/mptrack/Moddoc.h
trunk/OpenMPT/mptrack/Modedit.cpp
trunk/OpenMPT/mptrack/View_pat.cpp
Modified: trunk/OpenMPT/mptrack/Moddoc.h
===================================================================
--- trunk/OpenMPT/mptrack/Moddoc.h 2011-02-12 20:40:27 UTC (rev 798)
+++ trunk/OpenMPT/mptrack/Moddoc.h 2011-02-14 18:33:16 UTC (rev 799)
@@ -340,6 +340,9 @@
// [in] bIncludeIndex: True to include instrument index in front of the instrument name, false otherwise.
CString GetPatternViewInstrumentName(UINT nInstr, bool bEmptyInsteadOfNoName = false, bool bIncludeIndex = true) const;
+ // Check if a given channel contains data.
+ bool IsChannelUnused(CHANNELINDEX nChn) const;
+
// protected members
protected:
CSize m_szOldPatternScrollbarsPos;
@@ -347,7 +350,7 @@
BOOL InitializeMod();
void* GetChildFrame(); //rewbs.customKeys
- void CheckUnusedChannels(bool mask[MAX_BASECHANNELS], CHANNELINDEX maxRemoveCount = MAX_BASECHANNELS);
+ void CheckUnusedChannels(bool mask[MAX_BASECHANNELS], CHANNELINDEX maxRemoveCount = MAX_BASECHANNELS) const;
// Overrides
// ClassWizard generated virtual function overrides
Modified: trunk/OpenMPT/mptrack/Modedit.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Modedit.cpp 2011-02-12 20:40:27 UTC (rev 798)
+++ trunk/OpenMPT/mptrack/Modedit.cpp 2011-02-14 18:33:16 UTC (rev 799)
@@ -197,7 +197,7 @@
{
MODCOMMAND::INSTR instr = m.instr, newinstr = 0;
MODCOMMAND::NOTE note = m.note, newnote = note;
- if((note) && (note <= NOTE_MAX))
+ if((note >= NOTE_MIN) && (note <= NOTE_MAX))
note--;
else
note = NOTE_MIDDLEC - 1;
@@ -1231,33 +1231,48 @@
}
-void CModDoc::CheckUnusedChannels(bool mask[MAX_BASECHANNELS], CHANNELINDEX maxRemoveCount)
-//-------------------------------------------------------------------------------------
+// Check which channels contain note data. maxRemoveCount specified how many empty channels are reported at max.
+void CModDoc::CheckUnusedChannels(bool mask[MAX_BASECHANNELS], CHANNELINDEX maxRemoveCount) const
+//-----------------------------------------------------------------------------------------------
{
// Checking for unused channels
const int nChannels = m_SndFile.GetNumChannels();
for(int iRst = nChannels - 1; iRst >= 0; iRst--)
{
- mask[iRst] = true;
- for (PATTERNINDEX ipat = 0; ipat < m_SndFile.Patterns.Size(); ipat++) if (m_SndFile.Patterns.IsValidPat(ipat))
+ mask[iRst] = IsChannelUnused(iRst);
+ if(mask[iRst])
{
- MODCOMMAND *p = m_SndFile.Patterns[ipat] + iRst;
- UINT len = m_SndFile.Patterns[ipat].GetNumRows();
- for (UINT idata = 0; idata < len; idata++, p += m_SndFile.m_nChannels)
+ // Found enough empty channels yet?
+ if((--maxRemoveCount) == 0) break;
+ }
+ }
+}
+
+
+// Check if a given channel contains note data.
+bool CModDoc::IsChannelUnused(CHANNELINDEX nChn) const
+//----------------------------------------------------
+{
+ const CHANNELINDEX nChannels = m_SndFile.GetNumChannels();
+ if(nChn >= nChannels)
+ {
+ return true;
+ }
+ for(PATTERNINDEX nPat = 0; nPat < m_SndFile.Patterns.Size(); nPat++)
+ {
+ if(m_SndFile.Patterns.IsValidPat(nPat))
+ {
+ const MODCOMMAND *p = m_SndFile.Patterns[nPat] + nChn;
+ for(ROWINDEX nRow = m_SndFile.Patterns[nPat].GetNumRows(); nRow > 0; nRow--, p += nChannels)
{
- if (!p->IsEmpty())
+ if(!p->IsEmpty())
{
- mask[iRst] = false;
- break;
+ return false;
}
}
- if (!mask[iRst]) break;
}
- if (mask[iRst])
- {
- if ((--maxRemoveCount) == 0) break;
- }
}
+ return true;
}
Modified: trunk/OpenMPT/mptrack/View_pat.cpp
===================================================================
--- trunk/OpenMPT/mptrack/View_pat.cpp 2011-02-12 20:40:27 UTC (rev 798)
+++ trunk/OpenMPT/mptrack/View_pat.cpp 2011-02-14 18:33:16 UTC (rev 799)
@@ -2583,7 +2583,7 @@
{
CModDoc *pModDoc = GetDocument();
CSoundFile* pSndFile;
- if (pModDoc == 0 || (pSndFile = pModDoc->GetSoundFile()) == 0) return;
+ if (pModDoc == nullptr || (pSndFile = pModDoc->GetSoundFile()) == nullptr) return;
if(pSndFile->m_nChannels <= pSndFile->GetModSpecifications().channelsMin)
{
@@ -2592,9 +2592,11 @@
}
CHANNELINDEX nChn = GetChanFromCursor(m_nMenuParam);
+ const bool isEmpty = pModDoc->IsChannelUnused(nChn);
+
CString str;
- str.Format("Remove channel %d?\nNote: Affects all patterns and no undo", nChn+1);
- if(CMainFrame::GetMainFrame()->MessageBox(str , "Remove channel", MB_YESNO | MB_ICONQUESTION) == IDYES)
+ str.Format("Remove channel %d? This channel still contains note data!\nNote: Operation affects all patterns and has no undo", nChn + 1);
+ if(isEmpty || CMainFrame::GetMainFrame()->MessageBox(str , "Remove channel", MB_YESNO | MB_ICONQUESTION) == IDYES)
{
bool chnMask[MAX_BASECHANNELS];
for(CHANNELINDEX i = 0; i < MAX_BASECHANNELS; i++) {chnMask[i] = false;}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sag...@us...> - 2011-02-12 20:40:34
|
Revision: 798
http://modplug.svn.sourceforge.net/modplug/?rev=798&view=rev
Author: saga-games
Date: 2011-02-12 20:40:27 +0000 (Sat, 12 Feb 2011)
Log Message:
-----------
[Mod] Made the IT bidi loop flag non-static as loading another IT file reset the flag. I guess passing another parameter won't make the mixer slower...
Modified Paths:
--------------
trunk/OpenMPT/soundlib/Fastmix.cpp
trunk/OpenMPT/soundlib/Sndfile.cpp
trunk/OpenMPT/soundlib/Sndfile.h
Modified: trunk/OpenMPT/soundlib/Fastmix.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Fastmix.cpp 2011-02-11 23:28:58 UTC (rev 797)
+++ trunk/OpenMPT/soundlib/Fastmix.cpp 2011-02-12 20:40:27 UTC (rev 798)
@@ -1425,8 +1425,8 @@
/////////////////////////////////////////////////////////////////////////
-static LONG MPPFASTCALL GetSampleCount(MODCHANNEL *pChn, LONG nSamples)
-//---------------------------------------------------------------------
+static LONG MPPFASTCALL GetSampleCount(MODCHANNEL *pChn, LONG nSamples, bool bITBidiMode)
+//---------------------------------------------------------------------------------------
{
LONG nLoopStart = (pChn->dwFlags & CHN_LOOP) ? pChn->nLoopStart : 0;
LONG nInc = pChn->nInc;
@@ -1479,8 +1479,7 @@
pChn->nPos = pChn->nLength - nDeltaHi - (nDeltaLo>>16);
pChn->nPosLo = nDeltaLo & 0xffff;
// Impulse Tracker's software mixer would put a -2 (instead of -1) in the following line (doesn't happen on a GUS)
- // The bidi mode flag is stored in a static CSoundFile variable. Dirty!
- if ((pChn->nPos <= pChn->nLoopStart) || (pChn->nPos >= pChn->nLength)) pChn->nPos = pChn->nLength - (CSoundFile::m_bITBidiMode ? 2 : 1);
+ if ((pChn->nPos <= pChn->nLoopStart) || (pChn->nPos >= pChn->nLength)) pChn->nPos = pChn->nLength - (bITBidiMode ? 2 : 1);
} else
{
if (nInc < 0) // This is a bug
@@ -1663,7 +1662,7 @@
{
if ((LONG)nrampsamples > pChannel->nRampLength) nrampsamples = pChannel->nRampLength;
}
- if ((nSmpCount = GetSampleCount(pChannel, nrampsamples)) <= 0)
+ if ((nSmpCount = GetSampleCount(pChannel, nrampsamples, m_bITBidiMode)) <= 0)
{
// Stopping the channel
pChannel->pCurrentSample = NULL;
Modified: trunk/OpenMPT/soundlib/Sndfile.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Sndfile.cpp 2011-02-11 23:28:58 UTC (rev 797)
+++ trunk/OpenMPT/soundlib/Sndfile.cpp 2011-02-12 20:40:27 UTC (rev 798)
@@ -438,7 +438,6 @@
CTuningCollection* CSoundFile::s_pTuningsSharedBuiltIn(0);
CTuningCollection* CSoundFile::s_pTuningsSharedLocal(0);
uint8 CSoundFile::s_DefaultPlugVolumeHandling = PLUGIN_VOLUMEHANDLING_IGNORE;
-bool CSoundFile::m_bITBidiMode = false;
#pragma warning(disable : 4355) // "'this' : used in base member initializer list"
CSoundFile::CSoundFile() :
@@ -473,6 +472,7 @@
m_nMaxSample = 0;
m_ModFlags = 0;
+ m_bITBidiMode = false;
m_pModDoc = NULL;
m_dwLastSavedWithVersion=0;
@@ -3096,5 +3096,5 @@
void CSoundFile::SetupITBidiMode()
//--------------------------------
{
- CSoundFile::m_bITBidiMode = IsCompatibleMode(TRK_IMPULSETRACKER);
+ m_bITBidiMode = IsCompatibleMode(TRK_IMPULSETRACKER);
}
Modified: trunk/OpenMPT/soundlib/Sndfile.h
===================================================================
--- trunk/OpenMPT/soundlib/Sndfile.h 2011-02-11 23:28:58 UTC (rev 797)
+++ trunk/OpenMPT/soundlib/Sndfile.h 2011-02-12 20:40:27 UTC (rev 798)
@@ -574,12 +574,12 @@
private: //Misc data
uint16 m_ModFlags;
const CModSpecifications* m_pModSpecs;
+ bool m_bITBidiMode; // Process bidi loops like Impulse Tracker (see Fastmix.cpp for an explanation)
// For handling backwards jumps and stuff to prevent infinite loops when counting the mod length or rendering to wav.
VisitedRowsType m_VisitedRows;
-
public: // Static Members
static UINT m_nXBassDepth, m_nXBassRange;
static float m_nMaxSample;
@@ -593,10 +593,8 @@
static LPSNDMIXHOOKPROC gpSndMixHook;
static PMIXPLUGINCREATEPROC gpMixPluginCreateProc;
static uint8 s_DefaultPlugVolumeHandling;
- static bool m_bITBidiMode; // Process bidi loops like Impulse Tracker (see Fastmix.cpp for an explanation)
-
public: // for Editing
CModDoc* m_pModDoc; // Can be a null pointer f.e. when previewing samples from the treeview.
MODTYPE m_nType;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sag...@us...> - 2011-02-11 23:29:06
|
Revision: 797
http://modplug.svn.sourceforge.net/modplug/?rev=797&view=rev
Author: saga-games
Date: 2011-02-11 23:28:58 +0000 (Fri, 11 Feb 2011)
Log Message:
-----------
[Mod] The visited rows mechanism is now used everywhere, not only for song length detection. This introduces some great changes in the code. One advantage of the new mechanism is that backwards playing patterns can now be exported to WAV properly (hehe). The new code might break the "loop song" feature sometimes, let's see how that works...
[Ref] Some changes to GetLength()'s return values and other stuff related to the modification above.
[Mod] OpenMPT: Version is now 1.19.00.23
Modified Paths:
--------------
trunk/OpenMPT/mptrack/Ctrl_seq.cpp
trunk/OpenMPT/mptrack/Mod2wave.cpp
trunk/OpenMPT/mptrack/Moddoc.cpp
trunk/OpenMPT/mptrack/View_pat.cpp
trunk/OpenMPT/mptrack/version.h
trunk/OpenMPT/soundlib/Snd_fx.cpp
trunk/OpenMPT/soundlib/Sndfile.cpp
trunk/OpenMPT/soundlib/Sndfile.h
trunk/OpenMPT/soundlib/Sndmix.cpp
Modified: trunk/OpenMPT/mptrack/Ctrl_seq.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Ctrl_seq.cpp 2011-02-11 22:45:26 UTC (rev 796)
+++ trunk/OpenMPT/mptrack/Ctrl_seq.cpp 2011-02-11 23:28:58 UTC (rev 797)
@@ -303,24 +303,26 @@
if ((bIsPlaying) && (pSndFile->m_dwSongFlags & SONG_PATTERNLOOP))
{
BEGIN_CRITICAL();
+ // update channel parameters and play time
+ m_pModDoc->SetElapsedTime(m_nScrollPos, 0);
+
pSndFile->m_nPattern = n;
pSndFile->m_nCurrentPattern = pSndFile->m_nNextPattern = m_nScrollPos;
pMainFrm->ResetNotificationBuffer(); //rewbs.toCheck
pSndFile->m_nNextRow = 0;
END_CRITICAL();
- } else
- if (m_pParent->GetFollowSong())
+ } else if (m_pParent->GetFollowSong())
{
BEGIN_CRITICAL();
DWORD dwPaused = pSndFile->m_dwSongFlags & (SONG_PAUSED|SONG_STEP|SONG_PATTERNLOOP);
+
+ //if (!(dwPaused & SONG_PATTERNLOOP)) // why?
+ // update channel parameters and play time
+ m_pModDoc->SetElapsedTime(m_nScrollPos, 0);
+
pSndFile->m_nCurrentPattern = m_nScrollPos;
pSndFile->SetCurrentOrder(m_nScrollPos);
pSndFile->m_dwSongFlags |= dwPaused;
- //if (!(dwPaused & SONG_PATTERNLOOP)) // why?
- {
- // update channel parameters and play time
- m_pModDoc->SetElapsedTime(m_nScrollPos, 0);
- }
if (bIsPlaying) pMainFrm->ResetNotificationBuffer();
END_CRITICAL();
}
Modified: trunk/OpenMPT/mptrack/Mod2wave.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Mod2wave.cpp 2011-02-11 22:45:26 UTC (rev 796)
+++ trunk/OpenMPT/mptrack/Mod2wave.cpp 2011-02-11 23:28:58 UTC (rev 797)
@@ -690,6 +690,8 @@
DWORD dwOrds = m_pSndFile->Order.GetLengthFirstEmpty();
if ((m_nMaxPatterns < dwOrds) && (dwOrds > 0)) l = (l*m_nMaxPatterns) / dwOrds;
}
+ m_pSndFile->InitializeVisitedRows(true);
+
if (l < max) max = l;
if (progress != NULL)
@@ -1048,6 +1050,7 @@
CSoundFile::InitPlayer(TRUE);
CSoundFile::gdwSoundSetup |= SNDMIX_DIRECTTODISK;
if ((!m_dwFileLimit) && (!m_dwSongLimit)) CSoundFile::gdwSoundSetup |= SNDMIX_NOBACKWARDJUMPS;
+ m_pSndFile->InitializeVisitedRows(true);
// Setting up file limits and progress range
if ((!m_dwFileLimit) || (m_dwFileLimit > 512000)) m_dwFileLimit = 512000;
m_dwFileLimit <<= 10;
@@ -1138,6 +1141,7 @@
CSoundFile::gdwSoundSetup &= ~(SNDMIX_DIRECTTODISK|SNDMIX_NOBACKWARDJUMPS);
m_pSndFile->SetRepeatCount(oldrepeat);
m_pSndFile->m_nMaxOrderPosition = 0;
+ m_pSndFile->InitializeVisitedRows(true);
CMainFrame::UpdateAudioParameters(TRUE);
// Success
if (bSaveWave)
Modified: trunk/OpenMPT/mptrack/Moddoc.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Moddoc.cpp 2011-02-11 22:45:26 UTC (rev 796)
+++ trunk/OpenMPT/mptrack/Moddoc.cpp 2011-02-11 23:28:58 UTC (rev 797)
@@ -1923,6 +1923,7 @@
//m_SndFile.m_dwSongFlags &= ~SONG_STEP;
m_SndFile.m_dwSongFlags &= ~(SONG_STEP|SONG_PATTERNLOOP);
m_SndFile.SetCurrentPos(0);
+ m_SndFile.InitializeVisitedRows(true);
pMainFrm->ResetElapsedTime();
BEGIN_CRITICAL();
m_SndFile.ResumePlugins();
@@ -3692,7 +3693,7 @@
if(pMainFrm == NULL)
return;
- const double dPatternPlaytime = m_SndFile.GetPlaybackTimeAt(nOrd, nRow, false);
+ const double dPatternPlaytime = m_SndFile.GetPlaybackTimeAt(nOrd, nRow, true);
pMainFrm->SetElapsedTime((DWORD) (max(0, dPatternPlaytime) * 1000));
}
Modified: trunk/OpenMPT/mptrack/View_pat.cpp
===================================================================
--- trunk/OpenMPT/mptrack/View_pat.cpp 2011-02-11 22:45:26 UTC (rev 796)
+++ trunk/OpenMPT/mptrack/View_pat.cpp 2011-02-11 23:28:58 UTC (rev 797)
@@ -5453,7 +5453,7 @@
ORDERINDEX currentOrder = SendCtrlMessage(CTRLMSG_GETCURRENTORDER);
if(pSndFile->Order[currentOrder] == m_nPattern)
{
- const double t = pSndFile->GetPlaybackTimeAt(currentOrder, m_nRow, true);
+ const double t = pSndFile->GetPlaybackTimeAt(currentOrder, m_nRow, false);
if(t < 0)
msg.Format("Unable to determine the time. Possible cause: No order %d, row %d found from play sequence", currentOrder, m_nRow);
else
Modified: trunk/OpenMPT/mptrack/version.h
===================================================================
--- trunk/OpenMPT/mptrack/version.h 2011-02-11 22:45:26 UTC (rev 796)
+++ trunk/OpenMPT/mptrack/version.h 2011-02-11 23:28:58 UTC (rev 797)
@@ -15,7 +15,7 @@
#define VER_MAJORMAJOR 1
#define VER_MAJOR 19
#define VER_MINOR 00
-#define VER_MINORMINOR 22
+#define VER_MINORMINOR 23
//Creates version number from version parts that appears in version string.
//For example MAKE_VERSION_NUMERIC(1,17,02,28) gives version number of
Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Snd_fx.cpp 2011-02-11 22:45:26 UTC (rev 796)
+++ trunk/OpenMPT/soundlib/Snd_fx.cpp 2011-02-11 23:28:58 UTC (rev 797)
@@ -73,23 +73,24 @@
}
*/
-double CSoundFile::GetLength(bool bAdjust, ORDERINDEX endOrder, ROWINDEX endRow)
-//------------------------------------------------------------------------------
-{
- bool dummy = false;
- double result = GetLength(dummy, bAdjust, endOrder, endRow);
- return result;
-}
-
// Get mod length in various cases. Parameters:
-// &targetReached: Will be set to true if the specified order/row combination has been reached while going through the module.
-// bAdjust: If enabled, the mod parameters (such as global volume, speed, tempo, etc...) will be memorized (if the target has been reached) when leaving the function (i.e. they won't be reset to the previous values)
-// endOrder: Order which should be reached (ORDERINDEX_INVALID means whole song)
-// endRow: Row in that order that should be reached
-double CSoundFile::GetLength(bool& targetReached, bool bAdjust, ORDERINDEX endOrder, ROWINDEX endRow)
-//---------------------------------------------------------------------------------------------------
+// [in] bAdjust: If enabled, the mod parameters (such as global volume, speed, tempo, etc...) will be memorized (if the target has been reached) when leaving the function (i.e. they won't be reset to the previous values)
+// [in] endOrder: Order which should be reached (ORDERINDEX_INVALID means whole song)
+// [in] endRow: Row in that order that should be reached
+// [out] duration: total time in seconds
+// [out] targetReached: true if the specified order/row combination has been reached while going through the module.
+// [out] endOrder: last parsed order (if no target is specified, this is the first order that is parsed twice, i.e. not the *last* played order)
+// [out] endRow: last parsed row (dito)
+GetLengthType CSoundFile::GetLength(bool bAdjust, ORDERINDEX endOrder, ROWINDEX endRow)
+//-------------------------------------------------------------------------------------
{
+ GetLengthType retval;
+ retval.duration = 0.0;
+ retval.targetReached = false;
+ retval.endOrder = ORDERINDEX_INVALID;
+ retval.endRow = ROWINDEX_INVALID;
+
// -> CODE#0022
// -> DESC="alternative BPM/Speed interpretation method"
// UINT dwElapsedTime=0, nRow=0, nCurrentPattern=0, nNextPattern=0, nPattern=Order[0];
@@ -166,7 +167,7 @@
//Check whether target reached.
if(nCurrentPattern == endOrder && nRow == endRow)
{
- targetReached = true;
+ retval.targetReached = true;
break;
}
@@ -420,10 +421,17 @@
}
}
+ if(retval.targetReached || endOrder == ORDERINDEX_INVALID || endRow == ROWINDEX_INVALID)
+ {
+ retval.endOrder = nCurrentPattern;
+ retval.endRow = nRow;
+ }
+ retval.duration = dElapsedTime / 1000.0;
+
// Store final variables
if (bAdjust)
{
- if (targetReached || endOrder == ORDERINDEX_INVALID || endRow == ROWINDEX_INVALID)
+ if (retval.targetReached || endOrder == ORDERINDEX_INVALID || endRow == ROWINDEX_INVALID)
{
// Target found, or there is no target (i.e. play whole song)...
m_nGlobalVolume = nGlbVol;
@@ -438,7 +446,7 @@
if (vols[n] != 0xFF)
{
if (vols[n] > 64) vols[n] = 64;
- Chn[n].nVolume = vols[n] << 2;
+ Chn[n].nVolume = vols[n] * 4;
}
}
} else
@@ -449,10 +457,10 @@
m_nGlobalVolume = m_nDefaultGlobalVolume;
}
// When adjusting the playback status, we will also want to update the visited rows vector according to the current position.
- m_bVisitedRows = visitedRows;
+ m_VisitedRows = visitedRows;
}
- return dElapsedTime / 1000.0;
+ return retval;
}
@@ -1194,7 +1202,7 @@
//rewbs: Copy mute and FX status from master chan.
//I'd like to copy other flags too, but this would change playback behaviour.
- p->dwFlags |= (pChn->dwFlags & CHN_MUTE) | (pChn->dwFlags & CHN_NOFX);
+ p->dwFlags |= (pChn->dwFlags & (CHN_MUTE|CHN_NOFX));
p->nMasterChn = nChn+1;
p->nCommand = 0;
@@ -1241,7 +1249,8 @@
//-------------------------------
{
MODCHANNEL *pChn = Chn;
- int nBreakRow = -1, nPosJump = -1, nPatLoopRow = -1;
+ ROWINDEX nBreakRow = ROWINDEX_INVALID, nPatLoopRow = ROWINDEX_INVALID;
+ ORDERINDEX nPosJump = ORDERINDEX_INVALID;
// -> CODE#0010
// -> DESC="add extended parameter mechanism to pattern effects"
@@ -2088,45 +2097,28 @@
if(m_dwSongFlags & SONG_FIRSTTICK)
{
// Pattern Loop
- if (nPatLoopRow >= 0)
+ if (nPatLoopRow != ROWINDEX_INVALID)
{
m_nNextPattern = m_nCurrentPattern;
m_nNextRow = nPatLoopRow;
if (m_nPatternDelay) m_nNextRow++;
+ // As long as the pattern loop is running, mark the looped rows as not visited yet
+ for(ROWINDEX nRow = nPatLoopRow; nRow <= m_nRow; nRow++)
+ {
+ SetRowVisited(m_nCurrentPattern, nRow, false);
+ }
} else
// Pattern Break / Position Jump only if no loop running
- if ((nBreakRow >= 0) || (nPosJump >= 0))
+ if ((nBreakRow != ROWINDEX_INVALID) || (nPosJump != ORDERINDEX_INVALID))
{
- bool bNoLoop = false;
- if (nPosJump < 0) nPosJump = m_nCurrentPattern+1;
- if (nBreakRow < 0) nBreakRow = 0;
+ if (nPosJump == ORDERINDEX_INVALID) nPosJump = m_nCurrentPattern + 1;
+ if (nBreakRow == ROWINDEX_INVALID) nBreakRow = 0;
+ m_dwSongFlags |= SONG_BREAKTOROW;
- if(nBreakRow >= 0) m_dwSongFlags |= SONG_BREAKTOROW;
- // ModPlug Tracker & ModPlugin allow backward jumps
- #ifndef FASTSOUNDLIB
- if ((nPosJump < (int)m_nCurrentPattern)
- || ((nPosJump == (int)m_nCurrentPattern) && (nBreakRow <= (int)m_nRow)))
+ if (nPosJump >= Order.size())
{
- if (!IsValidBackwardJump(m_nCurrentPattern, m_nRow, nPosJump, nBreakRow))
- {
- if (m_nRepeatCount)
- {
- if (m_nRepeatCount > 0) m_nRepeatCount--;
- } else
- {
- #ifdef MODPLUG_TRACKER
- if (gdwSoundSetup & SNDMIX_NOBACKWARDJUMPS)
- #endif
- // Backward jump disabled
- bNoLoop = true;
- }
- }
- }
- #endif // FASTSOUNDLIB
- //rewbs.fix
- //if (((!bNoLoop) && (nPosJump < MAX_ORDERS))
- if (nPosJump>=Order.size())
nPosJump = 0;
+ }
// This checks whether we're jumping to the same row we're already on.
// Sounds pretty stupid and pointless to me. And noone else does this, either.
@@ -2145,6 +2137,7 @@
m_bPatternTransitionOccurred = true;
}
} //Ends condition (nBreakRow >= 0) || (nPosJump >= 0)
+ //SetRowVisited(m_nCurrentPattern, m_nRow);
}
return TRUE;
}
@@ -3864,6 +3857,7 @@
}
+// This is how backward jumps should not be tested. :) (now unused)
BOOL CSoundFile::IsValidBackwardJump(UINT nStartOrder, UINT nStartRow, UINT nJumpOrder, UINT nJumpRow) const
//----------------------------------------------------------------------------------------------------------
{
@@ -4236,7 +4230,7 @@
{
if(pRowVector == nullptr)
{
- pRowVector = &m_bVisitedRows;
+ pRowVector = &m_VisitedRows;
}
pRowVector->resize(Order.GetLengthTailTrimmed());
@@ -4268,7 +4262,7 @@
if(pRowVector == nullptr)
{
- pRowVector = &m_bVisitedRows;
+ pRowVector = &m_VisitedRows;
}
// The module might have been edited in the meantime - so we have to extend this a bit.
@@ -4296,7 +4290,7 @@
if(pRowVector == nullptr)
{
- pRowVector = &m_bVisitedRows;
+ pRowVector = &m_VisitedRows;
}
// The row slot for this row has not been assigned yet - Just return false, as this means that the program has not played the row yet.
Modified: trunk/OpenMPT/soundlib/Sndfile.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Sndfile.cpp 2011-02-11 22:45:26 UTC (rev 796)
+++ trunk/OpenMPT/soundlib/Sndfile.cpp 2011-02-11 23:28:58 UTC (rev 797)
@@ -755,6 +755,8 @@
m_nNextRow = 0;
m_nRow = 0;
+ InitializeVisitedRows(true);
+
switch(m_nTempoMode)
{
case tempo_mode_alternative:
@@ -1212,7 +1214,7 @@
//rewbs.VSTCompliance
void CSoundFile::SuspendPlugins()
-//------------------------------
+//-------------------------------
{
for (UINT iPlug=0; iPlug<MAX_MIXPLUGINS; iPlug++)
{
@@ -1269,7 +1271,7 @@
void CSoundFile::RecalculateGainForAllPlugs()
-//------------------------------------------
+//-------------------------------------------
{
for (UINT iPlug=0; iPlug<MAX_MIXPLUGINS; iPlug++)
{
@@ -1337,7 +1339,7 @@
}
ORDERINDEX CSoundFile::FindOrder(PATTERNINDEX nPat, UINT startFromOrder, bool direction)
-//-------------------------------------------------------------------------------------
+//--------------------------------------------------------------------------------------
{
ORDERINDEX foundAtOrder = ORDERINDEX_INVALID;
ORDERINDEX candidateOrder = 0;
@@ -1626,7 +1628,7 @@
}
bool CSoundFile::MoveChannel(UINT chnFrom, UINT chnTo)
-//-----------------------------------------------------
+//----------------------------------------------------
{
//Implementation of move channel using ReArrangeChannels(...). So this function
//only creates correct newOrder-vector used in the ReArrangeChannels(...).
@@ -1734,7 +1736,7 @@
#ifndef MODPLUG_NO_FILESAVE
UINT CSoundFile::WriteSample(FILE *f, MODSAMPLE *pSmp, UINT nFlags, UINT nMaxLen)
-//-----------------------------------------------------------------------------------
+//-------------------------------------------------------------------------------
{
UINT len = 0, bufcount;
char buffer[4096];
@@ -1949,7 +1951,7 @@
// 6 = unsigned 16-bit PCM data
UINT CSoundFile::ReadSample(MODSAMPLE *pSmp, UINT nFlags, LPCSTR lpMemFile, DWORD dwMemLength, const WORD format)
-//-----------------------------------------------------------------------------------------------------------------------
+//---------------------------------------------------------------------------------------------------------------
{
if ((!pSmp) || (pSmp->nLength < 2) || (!lpMemFile)) return 0;
@@ -2429,7 +2431,7 @@
void CSoundFile::AdjustSampleLoop(MODSAMPLE *pSmp)
-//----------------------------------------------------
+//------------------------------------------------
{
if ((!pSmp->pSample) || (!pSmp->nLength)) return;
if (pSmp->nLoopEnd > pSmp->nLength) pSmp->nLoopEnd = pSmp->nLength;
@@ -2578,7 +2580,7 @@
void CSoundFile::FrequencyToTranspose(MODSAMPLE *psmp)
-//--------------------------------------------------------
+//----------------------------------------------------
{
int f2t = FrequencyToTranspose(psmp->nC5Speed);
int transp = f2t >> 7;
@@ -2814,14 +2816,14 @@
if (!from || from >= MAX_SAMPLES || !to || to >= MAX_SAMPLES) return false;
if (/*!Ins[from].pSample ||*/ Samples[to].pSample) return true;
- MODSAMPLE *pinsf = &Samples[from];
- MODSAMPLE *pinst = &Samples[to];
+ MODSAMPLE *pFrom = &Samples[from];
+ MODSAMPLE *pTo = &Samples[to];
- memcpy(pinst, pinsf, sizeof(MODSAMPLE));
+ memcpy(pTo, pFrom, sizeof(MODSAMPLE));
- pinsf->pSample = nullptr;
- pinsf->nLength = 0;
- pinsf->uFlags &= ~(CHN_16BIT);
+ pFrom->pSample = nullptr;
+ pFrom->nLength = 0;
+ pFrom->uFlags &= ~(CHN_16BIT);
return true;
}
@@ -2847,7 +2849,7 @@
{
// m_defaultInstrument is currently only used to get default values for extented properties.
// In the future we can make better use of this.
- memset(&m_defaultInstrument, 0, sizeof(MODINSTRUMENT));
+ MemsetZero(m_defaultInstrument);
m_defaultInstrument.nResampling = SRCMODE_DEFAULT;
m_defaultInstrument.nFilterMode = FLTMODE_UNCHANGED;
m_defaultInstrument.nPPC = 5*12;
@@ -2889,7 +2891,7 @@
}
bool CSoundFile::LoadStaticTunings()
-//-----------------------------------
+//----------------------------------
{
if(s_pTuningsSharedLocal || s_pTuningsSharedBuiltIn) return true;
//For now not allowing to reload tunings(one should be careful when reloading them
@@ -2941,8 +2943,8 @@
-void CSoundFile::SetDefaultInstrumentValues(MODINSTRUMENT *pIns)
-//-----------------------------------------------------------------
+void CSoundFile::SetDefaultInstrumentValues(MODINSTRUMENT *pIns)
+//--------------------------------------------------------------
{
pIns->nResampling = m_defaultInstrument.nResampling;
pIns->nFilterMode = m_defaultInstrument.nFilterMode;
@@ -2957,7 +2959,7 @@
long CSoundFile::GetSampleOffset()
-//-------------------------------
+//--------------------------------
{
//TODO: This is where we could inform patterns of the exact song position when playback starts.
//order: m_nNextPattern
@@ -2967,7 +2969,7 @@
}
string CSoundFile::GetNoteName(const CTuning::NOTEINDEXTYPE& note, const INSTRUMENTINDEX inst) const
-//----------------------------------------------------------------------------------
+//--------------------------------------------------------------------------------------------------
{
if((inst >= MAX_INSTRUMENTS && inst != INSTRUMENTINDEX_INVALID) || note < 1 || note > NOTE_MAX) return "BUG";
@@ -3054,12 +3056,11 @@
}
-double CSoundFile::GetPlaybackTimeAt(ORDERINDEX ord, ROWINDEX row, bool resetVars)
-//--------------------------------------------------------------------------------
+double CSoundFile::GetPlaybackTimeAt(ORDERINDEX ord, ROWINDEX row, bool updateVars)
+//---------------------------------------------------------------------------------
{
- bool targetReached = false;
- const double t = GetLength(targetReached, !resetVars, ord, row);
- if(targetReached) return t;
+ const GetLengthType t = GetLength(updateVars, ord, row);
+ if(t.targetReached) return t.duration;
else return -1; //Given position not found from play sequence.
}
Modified: trunk/OpenMPT/soundlib/Sndfile.h
===================================================================
--- trunk/OpenMPT/soundlib/Sndfile.h 2011-02-11 22:45:26 UTC (rev 796)
+++ trunk/OpenMPT/soundlib/Sndfile.h 2011-02-11 23:28:58 UTC (rev 797)
@@ -487,6 +487,16 @@
typedef vector<VisitedRowsBaseType> VisitedRowsType;
+// Return values for GetLength()
+struct GetLengthType
+{
+ double duration; // total time in seconds
+ bool targetReached; // true if the specified order/row combination has been reached while going through the module
+ ORDERINDEX endOrder; // last parsed order (if no target is specified, this is the first order that is parsed twice, i.e. not the *last* played order)
+ ROWINDEX endRow; // last parsed row (dito)
+};
+
+
//Note: These are bit indeces. MSF <-> Mod(Specific)Flag.
//If changing these, ChangeModTypeTo() might need modification.
const BYTE MSF_COMPATIBLE_PLAY = 0; //IT/MPT/XM
@@ -508,8 +518,8 @@
void ChangeModTypeTo(const MODTYPE& newType);
// Returns value in seconds. If given position won't be played at all, returns -1.
- // If resetVars is true, the state of various playback variables will be retained.
- double GetPlaybackTimeAt(ORDERINDEX ord, ROWINDEX row, bool resetVars);
+ // If updateVars is true, the state of various playback variables will be updated according to the playback position.
+ double GetPlaybackTimeAt(ORDERINDEX ord, ROWINDEX row, bool updateVars);
uint16 GetModFlags() const {return m_ModFlags;}
void SetModFlags(const uint16 v) {m_ModFlags = v;}
@@ -566,7 +576,7 @@
const CModSpecifications* m_pModSpecs;
// For handling backwards jumps and stuff to prevent infinite loops when counting the mod length or rendering to wav.
- VisitedRowsType m_bVisitedRows;
+ VisitedRowsType m_VisitedRows;
@@ -693,15 +703,13 @@
UINT GetMusicSpeed() const { return m_nMusicSpeed; }
UINT GetMusicTempo() const { return m_nMusicTempo; }
- double GetLength(bool bAdjust, ORDERINDEX ord = ORDERINDEX_MAX, ROWINDEX row = ROWINDEX_MAX);
-private:
//Get modlength in various cases: total length, length to
//specific order&row etc. Return value is in seconds.
- double GetLength(bool& targetReached, bool bAdjust, ORDERINDEX ord, ROWINDEX row);
+ GetLengthType GetLength(bool bAdjust, ORDERINDEX ord = ORDERINDEX_INVALID, ROWINDEX row = ROWINDEX_INVALID);
public:
//Returns song length in seconds.
- DWORD GetSongTime() { return static_cast<DWORD>((m_nTempoMode == tempo_mode_alternative) ? GetLength(false) + 1.0 : GetLength(false) + 0.5); }
+ DWORD GetSongTime() { return static_cast<DWORD>((m_nTempoMode == tempo_mode_alternative) ? GetLength(false).duration + 1.0 : GetLength(false).duration + 0.5); }
// A repeat count value of -1 means infinite loop
void SetRepeatCount(int n) { m_nRepeatCount = n; }
@@ -901,6 +909,7 @@
BOOL IsValidBackwardJump(UINT nStartOrder, UINT nStartRow, UINT nJumpOrder, UINT nJumpRow) const;
void UpdateTimeSignature();
+ UINT GetNumTicksOnCurrentRow() { return m_nMusicSpeed * (m_nPatternDelay + 1) + m_nFrameDelay; };
public:
// Write pattern effect functions
bool TryWriteEffect(PATTERNINDEX nPat, ROWINDEX nRow, BYTE nEffect, BYTE nParam, bool bIsVolumeEffect, CHANNELINDEX nChn = CHANNELINDEX_INVALID, bool bAllowMultipleEffects = true, bool bAllowNextRow = false, bool bRetry = true);
Modified: trunk/OpenMPT/soundlib/Sndmix.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Sndmix.cpp 2011-02-11 22:45:26 UTC (rev 796)
+++ trunk/OpenMPT/soundlib/Sndmix.cpp 2011-02-11 23:28:58 UTC (rev 797)
@@ -657,7 +657,7 @@
if ((m_nPattern == Order.GetInvalidPatIndex()) || (m_nCurrentPattern >= Order.size()))
{
- if (!m_nRepeatCount) return FALSE;
+ //if (!m_nRepeatCount) return FALSE;
ORDERINDEX nRestartPosOverride = m_nRestartPos;
if(!m_nRestartPos && m_nCurrentPattern <= Order.size() && m_nCurrentPattern > 0)
@@ -734,9 +734,10 @@
}
//Check for end of song or bad pattern
if (m_nCurrentPattern >= Order.size()
- ||
- (Order[m_nCurrentPattern] >= Patterns.Size())
- || (!Patterns[Order[m_nCurrentPattern]]) ) {
+ || (Order[m_nCurrentPattern] >= Patterns.Size())
+ || (!Patterns[Order[m_nCurrentPattern]]) )
+ {
+ InitializeVisitedRows(true);
return FALSE;
}
@@ -761,9 +762,42 @@
}
// Weird stuff?
- if ((m_nPattern >= Patterns.Size()) || (!Patterns[m_nPattern])) return FALSE;
+ if (!Patterns.IsValidPat(m_nPattern)) return FALSE;
// Should never happen
if (m_nRow >= Patterns[m_nPattern].GetNumRows()) m_nRow = 0;
+
+ // Has this row been visited before? We might want to stop playback now.
+ // But: We will not mark the row as modified if the song is not in loop mode but
+ // the pattern loop (editor flag, not to be confused with the pattern loop effect)
+ // flag is set - because in that case, the module would stop after the first pattern loop...
+ const bool overrideLoopCheck = (m_nRepeatCount != -1) && (m_dwSongFlags & SONG_PATTERNLOOP);
+ if(!overrideLoopCheck && IsRowVisited(m_nCurrentPattern, m_nRow, true))
+ {
+ InitializeVisitedRows(true);
+ if(m_nRepeatCount)
+ {
+ // repeat count == -1 means repeat infinitely.
+ if (m_nRepeatCount > 0)
+ {
+ m_nRepeatCount--;
+ }
+ // We shouldn't forget that we actually just visited this row (InitializeVisitedRows cleared it).
+ SetRowVisited(m_nCurrentPattern, m_nRow);
+ } else
+ {
+#ifdef MODPLUG_TRACKER
+ // Let's check again if this really is the end of the song.
+ // The visited rows vector might have been screwed up while editing...
+ GetLengthType t = GetLength(false);
+ if(t.endOrder == m_nCurrentPattern && t.endRow == m_nRow)
+#endif // MODPLUG_TRACKER
+ {
+ // This is really the song's end!
+ return FALSE;
+ }
+ }
+ }
+
m_nNextRow = m_nRow + 1;
if (m_nNextRow >= Patterns[m_nPattern].GetNumRows())
{
@@ -1611,7 +1645,6 @@
if ((pChn->nAutoVibDepth >> 8) > pSmp->nVibDepth)
pChn->nAutoVibDepth = pSmp->nVibDepth << 8;
}
- const int vibpos = pChn->nAutoVibPos & 0xFF;
pChn->nAutoVibPos += pSmp->nVibRate;
int vdelta;
switch(pSmp->nVibType)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sag...@us...> - 2011-02-11 22:45:35
|
Revision: 796
http://modplug.svn.sourceforge.net/modplug/?rev=796&view=rev
Author: saga-games
Date: 2011-02-11 22:45:26 +0000 (Fri, 11 Feb 2011)
Log Message:
-----------
[Imp] Pattern Editor: The dodgy note colour is now also customisable.
Modified Paths:
--------------
trunk/OpenMPT/mptrack/Draw_pat.cpp
trunk/OpenMPT/mptrack/MainFrm.cpp
trunk/OpenMPT/mptrack/Mainfrm.h
trunk/OpenMPT/mptrack/Moptions.cpp
Modified: trunk/OpenMPT/mptrack/Draw_pat.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Draw_pat.cpp 2011-02-08 11:09:20 UTC (rev 795)
+++ trunk/OpenMPT/mptrack/Draw_pat.cpp 2011-02-11 22:45:26 UTC (rev 796)
@@ -135,7 +135,6 @@
b = hilightcolor(GetBValue(CMainFrame::rgbCustomColors[MODCOLOR_BACKHILIGHT]),
GetBValue(CMainFrame::rgbCustomColors[MODCOLOR_BACKNORMAL]));
m_Dib.SetColor(MODCOLOR_2NDHIGHLIGHT, RGB(r,g,b));
- m_Dib.SetColor(MODCOLOR_DODGY_COMMANDS, RGB(255, 0, 0));
m_Dib.SetBlendColor(CMainFrame::rgbCustomColors[MODCOLOR_BLENDCOLOR]);
}
Modified: trunk/OpenMPT/mptrack/MainFrm.cpp
===================================================================
--- trunk/OpenMPT/mptrack/MainFrm.cpp 2011-02-08 11:09:20 UTC (rev 795)
+++ trunk/OpenMPT/mptrack/MainFrm.cpp 2011-02-11 22:45:26 UTC (rev 796)
@@ -261,6 +261,8 @@
GetSysColor(COLOR_BTNSHADOW), GetSysColor(COLOR_BTNFACE), GetSysColor(COLOR_BTNHIGHLIGHT),
// Blend colour
GetSysColor(COLOR_BTNFACE),
+ // Dodgy commands
+ RGB(0xC0, 0x00, 0x00),
};
// Directory Arrays (Default + Last)
Modified: trunk/OpenMPT/mptrack/Mainfrm.h
===================================================================
--- trunk/OpenMPT/mptrack/Mainfrm.h 2011-02-08 11:09:20 UTC (rev 795)
+++ trunk/OpenMPT/mptrack/Mainfrm.h 2011-02-11 22:45:26 UTC (rev 796)
@@ -152,10 +152,10 @@
MODCOLOR_SEPFACE,
MODCOLOR_SEPHILITE,
MODCOLOR_BLENDCOLOR,
+ MODCOLOR_DODGY_COMMANDS,
MAX_MODCOLORS,
- // Internal color codes
+ // Internal color codes (not saved to color preset files)
MODCOLOR_2NDHIGHLIGHT,
- MODCOLOR_DODGY_COMMANDS,
MAX_MODPALETTECOLORS
};
Modified: trunk/OpenMPT/mptrack/Moptions.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Moptions.cpp 2011-02-08 11:09:20 UTC (rev 795)
+++ trunk/OpenMPT/mptrack/Moptions.cpp 2011-02-11 22:45:26 UTC (rev 796)
@@ -28,6 +28,7 @@
{"Play Cursor", 0, MODCOLOR_BACKPLAYCURSOR, MODCOLOR_TEXTPLAYCURSOR, 0, "Background:", "Foreground:", NULL},
{"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:"},
+ {"Invalid Commands",0, MODCOLOR_DODGY_COMMANDS, 0, 0, "Invalid Note:", NULL, NULL},
{"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},
@@ -397,6 +398,7 @@
CustomColors[MODCOLOR_SEPFACE] = GetSysColor(COLOR_BTNFACE);
CustomColors[MODCOLOR_SEPHILITE] = GetSysColor(COLOR_BTNHIGHLIGHT);
CustomColors[MODCOLOR_BLENDCOLOR] = GetSysColor(COLOR_BTNFACE);
+ CustomColors[MODCOLOR_DODGY_COMMANDS] = RGB(0xC0, 0x00, 0x00);
OnPreviewChanged();
}
@@ -429,6 +431,7 @@
CustomColors[MODCOLOR_SEPFACE] = RGB(0x40, 0x40, 0x80);
CustomColors[MODCOLOR_SEPHILITE] = RGB(0x99, 0x99, 0xCC);
CustomColors[MODCOLOR_BLENDCOLOR] = RGB(0x2E, 0x2E, 0x5A);
+ CustomColors[MODCOLOR_DODGY_COMMANDS] = RGB(0xC0, 0x40, 0x40);
OnPreviewChanged();
}
@@ -461,6 +464,7 @@
CustomColors[MODCOLOR_SEPFACE] = RGB(0x40, 0x68, 0x40);
CustomColors[MODCOLOR_SEPHILITE] = RGB(0x94, 0xBC, 0x94);
CustomColors[MODCOLOR_BLENDCOLOR] = RGB(0x00, 0x40, 0x00);
+ CustomColors[MODCOLOR_DODGY_COMMANDS] = RGB(0xFF, 0x80, 0x80);
OnPreviewChanged();
}
@@ -492,6 +496,7 @@
CustomColors[MODCOLOR_SEPFACE] = RGB(0xD6, 0xD0, 0xC6);
CustomColors[MODCOLOR_SEPHILITE] = RGB(0xEC, 0xE8, 0xE1);
CustomColors[MODCOLOR_BLENDCOLOR] = RGB(0xE1, 0xDB, 0xD0);
+ CustomColors[MODCOLOR_DODGY_COMMANDS] = RGB(0xC0, 0x00, 0x00);
OnPreviewChanged();
}
@@ -700,8 +705,8 @@
CHAR szPath[_MAX_PATH] = "";
BROWSEINFO bi;
- GetDlgItemText(nID, szPath, sizeof(szPath));
- memset(&bi, 0, sizeof(bi));
+ GetDlgItemText(nID, szPath, CountOf(szPath));
+ MemsetZero(bi);
bi.hwndOwner = m_hWnd;
bi.lpszTitle = "Select a default folder...";
bi.pszDisplayName = szPath;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sag...@us...> - 2011-02-08 11:09:26
|
Revision: 795
http://modplug.svn.sourceforge.net/modplug/?rev=795&view=rev
Author: saga-games
Date: 2011-02-08 11:09:20 +0000 (Tue, 08 Feb 2011)
Log Message:
-----------
[Fix] Pattern Editor: Changing a channel name from the pattern editor didn't set the document as modified (http://bugs.openmpt.org/view.php?id=65)
Modified Paths:
--------------
trunk/OpenMPT/mptrack/View_pat.cpp
Modified: trunk/OpenMPT/mptrack/View_pat.cpp
===================================================================
--- trunk/OpenMPT/mptrack/View_pat.cpp 2011-02-05 18:06:06 UTC (rev 794)
+++ trunk/OpenMPT/mptrack/View_pat.cpp 2011-02-08 11:09:20 UTC (rev 795)
@@ -5502,6 +5502,7 @@
if(dlg.DoModal() != IDOK || dlg.bChanged == false) return;
strcpy(pSndFile->ChnSettings[nChn].szName, dlg.m_sName);
+ pModDoc->SetModified();
pModDoc->UpdateAllViews(NULL, HINT_MODCHANNELS);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sag...@us...> - 2011-02-05 18:06:14
|
Revision: 794
http://modplug.svn.sourceforge.net/modplug/?rev=794&view=rev
Author: saga-games
Date: 2011-02-05 18:06:06 +0000 (Sat, 05 Feb 2011)
Log Message:
-----------
[Fix] When automatically entering note-offs in the pattern (MIDI or normal keyboard), keyboard split is now handled properly (apparently this broke some time after v1.18.03.00)
[Mod] OpenMPT: Version is now 1.19.00.22
Modified Paths:
--------------
trunk/OpenMPT/mptrack/View_pat.cpp
trunk/OpenMPT/mptrack/version.h
Modified: trunk/OpenMPT/mptrack/View_pat.cpp
===================================================================
--- trunk/OpenMPT/mptrack/View_pat.cpp 2011-01-31 23:32:12 UTC (rev 793)
+++ trunk/OpenMPT/mptrack/View_pat.cpp 2011-02-05 18:06:06 UTC (rev 794)
@@ -3242,8 +3242,8 @@
else nVol = (nVol + 3) / 4; //Value from [0,256] to [0,64]
TempEnterNote(nNote, true, nVol);
- // continue playing as soon as MIDI notes are being received (request 2813)
- if(pSndFile->IsPaused() && CMainFrame::m_dwMidiSetup & MIDISETUP_PLAYPATTERNONMIDIIN)
+ // continue playing as soon as MIDI notes are being received (http://forum.openmpt.org/index.php?topic=2813.0)
+ if(pSndFile->IsPaused() && (CMainFrame::m_dwMidiSetup & MIDISETUP_PLAYPATTERNONMIDIIN))
pModDoc->OnPatternPlayNoLoop();
break;
@@ -4025,7 +4025,7 @@
const UINT nTick = pSndFile->m_nTickCount;
const PATTERNINDEX nPatPlayback = pSndFile->m_nPattern;
- const bool isSplit = (note <= pModDoc->GetSplitKeyboardSettings()->splitNote);
+ const bool isSplit = (pModDoc->GetSplitKeyboardSettings()->IsSplitActive()) && (note <= pModDoc->GetSplitKeyboardSettings()->splitNote);
UINT ins = 0;
if (pModDoc)
{
@@ -4050,7 +4050,7 @@
}
//Enter note off in pattern?
- if ((note < 1) || (note > NOTE_MAX))
+ if ((note < NOTE_MIN) || (note > NOTE_MAX))
return;
if ((m_dwCursor & 7) > 1 && (bChordMode || !fromMidi))
return;
@@ -4066,7 +4066,9 @@
activeNoteMap[note] = 0xFF; //unlock channel
- if (!(CMainFrame::m_dwPatternSetup&PATTERN_KBDNOTEOFF || fromMidi)) {
+ if (!((CMainFrame::m_dwPatternSetup & PATTERN_KBDNOTEOFF) || fromMidi))
+ {
+ // We don't want to write the note-off into the pattern if this feature is disabled and we're not recording from MIDI.
return;
}
Modified: trunk/OpenMPT/mptrack/version.h
===================================================================
--- trunk/OpenMPT/mptrack/version.h 2011-01-31 23:32:12 UTC (rev 793)
+++ trunk/OpenMPT/mptrack/version.h 2011-02-05 18:06:06 UTC (rev 794)
@@ -15,7 +15,7 @@
#define VER_MAJORMAJOR 1
#define VER_MAJOR 19
#define VER_MINOR 00
-#define VER_MINORMINOR 21
+#define VER_MINORMINOR 22
//Creates version number from version parts that appears in version string.
//For example MAKE_VERSION_NUMERIC(1,17,02,28) gives version number of
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sag...@us...> - 2011-01-31 23:32:19
|
Revision: 793
http://modplug.svn.sourceforge.net/modplug/?rev=793&view=rev
Author: saga-games
Date: 2011-01-31 23:32:12 +0000 (Mon, 31 Jan 2011)
Log Message:
-----------
[Fix] IT Compatibility: Bidi loops are now treated like in IT's software mixer.
Modified Paths:
--------------
trunk/OpenMPT/mptrack/MainFrm.cpp
trunk/OpenMPT/mptrack/dlg_misc.cpp
trunk/OpenMPT/soundlib/Fastmix.cpp
trunk/OpenMPT/soundlib/Snd_defs.h
trunk/OpenMPT/soundlib/Sndfile.cpp
trunk/OpenMPT/soundlib/Sndfile.h
Modified: trunk/OpenMPT/mptrack/MainFrm.cpp
===================================================================
--- trunk/OpenMPT/mptrack/MainFrm.cpp 2011-01-30 14:50:20 UTC (rev 792)
+++ trunk/OpenMPT/mptrack/MainFrm.cpp 2011-01-31 23:32:12 UTC (rev 793)
@@ -1885,6 +1885,9 @@
const bool bPaused = pSndFile->IsPaused();
const bool bPatLoop = (pSndFile->m_dwSongFlags & SONG_PATTERNLOOP) ? true : false;
pSndFile->ResetChannels();
+ // Select correct bidi loop mode when playing a module.
+ pSndFile->SetupITBidiMode();
+
if ((m_pSndFile) || (m_dwStatus & MODSTATUS_PLAYING)) PauseMod();
if (((m_pSndFile) && (pSndFile != m_pSndFile)) || (!m_dwElapsedTime)) CSoundFile::ResetAGC();
m_pSndFile = pSndFile;
Modified: trunk/OpenMPT/mptrack/dlg_misc.cpp
===================================================================
--- trunk/OpenMPT/mptrack/dlg_misc.cpp 2011-01-30 14:50:20 UTC (rev 792)
+++ trunk/OpenMPT/mptrack/dlg_misc.cpp 2011-01-31 23:32:12 UTC (rev 793)
@@ -479,6 +479,8 @@
m_pSndFile->m_nDefaultRowsPerBeat = GetDlgItemInt(IDC_ROWSPERBEAT);
m_pSndFile->m_nDefaultRowsPerMeasure = GetDlgItemInt(IDC_ROWSPERMEASURE);
+ m_pSndFile->SetupITBidiMode();
+
if(CChannelManagerDlg::sharedInstance(FALSE) && CChannelManagerDlg::sharedInstance()->IsDisplayed())
CChannelManagerDlg::sharedInstance()->Update();
CDialog::OnOK();
@@ -1433,13 +1435,15 @@
combo->SetItemData(combo->AddString("No note"), 0);
AppendNotesToControlEx(*combo, pSndFile, m_nInstr);
- if (m_nNote <= NOTE_MAX)
+ if (NOTE_IS_VALID(m_nNote))
{
+ // Normal note / no note
const MODCOMMAND::NOTE noteStart = (pSndFile != nullptr) ? pSndFile->GetModSpecifications().noteMin : 1;
combo->SetCurSel(m_nNote - (noteStart - 1));
}
else
{
+ // Special notes
for(int i = combo->GetCount() - 1; i >= 0; --i)
{
if(combo->GetItemData(i) == m_nNote)
@@ -3191,7 +3195,6 @@
for(size_t n = 0; n < num; n++)
{
- CString temp;
FileHistory *hist = &(m_pModDoc->GetFileHistory()->at(n));
totalTime += hist->openTime;
@@ -3200,9 +3203,8 @@
_tcsftime(szDate, sizeof(szDate), _T("%d %b %Y, %H:%M:%S"), &hist->loadDate);
// Time + stuff
uint32 duration = (uint32)((double)(hist->openTime) / HISTORY_TIMER_PRECISION);
- temp.Format(_T("Loaded %s, open in the editor for %luh %02lum %02lus\r\n"),
+ s.AppendFormat(_T("Loaded %s, open in the editor for %luh %02lum %02lus\r\n"),
szDate, duration / 3600, (duration / 60) % 60, duration % 60);
- s += temp;
}
if(num == 0)
{
Modified: trunk/OpenMPT/soundlib/Fastmix.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Fastmix.cpp 2011-01-30 14:50:20 UTC (rev 792)
+++ trunk/OpenMPT/soundlib/Fastmix.cpp 2011-01-31 23:32:12 UTC (rev 793)
@@ -1479,8 +1479,8 @@
pChn->nPos = pChn->nLength - nDeltaHi - (nDeltaLo>>16);
pChn->nPosLo = nDeltaLo & 0xffff;
// Impulse Tracker's software mixer would put a -2 (instead of -1) in the following line (doesn't happen on a GUS)
- // TODO: How can we add IT compatibility here without slowing down the mixing routines?
- if ((pChn->nPos <= pChn->nLoopStart) || (pChn->nPos >= pChn->nLength)) pChn->nPos = pChn->nLength-1;
+ // The bidi mode flag is stored in a static CSoundFile variable. Dirty!
+ if ((pChn->nPos <= pChn->nLoopStart) || (pChn->nPos >= pChn->nLength)) pChn->nPos = pChn->nLength - (CSoundFile::m_bITBidiMode ? 2 : 1);
} else
{
if (nInc < 0) // This is a bug
Modified: trunk/OpenMPT/soundlib/Snd_defs.h
===================================================================
--- trunk/OpenMPT/soundlib/Snd_defs.h 2011-01-30 14:50:20 UTC (rev 792)
+++ trunk/OpenMPT/soundlib/Snd_defs.h 2011-01-31 23:32:12 UTC (rev 793)
@@ -349,7 +349,6 @@
#define SNDMIX_MAXDEFAULTPAN 0x80000 // Used by the MOD loader (currently unused)
#define SNDMIX_MUTECHNMODE 0x100000 // Notes are not played on muted channels
#define SNDMIX_SMARTRAMP 0x200000 // Don't apply ramping to sample beginning, but only when it ends
-#define SNDMIX_ITBIDIMODE 0x400000 // Process bidi loops like Impulse Tracker (see Fastmix.cpp for explanation)
#define MAX_GLOBAL_VOLUME 256
Modified: trunk/OpenMPT/soundlib/Sndfile.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Sndfile.cpp 2011-01-30 14:50:20 UTC (rev 792)
+++ trunk/OpenMPT/soundlib/Sndfile.cpp 2011-01-31 23:32:12 UTC (rev 793)
@@ -438,6 +438,7 @@
CTuningCollection* CSoundFile::s_pTuningsSharedBuiltIn(0);
CTuningCollection* CSoundFile::s_pTuningsSharedLocal(0);
uint8 CSoundFile::s_DefaultPlugVolumeHandling = PLUGIN_VOLUMEHANDLING_IGNORE;
+bool CSoundFile::m_bITBidiMode = false;
#pragma warning(disable : 4355) // "'this' : used in base member initializer list"
CSoundFile::CSoundFile() :
@@ -3031,6 +3032,7 @@
m_nType = newType;
SetModSpecsPointer(m_pModSpecs, m_nType);
SetupMODPanning(); // Setup LRRL panning scheme if needed
+ SetupITBidiMode(); // Setup IT bidi mode
m_ModFlags = m_ModFlags & GetModFlagMask(oldtype, newType);
@@ -3087,3 +3089,11 @@
ChnSettings[nChn].nPan = (((nChn & 3) == 1) || ((nChn & 3) == 2)) ? 0xC0 : 0x40;
}
}
+
+
+// Set or unset the IT bidi loop mode (see Fastmix.cpp for an explanation). The variable has to be static...
+void CSoundFile::SetupITBidiMode()
+//--------------------------------
+{
+ CSoundFile::m_bITBidiMode = IsCompatibleMode(TRK_IMPULSETRACKER);
+}
Modified: trunk/OpenMPT/soundlib/Sndfile.h
===================================================================
--- trunk/OpenMPT/soundlib/Sndfile.h 2011-01-30 14:50:20 UTC (rev 792)
+++ trunk/OpenMPT/soundlib/Sndfile.h 2011-01-31 23:32:12 UTC (rev 793)
@@ -107,7 +107,7 @@
INSTRUMENTENVELOPE PanEnv; // Panning envelope data
INSTRUMENTENVELOPE PitchEnv; // Pitch / filter envelope data
- BYTE NoteMap[128]; // Note mapping, f.e. C-5 => D-5
+ BYTE NoteMap[128]; // Note mapping, f.e. C-5 => D-5.
WORD Keyboard[128]; // Sample mapping, f.e. C-5 => Sample 1
BYTE nNNA; // New note action
@@ -376,6 +376,7 @@
CHAR szLibraryName[64]; // original DLL name
}; // Size should be 128
typedef SNDMIXPLUGININFO* PSNDMIXPLUGININFO;
+STATIC_ASSERT(sizeof(SNDMIXPLUGININFO) == 128); // this is directly written to files, so the size must be correct!
struct SNDMIXPLUGIN
{
@@ -452,6 +453,7 @@
CHAR szMidiZXXExt[128*32];
};
typedef MODMIDICFG* LPMODMIDICFG;
+STATIC_ASSERT(sizeof(MODMIDICFG) == 4896); // this is directly written to files, so the size must be correct!
typedef VOID (__cdecl * LPSNDMIXHOOKPROC)(int *, unsigned long, unsigned long); // buffer, samples, channels
@@ -581,11 +583,12 @@
static LPSNDMIXHOOKPROC gpSndMixHook;
static PMIXPLUGINCREATEPROC gpMixPluginCreateProc;
static uint8 s_DefaultPlugVolumeHandling;
+ static bool m_bITBidiMode; // Process bidi loops like Impulse Tracker (see Fastmix.cpp for an explanation)
public: // for Editing
- CModDoc* m_pModDoc;
+ CModDoc* m_pModDoc; // Can be a null pointer f.e. when previewing samples from the treeview.
MODTYPE m_nType;
CHANNELINDEX m_nChannels;
SAMPLEINDEX m_nSamples;
@@ -711,6 +714,8 @@
CHANNELINDEX ReArrangeChannels(const vector<CHANNELINDEX>& fromToArray);
bool MoveChannel(UINT chn_from, UINT chn_to);
+ void SetupITBidiMode();
+
bool InitChannel(CHANNELINDEX nChn);
void ResetChannelState(CHANNELINDEX chn, BYTE resetStyle);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sag...@us...> - 2011-01-30 14:50:26
|
Revision: 792
http://modplug.svn.sourceforge.net/modplug/?rev=792&view=rev
Author: saga-games
Date: 2011-01-30 14:50:20 +0000 (Sun, 30 Jan 2011)
Log Message:
-----------
[Fix] IT Loader: Try to fix loading some IT files that were extracted with unmo3.exe/.dll
[Fix] VST: Changed some stuff in the file selection code, now VOPM shouldn't crash anymore.
[Ref] Some small changes
[Mod] OpenMPT: Version is now 1.19.00.21
Modified Paths:
--------------
trunk/OpenMPT/mptrack/MainFrm.cpp
trunk/OpenMPT/mptrack/Moddoc.cpp
trunk/OpenMPT/mptrack/Vstplug.cpp
trunk/OpenMPT/mptrack/Vstplug.h
trunk/OpenMPT/mptrack/version.h
trunk/OpenMPT/soundlib/Load_it.cpp
Modified: trunk/OpenMPT/mptrack/MainFrm.cpp
===================================================================
--- trunk/OpenMPT/mptrack/MainFrm.cpp 2011-01-30 13:38:50 UTC (rev 791)
+++ trunk/OpenMPT/mptrack/MainFrm.cpp 2011-01-30 14:50:20 UTC (rev 792)
@@ -187,7 +187,7 @@
DWORD CMainFrame::m_nBitsPerSample = 16;
DWORD CMainFrame::m_nPreAmp = 128;
DWORD CMainFrame::gbLoopSong = TRUE;
-LONG CMainFrame::m_nWaveDevice = (SNDDEV_DSOUND << SNDDEV_DEVICE_SHIFT);
+LONG CMainFrame::m_nWaveDevice = SNDDEV_BUILD_ID(0, SNDDEV_DSOUND);
LONG CMainFrame::m_nMidiDevice = 0;
DWORD CMainFrame::m_nBufferLength = 75;
LONG CMainFrame::gnLVuMeter = 0;
@@ -713,10 +713,10 @@
// Check for valid sound device
if (!EnumerateSoundDevices(SNDDEV_GET_TYPE(m_nWaveDevice), SNDDEV_GET_NUMBER(m_nWaveDevice), nullptr, 0))
{
- m_nWaveDevice = (SNDDEV_DSOUND << SNDDEV_DEVICE_SHIFT);
+ m_nWaveDevice = SNDDEV_BUILD_ID(0, SNDDEV_DSOUND);
if (!EnumerateSoundDevices(SNDDEV_GET_TYPE(m_nWaveDevice), SNDDEV_GET_NUMBER(m_nWaveDevice), nullptr, 0))
{
- m_nWaveDevice = (SNDDEV_WAVEOUT << SNDDEV_DEVICE_SHIFT);
+ m_nWaveDevice = SNDDEV_BUILD_ID(0, SNDDEV_WAVEOUT);
}
}
// Default directory location
@@ -986,7 +986,8 @@
WritePrivateProfileDWord("Display", "MsgBoxVisibilityFlags", gnMsgBoxVisiblityFlags, iniFile);
CHAR s[16];
- for (int ncol=0; ncol<MAX_MODCOLORS; ncol++) {
+ for (int ncol=0; ncol<MAX_MODCOLORS; ncol++)
+ {
wsprintf(s, "Color%02d", ncol);
WritePrivateProfileDWord("Display", s, rgbCustomColors[ncol], iniFile);
}
Modified: trunk/OpenMPT/mptrack/Moddoc.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Moddoc.cpp 2011-01-30 13:38:50 UTC (rev 791)
+++ trunk/OpenMPT/mptrack/Moddoc.cpp 2011-01-30 14:50:20 UTC (rev 792)
@@ -1050,6 +1050,8 @@
}
+// Check if a given note of an instrument or sample is playing.
+// If note == 0, just check if an instrument or sample is playing.
BOOL CModDoc::IsNotePlaying(UINT note, UINT nsmp, UINT nins)
//----------------------------------------------------------
{
@@ -2299,9 +2301,7 @@
case sfx_drywet: chanSpec.Append("Plug wet/dry ratio"); break;
case sfx_cc: {
int nCC = MacroToMidiCC(macroText);
- CString temp;
- temp.Format("MidiCC %d", nCC);
- chanSpec.Append(temp);
+ chanSpec.AppendFormat("MidiCC %d", nCC);
break;
}
case sfx_plug: {
@@ -2318,9 +2318,7 @@
}
if (paramName[0] == 0)
strcpy(paramName, "N/A - no plug");
- CString temp;
- temp.Format("param %d (%s)", nParam, paramName);
- chanSpec.Append(temp);
+ chanSpec.AppendFormat("param %d (%s)", nParam, paramName);
break; }
case sfx_custom:
default: chanSpec.Append("Custom");
Modified: trunk/OpenMPT/mptrack/Vstplug.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Vstplug.cpp 2011-01-30 13:38:50 UTC (rev 791)
+++ trunk/OpenMPT/mptrack/Vstplug.cpp 2011-01-30 14:50:20 UTC (rev 792)
@@ -1070,6 +1070,7 @@
if(!destructor)
{
pFileSel->nbReturnPath = 0;
+ pFileSel->reserved = 0;
if(pFileSel->command != kVstDirectorySelect)
{
@@ -1130,24 +1131,32 @@
} else
{
// Single path
+
+ // VOPM doesn't initialize required information properly (it doesn't memset the struct to 0)...
+ if(!memcmp(&(effect->uniqueID), "MPOV", 4))
+ {
+ pFileSel->sizeReturnPath = _MAX_PATH;
+ }
+
if(pFileSel->returnPath == nullptr || pFileSel->sizeReturnPath == 0)
{
// Provide some memory for the return path.
- pFileSel->sizeReturnPath = files.first_file.length();
- pFileSel->returnPath = new char[pFileSel->sizeReturnPath + 1];
+ pFileSel->sizeReturnPath = files.first_file.length() + 1;
+ pFileSel->returnPath = new char[pFileSel->sizeReturnPath];
if(pFileSel->returnPath == nullptr)
{
return 0;
}
- pFileSel->returnPath[pFileSel->sizeReturnPath] = '\0';
+ pFileSel->returnPath[pFileSel->sizeReturnPath - 1] = '\0';
pFileSel->reserved = 1;
} else
{
pFileSel->reserved = 0;
}
- strncpy(pFileSel->returnPath, files.first_file.c_str(), pFileSel->sizeReturnPath);
+ strncpy(pFileSel->returnPath, files.first_file.c_str(), pFileSel->sizeReturnPath - 1);
pFileSel->nbReturnPath = 1;
+ pFileSel->returnMultiplePaths = nullptr;
}
return 1;
@@ -1179,25 +1188,25 @@
// old versions of reViSiT (which still relied on the host's file selection code) seem to be dodgy.
// They report a path size of 0, but when using an own buffer, they will crash.
// So we'll just assume that reViSiT can handle long enough (_MAX_PATH) paths here.
- pFileSel->sizeReturnPath = strlen(szBuffer);
- pFileSel->returnPath[pFileSel->sizeReturnPath] = '\0';
+ pFileSel->sizeReturnPath = strlen(szBuffer) + 1;
+ pFileSel->returnPath[pFileSel->sizeReturnPath - 1] = '\0';
}
if(pFileSel->returnPath == nullptr || pFileSel->sizeReturnPath == 0)
{
// Provide some memory for the return path.
- pFileSel->sizeReturnPath = strlen(szBuffer);
- pFileSel->returnPath = new char[pFileSel->sizeReturnPath + 1];
+ pFileSel->sizeReturnPath = strlen(szBuffer) + 1;
+ pFileSel->returnPath = new char[pFileSel->sizeReturnPath];
if(pFileSel->returnPath == nullptr)
{
return 0;
}
- pFileSel->returnPath[pFileSel->sizeReturnPath] = '\0';
+ pFileSel->returnPath[pFileSel->sizeReturnPath - 1] = '\0';
pFileSel->reserved = 1;
} else
{
pFileSel->reserved = 0;
}
- strncpy(pFileSel->returnPath, szBuffer, pFileSel->sizeReturnPath);
+ strncpy(pFileSel->returnPath, szBuffer, pFileSel->sizeReturnPath - 1);
pFileSel->nbReturnPath = 1;
return 1;
} else
@@ -2009,8 +2018,8 @@
}
//rewbs.VSTcompliance: changed from BOOL to long
-long CVstPlugin::GetNumParameters()
-//---------------------------------
+PlugParamIndex CVstPlugin::GetNumParameters()
+//-------------------------------------------
{
if ((m_pEffect) && (m_pEffect->numParams > 0))
{
@@ -2084,7 +2093,7 @@
bool success;
//Collect required data
- long numParams = GetNumParameters();
+ PlugParamIndex numParams = GetNumParameters();
long ID = GetUID();
long plugVersion = GetVersion();
float *params = new float[numParams];
@@ -2115,7 +2124,7 @@
}
bool CVstPlugin::LoadProgram(CString fileName)
-//------------------------------------
+//--------------------------------------------
{
if (!(m_pEffect))
return false;
Modified: trunk/OpenMPT/mptrack/Vstplug.h
===================================================================
--- trunk/OpenMPT/mptrack/Vstplug.h 2011-01-30 13:38:50 UTC (rev 791)
+++ trunk/OpenMPT/mptrack/Vstplug.h 2011-01-30 14:50:20 UTC (rev 792)
@@ -106,7 +106,7 @@
PVSTPLUGINLIB GetPluginFactory() const { return m_pFactory; }
BOOL HasEditor();
long GetNumPrograms();
- long GetNumParameters();
+ PlugParamIndex GetNumParameters();
long GetCurrentProgram();
long GetNumProgramCategories(); //rewbs.VSTpresets
long GetProgramNameIndexed(long index, long category, char *text); //rewbs.VSTpresets
@@ -198,13 +198,13 @@
void MidiPitchBend(UINT nMidiCh, short pitchBendPos);
#else // case: NO_VST
public:
- long GetNumParameters() {return 0;}
+ PlugParamIndex GetNumParameters() {return 0;}
VOID GetParamName(UINT, LPSTR, UINT) {}
void ToggleEditor() {}
BOOL HasEditor() {return FALSE;}
UINT GetNumCommands() {return 0;}
VOID GetPluginType(LPSTR) {}
- long GetNumPrograms() {return 0;}
+ PlugParamIndex GetNumPrograms() {return 0;}
long GetProgramNameIndexed(long, long, char*) {return 0;}
VOID SetParameter(PlugParamIndex nIndex, PlugParamValue fValue) {}
VOID GetParamLabel(UINT, LPSTR) {}
Modified: trunk/OpenMPT/mptrack/version.h
===================================================================
--- trunk/OpenMPT/mptrack/version.h 2011-01-30 13:38:50 UTC (rev 791)
+++ trunk/OpenMPT/mptrack/version.h 2011-01-30 14:50:20 UTC (rev 792)
@@ -15,7 +15,7 @@
#define VER_MAJORMAJOR 1
#define VER_MAJOR 19
#define VER_MINOR 00
-#define VER_MINORMINOR 20
+#define VER_MINORMINOR 21
//Creates version number from version parts that appears in version string.
//For example MAKE_VERSION_NUMERIC(1,17,02,28) gives version number of
Modified: trunk/OpenMPT/soundlib/Load_it.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Load_it.cpp 2011-01-30 13:38:50 UTC (rev 791)
+++ trunk/OpenMPT/soundlib/Load_it.cpp 2011-01-30 14:50:20 UTC (rev 792)
@@ -718,7 +718,7 @@
// the first parapointer, we assume that it's actually no history data.
if (dwMemPos + 2 < dwMemLength && (pifh->special & 0x02))
{
- size_t nflt = LittleEndianW(*((uint16*)(lpStream + dwMemPos)));
+ const size_t nflt = LittleEndianW(*((uint16*)(lpStream + dwMemPos)));
dwMemPos += 2;
if (nflt * 8 <= dwMemLength - dwMemPos && dwMemPos + nflt * 8 <= minptr)
@@ -766,6 +766,17 @@
dwMemPos -= 2;
}
}
+ // Another non-conforming application is unmo3 < v2.4.0.1, which doesn't set the special bit
+ // at all, but still writes the two edit history length bytes (zeroes)...
+ else if(dwMemPos + 2 < dwMemLength && pifh->highlight_major == 0 && pifh->highlight_minor == 0 && pifh->cmwt == 0x0214 && pifh->cwtv == 0x0214 && pifh->reserved == 0 && (pifh->special & (0x02|0x04)) == 0)
+ {
+ const size_t nflt = LittleEndianW(*((uint16*)(lpStream + dwMemPos)));
+ if(nflt == 0)
+ {
+ dwMemPos += 2;
+ }
+ }
+
// Reading MIDI Output & Macros
if (m_dwSongFlags & SONG_EMBEDMIDICFG)
{
@@ -866,9 +877,9 @@
continue;
}
- UINT ch = b & IT_bitmask_patternChanField_c; // 0x7f We have some data grab a byte keeping only 127 bits
+ UINT ch = b & IT_bitmask_patternChanField_c; // 0x7f We have some data grab a byte keeping only 7 bits
if (ch)
- ch = (ch - 1);// & IT_bitmask_patternChanMask_c; // 0x3f mask of the byte again, keeping only 64 bits
+ ch = (ch - 1);// & IT_bitmask_patternChanMask_c; // 0x3f mask of the byte again, keeping only 6 bits
if (b & IT_bitmask_patternChanEnabled_c) // 0x80 check if the upper bit is enabled.
{
@@ -2776,12 +2787,12 @@
const BYTE *p = (const BYTE *)pData;
UINT nPos = 0;
- while (nPos+8 < nLen) // so plugin data chunks must be multiples of 8 bytes?
+ while (nPos+8 < nLen) // read 4 magic bytes + size
{
DWORD nPluginSize;
UINT nPlugin;
- nPluginSize = *(DWORD *)(p+nPos+4); // why +4?
+ nPluginSize = *(DWORD *)(p+nPos+4);
if (nPluginSize > nLen-nPos-8) break;;
if ((*(DWORD *)(p+nPos)) == 'XFHC')
{
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sag...@us...> - 2011-01-30 13:38:59
|
Revision: 791
http://modplug.svn.sourceforge.net/modplug/?rev=791&view=rev
Author: saga-games
Date: 2011-01-30 13:38:50 +0000 (Sun, 30 Jan 2011)
Log Message:
-----------
[Fix] Sound Setup: Rev.788 pretty much broke the sample rate selection for ASIO devices... Now it should be working properly.
[Mod] Updated unmo3-free install scripts to point to a new download location for unmo3.dll
[Mod] Updated history.txt
Modified Paths:
--------------
trunk/OpenMPT/installer/install-unmo3-free-itd.iss
trunk/OpenMPT/installer/install-unmo3-free.iss
trunk/OpenMPT/mptrack/Mpdlgs.cpp
trunk/OpenMPT/mptrack/Mpdlgs.h
trunk/OpenMPT/packageTemplate/History.txt
Modified: trunk/OpenMPT/installer/install-unmo3-free-itd.iss
===================================================================
--- trunk/OpenMPT/installer/install-unmo3-free-itd.iss 2011-01-23 21:32:23 UTC (rev 790)
+++ trunk/OpenMPT/installer/install-unmo3-free-itd.iss 2011-01-30 13:38:50 UTC (rev 791)
@@ -21,7 +21,7 @@
begin
if(IsTaskSelected('downloadmo3') And FileExists(ExpandConstant('{tmp}\openmpt-unmo3.dll.tmp'))) then
begin
- if(GetSHA1OfFile(ExpandConstant('{tmp}\openmpt-unmo3.dll.tmp')) <> '2e17f7bb6d19ce326851333b918070c5357cacd1') then
+ if(GetSHA1OfFile(ExpandConstant('{tmp}\openmpt-unmo3.dll.tmp')) <> '393be7e0f50c62d142386a16d6855ca771025554') then
begin
MsgBox('Warning: unmo3.dll has been downloaded, but its checksum is wrong! This means that either the downloaded file is corrupted or that a newer version of unmo3.dll is available. The file has thus not been installed. Please obtain unmo3.dll from http://openmpt.com/ and verify its checksum.', mbCriticalError, MB_OK)
end else
@@ -51,7 +51,7 @@
begin
if(IsTaskSelected('downloadmo3')) then
begin
- ITD_AddMirror('http://openmpt.com/download/unmo3.dll', ExpandConstant('{tmp}\openmpt-unmo3.dll.tmp'));
+ ITD_AddMirror('http://openmpt.org/files/unmo3/2.4.0.1/unmo3.dll', ExpandConstant('{tmp}\openmpt-unmo3.dll.tmp'));
ITD_AddFile('ftp://ftp.untergrund.net/users/sagamusix/openmpt/unmo3.dll', ExpandConstant('{tmp}\openmpt-unmo3.dll.tmp'));
end else
begin
Modified: trunk/OpenMPT/installer/install-unmo3-free.iss
===================================================================
--- trunk/OpenMPT/installer/install-unmo3-free.iss 2011-01-23 21:32:23 UTC (rev 790)
+++ trunk/OpenMPT/installer/install-unmo3-free.iss 2011-01-30 13:38:50 UTC (rev 791)
@@ -15,14 +15,14 @@
#include "install.iss"
[_ISToolDownload]
-Source: http://openmpt.com/download/unmo3.dll; DestDir: {tmp}; DestName: openmpt-unmo3.dll.tmp; Tasks: downloadmo3
+Source: http://openmpt.org/files/unmo3/2.4.0.1/unmo3.dll; DestDir: {tmp}; DestName: openmpt-unmo3.dll.tmp; Tasks: downloadmo3
[Code]
// Verify checksum of downloaded file, and if it is OK, copy it to the app directory.
procedure VerifyUNMO3Checksum();
begin
if(IsTaskSelected('downloadmo3') And FileExists(ExpandConstant('{tmp}\openmpt-unmo3.dll.tmp'))) then
begin
- if(GetSHA1OfFile(ExpandConstant('{tmp}\openmpt-unmo3.dll.tmp')) <> '2e17f7bb6d19ce326851333b918070c5357cacd1') then
+ if(GetSHA1OfFile(ExpandConstant('{tmp}\openmpt-unmo3.dll.tmp')) <> '393be7e0f50c62d142386a16d6855ca771025554') then
begin
MsgBox('Warning: unmo3.dll has been downloaded, but its checksum is wrong! This means that either the downloaded file is corrupted or that a newer version of unmo3.dll is available. The file has thus not been installed. Please obtain unmo3.dll from http://openmpt.com/ and verify its checksum.', mbCriticalError, MB_OK)
end else
Modified: trunk/OpenMPT/mptrack/Mpdlgs.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Mpdlgs.cpp 2011-01-23 21:32:23 UTC (rev 790)
+++ trunk/OpenMPT/mptrack/Mpdlgs.cpp 2011-01-30 13:38:50 UTC (rev 791)
@@ -124,16 +124,8 @@
}
// Sampling Rate
- {
- UINT n = 1;
- for (UINT i=0; i<NUMMIXRATE; i++)
- {
- wsprintf(s, "%u Hz", nMixingRates[i]);
- m_CbnMixingFreq.AddString(s);
- if (m_dwRate == nMixingRates[i]) n = i;
- }
- m_CbnMixingFreq.SetCurSel(n);
- }
+ UpdateSampleRates(m_nSoundDevice);
+
// Max Mixing Channels
{
for (UINT n=0; n<8; n++)
@@ -225,7 +217,7 @@
nDev++;
}
}
- GetDlgItem(IDC_CHECK4)->EnableWindow(((m_nSoundDevice>>8)==SNDDEV_DSOUND) ? TRUE : FALSE);
+ GetDlgItem(IDC_CHECK4)->EnableWindow((SNDDEV_GET_TYPE(m_nSoundDevice) == SNDDEV_DSOUND) ? TRUE : FALSE);
}
// Sample Format
{
@@ -311,53 +303,66 @@
{
int dev = m_CbnDevice.GetItemData(n);
GetDlgItem(IDC_CHECK4)->EnableWindow((SNDDEV_GET_TYPE(dev) == SNDDEV_DSOUND) ? TRUE : FALSE);
-
- CHAR s[128];
- m_CbnMixingFreq.ResetContent();
+ UpdateSampleRates(dev);
+ OnSettingsChanged();
+ }
+}
- bool knowRates = false;
- vector<bool> supportedRates;
- vector<UINT> samplerates;
- for(size_t i = 0; i < NUMMIXRATE; i++)
+
+// Fill the dropdown box with a list of valid sample rates, depending on the selected sound device.
+void COptionsSoundcard::UpdateSampleRates(int dev)
+//------------------------------------------------
+{
+ CHAR s[16];
+ m_CbnMixingFreq.ResetContent();
+
+ vector<bool> supportedRates;
+ vector<UINT> samplerates;
+ for(size_t i = 0; i < NUMMIXRATE; i++)
+ {
+ samplerates.push_back(nMixingRates[i]);
+ }
+
+ ISoundDevice *dummy = nullptr;
+ bool justCreated = false, knowRates = false;
+ if(CMainFrame::m_nWaveDevice == dev)
+ {
+ // If this is the currently active sound device, it might already be playing something, so we shouldn't create yet another instance of it.
+ dummy = CMainFrame::gpSoundDevice;
+ }
+ if(dummy == nullptr)
+ {
+ justCreated = true;
+ CreateSoundDevice(SNDDEV_GET_TYPE(dev), &dummy);
+ }
+
+ if(dummy != nullptr)
+ {
+ // Now we can query the supported sample rates.
+ knowRates = dummy->CanSampleRate(SNDDEV_GET_NUMBER(dev), samplerates, supportedRates);
+ if(justCreated)
{
- samplerates.push_back(nMixingRates[i]);
- }
-
- ISoundDevice *dummy;
- if(CreateSoundDevice(SNDDEV_GET_TYPE(dev), &dummy))
- {
- knowRates = dummy->CanSampleRate(SNDDEV_GET_NUMBER(dev), samplerates, supportedRates);
delete dummy;
}
+ }
- if(knowRates)
+ if(!knowRates)
+ {
+ // We have no valid list of supported playback rates! Assume all rates supported by OpenMPT are possible...
+ supportedRates.assign(samplerates.size(), true);
+ }
+ int n = 1;
+ for(size_t i = 0; i < NUMMIXRATE; i++)
+ {
+ if(supportedRates[i])
{
- // We have a valid list of supported playback rates.
- int n = 1;
- for(size_t i = 0; i < NUMMIXRATE; i++)
- {
- if(supportedRates[i])
- {
- wsprintf(s, "%u Hz", nMixingRates[i]);
- int pos = m_CbnMixingFreq.AddString(s);
- if (m_dwRate == nMixingRates[i]) n = pos;
- }
- }
- m_CbnMixingFreq.SetCurSel(n);
- } else
- {
- // Rates supported by the device are not known, show all rates supported by OpenMPT instead.
- UINT n = 1;
- for (UINT i=0; i<NUMMIXRATE; i++)
- {
- wsprintf(s, "%u Hz", nMixingRates[i]);
- m_CbnMixingFreq.AddString(s);
- if (m_dwRate == nMixingRates[i]) n = i;
- }
- m_CbnMixingFreq.SetCurSel(n);
+ wsprintf(s, "%u Hz", nMixingRates[i]);
+ int pos = m_CbnMixingFreq.AddString(s);
+ m_CbnMixingFreq.SetItemData(pos, nMixingRates[i]);
+ if(m_dwRate == nMixingRates[i]) n = pos;
}
- OnSettingsChanged();
}
+ m_CbnMixingFreq.SetCurSel(n);
}
@@ -379,9 +384,7 @@
if (IsDlgButtonChecked(IDC_CHECK4)) m_dwSoundSetup |= SOUNDSETUP_SECONDARY;
// Mixing Freq
{
- UINT n = m_CbnMixingFreq.GetCurSel();
- if (n >= NUMMIXRATE) n = 3;
- m_dwRate = nMixingRates[n];
+ m_dwRate = m_CbnMixingFreq.GetItemData(m_CbnMixingFreq.GetCurSel());
}
// Quality
{
Modified: trunk/OpenMPT/mptrack/Mpdlgs.h
===================================================================
--- trunk/OpenMPT/mptrack/Mpdlgs.h 2011-01-23 21:32:23 UTC (rev 790)
+++ trunk/OpenMPT/mptrack/Mpdlgs.h 2011-01-30 13:38:50 UTC (rev 791)
@@ -25,6 +25,7 @@
m_nBufferLength = bufsize; m_nSoundDevice = sd; m_PreAmpNoteShowed = false;}
private:
+ void UpdateSampleRates(int dev);
void SetPreAmpSliderPosition();
protected:
Modified: trunk/OpenMPT/packageTemplate/History.txt
===================================================================
--- trunk/OpenMPT/packageTemplate/History.txt 2011-01-23 21:32:23 UTC (rev 790)
+++ trunk/OpenMPT/packageTemplate/History.txt 2011-01-30 13:38:50 UTC (rev 791)
@@ -10,7 +10,7 @@
(tx XYZ): thanks to XYZ for telling us about the bug
-v1.19.01.00 (January 2011, revision 781)
+v1.19.01.00 (January 2011, revision 791)
----------------------------------------
Pattern tab
[New] <Jojo> Clicking and dragging the row numbers selects the whole row now (Excel / Calc style) - see http://bugs.openmpt.org/view.php?id=45
@@ -22,6 +22,8 @@
[Fix] <Jojo> When entering chords into the pattern editor, the module was only marked as modified if the base note of the chord was changed.
[Fix] <Jojo> When jumping to an order which is normally not played, the song variables are now reset (previously, if the main song had f.e. a global volume fade out at the end, this was retained when switching to an unplayed order, effectively muting all sub songs).
[Fix] <Jojo> OpenMPT should not crash anymore when applying the Amplify command on a pattern selection that just covers the note / instrument column of the first channel.
+ [Fix] <Jojo> Queueing a "---" or "+++" item now automatically moves the queue "cursor" to the next available pattern. Previously, queueing a "---" pattern restarted the song.
+ [Fix] <Jojo> When restarting a pattern, the timer was not reset properly.
[Reg] <Jojo> The "Position aware timer" option is gone. The position aware timer is now automatically used. It was optional in the first place because of some buggy code, which is now fixed.
Pattern tab::Note properties
@@ -36,14 +38,17 @@
Sample tab
[New] <Jojo> The new "sample grid" feature can create equally-sized sample selections, so it is f.e. easy to split a sample into four equally-sized samples.
[Imp] <re> Ctrl + Mouse Wheel can now be used for zooming into the sample data.
- [Mod] <Jojo> Undo steps have been increased from 100 to 1000.
+ [Mod] <Jojo> Undo steps have been increased from 100 to 1000 (per sample).
[Fix] <Jojo> When cutting samples with a loop, the loop end point was not always moved correctly if the cut start was in the loop.
[Fix] <re> Changing zoom level should now preserve the view position better.
Instrument tab
[Imp] <re> Ctrl + Mouse Wheel can now be used for zooming into the envelopes.
+ [Imp] <Jojo> When pressing the up arrow key in the sample map while the cursor is on the lowest note (C-0), the sample map doesn't lose focus anymore. It is also not possible anymore to move the sample map out of view by clicking the area above the lowest note.
[Mod] <Jojo> Copying and pasting envelopes with no points isn't possible anymore. (Who wants to do that anyway?)
[Fix] <Jojo> Changing the filter mode didn't mark the file as modified.
+ [Fix] <Jojo> The note mapping doesn't allow items anymore that aren't notes (such as "no note" or "note cut"). Such notes couldn't be entered manually, however when converting from other formats this was possible and it could crash the tracker (http://bugs.openmpt.org/view.php?id=61).
+ [Fix] <Jojo> Various actions in the instrument note map and envelope view should now also mark the instrument as modified (when working in the ITP format).
Mod Conversion
[Imp] <Jojo> When converting patterns from a format with instruments to a format without instruments (or when removing all instruments using the cleanup dialog), the instrument note mapping is now also taken care of.
@@ -59,14 +64,15 @@
[Fix] <Jojo> Pattern jumps to the same row + pattern as the jump command are not ignored anymore. (http://forum.openmpt.org/index.php?topic=1810.0)
IT
- [New] <Jojo> Edit history information can now be read from IT files and saved to IT / MPTM files. This is based on an undocumented feature in Impulse Tracker. Use View -> Edit History for viewing or deleting this information.
- [Imp] <Jojo> ITs made with Modplug Tracker 1.00a5 are now also detected as such.
+ [New] <Jojo> Edit history information can now be read from and saved to IT / MPTM files. This is based on an undocumented feature in Impulse Tracker. Use View -> Edit History for viewing or deleting this information.
+ [Imp] <Jojo> IT files made with Modplug Tracker 1.00a5 are now also detected as such.
[Mod] <Jojo> Sane values are used again for the "cwtv" and "cmwt" header fields when saving IT files; in fact the same values as in compatibility export are used. To be able to distinguish between raped and compatibility-exported IT files, "OMPT" is written in the "reserved" header field. As a consequence, IT files made with OpenMPT can now be loaded in Impulse Tracker again.
[Mod] <Jojo> IT Loader: MIDI macros are now cleared when loading IT files made with old Impulse Tracker versions (< 2.14), so that Zxx commands won't break the songs anymore (fixes denonde.it, fix from Schism Tracker).
[Fix] <Jojo> Sample autovibrato is now hopefully a bit closer to Impulse Tracker in compatible mode...
[Fix] <Jojo> The envelope handling was altered slightly to work more like in Schism Tracker. This fixes a combination of Envelope Carry + Portamento as it can be found in "electric bunny" by Alpha C.
[Fix] <Jojo> Various fixes to playback of multi-sample instruments. "Ultima Ratio" by Nebularia and "Shuttle Departure" by Sphenx sound better now.
[Fix] <Jojo> The extended sample map is not saved anymore in the instrument headers when using compatibility export.
+ [Fix] <Jojo> IT Loader / Saver: Note mapping items that aren't notes are now ignored.
MPTM
[New] <Jojo> Each pattern can now have a custom time signature (rows per beat and rows per measure) which can be set from the pattern properties dialog.
@@ -99,7 +105,7 @@
[Mod] <Jojo> When automatically inserting a new instrument from the VST editor, the bank and patch values are now not filled in anymore, so it is easier to change to another patch while editing.
[Mod] <Jojo> Various small improvements to support VST 2.4 plugins better.
[Fix] <Jojo> Speaker arrangement is now sent to the plugins upon initialization. This fixes Voxengo SPAN 2 (a VST 2.4 plugin). Does this break other multichannel plugins?
- [Fix] <Jojo> The time signature sent to VST plugins should be correct now.
+ [Fix] <Jojo> The time signature sent to VST plugins should be correct now. The denominator is always assumed to be 4, so a 6/8 signature is for example not possible.
Other modules
[Imp] <Jojo> Garbage characters in sample / instrument / song names should be gone now.. This should f.e. avoid sample names like " ntitled" turning up in modules after deleting sample names.
@@ -111,14 +117,17 @@
Misc
[New] <Jojo> WAV Export: Sample-exact cue points are now written at each pattern transition.
+ [Imp] <Jojo> Paths to VST plugins in mptrack.ini and plugin.cache are now also relative in portable mode. This means that finally, *all* stored paths are now relative in portable mode.
[Imp] <Jojo> New keyboard shortcuts: Panic, View Edit History, Set Invalid / Ignore (--- / +++) Pattern (in the orderlist)
[Imp] <Jojo> Some improvements were made to the Registry / INI reading: If there were no Registry settings because MPT 1.16 was previously not installed, the INI file is now also read as it might contain some lines created by the installer.
+ [Imp] <Jojo> Sound Setup: For ASIO devices, only supported sampling rates are now shown.
[Mod] <Jojo> Changes to keymap file handling: The active keymap is now always saved to Keybindings.mkb (in either %APPDATA%\OpenMPT or the executable's directory). Any other keymaps are now only overwritten when using the "Save keys as" function.
[Mod] <Jojo> On first run, the default ASIO driver is now chosen instead of DirectSound (if there is one).
[Mod] <Jojo> The "Original" mix mode now also has a version number (1.16) to reflect what the "original" thing is.
[Mod] <Jojo> Updated genre list in the MP3 export dialog.
[Mod] <Jojo> When using the ACM MP3 codec, 320kbit/s bitrate should now theoretically be available.
[Mod] <Jojo> The MMX acceleration label in the Soundcard setup dialog is now updated according to the multimedia extensions that are supported by the CPU (3DNow! / SSE)
+ [Mod] <Jojo> Updated unmo3.dll to version 2.4.0.1
[Fix] <Jojo> Mod Cleanup: Rearrange patterns was broken when using more than one sequence in the MPTM format. (tx Skaven)
[Fix] <Jojo> Mod Cleanup: Various sample / instrument rearranging functions broke PC Notes.
[Fix] <Jojo> The text length was calculated wrong in the message reader, leading to a possible buffer overflow when reading song messages with mixed line endings where CR or LF line endings where expected.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rel...@us...> - 2011-01-23 21:32:29
|
Revision: 790
http://modplug.svn.sourceforge.net/modplug/?rev=790&view=rev
Author: relabsoluness
Date: 2011-01-23 21:32:23 +0000 (Sun, 23 Jan 2011)
Log Message:
-----------
[Fix] DSL loader: Fix to code level bug in instrument loading.
Modified Paths:
--------------
trunk/OpenMPT/mptrack/Moddoc.cpp
trunk/OpenMPT/soundlib/Dlsbank.cpp
Modified: trunk/OpenMPT/mptrack/Moddoc.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Moddoc.cpp 2011-01-16 21:41:10 UTC (rev 789)
+++ trunk/OpenMPT/mptrack/Moddoc.cpp 2011-01-23 21:32:23 UTC (rev 790)
@@ -254,12 +254,15 @@
if (dwKey < 0x80) nDrumRgn = pEmbeddedBank->GetRegionFromKey(nDlsIns, dwKey);
if (pEmbeddedBank->ExtractInstrument(&m_SndFile, nIns, nDlsIns, nDrumRgn))
{
+ pIns = m_SndFile.Instruments[nIns]; // Reset pIns because ExtractInstrument may delete the previous value.
if ((dwKey >= 24) && (dwKey < 100))
{
lstrcpyn(pIns->name, szMidiPercussionNames[dwKey-24], sizeof(pIns->name));
}
bEmbedded = TRUE;
}
+ else
+ pIns = m_SndFile.Instruments[nIns]; // Reset pIns because ExtractInstrument may delete the previous value.
}
}
if ((pszMidiMapName) && (pszMidiMapName[0]) && (!bEmbedded))
@@ -293,6 +296,7 @@
{
if (dwKey < 0x80) nDrumRgn = pDLSBank->GetRegionFromKey(nDlsIns, dwKey);
pDLSBank->ExtractInstrument(&m_SndFile, nIns, nDlsIns, nDrumRgn);
+ pIns = m_SndFile.Instruments[nIns]; // Reset pIns because ExtractInstrument may delete the previous value.
if ((dwKey >= 24) && (dwKey < 24+61))
{
lstrcpyn(pIns->name, szMidiPercussionNames[dwKey-24], sizeof(pIns->name));
Modified: trunk/OpenMPT/soundlib/Dlsbank.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Dlsbank.cpp 2011-01-16 21:41:10 UTC (rev 789)
+++ trunk/OpenMPT/soundlib/Dlsbank.cpp 2011-01-23 21:32:23 UTC (rev 790)
@@ -1641,7 +1641,7 @@
#endif
pIns = new MODINSTRUMENT;
if (!pIns) return FALSE;
- memset(pIns, 0, sizeof(MODINSTRUMENT));
+ MemsetZero(*pIns);
pIns->pTuning = pIns->s_DefaultTuning;
if (pSndFile->Instruments[nInstr])
{
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sag...@us...> - 2011-01-16 21:41:16
|
Revision: 789
http://modplug.svn.sourceforge.net/modplug/?rev=789&view=rev
Author: saga-games
Date: 2011-01-16 21:41:10 +0000 (Sun, 16 Jan 2011)
Log Message:
-----------
[Imp] Paths to VST plugins in mptrack.ini and plugin.cache are now also relative in portable mode.
[Mod] OpenMPT: Version is now 1.19.00.20
Modified Paths:
--------------
trunk/OpenMPT/mptrack/Mptrack.cpp
trunk/OpenMPT/mptrack/Vstplug.cpp
trunk/OpenMPT/mptrack/version.h
Modified: trunk/OpenMPT/mptrack/Mptrack.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Mptrack.cpp 2011-01-16 21:39:44 UTC (rev 788)
+++ trunk/OpenMPT/mptrack/Mptrack.cpp 2011-01-16 21:41:10 UTC (rev 789)
@@ -3048,7 +3048,7 @@
BOOL CTrackApp::InitializeDXPlugins()
//-----------------------------------
{
- CHAR s[_MAX_PATH], tmp[32];
+ TCHAR s[_MAX_PATH], tmp[32];
LONG nPlugins;
m_pPluginManager = new CVstPluginManager;
@@ -3071,7 +3071,11 @@
s[0] = 0;
wsprintf(tmp, "Plugin%d", iPlug);
GetPrivateProfileString("VST Plugins", tmp, "", s, sizeof(s), m_szConfigFileName);
- if (s[0]) m_pPluginManager->AddPlugin(s, TRUE, true, &nonFoundPlugs);
+ if (s[0])
+ {
+ CMainFrame::RelativePathToAbsolute(s);
+ m_pPluginManager->AddPlugin(s, TRUE, true, &nonFoundPlugs);
+ }
}
if(nonFoundPlugs.GetLength() > 0)
{
@@ -3085,7 +3089,7 @@
BOOL CTrackApp::UninitializeDXPlugins()
//-------------------------------------
{
- CHAR s[_MAX_PATH], tmp[32];
+ TCHAR s[_MAX_PATH], tmp[32];
PVSTPLUGINLIB pPlug;
UINT iPlug;
@@ -3099,6 +3103,10 @@
s[0] = 0;
wsprintf(tmp, "Plugin%d", iPlug);
strcpy(s, pPlug->szDllPath);
+ if(theApp.IsPortableMode())
+ {
+ CMainFrame::AbsolutePathToRelative(s);
+ }
WritePrivateProfileString("VST Plugins", tmp, s, m_szConfigFileName);
iPlug++;
}
Modified: trunk/OpenMPT/mptrack/Vstplug.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Vstplug.cpp 2011-01-16 21:39:44 UTC (rev 788)
+++ trunk/OpenMPT/mptrack/Vstplug.cpp 2011-01-16 21:41:10 UTC (rev 789)
@@ -189,6 +189,8 @@
PVSTPLUGINLIB CVstPluginManager::AddPlugin(LPCSTR pszDllPath, BOOL bCache, const bool checkFileExistence, CString* const errStr)
//------------------------------------------------------------------------------------------------------------------------------
{
+ TCHAR szPath[_MAX_PATH];
+
if(checkFileExistence && (PathFileExists(pszDllPath) == FALSE))
{
if(errStr)
@@ -207,8 +209,8 @@
// Look if the plugin info is stored in the PluginCache
if (bCache)
{
- CString cacheSection = "PluginCache";
- CString cacheFile = theApp.GetPluginCacheFileName();
+ const CString cacheSection = "PluginCache";
+ const CString cacheFile = theApp.GetPluginCacheFileName();
char fileName[_MAX_PATH];
_splitpath(pszDllPath, NULL, NULL, fileName, NULL);
@@ -216,8 +218,12 @@
if (IDs.GetLength() >= 16)
{
- CString fullPath = CMainFrame::GetPrivateProfileCString(cacheSection, IDs, "", cacheFile);
- if ((fullPath) && (fullPath[0]) && (!lstrcmpi(fullPath, pszDllPath)))
+ // Get path from cache file
+ GetPrivateProfileString(cacheSection, IDs, "", szPath, CountOf(szPath) - 1, cacheFile);
+ SetNullTerminator(szPath);
+ CMainFrame::RelativePathToAbsolute(szPath);
+
+ if ((szPath[0]) && (!lstrcmpi(szPath, pszDllPath)))
{
PVSTPLUGINLIB p = new VSTPLUGINLIB;
if (!p) return NULL;
@@ -352,6 +358,15 @@
CString IDs, flagsKey;
IDs.Format("%08X%08X", p->dwPluginId1, p->dwPluginId2);
flagsKey.Format("%s.Flags", IDs);
+
+ _tcsncpy(szPath, pszDllPath, CountOf(szPath) - 1);
+ if(theApp.IsPortableMode())
+ {
+ CMainFrame::AbsolutePathToRelative(szPath);
+ }
+ SetNullTerminator(szPath);
+
+ WritePrivateProfileString(cacheSection, IDs, szPath, cacheFile);
CMainFrame::WritePrivateProfileCString(cacheSection, IDs, pszDllPath, cacheFile);
CMainFrame::WritePrivateProfileCString(cacheSection, p->szLibraryName, IDs, cacheFile);
CMainFrame::WritePrivateProfileLong(cacheSection, flagsKey, p->bIsInstrument, cacheFile);
Modified: trunk/OpenMPT/mptrack/version.h
===================================================================
--- trunk/OpenMPT/mptrack/version.h 2011-01-16 21:39:44 UTC (rev 788)
+++ trunk/OpenMPT/mptrack/version.h 2011-01-16 21:41:10 UTC (rev 789)
@@ -15,7 +15,7 @@
#define VER_MAJORMAJOR 1
#define VER_MAJOR 19
#define VER_MINOR 00
-#define VER_MINORMINOR 19
+#define VER_MINORMINOR 20
//Creates version number from version parts that appears in version string.
//For example MAKE_VERSION_NUMERIC(1,17,02,28) gives version number of
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sag...@us...> - 2011-01-16 21:39:51
|
Revision: 788
http://modplug.svn.sourceforge.net/modplug/?rev=788&view=rev
Author: saga-games
Date: 2011-01-16 21:39:44 +0000 (Sun, 16 Jan 2011)
Log Message:
-----------
[Fix] Sample Editor: rev.781 broke the Downsample button. It was allocating too much memory (if it actually succeeded in requesting it).
[Imp] Sound Setup: For ASIO devices, only supported sampling rates are now shown.
Modified Paths:
--------------
trunk/OpenMPT/mptrack/Ctrl_smp.cpp
trunk/OpenMPT/mptrack/Mpdlgs.cpp
trunk/OpenMPT/soundlib/SNDDEV.H
trunk/OpenMPT/soundlib/SNDDEVX.H
trunk/OpenMPT/soundlib/Snddev.cpp
Modified: trunk/OpenMPT/mptrack/Ctrl_smp.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Ctrl_smp.cpp 2011-01-15 16:41:51 UTC (rev 787)
+++ trunk/OpenMPT/mptrack/Ctrl_smp.cpp 2011-01-16 21:39:44 UTC (rev 788)
@@ -1526,7 +1526,7 @@
dwStart = 0;
dwEnd = pSmp->nLength;
}
- smplsize = pSmp->GetSampleSizeInBytes();
+ smplsize = pSmp->GetBytesPerSample();
pOriginal = pSmp->pSample;
dwRemove = (dwEnd-dwStart+1)>>1;
dwNewLen = pSmp->nLength - dwRemove;
@@ -1633,7 +1633,7 @@
#define MAX_BUFFER_LENGTH 8192
-#define CLIP_SOUND(v) v = v < -1.0f ? -1.0f : v > 1.0f ? 1.0f : v
+#define CLIP_SOUND(v) Limit(v, -1.0f, 1.0f);
void CCtrlSamples::ReadTimeStretchParameters()
//--------------------------------------------
@@ -2122,7 +2122,8 @@
for(UINT j = startoffset ; j < len + finaloffset ; j++){
// Just perform a little bit of clipping...
- float v = outbuf[j]; CLIP_SOUND(v);
+ float v = outbuf[j];
+ CLIP_SOUND(v);
// ...before converting back to buffer
switch(smpsize){
case 2:
@@ -3060,7 +3061,7 @@
return points;
}
-// Set the currently select part of the sample.
+// Set the currently selected part of the sample.
// To reset the selection, use nStart = nEnd = 0.
void CCtrlSamples::SetSelectionPoints(UINT nStart, UINT nEnd)
//-----------------------------------------------------------
Modified: trunk/OpenMPT/mptrack/Mpdlgs.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Mpdlgs.cpp 2011-01-15 16:41:51 UTC (rev 787)
+++ trunk/OpenMPT/mptrack/Mpdlgs.cpp 2011-01-16 21:39:44 UTC (rev 788)
@@ -217,7 +217,7 @@
cbi.iSelectedImage = cbi.iImage;
cbi.iOverlay = cbi.iImage;
cbi.iIndent = 0;
- cbi.lParam = (nDevType<<8)|(nDev&0xff);
+ cbi.lParam = SNDDEV_BUILD_ID(nDev, nDevType);
cbi.pszText = s;
int pos = m_CbnDevice.InsertItem(&cbi);
if (cbi.lParam == (LONG)m_nSoundDevice) m_CbnDevice.SetCurSel(pos);
@@ -310,7 +310,52 @@
if (n >= 0)
{
int dev = m_CbnDevice.GetItemData(n);
- GetDlgItem(IDC_CHECK4)->EnableWindow(((dev>>8)==SNDDEV_DSOUND) ? TRUE : FALSE);
+ GetDlgItem(IDC_CHECK4)->EnableWindow((SNDDEV_GET_TYPE(dev) == SNDDEV_DSOUND) ? TRUE : FALSE);
+
+ CHAR s[128];
+ m_CbnMixingFreq.ResetContent();
+
+ bool knowRates = false;
+ vector<bool> supportedRates;
+ vector<UINT> samplerates;
+ for(size_t i = 0; i < NUMMIXRATE; i++)
+ {
+ samplerates.push_back(nMixingRates[i]);
+ }
+
+ ISoundDevice *dummy;
+ if(CreateSoundDevice(SNDDEV_GET_TYPE(dev), &dummy))
+ {
+ knowRates = dummy->CanSampleRate(SNDDEV_GET_NUMBER(dev), samplerates, supportedRates);
+ delete dummy;
+ }
+
+ if(knowRates)
+ {
+ // We have a valid list of supported playback rates.
+ int n = 1;
+ for(size_t i = 0; i < NUMMIXRATE; i++)
+ {
+ if(supportedRates[i])
+ {
+ wsprintf(s, "%u Hz", nMixingRates[i]);
+ int pos = m_CbnMixingFreq.AddString(s);
+ if (m_dwRate == nMixingRates[i]) n = pos;
+ }
+ }
+ m_CbnMixingFreq.SetCurSel(n);
+ } else
+ {
+ // Rates supported by the device are not known, show all rates supported by OpenMPT instead.
+ UINT n = 1;
+ for (UINT i=0; i<NUMMIXRATE; i++)
+ {
+ wsprintf(s, "%u Hz", nMixingRates[i]);
+ m_CbnMixingFreq.AddString(s);
+ if (m_dwRate == nMixingRates[i]) n = i;
+ }
+ m_CbnMixingFreq.SetCurSel(n);
+ }
OnSettingsChanged();
}
}
Modified: trunk/OpenMPT/soundlib/SNDDEV.H
===================================================================
--- trunk/OpenMPT/soundlib/SNDDEV.H 2011-01-15 16:41:51 UTC (rev 787)
+++ trunk/OpenMPT/soundlib/SNDDEV.H 2011-01-16 21:39:44 UTC (rev 788)
@@ -30,10 +30,11 @@
SNDDEV_NUM_DEVTYPES
};
-#define SNDDEV_DEVICE_MASK 0xFF // Mask for getting the device number
-#define SNDDEV_DEVICE_SHIFT 8 // Shift amount for getting the device type
-#define SNDDEV_GET_NUMBER(x) (x & SNDDEV_DEVICE_MASK) // Use this for getting the device number
-#define SNDDEV_GET_TYPE(x) (x >> SNDDEV_DEVICE_SHIFT) // ...and this for getting the device type
+#define SNDDEV_DEVICE_MASK 0xFF // Mask for getting the device number
+#define SNDDEV_DEVICE_SHIFT 8 // Shift amount for getting the device type
+#define SNDDEV_GET_NUMBER(x) (x & SNDDEV_DEVICE_MASK) // Use this for getting the device number
+#define SNDDEV_GET_TYPE(x) (x >> SNDDEV_DEVICE_SHIFT) // ...and this for getting the device type
+#define SNDDEV_BUILD_ID(number, type) ((number & SNDDEV_DEVICE_MASK) | (type << SNDDEV_DEVICE_SHIFT)) // Build a sound device ID from device number and device type.
#define SNDDEV_MINBUFFERS 2
#define SNDDEV_MAXBUFFERS 16
@@ -80,6 +81,8 @@
virtual UINT GetCurrentLatency() = 0;
virtual void SilenceAudioBuffer(ISoundSource *pSource, ULONG nMaxLatency, DWORD dwUser=0) = 0;
virtual UINT GetCurrentSampleRate(UINT nDevice) { UNREFERENCED_PARAMETER(nDevice); return 0; }
+ // Return which samplerates are actually supported by the device. Currently only implemented properly for ASIO.
+ virtual bool CanSampleRate(UINT nDevice, vector<UINT> &samplerates, vector<bool> &result) { UNREFERENCED_PARAMETER(nDevice); result.assign(samplerates.size(), true); return true; } ;
};
Modified: trunk/OpenMPT/soundlib/SNDDEVX.H
===================================================================
--- trunk/OpenMPT/soundlib/SNDDEVX.H 2011-01-15 16:41:51 UTC (rev 787)
+++ trunk/OpenMPT/soundlib/SNDDEVX.H 2011-01-16 21:39:44 UTC (rev 788)
@@ -131,6 +131,7 @@
UINT GetCurrentLatency() { return m_nAsioBufferLen; }
void SilenceAudioBuffer(ISoundSource *pSource, ULONG nMaxLatency, DWORD dwBuffer);
+ bool CanSampleRate(UINT nDevice, vector<UINT> &samplerates, vector<bool> &result);
UINT GetCurrentSampleRate(UINT nDevice);
public:
Modified: trunk/OpenMPT/soundlib/Snddev.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Snddev.cpp 2011-01-15 16:41:51 UTC (rev 787)
+++ trunk/OpenMPT/soundlib/Snddev.cpp 2011-01-16 21:39:44 UTC (rev 788)
@@ -1,4 +1,6 @@
#include "stdafx.h"
+#include <vector>
+using std::vector;
#include "snddev.h"
#include "snddevx.h"
@@ -1301,6 +1303,39 @@
}
+bool CASIODevice::CanSampleRate(UINT nDevice, vector<UINT> &samplerates, vector<bool> &result)
+//--------------------------------------------------------------------------------------------
+{
+ const bool wasOpen = (m_pAsioDrv != NULL);
+ if(!wasOpen)
+ {
+ OpenDevice(nDevice);
+ if(m_pAsioDrv == NULL)
+ {
+ return false;
+ }
+ }
+
+ bool foundSomething = false; // is at least one sample rate supported by the device?
+ result.clear();
+ for(size_t i = 0; i < samplerates.size(); i++)
+ {
+ result.push_back((m_pAsioDrv->canSampleRate((ASIOSampleRate)samplerates[i]) == ASE_OK));
+ if(result.back())
+ {
+ foundSomething = true;
+ }
+ }
+
+ if(!wasOpen)
+ {
+ CloseDevice();
+ }
+
+ return foundSomething;
+}
+
+
// If the device is open, this returns the current sample rate. If it's not open, it returns some sample rate supported by the device.
UINT CASIODevice::GetCurrentSampleRate(UINT nDevice)
//--------------------------------------------------
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sag...@us...> - 2011-01-15 16:42:03
|
Revision: 787
http://modplug.svn.sourceforge.net/modplug/?rev=787&view=rev
Author: saga-games
Date: 2011-01-15 16:41:51 +0000 (Sat, 15 Jan 2011)
Log Message:
-----------
The previous commit unintentionally included an updated install script. The new "unmo3-free" install script has now been moved to install-unmo3-free-itd.iss (only works with ANSI versions, read the comments in the file) and the old one is still there as well (for unicode versions)
Modified Paths:
--------------
trunk/OpenMPT/installer/filetypes.iss
trunk/OpenMPT/installer/install-unmo3-free.iss
trunk/OpenMPT/installer/install.iss
Added Paths:
-----------
trunk/OpenMPT/installer/install-unmo3-free-itd.iss
Modified: trunk/OpenMPT/installer/filetypes.iss
===================================================================
--- trunk/OpenMPT/installer/filetypes.iss 2011-01-15 16:27:50 UTC (rev 786)
+++ trunk/OpenMPT/installer/filetypes.iss 2011-01-15 16:41:51 UTC (rev 787)
@@ -1,7 +1,7 @@
; OpenMPT Install script - File associations
; Written by Johannes Schultz
+; http://openmpt.org/
; http://sagamusix.de/
-; http://sagagames.de/
[Setup]
ChangesAssociations=yes
Added: trunk/OpenMPT/installer/install-unmo3-free-itd.iss
===================================================================
--- trunk/OpenMPT/installer/install-unmo3-free-itd.iss (rev 0)
+++ trunk/OpenMPT/installer/install-unmo3-free-itd.iss 2011-01-15 16:41:51 UTC (rev 787)
@@ -0,0 +1,62 @@
+; OpenMPT Install script for InnoSetup
+; Written by Johannes Schultz
+; http://openmpt.org/
+; http://sagamusix.de/
+
+; This file is provided for creating an install package without the proprietary unmo3.dll (for example for the SourceForge package).
+; Instead of including the file in the setup package, the user instead has the possibility to automatically download unmo3.dll from
+; our servers.
+; The download code requires the InnoIDE with its downloader extension which currently only works in ANSI version! ISPP is also required.
+; To download and install ISPP and InnoIDE, get the Inno Setup QuickStart Pack from http://www.jrsoftware.org/isdl.php#qsp (don't use the unicode pack!)
+; it_download.iss and it_download.dll have to be placed in same directory as the file you are currently viewing.
+
+#define DOWNLOAD_MO3
+#define BaseNameAddition "_sf"
+#include "install.iss"
+#include "it_download.iss"
+
+[Code]
+// Verify checksum of downloaded file, and if it is OK, copy it to the app directory.
+procedure VerifyUNMO3Checksum();
+begin
+ if(IsTaskSelected('downloadmo3') And FileExists(ExpandConstant('{tmp}\openmpt-unmo3.dll.tmp'))) then
+ begin
+ if(GetSHA1OfFile(ExpandConstant('{tmp}\openmpt-unmo3.dll.tmp')) <> '2e17f7bb6d19ce326851333b918070c5357cacd1') then
+ begin
+ MsgBox('Warning: unmo3.dll has been downloaded, but its checksum is wrong! This means that either the downloaded file is corrupted or that a newer version of unmo3.dll is available. The file has thus not been installed. Please obtain unmo3.dll from http://openmpt.com/ and verify its checksum.', mbCriticalError, MB_OK)
+ end else
+ begin
+ FileCopy(ExpandConstant('{tmp}\openmpt-unmo3.dll.tmp'), ExpandConstant('{app}\unmo3.dll'), true);
+ end;
+ DeleteFile(ExpandConstant('{tmp}\openmpt-unmo3.dll.tmp'));
+ end;
+end;
+
+function IsUNMO3Installed(): Boolean;
+begin
+ Result := FileExists(ExpandConstant('{app}\unmo3.dll'));
+end;
+
+procedure InitializeWizard();
+begin
+ ITD_Init();
+ ITD_DownloadAfter(wpReady);
+end;
+
+// Function generated by ISTool.
+procedure CurPageChanged(CurPage: Integer);
+begin
+ case CurPage of
+ CurPage:
+ begin
+ if(IsTaskSelected('downloadmo3')) then
+ begin
+ ITD_AddMirror('http://openmpt.com/download/unmo3.dll', ExpandConstant('{tmp}\openmpt-unmo3.dll.tmp'));
+ ITD_AddFile('ftp://ftp.untergrund.net/users/sagamusix/openmpt/unmo3.dll', ExpandConstant('{tmp}\openmpt-unmo3.dll.tmp'));
+ end else
+ begin
+ ITD_ClearFiles();
+ end;
+ end;
+ end;
+end;
Modified: trunk/OpenMPT/installer/install-unmo3-free.iss
===================================================================
--- trunk/OpenMPT/installer/install-unmo3-free.iss 2011-01-15 16:27:50 UTC (rev 786)
+++ trunk/OpenMPT/installer/install-unmo3-free.iss 2011-01-15 16:41:51 UTC (rev 787)
@@ -1,61 +1,45 @@
; OpenMPT Install script for InnoSetup
; Written by Johannes Schultz
+; http://openmpt.org/
; http://sagamusix.de/
-; http://sagagames.de/
; This file is provided for creating an install package without the proprietary unmo3.dll (for example for the SourceForge package).
; Instead of including the file in the setup package, the user instead has the possibility to automatically download unmo3.dll from
; our servers.
; The download code requires the ISTool IDE with its downloader extension. ISPP is also required.
-; To download and install ISPP and ISTool, get the Inno Setup QuickStart Pack from http://www.jrsoftware.org/isdl.php#qsp
+; To download and install ISPP, get the Inno Setup QuickStart Pack from http://www.jrsoftware.org/isdl.php#qsp
+; The QuickStart Pack doesn't provide a ISTool downloader anymore, so you'll have to download it manually from http://www.istool.org/
#define DOWNLOAD_MO3
#define BaseNameAddition "_sf"
#include "install.iss"
-#include "it_download.iss"
+[_ISToolDownload]
+Source: http://openmpt.com/download/unmo3.dll; DestDir: {tmp}; DestName: openmpt-unmo3.dll.tmp; Tasks: downloadmo3
[Code]
// Verify checksum of downloaded file, and if it is OK, copy it to the app directory.
procedure VerifyUNMO3Checksum();
begin
if(IsTaskSelected('downloadmo3') And FileExists(ExpandConstant('{tmp}\openmpt-unmo3.dll.tmp'))) then
begin
- if(GetSHA1OfFile(ExpandConstant('{tmp}\openmpt-unmo3.dll.tmp')) <> '2e17f7bb6d19ce326851333b918070c5357cacd1') then
- begin
- MsgBox('Warning: unmo3.dll has been downloaded, but its checksum is wrong! This means that either the downloaded file is corrupted or that a newer version of unmo3.dll is available. The file has thus not been installed. Please obtain unmo3.dll from http://openmpt.com/ and verify its checksum.', mbCriticalError, MB_OK)
- end else
- begin
- FileCopy(ExpandConstant('{tmp}\openmpt-unmo3.dll.tmp'), ExpandConstant('{app}\unmo3.dll'), true);
- end;
- DeleteFile(ExpandConstant('{tmp}\openmpt-unmo3.dll.tmp'));
+ if(GetSHA1OfFile(ExpandConstant('{tmp}\openmpt-unmo3.dll.tmp')) <> '2e17f7bb6d19ce326851333b918070c5357cacd1') then
+ begin
+ MsgBox('Warning: unmo3.dll has been downloaded, but its checksum is wrong! This means that either the downloaded file is corrupted or that a newer version of unmo3.dll is available. The file has thus not been installed. Please obtain unmo3.dll from http://openmpt.com/ and verify its checksum.', mbCriticalError, MB_OK)
+ end else
+ begin
+ FileCopy(ExpandConstant('{tmp}\openmpt-unmo3.dll.tmp'), ExpandConstant('{app}\unmo3.dll'), true);
+ end;
+ DeleteFile(ExpandConstant('{tmp}\openmpt-unmo3.dll.tmp'));
end;
end;
function IsUNMO3Installed(): Boolean;
begin
- Result := FileExists(ExpandConstant('{app}\unmo3.dll'));
+ Result := FileExists(ExpandConstant('{app}\unmo3.dll'));
end;
-procedure InitializeWizard();
-begin
- ITD_Init();
- ITD_DownloadAfter(wpReady);
-end;
-
// Function generated by ISTool.
-procedure CurPageChanged(CurPage: Integer);
+function NextButtonClick(CurPage: Integer): Boolean;
begin
- case CurPage of
- CurPage:
- begin
- if(IsTaskSelected('downloadmo3')) then
- begin
- ITD_AddMirror('http://openmpt.org/download/unmo3.dll', ExpandConstant('{tmp}\openmpt-unmo3.dll.tmp'));
- ITD_AddFile('ftp://ftp.untergrund.net/users/sagamusix/openmpt/unmo3.dll', ExpandConstant('{tmp}\openmpt-unmo3.dll.tmp'));
- end else
- begin
- ITD_ClearFiles();
- end;
- end;
- end;
+ Result := istool_download(CurPage);
end;
Modified: trunk/OpenMPT/installer/install.iss
===================================================================
--- trunk/OpenMPT/installer/install.iss 2011-01-15 16:27:50 UTC (rev 786)
+++ trunk/OpenMPT/installer/install.iss 2011-01-15 16:41:51 UTC (rev 787)
@@ -1,12 +1,12 @@
; OpenMPT Install script
; Written by Johannes Schultz
+; http://openmpt.org/
; http://sagamusix.de/
-; http://sagagames.de/
; ISPP is needed for automated version retrieval.
-; Furthermore, the ISTool IDE with its downloader extension is required for "unmo3-free" packages which don't contain unmo3.dll, but download it from a server.
-; Check install-unmo3-free.iss for details on this matter.
-; To download and install ISPP and ISTool, get the Inno Setup QuickStart Pack from http://www.jrsoftware.org/isdl.php#qsp
+; Furthermore, either the ISTool IDE or InnoIDE with their downloader extensions are required for "unmo3-free" packages which don't contain unmo3.dll, but download it from a server.
+; Check install-unmo3-free.iss and install-unmo3-free-itd.iss for details on this matter.
+; To download and install ISPP and InnoIDE, get the Inno Setup QuickStart Pack from http://www.jrsoftware.org/isdl.php#qsp
#define GetAppVersion StringChange(GetFileProductVersion("..\mptrack\bin\mptrack.exe"), ",", ".")
#define GetAppVersionShort Copy(GetAppVersion, 1, 4)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sag...@us...> - 2011-01-15 16:27:57
|
Revision: 786
http://modplug.svn.sourceforge.net/modplug/?rev=786&view=rev
Author: saga-games
Date: 2011-01-15 16:27:50 +0000 (Sat, 15 Jan 2011)
Log Message:
-----------
[Fix] Pattern Editor: Queueing a "---" or "+++" item now automatically moves the queue "cursor" to the next available pattern. Previously, queueing a "---" pattern restarted the song.
[Imp] Pattern Editor: Just like normal selections, the row selection feature now also suppresses pattern scrolling.
[Mod] OpenMPT: Version is now 1.19.00.19
Modified Paths:
--------------
trunk/OpenMPT/installer/install-unmo3-free.iss
trunk/OpenMPT/mptrack/Ctrl_seq.cpp
trunk/OpenMPT/mptrack/View_pat.cpp
trunk/OpenMPT/mptrack/version.h
Modified: trunk/OpenMPT/installer/install-unmo3-free.iss
===================================================================
--- trunk/OpenMPT/installer/install-unmo3-free.iss 2011-01-15 16:25:29 UTC (rev 785)
+++ trunk/OpenMPT/installer/install-unmo3-free.iss 2011-01-15 16:27:50 UTC (rev 786)
@@ -12,33 +12,50 @@
#define DOWNLOAD_MO3
#define BaseNameAddition "_sf"
#include "install.iss"
+#include "it_download.iss"
-[_ISToolDownload]
-Source: http://openmpt.com/download/unmo3.dll; DestDir: {tmp}; DestName: openmpt-unmo3.dll.tmp; Tasks: downloadmo3
[Code]
// Verify checksum of downloaded file, and if it is OK, copy it to the app directory.
procedure VerifyUNMO3Checksum();
begin
if(IsTaskSelected('downloadmo3') And FileExists(ExpandConstant('{tmp}\openmpt-unmo3.dll.tmp'))) then
begin
- if(GetSHA1OfFile(ExpandConstant('{tmp}\openmpt-unmo3.dll.tmp')) <> '2e17f7bb6d19ce326851333b918070c5357cacd1') then
- begin
- MsgBox('Warning: unmo3.dll has been downloaded, but its checksum is wrong! This means that either the downloaded file is corrupted or that a newer version of unmo3.dll is available. The file has thus not been installed. Please obtain unmo3.dll from http://openmpt.com/ and verify its checksum.', mbCriticalError, MB_OK)
- end else
- begin
- FileCopy(ExpandConstant('{tmp}\openmpt-unmo3.dll.tmp'), ExpandConstant('{app}\unmo3.dll'), true);
- end;
- DeleteFile(ExpandConstant('{tmp}\openmpt-unmo3.dll.tmp'));
+ if(GetSHA1OfFile(ExpandConstant('{tmp}\openmpt-unmo3.dll.tmp')) <> '2e17f7bb6d19ce326851333b918070c5357cacd1') then
+ begin
+ MsgBox('Warning: unmo3.dll has been downloaded, but its checksum is wrong! This means that either the downloaded file is corrupted or that a newer version of unmo3.dll is available. The file has thus not been installed. Please obtain unmo3.dll from http://openmpt.com/ and verify its checksum.', mbCriticalError, MB_OK)
+ end else
+ begin
+ FileCopy(ExpandConstant('{tmp}\openmpt-unmo3.dll.tmp'), ExpandConstant('{app}\unmo3.dll'), true);
+ end;
+ DeleteFile(ExpandConstant('{tmp}\openmpt-unmo3.dll.tmp'));
end;
end;
function IsUNMO3Installed(): Boolean;
begin
- Result := FileExists(ExpandConstant('{app}\unmo3.dll'));
+ Result := FileExists(ExpandConstant('{app}\unmo3.dll'));
end;
+procedure InitializeWizard();
+begin
+ ITD_Init();
+ ITD_DownloadAfter(wpReady);
+end;
+
// Function generated by ISTool.
-function NextButtonClick(CurPage: Integer): Boolean;
+procedure CurPageChanged(CurPage: Integer);
begin
- Result := istool_download(CurPage);
+ case CurPage of
+ CurPage:
+ begin
+ if(IsTaskSelected('downloadmo3')) then
+ begin
+ ITD_AddMirror('http://openmpt.org/download/unmo3.dll', ExpandConstant('{tmp}\openmpt-unmo3.dll.tmp'));
+ ITD_AddFile('ftp://ftp.untergrund.net/users/sagamusix/openmpt/unmo3.dll', ExpandConstant('{tmp}\openmpt-unmo3.dll.tmp'));
+ end else
+ begin
+ ITD_ClearFiles();
+ end;
+ end;
+ end;
end;
Modified: trunk/OpenMPT/mptrack/Ctrl_seq.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Ctrl_seq.cpp 2011-01-15 16:25:29 UTC (rev 785)
+++ trunk/OpenMPT/mptrack/Ctrl_seq.cpp 2011-01-15 16:27:50 UTC (rev 786)
@@ -1041,7 +1041,7 @@
if(bPatternExists) break;
}
- DWORD greyed = bPatternExists ? 0 : MF_GRAYED;
+ const DWORD greyed = bPatternExists ? 0 : MF_GRAYED;
CInputHandler* ih = (CMainFrame::GetMainFrame())->GetInputHandler();
@@ -1432,13 +1432,24 @@
CSoundFile *pSndFile = m_pModDoc->GetSoundFile();
if(pSndFile == nullptr) return;
+ const PATTERNINDEX nIgnore = pSndFile->Order.GetIgnoreIndex();
+ const PATTERNINDEX nInvalid = pSndFile->Order.GetInvalidPatIndex();
+ const ORDERINDEX nLength = pSndFile->Order.GetLength();
ORDERINDEX nOrder = GetOrderFromPoint(rect, pt);
- if (nOrder < pSndFile->Order.GetLength())
+ // If this is not a playable order item, find the next valid item.
+ while(nOrder < nLength && (pSndFile->Order[nOrder] == nIgnore || pSndFile->Order[nOrder] == nInvalid))
{
- if (pSndFile->m_nSeqOverride == static_cast<UINT>(nOrder) + 1) {
+ nOrder++;
+ }
+
+ if (nOrder < nLength)
+ {
+ if (pSndFile->m_nSeqOverride == static_cast<UINT>(nOrder) + 1)
+ {
pSndFile->m_nSeqOverride = 0;
- } else {
+ } else
+ {
pSndFile->m_nSeqOverride = nOrder + 1;
}
InvalidateRect(NULL, FALSE);
Modified: trunk/OpenMPT/mptrack/View_pat.cpp
===================================================================
--- trunk/OpenMPT/mptrack/View_pat.cpp 2011-01-15 16:25:29 UTC (rev 785)
+++ trunk/OpenMPT/mptrack/View_pat.cpp 2011-01-15 16:27:50 UTC (rev 786)
@@ -3018,7 +3018,7 @@
m_pEffectVis->SetPlayCursor(nPat, nRow);
}
- if ((m_dwStatus & (PATSTATUS_FOLLOWSONG|PATSTATUS_DRAGVSCROLL|PATSTATUS_DRAGHSCROLL|PATSTATUS_MOUSEDRAGSEL)) == PATSTATUS_FOLLOWSONG)
+ if ((m_dwStatus & (PATSTATUS_FOLLOWSONG|PATSTATUS_DRAGVSCROLL|PATSTATUS_DRAGHSCROLL|PATSTATUS_MOUSEDRAGSEL|PATSTATUS_SELECTROW)) == PATSTATUS_FOLLOWSONG)
{
if (nPat < pSndFile->Patterns.Size())
{
Modified: trunk/OpenMPT/mptrack/version.h
===================================================================
--- trunk/OpenMPT/mptrack/version.h 2011-01-15 16:25:29 UTC (rev 785)
+++ trunk/OpenMPT/mptrack/version.h 2011-01-15 16:27:50 UTC (rev 786)
@@ -15,7 +15,7 @@
#define VER_MAJORMAJOR 1
#define VER_MAJOR 19
#define VER_MINOR 00
-#define VER_MINORMINOR 18
+#define VER_MINORMINOR 19
//Creates version number from version parts that appears in version string.
//For example MAKE_VERSION_NUMERIC(1,17,02,28) gives version number of
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sag...@us...> - 2011-01-15 16:25:35
|
Revision: 785
http://modplug.svn.sourceforge.net/modplug/?rev=785&view=rev
Author: saga-games
Date: 2011-01-15 16:25:29 +0000 (Sat, 15 Jan 2011)
Log Message:
-----------
[Imp] Instrument Editor: When pressing the up arrow key in the sample map while the cursor is on the lowest note (C-0), the sample map doesn't lose focus anymore.
[Imp] Instrument Editor: It is not possible anymore to move the sample map by clicking the area above the lowest note (C-0).
[Fix] Instrument Editor: The note mapping doesn't allow items anymore that aren't notes (such as "no note" or "note cut"). Such notes couldn't be entered manually, however when converting from other formats this was possible and it could crash the tracker (http://bugs.openmpt.org/view.php?id=61).
[Fix] IT Loader / IT Saver: Note mapping items that aren't notes are now ignored.
Modified Paths:
--------------
trunk/OpenMPT/mptrack/Ctrl_ins.cpp
trunk/OpenMPT/soundlib/Load_it.cpp
trunk/OpenMPT/soundlib/modcommand.h
Modified: trunk/OpenMPT/mptrack/Ctrl_ins.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Ctrl_ins.cpp 2011-01-03 22:00:34 UTC (rev 784)
+++ trunk/OpenMPT/mptrack/Ctrl_ins.cpp 2011-01-15 16:25:29 UTC (rev 785)
@@ -125,7 +125,7 @@
//------------------------------------------
{
if (nNote == m_nNote) return TRUE;
- if (nNote >= NOTE_MAX) return FALSE;
+ if (!NOTE_IS_VALID(nNote + 1)) return FALSE;
m_nNote = nNote;
InvalidateRect(NULL, FALSE);
return TRUE;
@@ -189,14 +189,14 @@
if ((pIns) && (nPos >= 0) && (nPos < NOTE_MAX) && (pIns->NoteMap[nPos]))
{
UINT n = pIns->NoteMap[nPos];
- if(n < NOTE_MIN_SPECIAL)
+ if(NOTE_IS_VALID(n))
{
string temp = pSndFile->GetNoteName(n, m_nInstrument);
temp.resize(4);
wsprintf(s, "%s", temp.c_str());
} else
{
- strcpy(s, szSpecialNoteNames[pIns->NoteMap[n] - NOTE_MIN_SPECIAL]);
+ strcpy(s, "???");
}
}
FillRect(hdc, &rect, (bHighLight) ? CMainFrame::brushHighLight : CMainFrame::brushWindow);
@@ -275,9 +275,11 @@
CRect rcClient;
GetClientRect(&rcClient);
int nNotes = (rcClient.bottom + m_cyFont - 1) / m_cyFont;
- UINT n = (pt.y / m_cyFont) + m_nNote - (nNotes/2);
- m_nNote = n;
- InvalidateRect(NULL, FALSE);
+ int n = (pt.y / m_cyFont) + m_nNote - (nNotes/2);
+ if(n >= 0)
+ {
+ SetCurrentNote(n);
+ }
}
SetFocus();
}
@@ -314,21 +316,21 @@
AppendMenu(hMenu, MF_STRING, ID_INSTRUMENT_SAMPLEMAP, "Edit Sample &Map\t" + ih->GetKeyTextFromCommand(kcInsNoteMapEditSampleMap));
if (hSubMenu)
{
- BYTE smpused[(MAX_SAMPLES+7)/8];
- memset(smpused, 0, sizeof(smpused));
+ const SAMPLEINDEX numSamps = pSndFile->GetNumSamples();
+ vector<bool> smpused(numSamps + 1, false);
for (UINT i=1; i<NOTE_MAX; i++)
{
- UINT nsmp = pIns->Keyboard[i];
- if (nsmp < MAX_SAMPLES) smpused[nsmp>>3] |= 1 << (nsmp & 7);
+ SAMPLEINDEX nsmp = pIns->Keyboard[i];
+ if (nsmp <= numSamps) smpused[nsmp] = true;
}
- for (UINT j=1; j<MAX_SAMPLES; j++)
+ for (SAMPLEINDEX j = 1; j <= numSamps; j++)
{
- if (smpused[j>>3] & (1 << (j & 7)))
+ if (smpused[j])
{
wsprintf(s, "%d: ", j);
UINT l = strlen(s);
- memcpy(s+l, pSndFile->m_szNames[j], MAX_SAMPLENAME);
- s[l+32] = 0;
+ memcpy(s + l, pSndFile->m_szNames[j], MAX_SAMPLENAME);
+ s[l + MAX_SAMPLENAME] = 0;
AppendMenu(hSubMenu, MF_STRING, ID_NOTEMAP_EDITSAMPLE+j, s);
}
}
@@ -340,11 +342,11 @@
if(pSndFile->GetType() != MOD_TYPE_XM)
{
- if(pIns->NoteMap[m_nNote] < NOTE_MIN_SPECIAL)
+ if(NOTE_IS_VALID(pIns->NoteMap[m_nNote]))
+ {
wsprintf(s, "Map all ¬es to %s\t" + ih->GetKeyTextFromCommand(kcInsNoteMapCopyCurrentNote), pSndFile->GetNoteName(pIns->NoteMap[m_nNote], m_nInstrument).c_str());
- else
- wsprintf(s, "Map all ¬es to %s\t" + ih->GetKeyTextFromCommand(kcInsNoteMapCopyCurrentNote), szSpecialNoteNames[pIns->NoteMap[m_nNote] - NOTE_MIN_SPECIAL]);
- AppendMenu(hMenu, MF_STRING, ID_NOTEMAP_COPY_NOTE, s);
+ AppendMenu(hMenu, MF_STRING, ID_NOTEMAP_COPY_NOTE, s);
+ }
AppendMenu(hMenu, MF_STRING, ID_NOTEMAP_TRANS_UP, "Transpose map &up\t" + ih->GetKeyTextFromCommand(kcInsNoteMapTransposeUp));
AppendMenu(hMenu, MF_STRING, ID_NOTEMAP_TRANS_DOWN, "Transpose map &down\t" + ih->GetKeyTextFromCommand(kcInsNoteMapTransposeDown));
}
@@ -714,14 +716,15 @@
}
}
return true;
+ default:
+ return false;
}
if (bRedraw)
{
InvalidateRect(NULL, FALSE);
- return true;
}
- return false;
+ return true;
}
@@ -1162,7 +1165,7 @@
BOOL bITandMPT = ((m_pSndFile->m_nType & (MOD_TYPE_IT | MOD_TYPE_MPT)) && (m_pSndFile->m_nInstruments)) ? TRUE : FALSE;
//rewbs.instroVSTi
- BOOL bITandXM = (((m_pSndFile->m_nType & (MOD_TYPE_IT | MOD_TYPE_MPT)) || (m_pSndFile->m_nType == MOD_TYPE_XM)) && (m_pSndFile->m_nInstruments)) ? TRUE : FALSE;
+ BOOL bITandXM = ((m_pSndFile->m_nType & (MOD_TYPE_IT | MOD_TYPE_MPT | MOD_TYPE_XM)) && (m_pSndFile->m_nInstruments)) ? TRUE : FALSE;
bool bMPTOnly = ((m_pSndFile->m_nType == MOD_TYPE_MPT) && (m_pSndFile->m_nInstruments)) ? TRUE : FALSE;
::EnableWindow(::GetDlgItem(m_hWnd, IDC_EDIT10), bITandXM);
::EnableWindow(::GetDlgItem(m_hWnd, IDC_EDIT11), bITandXM);
@@ -1183,7 +1186,7 @@
else
m_SpinFadeOut.SetRange(0, 8192);
- // Panning ranges
+ // Panning ranges (0...64 for IT, 0...256 for MPTM)
m_SpinPanning.SetRange(0, (m_pModDoc->GetModType() & MOD_TYPE_IT) ? 64 : 256);
m_NoteMap.EnableWindow(bITandXM);
Modified: trunk/OpenMPT/soundlib/Load_it.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Load_it.cpp 2011-01-03 22:00:34 UTC (rev 784)
+++ trunk/OpenMPT/soundlib/Load_it.cpp 2011-01-15 16:25:29 UTC (rev 785)
@@ -302,13 +302,13 @@
SpaceToNullStringFixed<12>(pIns->filename);
pIns->nFadeOut = pis->fadeout << 6;
pIns->nGlobalVol = 64;
- for (UINT j=0; j<NOTE_MAX; j++)
+ for (UINT j = 0; j < 120; j++)
{
UINT note = pis->keyboard[j*2];
UINT ins = pis->keyboard[j*2+1];
if (ins < MAX_SAMPLES) pIns->Keyboard[j] = ins;
- if (note < 128) pIns->NoteMap[j] = note+1;
- else if (note >= 0xFE) pIns->NoteMap[j] = note;
+ if (note < 120) pIns->NoteMap[j] = note + 1;
+ else pIns->NoteMap[j] = j + 1;
}
if (pis->flags & 0x01) pIns->VolEnv.dwFlags |= ENV_ENABLED;
if (pis->flags & 0x02) pIns->VolEnv.dwFlags |= ENV_LOOP;
@@ -361,8 +361,8 @@
UINT note = pis->keyboard[j*2];
UINT ins = pis->keyboard[j*2+1];
if (ins < MAX_SAMPLES) pIns->Keyboard[j] = ins;
- if (note < 128) pIns->NoteMap[j] = note+1;
- else if (note >= 0xFE) pIns->NoteMap[j] = note;
+ if (note < 120) pIns->NoteMap[j] = note + 1;
+ else pIns->NoteMap[j] = j + 1;
}
// Olivier's MPT Instrument Extension
if (*((int *)pis->dummy) == 'MPTX')
@@ -1548,7 +1548,7 @@
smpcount[smp>>3] |= 1 << (smp&7);
iti.nos++;
}
- iti.keyboard[i*2] = pIns->NoteMap[i] - 1;
+ iti.keyboard[i*2] = (pIns->NoteMap[i] >= NOTE_MIN && pIns->NoteMap[i] <= NOTE_MAX) ? (pIns->NoteMap[i] - 1) : i;
iti.keyboard[i*2+1] = smp;
if (smp > 0xff) bKbdEx = true;
keyboardex[i] = (smp>>8);
@@ -2143,7 +2143,7 @@
smpcount[smp>>3] |= 1 << (smp&7);
iti.nos++;
}
- iti.keyboard[i*2] = pIns->NoteMap[i] - 1;
+ iti.keyboard[i*2] = (pIns->NoteMap[i] >= NOTE_MIN && pIns->NoteMap[i] <= NOTE_MAX) ? (pIns->NoteMap[i] - 1) : i;
iti.keyboard[i*2+1] = smp;
//if (smp > 0xFF) bKbdEx = true; // no extended sample map in compat mode
keyboardex[i] = (smp>>8);
Modified: trunk/OpenMPT/soundlib/modcommand.h
===================================================================
--- trunk/OpenMPT/soundlib/modcommand.h 2011-01-03 22:00:34 UTC (rev 784)
+++ trunk/OpenMPT/soundlib/modcommand.h 2011-01-15 16:25:29 UTC (rev 785)
@@ -14,6 +14,7 @@
#define NOTE_MAX 120 //Defines maximum notevalue(with index starting from 1) as well as maximum number of notes.
#define NOTE_MAX_SPECIAL NOTE_KEYOFF
#define NOTE_MIN_SPECIAL NOTE_PCS
+#define NOTE_IS_VALID(n) ((n) == NOTE_NONE || ((n) >= NOTE_MIN && (n) <= NOTE_MAX)) // Checks whether a number represents a valid note (a "normal" note or no note, but not something like note off)
//==============
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sag...@us...> - 2011-01-03 22:00:41
|
Revision: 784
http://modplug.svn.sourceforge.net/modplug/?rev=784&view=rev
Author: saga-games
Date: 2011-01-03 22:00:34 +0000 (Mon, 03 Jan 2011)
Log Message:
-----------
[Fix] Various actions in the instrument note map and envelope view should now also mark the instrument as modified.
Modified Paths:
--------------
trunk/OpenMPT/mptrack/Ctrl_ins.cpp
trunk/OpenMPT/mptrack/Ctrl_ins.h
trunk/OpenMPT/mptrack/View_ins.cpp
trunk/OpenMPT/mptrack/View_ins.h
Modified: trunk/OpenMPT/mptrack/Ctrl_ins.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Ctrl_ins.cpp 2011-01-03 19:08:33 UTC (rev 783)
+++ trunk/OpenMPT/mptrack/Ctrl_ins.cpp 2011-01-03 22:00:34 UTC (rev 784)
@@ -381,7 +381,7 @@
}
if (bModified)
{
- m_pModDoc->SetModified();
+ m_pParent->SetInstrumentModified();
InvalidateRect(NULL, FALSE);
}
}
@@ -407,7 +407,7 @@
}
if (bModified)
{
- m_pModDoc->SetModified();
+ m_pParent->SetInstrumentModified();
InvalidateRect(NULL, FALSE);
}
}
@@ -434,7 +434,7 @@
}
if (bModified)
{
- m_pModDoc->SetModified();
+ m_pParent->SetInstrumentModified();
InvalidateRect(NULL, FALSE);
}
}
@@ -479,7 +479,7 @@
}
if (bModified)
{
- m_pModDoc->SetModified();
+ m_pParent->SetInstrumentModified();
InvalidateRect(NULL, FALSE);
}
}
@@ -583,7 +583,7 @@
if (n != pIns->NoteMap[m_nNote])
{
pIns->NoteMap[m_nNote] = n;
- m_pModDoc->SetModified();
+ m_pParent->SetInstrumentModified();
InvalidateRect(NULL, FALSE);
}
if (bOk)
@@ -618,7 +618,7 @@
if (n != pIns->Keyboard[m_nNote])
{
pIns->Keyboard[m_nNote] = n;
- m_pModDoc->SetModified();
+ m_pParent->SetInstrumentModified();
InvalidateRect(NULL, FALSE);
PlayNote(m_nNote+1);
}
@@ -650,7 +650,7 @@
if (n != pIns->NoteMap[m_nNote])
{
pIns->NoteMap[m_nNote] = n;
- m_pModDoc->SetModified();
+ m_pParent->SetInstrumentModified();
InvalidateRect(NULL, FALSE);
}
@@ -999,6 +999,7 @@
}
}
+
BOOL CCtrlInstruments::SetCurrentInstrument(UINT nIns, BOOL bUpdNum)
//------------------------------------------------------------------
{
Modified: trunk/OpenMPT/mptrack/Ctrl_ins.h
===================================================================
--- trunk/OpenMPT/mptrack/Ctrl_ins.h 2011-01-03 19:08:33 UTC (rev 783)
+++ trunk/OpenMPT/mptrack/Ctrl_ins.h 2011-01-03 22:00:34 UTC (rev 784)
@@ -113,6 +113,7 @@
virtual ~CCtrlInstruments();
public:
+ void SetInstrumentModified(const bool modified = true);
BOOL SetCurrentInstrument(UINT nIns, BOOL bUpdNum=TRUE);
BOOL OpenInstrument(LPCSTR lpszFileName);
BOOL OpenInstrument(CSoundFile *pSndFile, UINT nInstr);
@@ -120,9 +121,6 @@
VOID UpdateFilterText();
LONG* GetSplitPosRef() {return &CMainFrame::glInstrumentWindowHeight;} //rewbs.varWindowSize
-protected:
- void CCtrlInstruments::SetInstrumentModified(const bool modified);
-
public:
//{{AFX_VIRTUAL(CCtrlInstruments)
virtual BOOL OnInitDialog();
Modified: trunk/OpenMPT/mptrack/View_ins.cpp
===================================================================
--- trunk/OpenMPT/mptrack/View_ins.cpp 2011-01-03 19:08:33 UTC (rev 783)
+++ trunk/OpenMPT/mptrack/View_ins.cpp 2011-01-03 22:00:34 UTC (rev 784)
@@ -160,6 +160,21 @@
}
+// Set instrument (and moddoc) as modified.
+void CViewInstrument::SetInstrumentModified()
+//-------------------------------------------
+{
+ CModDoc *pModDoc = GetDocument();
+ if(pModDoc == nullptr) return;
+// -> CODE#0023
+// -> DESC="IT project files (.itp)"
+ pModDoc->m_bsInstrumentModified.set(m_nInstrument - 1, true);
+ pModDoc->UpdateAllViews(NULL, (m_nInstrument << HINT_SHIFT_INS) | HINT_INSNAMES, this);
+// -! NEW_FEATURE#0023
+ pModDoc->SetModified();
+}
+
+
BOOL CViewInstrument::SetCurrentInstrument(INSTRUMENTINDEX nIns, enmEnvelopeTypes nEnv)
//-------------------------------------------------------------------------------------
{
@@ -1003,7 +1018,7 @@
envelope->nReleaseNode = ENV_RELEASE_NODE_UNSET;
}
- pModDoc->SetModified();
+ SetInstrumentModified();
pModDoc->UpdateAllViews(NULL, (m_nInstrument << HINT_SHIFT_INS) | HINT_ENVELOPE, NULL);
return true;
}
@@ -1070,7 +1085,7 @@
if (envelope->nSustainEnd >= i) envelope->nSustainEnd++;
if (envelope->nReleaseNode >= i && envelope->nReleaseNode != ENV_RELEASE_NODE_UNSET) envelope->nReleaseNode++;
- pModDoc->SetModified();
+ SetInstrumentModified();
pModDoc->UpdateAllViews(NULL, (m_nInstrument << HINT_SHIFT_INS) | HINT_ENVELOPE, NULL);
return i + 1;
}
@@ -1476,7 +1491,7 @@
CModDoc *pModDoc = GetDocument();
if(pModDoc)
{
- pModDoc->SetModified();
+ SetInstrumentModified();
pModDoc->UpdateAllViews(NULL, (m_nInstrument << HINT_SHIFT_INS) | HINT_ENVELOPE, NULL);
}
UpdateWindow(); //rewbs: TODO - optimisation here so we don't redraw whole view.
@@ -1729,7 +1744,7 @@
CModDoc *pModDoc = GetDocument();
if ((pModDoc) && (EnvSetLoop(!EnvGetLoop())))
{
- pModDoc->SetModified();
+ SetInstrumentModified();
pModDoc->UpdateAllViews(NULL, (m_nInstrument << HINT_SHIFT_INS) | HINT_ENVELOPE, NULL);
UpdateNcButtonState();
}
@@ -1742,7 +1757,7 @@
CModDoc *pModDoc = GetDocument();
if ((pModDoc) && (EnvSetSustain(!EnvGetSustain())))
{
- pModDoc->SetModified();
+ SetInstrumentModified();
pModDoc->UpdateAllViews(NULL, (m_nInstrument << HINT_SHIFT_INS) | HINT_ENVELOPE, NULL);
UpdateNcButtonState();
}
@@ -1755,7 +1770,7 @@
CModDoc *pModDoc = GetDocument();
if ((pModDoc) && (EnvSetCarry(!EnvGetCarry())))
{
- pModDoc->SetModified();
+ SetInstrumentModified();
UpdateNcButtonState();
}
}
@@ -1765,7 +1780,7 @@
{
if(IsDragItemEnvPoint() && EnvToggleReleaseNode(m_nDragItem - 1))
{
- if(GetDocument() != nullptr) GetDocument()->SetModified();
+ SetInstrumentModified();
InvalidateRect(NULL, FALSE);
}
}
@@ -1774,10 +1789,9 @@
void CViewInstrument::OnEnvVolChanged()
//-------------------------------------
{
- CModDoc *pModDoc = GetDocument();
- if ((pModDoc) && (EnvSetVolEnv(!EnvGetVolEnv())))
+ if (EnvSetVolEnv(!EnvGetVolEnv()))
{
- pModDoc->SetModified();
+ SetInstrumentModified();
UpdateNcButtonState();
}
}
@@ -1786,10 +1800,9 @@
void CViewInstrument::OnEnvPanChanged()
//-------------------------------------
{
- CModDoc *pModDoc = GetDocument();
- if ((pModDoc) && (EnvSetPanEnv(!EnvGetPanEnv())))
+ if (EnvSetPanEnv(!EnvGetPanEnv()))
{
- pModDoc->SetModified();
+ SetInstrumentModified();
UpdateNcButtonState();
}
}
@@ -1798,10 +1811,9 @@
void CViewInstrument::OnEnvPitchChanged()
//---------------------------------------
{
- CModDoc *pModDoc = GetDocument();
- if ((pModDoc) && (EnvSetPitchEnv(!EnvGetPitchEnv())))
+ if (EnvSetPitchEnv(!EnvGetPitchEnv()))
{
- pModDoc->SetModified();
+ SetInstrumentModified();
UpdateNcButtonState();
}
}
@@ -1810,10 +1822,9 @@
void CViewInstrument::OnEnvFilterChanged()
//----------------------------------------
{
- CModDoc *pModDoc = GetDocument();
- if ((pModDoc) && (EnvSetFilterEnv(!EnvGetFilterEnv())))
+ if (EnvSetFilterEnv(!EnvGetFilterEnv()))
{
- pModDoc->SetModified();
+ SetInstrumentModified();
UpdateNcButtonState();
}
}
@@ -2061,8 +2072,8 @@
}
if (bUpdate)
{
+ SetInstrumentModified();
pModDoc->UpdateAllViews(NULL, (m_nInstrument << HINT_SHIFT_INS) | HINT_INSTRUMENT | HINT_ENVELOPE | HINT_INSNAMES, NULL);
- pModDoc->SetModified();
}
CMDIChildWnd *pMDIFrame = (CMDIChildWnd *)GetParentFrame();
if (pMDIFrame)
@@ -2245,7 +2256,7 @@
CScaleEnvPointsDlg dlg(this, GetEnvelopePtr(), nOffset);
if(dlg.DoModal())
{
- pModDoc->SetModified();
+ SetInstrumentModified();
pModDoc->UpdateAllViews(NULL, (m_nInstrument << HINT_SHIFT_INS) | HINT_ENVELOPE, NULL);
}
}
@@ -2303,7 +2314,7 @@
return;
pEnv->Ticks[m_nDragItem - 1]--;
- GetDocument()->SetModified(); // sanity checks are done in GetEnvelopePtr() already
+ SetInstrumentModified();
InvalidateRect(NULL, FALSE);
}
@@ -2317,7 +2328,7 @@
return;
pEnv->Ticks[m_nDragItem - 1]++;
- GetDocument()->SetModified(); // sanity checks are done in GetEnvelopePtr() already
+ SetInstrumentModified();
InvalidateRect(NULL, FALSE);
}
@@ -2332,7 +2343,7 @@
else
pEnv->Values[m_nDragItem - 1] = ENVELOPE_MAX;
- GetDocument()->SetModified(); // sanity checks are done in GetEnvelopePtr() already
+ SetInstrumentModified();
InvalidateRect(NULL, FALSE);
}
@@ -2347,7 +2358,7 @@
else
pEnv->Values[m_nDragItem - 1] = ENVELOPE_MIN;
- GetDocument()->SetModified(); // sanity checks are done in GetEnvelopePtr() already
+ SetInstrumentModified();
InvalidateRect(NULL, FALSE);
}
@@ -2443,7 +2454,7 @@
if(EnvToggleReleaseNode(m_nDragItem - 1))
{
CModDoc *pModDoc = GetDocument(); // sanity checks are done in GetEnvelopePtr() already
- pModDoc->SetModified();
+ SetInstrumentModified();
pModDoc->UpdateAllViews(NULL, (m_nInstrument << HINT_SHIFT_INS) | HINT_ENVELOPE, NULL);
}
}
Modified: trunk/OpenMPT/mptrack/View_ins.h
===================================================================
--- trunk/OpenMPT/mptrack/View_ins.h 2011-01-03 19:08:33 UTC (rev 783)
+++ trunk/OpenMPT/mptrack/View_ins.h 2011-01-03 22:00:34 UTC (rev 784)
@@ -116,6 +116,7 @@
////////////////////////
// Misc stuff
void UpdateScrollSize();
+ void SetInstrumentModified();
BOOL SetCurrentInstrument(INSTRUMENTINDEX nIns, enmEnvelopeTypes m_nEnv = ENV_VOLUME);
MODINSTRUMENT *GetInstrumentPtr() const;
INSTRUMENTENVELOPE *GetEnvelopePtr() const;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sag...@us...> - 2011-01-03 19:08:40
|
Revision: 783
http://modplug.svn.sourceforge.net/modplug/?rev=783&view=rev
Author: saga-games
Date: 2011-01-03 19:08:33 +0000 (Mon, 03 Jan 2011)
Log Message:
-----------
[Fix] When restarting a pattern, the timer was not reset properly (CModDoc:::OnPatternRestart)
[Ref] Moved bool instrumentModified[MAX_INSTRUMENTS] to CModDoc and turned it into a bitset. ctrl_ins code has been unified with regards to this bitset, so the treeview should now also be updated properly in all cases and the document / instruments should be marked as modified as well.
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/View_tre.cpp
trunk/OpenMPT/soundlib/Sampleio.cpp
trunk/OpenMPT/soundlib/Sndfile.cpp
trunk/OpenMPT/soundlib/Sndfile.h
Modified: trunk/OpenMPT/mptrack/Ctrl_ins.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Ctrl_ins.cpp 2011-01-03 15:11:22 UTC (rev 782)
+++ trunk/OpenMPT/mptrack/Ctrl_ins.cpp 2011-01-03 19:08:33 UTC (rev 783)
@@ -983,6 +983,22 @@
}
+// Set instrument (and moddoc) as modified.
+void CCtrlInstruments::SetInstrumentModified(const bool modified)
+//---------------------------------------------------------------
+{
+ if(m_pModDoc == nullptr) return;
+// -> CODE#0023
+// -> DESC="IT project files (.itp)"
+ m_pModDoc->m_bsInstrumentModified.set(m_nInstrument - 1, modified);
+ m_pModDoc->UpdateAllViews(NULL, (m_nInstrument << HINT_SHIFT_INS) | HINT_INSNAMES, this);
+// -! NEW_FEATURE#0023
+ if(modified)
+ {
+ m_pModDoc->SetModified();
+ }
+}
+
BOOL CCtrlInstruments::SetCurrentInstrument(UINT nIns, BOOL bUpdNum)
//------------------------------------------------------------------
{
@@ -1399,7 +1415,7 @@
if(n >= _MAX_PATH) n = _MAX_PATH-1;
strncpy(m_pSndFile->m_szInstrumentPath[m_nInstrument-1],lpszFileName,n);
m_pSndFile->m_szInstrumentPath[m_nInstrument-1][n] = '\0';
- m_pSndFile->instrumentModified[m_nInstrument-1] = FALSE;
+ SetInstrumentModified(false);
// -! NEW_FEATURE#0023
bOk = TRUE;
}
@@ -1723,7 +1739,7 @@
int n = strlen(files.first_file.c_str());
if(n > _MAX_PATH) n = _MAX_PATH;
strncpy(m_pSndFile->m_szInstrumentPath[m_nInstrument-1], files.first_file.c_str(),n);
- m_pSndFile->instrumentModified[m_nInstrument-1] = FALSE;
+ SetInstrumentModified(false);
// -! NEW_FEATURE#0023
EndWaitCursor();
@@ -1773,13 +1789,8 @@
MODINSTRUMENT *pIns = m_pSndFile->Instruments[m_nInstrument];
if ((pIns) && (strncmp(s, pIns->name, 32)))
{
-// -> CODE#0023
-// -> DESC="IT project files (.itp)"
- m_pSndFile->instrumentModified[m_nInstrument-1] = TRUE;
-// -! NEW_FEATURE#0023
memcpy(pIns->name, s, 32);
- m_pModDoc->SetModified();
- m_pModDoc->UpdateAllViews(NULL, (m_nInstrument << HINT_SHIFT_INS) | HINT_INSNAMES, this);
+ SetInstrumentModified(true);
}
}
}
@@ -1798,12 +1809,7 @@
if ((pIns) && (strncmp(s, pIns->filename, 12)))
{
memcpy(pIns->filename, s, 12);
- m_pModDoc->SetModified();
-// -> CODE#0023
-// -> DESC="IT project files (.itp)"
- m_pSndFile->instrumentModified[m_nInstrument-1] = TRUE;
- m_pModDoc->UpdateAllViews(NULL, HINT_INSNAMES, this);
-// -! NEW_FEATURE#0023
+ SetInstrumentModified(true);
}
}
}
@@ -1821,12 +1827,7 @@
if(nVol != (int)pIns->nFadeOut)
{
pIns->nFadeOut = nVol;
- m_pModDoc->SetModified();
-// -> CODE#0023
-// -> DESC="IT project files (.itp)"
- m_pSndFile->instrumentModified[m_nInstrument-1] = TRUE;
- m_pModDoc->UpdateAllViews(NULL, HINT_INSNAMES, this);
-// -! NEW_FEATURE#0023
+ SetInstrumentModified(true);
}
}
}
@@ -1844,12 +1845,7 @@
if (nVol != (int)pIns->nGlobalVol)
{
pIns->nGlobalVol = nVol;
- if (m_pSndFile->m_nType & (MOD_TYPE_IT | MOD_TYPE_MPT)) m_pModDoc->SetModified();
-// -> CODE#0023
-// -> DESC="IT project files (.itp)"
- m_pSndFile->instrumentModified[m_nInstrument-1] = TRUE;
- m_pModDoc->UpdateAllViews(NULL, HINT_INSNAMES, this);
-// -! NEW_FEATURE#0023
+ SetInstrumentModified(true);
}
}
}
@@ -1893,18 +1889,11 @@
if(smp <= m_pSndFile->GetNumSamples())
m_pSndFile->Samples[smp].uFlags &= ~CHN_PANNING;
}
- m_pModDoc->SetModified();
m_pModDoc->UpdateAllViews(NULL, HINT_SAMPLEINFO | HINT_MODTYPE);
}
}
}
-
-// -> CODE#0023
-// -> DESC="IT project files (.itp)"
- m_pSndFile->instrumentModified[m_nInstrument-1] = TRUE;
- m_pModDoc->UpdateAllViews(NULL, HINT_INSNAMES, this);
-// -! NEW_FEATURE#0023
- m_pModDoc->SetModified();
+ SetInstrumentModified(true);
}
}
@@ -1923,12 +1912,7 @@
if (nPan != (int)pIns->nPan)
{
pIns->nPan = nPan;
- if (m_pSndFile->m_nType & (MOD_TYPE_IT | MOD_TYPE_MPT)) m_pModDoc->SetModified();
-// -> CODE#0023
-// -> DESC="IT project files (.itp)"
- m_pSndFile->instrumentModified[m_nInstrument - 1] = true;
- m_pModDoc->UpdateAllViews(NULL, HINT_INSNAMES, this);
-// -! NEW_FEATURE#0023
+ SetInstrumentModified(true);
}
}
}
@@ -1940,17 +1924,11 @@
MODINSTRUMENT *pIns = m_pSndFile->Instruments[m_nInstrument];
if ((!IsLocked()) && (pIns))
{
- if (pIns->nNNA != m_ComboNNA.GetCurSel()) {
- m_pModDoc->SetModified();
+ if (pIns->nNNA != m_ComboNNA.GetCurSel())
+ {
pIns->nNNA = m_ComboNNA.GetCurSel();
- }
-
-// -> CODE#0023
-// -> DESC="IT project files (.itp)"
- m_pSndFile->instrumentModified[m_nInstrument - 1] = true;
- m_pModDoc->UpdateAllViews(NULL, HINT_INSNAMES, this);
-// -! NEW_FEATURE#0023
-
+ SetInstrumentModified(true);
+ }
}
}
@@ -1961,16 +1939,11 @@
MODINSTRUMENT *pIns = m_pSndFile->Instruments[m_nInstrument];
if ((!IsLocked()) && (pIns))
{
- if (pIns->nDCT != m_ComboDCT.GetCurSel()) {
+ if (pIns->nDCT != m_ComboDCT.GetCurSel())
+ {
pIns->nDCT = m_ComboDCT.GetCurSel();
- m_pModDoc->SetModified();
+ SetInstrumentModified(true);
}
-// -> CODE#0023
-// -> DESC="IT project files (.itp)"
- m_pSndFile->instrumentModified[m_nInstrument-1] = TRUE;
- m_pModDoc->UpdateAllViews(NULL, HINT_INSNAMES, this);
-// -! NEW_FEATURE#0023
-
}
}
@@ -1981,15 +1954,11 @@
MODINSTRUMENT *pIns = m_pSndFile->Instruments[m_nInstrument];
if ((!IsLocked()) && (pIns))
{
- if (pIns->nDNA != m_ComboDCA.GetCurSel()) {
+ if (pIns->nDNA != m_ComboDCA.GetCurSel())
+ {
pIns->nDNA = m_ComboDCA.GetCurSel();
- m_pModDoc->SetModified();
+ SetInstrumentModified(true);
}
-// -> CODE#0023
-// -> DESC="IT project files (.itp)"
- m_pSndFile->instrumentModified[m_nInstrument-1] = TRUE;
- m_pModDoc->UpdateAllViews(NULL, HINT_INSNAMES, this);
-// -! NEW_FEATURE#0023
}
}
@@ -2001,10 +1970,12 @@
if ((!IsLocked()) && (pIns))
{
int n = GetDlgItemInt(IDC_EDIT10);
- if ((n >= 0) && (n <= 255)) {
- if (pIns->nMidiProgram != n) {
+ if ((n >= 0) && (n <= 255))
+ {
+ if (pIns->nMidiProgram != n)
+ {
pIns->nMidiProgram = n;
- m_pModDoc->SetModified();
+ SetInstrumentModified(true);
}
}
//rewbs.MidiBank: we will not set the midi bank/program if it is 0
@@ -2015,12 +1986,6 @@
UnlockControls();
}
//end rewbs.MidiBank
-
-// -> CODE#0023
-// -> DESC="IT project files (.itp)"
- m_pSndFile->instrumentModified[m_nInstrument-1] = TRUE;
- m_pModDoc->UpdateAllViews(NULL, HINT_INSNAMES, this);
-// -! NEW_FEATURE#0023
}
}
@@ -2032,10 +1997,12 @@
if ((!IsLocked()) && (pIns))
{
WORD w = GetDlgItemInt(IDC_EDIT11);
- if ((w >= 0) && (w <= 255)) {
- if (pIns->wMidiBank != w) {
- m_pModDoc->SetModified();
+ if ((w >= 0) && (w <= 255))
+ {
+ if (pIns->wMidiBank != w)
+ {
pIns->wMidiBank = w;
+ SetInstrumentModified(true);
}
}
//rewbs.MidiBank: we will not set the midi bank/program if it is 0
@@ -2046,9 +2013,6 @@
UnlockControls();
}
//end rewbs.MidiBank
-
- m_pSndFile->instrumentModified[m_nInstrument-1] = TRUE;
- m_pModDoc->UpdateAllViews(NULL, HINT_INSNAMES, this);
}
}
//end rewbs.MidiBank
@@ -2060,11 +2024,10 @@
if ((!IsLocked()) && (pIns))
{
int n = m_CbnMidiCh.GetItemData(m_CbnMidiCh.GetCurSel());
- if (pIns->nMidiChannel != (BYTE)(n & 0xff)) {
+ if (pIns->nMidiChannel != (BYTE)(n & 0xff))
+ {
pIns->nMidiChannel = (BYTE)(n & 0xff);
- m_pModDoc->SetModified();
- m_pSndFile->instrumentModified[m_nInstrument-1] = TRUE;
- m_pModDoc->UpdateAllViews(NULL, HINT_INSNAMES, this);
+ SetInstrumentModified(true);
}
}
}
@@ -2076,10 +2039,10 @@
if ((!IsLocked()) && (pIns))
{
int n = m_CbnResampling.GetItemData(m_CbnResampling.GetCurSel());
- if (pIns->nResampling != (BYTE)(n & 0xff)) {
+ if (pIns->nResampling != (BYTE)(n & 0xff))
+ {
pIns->nResampling = (BYTE)(n & 0xff);
- m_pModDoc->SetModified();
- m_pSndFile->instrumentModified[m_nInstrument-1] = TRUE;
+ SetInstrumentModified(true);
m_pModDoc->UpdateAllViews(NULL, HINT_INSNAMES, this);
}
}
@@ -2108,11 +2071,11 @@
if (nPlug>=0 && nPlug <= MAX_MIXPLUGINS)
{
- if ((!IsLocked()) && pIns->nMixPlug != nPlug) {
- m_pModDoc->SetModified();
+ if ((!IsLocked()) && pIns->nMixPlug != nPlug)
+ {
pIns->nMixPlug = nPlug;
+ SetInstrumentModified(true);
m_pModDoc->UpdateAllViews(NULL, HINT_MIXPLUGINS, this);
- m_pModDoc->UpdateAllViews(NULL, (m_nInstrument << HINT_SHIFT_INS) | HINT_INSNAMES, this);
}
m_CbnPluginVelocityHandling.SetCurSel(pIns->nPluginVelocityHandling);
m_CbnPluginVolumeHandling.SetCurSel(pIns->nPluginVolumeHandling);
@@ -2126,9 +2089,9 @@
// if this plug can recieve MIDI events and we have no MIDI channel
// selected for this instrument, automatically select MIDI channel 1.
- if (pPlug->pMixPlugin->isInstrument() && pIns->nMidiChannel==0) {
- pIns->nMidiChannel=1;
- m_pSndFile->instrumentModified[m_nInstrument-1] = TRUE;
+ if (pPlug->pMixPlugin->isInstrument() && pIns->nMidiChannel == 0)
+ {
+ pIns->nMidiChannel = 1;
UpdateView((m_nInstrument << HINT_SHIFT_INS) | HINT_INSTRUMENT, NULL);
}
return;
@@ -2152,17 +2115,12 @@
{
int n = GetDlgItemInt(IDC_EDIT15);
if ((n >= -32) && (n <= 32)) {
- if (pIns->nPPS != (signed char)n) {
+ if (pIns->nPPS != (signed char)n)
+ {
pIns->nPPS = (signed char)n;
- m_pModDoc->SetModified();
+ SetInstrumentModified(true);
}
}
-// -> CODE#0023
-// -> DESC="IT project files (.itp)"
- m_pSndFile->instrumentModified[m_nInstrument-1] = TRUE;
- m_pModDoc->UpdateAllViews(NULL, HINT_INSNAMES, this);
-// -! NEW_FEATURE#0023
-
}
}
@@ -2177,21 +2135,17 @@
if(n > MAX_ATTACK_VALUE) n = MAX_ATTACK_VALUE;
int newRamp = n; //? MAX_ATTACK_LENGTH - n : 0;
-// -> CODE#0023
-// -> DESC="IT project files (.itp)"
- if(pIns->nVolRamp != newRamp){
- m_pSndFile->instrumentModified[m_nInstrument-1] = TRUE;
- m_pModDoc->UpdateAllViews(NULL, HINT_INSNAMES, this);
+ if(pIns->nVolRamp != newRamp)
+ {
+ pIns->nVolRamp = newRamp;
+ SetInstrumentModified(true);
}
-// -! NEW_FEATURE#0023
- pIns->nVolRamp = newRamp;
m_SliderAttack.SetPos(n);
if( CSpinButtonCtrl *spin = (CSpinButtonCtrl *)GetDlgItem(IDC_SPIN1) ) spin->SetPos(n);
LockControls();
if (n == 0) SetDlgItemText(IDC_EDIT2,"default");
UnlockControls();
- m_pModDoc->SetModified();
}
}
// -! NEW_FEATURE#0027
@@ -2204,17 +2158,14 @@
if ((!IsLocked()) && (pIns))
{
int n = m_ComboPPC.GetCurSel();
- if ((n >= 0) && (n <= NOTE_MAX - 1)) {
- if (pIns->nPPC != n) {
- m_pModDoc->SetModified();
+ if ((n >= 0) && (n <= NOTE_MAX - 1))
+ {
+ if (pIns->nPPC != n)
+ {
pIns->nPPC = n;
+ SetInstrumentModified(true);
}
}
-// -> CODE#0023
-// -> DESC="IT project files (.itp)"
- m_pSndFile->instrumentModified[m_nInstrument-1] = TRUE;
- m_pModDoc->UpdateAllViews(NULL, HINT_INSNAMES, this);
-// -! NEW_FEATURE#0023
}
}
@@ -2251,12 +2202,7 @@
}
}
}
-// -> CODE#0023
-// -> DESC="IT project files (.itp)"
- m_pSndFile->instrumentModified[m_nInstrument-1] = TRUE;
- m_pModDoc->UpdateAllViews(NULL, HINT_INSNAMES, this);
-// -! NEW_FEATURE#0023
- m_pModDoc->SetModified();
+ SetInstrumentModified(true);
SwitchToView();
}
}
@@ -2294,12 +2240,7 @@
}
}
}
-// -> CODE#0023
-// -> DESC="IT project files (.itp)"
- m_pSndFile->instrumentModified[m_nInstrument-1] = TRUE;
- m_pModDoc->UpdateAllViews(NULL, HINT_INSNAMES, this);
-// -! NEW_FEATURE#0023
- m_pModDoc->SetModified();
+ SetInstrumentModified(true);
SwitchToView();
}
}
@@ -2380,16 +2321,12 @@
if (pSlider==&m_SliderAttack) {
n = m_SliderAttack.GetPos();
int newRamp = n; //? MAX_ATTACK_LENGTH - n : 0;
-// -> CODE#0023
-// -> DESC="IT project files (.itp)"
- if(pIns->nVolRamp != newRamp){
- m_pSndFile->instrumentModified[m_nInstrument-1] = TRUE;
- m_pModDoc->UpdateAllViews(NULL, HINT_INSNAMES, this);
+ if(pIns->nVolRamp != newRamp)
+ {
pIns->nVolRamp = newRamp;
SetDlgItemInt(IDC_EDIT2,n);
- m_pModDoc->SetModified();
+ SetInstrumentModified(true);
}
-// -! NEW_FEATURE#0023
// -! NEW_FEATURE#0027
}
// Volume Swing
@@ -2398,12 +2335,8 @@
n = m_SliderVolSwing.GetPos();
if ((n >= 0) && (n <= 64) && (n != (int)pIns->nVolSwing))
{
-// -> CODE#0023
-// -> DESC="IT project files (.itp)"
- m_pSndFile->instrumentModified[m_nInstrument-1] = TRUE;
-// -! NEW_FEATURE#0023
pIns->nVolSwing = (BYTE)n;
- m_pModDoc->SetModified();
+ SetInstrumentModified(true);
}
}
// Pan Swing
@@ -2412,12 +2345,8 @@
n = m_SliderPanSwing.GetPos();
if ((n >= 0) && (n <= 64) && (n != (int)pIns->nPanSwing))
{
-// -> CODE#0023
-// -> DESC="IT project files (.itp)"
- m_pSndFile->instrumentModified[m_nInstrument-1] = TRUE;
-// -! NEW_FEATURE#0023
pIns->nPanSwing = (BYTE)n;
- m_pModDoc->SetModified();
+ SetInstrumentModified(true);
}
}
//Cutoff swing
@@ -2426,9 +2355,8 @@
n = m_SliderCutSwing.GetPos();
if ((n >= 0) && (n <= 64) && (n != (int)pIns->nCutSwing))
{
- m_pSndFile->instrumentModified[m_nInstrument-1] = TRUE;
pIns->nCutSwing = (BYTE)n;
- m_pModDoc->SetModified();
+ SetInstrumentModified(true);
}
}
//Resonance swing
@@ -2437,9 +2365,8 @@
n = m_SliderResSwing.GetPos();
if ((n >= 0) && (n <= 64) && (n != (int)pIns->nResSwing))
{
- m_pSndFile->instrumentModified[m_nInstrument-1] = TRUE;
pIns->nResSwing = (BYTE)n;
- m_pModDoc->SetModified();
+ SetInstrumentModified(true);
}
}
// Filter CutOff
@@ -2448,13 +2375,9 @@
n = m_SliderCutOff.GetPos();
if ((n >= 0) && (n < 0x80) && (n != (int)(pIns->nIFC & 0x7F)))
{
- // -> CODE#0023
- // -> DESC="IT project files (.itp)"
- m_pSndFile->instrumentModified[m_nInstrument-1] = TRUE;
- // -! NEW_FEATURE#0023
pIns->nIFC &= 0x80;
pIns->nIFC |= (BYTE)n;
- m_pModDoc->SetModified();
+ SetInstrumentModified(true);
UpdateFilterText();
filterChanger = true;
}
@@ -2465,13 +2388,9 @@
n = m_SliderResonance.GetPos();
if ((n >= 0) && (n < 0x80) && (n != (int)(pIns->nIFR & 0x7F)))
{
- // -> CODE#0023
- // -> DESC="IT project files (.itp)"
- m_pSndFile->instrumentModified[m_nInstrument-1] = TRUE;
- // -! NEW_FEATURE#0023
pIns->nIFR &= 0x80;
pIns->nIFR |= (BYTE)n;
- m_pModDoc->SetModified();
+ SetInstrumentModified(true);
filterChanger = true;
}
}
@@ -2738,9 +2657,7 @@
if(n != pIns->nPluginVelocityHandling)
{
pIns->nPluginVelocityHandling = n;
- m_pModDoc->SetModified();
- m_pSndFile->instrumentModified[m_nInstrument-1] = TRUE;
- m_pModDoc->UpdateAllViews(NULL, HINT_INSNAMES, this);
+ SetInstrumentModified(true);
}
}
}
@@ -2756,9 +2673,7 @@
if(n != pIns->nPluginVolumeHandling)
{
pIns->nPluginVolumeHandling = n;
- m_pModDoc->SetModified();
- m_pSndFile->instrumentModified[m_nInstrument-1] = TRUE;
- m_pModDoc->UpdateAllViews(NULL, HINT_INSNAMES, this);
+ SetInstrumentModified(true);
}
}
}
Modified: trunk/OpenMPT/mptrack/Ctrl_ins.h
===================================================================
--- trunk/OpenMPT/mptrack/Ctrl_ins.h 2011-01-03 15:11:22 UTC (rev 782)
+++ trunk/OpenMPT/mptrack/Ctrl_ins.h 2011-01-03 19:08:33 UTC (rev 783)
@@ -120,7 +120,8 @@
VOID UpdateFilterText();
LONG* GetSplitPosRef() {return &CMainFrame::glInstrumentWindowHeight;} //rewbs.varWindowSize
-
+protected:
+ void CCtrlInstruments::SetInstrumentModified(const bool modified);
public:
//{{AFX_VIRTUAL(CCtrlInstruments)
Modified: trunk/OpenMPT/mptrack/Moddoc.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Moddoc.cpp 2011-01-03 15:11:22 UTC (rev 782)
+++ trunk/OpenMPT/mptrack/Moddoc.cpp 2011-01-03 19:08:33 UTC (rev 783)
@@ -113,6 +113,8 @@
time(&m_creationTime);
m_FileHistory.clear();
+ m_bsInstrumentModified.reset();
+
#ifdef _DEBUG
MODCHANNEL *p = m_SndFile.Chn;
if (((DWORD)p) & 7) Log("MODCHANNEL is not aligned (0x%08X)\n", p);
@@ -463,8 +465,13 @@
bool unsavedInstrument = false;
- for(UINT i = 0 ; i < m_SndFile.m_nInstruments ; i++){
- if(m_SndFile.instrumentModified[i]) { unsavedInstrument = true; break; }
+ for(INSTRUMENTINDEX i = 0 ; i < m_SndFile.GetNumInstruments() ; i++)
+ {
+ if(m_bsInstrumentModified[i])
+ {
+ unsavedInstrument = true;
+ break;
+ }
}
if(unsavedInstrument && ::MessageBox(NULL,"Do you want to save modified instruments?",NULL,MB_ICONQUESTION | MB_YESNO | MB_APPLMODAL) == IDYES){
@@ -905,7 +912,7 @@
if (nVol >= 0) pChn->nVolume = nVol;
// handle sample looping.
- // Fix: Bug report 1700.
+ // Changed line to fix http://forum.openmpt.org/index.php?topic=1700.0
//if ((loopstart + 16 < loopend) && (loopstart >= 0) && (loopend <= (LONG)pChn->nLength)) {
if ((loopstart + 16 < loopend) && (loopstart >= 0) && (pChn->pModSample != nullptr))
{
@@ -3332,7 +3339,7 @@
END_CRITICAL();
// set playback timer in the status bar
- SetElapsedTime(nOrd, nRow);
+ SetElapsedTime(nOrd, 0);
if (pModPlaying != this)
{
Modified: trunk/OpenMPT/mptrack/Moddoc.h
===================================================================
--- trunk/OpenMPT/mptrack/Moddoc.h 2011-01-03 15:11:22 UTC (rev 782)
+++ trunk/OpenMPT/mptrack/Moddoc.h 2011-01-03 19:08:33 UTC (rev 783)
@@ -182,6 +182,9 @@
vector<FileHistory> m_FileHistory; // File edit history
time_t m_creationTime;
+public:
+ std::bitset<MAX_INSTRUMENTS> m_bsInstrumentModified; // which instruments have been modified? (for ITP functionality)
+
protected: // create from serialization only
CModDoc();
DECLARE_SERIAL(CModDoc)
Modified: trunk/OpenMPT/mptrack/Modedit.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Modedit.cpp 2011-01-03 15:11:22 UTC (rev 782)
+++ trunk/OpenMPT/mptrack/Modedit.cpp 2011-01-03 19:08:33 UTC (rev 783)
@@ -451,7 +451,7 @@
// -> CODE#0023
// -> DESC="IT project files (.itp)"
strcpy(m_SndFile.m_szInstrumentPath[newins - 1], m_SndFile.m_szInstrumentPath[nDuplicate - 1]);
- m_SndFile.instrumentModified[newins - 1] = false;
+ m_bsInstrumentModified.reset(newins - 1);
// -! NEW_FEATURE#0023
} else
{
Modified: trunk/OpenMPT/mptrack/View_tre.cpp
===================================================================
--- trunk/OpenMPT/mptrack/View_tre.cpp 2011-01-03 15:11:22 UTC (rev 782)
+++ trunk/OpenMPT/mptrack/View_tre.cpp 2011-01-03 19:08:33 UTC (rev 783)
@@ -968,9 +968,9 @@
if((pSndFile->m_dwSongFlags & SONG_ITPROJECT) != 0)
{
// 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, (LPCTSTR)pSndFile->GetInstrumentName(nIns));
+ const bool pathOk = pSndFile->m_szInstrumentPath[nIns - 1][0] != '\0';
+ const bool instMod = pDoc->m_bsInstrumentModified.test(nIns - 1);
+ wsprintf(s, pathOk ? (instMod ? "%3d: * %s" : "%3d: %s") : "%3d: ? %s", nIns, (LPCTSTR)pSndFile->GetInstrumentName(nIns));
} else
{
wsprintf(s, "%3d: %s", nIns, (LPCTSTR)pSndFile->GetInstrumentName(nIns));
@@ -3050,7 +3050,8 @@
strcpy(pSndFile->m_szInstrumentPath[modItemID - 1], files.first_file.c_str());
}
- if(pSndFile->m_szInstrumentPath[modItemID - 1][0] != '\0'){
+ if(pSndFile->m_szInstrumentPath[modItemID - 1][0] != '\0')
+ {
int size = strlen(pSndFile->m_szInstrumentPath[modItemID - 1]);
BOOL iti = _stricmp(&pSndFile->m_szInstrumentPath[modItemID - 1][size-3],"iti") == 0;
BOOL xi = _stricmp(&pSndFile->m_szInstrumentPath[modItemID - 1][size-2],"xi") == 0;
@@ -3060,7 +3061,7 @@
if(xi || (!xi && !iti && pSndFile->m_nType == MOD_TYPE_XM))
pSndFile->SaveXIInstrument((INSTRUMENTINDEX)modItemID, pSndFile->m_szInstrumentPath[modItemID - 1]);
- pSndFile->instrumentModified[modItemID - 1] = false;
+ pModDoc->m_bsInstrumentModified.reset(modItemID - 1);
}
if(pModDoc) pModDoc->UpdateAllViews(NULL, HINT_MODTYPE);
Modified: trunk/OpenMPT/soundlib/Sampleio.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Sampleio.cpp 2011-01-03 15:11:22 UTC (rev 782)
+++ trunk/OpenMPT/soundlib/Sampleio.cpp 2011-01-03 19:08:33 UTC (rev 783)
@@ -11,6 +11,9 @@
#include "sndfile.h"
#include "it_defs.h"
#include "wavConverter.h"
+#ifdef MODPLUG_TRACKER
+#include "../mptrack/Moddoc.h"
+#endif //MODPLUG_TRACKER
#include "Wav.h"
#pragma warning(disable:4244)
@@ -116,8 +119,13 @@
// -> CODE#0023
// -> DESC="IT project files (.itp)"
- m_szInstrumentPath[nInstr-1][0] = '\0';
- instrumentModified[nInstr-1] = false;
+ m_szInstrumentPath[nInstr - 1][0] = '\0';
+#ifdef MODPLUG_TRACKER
+ if(GetpModDoc())
+ {
+ GetpModDoc()->m_bsInstrumentModified.reset(nInstr - 1);
+ }
+#endif // MODPLUG_TRACKER
// -! NEW_FEATURE#0023
MODINSTRUMENT *pIns = Instruments[nInstr];
Modified: trunk/OpenMPT/soundlib/Sndfile.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Sndfile.cpp 2011-01-03 15:11:22 UTC (rev 782)
+++ trunk/OpenMPT/soundlib/Sndfile.cpp 2011-01-03 19:08:33 UTC (rev 783)
@@ -484,7 +484,6 @@
for(UINT i = 0; i < MAX_INSTRUMENTS; i++)
{
m_szInstrumentPath[i][0] = '\0';
- instrumentModified[i] = false;
}
// -! NEW_FEATURE#0023
Modified: trunk/OpenMPT/soundlib/Sndfile.h
===================================================================
--- trunk/OpenMPT/soundlib/Sndfile.h 2011-01-03 15:11:22 UTC (rev 782)
+++ trunk/OpenMPT/soundlib/Sndfile.h 2011-01-03 19:08:33 UTC (rev 783)
@@ -643,7 +643,6 @@
// -> CODE#0023
// -> DESC="IT project files (.itp)"
CHAR m_szInstrumentPath[MAX_INSTRUMENTS][_MAX_PATH];
- bool instrumentModified[MAX_INSTRUMENTS];
// -! NEW_FEATURE#0023
public:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sag...@us...> - 2011-01-03 15:11:29
|
Revision: 782
http://modplug.svn.sourceforge.net/modplug/?rev=782&view=rev
Author: saga-games
Date: 2011-01-03 15:11:22 +0000 (Mon, 03 Jan 2011)
Log Message:
-----------
[Ref] Added a version of SpaceToNullStringFixed with static length checks (using another template parameter) which should be preferred over the dynamic check version if the string length is known.
Modified Paths:
--------------
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_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/load_j2b.cpp
Modified: trunk/OpenMPT/mptrack/misc_util.h
===================================================================
--- trunk/OpenMPT/mptrack/misc_util.h 2011-01-03 14:49:21 UTC (rev 781)
+++ trunk/OpenMPT/mptrack/misc_util.h 2011-01-03 15:11:22 UTC (rev 782)
@@ -189,23 +189,45 @@
//--------------------------------------
{
STATIC_ASSERT(size > 0);
- bool overwrite = false;
- for(size_t pos = 0; pos < size; pos++)
+ size_t pos = 0;
+ // Find the first null char.
+ while(buffer[pos] != '\0' && pos < size)
{
- if(overwrite)
- buffer[pos] = 0;
- else if(buffer[pos] == 0)
- overwrite = true;
+ pos++;
}
+ // Remove everything after the null char.
+ while(pos < size)
+ {
+ buffer[pos++] = '\0';
+ }
}
-// Convert a space-padded string to a 0-terminated string.
-// Additional parameter to specifify the max length of the final string,
+// Convert a space-padded string to a 0-terminated string. STATIC VERSION! (use this if the maximum string length is known)
+// Additional template parameter to specifify the max length of the final string,
// not including null char (useful for e.g. mod loaders)
+template <size_t length, size_t size>
+void SpaceToNullStringFixed(char (&buffer)[size])
+//------------------------------------------------
+{
+ STATIC_ASSERT(size > 0);
+ STATIC_ASSERT(length < size);
+ // Remove Nulls in string
+ SpaceToNullString(buffer);
+ // Overwrite trailing chars
+ for(size_t pos = length; pos < size; pos++)
+ {
+ buffer[pos] = 0;
+ }
+}
+
+
+// Convert a space-padded string to a 0-terminated string. DYNAMIC VERSION!
+// Additional function 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)
-//--------------------------------------------------------------------
+void SpaceToNullStringFixed(char (&buffer)[size], size_t length)
+//--------------------------------------------------------------
{
STATIC_ASSERT(size > 0);
ASSERT(length < size);
Modified: trunk/OpenMPT/soundlib/LOAD_AMF.CPP
===================================================================
--- trunk/OpenMPT/soundlib/LOAD_AMF.CPP 2011-01-03 14:49:21 UTC (rev 781)
+++ trunk/OpenMPT/soundlib/LOAD_AMF.CPP 2011-01-03 15:11:22 UTC (rev 782)
@@ -201,7 +201,7 @@
{
MODSAMPLE *psmp = &Samples[iSmp+1];
memcpy(m_szNames[iSmp + 1], lpStream+dwMemPos, 22);
- SpaceToNullStringFixed(m_szNames[iSmp + 1], 22);
+ SpaceToNullStringFixed<22>(m_szNames[iSmp + 1]);
psmp->nFineTune = MOD2XMFineTune(lpStream[dwMemPos+22]);
psmp->nVolume = lpStream[dwMemPos+23];
psmp->nGlobalVol = 64;
@@ -273,7 +273,7 @@
|| (pfh->numchannels < 1) || (pfh->numchannels > 32))
return false;
memcpy(m_szNames[0], pfh->title, 31);
- SpaceToNullStringFixed(m_szNames[0], 31);
+ SpaceToNullStringFixed<31>(m_szNames[0]);
dwMemPos = sizeof(AMFFILEHEADER);
m_nType = MOD_TYPE_AMF;
m_nChannels = pfh->numchannels;
@@ -334,8 +334,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);
+ SpaceToNullStringFixed<31>(m_szNames[iIns + 1]);
+ SpaceToNullStringFixed<13>(pSmp->filename);
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 2011-01-03 14:49:21 UTC (rev 781)
+++ trunk/OpenMPT/soundlib/LOAD_DBM.CPP 2011-01-03 15:11:22 UTC (rev 782)
@@ -196,7 +196,7 @@
m_nType = MOD_TYPE_DBM;
m_nChannels = CLAMP(BigEndianW(pfh->channels), 1, MAX_BASECHANNELS); // note: MAX_BASECHANNELS is currently 127, but DBM supports up to 128 channels.
memcpy(m_szNames[0], (pfh->songname[0]) ? pfh->songname : pfh->songname2, 32);
- SpaceToNullStringFixed(m_szNames[0], 31);
+ SpaceToNullStringFixed<31>(m_szNames[0]);
Order.resize(nOrders, Order.GetInvalidPatIndex());
for (UINT iOrd=0; iOrd < nOrders; iOrd++)
{
@@ -235,11 +235,11 @@
nsmp = BigEndianW(pih->sampleno);
psmp = ((nsmp) && (nsmp < MAX_SAMPLES)) ? &Samples[nsmp] : nullptr;
memcpy(pIns->name, pih->name, 30);
- SpaceToNullStringFixed(pIns->name, 30);
+ SpaceToNullStringFixed<30>(pIns->name);
if (psmp)
{
memcpy(m_szNames[nsmp], pih->name, 30);
- SpaceToNullStringFixed(m_szNames[nsmp], 30);
+ SpaceToNullStringFixed<30>(m_szNames[nsmp]);
}
pIns->nFadeOut = 1024; // ???
Modified: trunk/OpenMPT/soundlib/LOAD_DMF.CPP
===================================================================
--- trunk/OpenMPT/soundlib/LOAD_DMF.CPP 2011-01-03 14:49:21 UTC (rev 781)
+++ trunk/OpenMPT/soundlib/LOAD_DMF.CPP 2011-01-03 15:11:22 UTC (rev 782)
@@ -100,7 +100,7 @@
if ((pfh->id != 0x464d4444) || (!pfh->version) || (pfh->version & 0xF0)) return false;
dwMemPos = 66;
memcpy(m_szNames[0], pfh->songname, 30);
- SpaceToNullStringFixed(m_szNames[0], 30);
+ SpaceToNullStringFixed<30>(m_szNames[0]);
m_nType = MOD_TYPE_DMF;
m_nChannels = 0;
#ifdef DMFLOG
Modified: trunk/OpenMPT/soundlib/LOAD_DSM.CPP
===================================================================
--- trunk/OpenMPT/soundlib/LOAD_DSM.CPP 2011-01-03 14:49:21 UTC (rev 781)
+++ trunk/OpenMPT/soundlib/LOAD_DSM.CPP 2011-01-03 15:11:22 UTC (rev 782)
@@ -121,7 +121,7 @@
}
}
memcpy(m_szNames[0], psong->songname, 28);
- SpaceToNullStringFixed(m_szNames[0], 28);
+ SpaceToNullStringFixed<28>(m_szNames[0]);
nPat = 0;
nSmp = 1;
while (dwMemPos < dwMemLength - 8)
@@ -215,10 +215,10 @@
DWORD dwPos = dwMemPos + sizeof(DSMSAMPLE);
dwMemPos += 8 + pSmp->inst_len;
memcpy(m_szNames[nSmp], pSmp->samplename, 28);
- SpaceToNullStringFixed(m_szNames[nSmp], 28);
+ SpaceToNullStringFixed<28>(m_szNames[nSmp]);
MODSAMPLE *psmp = &Samples[nSmp];
memcpy(psmp->filename, pSmp->filename, 13);
- SpaceToNullStringFixed(psmp->filename, 13);
+ SpaceToNullStringFixed<13>(psmp->filename);
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 2011-01-03 14:49:21 UTC (rev 781)
+++ trunk/OpenMPT/soundlib/Load_669.cpp 2011-01-03 15:11:22 UTC (rev 782)
@@ -70,7 +70,7 @@
m_nChannels = 8;
memcpy(m_szNames[0], pfh->songmessage, 16);
- SpaceToNullStringFixed(m_szNames[0], 16);
+ SpaceToNullStringFixed<16>(m_szNames[0]);
m_nSamples = pfh->samples;
for (SAMPLEINDEX nSmp = 1; nSmp <= m_nSamples; nSmp++, psmp++)
@@ -87,7 +87,7 @@
Samples[nSmp].nLoopEnd = loopend;
if (loopend) Samples[nSmp].uFlags |= CHN_LOOP;
memcpy(m_szNames[nSmp], psmp->filename, 13);
- SpaceToNullStringFixed(m_szNames[nSmp], 13);
+ SpaceToNullStringFixed<13>(m_szNames[nSmp]);
Samples[nSmp].nVolume = 256;
Samples[nSmp].nGlobalVol = 64;
Samples[nSmp].nPan = 128;
Modified: trunk/OpenMPT/soundlib/Load_ams.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Load_ams.cpp 2011-01-03 14:49:21 UTC (rev 781)
+++ trunk/OpenMPT/soundlib/Load_ams.cpp 2011-01-03 15:11:22 UTC (rev 782)
@@ -599,6 +599,7 @@
// AMS Sample unpacking
void AMSUnpack(const char *psrc, UINT inputlen, char *pdest, UINT dmax, char packcharacter)
+//-----------------------------------------------------------------------------------------
{
UINT tmplen = dmax;
signed char *amstmp = new signed char[tmplen];
Modified: trunk/OpenMPT/soundlib/Load_far.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Load_far.cpp 2011-01-03 14:49:21 UTC (rev 781)
+++ trunk/OpenMPT/soundlib/Load_far.cpp 2011-01-03 15:11:22 UTC (rev 782)
@@ -88,7 +88,7 @@
m_nDefaultGlobalVolume = MAX_GLOBAL_VOLUME;
memcpy(m_szNames[0], pmh1->songname, 31);
- SpaceToNullStringFixed(m_szNames[0], 31);
+ SpaceToNullStringFixed<31>(m_szNames[0]);
// Channel Setting
for (UINT nchpan=0; nchpan<16; nchpan++)
@@ -246,7 +246,7 @@
dwMemPos += sizeof(FARSAMPLE);
m_nSamples = ismp + 1;
memcpy(m_szNames[ismp+1], pfs->samplename, 31);
- SpaceToNullStringFixed(m_szNames[ismp + 1], 31);
+ SpaceToNullStringFixed<31>(m_szNames[ismp + 1]);
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 2011-01-03 14:49:21 UTC (rev 781)
+++ trunk/OpenMPT/soundlib/Load_gdm.cpp 2011-01-03 15:11:22 UTC (rev 782)
@@ -102,7 +102,7 @@
// song name
memset(m_szNames, 0, sizeof(m_szNames));
memcpy(m_szNames[0], pHeader->SongTitle, 32);
- SpaceToNullStringFixed(m_szNames[0], 31);
+ SpaceToNullStringFixed<31>(m_szNames[0]);
// read channel pan map... 0...15 = channel panning, 16 = surround channel, 255 = channel does not exist
m_nChannels = 32;
@@ -163,9 +163,9 @@
// sample header
memcpy(m_szNames[iSmp], pSample->SamName, 32);
- SpaceToNullStringFixed(m_szNames[iSmp], 31);
+ SpaceToNullStringFixed<31>(m_szNames[iSmp]);
memcpy(Samples[iSmp].filename, pSample->FileName, 12);
- SpaceToNullStringFixed(Samples[iSmp].filename, 12);
+ SpaceToNullStringFixed<12>(Samples[iSmp].filename);
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 2011-01-03 14:49:21 UTC (rev 781)
+++ trunk/OpenMPT/soundlib/Load_imf.cpp 2011-01-03 15:11:22 UTC (rev 782)
@@ -291,7 +291,7 @@
// song name
memset(m_szNames, 0, sizeof(m_szNames));
memcpy(m_szNames[0], hdr.title, 31);
- SpaceToNullStringFixed(m_szNames[0], 31);
+ SpaceToNullStringFixed<31>(m_szNames[0]);
if (hdr.flags & 1)
m_dwSongFlags |= SONG_LINEARSLIDES;
@@ -310,7 +310,7 @@
ChnSettings[nChn].nPan *= 4;
memcpy(ChnSettings[nChn].szName, hdr.channels[nChn].name, 12);
- SpaceToNullStringFixed(ChnSettings[nChn].szName, 12);
+ SpaceToNullStringFixed<12>(ChnSettings[nChn].szName);
// TODO: reverb/chorus?
switch(hdr.channels[nChn].status)
@@ -503,7 +503,7 @@
SetDefaultInstrumentValues(pIns);
memcpy(pIns->name, imfins.name, 31);
- SpaceToNullStringFixed(pIns->name, 31);
+ SpaceToNullStringFixed<31>(pIns->name);
if(imfins.smpnum)
{
@@ -542,7 +542,7 @@
return false;
memcpy(pSample->filename, imfsmp.filename, 12);
- SpaceToNullStringFixed(pSample->filename, 12);
+ SpaceToNullStringFixed<12>(pSample->filename);
strcpy(m_szNames[m_nSamples], pSample->filename);
blen = pSample->nLength = LittleEndian(imfsmp.length);
Modified: trunk/OpenMPT/soundlib/Load_it.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Load_it.cpp 2011-01-03 14:49:21 UTC (rev 781)
+++ trunk/OpenMPT/soundlib/Load_it.cpp 2011-01-03 15:11:22 UTC (rev 782)
@@ -298,8 +298,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);
+ SpaceToNullStringFixed<26>(pIns->name);
+ SpaceToNullStringFixed<12>(pIns->filename);
pIns->nFadeOut = pis->fadeout << 6;
pIns->nGlobalVol = 64;
for (UINT j=0; j<NOTE_MAX; j++)
@@ -340,8 +340,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);
+ SpaceToNullStringFixed<26>(pIns->name);
+ SpaceToNullStringFixed<12>(pIns->filename);
if (pis->mpr<=128)
pIns->nMidiProgram = pis->mpr;
pIns->nMidiChannel = pis->mch;
@@ -579,7 +579,7 @@
if (pifh->flags & 0x1000) m_dwSongFlags |= SONG_EXFILTERRANGE;
memcpy(m_szNames[0], pifh->songname, 26);
- SpaceToNullStringFixed(m_szNames[0], 26);
+ SpaceToNullStringFixed<26>(m_szNames[0]);
// Global Volume
m_nDefaultGlobalVolume = pifh->globalvol << 1;
@@ -934,7 +934,7 @@
{
MODSAMPLE *pSmp = &Samples[nsmp+1];
memcpy(pSmp->filename, pis->filename, 12);
- SpaceToNullStringFixed(pSmp->filename, 12);
+ SpaceToNullStringFixed<12>(pSmp->filename);
pSmp->uFlags = 0;
pSmp->nLength = 0;
pSmp->nLoopStart = pis->loopbegin;
@@ -989,7 +989,7 @@
}
}
memcpy(m_szNames[nsmp + 1], pis->name, 26);
- SpaceToNullStringFixed(m_szNames[nsmp + 1], 26);
+ SpaceToNullStringFixed<26>(m_szNames[nsmp + 1]);
}
m_nSamples = max(1, m_nSamples);
Modified: trunk/OpenMPT/soundlib/Load_mdl.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Load_mdl.cpp 2011-01-03 14:49:21 UTC (rev 781)
+++ trunk/OpenMPT/soundlib/Load_mdl.cpp 2011-01-03 15:11:22 UTC (rev 782)
@@ -275,7 +275,7 @@
#endif
pmib = (MDLINFOBLOCK *)(lpStream+dwMemPos);
memcpy(m_szNames[0], pmib->songname, 31);
- SpaceToNullStringFixed(m_szNames[0], 31);
+ SpaceToNullStringFixed<31>(m_szNames[0]);
norders = pmib->norders;
if (norders > MAX_ORDERS) norders = MAX_ORDERS;
@@ -370,7 +370,7 @@
MODINSTRUMENT *pIns = Instruments[nins];
memset(pIns, 0, sizeof(MODINSTRUMENT));
memcpy(pIns->name, lpStream+dwPos+2, 32);
- SpaceToNullStringFixed(pIns->name, 31);
+ SpaceToNullStringFixed<31>(pIns->name);
pIns->nGlobalVol = 64;
pIns->nPPC = 5*12;
@@ -461,8 +461,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);
+ SpaceToNullStringFixed<31>(m_szNames[nins]);
+ SpaceToNullStringFixed<8>(pSmp->filename);
const BYTE *p = lpStream+dwPos+41;
if (pmsh->version > 0)
{
Modified: trunk/OpenMPT/soundlib/Load_mod.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Load_mod.cpp 2011-01-03 14:49:21 UTC (rev 781)
+++ trunk/OpenMPT/soundlib/Load_mod.cpp 2011-01-03 15:11:22 UTC (rev 782)
@@ -300,7 +300,7 @@
UINT loopstart, looplen;
memcpy(m_szNames[i], pms->name, 22);
- SpaceToNullStringFixed(m_szNames[i], 22);
+ SpaceToNullStringFixed<22>(m_szNames[i]);
psmp->uFlags = 0;
psmp->nLength = BigEndianW(pms->length)*2;
dwTotalSampleLen += psmp->nLength;
@@ -417,7 +417,7 @@
m_nMinPeriod = 14 << 2;
m_nMaxPeriod = 3424 << 2;
memcpy(m_szNames[0], lpStream, 20);
- SpaceToNullStringFixed(m_szNames[0], 20);
+ SpaceToNullStringFixed<20>(m_szNames[0]);
// Setup channel pan positions and volume
SetupMODPanning();
Modified: trunk/OpenMPT/soundlib/Load_mt2.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Load_mt2.cpp 2011-01-03 14:49:21 UTC (rev 781)
+++ trunk/OpenMPT/soundlib/Load_mt2.cpp 2011-01-03 15:11:22 UTC (rev 782)
@@ -214,7 +214,7 @@
Order[iOrd] = (PATTERNINDEX)pfh->Orders[iOrd];
}
memcpy(m_szNames[0], pfh->szSongName, 32);
- SpaceToNullStringFixed(m_szNames[0], 31);
+ SpaceToNullStringFixed<31>(m_szNames[0]);
dwMemPos = sizeof(MT2FILEHEADER);
nDrumDataLen = *(WORD *)(lpStream + dwMemPos);
@@ -407,7 +407,7 @@
{
memcpy(Instruments[iIns], &m_defaultInstrument, sizeof(MODINSTRUMENT));
memcpy(pIns->name, pmi->szName, 32);
- SpaceToNullStringFixed(pIns->name, 31);
+ SpaceToNullStringFixed<31>(pIns->name);
pIns->nGlobalVol = 64;
pIns->nPan = 128;
for (BYTE i = 0; i < NOTE_MAX; i++)
@@ -520,7 +520,7 @@
if (iSmp < MAX_SAMPLES)
{
memcpy(m_szNames[iSmp], pms->szName, 31);
- SpaceToNullStringFixed(m_szNames[iSmp], 31);
+ SpaceToNullStringFixed<31>(m_szNames[iSmp]);
}
if (pms->dwDataLen > 0)
{
Modified: trunk/OpenMPT/soundlib/Load_mtm.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Load_mtm.cpp 2011-01-03 14:49:21 UTC (rev 781)
+++ trunk/OpenMPT/soundlib/Load_mtm.cpp 2011-01-03 15:11:22 UTC (rev 782)
@@ -61,7 +61,7 @@
|| (!pmh->numtracks) || (!pmh->numchannels)
|| (!pmh->lastpattern) || (pmh->lastpattern > MAX_PATTERNS)) return false;
memcpy(m_szNames[0], pmh->songname, 20);
- SpaceToNullStringFixed(m_szNames[0], 20);
+ SpaceToNullStringFixed<20>(m_szNames[0]);
if (dwMemPos + 37 * pmh->numsamples + 128 + 192 * pmh->numtracks
+ 64 * (pmh->lastpattern+1) + pmh->commentsize >= dwMemLength) return false;
@@ -73,7 +73,7 @@
{
MTMSAMPLE *pms = (MTMSAMPLE *)(lpStream + dwMemPos);
memcpy(m_szNames[i], pms->samplename, 22);
- SpaceToNullStringFixed(m_szNames[i], 22);
+ SpaceToNullStringFixed<22>(m_szNames[i]);
Samples[i].nVolume = pms->volume << 2;
Samples[i].nGlobalVol = 64;
UINT len = pms->length;
Modified: trunk/OpenMPT/soundlib/Load_okt.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Load_okt.cpp 2011-01-03 14:49:21 UTC (rev 781)
+++ trunk/OpenMPT/soundlib/Load_okt.cpp 2011-01-03 15:11:22 UTC (rev 782)
@@ -74,7 +74,7 @@
MemsetZero(*pSmp);
strncpy(pSndFile->m_szNames[nSmp], oktsmp.name, 20);
- SpaceToNullStringFixed(pSndFile->m_szNames[nSmp], 20);
+ SpaceToNullStringFixed<20>(pSndFile->m_szNames[nSmp]);
pSmp->nC5Speed = 8287;
pSmp->nGlobalVol = 64;
Modified: trunk/OpenMPT/soundlib/Load_psm.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Load_psm.cpp 2011-01-03 14:49:21 UTC (rev 781)
+++ trunk/OpenMPT/soundlib/Load_psm.cpp 2011-01-03 15:11:22 UTC (rev 782)
@@ -186,7 +186,7 @@
{
case PSMCHUNKID_TITL: // "TITL" - Song Title
memcpy(m_szNames[0], lpStream + dwMemPos, (chunkSize < 31) ? chunkSize : 31);
- SpaceToNullStringFixed(m_szNames[0], 31);
+ SpaceToNullStringFixed<31>(m_szNames[0]);
break;
case PSMCHUNKID_SDFT: // "SDFT" - Format info (song data starts here)
@@ -220,7 +220,7 @@
PSMSUBSONG subsong;
subsong.restartPos = (ORDERINDEX)Order.size(); // restart order "offset": current orderlist length
memcpy(subsong.songName, &pSong->songType, 9); // subsong name
- SpaceToNullStringFixed(subsong.songName, 9);
+ SpaceToNullStringFixed<9>(subsong.songName);
DWORD dwChunkPos = dwMemPos + sizeof(PSMSONGHEADER);
@@ -445,9 +445,9 @@
SAMPLEINDEX smp = (SAMPLEINDEX)(LittleEndianW(pSample->sampleNumber) + 1);
m_nSamples = max(m_nSamples, smp);
memcpy(m_szNames[smp], pSample->sampleName, 31);
- SpaceToNullStringFixed(m_szNames[smp], 31);
+ SpaceToNullStringFixed<31>(m_szNames[smp]);
memcpy(Samples[smp].filename, pSample->fileName, 8);
- SpaceToNullStringFixed(Samples[smp].filename, 8);
+ SpaceToNullStringFixed<8>(Samples[smp].filename);
Samples[smp].nGlobalVol = 0x40;
Samples[smp].nC5Speed = LittleEndianW(pSample->C5Freq);
@@ -469,9 +469,9 @@
SAMPLEINDEX smp = (SAMPLEINDEX)(LittleEndianW(pSample->sampleNumber) + 1);
m_nSamples = max(m_nSamples, smp);
memcpy(m_szNames[smp], pSample->sampleName, 31);
- SpaceToNullStringFixed(m_szNames[smp], 31);
+ SpaceToNullStringFixed<31>(m_szNames[smp]);
memcpy(Samples[smp].filename, pSample->fileName, 8);
- SpaceToNullStringFixed(Samples[smp].filename, 8);
+ SpaceToNullStringFixed<8>(Samples[smp].filename);
Samples[smp].nGlobalVol = 0x40;
Samples[smp].nC5Speed = LittleEndianW(pSample->C5Freq);
@@ -895,7 +895,7 @@
memset(m_szNames, 0, sizeof(m_szNames));
memcpy(m_szNames[0], shdr->songName, 31);
- SpaceToNullStringFixed(m_szNames[0], 31);
+ SpaceToNullStringFixed<31>(m_szNames[0]);
// Read orders
dwMemPos = LittleEndian(shdr->orderOffset);
@@ -935,9 +935,9 @@
m_nSamples = max(m_nSamples, iSmp);
memcpy(m_szNames[iSmp], smphdr->name, 24);
- SpaceToNullStringFixed(m_szNames[iSmp], 24);
+ SpaceToNullStringFixed<24>(m_szNames[iSmp]);
memcpy(Samples[iSmp].filename, smphdr->filename, 13);
- SpaceToNullStringFixed(Samples[iSmp].filename, 13);
+ SpaceToNullStringFixed<13>(Samples[iSmp].filename);
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 2011-01-03 14:49:21 UTC (rev 781)
+++ trunk/OpenMPT/soundlib/Load_ptm.cpp 2011-01-03 15:11:22 UTC (rev 782)
@@ -91,7 +91,7 @@
|| (!pfh.npatterns) || (pfh.npatterns > 128)
|| (SIZEOF_PTMFILEHEADER+pfh.nsamples*SIZEOF_PTMSAMPLE >= (int)dwMemLength)) return false;
memcpy(m_szNames[0], pfh.songname, 28);
- SpaceToNullStringFixed(m_szNames[0], 28);
+ SpaceToNullStringFixed<28>(m_szNames[0]);
m_nType = MOD_TYPE_PTM;
m_nChannels = pfh.nchannels;
@@ -112,8 +112,8 @@
lstrcpyn(m_szNames[ismp+1], psmp->samplename, 28);
memcpy(pSmp->filename, psmp->filename, 12);
- SpaceToNullStringFixed(m_szNames[ismp + 1], 28);
- SpaceToNullStringFixed(pSmp->filename, 12);
+ SpaceToNullStringFixed<28>(m_szNames[ismp + 1]);
+ SpaceToNullStringFixed<12>(pSmp->filename);
pSmp->nGlobalVol = 64;
pSmp->nPan = 128;
Modified: trunk/OpenMPT/soundlib/Load_s3m.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Load_s3m.cpp 2011-01-03 14:49:21 UTC (rev 781)
+++ trunk/OpenMPT/soundlib/Load_s3m.cpp 2011-01-03 15:11:22 UTC (rev 782)
@@ -267,7 +267,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);
+ SpaceToNullStringFixed<28>(m_szNames[0]);
// Speed
m_nDefaultSpeed = psfh.speed;
if (!m_nDefaultSpeed || m_nDefaultSpeed == 255) m_nDefaultSpeed = 6;
@@ -355,13 +355,13 @@
memcpy(s, lpStream+nInd, 0x50);
memcpy(Samples[iSmp].filename, s+1, 12);
- SpaceToNullStringFixed(Samples[iSmp].filename, 12);
+ SpaceToNullStringFixed<12>(Samples[iSmp].filename);
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);
+ SpaceToNullStringFixed<28>(m_szNames[iSmp]);
if ((s[0] == S3I_TYPE_PCM) && (s[0x4E] == 'R') && (s[0x4F] == 'S'))
{
Modified: trunk/OpenMPT/soundlib/Load_stm.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Load_stm.cpp 2011-01-03 14:49:21 UTC (rev 781)
+++ trunk/OpenMPT/soundlib/Load_stm.cpp 2011-01-03 15:11:22 UTC (rev 782)
@@ -70,7 +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);
+ SpaceToNullStringFixed<20>(m_szNames[0]);
// Read STM header
m_nType = MOD_TYPE_STM;
m_nSamples = 31;
@@ -98,8 +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);
+ SpaceToNullStringFixed<12>(pIns->filename);
+ SpaceToNullStringFixed<12>(m_szNames[nIns + 1]);
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 2011-01-03 14:49:21 UTC (rev 781)
+++ trunk/OpenMPT/soundlib/Load_ult.cpp 2011-01-03 15:11:22 UTC (rev 782)
@@ -371,7 +371,7 @@
memcpy(m_szNames[nSmp + 1], ultSmp.name, 32);
SetNullTerminator(m_szNames[nSmp + 1]);
memcpy(pSmp->filename, ultSmp.filename, 12);
- SpaceToNullStringFixed(pSmp->filename, 12);
+ SpaceToNullStringFixed<12>(pSmp->filename);
if(ultSmp.size_end <= ultSmp.size_start)
continue;
Modified: trunk/OpenMPT/soundlib/Load_xm.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Load_xm.cpp 2011-01-03 14:49:21 UTC (rev 781)
+++ trunk/OpenMPT/soundlib/Load_xm.cpp 2011-01-03 15:11:22 UTC (rev 782)
@@ -254,7 +254,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);
+ SpaceToNullStringFixed<20>(m_szNames[0]);
// load and convert header
memcpy(&xmheader, lpStream + 58, sizeof(XMFILEHEADER));
@@ -325,7 +325,7 @@
Instruments[iIns]->nPluginVolumeHandling = PLUGIN_VOLUMEHANDLING_IGNORE;
memcpy(Instruments[iIns]->name, pih.name, 22);
- SpaceToNullStringFixed(Instruments[iIns]->name, 22);
+ SpaceToNullStringFixed<22>(Instruments[iIns]->name);
memset(&xmsh, 0, sizeof(XMSAMPLEHEADER));
@@ -528,7 +528,7 @@
if (!xmss.looplen) xmss.type &= ~3;
UINT imapsmp = samplemap[ins];
memcpy(m_szNames[imapsmp], xmss.name, 22);
- SpaceToNullStringFixed(m_szNames[imapsmp], 22);
+ SpaceToNullStringFixed<22>(m_szNames[imapsmp]);
MODSAMPLE *pSmp = &Samples[imapsmp];
pSmp->nLength = (xmss.samplen > MAX_SAMPLE_LENGTH) ? MAX_SAMPLE_LENGTH : xmss.samplen;
pSmp->nLoopStart = xmss.loopstart;
@@ -557,7 +557,7 @@
pSmp->nVibDepth = xmsh.vibdepth;
pSmp->nVibRate = xmsh.vibrate;
memcpy(pSmp->filename, xmss.name, 22);
- SpaceToNullStringFixed(pSmp->filename, 21);
+ SpaceToNullStringFixed<21>(pSmp->filename);
if ((xmss.type & 3) == 3) // MPT 1.09 and maybe newer / older versions set both flags for bidi loops
bProbablyMPT109 = true;
Modified: trunk/OpenMPT/soundlib/load_j2b.cpp
===================================================================
--- trunk/OpenMPT/soundlib/load_j2b.cpp 2011-01-03 14:49:21 UTC (rev 781)
+++ trunk/OpenMPT/soundlib/load_j2b.cpp 2011-01-03 15:11:22 UTC (rev 782)
@@ -487,7 +487,7 @@
ASSERT_CAN_READ_CHUNK(mainchunk->channels);
memcpy(m_szNames[0], mainchunk->songname, 32);
- SpaceToNullStringFixed(m_szNames[0], 31);
+ SpaceToNullStringFixed<31>(m_szNames[0]);
m_dwSongFlags = SONG_ITOLDEFFECTS | SONG_ITCOMPATGXX;
if(!(mainchunk->flags & 0x01)) m_dwSongFlags |= SONG_LINEARSLIDES;
if(mainchunk->channels < 1) return false;
@@ -558,7 +558,7 @@
m_nInstruments = max(m_nInstruments, nIns);
memcpy(pIns->name, instheader->name, 28);
- SpaceToNullStringFixed(pIns->name, 28);
+ SpaceToNullStringFixed<28>(pIns->name);
for(BYTE i = 0; i < 128; i++)
{
@@ -599,7 +599,7 @@
if(smpchunk->signature != AMCHUNKID_SAMP) break; // SAMP
memcpy(m_szNames[nSmp], smpchunk->name, 28);
- SpaceToNullStringFixed(m_szNames[nSmp], 28);
+ SpaceToNullStringFixed<28>(m_szNames[nSmp]);
Samples[nSmp].nPan = smpchunk->pan << 2;
Samples[nSmp].nVolume = smpchunk->volume << 2;
@@ -669,7 +669,7 @@
m_nInstruments = max(m_nInstruments, nIns);
memcpy(pIns->name, instheader->name, 32);
- SpaceToNullStringFixed(pIns->name, 31);
+ SpaceToNullStringFixed<31>(pIns->name);
for(BYTE i = 0; i < 128; i++)
{
@@ -717,7 +717,7 @@
MemsetZero(Samples[nSmp]);
memcpy(m_szNames[nSmp], smpchunk->name, 32);
- SpaceToNullStringFixed(m_szNames[nSmp], 31);
+ SpaceToNullStringFixed<31>(m_szNames[nSmp]);
if(LittleEndianW(smpchunk->pan) > 0x7FFF || LittleEndianW(smpchunk->volume) > 0x7FFF)
break;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sag...@us...> - 2011-01-03 14:49:29
|
Revision: 781
http://modplug.svn.sourceforge.net/modplug/?rev=781&view=rev
Author: saga-games
Date: 2011-01-03 14:49:21 +0000 (Mon, 03 Jan 2011)
Log Message:
-----------
[Fix] High notes were broken in XM files since rev.764 (http://bugs.openmpt.org/view.php?id=55)
[Mod] When using the ACM MP3 codec, 320kbit/s bitrate should now theoretically be available.
[Mod] Updated copyright year
[Mod] Updated history.txt
[Mod] OpenMPT: Version is now 1.19.00.18
[Ref] Minor refactoring in ctrl_smp.cpp, vstplug.cpp
Modified Paths:
--------------
trunk/OpenMPT/mptrack/Ctrl_smp.cpp
trunk/OpenMPT/mptrack/Mptrack.cpp
trunk/OpenMPT/mptrack/Vstplug.cpp
trunk/OpenMPT/mptrack/Vstplug.h
trunk/OpenMPT/mptrack/version.h
trunk/OpenMPT/packageTemplate/History.txt
trunk/OpenMPT/soundlib/Snd_fx.cpp
Modified: trunk/OpenMPT/mptrack/Ctrl_smp.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Ctrl_smp.cpp 2011-01-02 16:10:49 UTC (rev 780)
+++ trunk/OpenMPT/mptrack/Ctrl_smp.cpp 2011-01-03 14:49:21 UTC (rev 781)
@@ -45,8 +45,9 @@
// Deduce exponent from equation : v = 2^exponent
int PowerOf2Exponent(const unsigned int v)
{
- float v2f = (float)v;
- return ( (*(int *)&v2f >> 23) & 0xff ) - 127;
+ return (int)_logb((double)v);
+ //float v2f = (float)v;
+ //return ( (*(int *)&v2f >> 23) & 0xff ) - 127;
}
// -! TEST#0029
@@ -1075,7 +1076,7 @@
{
if ((m_pModDoc) && (m_pSndFile))
{
- // Fix (bug report 1366).
+ // Commented out line to fix http://forum.openmpt.org/index.php?topic=1366.0
// if ((m_pSndFile->IsPaused()) && (m_pModDoc->IsNotePlaying(0, m_nSample, 0)))
if (m_pModDoc->IsNotePlaying(0, m_nSample, 0))
{
@@ -1378,9 +1379,8 @@
dwEnd = pSmp->nLength;
}
- smplsize = (pSmp->uFlags & CHN_16BIT) ? 2 : 1;
- if (pSmp->uFlags & CHN_STEREO) smplsize *= 2;
- newsmplsize = (pSmp->uFlags & CHN_STEREO) ? 4 : 2;
+ smplsize = pSmp->GetBytesPerSample();
+ newsmplsize = pSmp->GetNumChannels() * 2; // new sample is always 16-Bit
pOriginal = pSmp->pSample;
dwNewLen = pSmp->nLength + (dwEnd-dwStart);
pNewSample = NULL;
@@ -1389,7 +1389,7 @@
{
m_pModDoc->GetSampleUndo()->PrepareUndo(m_nSample, sundo_replace);
- UINT nCh = (pSmp->uFlags & CHN_STEREO) ? 2 : 1;
+ const UINT nCh = pSmp->GetNumChannels();
for (UINT iCh=0; iCh<nCh; iCh++)
{
int len = dwEnd-dwStart;
@@ -1526,8 +1526,7 @@
dwStart = 0;
dwEnd = pSmp->nLength;
}
- smplsize = (pSmp->uFlags & CHN_16BIT) ? 2 : 1;
- if (pSmp->uFlags & CHN_STEREO) smplsize *= 2;
+ smplsize = pSmp->GetSampleSizeInBytes();
pOriginal = pSmp->pSample;
dwRemove = (dwEnd-dwStart+1)>>1;
dwNewLen = pSmp->nLength - dwRemove;
@@ -1539,7 +1538,7 @@
m_pModDoc->GetSampleUndo()->PrepareUndo(m_nSample, sundo_replace);
- UINT nCh = (pSmp->uFlags & CHN_STEREO) ? 2 : 1;
+ const UINT nCh = pSmp->GetNumChannels();
for (UINT iCh=0; iCh<nCh; iCh++)
{
int len = dwRemove;
@@ -2599,7 +2598,7 @@
if(pSmp->uFlags & CHN_LOOP)
{
/* only update sample buffer if the loop is actually enabled
- (resets sound without any reason otherwise) - bug report 1874 */
+ (resets sound without any reason otherwise) - http://forum.openmpt.org/index.php?topic=1874.0 */
m_pModDoc->AdjustEndOfSample(m_nSample);
}
m_pModDoc->UpdateAllViews(NULL, (m_nSample << HINT_SHIFT_SMP) | HINT_SAMPLEDATA, this);
@@ -2620,7 +2619,7 @@
if(pSmp->uFlags & CHN_LOOP)
{
/* only update sample buffer if the loop is actually enabled
- (resets sound without any reason otherwise) - bug report 1874 */
+ (resets sound without any reason otherwise) - http://forum.openmpt.org/index.php?topic=1874.0 */
m_pModDoc->AdjustEndOfSample(m_nSample);
}
m_pModDoc->UpdateAllViews(NULL, (m_nSample << HINT_SHIFT_SMP) | HINT_SAMPLEDATA, this);
Modified: trunk/OpenMPT/mptrack/Mptrack.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Mptrack.cpp 2011-01-02 16:10:49 UTC (rev 780)
+++ trunk/OpenMPT/mptrack/Mptrack.cpp 2011-01-03 14:49:21 UTC (rev 781)
@@ -802,13 +802,6 @@
// Initialize OLE MFC support
AfxOleInit();
// Standard initialization
-/*
-#ifdef _AFXDLL
- Enable3dControls(); // Call this when using MFC in a shared DLL
-#else
- Enable3dControlsStatic(); // Call this when linking to MFC statically
-#endif
-*/
// Change the registry key under which our settings are stored.
//SetRegistryKey(_T("Olivier Lapicque"));
@@ -1793,12 +1786,12 @@
const char* const pArrCredit = {
"OpenMPT / ModPlug Tracker|"
- "Copyright \xA9 2004-2010 Contributors|"
+ "Copyright \xA9 2004-2011 Contributors|"
"Copyright \xA9 1997-2003 Olivier Lapicque (ol...@mo...)|"
"|"
"Contributors:|"
- "Ahti Lepp\xE4nen (2005-2010)|"
- "Johannes Schultz (2008-2010)|"
+ "Ahti Lepp\xE4nen (2005-2011)|"
+ "Johannes Schultz (2008-2011)|"
"Robin Fernandes (2004-2007)|"
"Sergiy Pylypenko (2007)|"
"Eric Chavanon (2004-2005)|"
@@ -2708,6 +2701,7 @@
}
switch(iFmt & 7)
{
+ case 5: wfx.wfx.nAvgBytesPerSec = 320/8; break;
case 4: wfx.wfx.nAvgBytesPerSec = 64/8; break;
case 3: wfx.wfx.nAvgBytesPerSec = 96/8; break;
case 2: wfx.wfx.nAvgBytesPerSec = 128/8; break;
Modified: trunk/OpenMPT/mptrack/Vstplug.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Vstplug.cpp 2011-01-02 16:10:49 UTC (rev 780)
+++ trunk/OpenMPT/mptrack/Vstplug.cpp 2011-01-03 14:49:21 UTC (rev 781)
@@ -671,7 +671,8 @@
if(pModDoc->GetSoundFile() && pModDoc->GetSoundFile()->GetModSpecifications().supportsPlugins)
CMainFrame::GetMainFrame()->ThreadSafeSetModified(pModDoc);
}
- //Could be used to update general tab in real time, but causes flickers in treeview
+ // Could be used to update general tab in real time, but causes flickers in treeview
+ // Better idea: add an update hint just for plugin params?
//pModDoc->UpdateAllViews(NULL, HINT_MIXPLUGINS, NULL);
}
@@ -789,7 +790,7 @@
timeInfo.timeSigDenominator = 4; //gcd(pSndFile->m_nCurrentRowsPerMeasure, pSndFile->m_nCurrentRowsPerBeat);
}
}
- return (VstIntPtr)&timeInfo;
+ return ToVstPtr(&timeInfo);
}
// VstEvents* in <ptr>
// We don't support plugs that send VSTEvents to the host
@@ -891,7 +892,7 @@
// Not entirely sure what this means. We can write automation TO the plug.
// Is that "read" in this context?
//Log("VST plugin to host: Get Automation State\n");
- return 2;
+ return kVstAutomationRead;
case audioMasterOfflineStart:
Log("VST plugin to host: Offlinestart\n");
@@ -972,8 +973,8 @@
break;
// get plug directory, FSSpec on MAC, else char*
case audioMasterGetDirectory:
- Log("VST plugin to host: Get Directory\n");
- break;
+ //Log("VST plugin to host: Get Directory\n");
+ return ToVstPtr(CMainFrame::GetDefaultDirectory(DIR_PLUGINS));
// something has changed, update 'multi-fx' display
case audioMasterUpdateDisplay:
if (effect && effect->resvd1)
@@ -1064,13 +1065,13 @@
VstFileType *pType = &(pFileSel->fileTypes[i]);
extensions += pType->name;
extensions += "|";
-#if (defined(WIN32) || defined(WINDOWS))
+#if (defined(WIN32) || (defined(WINDOWS) && WINDOWS == 1))
extensions += "*.";
extensions += pType->dosType;
-#elif defined(MAC)
+#elif defined(MAC) && MAC == 1
extensions += "*";
extensions += pType->macType;
-#elif defined(UNIX)
+#elif defined(UNIX) && UNIX == 1
extensions += "*.";
extensions += pType->unixType;
#else
@@ -1315,7 +1316,7 @@
} _PROBLEMATIC_PLUG, *PPROBLEMATIC_PLUG;
//TODO: Check whether the list is still valid.
-#define NUM_PROBLEMPLUGS 3
+#define NUM_PROBLEMPLUGS 2
static _PROBLEMATIC_PLUG gProblemPlugs[NUM_PROBLEMPLUGS] =
{
{kEffectMagic, CCONST('N', 'i', '4', 'S'), 1, "Native Instruments B4", "* v1.1.1 hangs on playback. Do not proceed unless you have v1.1.5. *"},
@@ -1762,7 +1763,7 @@
//rewbs.VSTcompliance
//Store a pointer so we can get the CVstPlugin object from the basic VST effect object.
//Assuming 32bit address space...
- m_pEffect->resvd1=(VstIntPtr)this;
+ m_pEffect->resvd1=ToVstPtr(this);
//rewbs.plugDocAware
m_pSndFile = pSndFile;
m_pModDoc = pSndFile->GetpModDoc();
@@ -1770,7 +1771,8 @@
//end rewbs.plugDocAware
Dispatch(effOpen, 0, 0, NULL, 0);
- m_bIsVst2 = (CVstPlugin::Dispatch(effGetVstVersion, 0,0, NULL, 0) >= 2) ? TRUE : FALSE;
+ // VST 2.0 plugins return 2 here, VST 2.4 plugins return 2400... Great!
+ m_bIsVst2 = (CVstPlugin::Dispatch(effGetVstVersion, 0,0, NULL, 0) >= 2) ? true : false;
if (m_bIsVst2)
{
// Set VST speaker in/out setup to Stereo. Required for some plugins (possibly all VST 2.4+ plugins?)
@@ -1802,7 +1804,7 @@
}
}
// For now, input setup = output setup.
- Dispatch(effSetSpeakerArrangement, 0, (VstIntPtr)(&sa), &sa, 0.0f);
+ Dispatch(effSetSpeakerArrangement, 0, ToVstPtr(&sa), &sa, 0.0f);
// Dummy pin properties collection.
// We don't use them but some plugs might do inits in here.
@@ -2302,18 +2304,20 @@
}
void CVstPlugin::Suspend()
+//------------------------
{
try {
Dispatch(effStopProcess, 0, 0, NULL, 0.0f);
Dispatch(effMainsChanged, 0, 0, NULL, 0.0f); // calls plugin's suspend
m_bPlugResumed=false;
} catch (...) {
- CVstPluginManager::ReportPlugException("Exception in Resume() (Plugin=%s)\n", m_pFactory->szLibraryName);
+ CVstPluginManager::ReportPlugException("Exception in Suspend() (Plugin=%s)\n", m_pFactory->szLibraryName);
}
}
void CVstPlugin::ProcessVSTEvents()
+//---------------------------------
{
// Process VST events
if ((m_pEffect) && (m_pEffect->dispatcher) && (m_pEvList) && (m_pEvList->numEvents > 0))
@@ -2351,8 +2355,9 @@
}
-void CVstPlugin::SetDryRatio(UINT param) {
-//----------------------------------------
+void CVstPlugin::SetDryRatio(UINT param)
+//--------------------------------------
+{
param = min(param, 127);
m_pMixStruct->fDryRatio = 1.0-(static_cast<float>(param)/127.0f);
}
Modified: trunk/OpenMPT/mptrack/Vstplug.h
===================================================================
--- trunk/OpenMPT/mptrack/Vstplug.h 2011-01-02 16:10:49 UTC (rev 780)
+++ trunk/OpenMPT/mptrack/Vstplug.h 2011-01-03 14:49:21 UTC (rev 781)
@@ -71,7 +71,7 @@
void (*m_pProcessFP)(AEffect*, float**, float**, VstInt32); //Function pointer to AEffect processReplacing if supported, else process.
CAbstractVstEditor *m_pEditor; //rewbs.defaultPlugGUI
UINT m_nSampleRate;
- BOOL m_bIsVst2;
+ bool m_bIsVst2;
SNDMIXPLUGINSTATE m_MixState;
UINT m_nInputs, m_nOutputs;
VstEvents *m_pEvList;
Modified: trunk/OpenMPT/mptrack/version.h
===================================================================
--- trunk/OpenMPT/mptrack/version.h 2011-01-02 16:10:49 UTC (rev 780)
+++ trunk/OpenMPT/mptrack/version.h 2011-01-03 14:49:21 UTC (rev 781)
@@ -15,7 +15,7 @@
#define VER_MAJORMAJOR 1
#define VER_MAJOR 19
#define VER_MINOR 00
-#define VER_MINORMINOR 17
+#define VER_MINORMINOR 18
//Creates version number from version parts that appears in version string.
//For example MAKE_VERSION_NUMERIC(1,17,02,28) gives version number of
Modified: trunk/OpenMPT/packageTemplate/History.txt
===================================================================
--- trunk/OpenMPT/packageTemplate/History.txt 2011-01-02 16:10:49 UTC (rev 780)
+++ trunk/OpenMPT/packageTemplate/History.txt 2011-01-03 14:49:21 UTC (rev 781)
@@ -10,22 +10,35 @@
(tx XYZ): thanks to XYZ for telling us about the bug
-v1.19.01.00 (October 2010, revision 757)
+v1.19.01.00 (January 2011, revision 781)
----------------------------------------
Pattern tab
+ [New] <Jojo> Clicking and dragging the row numbers selects the whole row now (Excel / Calc style) - see http://bugs.openmpt.org/view.php?id=45
[New] <Jojo> Experimental feature: Play the whole pattern row when entering notes and chords into the pattern editor. This can be enabled from the setup screen.
[Mod] <Jojo> Using the Goto Dialog should now update channel parameters and set the elapsed time. (http://bugs.openmpt.org/view.php?id=28)
+ [Mod] <Jojo> Undo steps have been increased from 100 to 1000.
[Fix] <Jojo> Cursor paste was possible even when editing was disabled.
+ [Fix] <Jojo> Using Right-Click -> Change Plugin on PC notes did not work for plugin numbers that were higher than the highest instrument number.
[Fix] <Jojo> When entering chords into the pattern editor, the module was only marked as modified if the base note of the chord was changed.
[Fix] <Jojo> When jumping to an order which is normally not played, the song variables are now reset (previously, if the main song had f.e. a global volume fade out at the end, this was retained when switching to an unplayed order, effectively muting all sub songs).
+ [Fix] <Jojo> OpenMPT should not crash anymore when applying the Amplify command on a pattern selection that just covers the note / instrument column of the first channel.
[Reg] <Jojo> The "Position aware timer" option is gone. The position aware timer is now automatically used. It was optional in the first place because of some buggy code, which is now fixed.
Pattern tab::Note properties
[Fix] <Jojo> The meaning of Q0x was displayed wrong for S3M / IT.
+ [Fix] <Jojo> Changing a value didn't create an undo point. (http://bugs.openmpt.org/view.php?id=56)
+Pattern tab::Find/replace
+ [New] <Jojo> Added Find / Replace mode: Find in current pattern selection.
+ [Imp] <Jojo> When changing the content of a combobox, the corresponding checkbox is now automatically checked. Likewise, the "Replace By" checkbox is checked if a checkbox or combobox on the "Replace" tab is enabled.
+ [Mod] <Jojo> "Replace All" just creates one undo point now.
+
Sample tab
+ [New] <Jojo> The new "sample grid" feature can create equally-sized sample selections, so it is f.e. easy to split a sample into four equally-sized samples.
[Imp] <re> Ctrl + Mouse Wheel can now be used for zooming into the sample data.
+ [Mod] <Jojo> Undo steps have been increased from 100 to 1000.
[Fix] <Jojo> When cutting samples with a loop, the loop end point was not always moved correctly if the cut start was in the loop.
+ [Fix] <re> Changing zoom level should now preserve the view position better.
Instrument tab
[Imp] <re> Ctrl + Mouse Wheel can now be used for zooming into the envelopes.
@@ -37,14 +50,14 @@
[Imp] <Jojo> Sample sustain loops are now converted to normal loops if needed and possible.
[Imp] <Jojo> Bidi loops are disabled when converting to MOD / S3M now.
[Imp] <Jojo> More warnings are shown, old warning messages were improved.
+ [Imp] <Jojo> Volume command priority when converting from XM to IT / S3M has been changed - Cxx overrides vxx in XM, so this is now taken into account.
[Fix] <Jojo> Q0y means "no volume change" in S3M / IT, but R0y means "continue volume change" in FT2, and converting from IT / S3M to XM didn't consider this. Q0y is now converted to R8y, and E9y is now converted to Q0y (instead of Q8y).
Playback
- [New] <Jojo> New mix mode: Compatible. This is used for MOD / S3M / XM / IT by default and has more appropriate mixing levels for those formats (same levels as Schism Tracker) than mix mode RC3. Please use compatible mixing levels when working with legacy formats from now on.
+ [New] <Jojo> New mix mode: Compatible. This is used for MOD / S3M / XM / IT by default and has more appropriate mixing levels for those formats (same levels as Schism Tracker) than mix mode RC3, and it forces soft panning to be *disabled*. Please use compatible mixing levels when working with legacy formats from now on.
[Imp] <Jojo> Improved the algorithm for finding a free channel for note playback in the editor (does not affect normal module playback).
[Fix] <Jojo> Pattern jumps to the same row + pattern as the jump command are not ignored anymore. (http://forum.openmpt.org/index.php?topic=1810.0)
-
IT
[New] <Jojo> Edit history information can now be read from IT files and saved to IT / MPTM files. This is based on an undocumented feature in Impulse Tracker. Use View -> Edit History for viewing or deleting this information.
[Imp] <Jojo> ITs made with Modplug Tracker 1.00a5 are now also detected as such.
@@ -79,11 +92,14 @@
[Mod] <Jojo> Changed some code in the S3M loader that should only affect really broken S3M files which every player handles different anyway (at least my broken version of aa-polym.s3m sounds better now)
[Fix] <Jojo> Octave 8 was allowed in S3M files while it shouldn't (it wasn't even saved in the file)
[Fix] <Jojo> Removed the X param (#) effect from the supported effect list.
- [Fix] <Jojo> Speed and tempo values are now adjusted to what Screamtracker actually expects (speed 1 - 254, tempo 32 - 255) - anything out of this range is ignored by Screamtracker, so it is now also ignored by OpenMPT.
+ [Fix] <Jojo> Speed and tempo values are now adjusted to what Scream Tracker actually expects (speed 1 - 254, tempo 32 - 255) - anything out of this range is ignored by Scream Tracker, so it is now also ignored by OpenMPT.
VST
+ [New] <Jojo> Plugins can now request common file dialogs (file and directory selection).
[Mod] <Jojo> When automatically inserting a new instrument from the VST editor, the bank and patch values are now not filled in anymore, so it is easier to change to another patch while editing.
- [Fix] <Jojo> VST: The time signature sent to VST plugins should be correct now.
+ [Mod] <Jojo> Various small improvements to support VST 2.4 plugins better.
+ [Fix] <Jojo> Speaker arrangement is now sent to the plugins upon initialization. This fixes Voxengo SPAN 2 (a VST 2.4 plugin). Does this break other multichannel plugins?
+ [Fix] <Jojo> The time signature sent to VST plugins should be correct now.
Other modules
[Imp] <Jojo> Garbage characters in sample / instrument / song names should be gone now.. This should f.e. avoid sample names like " ntitled" turning up in modules after deleting sample names.
@@ -101,7 +117,10 @@
[Mod] <Jojo> On first run, the default ASIO driver is now chosen instead of DirectSound (if there is one).
[Mod] <Jojo> The "Original" mix mode now also has a version number (1.16) to reflect what the "original" thing is.
[Mod] <Jojo> Updated genre list in the MP3 export dialog.
+ [Mod] <Jojo> When using the ACM MP3 codec, 320kbit/s bitrate should now theoretically be available.
+ [Mod] <Jojo> The MMX acceleration label in the Soundcard setup dialog is now updated according to the multimedia extensions that are supported by the CPU (3DNow! / SSE)
[Fix] <Jojo> Mod Cleanup: Rearrange patterns was broken when using more than one sequence in the MPTM format. (tx Skaven)
+ [Fix] <Jojo> Mod Cleanup: Various sample / instrument rearranging functions broke PC Notes.
[Fix] <Jojo> The text length was calculated wrong in the message reader, leading to a possible buffer overflow when reading song messages with mixed line endings where CR or LF line endings where expected.
[Fix] <Jojo> When there was no INI file, the size of the upper pattern view was defaulting to a wrong value.
[Fix] <Jojo> The ID3v2 "comments" field was not formatted properly when exporting to MP3.
@@ -122,7 +141,7 @@
Pattern tab::pattern editing
[Imp] <Jojo> Just like in MPT 1.16, it is now possible again to interpolate between an effect and "nothing". In that case, the same value as the already existing one is repeated between the two rows.
- [Fix] <Jojo> When the first column of a pattern selection (larger than one selection field) was the parameter column, PCNote values in this column were not reset properly.
+ [Fix] <Jojo> When the first column of a pattern selection (larger than one selection field) was the parameter column, PC Note values in this column were not reset properly.
[Fix] <Jojo> Pattern Editor: Transposing notes up/down doesn't allow notes which are actually supported by the current module format (f.e. notes below C-1 in XMs) anymore.
[Fix] <Jojo> Keyboard shortcut for toggling record state didn't save the change, so it was reset with every new module.
@@ -218,12 +237,12 @@
Pattern tab::pattern editing
[New] <Jojo> Extended context menu for PC Notes
- [New] <Jojo> Key shortcut + context menu entry for toggling the plugin editor of the PC note that's under the cursor.
+ [New] <Jojo> Key shortcut + context menu entry for toggling the plugin editor of the PC Note that's under the cursor.
[Imp] <Jojo> Overflow paste now only uses one undo step.
[Imp] <Jojo> Instead of simply ignoring note off/cut/fade when working with .MOD files, it is converted to C00.
- [Fix] <rewbs> Effect visualizer is now aware of PC notes (http://forum.openmpt.org/index.php?topic=3836.0).
+ [Fix] <rewbs> Effect visualizer is now aware of PC Notes (http://forum.openmpt.org/index.php?topic=3836.0).
[Fix] <Jojo> When using MIDI record or split keyboard settings, volume data was written into the volume column in MOD format.
- [Fix] <Jojo> When converting PC Notes to MIDI Macros, the instrument index is now also cleaned as well. Noticeable for example when pasting PC notes into an IT module.
+ [Fix] <Jojo> When converting PC Notes to MIDI Macros, the instrument index is now also cleaned as well. Noticeable for example when pasting PC Notes into an IT module.
[Fix] <Jojo> Now, plugin slot 100 can also be automated using PC Notes.
[Fix] <Jojo> When pasting pattern data that exactly reached the pattern end with overflow paste enabled, a redundant undo point was created.
[Fix] <Jojo> Entered (volume) effects are now properly validated (makes a difference f.e. in MOD format where it was previously possible to enter effects like Hxx)
@@ -233,7 +252,7 @@
Pattern tab::GUI
[New] <Jojo> When the PT1x mode or the S3M "Amiga" flag are enabled, dodgy notes (i.e lower than C-4 or higher than B-6) are marked red.
- [Imp] <Jojo> The status bar shows plugin and parameter names for PC notes now as well.
+ [Imp] <Jojo> The status bar shows plugin and parameter names for PC Notes now as well.
[Imp] <Jojo> Effect vis: Make use of song's own row highlighting variables instead of fixed global ones.
[Fix] <Jojo> The status bar ("Position x of y") only the showed order length for the first sub tune if sub tunes were separated by an "---" order item.
[Fix] <Jojo> Changing a channel plugin in MOD/S3M files doesn't mark them as modified anymore.
@@ -421,14 +440,14 @@
[Fix] <Jojo> Pattern c&p: invalid commands are not pasted anymore.
[Imp] <Jojo> If "record note off" is enabled and Note Off commands are not supported by the current format, try Note Cut and volume commands.
[Mod] <Jojo> It is impossible to enter something into the volume column in MOD format now.
- [Mod] <Jojo> When interpolating PC notes, the plugin number and note type won't get overridden if the note type is already PC or PCs.
+ [Mod] <Jojo> When interpolating PC Notes, the plugin number and note type won't get overridden if the note type is already PC or PCs.
[Fix] <re> Pattern c&p: Mix paste should behave better with parameter control notes.
[Fix] <Jojo> Amplify acted VERY weird when it was applied on an instrument that's not assigned to any sample. Should be a bit better now.
[Fix] <Jojo> Amplify doesn't use volume column in MOD format anymore.
[Fix] <Jojo> When recording live from the keyboard, SDx shouldn't exceed the song speed anymore.
[Fix] <Jojo> Got rid of possible redundant undo points.
- [Fix] <Jojo> PC notes are now deleted properly (last column).
- [Fix] <Jojo> Copying only the param column of PC notes overwrote the value column when pasting them.
+ [Fix] <Jojo> PC Notes are now deleted properly (last column).
+ [Fix] <Jojo> Copying only the param column of PC Notes overwrote the value column when pasting them.
[Fix] <Jojo> Entering Note Fade notes didn't work the "old style" way.
Pattern tab::GUI
@@ -721,7 +740,7 @@
[Fix] <Jojo> Don't ignore value of pattern break commands on last pattern anymore.
MPTM
- [New] <re> New experimental parameter controls (PC notes) for controlling plug params.
+ [New] <re> New experimental parameter controls (PC Notes) for controlling plug params.
[New] <re> Can now have multiple sequences in a module (access from orderlist context menu).
[New] <Jojo> Allow up to 240 envelope points.
[New] <Jojo> IT "Note Fade" command: This existed in IT's player routines already, but there was no way to actually use it in the editor. Triggering an invalid note would cause a note fade, so this is a new note type.
Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Snd_fx.cpp 2011-01-02 16:10:49 UTC (rev 780)
+++ trunk/OpenMPT/soundlib/Snd_fx.cpp 2011-01-03 14:49:21 UTC (rev 781)
@@ -777,8 +777,14 @@
return;
}
- if (m_nType & (MOD_TYPE_XM|MOD_TYPE_MT2|MOD_TYPE_MED)) note += pChn->nTranspose;
- note = CLAMP(note, NOTE_MIN, NOTE_MAX);
+ if (m_nType & (MOD_TYPE_XM|MOD_TYPE_MT2|MOD_TYPE_MED))
+ {
+ note += pChn->nTranspose;
+ note = CLAMP(note, NOTE_MIN, 131); // why 131? 120+11, how does this make sense?
+ } else
+ {
+ note = CLAMP(note, NOTE_MIN, NOTE_MAX);
+ }
pChn->nNote = note;
pChn->m_CalculateFreq = true;
@@ -3000,6 +3006,7 @@
// TRASH IT!!! (Yes, the sample!)
pModSample->pSample[pModSample->nLoopStart + pChn->nEFxOffset] = ~pModSample->pSample[pModSample->nLoopStart + pChn->nEFxOffset];
+ //AdjustSampleLoop(pModSample);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rel...@us...> - 2011-01-02 16:10:56
|
Revision: 780
http://modplug.svn.sourceforge.net/modplug/?rev=780&view=rev
Author: relabsoluness
Date: 2011-01-02 16:10:49 +0000 (Sun, 02 Jan 2011)
Log Message:
-----------
[Fix] Sample Editor: Changing zoom level should now preserve better the view position.
[Fix] Build: VC03 build was broken.
[Ref] Some cleanup(mostly regarding compiler warnings).
Modified Paths:
--------------
trunk/OpenMPT/mptrack/KeyConfigDlg.cpp
trunk/OpenMPT/mptrack/KeyConfigDlg.h
trunk/OpenMPT/mptrack/Moddoc.cpp
trunk/OpenMPT/mptrack/Moddoc.h
trunk/OpenMPT/mptrack/MoveFXSlotDialog.cpp
trunk/OpenMPT/mptrack/View_smp.cpp
trunk/OpenMPT/mptrack/View_smp.h
trunk/OpenMPT/mptrack/misc_util.cpp
trunk/OpenMPT/mptrack/misc_util.h
trunk/OpenMPT/soundlib/Load_ams.cpp
trunk/OpenMPT/soundlib/Load_it.cpp
trunk/OpenMPT/soundlib/SNDDEV.H
trunk/OpenMPT/soundlib/Sndfile.cpp
trunk/OpenMPT/soundlib/Sndfile.h
trunk/OpenMPT/unlha/UNLHA32.H
Modified: trunk/OpenMPT/mptrack/KeyConfigDlg.cpp
===================================================================
--- trunk/OpenMPT/mptrack/KeyConfigDlg.cpp 2010-12-31 20:58:02 UTC (rev 779)
+++ trunk/OpenMPT/mptrack/KeyConfigDlg.cpp 2011-01-02 16:10:49 UTC (rev 780)
@@ -36,7 +36,7 @@
}
-void CCustEdit::SetKey(UINT inMod, CString c)
+void CCustEdit::SetKey(UINT /*inMod*/, CString /*c*/)
{
/*
mod = inMod;
@@ -354,7 +354,7 @@
void COptionsKeyboard::OnCategorySelChanged()
//-------------------------------------------
{
- CommandID nCmd = (CommandID)m_lbnCommandKeys.GetItemData( m_lbnCommandKeys.GetCurSel() );
+ //CommandID nCmd = (CommandID)m_lbnCommandKeys.GetItemData( m_lbnCommandKeys.GetCurSel() );
int nCat = m_cmbCategory.GetItemData( m_cmbCategory.GetCurSel() );
//Fill Command list
@@ -372,7 +372,7 @@
m_lbnCommandKeys.SetItemData(m_lbnCommandKeys.AddString(plocalCmdSet->GetCommandText(com)), com);
if (commandCategories[nCat].separatorAt(com))
- m_lbnCommandKeys.SetItemData(m_lbnCommandKeys.AddString("------------------------------------------------------"), -1);
+ m_lbnCommandKeys.SetItemData(m_lbnCommandKeys.AddString("------------------------------------------------------"), DWORD_PTR(-1));
}
}
m_lbnCommandKeys.SetCurSel(0);
@@ -657,7 +657,7 @@
if(files.abort) return;
m_sFullPathName = files.first_file.c_str();
- plocalCmdSet->SaveFile(m_sFullPathName, m_bDebugSave.GetCheck());
+ plocalCmdSet->SaveFile(m_sFullPathName, m_bDebugSave.GetCheck() != BST_UNCHECKED);
//TentativeSetToDefaultFile(m_sFullPathName);
}
Modified: trunk/OpenMPT/mptrack/KeyConfigDlg.h
===================================================================
--- trunk/OpenMPT/mptrack/KeyConfigDlg.h 2010-12-31 20:58:02 UTC (rev 779)
+++ trunk/OpenMPT/mptrack/KeyConfigDlg.h 2011-01-02 16:10:49 UTC (rev 780)
@@ -33,7 +33,7 @@
commands.Copy(copy.commands);
separators.Copy(copy.separators);
}
- bool separatorAt(UINT c)
+ bool separatorAt(int c)
{
for (int p=0; p<separators.GetSize(); p++)
{
Modified: trunk/OpenMPT/mptrack/Moddoc.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Moddoc.cpp 2010-12-31 20:58:02 UTC (rev 779)
+++ trunk/OpenMPT/mptrack/Moddoc.cpp 2011-01-02 16:10:49 UTC (rev 780)
@@ -760,7 +760,20 @@
SendMessageToActiveViews(WM_MOD_ACTIVATEVIEW, IDD_CONTROL_INSTRUMENTS, nIns);
}
+void CModDoc::AddLogEvent(LogEventType eventType, LPCTSTR pszFuncName, LPCTSTR pszFormat, ...)
+{
+ CString strMsg;
+ va_list args;
+ va_start(args, pszFormat);
+ strMsg.FormatV(pszFormat, args);
+ va_end(args);
+ m_logEvents << Util::GetDateTimeStr()
+ << _T("Event type: ") << eventType << std::endl
+ << _T("Function: ") << pszFuncName << std::endl
+ << _T("Message: ") << strMsg << std::endl << std::endl;
+}
+
BOOL CModDoc::AddToLog(LPCSTR lpszLog)
//------------------------------------
{
Modified: trunk/OpenMPT/mptrack/Moddoc.h
===================================================================
--- trunk/OpenMPT/mptrack/Moddoc.h 2010-12-31 20:58:02 UTC (rev 779)
+++ trunk/OpenMPT/mptrack/Moddoc.h 2011-01-02 16:10:49 UTC (rev 780)
@@ -147,13 +147,19 @@
bool octaveLink; // apply octaveModifier
};
+enum LogEventType
+{
+ LogEventUnexpectedError
+};
+
//=============================
class CModDoc: public CDocument
//=============================
{
protected:
LPSTR m_lpszLog;
+ std::basic_ostringstream<TCHAR> m_logEvents; // Log for general progress and error events.
CSoundFile m_SndFile;
BOOL m_bPaused;
@@ -197,6 +203,10 @@
LPCSTR GetLog() const { return m_lpszLog; }
BOOL ClearLog();
UINT ShowLog(LPCSTR lpszTitle=NULL, CWnd *parent=NULL);
+
+ // Logging for general progress and error events.
+ void AddLogEvent(LogEventType eventType, LPCTSTR pszFuncName, LPCTSTR pszFormat, ...);
+
void ViewPattern(UINT nPat, UINT nOrd);
void ViewSample(UINT nSmp);
void ViewInstrument(UINT nIns);
Modified: trunk/OpenMPT/mptrack/MoveFXSlotDialog.cpp
===================================================================
--- trunk/OpenMPT/mptrack/MoveFXSlotDialog.cpp 2010-12-31 20:58:02 UTC (rev 779)
+++ trunk/OpenMPT/mptrack/MoveFXSlotDialog.cpp 2011-01-02 16:10:49 UTC (rev 780)
@@ -39,7 +39,7 @@
void CMoveFXSlotDialog::OnOK()
//----------------------------
{
- m_nToSlot = m_CbnEmptySlots.GetItemData(m_CbnEmptySlots.GetCurSel());
+ m_nToSlot = static_cast<PLUGINDEX>(m_CbnEmptySlots.GetItemData(m_CbnEmptySlots.GetCurSel()));
CDialog::OnOK();
}
Modified: trunk/OpenMPT/mptrack/View_smp.cpp
===================================================================
--- trunk/OpenMPT/mptrack/View_smp.cpp 2010-12-31 20:58:02 UTC (rev 779)
+++ trunk/OpenMPT/mptrack/View_smp.cpp 2011-01-02 16:10:49 UTC (rev 780)
@@ -135,7 +135,7 @@
}
-void CViewSample::UpdateScrollSize()
+void CViewSample::UpdateScrollSize(const UINT nZoomOld)
//----------------------------------
{
CModDoc *pModDoc = GetDocument();
@@ -182,7 +182,19 @@
sizePage.cx = sizeLine.cx * 4;
sizePage.cy = sizeLine.cy;
SetScrollSizes(MM_TEXT, m_sizeTotal, sizePage, sizeLine);
- m_nScrollPos = GetScrollPos(SB_HORZ) << m_nScrollFactor;
+
+ if (nZoomOld != m_nZoom) // After zoom change, keep the view position.
+ {
+ const UINT nOldPos = ScrollPosToSamplePos(nZoomOld);
+ const float fPosFraction = (dwLen > 0) ? static_cast<float>(nOldPos) / dwLen : 0;
+ m_nScrollPos = 0;
+ m_nScrollPos = SampleToScreen(nOldPos);
+ SetScrollPos(SB_HORZ, static_cast<int>(fPosFraction * GetScrollLimit(SB_HORZ)));
+ }
+ else
+ {
+ m_nScrollPos = GetScrollPos(SB_HORZ) << m_nScrollFactor;
+ }
}
}
@@ -220,8 +232,9 @@
if (nZoom > MAX_ZOOM)
return FALSE;
+ const UINT nZoomOld = m_nZoom;
m_nZoom = nZoom;
- UpdateScrollSize();
+ UpdateScrollSize(nZoomOld);
InvalidateRect(NULL, FALSE);
return TRUE;
}
@@ -749,8 +762,9 @@
CSoundFile *pSndFile;
HGDIOBJ oldpen;
HDC hdc;
- UINT nSmpScrollPos = (m_nZoom) ? (m_nScrollPos << (m_nZoom - 1)) : 0;
+ UINT nSmpScrollPos = ScrollPosToSamplePos();
+
if ((!pModDoc) || (!pDC)) return;
hdc = pDC->m_hDC;
oldpen = ::SelectObject(hdc, CMainFrame::penBlack);
Modified: trunk/OpenMPT/mptrack/View_smp.h
===================================================================
--- trunk/OpenMPT/mptrack/View_smp.h 2010-12-31 20:58:02 UTC (rev 779)
+++ trunk/OpenMPT/mptrack/View_smp.h 2011-01-02 16:10:49 UTC (rev 780)
@@ -31,7 +31,8 @@
DECLARE_SERIAL(CViewSample)
public:
- void UpdateScrollSize();
+ void UpdateScrollSize() {UpdateScrollSize(m_nZoom);}
+ void UpdateScrollSize(const UINT nZoomOld);
BOOL SetCurrentSample(SAMPLEINDEX nSmp);
BOOL SetZoom(UINT nZoom);
LONG SampleToScreen(LONG n) const;
@@ -65,6 +66,9 @@
// if smaller than the smallest zoom, returns value >= MAX_ZOOM + 1.
UINT GetAutoZoomLevel(const MODSAMPLE& smp);
+ UINT ScrollPosToSamplePos() const {return ScrollPosToSamplePos(m_nZoom);}
+ UINT ScrollPosToSamplePos(UINT nZoom) const {return (nZoom > 0) ? (m_nScrollPos << (nZoom - 1)) : 0;}
+
public:
//{{AFX_VIRTUAL(CViewSample)
virtual void OnDraw(CDC *);
Modified: trunk/OpenMPT/mptrack/misc_util.cpp
===================================================================
--- trunk/OpenMPT/mptrack/misc_util.cpp 2010-12-31 20:58:02 UTC (rev 779)
+++ trunk/OpenMPT/mptrack/misc_util.cpp 2011-01-02 16:10:49 UTC (rev 780)
@@ -1,5 +1,6 @@
#include "stdafx.h"
#include "misc_util.h"
+#include <ctime>
/*
* Loads resource.
@@ -51,3 +52,11 @@
return sMsg;
}
+
+std::basic_string<TCHAR> Util::GetDateTimeStr()
+{
+ time_t t;
+ std::time(&t);
+ return _tctime(&t);
+}
+
Modified: trunk/OpenMPT/mptrack/misc_util.h
===================================================================
--- trunk/OpenMPT/mptrack/misc_util.h 2010-12-31 20:58:02 UTC (rev 779)
+++ trunk/OpenMPT/mptrack/misc_util.h 2011-01-02 16:10:49 UTC (rev 780)
@@ -53,6 +53,7 @@
{
#if _HAS_TR1
static_assert(std::tr1::is_pointer<T>::value == false, "Won't memset pointers.");
+ static_assert(std::tr1::is_pod<T>::value == true, "Won't memset non-pods.");
#endif
memset(&a, 0, sizeof(T));
}
@@ -224,6 +225,9 @@
// Returns maximum value of given integer type.
template <class T> inline T MaxValueOfType(const T&) {static_assert(std::numeric_limits<T>::is_integer == true, "Only interger types are allowed."); return (std::numeric_limits<T>::max)();}
+
+ // Returns string containing date and time ended with newline.
+ std::basic_string<TCHAR> GetDateTimeStr();
};
#endif
Modified: trunk/OpenMPT/soundlib/Load_ams.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Load_ams.cpp 2010-12-31 20:58:02 UTC (rev 779)
+++ trunk/OpenMPT/soundlib/Load_ams.cpp 2011-01-02 16:10:49 UTC (rev 780)
@@ -349,10 +349,11 @@
#pragma pack()
-bool CSoundFile::ReadAMS2(LPCBYTE lpStream, DWORD dwMemLength)
+bool CSoundFile::ReadAMS2(LPCBYTE /*lpStream*/, DWORD /*dwMemLength*/)
//------------------------------------------------------------
{
return false;
+#if 0
const AMS2FILEHEADER *pfh = (AMS2FILEHEADER *)lpStream;
AMS2SONGHEADER *psh;
DWORD dwMemPos;
@@ -590,6 +591,7 @@
dwMemPos += ReadSample(&Samples[iSmp], flags, (LPSTR)(lpStream+dwMemPos), dwMemLength-dwMemPos);
}
return true;
+#endif
}
Modified: trunk/OpenMPT/soundlib/Load_it.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Load_it.cpp 2010-12-31 20:58:02 UTC (rev 779)
+++ trunk/OpenMPT/soundlib/Load_it.cpp 2011-01-02 16:10:49 UTC (rev 780)
@@ -1269,6 +1269,7 @@
for(size_t n = start; n < num; n++)
{
tm loadDate;
+ MemsetZero(loadDate);
uint32 openTime;
if(n < num - 1)
@@ -1281,7 +1282,14 @@
{
// Current ("new") timestamp
const time_t creationTime = pModDoc->GetCreationTime();
- localtime_s(&loadDate, &creationTime);
+ //localtime_s(&loadDate, &creationTime);
+ const tm* const p = localtime(&creationTime);
+ if (p != nullptr)
+ loadDate = *p;
+ else if (pSndFile->GetModDocPtr() != nullptr)
+ pSndFile->GetModDocPtr()->AddLogEvent(LogEventUnexpectedError,
+ __FUNCTION__,
+ _T("localtime() returned nullptr."));
openTime = (uint32)((double)difftime(time(nullptr), creationTime) * 18.2f);
}
Modified: trunk/OpenMPT/soundlib/SNDDEV.H
===================================================================
--- trunk/OpenMPT/soundlib/SNDDEV.H 2010-12-31 20:58:02 UTC (rev 779)
+++ trunk/OpenMPT/soundlib/SNDDEV.H 2011-01-02 16:10:49 UTC (rev 780)
@@ -79,7 +79,7 @@
virtual BOOL IsOpen() = 0;
virtual UINT GetCurrentLatency() = 0;
virtual void SilenceAudioBuffer(ISoundSource *pSource, ULONG nMaxLatency, DWORD dwUser=0) = 0;
- virtual UINT GetCurrentSampleRate(UINT nDevice) { return 0; }
+ virtual UINT GetCurrentSampleRate(UINT nDevice) { UNREFERENCED_PARAMETER(nDevice); return 0; }
};
Modified: trunk/OpenMPT/soundlib/Sndfile.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Sndfile.cpp 2010-12-31 20:58:02 UTC (rev 779)
+++ trunk/OpenMPT/soundlib/Sndfile.cpp 2011-01-02 16:10:49 UTC (rev 780)
@@ -439,13 +439,14 @@
CTuningCollection* CSoundFile::s_pTuningsSharedLocal(0);
uint8 CSoundFile::s_DefaultPlugVolumeHandling = PLUGIN_VOLUMEHANDLING_IGNORE;
-
+#pragma warning(disable : 4355) // "'this' : used in base member initializer list"
CSoundFile::CSoundFile() :
Patterns(*this),
Order(*this),
m_PlaybackEventer(*this),
m_pModSpecs(&ModSpecs::itEx),
m_MIDIMapper(*this)
+#pragma warning(default : 4355) // "'this' : used in base member initializer list"
//----------------------
{
m_nType = MOD_TYPE_NONE;
@@ -1532,7 +1533,7 @@
//added to position i. If index of some current channel is missing from the
//newOrder-vector, then the channel gets removed.
- CHANNELINDEX nRemainingChannels = newOrder.size();
+ const CHANNELINDEX nRemainingChannels = static_cast<CHANNELINDEX>(newOrder.size());
if(nRemainingChannels > GetModSpecifications().channelsMax || nRemainingChannels < GetModSpecifications().channelsMin)
{
@@ -2587,10 +2588,9 @@
transp++;
ftune -= 128;
}
- if (transp > 127) transp = 127;
- if (transp < -127) transp = -127;
- psmp->RelativeTone = transp;
- psmp->nFineTune = ftune;
+ Limit(transp, -127, 127);
+ psmp->RelativeTone = static_cast<int8>(transp);
+ psmp->nFineTune = static_cast<int8>(ftune);
}
Modified: trunk/OpenMPT/soundlib/Sndfile.h
===================================================================
--- trunk/OpenMPT/soundlib/Sndfile.h 2010-12-31 20:58:02 UTC (rev 779)
+++ trunk/OpenMPT/soundlib/Sndfile.h 2011-01-02 16:10:49 UTC (rev 780)
@@ -25,7 +25,7 @@
#include <aeffect.h> // VST
#else
typedef int32 VstInt32;
-typedef int32 VstIntPtr;
+typedef intptr_t VstIntPtr;
#endif
class CTuningBase;
@@ -660,6 +660,7 @@
inline bool TypeIsXM_MOD() const { return (m_nType & (MOD_TYPE_XM | MOD_TYPE_MOD)) != 0; }
inline bool TypeIsMOD_S3M() const { return (m_nType & (MOD_TYPE_MOD | MOD_TYPE_S3M)) != 0; }
CModDoc* GetpModDoc() const { return m_pModDoc; }
+ CModDoc* GetModDocPtr() const { return m_pModDoc; }
void SetMasterVolume(UINT vol, bool adjustAGC = false);
UINT GetMasterVolume() const { return m_nMasterVolume; }
Modified: trunk/OpenMPT/unlha/UNLHA32.H
===================================================================
--- trunk/OpenMPT/unlha/UNLHA32.H 2010-12-31 20:58:02 UTC (rev 779)
+++ trunk/OpenMPT/unlha/UNLHA32.H 2011-01-02 16:10:49 UTC (rev 780)
@@ -81,7 +81,7 @@
protected:
void setup_get(char *p) { get_ptr = p; }
int get_byte() { return (*get_ptr++ & 0xff); }
- unsigned short get_word() { int b0, b1; b0 = get_byte(); b1 = get_byte(); return (b1 << 8) + b0; }
+ unsigned short get_word() { int b0, b1; b0 = get_byte(); b1 = get_byte(); return static_cast<unsigned short>((b1 << 8) + b0); }
long get_longword() { long b0, b1, b2, b3; b0 = get_byte(); b1 = get_byte(); b2 = get_byte(); b3 = get_byte(); return (b3 << 24) + (b2 << 16) + (b1 << 8) + b0; }
BOOL get_header(DWORD &fp, LzHeader *hdr);
VOID make_crctable();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sag...@us...> - 2010-12-31 20:58:08
|
Revision: 779
http://modplug.svn.sourceforge.net/modplug/?rev=779&view=rev
Author: saga-games
Date: 2010-12-31 20:58:02 +0000 (Fri, 31 Dec 2010)
Log Message:
-----------
[Fix] Song Cleanup: Various sample/instrument rearranging functions broke PC Notes.
Modified Paths:
--------------
trunk/OpenMPT/mptrack/CleanupSong.cpp
Modified: trunk/OpenMPT/mptrack/CleanupSong.cpp
===================================================================
--- trunk/OpenMPT/mptrack/CleanupSong.cpp 2010-12-23 23:24:44 UTC (rev 778)
+++ trunk/OpenMPT/mptrack/CleanupSong.cpp 2010-12-31 20:58:02 UTC (rev 779)
@@ -554,7 +554,7 @@
UINT jmax = pSndFile->Patterns[nPat].GetNumRows() * pSndFile->GetNumChannels();
for (UINT j=0; j<jmax; j++, p++)
{
- if ((p->note) && (p->note <= NOTE_MAX))
+ if ((p->note) && (p->note <= NOTE_MAX) && (!p->IsPcNote()))
{
if ((p->instr) && (p->instr < MAX_INSTRUMENTS))
{
@@ -723,7 +723,7 @@
MODCOMMAND *m = pSndFile->Patterns[nPat];
for(UINT len = pSndFile->Patterns[nPat].GetNumRows() * pSndFile->GetNumChannels(); len; m++, len--)
{
- if(m->instr <= pSndFile->GetNumSamples()) m->instr = (BYTE)nSampleMap[m->instr];
+ if(!m->IsPcNote() && m->instr <= pSndFile->GetNumSamples()) m->instr = (BYTE)nSampleMap[m->instr];
}
}
}
@@ -831,7 +831,7 @@
UINT nLen = pSndFile->m_nChannels * pSndFile->Patterns[iPat].GetNumRows();
while (nLen--)
{
- if (p->instr)
+ if (p->instr && !p->IsPcNote())
{
for (UINT k=0; k<nSwap; k++)
{
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sag...@us...> - 2010-12-23 23:24:51
|
Revision: 778
http://modplug.svn.sourceforge.net/modplug/?rev=778&view=rev
Author: saga-games
Date: 2010-12-23 23:24:44 +0000 (Thu, 23 Dec 2010)
Log Message:
-----------
[Mod] The code has been updated to use the VST 2.4 SDK. Please follow the instructions in include/readme.txt and upgrade your header files! The changes have not been tested very much, but they should not be very big anyway - a few things have been updated, but that doesn't mean that VST 2.4 plugins will work better now. But that's what comes next... ;)
[Mod] OpenMPT: Version is now 1.19.00.17
Modified Paths:
--------------
trunk/OpenMPT/mptrack/VSTEditor.cpp
trunk/OpenMPT/mptrack/Vstplug.cpp
trunk/OpenMPT/mptrack/Vstplug.h
trunk/OpenMPT/mptrack/version.h
trunk/OpenMPT/soundlib/Sndfile.h
Added Paths:
-----------
trunk/OpenMPT/include/readme.txt
Added: trunk/OpenMPT/include/readme.txt
===================================================================
--- trunk/OpenMPT/include/readme.txt (rev 0)
+++ trunk/OpenMPT/include/readme.txt 2010-12-23 23:24:44 UTC (rev 778)
@@ -0,0 +1,22 @@
+What files do I need to compile OpenMPT?
+
+VST 2.4 SDK
+===========
+If you don't use #define NO_VST, you will need to place the following files
+from Steinberg's VST 2.4 SDK in this folder:
+aeffect.h
+aeffectx.h
+vstfxstore.h
+You can find them in the "vstsdk2.4/pluginterfaces/vst2.x" folder.
+
+ASIO SDK
+========
+If you don't use #define NO_ASIO, you will need to place the following files
+from Steinberg's ASIO SDK in this folder:
+asio.h
+asiosys.h
+iasiodrv.h
+You can find them in the "ASIOSDK2/common" directory.
+
+Please visit http://www.steinberg.net/en/company/developer.html to download
+these SDKs.
\ No newline at end of file
Modified: trunk/OpenMPT/mptrack/VSTEditor.cpp
===================================================================
--- trunk/OpenMPT/mptrack/VSTEditor.cpp 2010-12-23 23:06:16 UTC (rev 777)
+++ trunk/OpenMPT/mptrack/VSTEditor.cpp 2010-12-23 23:24:44 UTC (rev 778)
@@ -11,31 +11,21 @@
#ifndef NO_VST
COwnerVstEditor::COwnerVstEditor(CVstPlugin *pPlugin) : CAbstractVstEditor(pPlugin)
-//-----------------------------------------
+//---------------------------------------------------------------------------------
{
}
COwnerVstEditor::~COwnerVstEditor()
-//-----------------------
+//---------------------------------
{
}
-#pragma pack(push, 1)
-typedef struct _ERect
-{
- short top;
- short left;
- short bottom;
- short right;
-} ERect, *PERect;
-#pragma pack(pop)
-
BOOL COwnerVstEditor::OpenEditor(CWnd *parent)
-//---------------------------------------
+//--------------------------------------------
{
Create(IDD_PLUGINEDITOR, parent);
SetupMenu();
@@ -81,21 +71,21 @@
VOID COwnerVstEditor::OnClose()
-//------------------------
+//-----------------------------
{
DoClose();
}
VOID COwnerVstEditor::OnOK()
-//---------------------
+//--------------------------
{
OnClose();
}
VOID COwnerVstEditor::OnCancel()
-//-------------------------
+//------------------------------
{
OnClose();
}
@@ -103,7 +93,7 @@
VOID COwnerVstEditor::DoClose()
-//------------------------
+//-----------------------------
{
#ifdef VST_LOG
Log("CVstEditor::DoClose()\n");
Modified: trunk/OpenMPT/mptrack/Vstplug.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Vstplug.cpp 2010-12-23 23:06:16 UTC (rev 777)
+++ trunk/OpenMPT/mptrack/Vstplug.cpp 2010-12-23 23:24:44 UTC (rev 778)
@@ -26,7 +26,7 @@
char CVstPluginManager::s_szHostProductString[64] = "OpenMPT";
char CVstPluginManager::s_szHostVendorString[64] = "OpenMPT project";
-long CVstPluginManager::s_nHostVendorVersion = MptVersion::num;
+VstIntPtr CVstPluginManager::s_nHostVendorVersion = MptVersion::num;
//#define VST_LOG
//#define ENABLE_BUZZ
@@ -54,8 +54,8 @@
}
#endif
-long VSTCALLBACK CVstPluginManager::MasterCallBack(AEffect *effect, long opcode, long index, long value, void *ptr, float opt)
-//----------------------------------------------------------------------------------------------------------------------------
+VstIntPtr VSTCALLBACK CVstPluginManager::MasterCallBack(AEffect *effect, VstInt32 opcode, VstInt32 index, VstIntPtr value, void *ptr, float opt)
+//----------------------------------------------------------------------------------------------------------------------------------------------
{
CVstPluginManager *that = theApp.GetPluginManager();
if (that)
@@ -640,8 +640,8 @@
}
//rewbs.VSTCompliance: Added support for lots of opcodes
-long CVstPluginManager::VstCallback(AEffect *effect, long opcode, long index, long value, void *ptr, float /*opt*/)
-//-------------------------------------------------------------------------------------------------------------
+VstIntPtr CVstPluginManager::VstCallback(AEffect *effect, VstInt32 opcode, VstInt32 index, VstIntPtr value, void *ptr, float /*opt*/)
+//-----------------------------------------------------------------------------------------------------------------------------------
{
#ifdef VST_LOG
Log("VST plugin to host: Eff: 0x%.8X, Opcode = %d, Index = %d, Value = %d, PTR = %.8X, OPT = %.3f\n",(int)effect, opcode,index,value,(int)ptr,opt);
@@ -706,7 +706,7 @@
}
return 0;
// Called when plugin asks for VST version supported by host
- case audioMasterVersion: return 2300;
+ case audioMasterVersion: return kVstVersion;
// Returns the unique id of a plug that's currently loading
// (not sure what this is actually for - we return *effect's UID, cos Herman Seib does something similar :)
// Let's see what happens...)
@@ -789,7 +789,7 @@
timeInfo.timeSigDenominator = 4; //gcd(pSndFile->m_nCurrentRowsPerMeasure, pSndFile->m_nCurrentRowsPerBeat);
}
}
- return (long)&timeInfo;
+ return (VstIntPtr)&timeInfo;
}
// VstEvents* in <ptr>
// We don't support plugs that send VSTEvents to the host
@@ -861,7 +861,7 @@
break;
case audioMasterGetOutputLatency:
{
- long latency = CMainFrame::GetMainFrame()->m_nBufferLength*(CMainFrame::GetMainFrame()->GetSampleRate()/1000L);
+ VstIntPtr latency = CMainFrame::GetMainFrame()->m_nBufferLength * (CMainFrame::GetMainFrame()->GetSampleRate()/1000L);
return latency;
}
// input pin in <value> (-1: first to come), returns cEffect*
@@ -946,12 +946,15 @@
//"asyncProcessing",
//"offline",
//"supportShell"
+ //"editFile"
+ //"startStopProcess"
if ((strcmp((char*)ptr,"sendVstEvents") == 0 ||
strcmp((char*)ptr,"sendVstMidiEvent") == 0 ||
strcmp((char*)ptr,"sendVstTimeInfo") == 0 ||
strcmp((char*)ptr,"supplyIdle") == 0 ||
strcmp((char*)ptr,"sizeWindow") == 0 ||
- strcmp((char*)ptr,"openFileSelector") == 0
+ strcmp((char*)ptr,"openFileSelector") == 0 ||
+ strcmp((char*)ptr,"closeFileSelector") == 0
))
return HostCanDo;
else
@@ -990,6 +993,7 @@
return 0;
//---from here VST 2.1 extension opcodes------------------------------------------------------
+
// begin of automation session (when mouse down), parameter index in <index>
case audioMasterBeginEdit:
Log("VST plugin to host: Begin Edit\n");
@@ -1001,26 +1005,36 @@
// open a fileselector window with VstFileSelect* in <ptr>
case audioMasterOpenFileSelector:
//---from here VST 2.2 extension opcodes------------------------------------------------------
+
// close a fileselector operation with VstFileSelect* in <ptr>: Must be always called after an open !
case audioMasterCloseFileSelector:
return VstFileSelector(opcode == audioMasterCloseFileSelector, (VstFileSelect *)ptr, effect);
- // open an editor for audio (defined by XML text in ptr)
+ // open an editor for audio (defined by XML text in ptr) - DEPRECATED
case audioMasterEditFile:
Log("VST plugin to host: Edit File\n");
break;
// get the native path of currently loading bank or project
- // (called from writeChunk) void* in <ptr> (char[2048], or sizeof(FSSpec))
+ // (called from writeChunk) void* in <ptr> (char[2048], or sizeof(FSSpec)) - DEPRECATED
case audioMasterGetChunkFile:
Log("VST plugin to host: Get Chunk File\n");
break;
//---from here VST 2.3 extension opcodes------------------------------------------------------
- // result a VstSpeakerArrangement in ret
+
+ // result a VstSpeakerArrangement in ret - DEPRECATED
case audioMasterGetInputSpeakerArrangement:
Log("VST plugin to host: Get Input Speaker Arrangement\n");
break;
+
+ //---from here VST 2.4 extension opcodes------------------------------------------------------
+
+ // Floating point processing precision
+ case effSetProcessPrecision:
+ return kVstProcessPrecision32;
+
}
+
// Unknown codes:
return 0;
@@ -1029,8 +1043,8 @@
// Helper function for file selection dialog stuff.
-long CVstPluginManager::VstFileSelector(const bool destructor, VstFileSelect *pFileSel, const AEffect *effect)
-//------------------------------------------------------------------------------------------------------------
+VstIntPtr CVstPluginManager::VstFileSelector(const bool destructor, VstFileSelect *pFileSel, const AEffect *effect)
+//-----------------------------------------------------------------------------------------------------------------
{
if(pFileSel == nullptr)
{
@@ -1304,8 +1318,8 @@
#define NUM_PROBLEMPLUGS 3
static _PROBLEMATIC_PLUG gProblemPlugs[NUM_PROBLEMPLUGS] =
{
- {'VstP', 'Ni4S', 1, "Native Instruments B4", "* v1.1.1 hangs on playback. Do not proceed unless you have v1.1.5. *"},
- {'VstP', 'mdaC', 1, "MDA Degrade", "* This plugin can cause OpenMPT to behave erratically.\r\nYou should try SoundHack's Decimate, ConcreteFX's Lowbit or Subtek's LoFi Plus instead. *"},
+ {kEffectMagic, CCONST('N', 'i', '4', 'S'), 1, "Native Instruments B4", "* v1.1.1 hangs on playback. Do not proceed unless you have v1.1.5. *"},
+ {kEffectMagic, CCONST('m', 'd', 'a', 'C'), 1, "MDA Degrade", "* This plugin can cause OpenMPT to behave erratically.\r\nYou should try SoundHack's Decimate, ConcreteFX's Lowbit or Subtek's LoFi Plus instead. *"},
};
bool CSelectPluginDlg::VerifyPlug(PVSTPLUGINLIB plug)
@@ -1368,7 +1382,7 @@
switch(m_pPlugin->Info.dwPluginId2)
{
// Enable drymix by default for these known plugins
- case 'Scop':
+ case CCONST('S', 'c', 'o', 'p'):
m_pPlugin->Info.dwInputRouting |= MIXPLUG_INPUTF_WETMIX;
break;
}
@@ -1748,7 +1762,7 @@
//rewbs.VSTcompliance
//Store a pointer so we can get the CVstPlugin object from the basic VST effect object.
//Assuming 32bit address space...
- m_pEffect->resvd1=(long)this;
+ m_pEffect->resvd1=(VstIntPtr)this;
//rewbs.plugDocAware
m_pSndFile = pSndFile;
m_pModDoc = pSndFile->GetpModDoc();
@@ -1767,20 +1781,20 @@
sa.type = kSpeakerArrStereo;
for(int i = 0; i < ARRAYELEMCOUNT(sa.speakers); i++)
{
- sa.speakers[i].azimuth = 0;
- sa.speakers[i].elevation = 0;
- sa.speakers[i].radius = 0;
+ sa.speakers[i].azimuth = 0.0f;
+ sa.speakers[i].elevation = 0.0f;
+ sa.speakers[i].radius = 0.0f;
sa.speakers[i].reserved = 0.0f;
// For now, only left and right speaker are used.
switch(i)
{
case 0:
sa.speakers[i].type = kSpeakerL;
- strcpy(sa.speakers[i].name, "Left");
+ vst_strncpy(sa.speakers[i].name, "Left", kVstMaxNameLen - 1);
break;
case 1:
sa.speakers[i].type = kSpeakerR;
- strcpy(sa.speakers[i].name, "Right");
+ vst_strncpy(sa.speakers[i].name, "Right", kVstMaxNameLen - 1);
break;
default:
sa.speakers[i].type = kSpeakerUndefined;
@@ -1788,7 +1802,7 @@
}
}
// For now, input setup = output setup.
- Dispatch(effSetSpeakerArrangement, 0, (LONG_PTR)(&sa), &sa, 0.0f);
+ Dispatch(effSetSpeakerArrangement, 0, (VstIntPtr)(&sa), &sa, 0.0f);
// Dummy pin properties collection.
// We don't use them but some plugs might do inits in here.
@@ -1989,16 +2003,16 @@
}
//rewbs.VSTpresets
-long CVstPlugin::GetUID()
-//-----------------------
+VstInt32 CVstPlugin::GetUID()
+//---------------------------
{
if (!(m_pEffect))
return 0;
return m_pEffect->uniqueID;
}
-long CVstPlugin::GetVersion()
-//-----------------------
+VstInt32 CVstPlugin::GetVersion()
+//-------------------------------
{
if (!(m_pEffect))
return 0;
@@ -2006,8 +2020,8 @@
return m_pEffect->version;
}
-bool CVstPlugin::GetParams(float *param, long min, long max)
-//----------------------------------------------------------
+bool CVstPlugin::GetParams(float *param, VstInt32 min, VstInt32 max)
+//------------------------------------------------------------------
{
if (!(m_pEffect))
return false;
@@ -2015,15 +2029,15 @@
if (max>m_pEffect->numParams)
max = m_pEffect->numParams;
- for (long p=min; p<max; p++)
+ for (VstInt32 p = min; p < max; p++)
param[p-min]=GetParameter(p);
return true;
}
-bool CVstPlugin::RandomizeParams(long minParam, long maxParam)
-//------------------------------------------------------------
+bool CVstPlugin::RandomizeParams(VstInt32 minParam, VstInt32 maxParam)
+//--------------------------------------------------------------------
{
if (!(m_pEffect))
return false;
@@ -2039,7 +2053,7 @@
maxParam=m_pEffect->numParams;
}
- for (long p=minParam; p<maxParam; p++)
+ for (VstInt32 p = minParam; p < maxParam; p++)
SetParameter(p, (rand() / float(RAND_MAX)));
return true;
@@ -2095,14 +2109,14 @@
if (m_pEffect->uniqueID != fxp.fxID)
return false;
- if (fxp.fxMagic == 'FxCk') //Load preset based fxp
+ if (fxp.fxMagic == fMagic) //Load preset based fxp
{
if (m_pEffect->numParams != fxp.numParams)
return false;
for (int p=0; p<fxp.numParams; p++)
SetParameter(p, fxp.params[p]);
}
- else if (fxp.fxMagic == 'FPCh')
+ else if (fxp.fxMagic == chunkPresetMagic)
{
Dispatch(effSetChunk, 1, fxp.chunkSize, (BYTE*)fxp.chunk, 0);
}
@@ -2111,8 +2125,8 @@
}
//end rewbs.VSTpresets
-long CVstPlugin::Dispatch(long opCode, long index, long value, void *ptr, float opt)
-//----------------------------------------------------------------------------------
+VstIntPtr CVstPlugin::Dispatch(VstInt32 opCode, VstInt32 index, VstIntPtr value, void *ptr, float opt)
+//----------------------------------------------------------------------------------------------------
{
long lresult = 0;
@@ -3009,7 +3023,7 @@
if ((m_pEffect->flags & effFlagsProgramChunks)
&& (Dispatch(effIdentify, 0,0, NULL, 0) == 'NvEf')
- && (m_pEffect->uniqueID != 'Sytr')) //special case: imageline sytrus pretends to support chunks but gives us garbage.
+ && (m_pEffect->uniqueID != CCONST('S', 'y', 't', 'r'))) //special case: imageline sytrus pretends to support chunks but gives us garbage.
{
PVOID p = NULL;
LONG nByteSize = 0;
@@ -3417,16 +3431,16 @@
CBuzz2Vst(CMachineInterface *, const CMachineInfo *);
~CBuzz2Vst();
AEffect *GetEffect() { return &m_Effect; }
- long Dispatcher(long opCode, long index, long value, void *ptr, float opt);
- void SetParameter(long index, float parameter);
- float GetParameter(long index);
+ VstIntPtr Dispatcher(VstInt32 opCode, VstInt32 index, VstIntPtr value, void *ptr, float opt);
+ void SetParameter(VstInt32 index, float parameter);
+ float GetParameter(VstInt32 index);
void Process(float **inputs, float **outputs, long sampleframes);
public:
- static long VSTCALLBACK BuzzDispatcher(AEffect *effect, long opCode, long index, long value, void *ptr, float opt);
- static void VSTCALLBACK BuzzSetParameter(AEffect *effect, long index, float parameter);
- static float VSTCALLBACK BuzzGetParameter(AEffect *effect, long index);
- static void VSTCALLBACK BuzzProcess(AEffect *effect, float **inputs, float **outputs, long sampleframes);
+ static VstIntPtr VSTCALLBACK BuzzDispatcher(AEffect *effect, VstInt32 opCode, VstInt32 index, VstIntPtr value, void *ptr, float opt);
+ static void VSTCALLBACK BuzzSetParameter(AEffect *effect, VstInt32 index, float parameter);
+ static float VSTCALLBACK BuzzGetParameter(AEffect *effect, VstInt32 index);
+ static void VSTCALLBACK BuzzProcess(AEffect *effect, float **inputs, float **outputs, VstInt32 sampleframes);
// CMICallbacks interface
public:
@@ -3569,8 +3583,8 @@
}
-long CBuzz2Vst::BuzzDispatcher(AEffect *effect, long opCode, long index, long value, void *ptr, float opt)
-//--------------------------------------------------------------------------------------------------------
+VstIntPtr CBuzz2Vst::BuzzDispatcher(AEffect *effect, VstInt32 opCode, VstInt32 index, VstIntPtr value, void *ptr, float opt)
+//--------------------------------------------------------------------------------------------------------------------------
{
CBuzz2Vst *pBuzz2Vst = (CBuzz2Vst *)effect->object;
if (pBuzz2Vst) return pBuzz2Vst->Dispatcher(opCode, index, value, ptr, opt);
@@ -3578,16 +3592,16 @@
}
-void CBuzz2Vst::BuzzSetParameter(AEffect *effect, long index, float parameter)
-//----------------------------------------------------------------------------
+void CBuzz2Vst::BuzzSetParameter(AEffect *effect, VstInt32 index, float parameter)
+//--------------------------------------------------------------------------------
{
CBuzz2Vst *pBuzz2Vst = (CBuzz2Vst *)effect->object;
if (pBuzz2Vst) pBuzz2Vst->SetParameter(index, parameter);
}
-float CBuzz2Vst::BuzzGetParameter(AEffect *effect, long index)
-//------------------------------------------------------------
+float CBuzz2Vst::BuzzGetParameter(AEffect *effect, VstInt32 index)
+//----------------------------------------------------------------
{
CBuzz2Vst *pBuzz2Vst = (CBuzz2Vst *)effect->object;
if (pBuzz2Vst) return pBuzz2Vst->GetParameter(index);
@@ -3595,16 +3609,16 @@
}
-void CBuzz2Vst::BuzzProcess(AEffect *effect, float **inputs, float **outputs, long sampleframes)
-//----------------------------------------------------------------------------------------------
+void CBuzz2Vst::BuzzProcess(AEffect *effect, float **inputs, float **outputs, VstInt32 sampleframes)
+//--------------------------------------------------------------------------------------------------
{
CBuzz2Vst *pBuzz2Vst = (CBuzz2Vst *)effect->object;
if (pBuzz2Vst) pBuzz2Vst->Process(inputs, outputs, sampleframes);
}
-long CBuzz2Vst::Dispatcher(long opCode, long index, long value, void *ptr, float opt)
-//-----------------------------------------------------------------------------------
+VstIntPtr CBuzz2Vst::Dispatcher(VstInt32 opCode, VstInt32 index, VstIntPtr value, void *ptr, float opt)
+//-----------------------------------------------------------------------------------------------------
{
if (!m_pMachineInterface) return 0;
switch(opCode)
@@ -3702,15 +3716,15 @@
}
-void CBuzz2Vst::SetParameter(long index, float parameter)
-//-------------------------------------------------------
+void CBuzz2Vst::SetParameter(VstInt32 index, float parameter)
+//-----------------------------------------------------------
{
}
-float CBuzz2Vst::GetParameter(long index)
-//---------------------------------------
+float CBuzz2Vst::GetParameter(VstInt32 index)
+//-------------------------------------------
{
if (index < m_pMachineInfo->numGlobalParameters)
{
@@ -3805,16 +3819,16 @@
CDmo2Vst(IMediaObject *pMO, IMediaObjectInPlace *pMOIP, DWORD uid);
~CDmo2Vst();
AEffect *GetEffect() { return &m_Effect; }
- long Dispatcher(long opCode, long index, long value, void *ptr, float opt);
- void SetParameter(long index, float parameter);
- float GetParameter(long index);
+ VstIntPtr Dispatcher(VstInt32 opCode, VstInt32 index, VstIntPtr value, void *ptr, float opt);
+ void SetParameter(VstInt32 index, float parameter);
+ float GetParameter(VstInt32 index);
void Process(float **inputs, float **outputs, long sampleframes);
public:
- static long VSTCALLBACK DmoDispatcher(AEffect *effect, long opCode, long index, long value, void *ptr, float opt);
- static void VSTCALLBACK DmoSetParameter(AEffect *effect, long index, float parameter);
- static float VSTCALLBACK DmoGetParameter(AEffect *effect, long index);
- static void VSTCALLBACK DmoProcess(AEffect *effect, float **inputs, float **outputs, long sampleframes);
+ static VstIntPtr VSTCALLBACK DmoDispatcher(AEffect *effect, VstInt32 opCode, VstInt32 index, VstIntPtr value, void *ptr, float opt);
+ static void VSTCALLBACK DmoSetParameter(AEffect *effect, VstInt32 index, float parameter);
+ static float VSTCALLBACK DmoGetParameter(AEffect *effect, VstInt32 index);
+ static void VSTCALLBACK DmoProcess(AEffect *effect, float **inputs, float **outputs, VstInt32 sampleframes);
};
@@ -3882,8 +3896,8 @@
}
-long CDmo2Vst::DmoDispatcher(AEffect *effect, long opCode, long index, long value, void *ptr, float opt)
-//------------------------------------------------------------------------------------------------------
+VstIntPtr CDmo2Vst::DmoDispatcher(AEffect *effect, VstInt32 opCode, VstInt32 index, VstIntPtr value, void *ptr, float opt)
+//------------------------------------------------------------------------------------------------------------------------
{
if (effect)
{
@@ -3894,8 +3908,8 @@
}
-void CDmo2Vst::DmoSetParameter(AEffect *effect, long index, float parameter)
-//--------------------------------------------------------------------------
+void CDmo2Vst::DmoSetParameter(AEffect *effect, VstInt32 index, float parameter)
+//------------------------------------------------------------------------------
{
if (effect)
{
@@ -3905,7 +3919,7 @@
}
-float CDmo2Vst::DmoGetParameter(AEffect *effect, long index)
+float CDmo2Vst::DmoGetParameter(AEffect *effect, VstInt32 index)
//----------------------------------------------------------
{
if (effect)
@@ -3917,8 +3931,8 @@
}
-void CDmo2Vst::DmoProcess(AEffect *effect, float **inputs, float **outputs, long sampleframes)
-//--------------------------------------------------------------------------------------------
+void CDmo2Vst::DmoProcess(AEffect *effect, float **inputs, float **outputs, VstInt32 sampleframes)
+//------------------------------------------------------------------------------------------------
{
if (effect)
{
@@ -3928,8 +3942,8 @@
}
-long CDmo2Vst::Dispatcher(long opCode, long index, long value, void *ptr, float opt)
-//----------------------------------------------------------------------------------
+VstIntPtr CDmo2Vst::Dispatcher(VstInt32 opCode, VstInt32 index, VstIntPtr value, void *ptr, float opt)
+//----------------------------------------------------------------------------------------------------
{
switch(opCode)
{
@@ -4035,8 +4049,8 @@
}
-void CDmo2Vst::SetParameter(long index, float fValue)
-//---------------------------------------------------
+void CDmo2Vst::SetParameter(VstInt32 index, float fValue)
+//-------------------------------------------------------
{
MP_PARAMINFO mpi;
@@ -4065,8 +4079,8 @@
}
-float CDmo2Vst::GetParameter(long index)
-//--------------------------------------
+float CDmo2Vst::GetParameter(VstInt32 index)
+//------------------------------------------
{
if ((index < m_Effect.numParams) && (m_pParamInfo) && (m_pMediaParams))
{
Modified: trunk/OpenMPT/mptrack/Vstplug.h
===================================================================
--- trunk/OpenMPT/mptrack/Vstplug.h 2010-12-23 23:06:16 UTC (rev 777)
+++ trunk/OpenMPT/mptrack/Vstplug.h 2010-12-23 23:24:44 UTC (rev 778)
@@ -2,7 +2,9 @@
#define _VST_PLUGIN_MANAGER_H_
#ifndef NO_VST
+ #define VST_FORCE_DEPRECATED 0
#include <aeffectx.h> // VST
+ #include <vstfxstore.h>
#endif
#define kBuzzMagic 'Buzz'
@@ -66,7 +68,7 @@
PVSTPLUGINLIB m_pFactory;
PSNDMIXPLUGIN m_pMixStruct;
AEffect *m_pEffect;
- void (*m_pProcessFP)(AEffect*, float**, float**, long); //Function pointer to AEffect processReplacing if supported, else process.
+ void (*m_pProcessFP)(AEffect*, float**, float**, VstInt32); //Function pointer to AEffect processReplacing if supported, else process.
CAbstractVstEditor *m_pEditor; //rewbs.defaultPlugGUI
UINT m_nSampleRate;
BOOL m_bIsVst2;
@@ -110,10 +112,10 @@
long GetProgramNameIndexed(long index, long category, char *text); //rewbs.VSTpresets
bool LoadProgram(CString fileName);
bool SaveProgram(CString fileName);
- long GetUID(); //rewbs.VSTpresets
- long GetVersion(); //rewbs.VSTpresets
- bool GetParams(float* param, long min, long max); //rewbs.VSTpresets
- bool RandomizeParams(long minParam=0, long maxParam=0); //rewbs.VSTpresets
+ VstInt32 GetUID(); //rewbs.VSTpresets
+ VstInt32 GetVersion(); //rewbs.VSTpresets
+ bool GetParams(float* param, VstInt32 min, VstInt32 max); //rewbs.VSTpresets
+ bool RandomizeParams(VstInt32 minParam = 0, VstInt32 maxParam = 0); //rewbs.VSTpresets
bool isModified() {return m_bModified;}
inline CModDoc* GetModDoc() {return m_pModDoc;}
inline CSoundFile* GetSoundFile() {return m_pSndFile;}
@@ -135,7 +137,7 @@
VOID GetParamName(UINT nIndex, LPSTR pszName, UINT cbSize);
VOID GetParamLabel(UINT nIndex, LPSTR pszLabel);
VOID GetParamDisplay(UINT nIndex, LPSTR pszDisplay);
- long Dispatch(long opCode, long index, long value, void *ptr, float opt);
+ VstIntPtr Dispatch(VstInt32 opCode, VstInt32 index, VstIntPtr value, void *ptr, float opt);
VOID ToggleEditor();
VOID GetPluginType(LPSTR pszType);
BOOL GetDefaultEffectName(LPSTR pszName);
@@ -245,16 +247,16 @@
VOID EnumerateDirectXDMOs();
protected:
- long VstCallback(AEffect *effect, long opcode, long index, long value, void *ptr, float opt);
- long VstFileSelector(const bool destructor, VstFileSelect *pFileSel, const AEffect *effect);
- static long VSTCALLBACK MasterCallBack(AEffect *effect, long opcode, long index, long value, void *ptr, float opt);
+ VstIntPtr VstCallback(AEffect *effect, VstInt32 opcode, VstInt32 index, VstIntPtr value, void *ptr, float opt);
+ VstIntPtr VstFileSelector(const bool destructor, VstFileSelect *pFileSel, const AEffect *effect);
+ static VstIntPtr VSTCALLBACK MasterCallBack(AEffect *effect, VstInt32 opcode, VstInt32 index, VstIntPtr value, void *ptr, float opt);
static BOOL __cdecl CreateMixPluginProc(PSNDMIXPLUGIN, CSoundFile*);
VstTimeInfo timeInfo; //rewbs.VSTcompliance
public:
static char s_szHostProductString[64];
static char s_szHostVendorString[64];
- static long s_nHostVendorVersion;
+ static VstIntPtr s_nHostVendorVersion;
#else // NO_VST
public:
Modified: trunk/OpenMPT/mptrack/version.h
===================================================================
--- trunk/OpenMPT/mptrack/version.h 2010-12-23 23:06:16 UTC (rev 777)
+++ trunk/OpenMPT/mptrack/version.h 2010-12-23 23:24:44 UTC (rev 778)
@@ -15,7 +15,7 @@
#define VER_MAJORMAJOR 1
#define VER_MAJOR 19
#define VER_MINOR 00
-#define VER_MINORMINOR 16
+#define VER_MINORMINOR 17
//Creates version number from version parts that appears in version string.
//For example MAKE_VERSION_NUMERIC(1,17,02,28) gives version number of
Modified: trunk/OpenMPT/soundlib/Sndfile.h
===================================================================
--- trunk/OpenMPT/soundlib/Sndfile.h 2010-12-23 23:06:16 UTC (rev 777)
+++ trunk/OpenMPT/soundlib/Sndfile.h 2010-12-23 23:24:44 UTC (rev 778)
@@ -19,6 +19,15 @@
#include "Snd_defs.h"
#include "Endianness.h"
+// For VstInt32 and stuff - a stupid workaround for IMixPlugin.
+#ifndef NO_VST
+#define VST_FORCE_DEPRECATED 0
+#include <aeffect.h> // VST
+#else
+typedef int32 VstInt32;
+typedef int32 VstIntPtr;
+#endif
+
class CTuningBase;
typedef CTuningBase CTuning;
@@ -288,7 +297,7 @@
// Mix Plugins
#define MIXPLUG_MIXREADY 0x01 // Set when cleared
-typedef long PlugParamIndex;
+typedef VstInt32 PlugParamIndex;
typedef float PlugParamValue;
class IMixPlugin
@@ -313,7 +322,7 @@
virtual PlugParamValue GetParameter(PlugParamIndex nIndex) = 0;
virtual UINT GetZxxParameter(UINT nParam) = 0; //rewbs.smoothVST
virtual void ModifyParameter(PlugParamIndex nIndex, PlugParamValue diff);
- virtual long Dispatch(long opCode, long index, long value, void *ptr, float opt) =0; //rewbs.VSTCompliance
+ virtual VstIntPtr Dispatch(VstInt32 opCode, VstInt32 index, VstIntPtr value, void *ptr, float opt) =0; //rewbs.VSTCompliance
virtual void NotifySongPlaying(bool)=0; //rewbs.VSTCompliance
virtual bool IsSongPlaying()=0;
virtual bool IsResumed()=0;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sag...@us...> - 2010-12-23 23:06:23
|
Revision: 777
http://modplug.svn.sourceforge.net/modplug/?rev=777&view=rev
Author: saga-games
Date: 2010-12-23 23:06:16 +0000 (Thu, 23 Dec 2010)
Log Message:
-----------
[Fix] Note Properties: Changing values didn't create an undo point. (http://bugs.openmpt.org/view.php?id=56)
Modified Paths:
--------------
trunk/OpenMPT/mptrack/dlg_misc.cpp
trunk/OpenMPT/mptrack/dlg_misc.h
Modified: trunk/OpenMPT/mptrack/dlg_misc.cpp
===================================================================
--- trunk/OpenMPT/mptrack/dlg_misc.cpp 2010-12-20 23:03:47 UTC (rev 776)
+++ trunk/OpenMPT/mptrack/dlg_misc.cpp 2010-12-23 23:06:16 UTC (rev 777)
@@ -1187,6 +1187,7 @@
m_pageNote = NULL;
m_pageVolume = NULL;
m_pageEffect = NULL;
+ m_bModified = false;
}
@@ -1301,6 +1302,11 @@
MODCOMMAND *m = pSndFile->Patterns[m_nPattern]+m_nRow*pSndFile->m_nChannels+m_nChannel;
if ((m->note != note) || (m->instr != instr))
{
+ if(!m_bModified) // let's create just one undo step.
+ {
+ m_pModDoc->GetPatternUndo()->PrepareUndo(m_nPattern, m_nChannel, m_nRow, 1, 1);
+ m_bModified = true;
+ }
m->note = note;
m->instr = instr;
m_Command = *m;
@@ -1325,6 +1331,11 @@
MODCOMMAND *m = pSndFile->Patterns[m_nPattern]+m_nRow*pSndFile->m_nChannels+m_nChannel;
if ((m->volcmd != volcmd) || (m->vol != vol))
{
+ if(!m_bModified) // let's create just one undo step.
+ {
+ m_pModDoc->GetPatternUndo()->PrepareUndo(m_nPattern, m_nChannel, m_nRow, 1, 1);
+ m_bModified = true;
+ }
m->volcmd = volcmd;
m->vol = vol;
m_pModDoc->SetModified();
@@ -1359,6 +1370,11 @@
if ((m->command != command) || (m->param != param))
{
+ if(!m_bModified) // let's create just one undo step.
+ {
+ m_pModDoc->GetPatternUndo()->PrepareUndo(m_nPattern, m_nChannel, m_nRow, 1, 1);
+ m_bModified = true;
+ }
m->command = command;
m->param = param;
m_pModDoc->SetModified();
@@ -1386,7 +1402,7 @@
//-----------------------------------
{
CPropertyPage::OnInitDialog();
- m_bInitialized = TRUE;
+ m_bInitialized = true;
UpdateDialog();
return TRUE;
}
Modified: trunk/OpenMPT/mptrack/dlg_misc.h
===================================================================
--- trunk/OpenMPT/mptrack/dlg_misc.h 2010-12-20 23:03:47 UTC (rev 776)
+++ trunk/OpenMPT/mptrack/dlg_misc.h 2010-12-23 23:06:16 UTC (rev 777)
@@ -255,10 +255,10 @@
protected:
CModDoc *m_pModDoc;
CEditCommand *m_pParent;
- BOOL m_bInitialized;
+ bool m_bInitialized;
public:
- CPageEditCommand(CModDoc *pModDoc, CEditCommand *parent, UINT id):CPropertyPage(id) { m_pModDoc = pModDoc; m_pParent = parent; m_bInitialized = FALSE; }
+ CPageEditCommand(CModDoc *pModDoc, CEditCommand *parent, UINT id):CPropertyPage(id) { m_pModDoc = pModDoc; m_pParent = parent; m_bInitialized = false; }
virtual ~CPageEditCommand() {}
virtual BOOL OnInitDialog();
virtual void Init(MODCOMMAND&)=0;
@@ -358,6 +358,7 @@
HWND m_hWndView;
UINT m_nPattern, m_nRow, m_nChannel;
MODCOMMAND m_Command;
+ bool m_bModified;
public:
CEditCommand();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|