|
From: <rel...@us...> - 2008-03-19 20:38:20
|
Revision: 206
http://modplug.svn.sourceforge.net/modplug/?rev=206&view=rev
Author: relabsoluness
Date: 2008-03-19 13:38:12 -0700 (Wed, 19 Mar 2008)
Log Message:
-----------
Bug fixing.
. Fix to possible crash when browsing modules in treeview(http://lpchip.com/modplug/viewtopic.php?t=2222).
. Fix to severe memory leak in the same section as above.
. Fix to mptm not showing in tree view file browser.
? Some internal modifications
Modified Paths:
--------------
trunk/OpenMPT/mptrack/MainFrm.cpp
trunk/OpenMPT/mptrack/Mainbar.cpp
trunk/OpenMPT/mptrack/Mainbar.h
trunk/OpenMPT/mptrack/View_ins.cpp
trunk/OpenMPT/mptrack/View_ins.h
trunk/OpenMPT/mptrack/View_smp.cpp
trunk/OpenMPT/mptrack/View_smp.h
trunk/OpenMPT/mptrack/View_tre.cpp
trunk/OpenMPT/mptrack/Vstplug.cpp
trunk/OpenMPT/mptrack/Vstplug.h
trunk/OpenMPT/soundlib/Load_it.cpp
trunk/OpenMPT/soundlib/Snd_fx.cpp
trunk/OpenMPT/soundlib/Sndfile.cpp
trunk/OpenMPT/soundlib/Sndfile.h
Modified: trunk/OpenMPT/mptrack/MainFrm.cpp
===================================================================
--- trunk/OpenMPT/mptrack/MainFrm.cpp 2008-03-17 18:11:44 UTC (rev 205)
+++ trunk/OpenMPT/mptrack/MainFrm.cpp 2008-03-19 20:38:12 UTC (rev 206)
@@ -450,7 +450,7 @@
GetPrivateProfileLong("AutoSave", "Enabled", true, iniFile)?m_pAutoSaver->Enable():m_pAutoSaver->Disable();
m_pAutoSaver->SetSaveInterval(GetPrivateProfileLong("AutoSave", "IntervalMinutes", 10, iniFile));
m_pAutoSaver->SetHistoryDepth(GetPrivateProfileLong("AutoSave", "BackupHistory", 3, iniFile));
- m_pAutoSaver->SetUseOriginalPath(GetPrivateProfileLong("AutoSave", "UseOriginalPath", true, iniFile));
+ m_pAutoSaver->SetUseOriginalPath(GetPrivateProfileLong("AutoSave", "UseOriginalPath", true, iniFile) != 0);
m_pAutoSaver->SetPath(GetPrivateProfileCString("AutoSave", "Path", "", iniFile));
m_pAutoSaver->SetFilenameTemplate(GetPrivateProfileCString("AutoSave", "FileNameTemplate", "", iniFile));
}
@@ -961,7 +961,7 @@
{
CHAR valueBuffer[INIBUFFERSIZE];
wsprintf(valueBuffer, "%li", value);
- return WritePrivateProfileString(section, key, valueBuffer, iniFile);
+ return (WritePrivateProfileString(section, key, valueBuffer, iniFile) != 0);
}
@@ -981,7 +981,7 @@
{
CHAR valueBuffer[INIBUFFERSIZE];
wsprintf(valueBuffer, "%lu", value);
- return WritePrivateProfileString(section, key, valueBuffer, iniFile);
+ return (WritePrivateProfileString(section, key, valueBuffer, iniFile) != 0);
}
DWORD CMainFrame::GetPrivateProfileDWord(const CString section, const CString key, const DWORD defaultValue, const CString iniFile)
@@ -996,7 +996,7 @@
bool CMainFrame::WritePrivateProfileCString(const CString section, const CString key, const CString value, const CString iniFile)
{
- return WritePrivateProfileString(section, key, value, iniFile);
+ return (WritePrivateProfileString(section, key, value, iniFile) != 0);
}
CString CMainFrame::GetPrivateProfileCString(const CString section, const CString key, const CString defaultValue, const CString iniFile)
Modified: trunk/OpenMPT/mptrack/Mainbar.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Mainbar.cpp 2008-03-17 18:11:44 UTC (rev 205)
+++ trunk/OpenMPT/mptrack/Mainbar.cpp 2008-03-19 20:38:12 UTC (rev 206)
@@ -922,7 +922,7 @@
}
-#if _MSC_VER >= 1400
+#if _MFC_VER > 0x0710
LRESULT CModTreeBar::OnNcHitTest(CPoint point)
#else
UINT CModTreeBar::OnNcHitTest(CPoint point)
Modified: trunk/OpenMPT/mptrack/Mainbar.h
===================================================================
--- trunk/OpenMPT/mptrack/Mainbar.h 2008-03-17 18:11:44 UTC (rev 205)
+++ trunk/OpenMPT/mptrack/Mainbar.h 2008-03-19 20:38:12 UTC (rev 206)
@@ -116,7 +116,7 @@
protected:
//{{AFX_MSG(CModTreeBar)
afx_msg void OnNcPaint();
-#if _MSC_VER >= 1400
+#if _MFC_VER > 0x0710
afx_msg LRESULT OnNcHitTest(CPoint point);
#else
afx_msg UINT OnNcHitTest(CPoint point);
Modified: trunk/OpenMPT/mptrack/View_ins.cpp
===================================================================
--- trunk/OpenMPT/mptrack/View_ins.cpp 2008-03-17 18:11:44 UTC (rev 205)
+++ trunk/OpenMPT/mptrack/View_ins.cpp 2008-03-19 20:38:12 UTC (rev 206)
@@ -1700,7 +1700,7 @@
}
-#if _MSC_VER >= 1400
+#if _MFC_VER > 0x0710
LRESULT CViewInstrument::OnNcHitTest(CPoint point)
#else
UINT CViewInstrument::OnNcHitTest(CPoint point)
Modified: trunk/OpenMPT/mptrack/View_ins.h
===================================================================
--- trunk/OpenMPT/mptrack/View_ins.h 2008-03-17 18:11:44 UTC (rev 205)
+++ trunk/OpenMPT/mptrack/View_ins.h 2008-03-19 20:38:12 UTC (rev 206)
@@ -98,7 +98,7 @@
afx_msg BOOL OnEraseBkgnd(CDC *) { return TRUE; }
afx_msg void OnSize(UINT nType, int cx, int cy);
afx_msg void OnNcCalcSize(BOOL bCalcValidRects, NCCALCSIZE_PARAMS* lpncsp);
-#if _MSC_VER >= 1400
+#if _MFC_VER > 0x0710
afx_msg LRESULT OnNcHitTest(CPoint point);
#else
afx_msg UINT OnNcHitTest(CPoint point);
Modified: trunk/OpenMPT/mptrack/View_smp.cpp
===================================================================
--- trunk/OpenMPT/mptrack/View_smp.cpp 2008-03-17 18:11:44 UTC (rev 205)
+++ trunk/OpenMPT/mptrack/View_smp.cpp 2008-03-19 20:38:12 UTC (rev 206)
@@ -1408,7 +1408,7 @@
}
-#if _MSC_VER >= 1400
+#if _MFC_VER > 0x0710
LRESULT CViewSample::OnNcHitTest(CPoint point)
#else
UINT CViewSample::OnNcHitTest(CPoint point)
Modified: trunk/OpenMPT/mptrack/View_smp.h
===================================================================
--- trunk/OpenMPT/mptrack/View_smp.h 2008-03-17 18:11:44 UTC (rev 205)
+++ trunk/OpenMPT/mptrack/View_smp.h 2008-03-19 20:38:12 UTC (rev 206)
@@ -59,7 +59,7 @@
afx_msg BOOL OnEraseBkgnd(CDC *) { return TRUE; }
afx_msg void OnSize(UINT nType, int cx, int cy);
afx_msg void OnNcCalcSize(BOOL bCalcValidRects, NCCALCSIZE_PARAMS* lpncsp);
-#if _MSC_VER >= 1400
+#if _MFC_VER > 0x0710
afx_msg LRESULT OnNcHitTest(CPoint point);
#else
afx_msg UINT OnNcHitTest(CPoint point);
Modified: trunk/OpenMPT/mptrack/View_tre.cpp
===================================================================
--- trunk/OpenMPT/mptrack/View_tre.cpp 2008-03-17 18:11:44 UTC (rev 205)
+++ trunk/OpenMPT/mptrack/View_tre.cpp 2008-03-19 20:38:12 UTC (rev 206)
@@ -247,7 +247,9 @@
LPBYTE lpStream = f.Lock();
if (lpStream)
{
- m_SongFile.Create(lpStream, CMainFrame::GetMainFrame()->GetActiveDoc(), dwLen);
+ //m_SongFile.Create(lpStream, CMainFrame::GetMainFrame()->GetActiveDoc(), dwLen);
+ m_SongFile.Destroy();
+ m_SongFile.Create(lpStream, NULL, dwLen);
f.Unlock();
}
}
@@ -1530,6 +1532,7 @@
|| (!lstrcmpi(s, ".s3m"))
|| (!lstrcmpi(s, ".xm"))
|| (!lstrcmpi(s, ".it"))
+ || (!lstrcmpi(s, ".mptm"))
// -> CODE#0023
// -> DESC="IT project files (.itp)"
// || (!lstrcmpi(s, ".itp")) ericus 03/03/2005 : temporarily deactivated 03/03/2005
Modified: trunk/OpenMPT/mptrack/Vstplug.cpp
===================================================================
--- trunk/OpenMPT/mptrack/Vstplug.cpp 2008-03-17 18:11:44 UTC (rev 205)
+++ trunk/OpenMPT/mptrack/Vstplug.cpp 2008-03-19 20:38:12 UTC (rev 206)
@@ -39,13 +39,13 @@
}
-BOOL CVstPluginManager::CreateMixPluginProc(PSNDMIXPLUGIN pMixPlugin, CModDoc *pModDoc)
+BOOL CVstPluginManager::CreateMixPluginProc(PSNDMIXPLUGIN pMixPlugin, CSoundFile* pSndFile)
//-------------------------------------------------------------------------------------
{
CVstPluginManager *that = theApp.GetPluginManager();
if (that)
{
- return that->CreateMixPlugin(pMixPlugin, pModDoc);
+ return that->CreateMixPlugin(pMixPlugin, pSndFile);
}
return FALSE;
}
@@ -408,7 +408,7 @@
}
-BOOL CVstPluginManager::CreateMixPlugin(PSNDMIXPLUGIN pMixPlugin, CModDoc *pModDoc)
+BOOL CVstPluginManager::CreateMixPlugin(PSNDMIXPLUGIN pMixPlugin, CSoundFile* pSndFile)
//---------------------------------------------------------------------------------
{
UINT nMatch=0;
@@ -462,7 +462,7 @@
CVstPlugin *pVstPlug = new CVstPlugin(NULL, pFound, pMixPlugin, pEffect);
if (pVstPlug)
{
- pVstPlug->Initialize(pModDoc);
+ pVstPlug->Initialize(pSndFile);
bOk = TRUE;
}
END_CRITICAL();
@@ -547,7 +547,7 @@
}
}
CVstPlugin *pVstPlug = new CVstPlugin(hLibrary, pFound, pMixPlugin, pEffect);
- if (pVstPlug) pVstPlug->Initialize(pModDoc);
+ if (pVstPlug) pVstPlug->Initialize(pSndFile);
}
} else
{
@@ -1145,7 +1145,7 @@
// Now, create the new plugin
if (pManager)
{
- pManager->CreateMixPlugin(m_pPlugin, m_pModDoc);
+ pManager->CreateMixPlugin(m_pPlugin, (m_pModDoc) ? m_pModDoc->GetSoundFile() : 0);
if (m_pPlugin->pMixPlugin)
{
CHAR s[128];
@@ -1518,7 +1518,7 @@
}
-void CVstPlugin::Initialize(CModDoc *pModDoc)
+void CVstPlugin::Initialize(CSoundFile* pSndFile)
//-------------------------------------------
{
if (!m_pEvList)
@@ -1541,8 +1541,8 @@
//Assuming 32bit address space...
m_pEffect->resvd1=(long)this;
//rewbs.plugDocAware
- m_pModDoc = pModDoc;
- m_pSndFile = pModDoc->GetSoundFile();
+ m_pSndFile = pSndFile;
+ m_pModDoc = pSndFile->GetpModDoc();
m_nSlot = FindSlot();
//end rewbs.plugDocAware
@@ -2079,7 +2079,7 @@
float gain = 0.1f * (float)( m_pMixStruct ? (m_pMixStruct->Info.dwInputRouting>>16) & 0xff : 10 );
if(gain < 0.1f) gain = 1.0f;
- if (m_bIsInstrument) {
+ if (m_bIsInstrument && m_pSndFile) {
gain /= m_pSndFile->m_pConfig->getVSTiAttenuation();
gain *= (m_pSndFile->m_nVSTiVolume / m_pSndFile->m_pConfig->getNormalVSTiVol());
}
@@ -2543,7 +2543,7 @@
nParam=127;
}
- if(m_pSndFile->GetModFlag(MSF_MIDICC_BUGEMULATION))
+ if(m_pSndFile && m_pSndFile->GetModFlag(MSF_MIDICC_BUGEMULATION))
MidiSend(nController<<16 | nParam<<8 | 0xB0|nMidiCh);
else
MidiSend(nParam<<16 | nController<<8 | 0xB0|nMidiCh);
@@ -2710,13 +2710,15 @@
}
bool CVstPlugin::isPlaying(UINT note, UINT midiChn, UINT trackerChn)
+//------------------------------------------------------------------
{
note--;
PVSTINSTCH pMidiCh = &m_MidiCh[(midiChn-1) & 0x0f];
- return pMidiCh->uNoteOnMap[note][trackerChn];
+ return (pMidiCh->uNoteOnMap[note][trackerChn] != 0);
}
bool CVstPlugin::MoveNote(UINT note, UINT midiChn, UINT sourceTrackerChn, UINT destTrackerChn)
+//---------------------------------------------------------------------------------------------
{
note--;
PVSTINSTCH pMidiCh = &m_MidiCh[(midiChn-1) & 0x0f];
@@ -2820,7 +2822,7 @@
&& (m_pEffect->uniqueID != 'Sytr')) //special case: imageline sytrus pretends to support chunks but gives us garbage.
{
PVOID p = NULL;
- LONG nByteSize;
+ LONG nByteSize = 0;
// Try to get whole bank
if (m_pEffect->uniqueID != 1984054788) { //special case: VB ffx4 pretends to get a valid bank but gives us garbage.
@@ -2839,7 +2841,7 @@
m_pMixStruct->nPluginDataSize = nByteSize+4;
} else
{
- if (m_pMixStruct->pPluginData) delete[] m_pMixStruct->pPluginData;
+ delete[] m_pMixStruct->pPluginData;
m_pMixStruct->nPluginDataSize = 0;
m_pMixStruct->pPluginData = new char[nByteSize+4];
if (m_pMixStruct->pPluginData)
@@ -3001,11 +3003,13 @@
//rewbs.defaultPlugGui
CAbstractVstEditor* CVstPlugin::GetEditor()
+//-----------------------------------------
{
return m_pEditor;
}
bool CVstPlugin::Bypass(bool bypass)
+//-----------------------------------
{
if (bypass) {
m_pMixStruct->Info.dwInputRouting |= MIXPLUG_INPUTF_BYPASS;
@@ -3020,13 +3024,15 @@
return bypass;
}
bool CVstPlugin::Bypass()
+//-----------------------
{
return Bypass(!IsBypassed());
}
bool CVstPlugin::IsBypassed()
+//---------------------------
{
- return m_pMixStruct->Info.dwInputRouting & MIXPLUG_INPUTF_BYPASS;
+ return ((m_pMixStruct->Info.dwInputRouting & MIXPLUG_INPUTF_BYPASS) != 0);
}
//end rewbs.defaultPlugGui
@@ -3035,6 +3041,7 @@
//rewbs.VSTcompliance
BOOL CVstPlugin::GetSpeakerArrangement()
+//--------------------------------------
{
VstSpeakerArrangement **pSA = NULL;
Dispatch(effGetSpeakerArrangement, 0,0,pSA,0);
@@ -3044,7 +3051,9 @@
return true;
}
-void CVstPlugin::NotifySongPlaying(bool playing) {
+void CVstPlugin::NotifySongPlaying(bool playing)
+//----------------------------------------------
+{
m_bSongPlaying=playing;
}
@@ -3095,10 +3104,11 @@
bool CVstPlugin::KeysRequired()
//-----------------------------
{
- return (CVstPlugin::Dispatch(effKeysRequired, 0, 0, NULL, 0));
+ return (CVstPlugin::Dispatch(effKeysRequired, 0, 0, NULL, 0) != 0);
}
void CVstPlugin::GetOutputPlugList(CArray<CVstPlugin*,CVstPlugin*> &list)
+//-----------------------------------------------------------------------
{
// At the moment we know there will only be 1 output.
// Returning NULL ptr means plugin outputs directly to master.
@@ -3107,7 +3117,7 @@
CVstPlugin *pOutputPlug = NULL;
if (m_pMixStruct->Info.dwOutputRouting & 0x80) {
UINT nOutput = m_pMixStruct->Info.dwOutputRouting & 0x7f;
- if ((nOutput > m_nSlot) && (nOutput < MAX_MIXPLUGINS)) {
+ if (m_pSndFile && (nOutput > m_nSlot) && (nOutput < MAX_MIXPLUGINS)) {
pOutputPlug = (CVstPlugin*) m_pSndFile->m_MixPlugins[nOutput].pMixPlugin;
}
}
@@ -3117,7 +3127,10 @@
}
void CVstPlugin::GetInputPlugList(CArray<CVstPlugin*,CVstPlugin*> &list)
+//----------------------------------------------------------------------
{
+ if(m_pSndFile == 0) return;
+
CArray<CVstPlugin*, CVstPlugin*> candidatePlugOutputs;
CVstPlugin* pCandidatePlug = NULL;
list.RemoveAll();
@@ -3139,16 +3152,15 @@
return;
}
-void CVstPlugin::GetInputInstrumentList(CArray<UINT,UINT> &list)
+void CVstPlugin::GetInputInstrumentList(CArray<UINT,UINT> &list)
+//--------------------------------------------------------------
{
list.RemoveAll();
+ if(m_pSndFile == 0) return;
- CModDoc* pModDoc = GetModDoc();
- CSoundFile* pSndFile = pModDoc->GetSoundFile();
-
UINT nThisMixPlug = m_nSlot+1; //m_nSlot is position in mixplug array.
for (int nIns=0; nIns<MAX_INSTRUMENTS; nIns++) {
- if (pSndFile->Headers[nIns] && (pSndFile->Headers[nIns]->nMixPlug==nThisMixPlug)) {
+ if (m_pSndFile->Headers[nIns] && (m_pSndFile->Headers[nIns]->nMixPlug==nThisMixPlug)) {
list.Add(nIns);
}
}
@@ -3157,16 +3169,16 @@
}
-void CVstPlugin::GetInputChannelList(CArray<UINT,UINT> &list)
+void CVstPlugin::GetInputChannelList(CArray<UINT,UINT> &list)
+//------------------------------------------------------------
{
+ if(m_pSndFile == 0) return;
list.RemoveAll();
- CModDoc* pModDoc = GetModDoc();
- CSoundFile* pSndFile = pModDoc->GetSoundFile();
-
UINT nThisMixPlug = m_nSlot+1; //m_nSlot is position in mixplug array.
- for (int nChn=0; nChn<pSndFile->m_nChannels; nChn++) {
- if (pSndFile->ChnSettings[nChn].nMixPlugin==nThisMixPlug) {
+ const CHANNELINDEX chnCount = m_pSndFile->GetNumChannels();
+ for (CHANNELINDEX nChn=0; nChn<chnCount; nChn++) {
+ if (m_pSndFile->ChnSettings[nChn].nMixPlugin==nThisMixPlug) {
list.Add(nChn);
}
}
Modified: trunk/OpenMPT/mptrack/Vstplug.h
===================================================================
--- trunk/OpenMPT/mptrack/Vstplug.h 2008-03-17 18:11:44 UTC (rev 205)
+++ trunk/OpenMPT/mptrack/Vstplug.h 2008-03-19 20:38:12 UTC (rev 206)
@@ -93,7 +93,7 @@
public:
CVstPlugin(HINSTANCE hLibrary, PVSTPLUGINLIB pFactory, PSNDMIXPLUGIN pMixPlugin, AEffect *pEffect);
virtual ~CVstPlugin();
- void Initialize(CModDoc* pModDoc);
+ void Initialize(CSoundFile* pSndFile);
public:
PVSTPLUGINLIB GetPluginFactory() const { return m_pFactory; }
@@ -208,7 +208,7 @@
BOOL IsValidPlugin(const VSTPLUGINLIB *pLib);
PVSTPLUGINLIB AddPlugin(LPCSTR pszDllPath, BOOL bCache=TRUE, const bool checkFileExistence = false, CString* const errStr = 0);
BOOL RemovePlugin(PVSTPLUGINLIB);
- BOOL CreateMixPlugin(PSNDMIXPLUGIN, CModDoc*);
+ BOOL CreateMixPlugin(PSNDMIXPLUGIN, CSoundFile*);
VOID OnIdle();
static void ReportPlugException(LPCSTR format,...);
@@ -218,7 +218,7 @@
protected:
long VstCallback(AEffect *effect, long opcode, long index, long value, void *ptr, float opt);
static long VSTCALLBACK MasterCallBack(AEffect *effect, long opcode, long index, long value, void *ptr, float opt);
- static BOOL __cdecl CreateMixPluginProc(PSNDMIXPLUGIN, CModDoc*);
+ static BOOL __cdecl CreateMixPluginProc(PSNDMIXPLUGIN, CSoundFile*);
VstTimeInfo timeInfo; //rewbs.VSTcompliance
};
Modified: trunk/OpenMPT/soundlib/Load_it.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Load_it.cpp 2008-03-17 18:11:44 UTC (rev 205)
+++ trunk/OpenMPT/soundlib/Load_it.cpp 2008-03-19 20:38:12 UTC (rev 206)
@@ -172,8 +172,9 @@
notFoundTunings.push_back(str);
string erm = string("Tuning ") + str + string(" used by the module was not found.");
MessageBox(0, erm.c_str(), 0, MB_ICONINFORMATION);
- csf.m_pModDoc->SetModified(); //The tuning is changed so
- //the modified flag is set.
+ if(csf.GetpModDoc()) //The tuning is changed so the modified flag is set.
+ csf.GetpModDoc()->SetModified();
+
}
csf.Headers[i]->pTuning = csf.Headers[i]->s_DefaultTuning;
Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Snd_fx.cpp 2008-03-17 18:11:44 UTC (rev 205)
+++ trunk/OpenMPT/soundlib/Snd_fx.cpp 2008-03-19 20:38:12 UTC (rev 206)
@@ -3427,8 +3427,10 @@
// Channel mutes
for (UINT chan=0; chan<m_nChannels; chan++) {
- if (m_bChannelMuteTogglePending[chan]) {
- m_pModDoc->MuteChannel(chan, !m_pModDoc->IsChannelMuted(chan));
+ if (m_bChannelMuteTogglePending[chan])
+ {
+ if(m_pModDoc)
+ m_pModDoc->MuteChannel(chan, !m_pModDoc->IsChannelMuted(chan));
m_bChannelMuteTogglePending[chan]=false;
}
}
Modified: trunk/OpenMPT/soundlib/Sndfile.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Sndfile.cpp 2008-03-17 18:11:44 UTC (rev 205)
+++ trunk/OpenMPT/soundlib/Sndfile.cpp 2008-03-19 20:38:12 UTC (rev 206)
@@ -687,15 +687,15 @@
}
if ((m_nRestartPos >= Order.size()) || (Order[m_nRestartPos] >= Patterns.Size())) m_nRestartPos = 0;
- // Load plugins
- if (gpMixPluginCreateProc)
+ // Load plugins only when m_pModDoc != 0. (can be == 0 for example when examining module samples in treeview.
+ if (gpMixPluginCreateProc && GetpModDoc())
{
for (UINT iPlug=0; iPlug<MAX_MIXPLUGINS; iPlug++)
{
if ((m_MixPlugins[iPlug].Info.dwPluginId1)
|| (m_MixPlugins[iPlug].Info.dwPluginId2))
{
- gpMixPluginCreateProc(&m_MixPlugins[iPlug], pModDoc);
+ gpMixPluginCreateProc(&m_MixPlugins[iPlug], this);
if (m_MixPlugins[iPlug].pMixPlugin)
{
m_MixPlugins[iPlug].pMixPlugin->RestoreAllParameters(m_MixPlugins[iPlug].defaultProgram); //rewbs.plugDefaultProgram: added param
@@ -728,16 +728,13 @@
Patterns[i] = NULL;
}
m_nPatternNames = 0;
- if (m_lpszPatternNames)
- {
- delete[] m_lpszPatternNames;
- m_lpszPatternNames = NULL;
- }
- if (m_lpszSongComments)
- {
- delete[] m_lpszSongComments;
- m_lpszSongComments = NULL;
- }
+
+ delete[] m_lpszPatternNames;
+ m_lpszPatternNames = NULL;
+
+ delete[] m_lpszSongComments;
+ m_lpszSongComments = NULL;
+
for (i=1; i<MAX_SAMPLES; i++)
{
MODINSTRUMENT *pins = &Ins[i];
@@ -749,11 +746,8 @@
}
for (i=0; i<MAX_INSTRUMENTS; i++)
{
- if (Headers[i])
- {
- delete Headers[i];
- Headers[i] = NULL;
- }
+ delete Headers[i];
+ Headers[i] = NULL;
}
for (i=0; i<MAX_MIXPLUGINS; i++)
{
@@ -1365,8 +1359,11 @@
ResetChannelState(nch, CHNRESET_TOTAL);
- m_pModDoc->Record1Channel(nch,FALSE);
- m_pModDoc->Record2Channel(nch,FALSE);
+ if(m_pModDoc)
+ {
+ m_pModDoc->Record1Channel(nch,FALSE);
+ m_pModDoc->Record2Channel(nch,FALSE);
+ }
m_bChannelMuteTogglePending[nch] = false;
return false;
@@ -1498,11 +1495,13 @@
{
settings[i] = ChnSettings[i];
chns[i] = Chn[i];
- recordStates[i] = m_pModDoc->IsChannelRecord(i);
+ if(m_pModDoc)
+ recordStates[i] = m_pModDoc->IsChannelRecord(i);
chnMutePendings[i] = m_bChannelMuteTogglePending[i];
}
- m_pModDoc->ReinitRecordState();
+ if(m_pModDoc)
+ m_pModDoc->ReinitRecordState();
for (UINT i=0; i<nRemainingChannels; i++)
{
@@ -1510,8 +1509,11 @@
{
ChnSettings[i] = settings[newOrder[i]];
Chn[i] = chns[newOrder[i]];
- if(recordStates[newOrder[i]] == 1) m_pModDoc->Record1Channel(i,TRUE);
- if(recordStates[newOrder[i]] == 2) m_pModDoc->Record2Channel(i,TRUE);
+ if(m_pModDoc)
+ {
+ if(recordStates[newOrder[i]] == 1) m_pModDoc->Record1Channel(i,TRUE);
+ if(recordStates[newOrder[i]] == 2) m_pModDoc->Record2Channel(i,TRUE);
+ }
m_bChannelMuteTogglePending[i] = chnMutePendings[newOrder[i]];
}
else
Modified: trunk/OpenMPT/soundlib/Sndfile.h
===================================================================
--- trunk/OpenMPT/soundlib/Sndfile.h 2008-03-17 18:11:44 UTC (rev 205)
+++ trunk/OpenMPT/soundlib/Sndfile.h 2008-03-19 20:38:12 UTC (rev 206)
@@ -45,7 +45,7 @@
//#else
// -> CODE#0006
// -> DESC="misc quantity changes"
-#define MAX_CHANNELS 256 //200
+#define MAX_CHANNELS 256 //200 //Note: MAX_BASECHANNELS defines max pattern channels
// -! BEHAVIOUR_CHANGE#0006
//#endif
// -> CODE#0006
@@ -53,7 +53,7 @@
//#ifdef FASTSOUNDLIB
//#define MAX_BASECHANNELS 64
//#else
-#define MAX_BASECHANNELS 127
+#define MAX_BASECHANNELS 127 //Max pattern channels.
//#endif
// -! BEHAVIOUR_CHANGE#0006
#define MAX_ENVPOINTS 32
@@ -731,7 +731,7 @@
//class CSoundFile;
class CModDoc;
-typedef BOOL (__cdecl *PMIXPLUGINCREATEPROC)(PSNDMIXPLUGIN, CModDoc*);
+typedef BOOL (__cdecl *PMIXPLUGINCREATEPROC)(PSNDMIXPLUGIN, CSoundFile*);
struct SNDMIXSONGEQ
{
@@ -939,7 +939,7 @@
SNDMIXPLUGIN m_MixPlugins[MAX_MIXPLUGINS]; // Mix plugins
SNDMIXSONGEQ m_SongEQ; // Default song EQ preset
CHAR CompressionTable[16];
- bool m_bChannelMuteTogglePending[MAX_CHANNELS];
+ bool m_bChannelMuteTogglePending[MAX_BASECHANNELS];
CSoundFilePlayConfig* m_pConfig;
DWORD m_dwCreatedWithVersion;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|