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
(353) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <re...@us...> - 2006-06-20 00:47:14
|
Revision: 157 Author: rewbs Date: 2006-06-19 17:44:57 -0700 (Mon, 19 Jun 2006) ViewCVS: http://svn.sourceforge.net/modplug/?rev=157&view=rev Log Message: ----------- . v1.17.02.43 + <rewbs> You can now load up new plugins from anywhere, not just the General tab. Select "Plugin Manager..." from the view menu. This can also be assigned to a global hotkey. Limitation: currently plugins added to a song in this manner with always be put in the first empty slot. In a future version you'll be able to choose the slot directly from that window. + <rewbs> "Cleanup Plugins" to remove any plugs that are not associated to a channel and not used by an instrument and not used as an output for any used plugs. . <rewbs> Fixed channel limits. Should be able to correctly save IT pattern data with up to 127 chans. There's only space for 64 channel headers though (channel names etc..). XMs restricted to 64 chans. . <rewbs> Added channel limit check when adding chans from the pattern editor. . <rewbs> Fixed instant crash with SampleTank 2.1. Modified Paths: -------------- trunk/OpenMPT/mptrack/Childfrm.cpp trunk/OpenMPT/mptrack/Childfrm.h trunk/OpenMPT/mptrack/CommandSet.cpp trunk/OpenMPT/mptrack/Ctrl_gen.cpp trunk/OpenMPT/mptrack/Globals.cpp trunk/OpenMPT/mptrack/Globals.h trunk/OpenMPT/mptrack/MainFrm.cpp trunk/OpenMPT/mptrack/Mainfrm.h trunk/OpenMPT/mptrack/Moddoc.cpp trunk/OpenMPT/mptrack/Moddoc.h trunk/OpenMPT/mptrack/Modedit.cpp trunk/OpenMPT/mptrack/View_gen.cpp trunk/OpenMPT/mptrack/View_pat.cpp trunk/OpenMPT/mptrack/Vstplug.cpp trunk/OpenMPT/mptrack/Vstplug.h trunk/OpenMPT/mptrack/bin/mptrack_Generic.exe trunk/OpenMPT/mptrack/bin/mptrack_P3.exe trunk/OpenMPT/mptrack/bin/mptrack_P4-Athlon64.exe trunk/OpenMPT/mptrack/bin/mptrack_athlon32.exe trunk/OpenMPT/mptrack/bin/version trunk/OpenMPT/mptrack/dlg_misc.cpp trunk/OpenMPT/mptrack/mptrack.rc trunk/OpenMPT/mptrack/mptrack.vcproj trunk/OpenMPT/mptrack/resource.h trunk/OpenMPT/packageTemplate/History.txt trunk/OpenMPT/packageTemplate/extraKeymaps/UK_mpt_it2_hybrid_(rewbs).mkb trunk/OpenMPT/soundlib/Fastmix.cpp trunk/OpenMPT/soundlib/Load_it.cpp trunk/OpenMPT/soundlib/Load_mod.cpp trunk/OpenMPT/soundlib/Sndfile.h Modified: trunk/OpenMPT/mptrack/Childfrm.cpp =================================================================== --- trunk/OpenMPT/mptrack/Childfrm.cpp 2006-04-11 23:44:36 UTC (rev 156) +++ trunk/OpenMPT/mptrack/Childfrm.cpp 2006-06-20 00:44:57 UTC (rev 157) @@ -220,7 +220,18 @@ return TRUE; } +void CChildFrame::ForceRefresh() +//------------------------------ +{ + CModControlView *pModView; + if ((pModView = (CModControlView *)m_wndSplitter.GetPane(0, 0)) != NULL) + { + pModView->ForceRefresh(); + } + return; +} + void CChildFrame::SavePosition(BOOL bForce) //----------------------------------------- { Modified: trunk/OpenMPT/mptrack/Childfrm.h =================================================================== --- trunk/OpenMPT/mptrack/Childfrm.h 2006-04-11 23:44:36 UTC (rev 156) +++ trunk/OpenMPT/mptrack/Childfrm.h 2006-06-20 00:44:57 UTC (rev 157) @@ -102,6 +102,7 @@ // Operations public: BOOL ChangeViewClass(CRuntimeClass* pNewViewClass, CCreateContext* pContext=NULL); + void ForceRefresh(); void SavePosition(BOOL bExit=FALSE); CHAR* GetCurrentViewClassName(); //rewbs.varWindowSize LRESULT SendViewMessage(UINT uMsg, LPARAM lParam=0) const; Modified: trunk/OpenMPT/mptrack/CommandSet.cpp =================================================================== --- trunk/OpenMPT/mptrack/CommandSet.cpp 2006-04-11 23:44:36 UTC (rev 156) +++ trunk/OpenMPT/mptrack/CommandSet.cpp 2006-06-20 00:44:57 UTC (rev 157) @@ -2050,7 +2050,7 @@ commands[kcNoteOffOld].Message = "Note off (don't remember instrument)"; commands[kcViewAddPlugin].UID = 1669; - commands[kcViewAddPlugin].Message = "View 'Add Plugin' Window"; + commands[kcViewAddPlugin].Message = "View Plugin Manager"; commands[kcViewAddPlugin].isHidden = false; commands[kcViewAddPlugin].isDummy = false; Modified: trunk/OpenMPT/mptrack/Ctrl_gen.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_gen.cpp 2006-04-11 23:44:36 UTC (rev 156) +++ trunk/OpenMPT/mptrack/Ctrl_gen.cpp 2006-06-20 00:44:57 UTC (rev 157) @@ -134,6 +134,7 @@ if (m_pModDoc) m_pModDoc->SetFollowWnd(m_hWnd, MPTNOTIFY_MASTERVU); if (pMainFrm) pMainFrm->SetFollowSong(m_pModDoc, m_hWnd, TRUE, MPTNOTIFY_MASTERVU); CMainFrame::EnableLowLatencyMode(FALSE); + PostViewMessage(VIEWMSG_SETACTIVE, NULL); SetFocus(); } Modified: trunk/OpenMPT/mptrack/Globals.cpp =================================================================== --- trunk/OpenMPT/mptrack/Globals.cpp 2006-04-11 23:44:36 UTC (rev 156) +++ trunk/OpenMPT/mptrack/Globals.cpp 2006-06-20 00:44:57 UTC (rev 157) @@ -272,6 +272,18 @@ } +void CModControlView::ForceRefresh() +//--------------------------------- +{ + SetActivePage(GetActivePage()); +} + +int CModControlView::GetActivePage() +//----------------------------------- +{ + return m_nActiveDlg; +} + BOOL CModControlView::SetActivePage(int nIndex, LPARAM lParam) //------------------------------------------------------------ { Modified: trunk/OpenMPT/mptrack/Globals.h =================================================================== --- trunk/OpenMPT/mptrack/Globals.h 2006-04-11 23:44:36 UTC (rev 156) +++ trunk/OpenMPT/mptrack/Globals.h 2006-06-20 00:44:57 UTC (rev 157) @@ -143,11 +143,13 @@ void InstrumentChanged(int nInstr=-1) { m_nInstrumentChanged = nInstr; } int GetInstrumentChange() const { return m_nInstrumentChanged; } void SetMDIParentFrame(HWND hwnd) { m_hWndMDI = hwnd; } + void ForceRefresh(); protected: void RecalcLayout(); void UpdateView(DWORD dwHintMask=0, CObject *pHint=NULL); BOOL SetActivePage(int nIndex=-1, LPARAM lParam=-1); + int GetActivePage(); //{{AFX_VIRTUAL(CModControlView) public: Modified: trunk/OpenMPT/mptrack/MainFrm.cpp =================================================================== --- trunk/OpenMPT/mptrack/MainFrm.cpp 2006-04-11 23:44:36 UTC (rev 156) +++ trunk/OpenMPT/mptrack/MainFrm.cpp 2006-06-20 00:44:57 UTC (rev 157) @@ -67,7 +67,7 @@ // -> CODE#0002 // -> DESC="list box to choose VST plugin presets (programs)" - ON_COMMAND(ID_PLUGIN_SETUP, OnPluginSetup) + ON_COMMAND(ID_PLUGIN_SETUP, OnPluginManager) // -! NEW_FEATURE#0002 // -> CODE#0015 @@ -2304,10 +2304,31 @@ // -> CODE#0002 // -> DESC="list box to choose VST plugin presets (programs)" -void CMainFrame::OnPluginSetup() +void CMainFrame::OnPluginManager() { - CSelectPluginDlg dlg(NULL, GetActiveDoc(), this); + int nPlugslot=-1; + CModDoc* pModDoc = GetActiveDoc(); + + if (pModDoc) { + CSoundFile *pSndFile = pModDoc->GetSoundFile(); + //Find empty plugin slot + for (int nPlug=0; nPlug<MAX_MIXPLUGINS; nPlug++) { + PSNDMIXPLUGIN pCandidatePlugin = &pSndFile->m_MixPlugins[nPlug]; + if (pCandidatePlugin->pMixPlugin == NULL) { + nPlugslot=nPlug; + break; + } + } + } + CSelectPluginDlg dlg(GetActiveDoc(), nPlugslot, this); dlg.DoModal(); + if (pModDoc) { + //Refresh views + pModDoc->UpdateAllViews(NULL, HINT_MIXPLUGINS|HINT_MODTYPE); + //Refresh Controls + CChildFrame *pActiveChild = (CChildFrame *)MDIGetActive(); + pActiveChild->ForceRefresh(); + } } // -! NEW_FEATURE#0002 @@ -2696,7 +2717,7 @@ case kcFileOpen: theApp.OnFileOpen(); break; case kcMidiRecord: OnMidiRecord(); break; case kcHelp: CMDIFrameWnd::OnHelp(); break; - case kcViewAddPlugin: OnPluginSetup(); break; + case kcViewAddPlugin: OnPluginManager(); break; case kcViewChannelManager: OnChannelManager(); break; case kcNextDocument: MDINext(); break; case kcPrevDocument: MDIPrev(); break; Modified: trunk/OpenMPT/mptrack/Mainfrm.h =================================================================== --- trunk/OpenMPT/mptrack/Mainfrm.h 2006-04-11 23:44:36 UTC (rev 156) +++ trunk/OpenMPT/mptrack/Mainfrm.h 2006-06-20 00:44:57 UTC (rev 157) @@ -588,7 +588,7 @@ // -> CODE#0002 // -> DESC="list box to choose VST plugin presets (programs)" - afx_msg void OnPluginSetup(); + afx_msg void OnPluginManager(); // -! NEW_FEATURE#0002 // -> CODE#0015 Modified: trunk/OpenMPT/mptrack/Moddoc.cpp =================================================================== --- trunk/OpenMPT/mptrack/Moddoc.cpp 2006-04-11 23:44:36 UTC (rev 156) +++ trunk/OpenMPT/mptrack/Moddoc.cpp 2006-06-20 00:44:57 UTC (rev 157) @@ -46,6 +46,7 @@ ON_COMMAND(ID_INSERT_INSTRUMENT, OnInsertInstrument) ON_COMMAND(ID_CLEANUP_SAMPLES, OnCleanupSamples) ON_COMMAND(ID_CLEANUP_INSTRUMENTS, OnCleanupInstruments) + ON_COMMAND(ID_CLEANUP_PLUGS, OnCleanupPlugs) ON_COMMAND(ID_CLEANUP_PATTERNS, OnCleanupPatterns) ON_COMMAND(ID_CLEANUP_SONG, OnCleanupSong) ON_COMMAND(ID_CLEANUP_REARRANGE, OnRearrangePatterns) @@ -1770,7 +1771,17 @@ ShowLog("Instrument Cleanup", CMainFrame::GetMainFrame()); } +void CModDoc::OnCleanupPlugs() +//---------------------------------- +{ + ClearLog(); + RemoveUnusedPlugs(); + UpdateAllViews(NULL, HINT_MODTYPE); + ShowLog("Plugin Cleanup", CMainFrame::GetMainFrame()); +} + + void CModDoc::OnCleanupPatterns() //------------------------------- { @@ -1788,6 +1799,7 @@ RemoveUnusedPatterns(); RemoveUnusedInstruments(); RemoveUnusedSamples(); + RemoveUnusedPlugs(); UpdateAllViews(NULL, HINT_MODTYPE|HINT_MODSEQUENCE); ShowLog("Song Cleanup", CMainFrame::GetMainFrame()); } Modified: trunk/OpenMPT/mptrack/Moddoc.h =================================================================== --- trunk/OpenMPT/mptrack/Moddoc.h 2006-04-11 23:44:36 UTC (rev 156) +++ trunk/OpenMPT/mptrack/Moddoc.h 2006-06-20 00:44:57 UTC (rev 157) @@ -147,6 +147,7 @@ BOOL ConvertInstrumentsToSamples();; BOOL RemoveUnusedSamples(); BOOL RemoveUnusedInstruments(); + BOOL RemoveUnusedPlugs(); BOOL RemoveUnusedPatterns(BOOL bRemove=TRUE); LONG InsertPattern(LONG nOrd=-1, UINT nRows=64); LONG InsertSample(BOOL bLimit=FALSE); @@ -274,6 +275,7 @@ afx_msg void OnInsertInstrument(); afx_msg void OnCleanupSamples(); afx_msg void OnCleanupInstruments(); + afx_msg void OnCleanupPlugs(); afx_msg void OnCleanupPatterns(); afx_msg void OnCleanupSong(); afx_msg void OnRearrangePatterns(); Modified: trunk/OpenMPT/mptrack/Modedit.cpp =================================================================== --- trunk/OpenMPT/mptrack/Modedit.cpp 2006-04-11 23:44:36 UTC (rev 156) +++ trunk/OpenMPT/mptrack/Modedit.cpp 2006-06-20 00:44:57 UTC (rev 157) @@ -324,7 +324,24 @@ BOOL CModDoc::ChangeNumChannels(UINT nNewChannels) //------------------------------------------------ { - if (nNewChannels == m_SndFile.m_nChannels) return TRUE; + int maxChans; + if (m_SndFile.m_nType&MOD_TYPE_IT) { + maxChans=max_chans_IT; + } else if (m_SndFile.m_nType&MOD_TYPE_XM) { + maxChans=max_chans_XM; + } else if (m_SndFile.m_nType&MOD_TYPE_S3M) { + maxChans=max_chans_S3M; + } else { + maxChans=max_chans_MOD; + } + if (nNewChannels > maxChans) { + CString error; + error.Format("Error: Max number of channels for this type is %d", maxChans); + ::AfxMessageBox(error, MB_OK|MB_ICONEXCLAMATION); + return FALSE; + } + + if (nNewChannels == m_SndFile.m_nChannels) return FALSE; if (nNewChannels < m_SndFile.m_nChannels) { UINT nChnToRemove = 0; @@ -363,7 +380,7 @@ if ((--nFound) == 0) break; } } - if (rem.DoModal() != IDOK) return TRUE; + if (rem.DoModal() != IDOK) return FALSE; // Removing selected channels RemoveChannels(rem.m_bChnMask); } else @@ -379,7 +396,7 @@ { END_CRITICAL(); AddToLog("ERROR: Not enough memory to create new channels!\nPattern Data is corrupted!\n"); - return TRUE; + return FALSE; } for (UINT j=0; j<m_SndFile.PatternSize[i]; j++) { @@ -395,7 +412,7 @@ SetModified(); ClearUndo(); UpdateAllViews(NULL, HINT_MODTYPE); - return FALSE; + return TRUE; } @@ -841,7 +858,83 @@ return FALSE; } +BOOL CModDoc::RemoveUnusedPlugs() +//------------------------------- +{ + BYTE usedmap[MAX_MIXPLUGINS]; + memset(usedmap, false, MAX_MIXPLUGINS); + + for (int nPlug=0; nPlug<MAX_MIXPLUGINS; nPlug++) { + + //Is the plugin assigned to a channel? + for (int nChn=0; nChn<m_SndFile.m_nChannels; nChn++) { + if (m_SndFile.ChnSettings[nChn].nMixPlugin == nPlug+1) { + usedmap[nPlug]=true; + break; + } + } + + //Is the plugin used by an instrument? + for (int nIns=1; nIns<=m_SndFile.m_nInstruments; nIns++) { + if (m_SndFile.Headers[nIns] && (m_SndFile.Headers[nIns]->nMixPlug == nPlug+1)) { + usedmap[nPlug]=true; + break; + } + } + + //Is the plugin assigned to master? + if (m_SndFile.m_MixPlugins[nPlug].Info.dwInputRouting & MIXPLUG_INPUTF_MASTEREFFECT) { + usedmap[nPlug]=true; + } + + //all outputs of used plugins count as used + if (usedmap[nPlug]==true) { + if (m_SndFile.m_MixPlugins[nPlug].Info.dwOutputRouting & 0x80) { + int output = m_SndFile.m_MixPlugins[nPlug].Info.dwOutputRouting & 0x7f; + usedmap[output]=true; + } + } + + } + + //Remove unused plugins + int nRemoved=0; + for (int nPlug=0; nPlug<MAX_MIXPLUGINS; nPlug++) { + SNDMIXPLUGIN* pPlug = &m_SndFile.m_MixPlugins[nPlug]; + if (usedmap[nPlug] || !pPlug) { + Log("Keeping mixplug addess (%d): %X\n", nPlug, &(pPlug->pMixPlugin)); + continue; + } + + if (pPlug->pPluginData) { + delete pPlug->pPluginData; + pPlug->pPluginData = NULL; + } + if (pPlug->pMixPlugin) { + pPlug->pMixPlugin->Release(); + pPlug->pMixPlugin=NULL; + } + if (pPlug->pMixState) { + delete pPlug->pMixState; + } + + memset(&(pPlug->Info), 0, sizeof(SNDMIXPLUGININFO)); + Log("Zeroing range (%d) %X - %X\n", nPlug, &(pPlug->Info), &(pPlug->Info)+sizeof(SNDMIXPLUGININFO)); + pPlug->nPluginDataSize=0; + pPlug->fDryRatio=0; + pPlug->defaultProgram=0; + nRemoved++; + + } + + if (nRemoved) { + SetModified(); + } + + return nRemoved; +} + BOOL CModDoc::RemoveUnusedInstruments() //------------------------------------- { Modified: trunk/OpenMPT/mptrack/View_gen.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_gen.cpp 2006-04-11 23:44:36 UTC (rev 156) +++ trunk/OpenMPT/mptrack/View_gen.cpp 2006-06-20 00:44:57 UTC (rev 157) @@ -1212,8 +1212,7 @@ if ((pModDoc) && (m_nCurrentPlugin < MAX_MIXPLUGINS)) { CSoundFile *pSndFile = pModDoc->GetSoundFile(); - PSNDMIXPLUGIN pPlugin = &pSndFile->m_MixPlugins[m_nCurrentPlugin]; - CSelectPluginDlg dlg(pPlugin, pModDoc, this); //rewbs.plugDocAware + CSelectPluginDlg dlg(pModDoc, m_nCurrentPlugin, this); if (dlg.DoModal() == IDOK) { if (pSndFile->m_nType & (MOD_TYPE_XM|MOD_TYPE_IT)) Modified: trunk/OpenMPT/mptrack/View_pat.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_pat.cpp 2006-04-11 23:44:36 UTC (rev 156) +++ trunk/OpenMPT/mptrack/View_pat.cpp 2006-06-20 00:44:57 UTC (rev 157) @@ -2401,16 +2401,17 @@ BeginWaitCursor(); //First adding channel as the last channel... - pModDoc->ChangeNumChannels(pSndFile->m_nChannels+1); - pSndFile->SetChannelSettingsToDefault(pSndFile->m_nChannels-1); - //...and then moving it to right position. - pSndFile->MoveChannel(pSndFile->m_nChannels-1, nChn); + if (pModDoc->ChangeNumChannels(pSndFile->m_nChannels+1)) { + pSndFile->SetChannelSettingsToDefault(pSndFile->m_nChannels-1); + //...and then moving it to right position. + pSndFile->MoveChannel(pSndFile->m_nChannels-1, nChn); - pModDoc->SetModified(); - pModDoc->ClearUndo(); - pModDoc->UpdateAllViews(NULL, HINT_MODCHANNELS); //refresh channel headers - pModDoc->UpdateAllViews(NULL, HINT_MODTYPE); //updates(?) the channel number to general tab display - SetCurrentPattern(m_nPattern); + pModDoc->SetModified(); + pModDoc->ClearUndo(); + pModDoc->UpdateAllViews(NULL, HINT_MODCHANNELS); //refresh channel headers + pModDoc->UpdateAllViews(NULL, HINT_MODTYPE); //updates(?) the channel number to general tab display + SetCurrentPattern(m_nPattern); + } EndWaitCursor(); } @@ -2424,15 +2425,16 @@ if (pModDoc == 0 || (pSndFile = pModDoc->GetSoundFile()) == 0) return; BeginWaitCursor(); - pModDoc->ChangeNumChannels(pSndFile->m_nChannels+1); - pSndFile->SetChannelSettingsToDefault(pSndFile->m_nChannels-1); - pSndFile->MoveChannel(pSndFile->m_nChannels-1, nChn); + if (pModDoc->ChangeNumChannels(pSndFile->m_nChannels+1)) { + pSndFile->SetChannelSettingsToDefault(pSndFile->m_nChannels-1); + pSndFile->MoveChannel(pSndFile->m_nChannels-1, nChn); - pModDoc->SetModified(); - pModDoc->ClearUndo(); - pModDoc->UpdateAllViews(NULL, HINT_MODCHANNELS); - pModDoc->UpdateAllViews(NULL, HINT_MODTYPE); - SetCurrentPattern(m_nPattern); + pModDoc->SetModified(); + pModDoc->ClearUndo(); + pModDoc->UpdateAllViews(NULL, HINT_MODCHANNELS); + pModDoc->UpdateAllViews(NULL, HINT_MODTYPE); + SetCurrentPattern(m_nPattern); + } EndWaitCursor(); } Modified: trunk/OpenMPT/mptrack/Vstplug.cpp =================================================================== --- trunk/OpenMPT/mptrack/Vstplug.cpp 2006-04-11 23:44:36 UTC (rev 156) +++ trunk/OpenMPT/mptrack/Vstplug.cpp 2006-06-20 00:44:57 UTC (rev 157) @@ -999,11 +999,19 @@ } -CSelectPluginDlg::CSelectPluginDlg(PSNDMIXPLUGIN pPlugin, CModDoc *pModDoc, CWnd *parent):CDialog(IDD_SELECTMIXPLUGIN, parent) +CSelectPluginDlg::CSelectPluginDlg(CModDoc *pModDoc, int nPlugSlot, CWnd *parent):CDialog(IDD_SELECTMIXPLUGIN, parent) //---------------------------------------------------------------------------------------------------------- { - m_pModDoc = pModDoc; //rewbs.plugDocAware - m_pPlugin = pPlugin; + m_pPlugin = NULL; + m_pModDoc = pModDoc; + m_nPlugSlot = nPlugSlot; + + if (m_pModDoc) { + CSoundFile* pSndFile = pModDoc->GetSoundFile(); + if (pSndFile && (0<=m_nPlugSlot && m_nPlugSlot<MAX_MIXPLUGINS)) { + m_pPlugin = &pSndFile->m_MixPlugins[m_nPlugSlot]; + } + } } @@ -1016,6 +1024,15 @@ CDialog::OnInitDialog(); m_treePlugins.ModifyStyle(dwRemove, dwAdd); m_treePlugins.SetImageList(CMainFrame::GetMainFrame()->GetImageList(), TVSIL_NORMAL); + + if (m_pPlugin) { + CString targetSlot; + targetSlot.Format("Put in FX%02d", m_nPlugSlot+1); + SetDlgItemText(IDOK, targetSlot); + ::EnableWindow(::GetDlgItem(m_hWnd, IDOK), TRUE); + } else { + ::EnableWindow(::GetDlgItem(m_hWnd, IDOK), FALSE); + } MoveWindow(CMainFrame::GetMainFrame()->gnPlugWindowX, CMainFrame::GetMainFrame()->gnPlugWindowY, @@ -1065,7 +1082,7 @@ { // -> CODE#0002 // -> DESC="list box to choose VST plugin presets (programs)" - if(m_pPlugin == NULL) { CDialog::OnOK(); return; } + if(m_pPlugin==NULL) { CDialog::OnOK(); return; } // -! NEW_FEATURE#0002 BOOL bChanged = FALSE; @@ -1371,11 +1388,11 @@ if (m_treePlugins) { m_treePlugins.MoveWindow(11,11, cx-105, cy-40, FALSE); - ::MoveWindow(GetDlgItem(IDC_TEXT1)->m_hWnd, 11,cy-25, cx-22, 25, FALSE); - ::MoveWindow(GetDlgItem(IDOK)->m_hWnd, cx-85, 11, 75, 23, FALSE); - ::MoveWindow(GetDlgItem(IDCANCEL)->m_hWnd, cx-85, 39, 75, 23, FALSE); - ::MoveWindow(GetDlgItem(IDC_BUTTON1)->m_hWnd , cx-85, cy-80, 75, 23, FALSE); - ::MoveWindow(GetDlgItem(IDC_BUTTON2)->m_hWnd, cx-85, cy-52, 75, 23, FALSE); + ::MoveWindow(GetDlgItem(IDC_TEXT1)->m_hWnd, 11,cy-25, cx-22, 25, FALSE); + ::MoveWindow(GetDlgItem(IDOK)->m_hWnd, cx-85, 11, 75, 23, FALSE); + ::MoveWindow(GetDlgItem(IDCANCEL)->m_hWnd, cx-85, 39, 75, 23, FALSE); + ::MoveWindow(GetDlgItem(IDC_BUTTON1)->m_hWnd , cx-85, cy-80, 75, 23, FALSE); + ::MoveWindow(GetDlgItem(IDC_BUTTON2)->m_hWnd, cx-85, cy-52, 75, 23, FALSE); Invalidate(); } } @@ -1508,8 +1525,8 @@ } Dispatch(effMainsChanged, 0, 1, NULL, 0.0f); - m_nInputs = (m_pEffect->numInputs < 16) ? m_pEffect->numInputs : 16; - m_nOutputs = (m_pEffect->numOutputs < 16) ? m_pEffect->numOutputs : 16; + m_nInputs = m_pEffect->numInputs; + m_nOutputs = m_pEffect->numOutputs; m_pInputs = (float **)new char[m_nInputs*sizeof(float *)]; m_pOutputs = (float **)new char[m_nOutputs*sizeof(float *)]; m_pTempBuffer = (float **)new char[m_nOutputs*sizeof(float *)]; //rewbs.dryRatio @@ -2052,6 +2069,50 @@ m_pMixStruct->fDryRatio = 1.0-(static_cast<float>(param)/127.0f); } +/* +void CVstPlugin::Process(float **pOutputs, unsigned long nSamples) +//---------------------------------------------------------------- +{ + float wetRatio, dryRatio; + wetRatio *= m_fGain; + dryRatio *= m_fGain; + + ProcessVSTEvents(); + if ((m_pEffect) && (m_pProcessFP) && (m_pInputs) && (m_pOutputs) && (m_pMixStruct)) { + + //Merge stereo input before sending to the plug if the plug can only handle one input. + if (m_pEffect->numInputs == 1) { + for (UINT i=0; i<nSamples; i++) { + m_pInputs[0][i] = 0.5f*m_pInputs[0][i] + 0.5f*m_pInputs[1][i]; + } + } + + //Clear the buffers that will be receiving the plugin's output. + for (UINT iOut=0; iOut<m_nOutputs; iOut++) { + memset(m_pTempBuffer[iOut], 0, nSamples*sizeof(float)); + m_pOutputs[iOut] = m_pTempBuffer[iOut]; + } + + //Do the VST processing magic + m_dwTimeAtStartOfProcess = timeGetTime(); + try { + ASSERT(nSamples<=MIXBUFFERSIZE); + m_pProcessFP(m_pEffect, m_pInputs, m_pOutputs, nSamples); + } catch (char * str) { + m_pMixStruct->Info.dwInputRouting |= MIXPLUG_INPUTF_BYPASS; + CString processMethod = (m_pEffect->flags & effFlagsCanReplacing) ? "processReplacing" : "process"; + CVstPluginManager::ReportPlugException("The plugin %s threw an exception in %s: %s. It has automatically been set to \"Bypass\".", m_pMixStruct->Info.szName, processMethod, str); + ClearVSTEvents(); + SetEvent(processCalled); + } + + for(UINT i=0; i<nSamples; i++) { + pOutL[stream][i] += m_pTempBuffer[stream][i]*wetRatio + m_pInputs[stream%2][i]*dryRatio; + } + + } +} +*/ void CVstPlugin::Process(float *pOutL, float *pOutR, unsigned long nSamples) //-------------------------------------------------------------------------- { @@ -2080,7 +2141,7 @@ //RecalculateGain(); - //Merge stereo before sending to the plug if it is mono + //Merge stereo input before sending to the plug if the plug can only handle one input. if (m_pEffect->numInputs == 1) { for (UINT i=0; i<nSamples; i++) { Modified: trunk/OpenMPT/mptrack/Vstplug.h =================================================================== --- trunk/OpenMPT/mptrack/Vstplug.h 2006-04-11 23:44:36 UTC (rev 156) +++ trunk/OpenMPT/mptrack/Vstplug.h 2006-06-20 00:44:57 UTC (rev 157) @@ -228,12 +228,13 @@ //==================================== { protected: + int m_nPlugSlot; PSNDMIXPLUGIN m_pPlugin; CModDoc *m_pModDoc; CTreeCtrl m_treePlugins; public: - CSelectPluginDlg(PSNDMIXPLUGIN, CModDoc *pModDoc, CWnd *parent); //rewbs.plugDocAware + CSelectPluginDlg(CModDoc *pModDoc, int nPlugSlot, CWnd *parent); //rewbs.plugDocAware VOID DoClose(); VOID UpdatePluginsList(DWORD forceSelect=0); bool VerifyPlug(PVSTPLUGINLIB plug); Modified: trunk/OpenMPT/mptrack/bin/mptrack_Generic.exe =================================================================== (Binary files differ) Modified: trunk/OpenMPT/mptrack/bin/mptrack_P3.exe =================================================================== (Binary files differ) Modified: trunk/OpenMPT/mptrack/bin/mptrack_P4-Athlon64.exe =================================================================== (Binary files differ) Modified: trunk/OpenMPT/mptrack/bin/mptrack_athlon32.exe =================================================================== (Binary files differ) Modified: trunk/OpenMPT/mptrack/bin/version =================================================================== --- trunk/OpenMPT/mptrack/bin/version 2006-04-11 23:44:36 UTC (rev 156) +++ trunk/OpenMPT/mptrack/bin/version 2006-06-20 00:44:57 UTC (rev 157) @@ -1 +1 @@ -1.17.02.42 \ No newline at end of file +1.17.02.43 \ No newline at end of file Modified: trunk/OpenMPT/mptrack/dlg_misc.cpp =================================================================== --- trunk/OpenMPT/mptrack/dlg_misc.cpp 2006-04-11 23:44:36 UTC (rev 156) +++ trunk/OpenMPT/mptrack/dlg_misc.cpp 2006-06-20 00:44:57 UTC (rev 157) @@ -381,6 +381,25 @@ return FALSE; } + int sel = m_ChannelsBox.GetItemData(m_ChannelsBox.GetCurSel()); + int type = m_TypeBox.GetItemData(m_TypeBox.GetCurSel()); + int maxChans; + if (type&MOD_TYPE_IT) { + maxChans=max_chans_IT; + } else if (type&MOD_TYPE_XM) { + maxChans=max_chans_XM; + } else if (type&MOD_TYPE_S3M) { + maxChans=max_chans_S3M; + } else { + maxChans=max_chans_MOD; + } + if (sel > maxChans) { + CString error; + error.Format("Error: Max number of channels for this type is %d", maxChans); + ::AfxMessageBox(error, MB_OK|MB_ICONEXCLAMATION); + return FALSE; + } + return TRUE; } Modified: trunk/OpenMPT/mptrack/mptrack.rc =================================================================== --- trunk/OpenMPT/mptrack/mptrack.rc 2006-04-11 23:44:36 UTC (rev 156) +++ trunk/OpenMPT/mptrack/mptrack.rc 2006-06-20 00:44:57 UTC (rev 157) @@ -145,6 +145,7 @@ MENUITEM "Cleanup S&ong", ID_CLEANUP_SONG MENUITEM "Remove &All Instruments", ID_INSTRUMENTS_REMOVEALL MENUITEM "Rearrange Samples", ID_REARRANGE_SAMPLES + MENUITEM "Cleanup &Plugins", ID_CLEANUP_PLUGS END MENUITEM SEPARATOR MENUITEM "&Find\tCtrl+F", ID_EDIT_FIND @@ -1588,11 +1589,11 @@ CAPTION "Mix Plugins" FONT 8, "MS Sans Serif", 0, 0, 0x1 BEGIN - DEFPUSHBUTTON "OK",IDOK,161,7,50,14 - PUSHBUTTON "Cancel",IDCANCEL,161,24,50,14 + DEFPUSHBUTTON "Add to Song",IDOK,161,7,50,14 + PUSHBUTTON "Cancel",IDCANCEL,161,132,50,14 LTEXT "",IDC_TEXT1,7,151,204,8 - PUSHBUTTON "Add Plugin...",IDC_BUTTON1,161,115,50,14 - PUSHBUTTON "Remove",IDC_BUTTON2,161,132,50,14 + PUSHBUTTON "New plugin...",IDC_BUTTON1,161,46,50,14,BS_MULTILINE + PUSHBUTTON "Remove",IDC_BUTTON2,161,63,50,14 CONTROL "Tree1",IDC_TREE1,"SysTreeView32",TVS_DISABLEDRAGDROP | TVS_SHOWSELALWAYS | WS_TABSTOP,7,7,148,140, WS_EX_CLIENTEDGE @@ -1893,7 +1894,7 @@ // VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,17,2,42 + FILEVERSION 1,17,2,43 PRODUCTVERSION 0,0,0,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG @@ -1911,7 +1912,7 @@ BEGIN VALUE "CompanyName", "Olivier Lapicque / OpenMPT team" VALUE "FileDescription", "OpenMPT / ModPlug Tracker" - VALUE "FileVersion", "1, 17, 2, 42" + VALUE "FileVersion", "1, 17, 2, 43" VALUE "InternalName", "Modplug Tracker" VALUE "LegalCopyright", "Copyright \xA91997-2003 Olivier Lapicque; \xA92004-2005 GPL." VALUE "LegalTrademarks", "M.O.D.P.L.U.G" Modified: trunk/OpenMPT/mptrack/mptrack.vcproj =================================================================== --- trunk/OpenMPT/mptrack/mptrack.vcproj 2006-04-11 23:44:36 UTC (rev 156) +++ trunk/OpenMPT/mptrack/mptrack.vcproj 2006-06-20 00:44:57 UTC (rev 157) @@ -807,6 +807,70 @@ </Filter> </Filter> <Filter + Name="Resource Files" + Filter="ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe"> + <File + RelativePath="res\bitmap1.bmp"> + </File> + <File + RelativePath=".\res\colors.bmp"> + </File> + <File + RelativePath=".\res\dragging.cur"> + </File> + <File + RelativePath=".\Res\envbar.bmp"> + </File> + <File + RelativePath=".\res\img_list.bmp"> + </File> + <File + RelativePath=".\res\mainbar.bmp"> + </File> + <File + RelativePath=".\res\moddoc.ico"> + </File> + <File + RelativePath=".\res\modplthingmorecontrast.bmp"> + </File> + <File + RelativePath=".\res\MPTRACK.bmp"> + </File> + <File + RelativePath=".\res\mptrack.ico"> + </File> + <File + RelativePath=".\res\mptrack.rc2"> + </File> + <File + RelativePath=".\Res\nodrag.cur"> + </File> + <File + RelativePath=".\res\nodrop.cur"> + </File> + <File + RelativePath=".\res\patterns.bmp"> + </File> + <File + RelativePath=".\res\rt_manif.bin"> + </File> + <File + RelativePath=".\Res\smptoolb.bmp"> + </File> + <File + RelativePath=".\Res\splash.bmp"> + </File> + <File + RelativePath=".\res\splashno.bmp"> + </File> + <File + RelativePath=".\res\view_pat.bmp"> + </File> + <File + RelativePath=".\res\vumeters.bmp"> + </File> + </Filter> + <Filter Name="Header Files" Filter="h;hpp;hxx;hm;inl"> <File @@ -966,70 +1030,6 @@ RelativePath="..\soundlib\WindowedFIR.h"> </File> </Filter> - <Filter - Name="Resource Files" - Filter="ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe"> - <File - RelativePath="res\bitmap1.bmp"> - </File> - <File - RelativePath=".\res\colors.bmp"> - </File> - <File - RelativePath=".\res\dragging.cur"> - </File> - <File - RelativePath=".\Res\envbar.bmp"> - </File> - <File - RelativePath=".\res\img_list.bmp"> - </File> - <File - RelativePath=".\res\mainbar.bmp"> - </File> - <File - RelativePath=".\res\moddoc.ico"> - </File> - <File - RelativePath=".\res\modplthingmorecontrast.bmp"> - </File> - <File - RelativePath=".\res\MPTRACK.bmp"> - </File> - <File - RelativePath=".\res\mptrack.ico"> - </File> - <File - RelativePath=".\res\mptrack.rc2"> - </File> - <File - RelativePath=".\Res\nodrag.cur"> - </File> - <File - RelativePath=".\res\nodrop.cur"> - </File> - <File - RelativePath=".\res\patterns.bmp"> - </File> - <File - RelativePath=".\res\rt_manif.bin"> - </File> - <File - RelativePath=".\Res\smptoolb.bmp"> - </File> - <File - RelativePath=".\Res\splash.bmp"> - </File> - <File - RelativePath=".\res\splashno.bmp"> - </File> - <File - RelativePath=".\res\view_pat.bmp"> - </File> - <File - RelativePath=".\res\vumeters.bmp"> - </File> - </Filter> <File RelativePath=".\mptrack.reg"> </File> Modified: trunk/OpenMPT/mptrack/resource.h =================================================================== --- trunk/OpenMPT/mptrack/resource.h 2006-04-11 23:44:36 UTC (rev 156) +++ trunk/OpenMPT/mptrack/resource.h 2006-06-20 00:44:57 UTC (rev 157) @@ -942,6 +942,7 @@ #define ID_PATTERN_REMOVECHANNELDIALOG 59151 #define ID_Menu 59200 #define ID_FILE_SAVECOMPAT 59202 +#define ID_CLEANUP_PLUGS 59205 // Next default values for new objects // @@ -949,8 +950,8 @@ #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_3D_CONTROLS 1 #define _APS_NEXT_RESOURCE_VALUE 510 -#define _APS_NEXT_COMMAND_VALUE 59203 -#define _APS_NEXT_CONTROL_VALUE 2255 +#define _APS_NEXT_COMMAND_VALUE 59206 +#define _APS_NEXT_CONTROL_VALUE 2256 #define _APS_NEXT_SYMED_VALUE 901 #endif #endif Modified: trunk/OpenMPT/packageTemplate/History.txt =================================================================== --- trunk/OpenMPT/packageTemplate/History.txt 2006-04-11 23:44:36 UTC (rev 156) +++ trunk/OpenMPT/packageTemplate/History.txt 2006-06-20 00:44:57 UTC (rev 157) @@ -8,6 +8,14 @@ ?: other (tx XYZ): thanks to XYZ for telling me about the bug +. v1.17.02.43 + + <rewbs> You can now load up new plugins from anywhere, not just the General tab. Select "Plugin Manager..." from the view menu. This can also be assigned to a global hotkey. + Limitation: currently plugins added to a song in this manner with always be put in the first empty slot. In a future version you'll be able to choose the slot directly from that window. + + <rewbs> "Cleanup Plugins" to remove any plugs that are not associated to a channel and not used by an instrument and not used as an output for any used plugs. + . <rewbs> Fixed channel limits. Should be able to correctly save IT pattern data with up to 127 chans. There's only space for 64 channel headers though (channel names etc..). XMs restricted to 64 chans. + . <rewbs> Added channel limit check when adding chans from the pattern editor. + . <rewbs> Fixed instant crash with SampleTank 2.1. + . v1.17.02.42 + <rewbs> "Compatibility export" in file menu: save as 'plain' IT, without all of OpenMPT's crap. IT only for now (not XM). . <rewbs> Set instrument in pattern editor should work when no note is specified (tx Torvus - http://lpchip.com/modplug/viewtopic.php?t=470) @@ -22,6 +30,7 @@ . <rewbs> Fixed the following settings that were not saving correctly: mod document window status, row spacing, channel VU meters, channel effect visibility, Most recent files list, Toolbar settings. . <rewbs> Process priority no longer defaults to high. + . v 1.17.02.40 + <Relabsoluness> Added indicator of currently playing pattern to orderlist. + <Relabsoluness> 'Loop pattern' and 'follow song' keys should now work when orderlist has focus. Modified: trunk/OpenMPT/packageTemplate/extraKeymaps/UK_mpt_it2_hybrid_(rewbs).mkb =================================================================== --- trunk/OpenMPT/packageTemplate/extraKeymaps/UK_mpt_it2_hybrid_(rewbs).mkb 2006-04-11 23:44:36 UTC (rev 156) +++ trunk/OpenMPT/packageTemplate/extraKeymaps/UK_mpt_it2_hybrid_(rewbs).mkb 2006-06-20 00:44:57 UTC (rev 157) @@ -280,3 +280,5 @@ //----( Instrument Context [top] (17) )------------ //----( Comments Context [top] (18) )------------ + +//----( Unknown Context (19) )------------ Modified: trunk/OpenMPT/soundlib/Fastmix.cpp =================================================================== --- trunk/OpenMPT/soundlib/Fastmix.cpp 2006-04-11 23:44:36 UTC (rev 156) +++ trunk/OpenMPT/soundlib/Fastmix.cpp 2006-06-20 00:44:57 UTC (rev 157) @@ -1847,6 +1847,19 @@ } } + /* + if (pPlugin->multiRouting) { + int nOutput=0; + for (int nOutput=0; nOutput<pPlugin->nOutputs/2; nOutput++) { + destinationPlug = pPlugin->multiRoutingDestinations[nOutput]; + pOutState = m_MixPlugins[destinationPlug].pMixState; + pOutputs[2*nOutput] = pOutState->pOutBufferL; + pOutputs[2*(nOutput+1)] = pOutState->pOutBufferR; + } + + } +*/ + if (pPlugin->Info.dwInputRouting & MIXPLUG_INPUTF_MASTEREFFECT) { if (!bMasterMix) Modified: trunk/OpenMPT/soundlib/Load_it.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_it.cpp 2006-04-11 23:44:36 UTC (rev 156) +++ trunk/OpenMPT/soundlib/Load_it.cpp 2006-06-20 00:44:57 UTC (rev 157) @@ -665,11 +665,7 @@ m_nSongPreAmp=100; } // Reading Channels Pan Positions -// -> CODE#0006 -// -> DESC="misc quantity changes" -// for (int ipan=0; ipan<64; ipan++) if (pifh->chnpan[ipan] != 0xFF) - for (int ipan=0; ipan<MAX_BASECHANNELS; ipan++) if (pifh->chnpan[ipan] != 0xFF) -// -! BEHAVIOUR_CHANGE#0006 + for (int ipan=0; ipan</*MAX_BASECHANNELS*/64; ipan++) if (pifh->chnpan[ipan] != 0xFF) //Header only has room for settings for 64 chans... { ChnSettings[ipan].nVolume = pifh->chnvol[ipan]; ChnSettings[ipan].nPan = 128; @@ -814,7 +810,8 @@ UINT ch = b & IT_bitmask_patternChanField_c; // 0x7f We have some data grab a byte keeping only 127 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 64 bits + if (b & IT_bitmask_patternChanEnabled_c) // 0x80 check if the upper bit is enabled. { if (i >= len) @@ -1056,9 +1053,9 @@ } UINT ch = b & IT_bitmask_patternChanField_c; // 0x7f - + if (ch) - ch = (ch - 1) & IT_bitmask_patternChanMask_c; // 0x3f + ch = (ch - 1); //& IT_bitmask_patternChanMask_c; // 0x3f if (b & IT_bitmask_patternChanEnabled_c) // 0x80 { @@ -1493,17 +1490,22 @@ // Channel Pan and Volume memset(header.chnpan, 0xFF, 64); memset(header.chnvol, 64, 64); - for (UINT ich=0; ich<m_nChannels; ich++) + for (UINT ich=0; ich</*m_nChannels*/64; ich++) //Header only has room for settings for 64 chans... { header.chnpan[ich] = ChnSettings[ich].nPan >> 2; if (ChnSettings[ich].dwFlags & CHN_SURROUND) header.chnpan[ich] = 100; header.chnvol[ich] = ChnSettings[ich].nVolume; if (ChnSettings[ich].dwFlags & CHN_MUTE) header.chnpan[ich] |= 0x80; + } + + for (UINT ich=0; ich<m_nChannels; ich++) + { if (ChnSettings[ich].szName[0]) { dwChnNamLen = (ich+1) * MAX_CHANNELNAME; } } + if (dwChnNamLen) dwExtra += dwChnNamLen + 8; #ifdef SAVEITTIMESTAMP dwExtra += 8; // Time Stamp @@ -2067,7 +2069,7 @@ // Channel Pan and Volume memset(header.chnpan, 0xFF, 64); memset(header.chnvol, 64, 64); - for (UINT ich=0; ich<nChannels; ich++) + for (UINT ich=0; ich</*m_nChannels*/64; ich++) //Header only has room for settings for 64 chans... { header.chnpan[ich] = ChnSettings[ich].nPan >> 2; if (ChnSettings[ich].dwFlags & CHN_SURROUND) header.chnpan[ich] = 100; Modified: trunk/OpenMPT/soundlib/Load_mod.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_mod.cpp 2006-04-11 23:44:36 UTC (rev 156) +++ trunk/OpenMPT/soundlib/Load_mod.cpp 2006-06-20 00:44:57 UTC (rev 157) @@ -482,7 +482,7 @@ } } //end for all rows } else { - memset(s, 0, m_nChannels*4); //if patten does not exist + memset(s, 0, m_nChannels*4); //if pattern does not exist for (UINT i=0; i<64; i++) { //invent blank pattern fwrite(s, m_nChannels, 4, f); } Modified: trunk/OpenMPT/soundlib/Sndfile.h =================================================================== --- trunk/OpenMPT/soundlib/Sndfile.h 2006-04-11 23:44:36 UTC (rev 156) +++ trunk/OpenMPT/soundlib/Sndfile.h 2006-06-20 00:44:57 UTC (rev 157) @@ -34,21 +34,21 @@ // -> DESC="misc quantity changes" #define MAX_INSTRUMENTS 256 //200 // -! BEHAVIOUR_CHANGE#0006 -#ifdef FASTSOUNDLIB -#define MAX_CHANNELS 80 -#else +//#ifdef FASTSOUNDLIB +//#define MAX_CHANNELS 80 +//#else // -> CODE#0006 // -> DESC="misc quantity changes" #define MAX_CHANNELS 256 //200 // -! BEHAVIOUR_CHANGE#0006 -#endif +//#endif // -> CODE#0006 // -> DESC="misc quantity changes" -#ifdef FASTSOUNDLIB -#define MAX_BASECHANNELS 64 -#else -#define MAX_BASECHANNELS 128 // Let 128 channels between MAX_BASECHANNELS & MAX_CHANNELS -#endif +//#ifdef FASTSOUNDLIB +//#define MAX_BASECHANNELS 64 +//#else +#define MAX_BASECHANNELS 127 +//#endif // -! BEHAVIOUR_CHANGE#0006 #define MAX_ENVPOINTS 32 #define MIN_PERIOD 0x0020 @@ -770,7 +770,15 @@ MIDIOUT_PROGRAM, }; +enum { + max_chans_IT=127, + max_chans_XM=64, + max_chans_MOD=32, + max_chans_S3M=32, +}; + + typedef struct MODMIDICFG { CHAR szMidiGlb[9*32]; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <re...@us...> - 2006-04-11 23:46:56
|
Revision: 156 Author: rewbs Date: 2006-04-11 16:44:36 -0700 (Tue, 11 Apr 2006) ViewCVS: http://svn.sourceforge.net/modplug/?rev=156&view=rev Log Message: ----------- . v1.17.02.42 + <rewbs> "Compatibility export" in file menu: save as 'plain' IT, without all of OpenMPT's crap. IT only for now (not XM). . <rewbs> Set instrument in pattern editor should work when no note is specified (tx Torvus - http://lpchip.com/modplug/viewtopic.php?t=470) . <rewbs> Restart position saved in IT (tx LPChip - http://lpchip.com/modplug/viewtopic.php?t=473) . <rewbs> Loop song now works even if restart pos falls on +++ (tx LPChip - http://lpchip.com/modplug/viewtopic.php?t=463) . <rewbs> Last used tempo is applied even when playback is triggered from instrument panel. (tx LPChip - http://lpchip.com/modplug/viewtopic.php?t=480) / <rewbs> User now gets a warning when loading MDA Degrade (tx fisk0 - http://lpchip.com/modplug/viewtopic.php?t=467) Modified Paths: -------------- trunk/OpenMPT/mptrack/CommandSet.cpp trunk/OpenMPT/mptrack/CommandSet.h trunk/OpenMPT/mptrack/InputHandler.cpp trunk/OpenMPT/mptrack/MainFrm.cpp trunk/OpenMPT/mptrack/Moddoc.cpp trunk/OpenMPT/mptrack/Moddoc.h trunk/OpenMPT/mptrack/View_pat.cpp trunk/OpenMPT/mptrack/Vstplug.cpp trunk/OpenMPT/mptrack/bin/mptrack_Generic.exe trunk/OpenMPT/mptrack/bin/mptrack_P3.exe trunk/OpenMPT/mptrack/bin/mptrack_P4-Athlon64.exe trunk/OpenMPT/mptrack/bin/mptrack_athlon32.exe trunk/OpenMPT/mptrack/bin/version trunk/OpenMPT/mptrack/mptrack.rc trunk/OpenMPT/mptrack/resource.h trunk/OpenMPT/packageTemplate/History.txt trunk/OpenMPT/soundlib/Load_it.cpp trunk/OpenMPT/soundlib/Load_xm.cpp trunk/OpenMPT/soundlib/Sndfile.cpp trunk/OpenMPT/soundlib/Sndfile.h trunk/OpenMPT/soundlib/Sndmix.cpp Removed Paths: ------------- trunk/OpenMPT/mptrack/bin/testSvnCommitList trunk/OpenMPT/mptrack/bin/testSvnCommitList2 Modified: trunk/OpenMPT/mptrack/CommandSet.cpp =================================================================== --- trunk/OpenMPT/mptrack/CommandSet.cpp 2006-03-23 01:46:21 UTC (rev 155) +++ trunk/OpenMPT/mptrack/CommandSet.cpp 2006-04-11 23:44:36 UTC (rev 156) @@ -2253,13 +2253,11 @@ commands[kcChangeLoopStatus].isDummy = false; commands[kcChangeLoopStatus].Message = "Toggle loop pattern"; + commands[kcFileExportCompat].UID = 1777; + commands[kcFileExportCompat].Message = "File/Export to standard IT/XM"; + commands[kcFileExportCompat].isHidden = false; + commands[kcFileExportCompat].isDummy = false; -/* commands[kcToggleLoopSong].UID = 1777; - commands[kcToggleLoopSong].isHidden = false; - commands[kcToggleLoopSong].isDummy = false; - commands[kcToggleLoopSong].Message = "Toggle loop song"; -*/ - #ifdef _DEBUG for (int i=0; i<kcNumCommands; i++) { if (commands[i].UID != 0) { // ignore unset UIDs Modified: trunk/OpenMPT/mptrack/CommandSet.h =================================================================== --- trunk/OpenMPT/mptrack/CommandSet.h 2006-03-23 01:46:21 UTC (rev 155) +++ trunk/OpenMPT/mptrack/CommandSet.h 2006-04-11 23:44:36 UTC (rev 156) @@ -57,6 +57,7 @@ kcFileSaveAsWave, kcFileSaveAsMP3, kcFileSaveMidi, + kcFileExportCompat, kcPrevDocument, kcNextDocument, kcFileImportMidiLib, Modified: trunk/OpenMPT/mptrack/InputHandler.cpp =================================================================== --- trunk/OpenMPT/mptrack/InputHandler.cpp 2006-03-23 01:46:21 UTC (rev 155) +++ trunk/OpenMPT/mptrack/InputHandler.cpp 2006-04-11 23:44:36 UTC (rev 156) @@ -330,6 +330,7 @@ case ID_FILE_SAVEASWAVE: s="Save as Wave...\t"; c=kcFileSaveAsWave; break; case ID_FILE_SAVEASMP3: s="Save as MP3...\t"; c=kcFileSaveAsMP3; break; case ID_FILE_SAVEMIDI: s="Export as Midi...\t"; c=kcFileSaveMidi; break; + case ID_FILE_SAVECOMPAT: s="Compatibility Export...\t"; c=kcFileExportCompat; break; case ID_IMPORT_MIDILIB: s="Import Midi Library...\t"; c=kcFileImportMidiLib; break; case ID_ADD_SOUNDBANK: s="Add Sound Bank...\t"; c=kcFileAddSoundBank; break; @@ -390,6 +391,7 @@ pMenu->ModifyMenu(ID_FILE_SAVEASWAVE, MF_BYCOMMAND | MF_STRING, ID_FILE_SAVEASWAVE, GetMenuText(ID_FILE_SAVEASWAVE)); pMenu->ModifyMenu(ID_FILE_SAVEASMP3, MF_BYCOMMAND | MF_STRING, ID_FILE_SAVEASMP3, GetMenuText(ID_FILE_SAVEASMP3)); pMenu->ModifyMenu(ID_FILE_SAVEMIDI, MF_BYCOMMAND | MF_STRING, ID_FILE_SAVEMIDI, GetMenuText(ID_FILE_SAVEMIDI)); + pMenu->ModifyMenu(ID_FILE_SAVECOMPAT, MF_BYCOMMAND | MF_STRING, ID_FILE_SAVECOMPAT, GetMenuText(ID_FILE_SAVECOMPAT)); pMenu->ModifyMenu(ID_IMPORT_MIDILIB, MF_BYCOMMAND | MF_STRING, ID_IMPORT_MIDILIB, GetMenuText(ID_IMPORT_MIDILIB)); pMenu->ModifyMenu(ID_ADD_SOUNDBANK, MF_BYCOMMAND | MF_STRING, ID_ADD_SOUNDBANK, GetMenuText(ID_ADD_SOUNDBANK)); Modified: trunk/OpenMPT/mptrack/MainFrm.cpp =================================================================== --- trunk/OpenMPT/mptrack/MainFrm.cpp 2006-03-23 01:46:21 UTC (rev 155) +++ trunk/OpenMPT/mptrack/MainFrm.cpp 2006-04-11 23:44:36 UTC (rev 156) @@ -2707,6 +2707,7 @@ case kcFileSaveAs: case kcFileSaveAsWave: case kcFileSaveMidi: + case kcFileExportCompat: case kcFileClose: case kcFileSave: case kcViewGeneral: Modified: trunk/OpenMPT/mptrack/Moddoc.cpp =================================================================== --- trunk/OpenMPT/mptrack/Moddoc.cpp 2006-03-23 01:46:21 UTC (rev 155) +++ trunk/OpenMPT/mptrack/Moddoc.cpp 2006-04-11 23:44:36 UTC (rev 156) @@ -30,6 +30,7 @@ ON_COMMAND(ID_FILE_SAVEASWAVE, OnFileWaveConvert) ON_COMMAND(ID_FILE_SAVEASMP3, OnFileMP3Convert) ON_COMMAND(ID_FILE_SAVEMIDI, OnFileMidiConvert) + ON_COMMAND(ID_FILE_SAVECOMPAT, OnFileCompatibilitySave) ON_COMMAND(ID_PLAYER_PLAY, OnPlayerPlay) ON_COMMAND(ID_PLAYER_PAUSE, OnPlayerPause) ON_COMMAND(ID_PLAYER_STOP, OnPlayerStop) @@ -386,11 +387,7 @@ case MOD_TYPE_MOD: bOk = m_SndFile.SaveMod(lpszPathName, dwPacking); break; case MOD_TYPE_S3M: bOk = m_SndFile.SaveS3M(lpszPathName, dwPacking); break; case MOD_TYPE_XM: bOk = m_SndFile.SaveXM(lpszPathName, dwPacking); break; -// -> CODE#0023 -// -> DESC="IT project files (.itp)" -// case MOD_TYPE_IT: bOk = m_SndFile.SaveIT(lpszPathName, dwPacking); break; case MOD_TYPE_IT: bOk = (m_SndFile.m_dwSongFlags & SONG_ITPROJECT || !lstrcmpi(fext, ".itp")) ? m_SndFile.SaveITProject(lpszPathName) : m_SndFile.SaveIT(lpszPathName, dwPacking); break; -// -! NEW_FEATURE#0023 } EndWaitCursor(); if (bOk) @@ -398,12 +395,8 @@ if (nType == m_SndFile.m_nType) SetPathName(lpszPathName); } else { -// -> CODE#0023 -// -> DESC="IT project files (.itp)" -// ErrorBox(IDS_ERR_SAVESONG, CMainFrame::GetMainFrame()); if(nType == MOD_TYPE_IT && m_SndFile.m_dwSongFlags & SONG_ITPROJECT) ::MessageBox(NULL,"ITP projects need to have a path set for each instrument...",NULL,MB_ICONERROR | MB_OK); else ErrorBox(IDS_ERR_SAVESONG, CMainFrame::GetMainFrame()); -// -! NEW_FEATURE#0023 } return bOk; } @@ -1499,7 +1492,7 @@ void CModDoc::OnFileMidiConvert() -//------------------------------- +//------------------------------------- { CHAR path[_MAX_PATH]="", drive[_MAX_DRIVE]=""; CHAR s[_MAX_PATH], fname[_MAX_FNAME]=""; @@ -1527,7 +1520,60 @@ } } +//HACK: This is a quick fix. Needs to be better integrated into player and GUI. +void CModDoc::OnFileCompatibilitySave() +//------------------------------- +{ + CHAR path[_MAX_PATH]="", drive[_MAX_DRIVE]=""; + CHAR s[_MAX_PATH], fname[_MAX_FNAME]=""; + CMainFrame *pMainFrm = CMainFrame::GetMainFrame(); + CString ext, pattern; + + UINT type = m_SndFile.GetType(); + if ((!pMainFrm) || (!m_SndFile.GetType())) return; + switch (type) { + /*case MOD_TYPE_XM: + ext = "xm"; + pattern = "Fast Tracker Files (*.xm)|*.xm||"; + break;*/ + case MOD_TYPE_IT: + ext = "it"; + pattern = "Impulse Tracker Files (*.it)|*.it||"; + break; + default: + ::MessageBox(NULL,"Compatibility export is currently only available the IT format.", "Can't do compatibility export.",MB_ICONINFORMATION | MB_OK); + return; + } + + ::MessageBox(NULL,"Warning: the exported file will not contain any of MPT's file-format hacks.", "Compatibility export warning.",MB_ICONINFORMATION | MB_OK); + _splitpath(GetPathName(), drive, path, fname, NULL); + strcpy(s, drive); + strcat(s, path); + strcat(s, fname); + if (!strstr(fname, "compat")) { + strcat(s, ".compat."); + } else { + strcat(s, "."); + } + strcat(s, ext); + CFileDialog dlg(FALSE, ext, s, + OFN_HIDEREADONLY | OFN_ENABLESIZING | OFN_OVERWRITEPROMPT | OFN_PATHMUSTEXIST | OFN_NOREADONLYRETURN, + pattern, pMainFrm); + if (dlg.DoModal() != IDOK){ + return; + } + switch (type) { + case MOD_TYPE_XM: + m_SndFile.SaveCompatXM(dlg.GetPathName()); + break; + case MOD_TYPE_IT: + m_SndFile.SaveCompatIT(dlg.GetPathName()); + break; + } +} + + void CModDoc::OnPlayerPlay() //-------------------------- { @@ -2871,6 +2917,7 @@ case kcFileSaveAsWave: OnFileWaveConvert(); break; case kcFileSaveAsMP3: OnFileMP3Convert(); break; case kcFileSaveMidi: OnFileMidiConvert(); break; + case kcFileExportCompat: OnFileCompatibilitySave(); break; case kcEstimateSongLength: OnEstimateSongLength(); break; case kcApproxRealBPM: OnApproximateBPM(); break; case kcFileSave: DoSave(m_strPathName, 0); break; Modified: trunk/OpenMPT/mptrack/Moddoc.h =================================================================== --- trunk/OpenMPT/mptrack/Moddoc.h 2006-03-23 01:46:21 UTC (rev 155) +++ trunk/OpenMPT/mptrack/Moddoc.h 2006-04-11 23:44:36 UTC (rev 156) @@ -258,6 +258,7 @@ afx_msg void OnFileWaveConvert(); afx_msg void OnFileMP3Convert(); afx_msg void OnFileMidiConvert(); + afx_msg void OnFileCompatibilitySave(); afx_msg void OnPlayerPlay(); afx_msg void OnPlayerStop(); afx_msg void OnPlayerPause(); Modified: trunk/OpenMPT/mptrack/View_pat.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_pat.cpp 2006-03-23 01:46:21 UTC (rev 155) +++ trunk/OpenMPT/mptrack/View_pat.cpp 2006-04-11 23:44:36 UTC (rev 156) @@ -2315,7 +2315,7 @@ { CModDoc *pModDoc; CSoundFile *pSndFile; - UINT nIns = GetCurrentInstrument(); + BYTE nIns = static_cast<BYTE>(GetCurrentInstrument()); MODCOMMAND *p; BOOL bModified; @@ -2334,14 +2334,15 @@ UINT startChan = GetSelectionStartChan(); UINT endChan = GetSelectionEndChan(); - for (UINT r=startRow; r<endRow+1; r++) - { - for (UINT c=startChan; c<endChan+1; c++) - { + for (UINT r=startRow; r<endRow+1; r++) { + for (UINT c=startChan; c<endChan+1; c++) { + p = pSndFile->Patterns[m_nPattern] + r * pSndFile->m_nChannels + c; - if (p->note && p->instr != (BYTE)nIns) - { - p->instr = (BYTE)nIns; + + // If a note or an instr is present on the row, do the change, if required. + // Do not set instr if note and instr are both blank. + if ( (p->note||p->instr) && (p->instr!=nIns) ) { + p->instr = nIns; bModified = TRUE; } } Modified: trunk/OpenMPT/mptrack/Vstplug.cpp =================================================================== --- trunk/OpenMPT/mptrack/Vstplug.cpp 2006-03-23 01:46:21 UTC (rev 155) +++ trunk/OpenMPT/mptrack/Vstplug.cpp 2006-04-11 23:44:36 UTC (rev 156) @@ -1040,7 +1040,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', '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. *"}, }; bool CSelectPluginDlg::VerifyPlug(PVSTPLUGINLIB plug) @@ -1048,10 +1049,10 @@ CString s; for (int p=0; p<NUM_PROBLEMPLUGS; p++) { - if ( (gProblemPlugs[p].id2 == plug->dwPluginId2) && gProblemPlugs[p].id2 + if ( (gProblemPlugs[p].id2 == plug->dwPluginId2) /*&& (gProblemPlugs[p].id1 == plug->dwPluginId1)*/) { - s.Format("WARNING: This plugin has been identified as %s,\r\n which is known to have the following problem with MPT:\r\n\r\n%s\r\n\r\n(see here for more information: http://www.modplug.com/forum/viewtopic.php?p=36930#36930)\r\n\r\nDo you want to continue to load?", gProblemPlugs[p].name, gProblemPlugs[p].problem); + s.Format("WARNING: This plugin has been identified as %s,\r\nwhich is known to have the following problem with OpenMPT:\r\n\r\n%s\r\n\r\nWould you like to continue to load this plugin?", gProblemPlugs[p].name, gProblemPlugs[p].problem); return (AfxMessageBox(s, MB_YESNO) == IDYES); } } @@ -2564,6 +2565,7 @@ pCh->uNoteOnMap[i][trackChannel]=0; MidiSend(dwMidiCode|(i<<8)); } + } // All "active" notes off on this midi and tracker channel Modified: trunk/OpenMPT/mptrack/bin/mptrack_Generic.exe =================================================================== (Binary files differ) Modified: trunk/OpenMPT/mptrack/bin/mptrack_P3.exe =================================================================== (Binary files differ) Modified: trunk/OpenMPT/mptrack/bin/mptrack_P4-Athlon64.exe =================================================================== (Binary files differ) Modified: trunk/OpenMPT/mptrack/bin/mptrack_athlon32.exe =================================================================== (Binary files differ) Deleted: trunk/OpenMPT/mptrack/bin/testSvnCommitList =================================================================== Deleted: trunk/OpenMPT/mptrack/bin/testSvnCommitList2 =================================================================== Modified: trunk/OpenMPT/mptrack/bin/version =================================================================== --- trunk/OpenMPT/mptrack/bin/version 2006-03-23 01:46:21 UTC (rev 155) +++ trunk/OpenMPT/mptrack/bin/version 2006-04-11 23:44:36 UTC (rev 156) @@ -1 +1 @@ -1.17.02.41 \ No newline at end of file +1.17.02.42 \ No newline at end of file Modified: trunk/OpenMPT/mptrack/mptrack.rc =================================================================== --- trunk/OpenMPT/mptrack/mptrack.rc 2006-03-23 01:46:21 UTC (rev 155) +++ trunk/OpenMPT/mptrack/mptrack.rc 2006-04-11 23:44:36 UTC (rev 156) @@ -106,6 +106,7 @@ MENUITEM "Save as &Wave...", ID_FILE_SAVEASWAVE MENUITEM "Save as M&P3...", ID_FILE_SAVEASMP3 MENUITEM "Export as M&idi...", ID_FILE_SAVEMIDI + MENUITEM "Export &unraped...", ID_FILE_SAVECOMPAT MENUITEM SEPARATOR MENUITEM "Import &midi Library...", ID_IMPORT_MIDILIB MENUITEM "Add Sound &Bank...", ID_ADD_SOUNDBANK @@ -1892,7 +1893,7 @@ // VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,17,2,41 + FILEVERSION 1,17,2,42 PRODUCTVERSION 0,0,0,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG @@ -1910,7 +1911,7 @@ BEGIN VALUE "CompanyName", "Olivier Lapicque / OpenMPT team" VALUE "FileDescription", "OpenMPT / ModPlug Tracker" - VALUE "FileVersion", "1, 17, 2, 41" + VALUE "FileVersion", "1, 17, 2, 42" VALUE "InternalName", "Modplug Tracker" VALUE "LegalCopyright", "Copyright \xA91997-2003 Olivier Lapicque; \xA92004-2005 GPL." VALUE "LegalTrademarks", "M.O.D.P.L.U.G" @@ -2184,6 +2185,7 @@ ID_PATTERN_CHANNELMANAGER "Display channel manager window\nChannel manager" ID_INDICATOR_CPU "-" + ID_FILE_EXPORTCOMPAT "Export file to standard IT/XM." END STRINGTABLE @@ -2456,7 +2458,7 @@ STRINGTABLE BEGIN ID_SAMPLE_TRIM "Delete everything except the current selection\nTrim Sample" - ID_FILE_SAVEMIDI "Convert the current song to a standard midi file" + ID_FILE_SAVEMIDI "Export the current song to a standard midi file" ID_NETLINK_FORUMS "Go to the Modplug Central Music Forums" ID_INSTRUMENT_SAMPLEMAP "Edit the sample map" ID_NETLINK_PLUGINS "Go to KVR Audio to download plugins" Modified: trunk/OpenMPT/mptrack/resource.h =================================================================== --- trunk/OpenMPT/mptrack/resource.h 2006-03-23 01:46:21 UTC (rev 155) +++ trunk/OpenMPT/mptrack/resource.h 2006-04-11 23:44:36 UTC (rev 156) @@ -40,6 +40,7 @@ #define ID_PATTERN_CHANNELMANAGER 202 #define IDR_ENVELOPES 203 #define ID_INDICATOR_CPU 203 +#define ID_FILE_EXPORTCOMPAT 204 #define IDB_MAINBAR 300 #define IDB_IMAGELIST 301 #define IDB_PATTERNS 302 @@ -546,7 +547,6 @@ #define IDC_PATTERN_PLAYFROMSTART 2026 #define IDC_PATTERN_STOP 2027 #define IDC_PATTERN_RECORD 2028 -#define IDC_PATTERN_FOLLOWSONG 3029 #define IDC_PATTERN_NEW 2030 #define IDC_PATTERN_OCTAVELINK 2031 #define IDC_SPIN_SPACING 2032 @@ -738,6 +738,7 @@ #define IDC_TEXT_RPB 2301 #define IDC_SPIN_RPB 2302 #define IDC_EDIT_RPB 2303 +#define IDC_PATTERN_FOLLOWSONG 3029 #define ID_FILE_NEWMOD 32771 #define ID_FILE_NEWXM 32772 #define ID_FILE_NEWS3M 32773 @@ -939,6 +940,8 @@ #define ID_PATTERN_ADDCHANNEL_AFTER 59149 #define ID_PATTERN_REMOVECHANNEL 59150 #define ID_PATTERN_REMOVECHANNELDIALOG 59151 +#define ID_Menu 59200 +#define ID_FILE_SAVECOMPAT 59202 // Next default values for new objects // @@ -946,7 +949,7 @@ #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_3D_CONTROLS 1 #define _APS_NEXT_RESOURCE_VALUE 510 -#define _APS_NEXT_COMMAND_VALUE 59200 +#define _APS_NEXT_COMMAND_VALUE 59203 #define _APS_NEXT_CONTROL_VALUE 2255 #define _APS_NEXT_SYMED_VALUE 901 #endif Modified: trunk/OpenMPT/packageTemplate/History.txt =================================================================== --- trunk/OpenMPT/packageTemplate/History.txt 2006-03-23 01:46:21 UTC (rev 155) +++ trunk/OpenMPT/packageTemplate/History.txt 2006-04-11 23:44:36 UTC (rev 156) @@ -8,7 +8,15 @@ ?: other (tx XYZ): thanks to XYZ for telling me about the bug +. v1.17.02.42 + + <rewbs> "Compatibility export" in file menu: save as 'plain' IT, without all of OpenMPT's crap. IT only for now (not XM). + . <rewbs> Set instrument in pattern editor should work when no note is specified (tx Torvus - http://lpchip.com/modplug/viewtopic.php?t=470) + . <rewbs> Restart position saved in IT (tx LPChip - http://lpchip.com/modplug/viewtopic.php?t=473) + . <rewbs> Loop song now works even if restart pos falls on +++ (tx LPChip - http://lpchip.com/modplug/viewtopic.php?t=463) + . <rewbs> Last used tempo is applied even when playback is triggered from instrument panel. (tx LPChip - http://lpchip.com/modplug/viewtopic.php?t=480) + / <rewbs> User now gets a warning when loading MDA Degrade (tx fisk0 - http://lpchip.com/modplug/viewtopic.php?t=467) + . v 1.17.02.41 + <rewbs> Pattern record state is now saved to ini . <rewbs> Fixed the following settings that were not saving correctly: mod document window status, row spacing, channel VU meters, channel effect visibility, Most recent files list, Toolbar settings. Modified: trunk/OpenMPT/soundlib/Load_it.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_it.cpp 2006-03-23 01:46:21 UTC (rev 155) +++ trunk/OpenMPT/soundlib/Load_it.cpp 2006-04-11 23:44:36 UTC (rev 156) @@ -601,6 +601,7 @@ case 'SPA.': fadr = reinterpret_cast<BYTE*>(&m_nSongPreAmp); break; case 'VSTV': fadr = reinterpret_cast<BYTE*>(&m_nVSTiVolume); break; case 'DGV.': fadr = reinterpret_cast<BYTE*>(&m_nDefaultGlobalVolume); break; + case 'RP..': fadr = reinterpret_cast<BYTE*>(&m_nRestartPos); break; } if (fadr != NULL) { // if field code recognized @@ -1007,6 +1008,7 @@ case 'SPA.': fadr = reinterpret_cast<BYTE*>(&m_nSongPreAmp); break; case 'VSTV': fadr = reinterpret_cast<BYTE*>(&m_nVSTiVolume); break; case 'DGV.': fadr = reinterpret_cast<BYTE*>(&m_nDefaultGlobalVolume); break; + case 'RP..': fadr = reinterpret_cast<BYTE*>(&m_nRestartPos); break; } if (fadr != NULL) { // if field code recognized @@ -1996,6 +1998,579 @@ #pragma warning(default:4100) #endif // MODPLUG_NO_FILESAVE +//HACK: This is a quick fix. Needs to be better integrated into player and GUI. +//And need to split into subroutines and eliminate code duplication with SaveIT. +BOOL CSoundFile::SaveCompatIT(LPCSTR lpszFileName) +//------------------------------------------------ +{ + const int IT_MAX_CHANNELS=64; + DWORD dwPatNamLen, dwChnNamLen; + ITFILEHEADER header; + ITINSTRUMENT iti; + ITSAMPLESTRUCT itss; + BYTE smpcount[(MAX_SAMPLES+7)/8]; + DWORD inspos[MAX_INSTRUMENTS]; + DWORD patpos[MAX_PATTERNS]; + DWORD smppos[MAX_SAMPLES]; + DWORD dwPos = 0, dwHdrPos = 0, dwExtra = 2; + WORD patinfo[4]; +// -> CODE#0006 +// -> DESC="misc quantity changes" + BYTE chnmask[IT_MAX_CHANNELS]; + MODCOMMAND lastvalue[IT_MAX_CHANNELS]; + UINT nChannels = min(m_nChannels, IT_MAX_CHANNELS); +// -! BEHAVIOUR_CHANGE#0006 + BYTE buf[512]; + FILE *f; + + + if ((!lpszFileName) || ((f = fopen(lpszFileName, "wb")) == NULL)) return FALSE; + memset(inspos, 0, sizeof(inspos)); + memset(patpos, 0, sizeof(patpos)); + memset(smppos, 0, sizeof(smppos)); + // Writing Header + memset(&header, 0, sizeof(header)); + dwPatNamLen = 0; + dwChnNamLen = 0; + header.id = 0x4D504D49; + lstrcpyn(header.songname, m_szNames[0], 27); + header.reserved1 = 0x1004; + header.ordnum = 0; + header.ordnum=MAX_ORDERS; + while (header.ordnum>0 && Order[header.ordnum-1]==0xFF) { + header.ordnum--; + } + header.patnum = MAX_PATTERNS; + while ((header.patnum > 0) && (!Patterns[header.patnum-1])) { + header.patnum--; + } + + header.insnum = m_nInstruments; + header.smpnum = m_nSamples; + header.cwtv = 0x888; // We don't use these version info fields any more. + header.cmwt = 0x888; // Might come up as "Impulse Tracker 8" file in XMPlay. :) + header.flags = 0x0001; + header.special = 0x0006; + if (m_nInstruments) header.flags |= 0x04; + if (m_dwSongFlags & SONG_LINEARSLIDES) header.flags |= 0x08; + if (m_dwSongFlags & SONG_ITOLDEFFECTS) header.flags |= 0x10; + if (m_dwSongFlags & SONG_ITCOMPATMODE) header.flags |= 0x20; + if (m_dwSongFlags & SONG_EXFILTERRANGE) header.flags |= 0x1000; + header.globalvol = m_nDefaultGlobalVolume >> 1; + header.mv = m_nSongPreAmp; + if (header.mv < 0x20) header.mv = 0x20; + if (header.mv > 0x7F) header.mv = 0x7F; + header.speed = m_nDefaultSpeed; + header.tempo = min(m_nDefaultTempo,255); //Limit this one to 255, we save the real one as an extension below. + header.sep = 128; + dwHdrPos = sizeof(header) + header.ordnum; + // Channel Pan and Volume + memset(header.chnpan, 0xFF, 64); + memset(header.chnvol, 64, 64); + for (UINT ich=0; ich<nChannels; ich++) + { + header.chnpan[ich] = ChnSettings[ich].nPan >> 2; + if (ChnSettings[ich].dwFlags & CHN_SURROUND) header.chnpan[ich] = 100; + header.chnvol[ich] = ChnSettings[ich].nVolume; + if (ChnSettings[ich].dwFlags & CHN_MUTE) header.chnpan[ich] |= 0x80; +/* if (ChnSettings[ich].szName[0]) + { + dwChnNamLen = (ich+1) * MAX_CHANNELNAME; + } +*/ + } +// if (dwChnNamLen) dwExtra += dwChnNamLen + 8; +/*#ifdef SAVEITTIMESTAMP + dwExtra += 8; // Time Stamp +#endif +*/ + if (m_dwSongFlags & SONG_EMBEDMIDICFG) + { + header.flags |= 0x80; + header.special |= 0x08; + dwExtra += sizeof(MODMIDICFG); + } + // Pattern Names +/* if ((m_nPatternNames) && (m_lpszPatternNames)) + { + dwPatNamLen = m_nPatternNames * MAX_PATTERNNAME; + while ((dwPatNamLen >= MAX_PATTERNNAME) && (!m_lpszPatternNames[dwPatNamLen-MAX_PATTERNNAME])) dwPatNamLen -= MAX_PATTERNNAME; + if (dwPatNamLen < MAX_PATTERNNAME) dwPatNamLen = 0; + if (dwPatNamLen) dwExtra += dwPatNamLen + 8; + } +*/ // Mix Plugins + //dwExtra += SaveMixPlugins(NULL, TRUE); + // Comments + if (m_lpszSongComments) + { + header.special |= 1; + header.msglength = strlen(m_lpszSongComments)+1; + header.msgoffset = dwHdrPos + dwExtra + header.insnum*4 + header.patnum*4 + header.smpnum*4; + } + // Write file header + fwrite(&header, 1, sizeof(header), f); + fwrite(Order, 1, header.ordnum, f); + if (header.insnum) fwrite(inspos, 4, header.insnum, f); + if (header.smpnum) fwrite(smppos, 4, header.smpnum, f); + if (header.patnum) fwrite(patpos, 4, header.patnum, f); + // Writing editor history information + { +/*#ifdef SAVEITTIMESTAMP + SYSTEMTIME systime; + FILETIME filetime; + WORD timestamp[4]; + WORD nInfoEx = 1; + memset(timestamp, 0, sizeof(timestamp)); + fwrite(&nInfoEx, 1, 2, f); + GetSystemTime(&systime); + SystemTimeToFileTime(&systime, &filetime); + FileTimeToDosDateTime(&filetime, ×tamp[0], ×tamp[1]); + fwrite(timestamp, 1, 8, f); +#else +*/ WORD nInfoEx = 0; + fwrite(&nInfoEx, 1, 2, f); +//#endif + } + // Writing midi cfg + if (header.flags & 0x80) + { + fwrite(&m_MidiCfg, 1, sizeof(MODMIDICFG), f); + } + // Writing pattern names +/* if (dwPatNamLen) + { + DWORD d = 0x4d414e50; + fwrite(&d, 1, 4, f); + fwrite(&dwPatNamLen, 1, 4, f); + fwrite(m_lpszPatternNames, 1, dwPatNamLen, f); + } +*/ // Writing channel Names +/* if (dwChnNamLen) + { + DWORD d = 0x4d414e43; + fwrite(&d, 1, 4, f); + fwrite(&dwChnNamLen, 1, 4, f); + UINT nChnNames = dwChnNamLen / MAX_CHANNELNAME; + for (UINT inam=0; inam<nChnNames; inam++) + { + fwrite(ChnSettings[inam].szName, 1, MAX_CHANNELNAME, f); + } + } +*/ // Writing mix plugins info +/* SaveMixPlugins(f, FALSE); +*/ // Writing song message + dwPos = dwHdrPos + dwExtra + (header.insnum + header.smpnum + header.patnum) * 4; + if (header.special & 1) + { + dwPos += strlen(m_lpszSongComments) + 1; + fwrite(m_lpszSongComments, 1, strlen(m_lpszSongComments)+1, f); + } + // Writing instruments + for (UINT nins=1; nins<=header.insnum; nins++) + { + BOOL bKbdEx = FALSE; + BYTE keyboardex[120]; + + memset(&iti, 0, sizeof(iti)); + iti.id = 0x49504D49; // "IMPI" + //iti.trkvers = 0x211; + iti.trkvers = 0x220; //rewbs.itVersion + if (Headers[nins]) + { + INSTRUMENTHEADER *penv = Headers[nins]; + memset(smpcount, 0, sizeof(smpcount)); + memcpy(iti.filename, penv->filename, 12); + memcpy(iti.name, penv->name, 26); + iti.mbank = penv->wMidiBank; + iti.mpr = penv->nMidiProgram; + iti.mch = penv->nMidiChannel; + iti.nna = penv->nNNA; + if (penv->nDCT<DCT_PLUGIN) iti.dct = penv->nDCT; else iti.dct =0; + iti.dca = penv->nDNA; + iti.fadeout = penv->nFadeOut >> 5; + iti.pps = penv->nPPS; + iti.ppc = penv->nPPC; + iti.gbv = (BYTE)(penv->nGlobalVol << 1); + iti.dfp = (BYTE)penv->nPan >> 2; + if (!(penv->dwFlags & ENV_SETPANNING)) iti.dfp |= 0x80; + iti.rv = penv->nVolSwing; + iti.rp = penv->nPanSwing; + iti.ifc = penv->nIFC; + iti.ifr = penv->nIFR; + iti.nos = 0; + for (UINT i=0; i<120; i++) if (penv->Keyboard[i] < MAX_SAMPLES) + { + UINT smp = penv->Keyboard[i]; + if ((smp) && (!(smpcount[smp>>3] & (1<<(smp&7))))) + { + smpcount[smp>>3] |= 1 << (smp&7); + iti.nos++; + } + iti.keyboard[i*2] = penv->NoteMap[i] - 1; + iti.keyboard[i*2+1] = smp; + if (smp > 0xff) bKbdEx = TRUE; + keyboardex[i] = (smp>>8); + } else keyboardex[i] = 0; + // Writing Volume envelope + if (penv->dwFlags & ENV_VOLUME) iti.volenv.flags |= 0x01; + if (penv->dwFlags & ENV_VOLLOOP) iti.volenv.flags |= 0x02; + if (penv->dwFlags & ENV_VOLSUSTAIN) iti.volenv.flags |= 0x04; + if (penv->dwFlags & ENV_VOLCARRY) iti.volenv.flags |= 0x08; + iti.volenv.num = (BYTE)penv->nVolEnv; + iti.volenv.lpb = (BYTE)penv->nVolLoopStart; + iti.volenv.lpe = (BYTE)penv->nVolLoopEnd; + iti.volenv.slb = penv->nVolSustainBegin; + iti.volenv.sle = penv->nVolSustainEnd; + // Writing Panning envelope + if (penv->dwFlags & ENV_PANNING) iti.panenv.flags |= 0x01; + if (penv->dwFlags & ENV_PANLOOP) iti.panenv.flags |= 0x02; + if (penv->dwFlags & ENV_PANSUSTAIN) iti.panenv.flags |= 0x04; + if (penv->dwFlags & ENV_PANCARRY) iti.panenv.flags |= 0x08; + iti.panenv.num = (BYTE)penv->nPanEnv; + iti.panenv.lpb = (BYTE)penv->nPanLoopStart; + iti.panenv.lpe = (BYTE)penv->nPanLoopEnd; + iti.panenv.slb = penv->nPanSustainBegin; + iti.panenv.sle = penv->nPanSustainEnd; + // Writing Pitch Envelope + if (penv->dwFlags & ENV_PITCH) iti.pitchenv.flags |= 0x01; + if (penv->dwFlags & ENV_PITCHLOOP) iti.pitchenv.flags |= 0x02; + if (penv->dwFlags & ENV_PITCHSUSTAIN) iti.pitchenv.flags |= 0x04; + if (penv->dwFlags & ENV_PITCHCARRY) iti.pitchenv.flags |= 0x08; + if (penv->dwFlags & ENV_FILTER) iti.pitchenv.flags |= 0x80; + iti.pitchenv.num = (BYTE)penv->nPitchEnv; + iti.pitchenv.lpb = (BYTE)penv->nPitchLoopStart; + iti.pitchenv.lpe = (BYTE)penv->nPitchLoopEnd; + iti.pitchenv.slb = (BYTE)penv->nPitchSustainBegin; + iti.pitchenv.sle = (BYTE)penv->nPitchSustainEnd; + // Writing Envelopes data + for (UINT ev=0; ev<25; ev++) + { + iti.volenv.data[ev*3] = penv->VolEnv[ev]; + iti.volenv.data[ev*3+1] = penv->VolPoints[ev] & 0xFF; + iti.volenv.data[ev*3+2] = penv->VolPoints[ev] >> 8; + iti.panenv.data[ev*3] = penv->PanEnv[ev] - 32; + iti.panenv.data[ev*3+1] = penv->PanPoints[ev] & 0xFF; + iti.panenv.data[ev*3+2] = penv->PanPoints[ev] >> 8; + iti.pitchenv.data[ev*3] = penv->PitchEnv[ev] - 32; + iti.pitchenv.data[ev*3+1] = penv->PitchPoints[ev] & 0xFF; + iti.pitchenv.data[ev*3+2] = penv->PitchPoints[ev] >> 8; + } + } else + // Save Empty Instrument + { + for (UINT i=0; i<120; i++) iti.keyboard[i*2] = i; + iti.ppc = 5*12; + iti.gbv = 128; + iti.dfp = 0x20; + iti.ifc = 0xFF; + } + if (!iti.nos) iti.trkvers = 0; + // Writing instrument + if (bKbdEx) *((int *)iti.dummy) = 'MPTX'; + inspos[nins-1] = dwPos; + dwPos += sizeof(ITINSTRUMENT); + fwrite(&iti, 1, sizeof(ITINSTRUMENT), f); + if (bKbdEx) + { + dwPos += 120; + fwrite(keyboardex, 1, 120, f); + } + + //------------ rewbs.modularInstData +/* if (Headers[nins]) + { + long modularInstSize = 0; + UINT ModInstID = 'INSM'; + fwrite(&ModInstID, 1, sizeof(ModInstID), f); // mark this as an instrument with modular extensions + long sizePos = ftell(f); // we will want to write the modular data's total size here + fwrite(&modularInstSize, 1, sizeof(modularInstSize), f); // write a DUMMY size, just to move file pointer by a long + + //Write chunks + UINT ID; + { //VST Slot chunk: + ID='PLUG'; + fwrite(&ID, 1, sizeof(int), f); + INSTRUMENTHEADER *penv = Headers[nins]; + fwrite(&(penv->nMixPlug), 1, sizeof(BYTE), f); + modularInstSize += sizeof(int)+sizeof(BYTE); + } +*/ //How to save your own modular instrument chunk: + /* { + ID='MYID'; + fwrite(&ID, 1, sizeof(int), f); + instModularDataSize+=sizeof(int); + + //You can save your chunk size somwhere here if you need variable chunk size. + fwrite(myData, 1, myDataSize, f); + instModularDataSize+=myDataSize; + } + */ +/* //write modular data's total size + long curPos = ftell(f); // remember current pos + fseek(f, sizePos, SEEK_SET); // go back to sizePos + fwrite(&modularInstSize, 1, sizeof(modularInstSize), f); // write data + fseek(f, curPos, SEEK_SET); // go back to where we were. + + //move forward + dwPos+=sizeof(ModInstID)+sizeof(modularInstSize)+modularInstSize; + } +*/ //------------ end rewbs.modularInstData + } + // Writing sample headers + memset(&itss, 0, sizeof(itss)); + for (UINT hsmp=0; hsmp<header.smpnum; hsmp++) + { + smppos[hsmp] = dwPos; + dwPos += sizeof(ITSAMPLESTRUCT); + fwrite(&itss, 1, sizeof(ITSAMPLESTRUCT), f); + } + // Writing Patterns + for (UINT npat=0; npat<header.patnum; npat++) + { + DWORD dwPatPos = dwPos; + UINT len; + if (!Patterns[npat]) continue; + patpos[npat] = dwPos; + patinfo[0] = 0; + patinfo[1] = PatternSize[npat]; + patinfo[2] = 0; + patinfo[3] = 0; + // Check for empty pattern + if (PatternSize[npat] == 64) + { + MODCOMMAND *pzc = Patterns[npat]; + UINT nz = PatternSize[npat] * nChannels; + for (UINT iz=0; iz<nz; iz++) + { + if ((pzc[iz].note) || (pzc[iz].instr) + || (pzc[iz].volcmd) || (pzc[iz].command)) break; + } + if (iz == nz) + { + patpos[npat] = 0; + continue; + } + } + fwrite(patinfo, 8, 1, f); + dwPos += 8; + memset(chnmask, 0xFF, sizeof(chnmask)); + memset(lastvalue, 0, sizeof(lastvalue)); + MODCOMMAND *m = Patterns[npat]; + for (UINT row=0; row<PatternSize[npat]; row++) + { + len = 0; + for (UINT ch=0; ch<nChannels; ch++, m++) + { + BYTE b = 0; + UINT command = m->command; + UINT param = m->param; + UINT vol = 0xFF; + UINT note = m->note; + if (note) b |= 1; + if ((note) && (note < 0xFE)) note--; + if (m->instr) b |= 2; + if (m->volcmd) + { + UINT volcmd = m->volcmd; + switch(volcmd) + { + case VOLCMD_VOLUME: vol = m->vol; if (vol > 64) vol = 64; break; + case VOLCMD_PANNING: vol = m->vol + 128; if (vol > 192) vol = 192; break; + case VOLCMD_VOLSLIDEUP: vol = 85 + ConvertVolParam(m->vol); break; + case VOLCMD_VOLSLIDEDOWN: vol = 95 + ConvertVolParam(m->vol); break; + case VOLCMD_FINEVOLUP: vol = 65 + ConvertVolParam(m->vol); break; + case VOLCMD_FINEVOLDOWN: vol = 75 + ConvertVolParam(m->vol); break; + case VOLCMD_VIBRATO: vol = 203; break; + case VOLCMD_VIBRATOSPEED: vol = 203 + ConvertVolParam(m->vol); break; + case VOLCMD_TONEPORTAMENTO: vol = 193 + ConvertVolParam(m->vol); break; + case VOLCMD_PORTADOWN: vol = 105 + ConvertVolParam(m->vol); break; + case VOLCMD_PORTAUP: vol = 115 + ConvertVolParam(m->vol); break; + case VOLCMD_VELOCITY: vol = 213 + ConvertVolParam(m->vol); break; //rewbs.velocity + case VOLCMD_OFFSET: vol = 223 + ConvertVolParam(m->vol); break; //rewbs.volOff + default: vol = 0xFF; + } + } + if (vol != 0xFF) b |= 4; + if (command) + { + S3MSaveConvert(&command, ¶m, TRUE); + if (command) b |= 8; + } + // Packing information + if (b) + { + // Same note ? + if (b & 1) + { + if ((note == lastvalue[ch].note) && (lastvalue[ch].volcmd & 1)) + { + b &= ~1; + b |= 0x10; + } else + { + lastvalue[ch].note = note; + lastvalue[ch].volcmd |= 1; + } + } + // Same instrument ? + if (b & 2) + { + if ((m->instr == lastvalue[ch].instr) && (lastvalue[ch].volcmd & 2)) + { + b &= ~2; + b |= 0x20; + } else + { + lastvalue[ch].instr = m->instr; + lastvalue[ch].volcmd |= 2; + } + } + // Same volume column byte ? + if (b & 4) + { + if ((vol == lastvalue[ch].vol) && (lastvalue[ch].volcmd & 4)) + { + b &= ~4; + b |= 0x40; + } else + { + lastvalue[ch].vol = vol; + lastvalue[ch].volcmd |= 4; + } + } + // Same command / param ? + if (b & 8) + { + if ((command == lastvalue[ch].command) && (param == lastvalue[ch].param) && (lastvalue[ch].volcmd & 8)) + { + b &= ~8; + b |= 0x80; + } else + { + lastvalue[ch].command = command; + lastvalue[ch].param = param; + lastvalue[ch].volcmd |= 8; + } + } + if (b != chnmask[ch]) + { + chnmask[ch] = b; + buf[len++] = (ch+1) | 0x80; + buf[len++] = b; + } else + { + buf[len++] = ch+1; + } + if (b & 1) buf[len++] = note; + if (b & 2) buf[len++] = m->instr; + if (b & 4) buf[len++] = vol; + if (b & 8) + { + buf[len++] = command; + buf[len++] = param; + } + } + } + buf[len++] = 0; + dwPos += len; + patinfo[0] += len; + fwrite(buf, 1, len, f); + } + fseek(f, dwPatPos, SEEK_SET); + fwrite(patinfo, 8, 1, f); + fseek(f, dwPos, SEEK_SET); + } + // Writing Sample Data + for (UINT nsmp=1; nsmp<=header.smpnum; nsmp++) + { + MODINSTRUMENT *psmp = &Ins[nsmp]; + memset(&itss, 0, sizeof(itss)); + memcpy(itss.filename, psmp->name, 12); + memcpy(itss.name, m_szNames[nsmp], 26); + itss.id = 0x53504D49; + itss.gvl = (BYTE)psmp->nGlobalVol; + if (m_nInstruments) + { + for (UINT iu=1; iu<=m_nInstruments; iu++) if (Headers[iu]) + { + INSTRUMENTHEADER *penv = Headers[iu]; + for (UINT ju=0; ju<128; ju++) if (penv->Keyboard[ju] == nsmp) + { + itss.flags = 0x01; + break; + } + } + } else + { + itss.flags = 0x01; + } + if (psmp->uFlags & CHN_LOOP) itss.flags |= 0x10; + if (psmp->uFlags & CHN_SUSTAINLOOP) itss.flags |= 0x20; + if (psmp->uFlags & CHN_PINGPONGLOOP) itss.flags |= 0x40; + if (psmp->uFlags & CHN_PINGPONGSUSTAIN) itss.flags |= 0x80; + itss.C5Speed = psmp->nC4Speed; + if (!itss.C5Speed) itss.C5Speed = 8363; + itss.length = psmp->nLength; + itss.loopbegin = psmp->nLoopStart; + itss.loopend = psmp->nLoopEnd; + itss.susloopbegin = psmp->nSustainStart; + itss.susloopend = psmp->nSustainEnd; + itss.vol = psmp->nVolume >> 2; + itss.dfp = psmp->nPan >> 2; + itss.vit = autovibxm2it[psmp->nVibType & 7]; + itss.vis = psmp->nVibRate; + itss.vid = psmp->nVibDepth; + itss.vir = (psmp->nVibSweep < 64) ? psmp->nVibSweep * 4 : 255; + if (psmp->uFlags & CHN_PANNING) itss.dfp |= 0x80; + if ((psmp->pSample) && (psmp->nLength)) itss.cvt = 0x01; + UINT flags = RS_PCM8S; +#ifndef NO_PACKING + if (nPacking) + { + if ((!(psmp->uFlags & (CHN_16BIT|CHN_STEREO))) + && (CanPackSample(psmp->pSample, psmp->nLength, nPacking))) + { + flags = RS_ADPCM4; + itss.cvt = 0xFF; + } + } else +#endif // NO_PACKING + { + if (psmp->uFlags & CHN_STEREO) + { + flags = RS_STPCM8S; + itss.flags |= 0x04; + } + if (psmp->uFlags & CHN_16BIT) + { + itss.flags |= 0x02; + flags = (psmp->uFlags & CHN_STEREO) ? RS_STPCM16S : RS_PCM16S; + } + } + itss.samplepointer = dwPos; + fseek(f, smppos[nsmp-1], SEEK_SET); + fwrite(&itss, 1, sizeof(ITSAMPLESTRUCT), f); + fseek(f, dwPos, SEEK_SET); + if ((psmp->pSample) && (psmp->nLength)) + { + dwPos += WriteSample(f, psmp, flags); + } + } + + //Save hacked-on extra info +// SaveExtendedInstrumentProperties(Headers, header.insnum, f); +// SaveExtendedSongProperties(f); + + // Updating offsets + fseek(f, dwHdrPos, SEEK_SET); + if (header.insnum) fwrite(inspos, 4, header.insnum, f); + if (header.smpnum) fwrite(smppos, 4, header.smpnum, f); + if (header.patnum) fwrite(patpos, 4, header.patnum, f); + fclose(f); + return TRUE; + +} + ////////////////////////////////////////////////////////////////////////////// // IT 2.14 compression @@ -2549,5 +3124,12 @@ fwrite(&size, 1, sizeof(__int16), f); fwrite(&m_nDefaultGlobalVolume, 1, size, f); + code = 'RP..'; //write m_nRestartPos + fwrite(&code, 1, sizeof(__int32), f); + size = sizeof(m_nRestartPos); + fwrite(&size, 1, sizeof(__int16), f); + fwrite(&m_nRestartPos, 1, size, f); + + return; } \ No newline at end of file Modified: trunk/OpenMPT/soundlib/Load_xm.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_xm.cpp 2006-03-23 01:46:21 UTC (rev 155) +++ trunk/OpenMPT/soundlib/Load_xm.cpp 2006-04-11 23:44:36 UTC (rev 156) @@ -988,4 +988,12 @@ return TRUE; } +//HACK: This is a quick fix. Needs to be better integrated into player and GUI. +BOOL CSoundFile::SaveCompatXM(LPCSTR lpszFileName) +//------------------------------------------------ +{ + + return TRUE; +} + #endif // MODPLUG_NO_FILESAVE Modified: trunk/OpenMPT/soundlib/Sndfile.cpp =================================================================== --- trunk/OpenMPT/soundlib/Sndfile.cpp 2006-03-23 01:46:21 UTC (rev 155) +++ trunk/OpenMPT/soundlib/Sndfile.cpp 2006-04-11 23:44:36 UTC (rev 156) @@ -172,6 +172,7 @@ PSB. nPanSustainBegin; PSE. nPanSustainEnd; R... nResampling; +RP.. [EXT] nRestartPos; RPB. [EXT] nRowsPerBeat; RPM. [EXT] nRowsPerMeasure; RS.. nResSwing; Modified: trunk/OpenMPT/soundlib/Sndfile.h =================================================================== --- trunk/OpenMPT/soundlib/Sndfile.h 2006-03-23 01:46:21 UTC (rev 155) +++ trunk/OpenMPT/soundlib/Sndfile.h 2006-04-11 23:44:36 UTC (rev 156) @@ -934,6 +934,8 @@ BOOL SaveS3M(LPCSTR lpszFileName, UINT nPacking=0); BOOL SaveMod(LPCSTR lpszFileName, UINT nPacking=0); BOOL SaveIT(LPCSTR lpszFileName, UINT nPacking=0); + BOOL SaveCompatIT(LPCSTR lpszFileName); + BOOL SaveCompatXM(LPCSTR lpszFileName); // -> CODE#0023 // -> DESC="IT project files (.itp)" BOOL SaveITProject(LPCSTR lpszFileName); Modified: trunk/OpenMPT/soundlib/Sndmix.cpp =================================================================== --- trunk/OpenMPT/soundlib/Sndmix.cpp 2006-03-23 01:46:21 UTC (rev 155) +++ trunk/OpenMPT/soundlib/Sndmix.cpp 2006-04-11 23:44:36 UTC (rev 156) @@ -611,7 +611,8 @@ m_nTickCount = 0; m_nRow = m_nNextRow; // Reset Pattern Loop Effect - if (m_nCurrentPattern != m_nNextPattern) m_nCurrentPattern = m_nNextPattern; + if (m_nCurrentPattern != m_nNextPattern) + m_nCurrentPattern = m_nNextPattern; // Check if pattern is valid if (!(m_dwSongFlags & SONG_PATTERNLOOP)) { @@ -629,16 +630,14 @@ //rewbs.instroVSTi: stop all VSTi at end of song, if looping. StopAllVsti(); - m_nMusicSpeed = m_nDefaultSpeed; m_nMusicTempo = m_nDefaultTempo; m_nGlobalVolume = m_nDefaultGlobalVolume; - for (UINT i=0; i<MAX_CHANNELS; i++) - { + for (UINT i=0; i<MAX_CHANNELS; i++) { Chn[i].dwFlags |= CHN_NOTEFADE | CHN_KEYOFF; Chn[i].nFadeOutVol = 0; - if (i < m_nChannels) - { + + if (i < m_nChannels) { Chn[i].nGlobalVol = ChnSettings[i].nVolume; Chn[i].nVolume = ChnSettings[i].nVolume; Chn[i].nPan = ChnSettings[i].nPan; @@ -648,8 +647,8 @@ Chn[i].nOldOffset = 0; Chn[i].nOldHiOffset = 0; Chn[i].nPortamentoDest = 0; - if (!Chn[i].nLength) - { + + if (!Chn[i].nLength) { Chn[i].dwFlags = ChnSettings[i].dwFlags; Chn[i].nLoopStart = 0; Chn[i].nLoopEnd = 0; @@ -662,31 +661,42 @@ } + + //Handle Repeat position if (m_nRepeatCount > 0) m_nRepeatCount--; m_nCurrentPattern = m_nRestartPos; - m_nRow = 0; - if ((Order[m_nCurrentPattern] >= MAX_PATTERNS) || (!Patterns[Order[m_nCurrentPattern]])) return FALSE; - } else - { + m_nRow = 0; + //If restart pos points to +++, move along + while (Order[m_nCurrentPattern] == 0xFE) { + m_nCurrentPattern++; + } + //Check for end of song or bad pattern + if ( (Order[m_nCurrentPattern] >= MAX_PATTERNS) + || (!Patterns[Order[m_nCurrentPattern]]) ) { + return FALSE; + } + + } else { m_nCurrentPattern++; } - m_nPattern = (m_nCurrentPattern < MAX_ORDERS) ? Order[m_nCurrentPattern] : 0xFF; - if ((m_nPattern < MAX_PATTERNS) && (!Patterns[m_nPattern])) m_nPattern = 0xFE; + + if (m_nCurrentPattern < MAX_ORDERS) { + m_nPattern = Order[m_nCurrentPattern]; + } else { + m_nPattern = 0xFF; + } + + if ((m_nPattern < MAX_PATTERNS) && (!Patterns[m_nPattern])) { + m_nPattern = 0xFE; + } } m_nNextPattern = m_nCurrentPattern; #ifdef MODPLUG_TRACKER -// if (m_nInstruments) ProcessMidiOut(); //rewbs.VSTnoteDelay if ((m_nMaxOrderPosition) && (m_nCurrentPattern >= m_nMaxOrderPosition)) return FALSE; #endif // MODPLUG_TRACKER } -//#ifdef MODPLUG_TRACKER -// if (m_dwSongFlags & SONG_STEP) -// { -// m_dwSongFlags &= ~SONG_STEP; -// m_dwSongFlags |= SONG_PAUSED; -// } -//#endif // MODPLUG_TRACKER + // Weird stuff? if ((m_nPattern >= MAX_PATTERNS) || (!Patterns[m_nPattern])) return FALSE; // Should never happen @@ -766,10 +776,7 @@ //////////////////////////////////////////////////////////////////////////////////// m_nTotalCount++; if (!m_nMusicTempo) return FALSE; -// -> CODE#0022 -// -> DESC="alternative BPM/Speed interpretation method" - switch(m_nTempoMode) { case tempo_mode_alternative: @@ -796,47 +803,22 @@ default: m_nBufferCount = (gdwMixingFreq * 5 * m_nTempoFactor) / (m_nMusicTempo << 8); } - /* - if (CMainFrame::m_dwPatternSetup & PATTERN_ALTERNTIVEBPMSPEED) { - m_nBufferCount = gdwMixingFreq / m_nMusicTempo; - } - else { - m_nBufferCount = (gdwMixingFreq * 5 * m_nTempoFactor) / (m_nMusicTempo << 8); - } - */ -// -! NEW_FEATURE#0022 m_nSamplesPerTick = m_nBufferCount; //rewbs.flu -#ifdef MODPLUG_TRACKER - if (m_dwSongFlags & SONG_PAUSED) - { - m_nBufferCount = gdwMixingFreq / 64; // 1/64 seconds - } -#endif + +// robinf: this block causes envelopes to behave incorrectly when +// playback is triggered from instrument panel. +// I can't see why it would be useful. Dissabling for now. +// +// if (m_dwSongFlags & SONG_PAUSED) { +// m_nBufferCount = gdwMixingFreq / 64; // 1/64 seconds +// } + + // Master Volume + Pre-Amplification / Attenuation setup DWORD nMasterVol; { -////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// ericus 10/02/2005 -/* - int nchn32 = (m_nChannels < 32) ? m_nChannels : 31; - if ((m_nType & MOD_TYPE_IT) && (m_nInstruments) && (nchn32 < 6)) nchn32 = 6; - int realmastervol = m_nMasterVolume; - if (realmastervol > 0x80) - { - realmastervol = 0x80 + ((realmastervol - 0x80) * (nchn32+4)) / 16; - } - UINT attenuation = (gdwSoundSetup & SNDMIX_AGC) ? PreAmpAGCTable[nchn32>>1] : PreAmpTable[nchn32>>1]; - DWORD mastervol = (realmastervol * (m_nSongPreAmp + 0x10)) >> 6; - if (mastervol > 0x200) mastervol = 0x200; - if ((m_dwSongFlags & SONG_GLOBALFADE) && (m_nGlobalFadeMaxSamples)) - { - mastervol = _muldiv(mastervol, m_nGlobalFadeSamples, m_nGlobalFadeMaxSamples); - } - nMasterVol = (mastervol << 7) / attenuation; - if (nMasterVol > 0x180) nMasterVol = 0x180; -*/ int nchn32 = 0; MODCHANNEL *pChn = Chn; for (UINT nChn=0; nChn<m_nChannels; nChn++,pChn++) { @@ -862,8 +844,6 @@ if(attenuation < 1) attenuation = 1; nMasterVol = (mastervol << 7) / attenuation; - -////////////////////////////////////////////////////////////////////////////////////////////////////////////// } //////////////////////////////////////////////////////////////////////////////////// // Update channels data This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <re...@us...> - 2006-03-23 01:46:31
|
Revision: 155 Author: rewbs Date: 2006-03-22 17:46:21 -0800 (Wed, 22 Mar 2006) ViewCVS: http://svn.sourceforge.net/modplug/?rev=155&view=rev Log Message: ----------- Testing svn commit mailing list, again. Added Paths: ----------- trunk/OpenMPT/mptrack/bin/testSvnCommitList3 Copied: trunk/OpenMPT/mptrack/bin/testSvnCommitList3 (from rev 154, trunk/OpenMPT/mptrack/bin/testSvnCommitList2) =================================================================== This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |