From: <sag...@us...> - 2010-08-06 18:33:12
|
Revision: 679 http://modplug.svn.sourceforge.net/modplug/?rev=679&view=rev Author: saga-games Date: 2010-08-06 18:33:04 +0000 (Fri, 06 Aug 2010) Log Message: ----------- [Fix] Comments Tab: Editing a sample/instrument name didn't mark the module as modified (tx djmakas) [Imp] Improved algorithm for finding a free channel for note playback in the editor. Modified Paths: -------------- trunk/OpenMPT/mptrack/Moddoc.cpp trunk/OpenMPT/mptrack/view_com.cpp Modified: trunk/OpenMPT/mptrack/Moddoc.cpp =================================================================== --- trunk/OpenMPT/mptrack/Moddoc.cpp 2010-08-06 15:28:31 UTC (rev 678) +++ trunk/OpenMPT/mptrack/Moddoc.cpp 2010-08-06 18:33:04 UTC (rev 679) @@ -1676,7 +1676,7 @@ void CModDoc::OnFileMidiConvert() -//------------------------------------- +//------------------------------- { CHAR path[_MAX_PATH]="", drive[_MAX_DRIVE]=""; CHAR s[_MAX_PATH], fname[_MAX_FNAME]=""; @@ -3526,21 +3526,20 @@ UINT CModDoc::FindAvailableChannel() //---------------------------------- { + CHANNELINDEX nStoppedChannel = CHANNELINDEX_INVALID; // Search for available channel for (CHANNELINDEX j = m_SndFile.m_nChannels; j < MAX_CHANNELS; j++) { MODCHANNEL *p = &m_SndFile.Chn[j]; if (!p->nLength) return j; + else if(p->dwFlags & CHN_NOTEFADE) + nStoppedChannel = j; } - // Not found: look for one that's stopped - for (CHANNELINDEX j = m_SndFile.m_nChannels; j < MAX_CHANNELS; j++) - { - MODCHANNEL *p = &m_SndFile.Chn[j]; - if (p->dwFlags & CHN_NOTEFADE) - return j; - } + // Nothing found: return one that's stopped + if(nStoppedChannel != CHANNELINDEX_INVALID) + return nStoppedChannel; //Last resort: go for first virutal channel. return m_SndFile.m_nChannels; @@ -3588,7 +3587,7 @@ CString message; message.Format("Param %d can now be controlled with macro %X", paramToUse, macroToSet); - ::MessageBox(NULL,message, "Macro assigned for this param",MB_ICONINFORMATION | MB_OK); + ::MessageBox(NULL, message, "Macro assigned for this param",MB_ICONINFORMATION | MB_OK); return; } @@ -3599,20 +3598,20 @@ CModTypeDlg dlg(GetSoundFile(), CMainFrame::GetMainFrame()); if (dlg.DoModal() == IDOK) { - BOOL bShowLog = FALSE; + bool bShowLog = false; ClearLog(); if(dlg.m_nType) { if (!ChangeModType(dlg.m_nType)) return; - bShowLog = TRUE; + bShowLog = true; } UINT nNewChannels = CLAMP(dlg.m_nChannels, m_SndFile.GetModSpecifications().channelsMin, m_SndFile.GetModSpecifications().channelsMax); - if (nNewChannels != GetSoundFile()->m_nChannels) + if (nNewChannels != GetSoundFile()->GetNumChannels()) { const bool showCancelInRemoveDlg = m_SndFile.GetModSpecifications().channelsMax >= m_SndFile.GetNumChannels(); - if(ChangeNumChannels(nNewChannels, showCancelInRemoveDlg)) bShowLog = TRUE; + if(ChangeNumChannels(nNewChannels, showCancelInRemoveDlg)) bShowLog = true; } if (bShowLog) ShowLog("Conversion Status", CMainFrame::GetMainFrame()); Modified: trunk/OpenMPT/mptrack/view_com.cpp =================================================================== --- trunk/OpenMPT/mptrack/view_com.cpp 2010-08-06 15:28:31 UTC (rev 678) +++ trunk/OpenMPT/mptrack/view_com.cpp 2010-08-06 18:33:04 UTC (rev 679) @@ -500,6 +500,7 @@ SetNullTerminator(pSndFile->m_szNames[iItem + 1]); // 05/01/05 : ericus replaced "<< 24" by "<< 20" : 4000 samples -> 12bits [see Moddoc.h] pModDoc->UpdateAllViews(this, ((iItem + 1) << HINT_SHIFT_SMP) | (HINT_SMPNAMES|HINT_SAMPLEINFO), this); + pModDoc->SetModified(); } } else if (m_nListId == IDC_LIST_INSTRUMENTS) @@ -510,6 +511,7 @@ memcpy(pIns->name, s, sizeof(pIns->name)); SetNullTerminator(pIns->name); pModDoc->UpdateAllViews(this, ((iItem + 1) << HINT_SHIFT_INS) | (HINT_INSNAMES|HINT_INSTRUMENT), this); + pModDoc->SetModified(); } } else { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |