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. |