From: <sag...@us...> - 2014-02-09 21:28:02
|
Revision: 3685 http://sourceforge.net/p/modplug/code/3685 Author: saga-games Date: 2014-02-09 21:27:55 +0000 (Sun, 09 Feb 2014) Log Message: ----------- [Imp] General tab: Show real name of current program instead of "current" in plugin config (http://forum.openmpt.org/index.php?topic=3284.0). [Mod] OpenMPT: Version is now 1.22.07.20 Modified Paths: -------------- trunk/OpenMPT/common/versionNumber.h trunk/OpenMPT/mptrack/View_gen.cpp trunk/OpenMPT/mptrack/View_gen.h Modified: trunk/OpenMPT/common/versionNumber.h =================================================================== --- trunk/OpenMPT/common/versionNumber.h 2014-02-09 19:49:49 UTC (rev 3684) +++ trunk/OpenMPT/common/versionNumber.h 2014-02-09 21:27:55 UTC (rev 3685) @@ -17,7 +17,7 @@ #define VER_MAJORMAJOR 1 #define VER_MAJOR 22 #define VER_MINOR 07 -#define VER_MINORMINOR 19 +#define VER_MINORMINOR 20 //Version string. For example "1.17.02.28" #define MPT_VERSION_STR VER_STRINGIZE(VER_MAJORMAJOR) "." VER_STRINGIZE(VER_MAJOR) "." VER_STRINGIZE(VER_MINOR) "." VER_STRINGIZE(VER_MINORMINOR) Modified: trunk/OpenMPT/mptrack/View_gen.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_gen.cpp 2014-02-09 19:49:49 UTC (rev 3684) +++ trunk/OpenMPT/mptrack/View_gen.cpp 2014-02-09 21:27:55 UTC (rev 3685) @@ -36,10 +36,7 @@ ON_WM_DESTROY() ON_WM_CTLCOLOR() -// -> CODE#0015 -// -> DESC="channels management dlg" ON_WM_ACTIVATE() -// -! NEW_FEATURE#0015 ON_COMMAND(IDC_CHECK1, OnMute1) ON_COMMAND(IDC_CHECK3, OnMute2) ON_COMMAND(IDC_CHECK5, OnMute3) @@ -61,16 +58,10 @@ ON_COMMAND(IDC_CLONEPLUG, OnClonePlug) -// -> CODE#0002 -// -> DESC="VST plugins presets" ON_COMMAND(IDC_BUTTON6, OnLoadParam) ON_COMMAND(IDC_BUTTON8, OnSaveParam) -// -! NEW_FEATURE#0002 -// -> CODE#0014 -// -> DESC="vst wet/dry slider" ON_COMMAND(IDC_BUTTON7, OnSetWetDry) -// -! NEW_FEATURE#0014 ON_EN_UPDATE(IDC_EDIT1, OnEditVol1) ON_EN_UPDATE(IDC_EDIT3, OnEditVol2) ON_EN_UPDATE(IDC_EDIT5, OnEditVol3) @@ -95,17 +86,11 @@ ON_CBN_SELCHANGE(IDC_COMBO7, OnOutputRoutingChanged) -// -> CODE#0002 -// -> DESC="VST plugins presets" ON_CBN_SELCHANGE(IDC_COMBO8, OnProgramChanged) ON_CBN_SETFOCUS(IDC_COMBO8, OnFillProgramCombo) -// -! NEW_FEATURE#0002 -// -> CODE#0028 -// -> DESC="effect plugin mixing mode combo" ON_COMMAND(IDC_CHECK12, OnWetDryExpandChanged) ON_CBN_SELCHANGE(IDC_COMBO9, OnSpecialMixProcessingChanged) -// -! BEHAVIOUR_CHANGE#0028 ON_NOTIFY(TCN_SELCHANGE, IDC_TABCTRL1, OnTabSelchange) ON_MESSAGE(WM_MOD_UNLOCKCONTROLS, OnUnlockControls) @@ -129,16 +114,9 @@ DDX_Control(pDX, IDC_COMBO6, m_CbnParam); DDX_Control(pDX, IDC_COMBO7, m_CbnOutput); -// -> CODE#0002 -// -> DESC="VST plugins presets" DDX_Control(pDX, IDC_COMBO8, m_CbnPreset); -// -! NEW_FEATURE#0002 - -// -> CODE#0028 -// -> DESC="effect plugin mixing mode combo" DDX_Control(pDX, IDC_COMBO9, m_CbnSpecialMixProcessing); - DDX_Control(pDX, IDC_SPIN10, m_SpinMixGain); // update#02 -// -! BEHAVIOUR_CHANGE#0028 + DDX_Control(pDX, IDC_SPIN10, m_SpinMixGain); DDX_Control(pDX, IDC_SLIDER1, m_sbVolume[0]); DDX_Control(pDX, IDC_SLIDER2, m_sbPan[0]); @@ -149,7 +127,7 @@ DDX_Control(pDX, IDC_SLIDER7, m_sbVolume[3]); DDX_Control(pDX, IDC_SLIDER8, m_sbPan[3]); DDX_Control(pDX, IDC_SLIDER9, m_sbValue); - DDX_Control(pDX, IDC_SLIDER10, m_sbDryRatio); //rewbs.VSTdrywet + DDX_Control(pDX, IDC_SLIDER10, m_sbDryRatio); DDX_Control(pDX, IDC_SPIN1, m_spinVolume[0]); DDX_Control(pDX, IDC_SPIN2, m_spinPan[0]); DDX_Control(pDX, IDC_SPIN3, m_spinVolume[1]); @@ -173,10 +151,6 @@ m_nActiveTab = -1; m_nCurrentPlugin = 0; m_nCurrentParam = 0; -// -> CODE#0002 -// -> DESC="VST plugins presets" - m_nCurrentPreset = 0; -// -! NEW_FEATURE#0002 CFormView::OnInitialUpdate(); if (pFrame) @@ -211,28 +185,21 @@ m_sbValue.SetPos(0); m_sbValue.SetRange(0, 100); - m_sbValue.SetPos(0); // rewbs.dryRatio 20040122 - m_sbValue.SetRange(0, 100); // rewbs.dryRatio 20040122 + m_sbValue.SetPos(0); + m_sbValue.SetRange(0, 100); -// -> CODE#0028 -// -> DESC="effect plugin mixing mode combo" m_CbnSpecialMixProcessing.AddString("Default"); m_CbnSpecialMixProcessing.AddString("Wet subtract"); m_CbnSpecialMixProcessing.AddString("Dry subtract"); m_CbnSpecialMixProcessing.AddString("Mix subtract"); m_CbnSpecialMixProcessing.AddString("Middle subtract"); m_CbnSpecialMixProcessing.AddString("LR balance"); - m_SpinMixGain.SetRange(0,80); // update#02 - m_SpinMixGain.SetPos(10); // update#02 - SetDlgItemText(IDC_STATIC2, "Gain: x 1.0"); // update#02 -// -! BEHAVIOUR_CHANGE#0028 + m_SpinMixGain.SetRange(0,80); + m_SpinMixGain.SetPos(10); + SetDlgItemText(IDC_STATIC2, "Gain: x 1.0"); UpdateView(HINT_MODTYPE); OnParamChanged(); -// -> CODE#0014 -// -> DESC="vst wet/dry slider" - //OnWetDryChanged(); -// -! NEW_FEATURE#0014 m_nLockCount = 0; @@ -255,8 +222,6 @@ } -// -> CODE#0015 -// -> DESC="channels management dlg" void CViewGlobals::OnDraw(CDC* pDC) //--------------------------------- { @@ -268,7 +233,6 @@ if(activeDoc && CChannelManagerDlg::sharedInstance(FALSE) && CChannelManagerDlg::sharedInstance()->IsDisplayed()) CChannelManagerDlg::sharedInstance()->SetDocument((void*)this); } -// -! NEW_FEATURE#0015 LRESULT CViewGlobals::OnMidiMsg(WPARAM midiData, LPARAM) @@ -455,18 +419,13 @@ ::EnableWindow(::GetDlgItem(m_hWnd, IDC_MOVEFXSLOT), (pVstPlugin) ? TRUE : FALSE); ::EnableWindow(::GetDlgItem(m_hWnd, IDC_INSERTFXSLOT), (pVstPlugin) ? TRUE : FALSE); ::EnableWindow(::GetDlgItem(m_hWnd, IDC_CLONEPLUG), (pVstPlugin) ? TRUE : FALSE); - //rewbs.DryRatio int n = static_cast<int>(pPlugin->fDryRatio*100); wsprintf(s, "(%d%% wet, %d%% dry)", 100-n, n); SetDlgItemText(IDC_STATIC8, s); - m_sbDryRatio.SetPos(n); - //end rewbs.DryRatio + m_sbDryRatio.SetPos(n); -// -> CODE#0028 -// -> DESC="effect plugin mixing mode combo" if(pVstPlugin && pVstPlugin->isInstrument()) { - // ericus 18/02/2005 : disable mix mode for VSTi ::EnableWindow(::GetDlgItem(m_hWnd, IDC_COMBO9), FALSE); ::EnableWindow(::GetDlgItem(m_hWnd, IDC_CHECK12), FALSE); } @@ -476,14 +435,12 @@ m_CbnSpecialMixProcessing.SetCurSel(pPlugin->GetMixMode()); // update#02 (fix) CheckDlgButton(IDC_CHECK12, pPlugin->IsExpandedMix() ? BST_CHECKED : BST_UNCHECKED); } - // update#02 int gain = pPlugin->GetGain(); if(gain == 0) gain = 10; float value = 0.1f * (float)gain; sprintf(s,"Gain: x %1.1f", value); SetDlgItemText(IDC_STATIC2, s); m_SpinMixGain.SetPos(gain); -// -! BEHAVIOUR_CHANGE#0028 if (pVstPlugin) { @@ -511,10 +468,8 @@ // Some plugins like Synth1 have so many presets that this *does* indeed make a difference, // even on fairly modern CPUs. The rest of the presets are just added when the combo box // gets the focus, i.e. just when they're needed. - m_CbnPreset.SetRedraw(FALSE); - m_CbnPreset.ResetContent(); - m_CbnPreset.SetItemData(m_CbnPreset.AddString(_T("current")), 0); - m_CbnPreset.SetRedraw(TRUE); + VstInt32 currentProg = pVstPlugin->GetCurrentProgram(); + FillPluginProgramBox(currentProg, currentProg); m_CbnPreset.SetCurSel(0); m_sbValue.EnableWindow(TRUE); @@ -533,7 +488,6 @@ m_CbnPreset.ResetContent(); wsprintf(s2, "none"); m_CbnPreset.SetItemData(m_CbnPreset.AddString(s2), 0); - m_nCurrentPreset = 0; m_CbnPreset.SetRedraw(TRUE); m_CbnPreset.SetCurSel(0); m_sbValue.EnableWindow(FALSE); @@ -786,8 +740,6 @@ void CViewGlobals::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar) //--------------------------------------------------------------------------- { -// -> CODE#0028 update#02 -// -> DESC="effect plugin mixing mode combo" CModDoc *pModDoc = GetDocument(); CSoundFile *pSndFile = pModDoc->GetSoundFile(); CHAR s[32]; @@ -814,7 +766,6 @@ pModDoc->SetModified(); } } -// -! BEHAVIOUR_CHANGE#0028 CFormView::OnVScroll(nSBCode, nPos, pScrollBar); } @@ -828,16 +779,15 @@ if ((pModDoc) && (!m_nLockCount)) { CSoundFile *pSndFile = pModDoc->GetSoundFile(); - CHAR s[MAX_CHANNELNAME+4]; + CHAR s[MAX_CHANNELNAME + 2]; const UINT nChn = m_nActiveTab * 4 + chnMod4; - memset(s, 0, sizeof(s)); - GetDlgItemText(itemID, s, sizeof(s)); + MemsetZero(s); + GetDlgItemText(itemID, s, CountOf(s)); s[MAX_CHANNELNAME+1] = 0; - if ((pSndFile->m_nType & (MOD_TYPE_XM|MOD_TYPE_IT|MOD_TYPE_MPT)) && (nChn < pSndFile->m_nChannels) && (strncmp(s, pSndFile->ChnSettings[nChn].szName, MAX_CHANNELNAME))) + if ((pSndFile->GetType() & (MOD_TYPE_XM|MOD_TYPE_IT|MOD_TYPE_MPT)) && (nChn < pSndFile->GetNumChannels()) && (strncmp(s, pSndFile->ChnSettings[nChn].szName, MAX_CHANNELNAME))) { - memcpy(pSndFile->ChnSettings[nChn].szName, s, MAX_CHANNELNAME); - pSndFile->ChnSettings[nChn].szName[CountOf(pSndFile->ChnSettings[nChn].szName)-1] = 0; + mpt::String::Copy(pSndFile->ChnSettings[nChn].szName, s); pModDoc->SetModified(); pModDoc->UpdateAllViews(this, HINT_MODCHANNELS | (m_nActiveTab << HINT_SHIFT_CHNTAB)); } @@ -887,7 +837,7 @@ { CSoundFile *pSndFile = pModDoc->GetSoundFile(); - GetDlgItemText(IDC_EDIT13, s, 32); + GetDlgItemText(IDC_EDIT13, s, CountOf(s)); mpt::String::SetNullTerminator(s); if (strcmp(s, pSndFile->m_MixPlugins[m_nCurrentPlugin].GetName())) { @@ -908,9 +858,6 @@ { m_nCurrentPlugin--; pModDoc->UpdateAllViews(NULL, HINT_MIXPLUGINS | HINT_MODCHANNELS | (m_nActiveTab << HINT_SHIFT_CHNTAB)); -// -> CODE#0014 -// -> DESC="vst wet/dry slider" - //OnWetDryChanged(); } } @@ -924,9 +871,6 @@ { m_nCurrentPlugin++; pModDoc->UpdateAllViews(NULL, HINT_MIXPLUGINS | HINT_MODCHANNELS | (m_nActiveTab << HINT_SHIFT_CHNTAB)); -// -> CODE#0014 -// -> DESC="vst wet/dry slider" - //OnWetDryChanged(); } } @@ -942,16 +886,7 @@ m_nCurrentPlugin = (PLUGINDEX)nPlugin; pModDoc->UpdateAllViews(NULL, HINT_MIXPLUGINS | HINT_MODCHANNELS | (m_nActiveTab << HINT_SHIFT_CHNTAB)); } -// -> CODE#0002 -// -> DESC="VST plugins presets" - m_nCurrentPreset = 0; m_CbnPreset.SetCurSel(0); -// -! NEW_FEATURE#0002 - -// -> CODE#0014 -// -> DESC="vst wet/dry slider" - //OnWetDryChanged(); -// -! NEW_FEATURE#0014 } @@ -972,10 +907,6 @@ } OnPluginChanged(); OnParamChanged(); -// -> CODE#0014 -// -> DESC="vst wet/dry slider" - //OnWetDryChanged(); -// -! NEW_FEATURE#0014 } #endif // NO_VST } @@ -1010,45 +941,39 @@ m_sbValue.SetPos(0); } -// -> CODE#0002 -// -> DESC="VST plugins presets" + void CViewGlobals::OnProgramChanged() //----------------------------------- { - int cursel = m_CbnPreset.GetCurSel(); + VstInt32 cursel = m_CbnPreset.GetItemData(m_CbnPreset.GetCurSel()); CModDoc *pModDoc = GetDocument(); - CSoundFile *pSndFile; if ((m_nCurrentPlugin >= MAX_MIXPLUGINS) || (!pModDoc)) return; - pSndFile = pModDoc->GetSoundFile(); CVstPlugin *pVstPlugin = GetCurrentPlugin(); if(pVstPlugin != nullptr) { - UINT nParams = pVstPlugin->GetNumPrograms(); - if(cursel > 0 && cursel <= (int)nParams) m_nCurrentPreset = cursel; - if(m_nCurrentPreset > 0 && m_nCurrentPreset <= nParams) + VstInt32 nParams = pVstPlugin->GetNumPrograms(); + if(cursel <= nParams) { - pVstPlugin->SetCurrentProgram(m_nCurrentPreset - 1); + pVstPlugin->SetCurrentProgram(m_nCurrentPreset); // Update parameter display OnParamChanged(); } - if(pSndFile->GetModSpecifications().supportsPlugins) + if(pModDoc->GetrSoundFile().GetModSpecifications().supportsPlugins) pModDoc->SetModified(); } } + void CViewGlobals::OnLoadParam() //------------------------------ { CVstPlugin *pVstPlugin = GetCurrentPlugin(); if(pVstPlugin != nullptr && pVstPlugin->LoadProgram()) { - m_nCurrentPreset = 0; - m_CbnPreset.SetRedraw(FALSE); - m_CbnPreset.ResetContent(); - m_CbnPreset.SetItemData(m_CbnPreset.AddString(_T("current")), 0); - m_CbnPreset.SetRedraw(TRUE); + VstInt32 currentProg = pVstPlugin->GetCurrentProgram(); + FillPluginProgramBox(currentProg, currentProg); m_CbnPreset.SetCurSel(0); } } @@ -1091,8 +1016,6 @@ } -// -> CODE#0014 -// -> DESC="vst wet/dry slider" void CViewGlobals::OnSetWetDry() //------------------------------ { @@ -1105,12 +1028,10 @@ if (plugin.pMixPlugin != nullptr) { - //CVstPlugin *pVstPlugin = (CVstPlugin *)pPlugin->pMixPlugin; UINT value = GetDlgItemIntEx(IDC_EDIT15); plugin.fDryRatio = (float)value / 100.0f; if(pSndFile->GetModSpecifications().supportsPlugins) pModDoc->SetModified(); - //OnWetDryChanged(); } } @@ -1147,8 +1068,6 @@ } -// -> CODE#0028 -// -> DESC="effect plugin mixing mode combo" void CViewGlobals::OnWetDryExpandChanged() //---------------------------------------- { @@ -1178,7 +1097,6 @@ if(pSndFile->GetModSpecifications().supportsPlugins) pModDoc->SetModified(); } -// -! BEHAVIOUR_CHANGE#0028 void CViewGlobals::OnDryMixChanged() @@ -1497,17 +1415,23 @@ CVstPlugin *pVstPlugin = GetCurrentPlugin(); if(pVstPlugin == nullptr) return; - UINT nProg = pVstPlugin->GetNumPrograms(); + FillPluginProgramBox(0, pVstPlugin->GetNumPrograms() - 1); + m_CbnPreset.SetCurSel(pVstPlugin->GetCurrentProgram()); +} + + +void CViewGlobals::FillPluginProgramBox(VstInt32 firstProg, VstInt32 lastProg) +//---------------------------------------------------------------------------- +{ + CVstPlugin *pVstPlugin = GetCurrentPlugin(); + m_CbnPreset.SetRedraw(FALSE); m_CbnPreset.ResetContent(); - m_CbnPreset.SetItemData(m_CbnPreset.AddString(_T("current")), 0); - for (UINT i = 0; i < nProg; i++) + for (VstInt32 i = firstProg; i <= lastProg; i++) { - m_CbnPreset.SetItemData(m_CbnPreset.AddString(pVstPlugin->GetFormattedProgramName(i)), i + 1); + m_CbnPreset.SetItemData(m_CbnPreset.AddString(pVstPlugin->GetFormattedProgramName(i)), i); } - m_nCurrentPreset = 0; m_CbnPreset.SetRedraw(TRUE); - m_CbnPreset.SetCurSel(0); } Modified: trunk/OpenMPT/mptrack/View_gen.h =================================================================== --- trunk/OpenMPT/mptrack/View_gen.h 2014-02-09 19:49:49 UTC (rev 3684) +++ trunk/OpenMPT/mptrack/View_gen.h 2014-02-09 21:27:55 UTC (rev 3685) @@ -97,6 +97,8 @@ CVstPlugin *GetCurrentPlugin() const; + void FillPluginProgramBox(VstInt32 firstProg, VstInt32 lastProg); + protected: //{{AFX_MSG(CViewGlobals) afx_msg void OnMute1(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2014-02-10 21:05:31
|
Revision: 3693 http://sourceforge.net/p/modplug/code/3693 Author: saga-games Date: 2014-02-10 21:05:17 +0000 (Mon, 10 Feb 2014) Log Message: ----------- [New] Redo for pattern editor [Imp] Pattern editor undo steps have names that are shown in the undo menu now. Modified Paths: -------------- trunk/OpenMPT/mptrack/CleanupSong.cpp trunk/OpenMPT/mptrack/CommandSet.cpp trunk/OpenMPT/mptrack/CommandSet.h trunk/OpenMPT/mptrack/EffectVis.cpp trunk/OpenMPT/mptrack/InputHandler.cpp trunk/OpenMPT/mptrack/Moddoc.cpp trunk/OpenMPT/mptrack/Moddoc.h trunk/OpenMPT/mptrack/Modedit.cpp trunk/OpenMPT/mptrack/PatternClipboard.cpp trunk/OpenMPT/mptrack/PatternEditorDialogs.cpp trunk/OpenMPT/mptrack/PatternEditorDialogs.h trunk/OpenMPT/mptrack/Undo.cpp trunk/OpenMPT/mptrack/Undo.h trunk/OpenMPT/mptrack/View_pat.cpp trunk/OpenMPT/mptrack/View_pat.h trunk/OpenMPT/mptrack/mptrack.rc trunk/OpenMPT/mptrack/res/defaultKeybindings.mkb trunk/OpenMPT/packageTemplate/extraKeymaps/DE_jojo.mkb Modified: trunk/OpenMPT/mptrack/CleanupSong.cpp =================================================================== --- trunk/OpenMPT/mptrack/CleanupSong.cpp 2014-02-10 19:16:02 UTC (rev 3692) +++ trunk/OpenMPT/mptrack/CleanupSong.cpp 2014-02-10 21:05:17 UTC (rev 3693) @@ -374,7 +374,7 @@ if(!patternUsed[pat] && sndFile.Patterns.IsValidPat(pat)) { numRemovedPatterns++; - modDoc.GetPatternUndo().PrepareUndo(pat, 0, 0, sndFile.GetNumChannels(), sndFile.Patterns[pat].GetNumRows(), numRemovedPatterns != 0, false); + modDoc.GetPatternUndo().PrepareUndo(pat, 0, 0, sndFile.GetNumChannels(), sndFile.Patterns[pat].GetNumRows(), "Remove Unused Patterns", numRemovedPatterns != 0, false); sndFile.Patterns.Remove(pat); } } Modified: trunk/OpenMPT/mptrack/CommandSet.cpp =================================================================== --- trunk/OpenMPT/mptrack/CommandSet.cpp 2014-02-10 19:16:02 UTC (rev 3692) +++ trunk/OpenMPT/mptrack/CommandSet.cpp 2014-02-10 21:05:17 UTC (rev 3693) @@ -653,6 +653,7 @@ DefineKeyCommand(kcClipboardNext, 1902, _T("Cycle to Next Clipboard")); DefineKeyCommand(kcSelectRow, 1903, _T("Select Row")); DefineKeyCommand(kcSelectEvent, 1904, _T("Select Event")); + DefineKeyCommand(kcEditRedo, 1905, _T("Redo")); // Add new key commands here. Modified: trunk/OpenMPT/mptrack/CommandSet.h =================================================================== --- trunk/OpenMPT/mptrack/CommandSet.h 2014-02-10 19:16:02 UTC (rev 3692) +++ trunk/OpenMPT/mptrack/CommandSet.h 2014-02-10 21:05:17 UTC (rev 3693) @@ -100,6 +100,7 @@ kcStartEditCommands, kcEditUndo=kcStartEditCommands, + kcEditRedo, kcEditCut, kcEditCopy, kcEditPaste, Modified: trunk/OpenMPT/mptrack/EffectVis.cpp =================================================================== --- trunk/OpenMPT/mptrack/EffectVis.cpp 2014-02-10 19:16:02 UTC (rev 3692) +++ trunk/OpenMPT/mptrack/EffectVis.cpp 2014-02-10 21:05:17 UTC (rev 3693) @@ -643,7 +643,7 @@ rect.SetRect(x-NODEHALF, y-NODEHALF, x+NODEHALF+1, y+NODEHALF+1); if (rect.PtInRect(point)) { - m_pModDoc->GetPatternUndo().PrepareUndo(static_cast<PATTERNINDEX>(m_nPattern), m_nChan, row, m_nChan+1, row+1); + m_pModDoc->GetPatternUndo().PrepareUndo(static_cast<PATTERNINDEX>(m_nPattern), m_nChan, row, m_nChan + 1, row + 1, "Parameter Editor entry"); m_nDragItem = row; } } @@ -741,7 +741,7 @@ SetFocus(); SetCapture(); - m_pModDoc->GetPatternUndo().PrepareUndo(static_cast<PATTERNINDEX>(m_nPattern), m_nChan, m_startRow, m_nChan+1, m_endRow); + m_pModDoc->GetPatternUndo().PrepareUndo(static_cast<PATTERNINDEX>(m_nPattern), m_nChan, m_startRow, m_nChan + 1, m_endRow + 1, "Parameter Editor entry"); m_dwStatus |= FXVSTATUS_LDRAGGING; } Modified: trunk/OpenMPT/mptrack/InputHandler.cpp =================================================================== --- trunk/OpenMPT/mptrack/InputHandler.cpp 2014-02-10 19:16:02 UTC (rev 3692) +++ trunk/OpenMPT/mptrack/InputHandler.cpp 2014-02-10 21:05:17 UTC (rev 3693) @@ -452,68 +452,69 @@ switch(id) { - case FILENEW: s = _T("&New\t"); c = kcFileNew; break; - case ID_FILE_OPEN: s = _T("&Open...\t"); c = kcFileOpen; break; - case ID_FILE_OPENTEMPLATE: return "Open &Template\t"; - case ID_FILE_CLOSE: s = _T("&Close\t"); c = kcFileClose; break; - case ID_FILE_CLOSEALL: s = _T("C&lose All\t"); c = kcFileCloseAll; break; - case ID_FILE_SAVE: s = _T("&Save\t"); c = kcFileSave; break; - case ID_FILE_SAVE_AS: s = _T("Save &As...\t"); c = kcFileSaveAs; break; - case ID_FILE_SAVEASTEMPLATE:s = _T("Sa&ve as Template\t"); c = kcFileSaveTemplate; break; - case ID_FILE_SAVEASWAVE: s = _T("Export as lossless (&Wave, FLAC)...\t"); c = kcFileSaveAsWave; break; - case ID_FILE_SAVEASMP3: s = _T("Export as lossy (Opus, Vorbis, M&P3)...\t"); c = kcFileSaveAsMP3; break; - case ID_FILE_SAVEMIDI: s = _T("Export as M&IDI...\t"); c = kcFileSaveMidi; break; - case ID_FILE_SAVECOMPAT: s = _T("Compatibility &Export...\t"); c = kcFileExportCompat; break; - case ID_IMPORT_MIDILIB: s = _T("Import &MIDI Library...\t"); c = kcFileImportMidiLib; break; - case ID_ADD_SOUNDBANK: s = _T("Add Sound &Bank...\t"); c = kcFileAddSoundBank; break; + case FILENEW: s = _T("&New"); c = kcFileNew; break; + case ID_FILE_OPEN: s = _T("&Open..."); c = kcFileOpen; break; + case ID_FILE_OPENTEMPLATE: return "Open &Template"; + case ID_FILE_CLOSE: s = _T("&Close"); c = kcFileClose; break; + case ID_FILE_CLOSEALL: s = _T("C&lose All"); c = kcFileCloseAll; break; + case ID_FILE_SAVE: s = _T("&Save"); c = kcFileSave; break; + case ID_FILE_SAVE_AS: s = _T("Save &As..."); c = kcFileSaveAs; break; + case ID_FILE_SAVEASTEMPLATE:s = _T("Sa&ve as Template"); c = kcFileSaveTemplate; break; + case ID_FILE_SAVEASWAVE: s = _T("Export as lossless (&Wave, FLAC)..."); c = kcFileSaveAsWave; break; + case ID_FILE_SAVEASMP3: s = _T("Export as lossy (Opus, Vorbis, M&P3)..."); c = kcFileSaveAsMP3; break; + case ID_FILE_SAVEMIDI: s = _T("Export as M&IDI..."); c = kcFileSaveMidi; break; + case ID_FILE_SAVECOMPAT: s = _T("Compatibility &Export..."); c = kcFileExportCompat; break; + case ID_IMPORT_MIDILIB: s = _T("Import &MIDI Library..."); c = kcFileImportMidiLib; break; + case ID_ADD_SOUNDBANK: s = _T("Add Sound &Bank..."); c = kcFileAddSoundBank; break; - case ID_PLAYER_PLAY: s = _T("Pause / &Resume\t"); c = kcPlayPauseSong; break; - case ID_PLAYER_PLAYFROMSTART: s = _T("&Play from Start\t"); c = kcPlaySongFromStart; break; - case ID_PLAYER_STOP: s = _T("&Stop\t"); c = kcStopSong; break; - case ID_PLAYER_PAUSE: s = _T("P&ause\t"); c = kcPauseSong; break; - case ID_MIDI_RECORD: s = _T("&MIDI Record\t"); c = kcMidiRecord; break; - case ID_ESTIMATESONGLENGTH: s = _T("&Estimate Song Length\t"); c = kcEstimateSongLength; break; - case ID_APPROX_BPM: s = _T("Approx. real &BPM\t"); c = kcApproxRealBPM; break; + case ID_PLAYER_PLAY: s = _T("Pause / &Resume"); c = kcPlayPauseSong; break; + case ID_PLAYER_PLAYFROMSTART: s = _T("&Play from Start"); c = kcPlaySongFromStart; break; + case ID_PLAYER_STOP: s = _T("&Stop"); c = kcStopSong; break; + case ID_PLAYER_PAUSE: s = _T("P&ause"); c = kcPauseSong; break; + case ID_MIDI_RECORD: s = _T("&MIDI Record"); c = kcMidiRecord; break; + case ID_ESTIMATESONGLENGTH: s = _T("&Estimate Song Length"); c = kcEstimateSongLength; break; + case ID_APPROX_BPM: s = _T("Approx. real &BPM"); c = kcApproxRealBPM; break; - case ID_EDIT_UNDO: s = _T("&Undo\t"); c = kcEditUndo; break; - case ID_EDIT_CUT: s = _T("Cu&t\t"); c = kcEditCut; break; - case ID_EDIT_COPY: s = _T("&Copy\t"); c = kcEditCopy; break; - case ID_EDIT_PASTE: s = _T("&Paste\t"); c = kcEditPaste; break; - case ID_EDIT_SELECT_ALL: s = _T("Select &All\t"); c = kcEditSelectAll; break; + case ID_EDIT_UNDO: s = _T("&Undo"); c = kcEditUndo; break; + case ID_EDIT_REDO: s = _T("&Redo"); c = kcEditRedo; break; + case ID_EDIT_CUT: s = _T("Cu&t"); c = kcEditCut; break; + case ID_EDIT_COPY: s = _T("&Copy"); c = kcEditCopy; break; + case ID_EDIT_PASTE: s = _T("&Paste"); c = kcEditPaste; break; + case ID_EDIT_SELECT_ALL: s = _T("Select &All"); c = kcEditSelectAll; break; case ID_EDIT_CLEANUP: s = _T("C&leanup"); break; - case ID_EDIT_FIND: s = _T("&Find / Replace\t"); c = kcEditFind; break; - case ID_EDIT_FINDNEXT: s = _T("Find &Next\t"); c = kcEditFindNext; break; - case ID_EDIT_GOTO_MENU: s = _T("&Goto\t"); c = kcPatternGoto; break; - case ID_EDIT_SPLITKEYBOARDSETTINGS: s = _T("Split &Keyboard Settings\t"); c = kcShowSplitKeyboardSettings; break; + case ID_EDIT_FIND: s = _T("&Find / Replace"); c = kcEditFind; break; + case ID_EDIT_FINDNEXT: s = _T("Find &Next"); c = kcEditFindNext; break; + case ID_EDIT_GOTO_MENU: s = _T("&Goto"); c = kcPatternGoto; break; + case ID_EDIT_SPLITKEYBOARDSETTINGS: s = _T("Split &Keyboard Settings"); c = kcShowSplitKeyboardSettings; break; // "Paste Special" sub menu - case ID_EDIT_PASTE_SPECIAL: s = _T("&Mix Paste\t"); c = kcEditMixPaste; break; - case ID_EDIT_MIXPASTE_ITSTYLE: s = _T("M&ix Paste (IT Style)\t"); c = kcEditMixPasteITStyle; break; - case ID_EDIT_PASTEFLOOD: s = _T("Paste Fl&ood\t"); c = kcEditPasteFlood; break; - case ID_EDIT_PUSHFORWARDPASTE: s = _T("&Push Forward Paste (Insert)\t"); c = kcEditPushForwardPaste; break; + case ID_EDIT_PASTE_SPECIAL: s = _T("&Mix Paste"); c = kcEditMixPaste; break; + case ID_EDIT_MIXPASTE_ITSTYLE: s = _T("M&ix Paste (IT Style)"); c = kcEditMixPasteITStyle; break; + case ID_EDIT_PASTEFLOOD: s = _T("Paste Fl&ood"); c = kcEditPasteFlood; break; + case ID_EDIT_PUSHFORWARDPASTE: s = _T("&Push Forward Paste (Insert)"); c = kcEditPushForwardPaste; break; - case ID_VIEW_GLOBALS: s = _T("&General\t"); c = kcViewGeneral; break; - case ID_VIEW_SAMPLES: s = _T("&Samples\t"); c = kcViewSamples; break; - case ID_VIEW_PATTERNS: s = _T("&Patterns\t"); c = kcViewPattern; break; - case ID_VIEW_INSTRUMENTS: s = _T("&Instruments\t"); c = kcViewInstruments; break; - case ID_VIEW_COMMENTS: s = _T("&Comments\t"); c = kcViewComments; break; - case ID_VIEW_GRAPH: s = _T("G&raph\t"); c = kcViewGraph; break; //rewbs.graph - case MAINVIEW: s = _T("&Main\t"); c = kcViewMain; break; - case IDD_TREEVIEW: s = _T("&Tree\t"); c = kcViewTree; break; - case ID_VIEW_OPTIONS: s = _T("S&etup...\t"); c = kcViewOptions; break; - case ID_HELP: s = _T("&Help"); c = kcHelp; break; - case ID_PLUGIN_SETUP: s = _T("Pl&ugin Manager...\t"); c = kcViewAddPlugin; break; - case ID_CHANNEL_MANAGER: s = _T("Ch&annel Manager...\t"); c = kcViewChannelManager; break; - case ID_CLIPBOARD_MANAGER: s = _T("C&lipboard Manager...\t"); c = kcToggleClipboardManager; break; - case ID_VIEW_SONGPROPERTIES:s = _T("Song P&roperties...\t"); c = kcViewSongProperties; break; //rewbs.graph - case ID_VIEW_MIDIMAPPING: s = _T("&MIDI Mapping...\t"); c = kcViewMIDImapping; break; - case ID_VIEW_EDITHISTORY: s = _T("Edit &History...\t"); c = kcViewEditHistory; break; + case ID_VIEW_GLOBALS: s = _T("&General"); c = kcViewGeneral; break; + case ID_VIEW_SAMPLES: s = _T("&Samples"); c = kcViewSamples; break; + case ID_VIEW_PATTERNS: s = _T("&Patterns"); c = kcViewPattern; break; + case ID_VIEW_INSTRUMENTS: s = _T("&Instruments"); c = kcViewInstruments; break; + case ID_VIEW_COMMENTS: s = _T("&Comments"); c = kcViewComments; break; + case ID_VIEW_GRAPH: s = _T("G&raph"); c = kcViewGraph; break; //rewbs.graph + case MAINVIEW: s = _T("&Main"); c = kcViewMain; break; + case IDD_TREEVIEW: s = _T("&Tree"); c = kcViewTree; break; + case ID_VIEW_OPTIONS: s = _T("S&etup..."); c = kcViewOptions; break; + case ID_HELPSHOW: s = _T("&Help..."); c = kcHelp; break; + case ID_PLUGIN_SETUP: s = _T("Pl&ugin Manager..."); c = kcViewAddPlugin; break; + case ID_CHANNEL_MANAGER: s = _T("Ch&annel Manager..."); c = kcViewChannelManager; break; + case ID_CLIPBOARD_MANAGER: s = _T("C&lipboard Manager..."); c = kcToggleClipboardManager; break; + case ID_VIEW_SONGPROPERTIES:s = _T("Song P&roperties..."); c = kcViewSongProperties; break; //rewbs.graph + case ID_VIEW_MIDIMAPPING: s = _T("&MIDI Mapping..."); c = kcViewMIDImapping; break; + case ID_VIEW_EDITHISTORY: s = _T("Edit &History..."); c = kcViewEditHistory; break; // Help submenu: - case ID_EXAMPLE_MODULES: return _T("&Example Modules\t"); + case ID_EXAMPLE_MODULES: return _T("&Example Modules"); default: return _T("Unknown Item."); } - return s + GetKeyTextFromCommand(c); + return s + CString(_T("\t")) + GetKeyTextFromCommand(c); } @@ -523,55 +524,57 @@ CMenu *pMenu = (CMainFrame::GetMainFrame())->GetMenu(); if (!pMenu) return; +#define UPDATEMENU(id) pMenu->ModifyMenu(id, MF_BYCOMMAND | MF_STRING, id, GetMenuText(id)); pMenu->GetSubMenu(0)->ModifyMenu(0, MF_BYPOSITION | MF_STRING, 0, GetMenuText(FILENEW)); - pMenu->ModifyMenu(ID_FILE_OPEN, MF_BYCOMMAND | MF_STRING, ID_FILE_OPEN, GetMenuText(ID_FILE_OPEN)); - pMenu->ModifyMenu(ID_FILE_CLOSE, MF_BYCOMMAND | MF_STRING, ID_FILE_CLOSE, GetMenuText(ID_FILE_CLOSE)); - pMenu->ModifyMenu(ID_FILE_SAVE, MF_BYCOMMAND | MF_STRING, ID_FILE_SAVE, GetMenuText(ID_FILE_SAVE)); - pMenu->ModifyMenu(ID_FILE_SAVE_AS, MF_BYCOMMAND | MF_STRING, ID_FILE_SAVE_AS, GetMenuText(ID_FILE_SAVE_AS)); - 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)); + UPDATEMENU(ID_FILE_OPEN); + UPDATEMENU(ID_FILE_CLOSE); + UPDATEMENU(ID_FILE_SAVE); + UPDATEMENU(ID_FILE_SAVE_AS); + UPDATEMENU(ID_FILE_SAVEASWAVE); + UPDATEMENU(ID_FILE_SAVEASMP3); + UPDATEMENU(ID_FILE_SAVEMIDI); + UPDATEMENU(ID_FILE_SAVECOMPAT); + UPDATEMENU(ID_IMPORT_MIDILIB); + UPDATEMENU(ID_ADD_SOUNDBANK); - pMenu->ModifyMenu(ID_PLAYER_PLAY, MF_BYCOMMAND | MF_STRING, ID_PLAYER_PLAY, GetMenuText(ID_PLAYER_PLAY)); - pMenu->ModifyMenu(ID_PLAYER_PLAYFROMSTART, MF_BYCOMMAND | MF_STRING, ID_PLAYER_PLAYFROMSTART, GetMenuText(ID_PLAYER_PLAYFROMSTART)); - pMenu->ModifyMenu(ID_PLAYER_STOP, MF_BYCOMMAND | MF_STRING, ID_PLAYER_STOP, GetMenuText(ID_PLAYER_STOP)); - pMenu->ModifyMenu(ID_PLAYER_PAUSE, MF_BYCOMMAND | MF_STRING, ID_PLAYER_PAUSE, GetMenuText(ID_PLAYER_PAUSE)); - pMenu->ModifyMenu(ID_MIDI_RECORD, MF_BYCOMMAND | MF_STRING, ID_MIDI_RECORD, GetMenuText(ID_MIDI_RECORD)); - pMenu->ModifyMenu(ID_ESTIMATESONGLENGTH, MF_BYCOMMAND | MF_STRING, ID_ESTIMATESONGLENGTH, GetMenuText(ID_ESTIMATESONGLENGTH)); - pMenu->ModifyMenu(ID_APPROX_BPM, MF_BYCOMMAND | MF_STRING, ID_APPROX_BPM, GetMenuText(ID_APPROX_BPM)); + UPDATEMENU(ID_PLAYER_PLAY); + UPDATEMENU(ID_PLAYER_PLAYFROMSTART); + UPDATEMENU(ID_PLAYER_STOP); + UPDATEMENU(ID_PLAYER_PAUSE); + UPDATEMENU(ID_MIDI_RECORD); + UPDATEMENU(ID_ESTIMATESONGLENGTH); + UPDATEMENU(ID_APPROX_BPM); + UPDATEMENU(ID_EDIT_UNDO); + UPDATEMENU(ID_EDIT_REDO); + UPDATEMENU(ID_EDIT_CUT); + UPDATEMENU(ID_EDIT_COPY); + UPDATEMENU(ID_EDIT_PASTE); + UPDATEMENU(ID_EDIT_PASTE_SPECIAL); + UPDATEMENU(ID_EDIT_MIXPASTE_ITSTYLE); + UPDATEMENU(ID_EDIT_PASTEFLOOD); + UPDATEMENU(ID_EDIT_PUSHFORWARDPASTE); + UPDATEMENU(ID_EDIT_SELECT_ALL); + UPDATEMENU(ID_EDIT_FIND); + UPDATEMENU(ID_EDIT_FINDNEXT); + UPDATEMENU(ID_EDIT_GOTO_MENU); + UPDATEMENU(ID_EDIT_SPLITKEYBOARDSETTINGS); - pMenu->ModifyMenu(ID_EDIT_UNDO, MF_BYCOMMAND | MF_STRING, ID_EDIT_UNDO, GetMenuText(ID_EDIT_UNDO)); - pMenu->ModifyMenu(ID_EDIT_CUT, MF_BYCOMMAND | MF_STRING, ID_EDIT_CUT, GetMenuText(ID_EDIT_CUT)); - pMenu->ModifyMenu(ID_EDIT_COPY, MF_BYCOMMAND | MF_STRING, ID_EDIT_COPY, GetMenuText(ID_EDIT_COPY)); - pMenu->ModifyMenu(ID_EDIT_PASTE, MF_BYCOMMAND | MF_STRING, ID_EDIT_PASTE, GetMenuText(ID_EDIT_PASTE)); - pMenu->ModifyMenu(ID_EDIT_PASTE_SPECIAL, MF_BYCOMMAND | MF_STRING, ID_EDIT_PASTE_SPECIAL, GetMenuText(ID_EDIT_PASTE_SPECIAL)); - pMenu->ModifyMenu(ID_EDIT_MIXPASTE_ITSTYLE, MF_BYCOMMAND | MF_STRING, ID_EDIT_MIXPASTE_ITSTYLE, GetMenuText(ID_EDIT_MIXPASTE_ITSTYLE)); - pMenu->ModifyMenu(ID_EDIT_PASTEFLOOD, MF_BYCOMMAND | MF_STRING, ID_EDIT_PASTEFLOOD, GetMenuText(ID_EDIT_PASTEFLOOD)); - pMenu->ModifyMenu(ID_EDIT_PUSHFORWARDPASTE, MF_BYCOMMAND | MF_STRING, ID_EDIT_PUSHFORWARDPASTE, GetMenuText(ID_EDIT_PUSHFORWARDPASTE)); - pMenu->ModifyMenu(ID_EDIT_SELECT_ALL, MF_BYCOMMAND | MF_STRING, ID_EDIT_SELECT_ALL, GetMenuText(ID_EDIT_SELECT_ALL)); - pMenu->ModifyMenu(ID_EDIT_FIND, MF_BYCOMMAND | MF_STRING, ID_EDIT_FIND, GetMenuText(ID_EDIT_FIND)); - pMenu->ModifyMenu(ID_EDIT_FINDNEXT, MF_BYCOMMAND | MF_STRING, ID_EDIT_FINDNEXT, GetMenuText(ID_EDIT_FINDNEXT)); - pMenu->ModifyMenu(ID_EDIT_GOTO_MENU, MF_BYCOMMAND | MF_STRING, ID_EDIT_GOTO_MENU, GetMenuText(ID_EDIT_GOTO_MENU)); - pMenu->ModifyMenu(ID_EDIT_SPLITKEYBOARDSETTINGS, MF_BYCOMMAND | MF_STRING, ID_EDIT_SPLITKEYBOARDSETTINGS, GetMenuText(ID_EDIT_SPLITKEYBOARDSETTINGS)); - - pMenu->ModifyMenu(ID_VIEW_GLOBALS, MF_BYCOMMAND | MF_STRING, ID_VIEW_GLOBALS, GetMenuText(ID_VIEW_GLOBALS)); - pMenu->ModifyMenu(ID_VIEW_SAMPLES, MF_BYCOMMAND | MF_STRING, ID_VIEW_SAMPLES, GetMenuText(ID_VIEW_SAMPLES)); - pMenu->ModifyMenu(ID_VIEW_PATTERNS, MF_BYCOMMAND | MF_STRING, ID_VIEW_PATTERNS, GetMenuText(ID_VIEW_PATTERNS)); - pMenu->ModifyMenu(ID_VIEW_INSTRUMENTS, MF_BYCOMMAND | MF_STRING, ID_VIEW_INSTRUMENTS, GetMenuText(ID_VIEW_INSTRUMENTS)); - pMenu->ModifyMenu(ID_VIEW_COMMENTS, MF_BYCOMMAND | MF_STRING, ID_VIEW_COMMENTS, GetMenuText(ID_VIEW_COMMENTS)); - pMenu->ModifyMenu(MAINVIEW, MF_BYCOMMAND | MF_STRING, MAINVIEW, GetMenuText(MAINVIEW)); - pMenu->ModifyMenu(IDD_TREEVIEW, MF_BYCOMMAND | MF_STRING, IDD_TREEVIEW, GetMenuText(IDD_TREEVIEW)); - pMenu->ModifyMenu(ID_VIEW_OPTIONS, MF_BYCOMMAND | MF_STRING, ID_VIEW_OPTIONS, GetMenuText(ID_VIEW_OPTIONS)); - pMenu->ModifyMenu(ID_PLUGIN_SETUP, MF_BYCOMMAND | MF_STRING, ID_PLUGIN_SETUP, GetMenuText(ID_PLUGIN_SETUP)); - pMenu->ModifyMenu(ID_CHANNEL_MANAGER, MF_BYCOMMAND | MF_STRING, ID_CHANNEL_MANAGER, GetMenuText(ID_CHANNEL_MANAGER)); - pMenu->ModifyMenu(ID_CLIPBOARD_MANAGER, MF_BYCOMMAND | MF_STRING, ID_CLIPBOARD_MANAGER, GetMenuText(ID_CLIPBOARD_MANAGER)); - pMenu->ModifyMenu(ID_VIEW_SONGPROPERTIES, MF_BYCOMMAND | MF_STRING, ID_VIEW_SONGPROPERTIES, GetMenuText(ID_VIEW_SONGPROPERTIES)); - pMenu->ModifyMenu(ID_VIEW_MIDIMAPPING, MF_BYCOMMAND | MF_STRING, ID_VIEW_MIDIMAPPING, GetMenuText(ID_VIEW_MIDIMAPPING)); - pMenu->ModifyMenu(ID_HELP, MF_BYCOMMAND | MF_STRING, ID_HELP, GetMenuText(ID_HELP)); + UPDATEMENU(ID_VIEW_GLOBALS); + UPDATEMENU(ID_VIEW_SAMPLES); + UPDATEMENU(ID_VIEW_PATTERNS); + UPDATEMENU(ID_VIEW_INSTRUMENTS); + UPDATEMENU(ID_VIEW_COMMENTS); + UPDATEMENU(MAINVIEW); + UPDATEMENU(IDD_TREEVIEW); + UPDATEMENU(ID_VIEW_OPTIONS); + UPDATEMENU(ID_PLUGIN_SETUP); + UPDATEMENU(ID_CHANNEL_MANAGER); + UPDATEMENU(ID_CLIPBOARD_MANAGER); + UPDATEMENU(ID_VIEW_SONGPROPERTIES); + UPDATEMENU(ID_VIEW_MIDIMAPPING); + UPDATEMENU(ID_HELPSHOW); +#undef UPDATEMENU } Modified: trunk/OpenMPT/mptrack/Moddoc.cpp =================================================================== --- trunk/OpenMPT/mptrack/Moddoc.cpp 2014-02-10 19:16:02 UTC (rev 3692) +++ trunk/OpenMPT/mptrack/Moddoc.cpp 2014-02-10 21:05:17 UTC (rev 3693) @@ -190,14 +190,10 @@ } theApp.GetDefaultMidiMacro(m_SndFile.m_MidiCfg); - if (m_SndFile.m_nType & (MOD_TYPE_XM | MOD_TYPE_IT | MOD_TYPE_MPT)) + m_SndFile.m_SongFlags.set(SONG_LINEARSLIDES & m_SndFile.GetModSpecifications().songFlags); + if(!m_SndFile.m_MidiCfg.IsMacroDefaultSetupUsed()) { - m_SndFile.m_SongFlags.set(SONG_LINEARSLIDES); - - if(!m_SndFile.m_MidiCfg.IsMacroDefaultSetupUsed()) - { - m_SndFile.m_SongFlags.set(SONG_EMBEDMIDICFG); - } + m_SndFile.m_SongFlags.set(SONG_EMBEDMIDICFG & m_SndFile.GetModSpecifications().songFlags); } @@ -1579,17 +1575,16 @@ } -UINT CModDoc::FindInstrumentChild(UINT nIns) const -//------------------------------------------------ +SAMPLEINDEX CModDoc::FindInstrumentChild(INSTRUMENTINDEX nIns) const +//------------------------------------------------------------------ { - ModInstrument *pIns; if ((!nIns) || (nIns > m_SndFile.GetNumInstruments())) return 0; - pIns = m_SndFile.Instruments[nIns]; + const ModInstrument *pIns = m_SndFile.Instruments[nIns]; if (pIns) { - for (UINT i=0; i<NOTE_MAX; i++) + for (size_t i = 0; i < CountOf(pIns->Keyboard); i++) { - UINT n = pIns->Keyboard[i]; + SAMPLEINDEX n = pIns->Keyboard[i]; if ((n) && (n <= m_SndFile.GetNumSamples())) return n; } } @@ -1850,7 +1845,7 @@ m_SndFile.SetRepeatCount(oldRepeat); m_SndFile.SetCurrentPos(pos); - CMainFrame::UpdateAudioParameters(m_SndFile, TRUE); + CMainFrame::UpdateAudioParameters(m_SndFile, true); } @@ -2933,15 +2928,15 @@ // Create an undo point that stores undo data for all existing patterns -void CModDoc::PrepareUndoForAllPatterns(bool storeChannelInfo) -//------------------------------------------------------------ +void CModDoc::PrepareUndoForAllPatterns(bool storeChannelInfo, const char *description) +//------------------------------------------------------------------------------------- { bool linkUndo = false; for(PATTERNINDEX pat = 0; pat < m_SndFile.Patterns.Size(); pat++) { if(m_SndFile.Patterns.IsValidPat(pat)) { - GetPatternUndo().PrepareUndo(pat, 0, 0, GetNumChannels(), m_SndFile.Patterns[pat].GetNumRows(), linkUndo, storeChannelInfo); + GetPatternUndo().PrepareUndo(pat, 0, 0, GetNumChannels(), m_SndFile.Patterns[pat].GetNumRows(), description, linkUndo, storeChannelInfo); linkUndo = true; storeChannelInfo = false; } Modified: trunk/OpenMPT/mptrack/Moddoc.h =================================================================== --- trunk/OpenMPT/mptrack/Moddoc.h 2014-02-10 19:16:02 UTC (rev 3692) +++ trunk/OpenMPT/mptrack/Moddoc.h 2014-02-10 21:05:17 UTC (rev 3693) @@ -244,7 +244,7 @@ void SongProperties(); - void PrepareUndoForAllPatterns(bool storeChannelInfo = false); + void PrepareUndoForAllPatterns(bool storeChannelInfo = false, const char *description = ""); CPatternUndo &GetPatternUndo() { return m_PatternUndo; } CSampleUndo &GetSampleUndo() { return m_SampleUndo; } SplitKeyboardSettings &GetSplitKeyboardSettings() { return m_SplitKeyboardSettings; } @@ -310,7 +310,7 @@ UINT GetPatternSize(PATTERNINDEX nPat) const; bool IsChildSample(INSTRUMENTINDEX nIns, SAMPLEINDEX nSmp) const; INSTRUMENTINDEX FindSampleParent(SAMPLEINDEX sample) const; - UINT FindInstrumentChild(UINT nIns) const; + SAMPLEINDEX FindInstrumentChild(INSTRUMENTINDEX nIns) const; bool MoveOrder(ORDERINDEX nSourceNdx, ORDERINDEX nDestNdx, bool bUpdate = true, bool bCopy = false, SEQUENCEINDEX nSourceSeq = SEQUENCEINDEX_INVALID, SEQUENCEINDEX nDestSeq = SEQUENCEINDEX_INVALID); BOOL ExpandPattern(PATTERNINDEX nPattern); BOOL ShrinkPattern(PATTERNINDEX nPattern); Modified: trunk/OpenMPT/mptrack/Modedit.cpp =================================================================== --- trunk/OpenMPT/mptrack/Modedit.cpp 2014-02-10 19:16:02 UTC (rev 3692) +++ trunk/OpenMPT/mptrack/Modedit.cpp 2014-02-10 21:05:17 UTC (rev 3693) @@ -163,7 +163,7 @@ CriticalSection cs; if(createUndoPoint) { - PrepareUndoForAllPatterns(true); + PrepareUndoForAllPatterns(true, "Rearrange Channels"); } for(PATTERNINDEX nPat = 0; nPat < m_SndFile.Patterns.Size(); nPat++) @@ -367,7 +367,7 @@ } } else { - PrepareUndoForAllPatterns(); + PrepareUndoForAllPatterns("Rearrange Samples"); std::vector<ModCommand::INSTR> indices(newIndex.size(), 0); for(size_t i = 0; i < newIndex.size(); i++) @@ -443,7 +443,7 @@ m_SndFile.DestroyInstrument(i, doNoDeleteAssociatedSamples); } - PrepareUndoForAllPatterns(); + PrepareUndoForAllPatterns("Rearrange Instrumens"); std::vector<ModCommand::INSTR> indices(newIndex.size(), 0); for(size_t i = 0; i < newIndex.size(); i++) @@ -879,7 +879,7 @@ BeginWaitCursor(); CriticalSection cs; - GetPatternUndo().PrepareUndo(nPattern, 0, 0, GetNumChannels(), numRows); + GetPatternUndo().PrepareUndo(nPattern, 0, 0, GetNumChannels(), numRows, "Expand Pattern"); bool success = m_SndFile.Patterns[nPattern].Expand(); cs.Leave(); EndWaitCursor(); @@ -909,7 +909,7 @@ BeginWaitCursor(); CriticalSection cs; - GetPatternUndo().PrepareUndo(nPattern, 0, 0, GetNumChannels(), numRows); + GetPatternUndo().PrepareUndo(nPattern, 0, 0, GetNumChannels(), numRows, "Shrink Pattern"); bool success = m_SndFile.Patterns[nPattern].Shrink(); cs.Leave(); EndWaitCursor(); Modified: trunk/OpenMPT/mptrack/PatternClipboard.cpp =================================================================== --- trunk/OpenMPT/mptrack/PatternClipboard.cpp 2014-02-10 19:16:02 UTC (rev 3692) +++ trunk/OpenMPT/mptrack/PatternClipboard.cpp 2014-02-10 21:05:17 UTC (rev 3693) @@ -545,7 +545,7 @@ // Before changing anything in this pattern, we have to create an undo point. if(prepareUndo) { - modDoc.GetPatternUndo().PrepareUndo(pattern, startChan, startRow, sndFile.GetNumChannels(), sndFile.Patterns[pattern].GetNumRows(), !firstUndo); + modDoc.GetPatternUndo().PrepareUndo(pattern, startChan, startRow, sndFile.GetNumChannels(), sndFile.Patterns[pattern].GetNumRows(), "Paste", !firstUndo); prepareUndo = false; firstUndo = false; } Modified: trunk/OpenMPT/mptrack/PatternEditorDialogs.cpp =================================================================== --- trunk/OpenMPT/mptrack/PatternEditorDialogs.cpp 2014-02-10 19:16:02 UTC (rev 3692) +++ trunk/OpenMPT/mptrack/PatternEditorDialogs.cpp 2014-02-10 21:05:17 UTC (rev 3693) @@ -585,8 +585,8 @@ if(resize) { - modDoc.GetPatternUndo().PrepareUndo(m_nPattern, 0, 0, sndFile.Patterns[m_nPattern].GetNumChannels(), sndFile.Patterns[m_nPattern].GetNumRows()); modDoc.BeginWaitCursor(); + modDoc.GetPatternUndo().PrepareUndo(m_nPattern, 0, 0, sndFile.Patterns[m_nPattern].GetNumChannels(), sndFile.Patterns[m_nPattern].GetNumRows(), "Resize"); if(sndFile.Patterns[m_nPattern].Resize(newSize)) { modDoc.SetModified(); @@ -926,7 +926,7 @@ if(m->note != newNote || m->instr != newInstr) { - PrepareUndo(); + PrepareUndo("Note Entry"); CModDoc *modDoc = sndFile.GetpModDoc(); m->note = newNote; m->instr = newInstr; @@ -971,7 +971,7 @@ const bool volCmdChanged = m->volcmd != newVolCmd; if(volCmdChanged || m->vol != newVol) { - PrepareUndo(); + PrepareUndo("Volume Entry"); CModDoc *modDoc = sndFile.GetpModDoc(); m->volcmd = newVolCmd; m->vol = newVol; @@ -1023,7 +1023,7 @@ if((!m->IsPcNote() && (m->command != newCommand || m->param != newParam)) || (m->IsPcNote() && m->GetValueVolCol() != newPlugParam)) { - PrepareUndo(); + PrepareUndo("Effect Entry"); CModDoc *modDoc = sndFile.GetpModDoc(); if(m->IsPcNote()) { @@ -1073,7 +1073,7 @@ if((!m->IsPcNote() && m->param != newParam) || (m->IsPcNote() && m->GetValueVolCol() != newPlugParam)) { - PrepareUndo(); + PrepareUndo("Effect Entry"); CModDoc *modDoc = sndFile.GetpModDoc(); if(m->IsPcNote()) { @@ -1089,14 +1089,14 @@ } -void CEditCommand::PrepareUndo() -//------------------------------ +void CEditCommand::PrepareUndo(const char *description) +//----------------------------------------------------- { CModDoc *modDoc = sndFile.GetpModDoc(); if(!modified) { // Let's create just one undo step. - modDoc->GetPatternUndo().PrepareUndo(editPos.pattern, editPos.channel, editPos.row, 1, 1); + modDoc->GetPatternUndo().PrepareUndo(editPos.pattern, editPos.channel, editPos.row, 1, 1, description); modified = true; } modDoc->SetModified(); @@ -1576,7 +1576,7 @@ { // Backup old channel settings through pattern undo. settingsChanged = true; - document->GetPatternUndo().PrepareUndo(pattern, 0, 0, 1, 1, false, true); + document->GetPatternUndo().PrepareUndo(pattern, 0, 0, 1, 1, "Channel Settings", false, true); } } Modified: trunk/OpenMPT/mptrack/PatternEditorDialogs.h =================================================================== --- trunk/OpenMPT/mptrack/PatternEditorDialogs.h 2014-02-10 19:16:02 UTC (rev 3692) +++ trunk/OpenMPT/mptrack/PatternEditorDialogs.h 2014-02-10 21:05:17 UTC (rev 3693) @@ -144,7 +144,7 @@ void UpdateEffectRange(bool set); void UpdateEffectValue(bool set); - void PrepareUndo(); + void PrepareUndo(const char *description); //{{AFX_VIRTUAL(CEditCommand) virtual void DoDataExchange(CDataExchange* pDX); Modified: trunk/OpenMPT/mptrack/Undo.cpp =================================================================== --- trunk/OpenMPT/mptrack/Undo.cpp 2014-02-10 19:16:02 UTC (rev 3692) +++ trunk/OpenMPT/mptrack/Undo.cpp 2014-02-10 21:05:17 UTC (rev 3693) @@ -26,10 +26,20 @@ void CPatternUndo::ClearUndo() //---------------------------- { - while(UndoBuffer.size() > 0) + ClearBuffer(UndoBuffer); + ClearBuffer(RedoBuffer); +} + + +bool CPatternUndo::PrepareUndo(PATTERNINDEX pattern, CHANNELINDEX firstChn, ROWINDEX firstRow, CHANNELINDEX numChns, ROWINDEX numRows, const char *description, bool linkToPrevious, bool storeChannelInfo) +//--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +{ + if(PrepareUndo(UndoBuffer, pattern, firstChn, firstRow, numChns, numRows, description, linkToPrevious, storeChannelInfo)) { - DeleteUndoStep(0); + ClearBuffer(RedoBuffer); + return true; } + return false; } @@ -40,44 +50,40 @@ // - firstRow: first row, 0-based. // - numChns: width // - numRows: height -// - linkToPrevious: Don't create a separate undo step, but link this to the previous undo event. Useful for commands that modify several patterns at once. +// - description: Short description text of action for undo menu. +// - linkToPrevious: Don't create a separate undo step, but link this to the previous undo event. Use this for commands that modify several patterns at once. // - storeChannelInfo: Also store current channel header information (pan / volume / etc. settings) and number of channels in this undo point. -bool CPatternUndo::PrepareUndo(PATTERNINDEX pattern, CHANNELINDEX firstChn, ROWINDEX firstRow, CHANNELINDEX numChns, ROWINDEX numRows, bool linkToPrevious, bool storeChannelInfo) -//-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +bool CPatternUndo::PrepareUndo(undobuf_t &buffer, PATTERNINDEX pattern, CHANNELINDEX firstChn, ROWINDEX firstRow, CHANNELINDEX numChns, ROWINDEX numRows, const char *description, bool linkToPrevious, bool storeChannelInfo) +//---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- { - CSoundFile &sndFile = modDoc.GetrSoundFile(); + const CSoundFile &sndFile = modDoc.GetrSoundFile(); - UndoInfo sUndo; - ModCommand *pUndoData, *pPattern; - ROWINDEX nRows; - if (!sndFile.Patterns.IsValidPat(pattern)) return false; - nRows = sndFile.Patterns[pattern].GetNumRows(); - pPattern = sndFile.Patterns[pattern]; + ROWINDEX nRows = sndFile.Patterns[pattern].GetNumRows(); if ((firstRow >= nRows) || (numChns < 1) || (numRows < 1) || (firstChn >= sndFile.GetNumChannels())) return false; if (firstRow + numRows >= nRows) numRows = nRows - firstRow; if (firstChn + numChns >= sndFile.GetNumChannels()) numChns = sndFile.GetNumChannels() - firstChn; - pUndoData = CPattern::AllocatePattern(numRows, numChns); + ModCommand *pUndoData = CPattern::AllocatePattern(numRows, numChns); if (!pUndoData) return false; - const bool updateView = !CanUndo(); // update undo status? - // Remove an undo step if there are too many. - while(UndoBuffer.size() >= MAX_UNDO_LEVEL) + while(buffer.size() >= MAX_UNDO_LEVEL) { - DeleteUndoStep(0); + DeleteUndoStep(buffer, 0); } + UndoInfo sUndo; sUndo.pattern = pattern; - sUndo.patternsize = sndFile.Patterns[pattern].GetNumRows(); + sUndo.numPatternRows = sndFile.Patterns[pattern].GetNumRows(); sUndo.firstChannel = firstChn; sUndo.firstRow = firstRow; sUndo.numChannels = numChns; sUndo.numRows = numRows; sUndo.pbuffer = pUndoData; sUndo.linkToPrevious = linkToPrevious; - pPattern += firstChn + firstRow * sndFile.GetNumChannels(); + sUndo.description = description; + const ModCommand *pPattern = sndFile.Patterns[pattern].GetpModCommand(firstRow, firstChn); for(ROWINDEX iy = 0; iy < numRows; iy++) { memcpy(pUndoData, pPattern, numChns * sizeof(ModCommand)); @@ -87,16 +93,16 @@ if(storeChannelInfo) { - sUndo.channelInfo = new ChannelInfo(sndFile.GetNumChannels()); + sUndo.channelInfo = new UndoInfo::ChannelInfo(sndFile.GetNumChannels()); memcpy(sUndo.channelInfo->settings, sndFile.ChnSettings, sizeof(ModChannelSettings) * sndFile.GetNumChannels()); } else { sUndo.channelInfo = nullptr; } - UndoBuffer.push_back(sUndo); + buffer.push_back(sUndo); - if(updateView) modDoc.UpdateAllViews(NULL, HINT_UNDO); + modDoc.UpdateAllViews(NULL, HINT_UNDO); return true; } @@ -105,36 +111,34 @@ PATTERNINDEX CPatternUndo::Undo() //------------------------------- { - return Undo(false); + return Undo(UndoBuffer, RedoBuffer, false); } // Restore an undo point. Returns which pattern has been modified. +PATTERNINDEX CPatternUndo::Redo() +//------------------------------- +{ + return Undo(RedoBuffer, UndoBuffer, false); +} + + +// Restore an undo point. Returns which pattern has been modified. // linkedFromPrevious is true if a connected undo event is going to be deleted (can only be called internally). -PATTERNINDEX CPatternUndo::Undo(bool linkedFromPrevious) -//------------------------------------------------------ +PATTERNINDEX CPatternUndo::Undo(undobuf_t &fromBuf, undobuf_t &toBuf, bool linkedFromPrevious) +//-------------------------------------------------------------------------------------------- { CSoundFile &sndFile = modDoc.GetrSoundFile(); - ModCommand *pUndoData, *pPattern; - PATTERNINDEX nPattern; - ROWINDEX nRows; bool linkToPrevious = false; - if (CanUndo() == false) return PATTERNINDEX_INVALID; + if(fromBuf.empty()) return PATTERNINDEX_INVALID; - // If the most recent undo step is invalid, trash it. - while(UndoBuffer.back().pattern >= sndFile.Patterns.Size()) - { - RemoveLastUndoStep(); - // The command which was connect to this command is no more valid, so don't search for the next command. - if(linkedFromPrevious) - return PATTERNINDEX_INVALID; - } - // Select most recent undo slot - const UndoInfo &undo = UndoBuffer.back(); + const UndoInfo &undo = fromBuf.back(); + PrepareUndo(toBuf, undo.pattern, undo.firstChannel, undo.firstRow, undo.numChannels, undo.numRows, undo.description, linkedFromPrevious, undo.channelInfo != nullptr); + if(undo.channelInfo != nullptr) { if(undo.channelInfo->oldNumChannels != sndFile.GetNumChannels()) @@ -158,66 +162,64 @@ } - nPattern = undo.pattern; - nRows = undo.patternsize; + PATTERNINDEX nPattern = undo.pattern; if(undo.firstChannel + undo.numChannels <= sndFile.GetNumChannels()) { - if(!sndFile.Patterns[nPattern]) + if(!sndFile.Patterns.IsValidPat(nPattern)) { - if(!sndFile.Patterns[nPattern].AllocatePattern(nRows)) + if(!sndFile.Patterns[nPattern].AllocatePattern(undo.numPatternRows)) { + DeleteUndoStep(fromBuf, fromBuf.size() - 1); return PATTERNINDEX_INVALID; } - } else if(sndFile.Patterns[nPattern].GetNumRows() != nRows) + } else if(sndFile.Patterns[nPattern].GetNumRows() != undo.numPatternRows) { - sndFile.Patterns[nPattern].Resize(nRows); + sndFile.Patterns[nPattern].Resize(undo.numPatternRows); } linkToPrevious = undo.linkToPrevious; - pUndoData = undo.pbuffer; - pPattern = sndFile.Patterns[nPattern]; - if (!sndFile.Patterns[nPattern]) return PATTERNINDEX_INVALID; - pPattern += undo.firstChannel + (undo.firstRow * sndFile.GetNumChannels()); + const ModCommand *pUndoData = undo.pbuffer; + ModCommand *pPattern = sndFile.Patterns[nPattern].GetpModCommand(undo.firstRow, undo.firstChannel); for(ROWINDEX iy = 0; iy < undo.numRows; iy++) { memcpy(pPattern, pUndoData, undo.numChannels * sizeof(ModCommand)); pPattern += sndFile.GetNumChannels(); pUndoData += undo.numChannels; } - } + } - RemoveLastUndoStep(); + DeleteUndoStep(fromBuf, fromBuf.size() - 1); - if(CanUndo() == false) modDoc.UpdateAllViews(NULL, HINT_UNDO); + if(fromBuf.empty()) modDoc.UpdateAllViews(NULL, HINT_UNDO); if(linkToPrevious) { - nPattern = Undo(true); + nPattern = Undo(fromBuf, toBuf, true); } return nPattern; } -// Check if an undo buffer actually exists. -bool CPatternUndo::CanUndo() const -//-------------------------------- +// Remove all undo or redo steps +void CPatternUndo::ClearBuffer(undobuf_t &buffer) +//----------------------------------------------- { - return (UndoBuffer.size() > 0); + while(buffer.size() > 0) + { + DeleteUndoStep(buffer, buffer.size() - 1); + } } -// Delete a given undo step. -void CPatternUndo::DeleteUndoStep(size_t step) -//-------------------------------------------- +// Delete a given undo / redo step. +void CPatternUndo::DeleteUndoStep(undobuf_t &buffer, size_t step) +//--------------------------------------------------------------- { - if(step >= UndoBuffer.size()) return; - if(UndoBuffer[step].pbuffer) delete[] UndoBuffer[step].pbuffer; - if(UndoBuffer[step].channelInfo) - { - delete UndoBuffer[step].channelInfo; - } - UndoBuffer.erase(UndoBuffer.begin() + step); + if(step >= buffer.size()) return; + delete[] buffer[step].pbuffer; + delete buffer[step].channelInfo; + buffer.erase(buffer.begin() + step); } @@ -226,10 +228,32 @@ //------------------------------------- { if(!CanUndo()) return; - DeleteUndoStep(UndoBuffer.size() - 1); + DeleteUndoStep(UndoBuffer, UndoBuffer.size() - 1); } +const char *CPatternUndo::GetUndoName() const +//------------------------------------------- +{ + if(!CanUndo()) + { + return ""; + } + return UndoBuffer.back().description; +} + + +const char *CPatternUndo::GetRedoName() const +//------------------------------------------- +{ + if(!CanRedo()) + { + return ""; + } + return RedoBuffer.back().description; +} + + ///////////////////////////////////////////////////////////////////////////////////////// // Sample Undo Functions Modified: trunk/OpenMPT/mptrack/Undo.h =================================================================== --- trunk/OpenMPT/mptrack/Undo.h 2014-02-10 19:16:02 UTC (rev 3692) +++ trunk/OpenMPT/mptrack/Undo.h 2014-02-10 21:05:17 UTC (rev 3693) @@ -11,6 +11,10 @@ #pragma once +class CModDoc; +class ModCommand; +struct ModSample; + #define MAX_UNDO_LEVEL 100000 // 100,000 undo steps for each undo type! ///////////////////////////////////////////////////////////////////////////////////////// @@ -23,58 +27,70 @@ { protected: - // Additional undo information, as required - struct ChannelInfo + struct UndoInfo { - ModChannelSettings *settings; - CHANNELINDEX oldNumChannels; - - ChannelInfo(CHANNELINDEX numChannels) : oldNumChannels(numChannels) + // Additional undo information, as required + struct ChannelInfo { - settings = new ModChannelSettings[numChannels]; - } + ModChannelSettings *settings; + CHANNELINDEX oldNumChannels; - ~ChannelInfo() - { - delete[] settings; - } - }; + ChannelInfo(CHANNELINDEX numChannels) : oldNumChannels(numChannels) + { + settings = new ModChannelSettings[numChannels]; + } - struct UndoInfo - { - ModCommand *pbuffer; - ChannelInfo *channelInfo; - ROWINDEX patternsize; + ~ChannelInfo() + { + delete[] settings; + } + }; + + ModCommand *pbuffer; // Rescued pattern content + ChannelInfo *channelInfo; // Optional old channel information (pan / volume / etc.) + const char *description; // Name of this undo action + ROWINDEX numPatternRows; // Original number of pattern rows (in case of resize) ROWINDEX firstRow, numRows; PATTERNINDEX pattern; CHANNELINDEX firstChannel, numChannels; - bool linkToPrevious; + bool linkToPrevious; // This undo information is linked with the previous undo information }; - std::vector<UndoInfo> UndoBuffer; + typedef std::vector<UndoInfo> undobuf_t; + + undobuf_t UndoBuffer; + undobuf_t RedoBuffer; CModDoc &modDoc; // Pattern undo helper functions - void DeleteUndoStep(size_t step); - PATTERNINDEX Undo(bool linkedFromPrevious); + void ClearBuffer(undobuf_t &buffer); + void DeleteUndoStep(undobuf_t &buffer, size_t step); + PATTERNINDEX Undo(undobuf_t &fromBuf, undobuf_t &toBuf, bool linkedFromPrevious); + bool PrepareUndo(undobuf_t &buffer, PATTERNINDEX pattern, CHANNELINDEX firstChn, ROWINDEX firstRow, CHANNELINDEX numChns, ROWINDEX numRows, const char *description, bool linkToPrevious, bool storeChannelInfo); + public: // Removes all undo steps from the buffer. void ClearUndo(); // Adds a new action to the undo buffer. - bool PrepareUndo(PATTERNINDEX pattern, CHANNELINDEX firstChn, ROWINDEX firstRow, CHANNELINDEX numChns, ROWINDEX numRows, bool linkToPrevious = false, bool storeChannelInfo = false); + bool PrepareUndo(PATTERNINDEX pattern, CHANNELINDEX firstChn, ROWINDEX firstRow, CHANNELINDEX numChns, ROWINDEX numRows, const char *description, bool linkToPrevious = false, bool storeChannelInfo = false); // Undoes the most recent action. PATTERNINDEX Undo(); + // Redoes the most recent action. + PATTERNINDEX Redo(); // Returns true if any actions can currently be undone. - bool CanUndo() const; + bool CanUndo() const { return !UndoBuffer.empty(); } + // Returns true if any actions can currently be redone. + bool CanRedo() const { return !RedoBuffer.empty(); } // Remove the latest added undo step from the undo buffer void RemoveLastUndoStep(); + // Get name of next undo item + const char *GetUndoName() const; + // Get name of next redo item + const char *GetRedoName() const; - CPatternUndo(CModDoc &parent) : modDoc(parent) - { - UndoBuffer.clear(); - }; + CPatternUndo(CModDoc &parent) : modDoc(parent) { } ~CPatternUndo() { @@ -117,8 +133,9 @@ sampleUndoTypes changeType; }; - // Undo buffer - std::vector<std::vector<UndoInfo> > UndoBuffer; + typedef std::vector<std::vector<UndoInfo> > undobuf_t; + undobuf_t UndoBuffer; + CModDoc &modDoc; // Sample undo helper functions @@ -137,10 +154,7 @@ bool CanUndo(const SAMPLEINDEX smp); void RemoveLastUndoStep(const SAMPLEINDEX smp); - CSampleUndo(CModDoc &parent) : modDoc(parent) - { - UndoBuffer.clear(); - }; + CSampleUndo(CModDoc &parent) : modDoc(parent) { } ~CSampleUndo() { Modified: trunk/OpenMPT/mptrack/View_pat.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_pat.cpp 2014-02-10 19:16:02 UTC (rev 3692) +++ trunk/OpenMPT/mptrack/View_pat.cpp 2014-02-10 21:05:17 UTC (rev 3693) @@ -84,6 +84,7 @@ ON_COMMAND(ID_EDIT_SPLITKEYBOARDSETTINGS, SetSplitKeyboardSettings) // -! NEW_FEATURE#0012 ON_COMMAND(ID_EDIT_UNDO, OnEditUndo) + ON_COMMAND(ID_EDIT_REDO, OnEditRedo) ON_COMMAND(ID_PATTERN_CHNRESET, OnChannelReset) ON_COMMAND(ID_PATTERN_MUTE, OnMuteFromClick) //rewbs.customKeys ON_COMMAND(ID_PATTERN_SOLO, OnSoloFromClick) //rewbs.customKeys @@ -131,6 +132,7 @@ ON_COMMAND_RANGE(ID_CHANGE_INSTRUMENT, ID_CHANGE_INSTRUMENT+MAX_INSTRUMENTS, OnSelectInstrument) ON_COMMAND_RANGE(ID_CHANGE_PCNOTE_PARAM, ID_CHANGE_PCNOTE_PARAM + ModCommand::maxColumnValue, OnSelectPCNoteParam) ON_UPDATE_COMMAND_UI(ID_EDIT_UNDO, OnUpdateUndo) + ON_UPDATE_COMMAND_UI(ID_EDIT_REDO, OnUpdateRedo) ON_COMMAND_RANGE(ID_PLUGSELECT, ID_PLUGSELECT+MAX_MIXPLUGINS, OnSelectPlugin) //rewbs.patPlugName @@ -646,15 +648,15 @@ } -bool CViewPattern::PrepareUndo(const PatternCursor &beginSel, const PatternCursor &endSel) -//---------------------------------------------------------------------------------------- +bool CViewPattern::PrepareUndo(const PatternCursor &beginSel, const PatternCursor &endSel, const char *description) +//----------------------------------------------------------------------------------------------------------------- { CModDoc *pModDoc = GetDocument(); const CHANNELINDEX nChnBeg = beginSel.GetChannel(), nChnEnd = endSel.GetChannel(); const ROWINDEX nRowBeg = beginSel.GetRow(), nRowEnd = endSel.GetRow(); if((nChnEnd < nChnBeg) || (nRowEnd < nRowBeg) || pModDoc == nullptr) return false; - return pModDoc->GetPatternUndo().PrepareUndo(m_nPattern, nChnBeg, nRowBeg, nChnEnd - nChnBeg + 1, nRowEnd-nRowBeg + 1); + return pModDoc->GetPatternUndo().PrepareUndo(m_nPattern, nChnBeg, nRowBeg, nChnEnd - nChnBeg + 1, nRowEnd-nRowBeg + 1, description); } @@ -798,7 +800,7 @@ m_Selection.Sanitize(pSndFile->Patterns[m_nPattern].GetNumRows(), pSndFile->GetNumChannels()); const PatternCursor startSel = m_Selection.GetUpperLeft(); const PatternCursor endSel = m_Selection.GetLowerRight(); - PrepareUndo(startSel, PatternCursor(pSndFile->Patterns[m_nPattern].GetNumRows(), endSel)); + PrepareUndo(startSel, PatternCursor(pSndFile->Patterns[m_nPattern].GetNumRows(), endSel), "Grow Selection"); const ROWINDEX finalDest = m_Selection.GetStartRow() + (m_Selection.GetNumRows() - 1) * 2; for(int row = finalDest; row > (int)startSel.GetRow(); row -= 2) @@ -882,7 +884,7 @@ m_Selection.Sanitize(pSndFile->Patterns[m_nPattern].GetNumRows(), pSndFile->GetNumChannels()); const PatternCursor startSel = m_Selection.GetUpperLeft(); const PatternCursor endSel = m_Selection.GetLowerRight(); - PrepareUndo(startSel, endSel); + PrepareUndo(startSel, endSel, "Shrink Selection"); const ROWINDEX finalDest = m_Selection.GetStartRow() + (m_Selection.GetNumRows() - 1) / 2; for(ROWINDEX row = startSel.GetRow(); row <= endSel.GetRow(); row++) @@ -997,7 +999,7 @@ m_Selection.Sanitize(pSndFile->Patterns[m_nPattern].GetNumRows(), pSndFile->GetNumChannels()); - PrepareUndo(m_Selection); + PrepareUndo(m_Selection, "Clear Selection"); const ROWINDEX endRow = m_Selection.GetEndRow(); for(ROWINDEX row = m_Selection.GetStartRow(); row <= endRow; row++) @@ -1827,7 +1829,7 @@ LimitMax(colmax, CHANNELINDEX(pSndFile->GetNumChannels() - 1)); if(colmin > colmax) return; - PrepareUndo(PatternCursor(0), PatternCursor(maxrow - 1, pSndFile->GetNumChannels() - 1)); + PrepareUndo(PatternCursor(0), PatternCursor(maxrow - 1, pSndFile->GetNumChannels() - 1), nrows != 1 ? "Delete Rows" : "Delete Row"); for(ROWINDEX r = row; r < maxrow; r++) { @@ -1889,7 +1891,7 @@ LimitMax(colmax, CHANNELINDEX(pSndFile->GetNumChannels() - 1)); if(colmin > colmax) return; - PrepareUndo(PatternCursor(0), PatternCursor(maxrow - 1, pSndFile->GetNumChannels() - 1)); + PrepareUndo(PatternCursor(0), PatternCursor(maxrow - 1, pSndFile->GetNumChannels() - 1), "Insert Row"); for(ROWINDEX r = maxrow; r > row; ) { @@ -2225,13 +2227,13 @@ // Just create one logic undo step per pattern when auto-replacing all occurences. if(firstInPat) { - GetDocument()->GetPatternUndo().PrepareUndo(pat, firstChannel, row, lastChannel - firstChannel + 1, numRows - row + 1, (nFound > 1)); + GetDocument()->GetPatternUndo().PrepareUndo(pat, firstChannel, row, lastChannel - firstChannel + 1, numRows - row + 1, "Find / Replace", (nFound > 1)); firstInPat = false; } } else { // Create separately undo-able items when replacing manually. - GetDocument()->GetPatternUndo().PrepareUndo(pat, chn, row, 1, 1); + GetDocument()->GetPatternUndo().PrepareUndo(pat, chn, row, 1, 1, "Find / Replace"); } if(m_findReplace.replaceFlags[FindReplace::Note]) @@ -2527,7 +2529,7 @@ return; } - PrepareUndo(m_Cursor, m_Cursor); + PrepareUndo(m_Cursor, m_Cursor, "Cursor Paste"); PatternCursor::Columns column = m_Cursor.GetColumnType(); ModCommand &m = GetCursorCommand(); @@ -2685,7 +2687,26 @@ continue; //skip chans where interpolation isn't possible if (!changed) //ensure we save undo buffer only before any channels are interpolated - PrepareUndo(m_Selection); + { + const char *description = ""; + switch(type) + { + case PatternCursor::noteColumn: + description = "Interpolate Note Column"; + break; + case PatternCursor::instrColumn: + description = "Interpolate Instrument Column"; + break; + case PatternCursor::volumeColumn: + description = "Interpolate Volume Column"; + break; + case PatternCursor::effectColumn: + case PatternCursor::paramColumn: + description = "Interpolate Effect Column"; + break; + } + PrepareUndo(m_Selection, description); + } bool doPCinterpolation = false; @@ -2863,7 +2884,7 @@ const ModCommand::NOTE noteMin = pSndFile->GetModSpecifications().noteMin; const ModCommand::NOTE noteMax = pSndFile->GetModSpecifications().noteMax; - PrepareUndo(m_Selection); + PrepareUndo(m_Selection, "Transpose"); for(ROWINDEX row = startRow; row <= endRow; row++) { @@ -2905,7 +2926,7 @@ const EffectInfo effectInfo(*pSndFile); const int offset = up ? 1 : -1; - PrepareUndo(m_Selection); + PrepareUndo(m_Selection, "Data Entry"); for(ROWINDEX row = startRow; row <= endRow; row++) { @@ -3048,7 +3069,7 @@ const bool moveSelection = !m_Status[psKeyboardDragSelect | psCtrlDragSelect]; BeginWaitCursor(); - pModDoc->GetPatternUndo().PrepareUndo(m_nPattern, 0, 0, pSndFile->GetNumChannels(), pSndFile->Patterns[m_nPattern].GetNumRows()); + pModDoc->GetPatternUndo().PrepareUndo(m_nPattern, 0, 0, pSndFile->GetNumChannels(), pSndFile->Patterns[m_nPattern].GetNumRows(), moveSelection ? "Move Selection" : "Copy Selection"); ModCommand *p = pNewPattern; for(ROWINDEX row = 0; row < pSndFile->Patterns[m_nPattern].GetNumRows(); row++) @@ -3261,17 +3282,46 @@ if ((pCmdUI) && (pModDoc)) { pCmdUI->Enable(pModDoc->GetPatternUndo().CanUndo()); + pCmdUI->SetText(CString("Undo ") + CString(pModDoc->GetPatternUndo().GetUndoName()) + + CString("\t") + CMainFrame::GetInputHandler()->GetKeyTextFromCommand(kcEditUndo)); } } +void CViewPattern::OnUpdateRedo(CCmdUI *pCmdUI) +//--------------------------------------------- +{ + CModDoc *pModDoc = GetDocument(); + if ((pCmdUI) && (pModDoc)) + { + pCmdUI->Enable(pModDoc->GetPatternUndo().CanRedo()); + pCmdUI->SetText(CString("Redo ") + CString(pModDoc->GetPatternUndo().GetRedoName()) + + CString("\t") + CMainFrame::GetInputHandler()->GetKeyTextFromCommand(kcEditRedo)); + } +} + + void CViewPattern::OnEditUndo() //----------------------------- { + UndoRedo(true); +} + + +void CViewPattern::OnEditRedo() +//----------------------------- +{ + UndoRedo(false); +} + + +void CViewPattern::UndoRedo(bool undo) +//------------------------------------ +{ CModDoc *pModDoc = GetDocument(); if (pModDoc && IsEditingEnabled_bmsg()) { - PATTERNINDEX pat = pModDoc->GetPatternUndo().Undo(); + PATTERNINDEX pat = undo ? pModDoc->GetPatternUndo().Undo() : pModDoc->GetPatternUndo().Redo(); if(pat < pModDoc->GetSoundFile()->Patterns.Size()) { pModDoc->SetModified(); @@ -3309,7 +3359,7 @@ const bool useVolCol = pSndFile->GetModSpecifications().HasVolCommand(VOLCMD_VOLUME); BeginWaitCursor(); - PrepareUndo(m_Selection); + PrepareUndo(m_Selection, "Amplify"); snOldAmp = dlg.m_nFactor; if(pSndFile->Patterns.IsValidPat(m_nPattern)) @@ -3624,7 +3674,7 @@ // only overwrite existing PC Notes if(pRow->IsEmpty() || pRow->IsPcNote()) { - pModDoc->GetPatternUndo().PrepareUndo(nPattern, nChn, nRow, 1, 1); + pModDoc->GetPatternUndo().PrepareUndo(nPattern, nChn, nRow, 1, 1, "Automation Entry"); pRow->Set(NOTE_PCS, plugSlot + 1, paramIndex, static_cast<uint16>(pPlug->GetParameter(paramIndex) * ModCommand::maxColumnValue)); InvalidateRow(nRow); @@ -3652,7 +3702,7 @@ pSndFile->Chn[nChn].nActiveMacro = foundMacro; if (pRow->command == CMD_NONE || pRow->command == CMD_SMOOTHMIDI || pRow->command == CMD_MIDI) //we overwrite existing Zxx and \xx only. { - pModDoc->GetPatternUndo().PrepareUndo(nPattern, nChn, nRow, 1, 1); + pModDoc->GetPatternUndo().PrepareUndo(nPattern, nChn, nRow, 1, 1, "Automation Entry"); pRow->command = (pSndFile->m_nType & (MOD_TYPE_IT | MOD_TYPE_MPT)) ? CMD_S3MCMDEX : CMD_MODCMDEX;; pRow->param = 0xF0 + (foundMacro & 0x0F); @@ -3665,7 +3715,7 @@ // Write the data, but we only overwrite if the command is a macro anyway. if(pRow->command == CMD_NONE || pRow->command == CMD_SMOOTHMIDI || pRow->command == CMD_MIDI) { - pModDoc->GetPatternUndo().PrepareUndo(nPattern, nChn, nRow, 1, 1); + pModDoc->GetPatternUndo().PrepareUndo(nPattern, nChn, nRow, 1, 1, "Automation Entry"); pRow->command = CMD_SMOOTHMIDI; pRow->param = pPlug->GetZxxParameter(paramIndex); @@ -3869,7 +3919,7 @@ if(m.command == CMD_NONE || m.command == CMD_SMOOTHMIDI || m.command == CMD_MIDI) { // Write command only if there's no existing command or already a midi macro command. - pModDoc->GetPatternUndo().PrepareUndo(editpos.pattern, editpos.channel, editpos.row, 1, 1); + pModDoc->GetPatternUndo().PrepareUndo(editpos.pattern, editpos.channel, editpos.row, 1, 1, "MIDI Record Entry"); m.command = CMD_SMOOTHMIDI; m.param = nByte2; pMainFrm->ThreadSafeSetModified(pModDoc); @@ -4343,6 +4393,7 @@ case kcNotePCS: TempEnterNote(NOTE_PCS); return wParam; case kcEditUndo: OnEditUndo(); return wParam; + case kcEditRedo: OnEditRedo(); return wParam; case kcEditFind: OnEditFind(); return wParam; case kcEditFindNext: OnEditFindNext(); return wParam; case kcEditCut: OnEditCut(); return wParam; @@ -4542,7 +4593,7 @@ return; } - PrepareUndo(m_Cursor, m_Cursor); + PrepareUndo(m_Cursor, m_Cursor, "Volume Entry"); ModCommand &target = GetCursorCommand(); ModCommand oldcmd = target; // This is the command we are about to overwrite @@ -4627,7 +4678,7 @@ ModCommand &target = GetCursorCommand(); ModCommand oldcmd = target; // This is the command we are about to overwrite - PrepareUndo(m_Cursor, m_Cursor); + PrepareUndo(m_Cursor, m_Cursor, "Effect Entry"); if(target.IsPcNote()) { @@ -4686,7 +4737,7 @@ ModCommand &target = GetCursorCommand(); ModCommand oldcmd = target; // This is the command we are about to overwrite - PrepareUndo(m_Cursor, m_Cursor); + PrepareUndo(m_Cursor, m_Cursor, "Parameter Entry"); if(target.IsPcNote()) { @@ -4831,7 +4882,7 @@ } // Create undo-point. - pModDoc->GetPatternUndo().PrepareUndo(editPos.pattern, nChn, editPos.row, noteChannels[numNotes - 1] - nChn + 1, 1); + pModDoc->GetPatternUndo().PrepareUndo(editPos.pattern, nChn, editPos.row, noteChannels[numNotes - 1] - nChn + 1, 1, "Note Stop Entry"); for(int i = 0; i < numNotes; i++) { @@ -4907,7 +4958,7 @@ const ModCommand &target = GetCursorCommand(); if(target.IsNote()) { - PrepareUndo(m_Cursor, m_Cursor); + PrepareUndo(m_Cursor, m_Cursor, "Octave Entry"); TempEnterNote(((target.note - NOTE_MIN) % 12) + val * 12 + NOTE_MIN); // Memorize note for key-up ASSERT(size_t(val) < octaveKeyMemory.size()); @@ -4939,7 +4990,7 @@ return; } - PrepareUndo(m_Cursor, m_Cursor); + PrepareUndo(m_Cursor, m_Cursor, "Instrument Entry"); ModCommand &target = GetCursorCommand(); ModCommand oldcmd = target; // This is the command we are about to overwrite @@ -5149,7 +5200,7 @@ const bool modified = (recordEnabled && *pTarget != newcmd); if (modified) { - pModDoc->GetPatternUndo().PrepareUndo(editPos.pattern, nChn, editPos.row, 1, 1); + pModDoc->GetPatternUndo().PrepareUndo(editPos.pattern, nChn, editPos.row, 1, 1, "Note Entry"); *pTarget = newcmd; } @@ -5391,7 +5442,7 @@ if(modified) { // Simply backup the whole row. - pModDoc->GetPatternUndo().PrepareUndo(m_nPattern, chn, GetCurrentRow(), sndFile.GetNumChannels(), 1); + pModDoc->GetPatternUndo().PrepareUndo(m_nPattern, chn, GetCurrentRow(), sndFile.GetNumChannels(), 1, "Chord Entry"); for(CHANNELINDEX n = 0; n < sndFile.GetNumChannels(); n++) { @@ -5543,7 +5594,7 @@ if(target != newCommand) { - PrepareUndo(cursor, cursor); + PrepareUndo(cursor, cursor, "Aftertouch Entry"); target = newCommand; SetModified(false); @@ -5695,7 +5746,7 @@ return; } - PrepareUndo(m_Cursor, m_Cursor); + PrepareUndo(m_Cursor, m_Cursor, "Clear Field"); ModCommand &target = GetCursorCommand(); ModCommand oldcmd = target; @@ -6078,6 +6129,11 @@ { AppendMenu(hMenu, MF_STRING | greyed, ID_EDIT_UNDO, "&Undo\t" + ih->GetKeyTextFromCommand(kcEditUndo)); } + greyed = pModDoc->GetPatternUndo().CanRedo() ? MF_ENABLED : MF_GRAYED; + if (!greyed || !(TrackerSettings::Instance().m_dwPatternSetup & PATTERN_OLDCTXMENUSTYLE)) + { + AppendMenu(hMenu, MF_STRING | greyed, ID_EDIT_REDO, "&Redo\t" + ih->GetKeyTextFromCommand(kcEditRedo)); + } AppendMenu(hMenu, MF_STRING, ID_CLEAR_SELECTION, "Clear selection\t" + ih->GetKeyTextFromCommand(kcSampleDelete)); @@ -6614,7 +6670,7 @@ bool modified = false; BeginWaitCursor(); - PrepareUndo(m_Selection); + PrepareUndo(m_Selection, "Set Instrument"); //rewbs: re-written to work regardless of selection ROWINDEX startRow = m_Selection.GetStartRow(); Modified: trunk/OpenMPT/mptrack/View_pat.h =================================================================== --- trunk/OpenMPT/mptrack/View_pat.h 2014-02-10 19:16:02 UTC (rev 3692) +++ trunk/OpenMPT/mptrack/View_pat.h 2014-02-10 21:05:17 UTC (rev 3693) @@ -279,8 +279,9 @@ bool TransposeSelection(int transp); bool DataEntry(bool up, bool coarse); - bool PrepareUndo(const PatternRect &selection) { return PrepareUndo(selection.GetUpperLeft(), selection.GetLowerRight()); }; - bool PrepareUndo(const PatternCursor &beginSel, const PatternCursor &endSel); + bool PrepareUndo(const PatternRect &selection, const char *description) { return PrepareUndo(selection.GetUpperLeft(), selection.GetLowerRight(), description); }; + bool PrepareUndo(const PatternCursor &beginSel, const PatternCursor &endSel, const char *description); + void UndoRedo(bool undo); void DeleteRows(CHANNELINDEX colmin, CHANNELINDEX colmax, ROWINDEX nrows); void OnDropSelection(); @@ -376,6 +377,7 @@ afx_msg void OnEditGoto(); afx_msg void OnEditFindNext(); afx_msg void OnEditUndo(); + afx_msg void OnEditRedo(); afx_msg void OnChannelReset(); afx_msg void OnMuteFromClick(); //rewbs.customKeys afx_msg void OnSoloFromClick(); //rewbs.customKeys @@ -417,6 +419,7 @@ afx_msg void OnCursorPaste(); afx_msg void OnPatternAmplify(); afx_msg void OnUpdateUndo(CCmdUI *pCmdUI); + afx_msg void OnUpdateRedo(CCmdUI *pCmdUI); afx_msg void OnSelectPlugin(UINT nID); //rewbs.patPlugName afx_msg LRESULT OnUpdatePosition(WPARAM nOrd, LPARAM nRow); afx_msg LRESULT OnMidiMsg(WPARAM, LPARAM); Modified: trunk/OpenMPT/mptrack/mptrack.rc =================================================================== --- trunk/OpenMPT/mptrack/mptrack.rc 2014-02-10 19:16:02 UTC (rev 3692) +++ trunk/OpenMPT/mptrack/mptrack.rc 2014-02-10 21:05:17 UTC (rev 3693) @@ -1964,6 +1964,7 @@ POPUP "&Edit" BEGIN MENUITEM "&Undo\tCtrl+Z", ID_EDIT_UNDO + MENUITEM "&Redo", ID_EDIT_REDO MENUITEM SEPARATOR MENUITEM "Cu&t\tCtrl+X", ID_EDIT_CUT MENUITEM "&Copy\tCtrl+C", ID_EDIT_COPY Modified: trunk/OpenMPT/mptrack/res/defaultKeybindings.mkb =================================================================== --- trunk/OpenMPT/mptrack/res/defaultKeybindings.mkb 2014-02-10 19:16:02 UTC (rev 3692) +++ trunk/OpenMPT/mptrack/res/defaultKeybindings.mkb 2014-02-10 21:05:17 UTC (rev 3693) @@ -22,6 +22,7 @@ 0:1026:2:118:1 //Play pattern from cursor: Ctrl+F7 (KeyDown) 0:1376:0:120:1 //Toggle MIDI Record: F9 (KeyDown) 0:1359:2:90:1 //Undo: Ctrl+Z (KeyDown... [truncated message content] |
From: <sag...@us...> - 2014-02-10 23:02:06
|
Revision: 3695 http://sourceforge.net/p/modplug/code/3695 Author: saga-games Date: 2014-02-10 23:01:57 +0000 (Mon, 10 Feb 2014) Log Message: ----------- [New] Added sample redo functionality + undo names Modified Paths: -------------- trunk/OpenMPT/mptrack/CleanupSong.cpp trunk/OpenMPT/mptrack/Ctrl_smp.cpp trunk/OpenMPT/mptrack/ModConvert.cpp trunk/OpenMPT/mptrack/Modedit.cpp trunk/OpenMPT/mptrack/Undo.cpp trunk/OpenMPT/mptrack/Undo.h trunk/OpenMPT/mptrack/View_smp.cpp trunk/OpenMPT/mptrack/View_smp.h trunk/OpenMPT/mptrack/View_tre.cpp trunk/OpenMPT/soundlib/Sndfile.cpp Modified: trunk/OpenMPT/mptrack/CleanupSong.cpp =================================================================== --- trunk/OpenMPT/mptrack/CleanupSong.cpp 2014-02-10 21:23:39 UTC (rev 3694) +++ trunk/OpenMPT/mptrack/CleanupSong.cpp 2014-02-10 23:01:57 UTC (rev 3695) @@ -499,7 +499,7 @@ if(!sndFile.IsSampleUsed(smp)) { samplesUsed[smp] = false; - modDoc.GetSampleUndo().PrepareUndo(smp, sundo_delete); + modDoc.GetSampleUndo().PrepareUndo(smp, sundo_delete, "Remove Unused Sample"); } } @@ -584,7 +584,7 @@ SmpLength lmax = loopLength + 2; if(lmax < sample.nLength && lmax >= 2) { - modDoc.GetSampleUndo().PrepareUndo(nSmp, sundo_delete, lmax, sample.nLength); + modDoc.GetSampleUndo().PrepareUndo(nSmp, sundo_delete, "Trim Unused Data", lmax, sample.nLength); ctrlSmp::ResizeSample(sample, lmax, sndFile); } } Modified: trunk/OpenMPT/mptrack/Ctrl_smp.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_smp.cpp 2014-02-10 21:23:39 UTC (rev 3694) +++ trunk/OpenMPT/mptrack/Ctrl_smp.cpp 2014-02-10 23:01:57 UTC (rev 3695) @@ -752,7 +752,7 @@ return false; } - m_modDoc.GetSampleUndo().PrepareUndo(m_nSample, sundo_replace); + m_modDoc.GetSampleUndo().PrepareUndo(m_nSample, sundo_replace, "Replace"); bool bOk = m_sndFile.ReadSampleFromFile(m_nSample, file, TrackerSettings::Instance().m_MayNormalizeSamplesOnLoad); ModSample &sample = m_sndFile.GetSample(m_nSample); @@ -850,7 +850,7 @@ BeginWaitCursor(); - m_modDoc.GetSampleUndo().PrepareUndo(m_nSample, sundo_replace); + m_modDoc.GetSampleUndo().PrepareUndo(m_nSample, sundo_replace, "Replace"); m_sndFile.ReadSampleFromSong(m_nSample, sndFile, nSample); ModSample &sample = m_sndFile.GetSample(m_nSample); if((m_sndFile.GetType() & MOD_TYPE_XM) && (!(sample.uFlags & CHN_PANNING))) @@ -922,7 +922,7 @@ if(duplicate && nOldSmp >= 1 && nOldSmp <= sndFile.GetNumSamples()) { - m_modDoc.GetSampleUndo().PrepareUndo(smp, sundo_replace); + m_modDoc.GetSampleUndo().PrepareUndo(smp, sundo_replace, "Duplicate"); sndFile.ReadSampleFromSong(smp, sndFile, nOldSmp); } @@ -1159,7 +1159,7 @@ } } - m_modDoc.GetSampleUndo().PrepareUndo(iSmp, sundo_update, selStart, selEnd); + m_modDoc.GetSampleUndo().PrepareUndo(iSmp, sundo_update, "Normalize", selStart, selEnd); if(sample.uFlags & CHN_STEREO) { selStart *= 2; selEnd *= 2; } @@ -1230,7 +1230,7 @@ SampleSelectionPoints selection = GetSelectionPoints(); - m_modDoc.GetSampleUndo().PrepareUndo(m_nSample, sundo_update, selection.nStart, selection.nEnd); + m_modDoc.GetSampleUndo().PrepareUndo(m_nSample, sundo_update, "Amplify", selection.nStart, selection.nEnd); if (sample.uFlags & CHN_STEREO) { selection.nStart *= 2; selection.nEnd *= 2; } SmpLength len = selection.nEnd - selection.nStart; @@ -1309,7 +1309,7 @@ selEnd = selection.nEnd; } - m_modDoc.GetSampleUndo().PrepareUndo(iSmp, sundo_update, selStart, selEnd); + m_modDoc.GetSampleUndo().PrepareUndo(iSmp, sundo_update, "Remove DC Offset", selStart, selEnd); const float fOffset = ctrlSmp::RemoveDCOffset(m_sndFile.GetSample(iSmp), selStart, selEnd, m_sndFile.GetType(), m_sndFile); @@ -1417,7 +1417,7 @@ if (dwNewLen <= MAX_SAMPLE_LENGTH) pNewSample = ModSample::AllocateSample(dwNewLen, newsmplsize); if (pNewSample) { - m_modDoc.GetSampleUndo().PrepareUndo(m_nSample, sundo_replace); + m_modDoc.GetSampleUndo().PrepareUndo(m_nSample, sundo_replace, "Upsample"); const UINT nCh = sample.GetNumChannels(); for (UINT iCh=0; iCh<nCh; iCh++) @@ -1554,7 +1554,7 @@ if (pNewSample) { - m_modDoc.GetSampleUndo().PrepareUndo(m_nSample, sundo_replace); + m_modDoc.GetSampleUndo().PrepareUndo(m_nSample, sundo_replace, "Downsample"); const UINT nCh = sample.GetNumChannels(); for (UINT iCh=0; iCh<nCh; iCh++) @@ -1975,7 +1975,7 @@ ASSERT(nNewSampleLength >= nLengthCounter); - m_modDoc.GetSampleUndo().PrepareUndo(m_nSample, sundo_replace); + m_modDoc.GetSampleUndo().PrepareUndo(m_nSample, sundo_replace, "Time Stretch"); // Swap sample buffer pointer to new buffer, update song + sample data & free old sample buffer ctrlSmp::ReplaceSample(sample, (LPSTR)pNewSample, std::min(nLengthCounter, nNewSampleLength), m_sndFile); @@ -2056,7 +2056,7 @@ float * buffer = new float[MAX_BUFFER_LENGTH + fft]; float * outbuf = new float[MAX_BUFFER_LENGTH + fft]; - m_modDoc.GetSampleUndo().PrepareUndo(m_nSample, sundo_replace); + m_modDoc.GetSampleUndo().PrepareUndo(m_nSample, sundo_replace, "Pitch Shift"); // Process each channel separately for(UINT i = 0 ; i < nChn ; i++){ @@ -2176,7 +2176,7 @@ SampleSelectionPoints selection = GetSelectionPoints(); - m_modDoc.GetSampleUndo().PrepareUndo(m_nSample, sundo_reverse, selection.nStart, selection.nEnd); + m_modDoc.GetSampleUndo().PrepareUndo(m_nSample, sundo_reverse, "Reverse", selection.nStart, selection.nEnd); if(ctrlSmp::ReverseSample(sample, selection.nStart, selection.nEnd, m_sndFile)) { m_modDoc.UpdateAllViews(NULL, (m_nSample << HINT_SHIFT_SMP) | HINT_SAMPLEDATA, NULL); @@ -2197,7 +2197,7 @@ SampleSelectionPoints selection = GetSelectionPoints(); - m_modDoc.GetSampleUndo().PrepareUndo(m_nSample, sundo_invert, selection.nStart, selection.nEnd); + m_modDoc.GetSampleUndo().PrepareUndo(m_nSample, sundo_invert, "Invert", selection.nStart, selection.nEnd); if(ctrlSmp::InvertSample(sample, selection.nStart, selection.nEnd, m_sndFile) == true) { m_modDoc.UpdateAllViews(NULL, (m_nSample << HINT_SHIFT_SMP) | HINT_SAMPLEDATA, NULL); @@ -2223,7 +2223,7 @@ ModSample &sample = m_sndFile.GetSample(m_nSample); SampleSelectionPoints selection = GetSelectionPoints(); - m_modDoc.GetSampleUndo().PrepareUndo(m_nSample, sundo_unsign, selection.nStart, selection.nEnd); + m_modDoc.GetSampleUndo().PrepareUndo(m_nSample, sundo_unsign, "Unsign", selection.nStart, selection.nEnd); if(ctrlSmp::UnsignSample(sample, selection.nStart, selection.nEnd, m_sndFile) == true) { m_modDoc.UpdateAllViews(NULL, (m_nSample << HINT_SHIFT_SMP) | HINT_SAMPLEDATA, NULL); @@ -2248,7 +2248,7 @@ if(selection.selectionActive == true) { ModSample &sample = m_sndFile.GetSample(m_nSample); - m_modDoc.GetSampleUndo().PrepareUndo(m_nSample, sundo_update, selection.nStart, selection.nEnd); + m_modDoc.GetSampleUndo().PrepareUndo(m_nSample, sundo_update, "Silence", selection.nStart, selection.nEnd); SmpLength len = selection.nEnd - selection.nStart; if (sample.uFlags & CHN_STEREO) @@ -3102,7 +3102,7 @@ if(fadeLength < 4) return; - m_modDoc.GetSampleUndo().PrepareUndo(m_nSample, sundo_update, sample.nLoopEnd - fadeLength, sample.nLoopEnd); + m_modDoc.GetSampleUndo().PrepareUndo(m_nSample, sundo_update, "Crossfade", sample.nLoopEnd - fadeLength, sample.nLoopEnd); // If we want to fade nFadeLength bytes, we need as much sample material before the loop point. nFadeLength has been adjusted above. if(sample.nLoopStart < fadeLength) { @@ -3138,7 +3138,7 @@ if(dlg.DoModal() == IDOK) { BeginWaitCursor(); - m_modDoc.GetSampleUndo().PrepareUndo(m_nSample, sundo_none); + m_modDoc.GetSampleUndo().PrepareUndo(m_nSample, sundo_none, "Automatic Sample Tuning"); at.Apply(static_cast<double>(dlg.GetPitchReference()), dlg.GetTargetNote()); m_modDoc.UpdateAllViews(NULL, (m_nSample << HINT_SHIFT_SMP) | HINT_SAMPLEINFO, NULL); m_modDoc.SetModified(); Modified: trunk/OpenMPT/mptrack/ModConvert.cpp =================================================================== --- trunk/OpenMPT/mptrack/ModConvert.cpp 2014-02-10 21:23:39 UTC (rev 3694) +++ trunk/OpenMPT/mptrack/ModConvert.cpp 2014-02-10 23:01:57 UTC (rev 3695) @@ -337,7 +337,7 @@ for(SAMPLEINDEX smp = 1; smp <= m_SndFile.GetNumSamples(); smp++) { ModSample &sample = m_SndFile.GetSample(smp); - GetSampleUndo().PrepareUndo(smp, sundo_none); + GetSampleUndo().PrepareUndo(smp, sundo_none, "Song Conversion"); // Too many samples? Only 31 samples allowed in MOD format... if(newTypeIsMOD && smp > 31 && sample.nLength > 0) Modified: trunk/OpenMPT/mptrack/Modedit.cpp =================================================================== --- trunk/OpenMPT/mptrack/Modedit.cpp 2014-02-10 21:23:39 UTC (rev 3694) +++ trunk/OpenMPT/mptrack/Modedit.cpp 2014-02-10 23:01:57 UTC (rev 3695) @@ -279,7 +279,7 @@ { if(newOrder[i] != i + 1) { - GetSampleUndo().PrepareUndo(i + 1, sundo_replace); + GetSampleUndo().PrepareUndo(i + 1, sundo_replace, "Rearrange"); } } Modified: trunk/OpenMPT/mptrack/Undo.cpp =================================================================== --- trunk/OpenMPT/mptrack/Undo.cpp 2014-02-10 21:23:39 UTC (rev 3694) +++ trunk/OpenMPT/mptrack/Undo.cpp 2014-02-10 23:01:57 UTC (rev 3695) @@ -31,10 +31,20 @@ } +// Create undo point. +// Parameter list: +// - pattern: Pattern of which an undo step should be created from. +// - firstChn: first channel, 0-based. +// - firstRow: first row, 0-based. +// - numChns: width +// - numRows: height +// - description: Short description text of action for undo menu. +// - linkToPrevious: Don't create a separate undo step, but link this to the previous undo event. Use this for commands that modify several patterns at once. +// - storeChannelInfo: Also store current channel header information (pan / volume / etc. settings) and number of channels in this undo point. bool CPatternUndo::PrepareUndo(PATTERNINDEX pattern, CHANNELINDEX firstChn, ROWINDEX firstRow, CHANNELINDEX numChns, ROWINDEX numRows, const char *description, bool linkToPrevious, bool storeChannelInfo) //--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- { - if(PrepareUndo(UndoBuffer, pattern, firstChn, firstRow, numChns, numRows, description, linkToPrevious, storeChannelInfo)) + if(PrepareBuffer(UndoBuffer, pattern, firstChn, firstRow, numChns, numRows, description, linkToPrevious, storeChannelInfo)) { ClearBuffer(RedoBuffer); return true; @@ -43,18 +53,8 @@ } -// Create undo point. -// Parameter list: -// - pattern: Pattern of which an undo step should be created from. -// - firstChn: first channel, 0-based. -// - firstRow: first row, 0-based. -// - numChns: width -// - numRows: height -// - description: Short description text of action for undo menu. -// - linkToPrevious: Don't create a separate undo step, but link this to the previous undo event. Use this for commands that modify several patterns at once. -// - storeChannelInfo: Also store current channel header information (pan / volume / etc. settings) and number of channels in this undo point. -bool CPatternUndo::PrepareUndo(undobuf_t &buffer, PATTERNINDEX pattern, CHANNELINDEX firstChn, ROWINDEX firstRow, CHANNELINDEX numChns, ROWINDEX numRows, const char *description, bool linkToPrevious, bool storeChannelInfo) -//---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +bool CPatternUndo::PrepareBuffer(undobuf_t &buffer, PATTERNINDEX pattern, CHANNELINDEX firstChn, ROWINDEX firstRow, CHANNELINDEX numChns, ROWINDEX numRows, const char *description, bool linkToPrevious, bool storeChannelInfo) +//------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ { const CSoundFile &sndFile = modDoc.GetrSoundFile(); @@ -70,19 +70,19 @@ // Remove an undo step if there are too many. while(buffer.size() >= MAX_UNDO_LEVEL) { - DeleteUndoStep(buffer, 0); + DeleteStep(buffer, 0); } - UndoInfo sUndo; - sUndo.pattern = pattern; - sUndo.numPatternRows = sndFile.Patterns[pattern].GetNumRows(); - sUndo.firstChannel = firstChn; - sUndo.firstRow = firstRow; - sUndo.numChannels = numChns; - sUndo.numRows = numRows; - sUndo.pbuffer = pUndoData; - sUndo.linkToPrevious = linkToPrevious; - sUndo.description = description; + UndoInfo undo; + undo.pattern = pattern; + undo.numPatternRows = sndFile.Patterns[pattern].GetNumRows(); + undo.firstChannel = firstChn; + undo.firstRow = firstRow; + undo.numChannels = numChns; + undo.numRows = numRows; + undo.pbuffer = pUndoData; + undo.linkToPrevious = linkToPrevious; + undo.description = description; const ModCommand *pPattern = sndFile.Patterns[pattern].GetpModCommand(firstRow, firstChn); for(ROWINDEX iy = 0; iy < numRows; iy++) { @@ -93,14 +93,14 @@ if(storeChannelInfo) { - sUndo.channelInfo = new UndoInfo::ChannelInfo(sndFile.GetNumChannels()); - memcpy(sUndo.channelInfo->settings, sndFile.ChnSettings, sizeof(ModChannelSettings) * sndFile.GetNumChannels()); + undo.channelInfo = new UndoInfo::ChannelInfo(sndFile.GetNumChannels()); + memcpy(undo.channelInfo->settings, sndFile.ChnSettings, sizeof(ModChannelSettings) * sndFile.GetNumChannels()); } else { - sUndo.channelInfo = nullptr; + undo.channelInfo = nullptr; } - buffer.push_back(sUndo); + buffer.push_back(undo); modDoc.UpdateAllViews(NULL, HINT_UNDO); return true; @@ -137,7 +137,7 @@ // Select most recent undo slot const UndoInfo &undo = fromBuf.back(); - PrepareUndo(toBuf, undo.pattern, undo.firstChannel, undo.firstRow, undo.numChannels, undo.numRows, undo.description, linkedFromPrevious, undo.channelInfo != nullptr); + PrepareBuffer(toBuf, undo.pattern, undo.firstChannel, undo.firstRow, undo.numChannels, undo.numRows, undo.description, linkedFromPrevious, undo.channelInfo != nullptr); if(undo.channelInfo != nullptr) { @@ -169,7 +169,7 @@ { if(!sndFile.Patterns[nPattern].AllocatePattern(undo.numPatternRows)) { - DeleteUndoStep(fromBuf, fromBuf.size() - 1); + DeleteStep(fromBuf, fromBuf.size() - 1); return PATTERNINDEX_INVALID; } } else if(sndFile.Patterns[nPattern].GetNumRows() != undo.numPatternRows) @@ -188,9 +188,9 @@ } } - DeleteUndoStep(fromBuf, fromBuf.size() - 1); + DeleteStep(fromBuf, fromBuf.size() - 1); - if(fromBuf.empty()) modDoc.UpdateAllViews(NULL, HINT_UNDO); + modDoc.UpdateAllViews(NULL, HINT_UNDO); if(linkToPrevious) { @@ -205,16 +205,16 @@ void CPatternUndo::ClearBuffer(undobuf_t &buffer) //----------------------------------------------- { - while(buffer.size() > 0) + while(!buffer.empty()) { - DeleteUndoStep(buffer, buffer.size() - 1); + DeleteStep(buffer, buffer.size() - 1); } } // Delete a given undo / redo step. -void CPatternUndo::DeleteUndoStep(undobuf_t &buffer, size_t step) -//--------------------------------------------------------------- +void CPatternUndo::DeleteStep(undobuf_t &buffer, size_t step) +//----------------------------------------------------------- { if(step >= buffer.size()) return; delete[] buffer[step].pbuffer; @@ -228,7 +228,7 @@ //------------------------------------- { if(!CanUndo()) return; - DeleteUndoStep(UndoBuffer, UndoBuffer.size() - 1); + DeleteStep(UndoBuffer, UndoBuffer.size() - 1); } @@ -264,21 +264,23 @@ { for(SAMPLEINDEX smp = 1; smp <= MAX_SAMPLES; smp++) { - ClearUndo(smp); + ClearUndo(UndoBuffer, smp); + ClearUndo(RedoBuffer, smp); } UndoBuffer.clear(); + RedoBuffer.clear(); } // Remove all undo steps of a given sample. -void CSampleUndo::ClearUndo(const SAMPLEINDEX smp) -//------------------------------------------------ +void CSampleUndo::ClearUndo(undobuf_t &buffer, const SAMPLEINDEX smp) +//------------------------------------------------------------------- { - if(!SampleBufferExists(smp, false)) return; + if(!SampleBufferExists(buffer, smp)) return; - while(UndoBuffer[smp - 1].size() > 0) + while(!buffer[smp - 1].empty()) { - DeleteUndoStep(smp, 0); + DeleteStep(buffer, smp, 0); } } @@ -286,27 +288,44 @@ // Create undo point for given sample. // The main program has to tell what kind of changes are going to be made to the sample. // That way, a lot of RAM can be saved, because some actions don't even require an undo sample buffer. -bool CSampleUndo::PrepareUndo(const SAMPLEINDEX smp, sampleUndoTypes changeType, SmpLength changeStart, SmpLength changeEnd) -//-------------------------------------------------------------------------------------------------------------------------- -{ - if(!SampleBufferExists(smp)) return false; +bool CSampleUndo::PrepareUndo(const SAMPLEINDEX smp, sampleUndoTypes changeType, const char *description, SmpLength changeStart, SmpLength changeEnd) +//--------------------------------------------------------------------------------------------------------------------------------------------------- +{ + if(PrepareBuffer(UndoBuffer, smp, changeType, description, changeStart, changeEnd)) + { + ClearUndo(RedoBuffer, smp); + return true; + } + return false; +} + +bool CSampleUndo::PrepareBuffer(undobuf_t &buffer, const SAMPLEINDEX smp, sampleUndoTypes changeType, const char *description, SmpLength changeStart, SmpLength changeEnd) +//------------------------------------------------------------------------------------------------------------------------------------------------------------------------ +{ + if(smp == 0 || smp >= MAX_SAMPLES) return false; + if(smp > buffer.size()) + { + buffer.resize(smp); + } + // Remove an undo step if there are too many. - while(UndoBuffer[smp - 1].size() >= MAX_UNDO_LEVEL) + while(buffer[smp - 1].size() >= MAX_UNDO_LEVEL) { - DeleteUndoStep(smp, 0); + DeleteStep(buffer, smp, 0); } // Create new undo slot UndoInfo undo; - CSoundFile &sndFile = modDoc.GetrSoundFile(); + const CSoundFile &sndFile = modDoc.GetrSoundFile(); const ModSample &oldSample = sndFile.GetSample(smp); // Save old sample header undo.OldSample = oldSample; mpt::String::Copy(undo.oldName, sndFile.m_szNames[smp]); undo.changeType = changeType; + undo.description = description; if(changeType == sundo_replace) { @@ -356,8 +375,8 @@ #ifdef _DEBUG char s[64]; - const size_t nSize = (GetUndoBufferCapacity() + changeLen * bytesPerSample) >> 10; - wsprintf(s, "Sample undo buffer size is now %u.%u MB\n", nSize >> 10, (nSize & 1023) * 100 / 1024); + const size_t nSize = (GetBufferCapacity(UndoBuffer) + GetBufferCapacity(RedoBuffer) + changeLen * bytesPerSample) >> 10; + wsprintf(s, "Sample undo/redo buffer size is now %u.%u MB\n", nSize >> 10, (nSize & 1023) * 100 / 1024); Log(s); #endif @@ -369,7 +388,7 @@ return false; } - UndoBuffer[smp - 1].push_back(undo); + buffer[smp - 1].push_back(undo); modDoc.UpdateAllViews(NULL, HINT_UNDO); @@ -381,13 +400,37 @@ bool CSampleUndo::Undo(const SAMPLEINDEX smp) //------------------------------------------- { - if(!CanUndo(smp)) return false; + return Undo(UndoBuffer, RedoBuffer, smp); +} + +// Restore redo point for given sample +bool CSampleUndo::Redo(const SAMPLEINDEX smp) +//------------------------------------------- +{ + return Undo(RedoBuffer, UndoBuffer, smp); +} + + +// Restore undo/redo point for given sample +bool CSampleUndo::Undo(undobuf_t &fromBuf, undobuf_t &toBuf, const SAMPLEINDEX smp) +//--------------------------------------------------------------------------------- +{ + if(!SampleBufferExists(fromBuf, smp) || fromBuf[smp - 1].empty()) return false; + CSoundFile &sndFile = modDoc.GetrSoundFile(); // Select most recent undo slot - UndoInfo &undo = UndoBuffer[smp - 1].back(); + UndoInfo &undo = fromBuf[smp - 1].back(); + // When turning an undo point into a redo point (and vice versa), some action types need to be adjusted. + sampleUndoTypes redoType = undo.changeType; + if(redoType == sundo_delete) + redoType = sundo_insert; + else if(redoType == sundo_insert) + redoType = sundo_delete; + PrepareBuffer(toBuf, smp, redoType, undo.description, undo.changeStart, undo.changeEnd); + ModSample &sample = sndFile.GetSample(smp); char *pCurrentSample = static_cast<char *>(sample.pSample); char *pNewSample = nullptr; // a new sample is possibly going to be allocated, depending on what's going to be undone. @@ -463,40 +506,31 @@ } sample.PrecomputeLoops(sndFile, true); - RemoveLastUndoStep(smp); + DeleteStep(fromBuf, smp, fromBuf[smp - 1].size() - 1); - if(CanUndo(smp) == false) modDoc.UpdateAllViews(NULL, HINT_UNDO); + modDoc.UpdateAllViews(NULL, HINT_UNDO); modDoc.SetModified(); return true; } -// Check if given sample has a valid undo buffer -bool CSampleUndo::CanUndo(const SAMPLEINDEX smp) -//---------------------------------------------- +// Delete a given undo / redo step of a sample. +void CSampleUndo::DeleteStep(undobuf_t &buffer, const SAMPLEINDEX smp, const size_t step) +//--------------------------------------------------------------------------------------- { - if(!SampleBufferExists(smp, false) || UndoBuffer[smp - 1].size() == 0) return false; - return true; + if(!SampleBufferExists(buffer, smp) || step >= buffer[smp - 1].size()) return; + ModSample::FreeSample(buffer[smp - 1][step].samplePtr); + buffer[smp - 1].erase(buffer[smp - 1].begin() + step); } -// Delete a given undo step of a sample. -void CSampleUndo::DeleteUndoStep(const SAMPLEINDEX smp, const size_t step) -//------------------------------------------------------------------------ -{ - if(!SampleBufferExists(smp, false) || step >= UndoBuffer[smp - 1].size()) return; - ModSample::FreeSample(UndoBuffer[smp - 1][step].samplePtr); - UndoBuffer[smp - 1].erase(UndoBuffer[smp - 1].begin() + step); -} - - // Public helper function to remove the most recent undo point. void CSampleUndo::RemoveLastUndoStep(const SAMPLEINDEX smp) //--------------------------------------------------------- { if(CanUndo(smp) == false) return; - DeleteUndoStep(smp, UndoBuffer[smp - 1].size() - 1); + DeleteStep(UndoBuffer, smp, UndoBuffer[smp - 1].size() - 1); } @@ -505,43 +539,51 @@ void CSampleUndo::RestrictBufferSize() //------------------------------------ { - size_t capacity = GetUndoBufferCapacity(); + size_t capacity = GetBufferCapacity(UndoBuffer) + GetBufferCapacity(RedoBuffer); while(capacity > TrackerSettings::Instance().GetSampleUndoBufferSize()) { - for(SAMPLEINDEX smp = 1; smp <= UndoBuffer.size(); smp++) + RestrictBufferSize(UndoBuffer, capacity); + RestrictBufferSize(RedoBuffer, capacity); + } +} + + +void CSampleUndo::RestrictBufferSize(undobuf_t &buffer, size_t &capacity) +//----------------------------------------------------------------------- +{ + for(SAMPLEINDEX smp = 1; smp <= buffer.size(); smp++) + { + if(capacity <= TrackerSettings::Instance().GetSampleUndoBufferSize()) return; + for(size_t i = 0; i < buffer[smp - 1].size(); i++) { - for(size_t i = 0; i < UndoBuffer[smp - 1].size(); i++) + if(buffer[smp - 1][i].samplePtr != nullptr) { - if(UndoBuffer[smp - 1][i].samplePtr != nullptr) + capacity -= (buffer[smp - 1][i].changeEnd - buffer[smp - 1][i].changeStart) * buffer[smp - 1][i].OldSample.GetBytesPerSample(); + for(size_t j = 0; j <= i; j++) { - capacity -= (UndoBuffer[smp - 1][i].changeEnd - UndoBuffer[smp - 1][i].changeStart) * UndoBuffer[smp - 1][i].OldSample.GetBytesPerSample(); - for(size_t j = 0; j <= i; j++) - { - DeleteUndoStep(smp, j); - } - // Try to evenly spread out the restriction, i.e. move on to other samples before deleting another step for this sample. - break; + DeleteStep(buffer, smp, j); } + // Try to evenly spread out the restriction, i.e. move on to other samples before deleting another step for this sample. + break; } - if(capacity <= TrackerSettings::Instance().GetSampleUndoBufferSize()) return; } } } // Return total amount of bytes used by the sample undo buffer. -size_t CSampleUndo::GetUndoBufferCapacity() -//----------------------------------------- +size_t CSampleUndo::GetBufferCapacity(const undobuf_t &buffer) const +//------------------------------------------------------------------ { size_t sum = 0; - for(size_t smp = 0; smp < UndoBuffer.size(); smp++) + for(size_t smp = 0; smp < buffer.size(); smp++) { - for(size_t nStep = 0; nStep < UndoBuffer[smp].size(); nStep++) + for(size_t nStep = 0; nStep < buffer[smp].size(); nStep++) { - if(UndoBuffer[smp][nStep].samplePtr != nullptr) + if(buffer[smp][nStep].samplePtr != nullptr) { - sum += (UndoBuffer[smp][nStep].changeEnd - UndoBuffer[smp][nStep].changeStart) - * UndoBuffer[smp][nStep].OldSample.GetBytesPerSample(); + sum += (buffer[smp][nStep].changeEnd - buffer[smp][nStep].changeStart) + * buffer[smp][nStep].OldSample.GetBytesPerSample(); } } } @@ -550,18 +592,33 @@ // Ensure that the undo buffer is big enough for a given sample number -bool CSampleUndo::SampleBufferExists(const SAMPLEINDEX smp, bool forceCreation) -//----------------------------------------------------------------------------- +bool CSampleUndo::SampleBufferExists(const undobuf_t &buffer, const SAMPLEINDEX smp) const +//---------------------------------------------------------------------------------------- { - if(smp == 0 || smp > MAX_SAMPLES) return false; + if(smp == 0 || smp >= MAX_SAMPLES) return false; + if(smp <= buffer.size()) return true; + return false; +} - // Sample slot exists already - if(smp <= UndoBuffer.size()) return true; +// Get name of next undo item +const char *CSampleUndo::GetUndoName(const SAMPLEINDEX smp) const +//--------------------------------------------------------------- +{ + if(!CanUndo(smp)) + { + return ""; + } + return UndoBuffer[smp - 1].back().description; +} - // Sample slot doesn't exist, don't create it. - if(forceCreation == false) return false; - // Sample slot doesn't exist, so create it. - UndoBuffer.resize(smp); - return true; +// Get name of next redo item +const char *CSampleUndo::GetRedoName(const SAMPLEINDEX smp) const +//--------------------------------------------------------------- +{ + if(!CanRedo(smp)) + { + return ""; + } + return RedoBuffer[smp - 1].back().description; } Modified: trunk/OpenMPT/mptrack/Undo.h =================================================================== --- trunk/OpenMPT/mptrack/Undo.h 2014-02-10 21:23:39 UTC (rev 3694) +++ trunk/OpenMPT/mptrack/Undo.h 2014-02-10 23:01:57 UTC (rev 3695) @@ -64,10 +64,10 @@ // Pattern undo helper functions void ClearBuffer(undobuf_t &buffer); - void DeleteUndoStep(undobuf_t &buffer, size_t step); + void DeleteStep(undobuf_t &buffer, size_t step); PATTERNINDEX Undo(undobuf_t &fromBuf, undobuf_t &toBuf, bool linkedFromPrevious); - bool PrepareUndo(undobuf_t &buffer, PATTERNINDEX pattern, CHANNELINDEX firstChn, ROWINDEX firstRow, CHANNELINDEX numChns, ROWINDEX numRows, const char *description, bool linkToPrevious, bool storeChannelInfo); + bool PrepareBuffer(undobuf_t &buffer, PATTERNINDEX pattern, CHANNELINDEX firstChn, ROWINDEX firstRow, CHANNELINDEX numChns, ROWINDEX numRows, const char *description, bool linkToPrevious, bool storeChannelInfo); public: @@ -129,30 +129,41 @@ ModSample OldSample; char oldName[MAX_SAMPLENAME]; void *samplePtr; + const char *description; SmpLength changeStart, changeEnd; sampleUndoTypes changeType; }; typedef std::vector<std::vector<UndoInfo> > undobuf_t; undobuf_t UndoBuffer; + undobuf_t RedoBuffer; CModDoc &modDoc; // Sample undo helper functions - void DeleteUndoStep(const SAMPLEINDEX smp, const size_t step); - bool SampleBufferExists(const SAMPLEINDEX smp, bool forceCreation = true); + void ClearUndo(undobuf_t &buffer, const SAMPLEINDEX smp); + void DeleteStep(undobuf_t &buffer, const SAMPLEINDEX smp, const size_t step); + bool SampleBufferExists(const undobuf_t &buffer, const SAMPLEINDEX smp) const; void RestrictBufferSize(); - size_t GetUndoBufferCapacity(); + void RestrictBufferSize(undobuf_t &buffer, size_t &capacity); + size_t GetBufferCapacity(const undobuf_t &buffer) const; + bool PrepareBuffer(undobuf_t &buffer, const SAMPLEINDEX smp, sampleUndoTypes changeType, const char *description, SmpLength changeStart, SmpLength changeEnd); + bool Undo(undobuf_t &fromBuf, undobuf_t &toBuf, const SAMPLEINDEX smp); + public: // Sample undo functions void ClearUndo(); - void ClearUndo(const SAMPLEINDEX smp); - bool PrepareUndo(const SAMPLEINDEX smp, sampleUndoTypes changeType, SmpLength changeStart = 0, SmpLength changeEnd = 0); + void ClearUndo(const SAMPLEINDEX smp) { ClearUndo(UndoBuffer, smp); ClearUndo(RedoBuffer, smp); } + bool PrepareUndo(const SAMPLEINDEX smp, sampleUndoTypes changeType, const char *description, SmpLength changeStart = 0, SmpLength changeEnd = 0); bool Undo(const SAMPLEINDEX smp); - bool CanUndo(const SAMPLEINDEX smp); + bool Redo(const SAMPLEINDEX smp); + bool CanUndo(const SAMPLEINDEX smp) const { return SampleBufferExists(UndoBuffer, smp) && !UndoBuffer[smp - 1].empty(); } + bool CanRedo(const SAMPLEINDEX smp) const { return SampleBufferExists(RedoBuffer, smp) && !RedoBuffer[smp - 1].empty(); } void RemoveLastUndoStep(const SAMPLEINDEX smp); + const char *GetUndoName(const SAMPLEINDEX smp) const; + const char *GetRedoName(const SAMPLEINDEX smp) const; CSampleUndo(CModDoc &parent) : modDoc(parent) { } Modified: trunk/OpenMPT/mptrack/View_smp.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_smp.cpp 2014-02-10 21:23:39 UTC (rev 3694) +++ trunk/OpenMPT/mptrack/View_smp.cpp 2014-02-10 23:01:57 UTC (rev 3695) @@ -80,6 +80,7 @@ ON_WM_DROPFILES() ON_WM_MOUSEWHEEL() ON_COMMAND(ID_EDIT_UNDO, OnEditUndo) + ON_COMMAND(ID_EDIT_REDO, OnEditRedo) ON_COMMAND(ID_EDIT_SELECT_ALL, OnEditSelectAll) ON_COMMAND(ID_EDIT_CUT, OnEditCut) ON_COMMAND(ID_EDIT_COPY, OnEditCopy) @@ -105,6 +106,8 @@ ON_COMMAND(ID_SAMPLE_ADDSILENCE, OnAddSilence) ON_COMMAND(ID_SAMPLE_GRID, OnChangeGridSize) ON_COMMAND(ID_SAMPLE_QUICKFADE, OnQuickFade) + ON_UPDATE_COMMAND_UI(ID_EDIT_UNDO, OnUpdateUndo) + ON_UPDATE_COMMAND_UI(ID_EDIT_REDO, OnUpdateRedo) ON_MESSAGE(WM_MOD_MIDIMSG, OnMidiMsg) ON_MESSAGE(WM_MOD_KEYCOMMAND, OnCustomKeyMsg) //rewbs.customKeys //}}AFX_MSG_MAP @@ -838,7 +841,7 @@ ::FillRect(offScreenDC, &rcClient, CMainFrame::brushBlack); } ::SelectObject(offScreenDC, CMainFrame::penDarkGray); - if (sample.uFlags & CHN_STEREO) + if (sample.uFlags[CHN_STEREO]) { ::MoveToEx(offScreenDC, 0, ymed-yrange/2, NULL); ::LineTo(offScreenDC, rcClient.right, ymed-yrange/2); @@ -1465,7 +1468,7 @@ if (m_dwStatus[SMPSTATUS_DRAWING]) { m_lastDrawPoint = point; - pModDoc->GetSampleUndo().PrepareUndo(m_nSample, sundo_replace); + pModDoc->GetSampleUndo().PrepareUndo(m_nSample, sundo_replace, "Draw Sample"); if(sample.GetElementarySampleSize() == 2) SetInitialDrawPoint<int16, uint16>(sample.pSample, point); else if(sample.GetElementarySampleSize() == 1) @@ -1537,10 +1540,10 @@ if (dwPos <= sample.nLength) { //Set loop points - wsprintf(s, "Set Loop Start to:\t%d", dwPos); + wsprintf(s, "Set &Loop Start to:\t%d", dwPos); ::AppendMenu(hMenu, MF_STRING | (dwPos + 4 <= sample.nLoopEnd ? 0 : MF_GRAYED), ID_SAMPLE_SETLOOPSTART, s); - wsprintf(s, "Set Loop End to:\t%d", dwPos); + wsprintf(s, "Set &Loop End to:\t%d", dwPos); ::AppendMenu(hMenu, MF_STRING | (dwPos >= sample.nLoopStart + 4 ? 0 : MF_GRAYED), ID_SAMPLE_SETLOOPEND, s); @@ -1548,10 +1551,10 @@ { //Set sustain loop points ::AppendMenu(hMenu, MF_SEPARATOR, 0, ""); - wsprintf(s, "Set Sustain Start to:\t%d", dwPos); + wsprintf(s, "Set &Sustain Start to:\t%d", dwPos); ::AppendMenu(hMenu, MF_STRING | (dwPos + 4 <= sample.nSustainEnd ? 0 : MF_GRAYED), ID_SAMPLE_SETSUSTAINSTART, s); - wsprintf(s, "Set Sustain End to:\t%d", dwPos); + wsprintf(s, "Set &Sustain End to:\t%d", dwPos); ::AppendMenu(hMenu, MF_STRING | (dwPos >= sample.nSustainStart + 4 ? 0 : MF_GRAYED), ID_SAMPLE_SETSUSTAINEND, s); } @@ -1573,7 +1576,7 @@ // "Trim" menu item is responding differently if there's no selection, // but a loop present: "trim around loop point"! (jojo in topic 2258) - std::string sTrimMenuText = "T&rim"; + std::string sTrimMenuText = "Tr&im"; bool bIsGrayed = ( (m_dwEndSel<=m_dwBeginSel) || (m_dwEndSel - m_dwBeginSel < MIN_TRIM_LENGTH) || (m_dwEndSel - m_dwBeginSel == sample.nLength) ); @@ -1600,7 +1603,8 @@ ::AppendMenu(hMenu, MF_STRING, ID_EDIT_COPY, "&Copy\t" + ih->GetKeyTextFromCommand(kcEditCopy)); } ::AppendMenu(hMenu, MF_STRING | (IsClipboardFormatAvailable(CF_WAVE) ? 0 : MF_GRAYED), ID_EDIT_PASTE, "&Paste\t" + ih->GetKeyTextFromCommand(kcEditPaste)); - ::AppendMenu(hMenu, MF_STRING | (pModDoc->GetSampleUndo().CanUndo(m_nSample) ? 0 : MF_GRAYED), ID_EDIT_UNDO, "&Undo\t" + ih->GetKeyTextFromCommand(kcEditUndo)); + ::AppendMenu(hMenu, MF_STRING | (pModDoc->GetSampleUndo().CanUndo(m_nSample) ? 0 : MF_GRAYED), ID_EDIT_UNDO, "&Undo" + CString(pModDoc->GetSampleUndo().GetUndoName(m_nSample)) + "\t" + ih->GetKeyTextFromCommand(kcEditUndo)); + ::AppendMenu(hMenu, MF_STRING | (pModDoc->GetSampleUndo().CanRedo(m_nSample) ? 0 : MF_GRAYED), ID_EDIT_REDO, "&Redo" + CString(pModDoc->GetSampleUndo().GetRedoName(m_nSample)) + "\t" + ih->GetKeyTextFromCommand(kcEditRedo)); ClientToScreen(&pt); ::TrackPopupMenu(hMenu, TPM_LEFTALIGN|TPM_RIGHTBUTTON, pt.x, pt.y, 0, m_hWnd, NULL); ::DestroyMenu(hMenu); @@ -1820,14 +1824,14 @@ || (m_dwEndSel - m_dwBeginSel + 4 >= len)) { if (Reporting::Confirm("Remove this sample?", "Remove Sample", true) != cnfYes) return; - pModDoc->GetSampleUndo().PrepareUndo(m_nSample, sundo_replace); + pModDoc->GetSampleUndo().PrepareUndo(m_nSample, sundo_replace, "Delete Sample"); sndFile.DestroySampleThreadsafe(m_nSample); dwUpdateFlags |= HINT_SMPNAMES; } else { - pModDoc->GetSampleUndo().PrepareUndo(m_nSample, sundo_delete, m_dwBeginSel, m_dwEndSel); + pModDoc->GetSampleUndo().PrepareUndo(m_nSample, sundo_delete, "Delete Selection", m_dwBeginSel, m_dwEndSel); CriticalSection cs; @@ -1978,7 +1982,7 @@ if ((hCpy) && ((p = (LPBYTE)GlobalLock(hCpy)) != NULL)) { - pModDoc->GetSampleUndo().PrepareUndo(m_nSample, sundo_replace); + pModDoc->GetSampleUndo().PrepareUndo(m_nSample, sundo_replace, "Paste"); CSoundFile &sndFile = pModDoc->GetrSoundFile(); ModSample &sample = sndFile.GetSample(m_nSample); @@ -2015,11 +2019,21 @@ { CModDoc *pModDoc = GetDocument(); if(pModDoc == nullptr) return; - if(pModDoc->GetSampleUndo().Undo(m_nSample) == true) + if(pModDoc->GetSampleUndo().Undo(m_nSample)) pModDoc->UpdateAllViews(NULL, (m_nSample << HINT_SHIFT_SMP) | HINT_SAMPLEINFO | HINT_SAMPLEDATA, NULL); } +void CViewSample::OnEditRedo() +//---------------------------- +{ + CModDoc *pModDoc = GetDocument(); + if(pModDoc == nullptr) return; + if(pModDoc->GetSampleUndo().Redo(m_nSample)) + pModDoc->UpdateAllViews(NULL, (m_nSample << HINT_SHIFT_SMP) | HINT_SAMPLEINFO | HINT_SAMPLEDATA, NULL); +} + + void CViewSample::On8BitConvert() //------------------------------- { @@ -2031,7 +2045,7 @@ ModSample &sample = sndFile.GetSample(m_nSample); if(sample.uFlags[CHN_16BIT] && sample.pSample != nullptr && sample.nLength != 0) { - pModDoc->GetSampleUndo().PrepareUndo(m_nSample, sundo_replace); + pModDoc->GetSampleUndo().PrepareUndo(m_nSample, sundo_replace, "8-Bit Conversion"); CriticalSection cs; @@ -2083,7 +2097,7 @@ } } - pModDoc->GetSampleUndo().PrepareUndo(m_nSample, sundo_replace); + pModDoc->GetSampleUndo().PrepareUndo(m_nSample, sundo_replace, "Mono Conversion"); if(ctrlSmp::ConvertToMono(sample, sndFile, convert)) { @@ -2156,7 +2170,7 @@ if ((sample.pSample) && (nStart+nEnd <= sample.nLength) && (nEnd >= MIN_TRIM_LENGTH)) { - pModDoc->GetSampleUndo().PrepareUndo(m_nSample, sundo_replace); + pModDoc->GetSampleUndo().PrepareUndo(m_nSample, sundo_replace, "Trim"); CriticalSection cs; @@ -2186,6 +2200,7 @@ sample.uFlags.reset(CHN_SUSTAINLOOP|CHN_PINGPONGSUSTAIN); } sample.nLength = nEnd; + sample.PrecomputeLoops(sndFile); sample.PrecomputeLoops(sndFile); cs.Leave(); @@ -2204,8 +2219,8 @@ } -void CViewSample::PlayNote(UINT note, const uint32 nStartPos) -//----------------------------------------------------------- +void CViewSample::PlayNote(ModCommand::NOTE note, const SmpLength nStartPos) +//-------------------------------------------------------------------------- { CMainFrame *pMainFrm = CMainFrame::GetMainFrame(); CModDoc *pModDoc = GetDocument(); @@ -2341,7 +2356,7 @@ { CriticalSection cs; - pModDoc->GetSampleUndo().PrepareUndo(m_nSample, sundo_replace); + pModDoc->GetSampleUndo().PrepareUndo(m_nSample, sundo_replace, "Replace"); bCanDrop = dlsbank.ExtractSample(*pSndFile, m_nSample, nIns, nRgn); } bUpdate = TRUE; @@ -2369,7 +2384,7 @@ } CriticalSection cs; - pModDoc->GetSampleUndo().PrepareUndo(m_nSample, sundo_replace); + pModDoc->GetSampleUndo().PrepareUndo(m_nSample, sundo_replace, "Replace"); bCanDrop = pDLSBank->ExtractSample(*pSndFile, m_nSample, nIns, nRgn); bUpdate = TRUE; @@ -2447,7 +2462,7 @@ ModSample &sample = sndFile.GetSample(m_nSample); if ((m_dwMenuParam+4 <= sample.nLoopEnd) && (sample.nLoopStart != m_dwMenuParam)) { - pModDoc->GetSampleUndo().PrepareUndo(m_nSample, sundo_none); + pModDoc->GetSampleUndo().PrepareUndo(m_nSample, sundo_none, "Set Loop Start"); sample.SetLoop(m_dwMenuParam, sample.nLoopEnd, true, sample.uFlags[CHN_PINGPONGLOOP], sndFile); pModDoc->SetModified(); pModDoc->UpdateAllViews(NULL, (m_nSample << HINT_SHIFT_SMP) | HINT_SAMPLEINFO | HINT_SAMPLEDATA, NULL); @@ -2466,7 +2481,7 @@ ModSample &sample = sndFile.GetSample(m_nSample); if ((m_dwMenuParam >= sample.nLoopStart+4) && (sample.nLoopEnd != m_dwMenuParam)) { - pModDoc->GetSampleUndo().PrepareUndo(m_nSample, sundo_none); + pModDoc->GetSampleUndo().PrepareUndo(m_nSample, sundo_none, "Set Loop End"); sample.SetLoop(sample.nLoopStart, m_dwMenuParam, true, sample.uFlags[CHN_PINGPONGLOOP], sndFile); pModDoc->SetModified(); pModDoc->UpdateAllViews(NULL, (m_nSample << HINT_SHIFT_SMP) | HINT_SAMPLEINFO | HINT_SAMPLEDATA, NULL); @@ -2485,7 +2500,7 @@ ModSample &sample = sndFile.GetSample(m_nSample); if ((m_dwMenuParam+4 <= sample.nSustainEnd) && (sample.nSustainStart != m_dwMenuParam)) { - pModDoc->GetSampleUndo().PrepareUndo(m_nSample, sundo_none); + pModDoc->GetSampleUndo().PrepareUndo(m_nSample, sundo_none, "Set Sustain Start"); sample.SetSustainLoop(m_dwMenuParam, sample.nSustainEnd, true, sample.uFlags[CHN_PINGPONGSUSTAIN], sndFile); pModDoc->SetModified(); pModDoc->UpdateAllViews(NULL, (m_nSample << HINT_SHIFT_SMP) | HINT_SAMPLEINFO | HINT_SAMPLEDATA, NULL); @@ -2504,7 +2519,7 @@ ModSample &sample = sndFile.GetSample(m_nSample); if ((m_dwMenuParam >= sample.nSustainStart+4) && (sample.nSustainEnd != m_dwMenuParam)) { - pModDoc->GetSampleUndo().PrepareUndo(m_nSample, sundo_none); + pModDoc->GetSampleUndo().PrepareUndo(m_nSample, sundo_none, "Set Sustain End"); sample.SetSustainLoop(sample.nSustainStart, m_dwMenuParam, true, sample.uFlags[CHN_PINGPONGSUSTAIN], sndFile); pModDoc->SetModified(); pModDoc->UpdateAllViews(NULL, (m_nSample << HINT_SHIFT_SMP) | HINT_SAMPLEINFO | HINT_SAMPLEDATA, NULL); @@ -2567,9 +2582,9 @@ CriticalSection cs; if(dlg.m_nSamples < sample.nLength) // make it shorter! - pModDoc->GetSampleUndo().PrepareUndo(m_nSample, sundo_delete, dlg.m_nSamples, sample.nLength); + pModDoc->GetSampleUndo().PrepareUndo(m_nSample, sundo_delete, "Resize", dlg.m_nSamples, sample.nLength); else // make it longer! - pModDoc->GetSampleUndo().PrepareUndo(m_nSample, sundo_insert, sample.nLength, dlg.m_nSamples); + pModDoc->GetSampleUndo().PrepareUndo(m_nSample, sundo_insert, "Add Silence", sample.nLength, dlg.m_nSamples); ctrlSmp::ResizeSample(sample, dlg.m_nSamples, sndFile); } } else @@ -2580,7 +2595,7 @@ CriticalSection cs; UINT nStart = (dlg.m_nEditOption == addsilence_at_end) ? sample.nLength : 0; - pModDoc->GetSampleUndo().PrepareUndo(m_nSample, sundo_insert, nStart, nStart + dlg.m_nSamples); + pModDoc->GetSampleUndo().PrepareUndo(m_nSample, sundo_insert, "Add Silence", nStart, nStart + dlg.m_nSamples); ctrlSmp::InsertSilence(sample, dlg.m_nSamples, nStart, sndFile); } } @@ -2707,6 +2722,7 @@ case kcEditCopy: OnEditCopy(); return wParam; case kcEditPaste: OnEditPaste(); return wParam; case kcEditUndo: OnEditUndo(); return wParam; + case kcEditRedo: OnEditRedo(); return wParam; case kcSample8Bit: On8BitConvert(); return wParam; case kcSampleMonoMix: OnMonoConvertMix(); return wParam; case kcSampleMonoLeft: OnMonoConvertLeft(); return wParam; @@ -2735,7 +2751,7 @@ } if (wParam >= kcSampStartNotes && wParam <= kcSampEndNotes) { - PlayNote(wParam - kcSampStartNotes + 1 + pMainFrm->GetBaseOctave() * 12); + PlayNote(static_cast<ModCommand::NOTE>(wParam - kcSampStartNotes + 1 + pMainFrm->GetBaseOctave() * 12)); return wParam; } if (wParam >= kcSampStartNoteStops && wParam <= kcSampEndNoteStops) @@ -2824,3 +2840,29 @@ InvalidateSample(); } } + + +void CViewSample::OnUpdateUndo(CCmdUI *pCmdUI) +//-------------------------------------------- +{ + CModDoc *pModDoc = GetDocument(); + if ((pCmdUI) && (pModDoc)) + { + pCmdUI->Enable(pModDoc->GetSampleUndo().CanUndo(m_nSample)); + pCmdUI->SetText(CString("Undo ") + CString(pModDoc->GetSampleUndo().GetUndoName(m_nSample)) + + CString("\t") + CMainFrame::GetInputHandler()->GetKeyTextFromCommand(kcEditUndo)); + } +} + + +void CViewSample::OnUpdateRedo(CCmdUI *pCmdUI) +//-------------------------------------------- +{ + CModDoc *pModDoc = GetDocument(); + if ((pCmdUI) && (pModDoc)) + { + pCmdUI->Enable(pModDoc->GetSampleUndo().CanRedo(m_nSample)); + pCmdUI->SetText(CString("Redo ") + CString(pModDoc->GetSampleUndo().GetRedoName(m_nSample)) + + CString("\t") + CMainFrame::GetInputHandler()->GetKeyTextFromCommand(kcEditRedo)); + } +} Modified: trunk/OpenMPT/mptrack/View_smp.h =================================================================== --- trunk/OpenMPT/mptrack/View_smp.h 2014-02-10 21:23:39 UTC (rev 3694) +++ trunk/OpenMPT/mptrack/View_smp.h 2014-02-10 23:01:57 UTC (rev 3695) @@ -61,7 +61,7 @@ BOOL SetZoom(UINT nZoom); int32 SampleToScreen(SmpLength pos) const; SmpLength ScreenToSample(int32 x) const; - void PlayNote(UINT note, const uint32 nStartPos = 0); //rewbs.customKeys + void PlayNote(ModCommand::NOTE note, const SmpLength nStartPos = 0); void InvalidateSample(); void SetCurSel(SmpLength nBegin, SmpLength nEnd); void ScrollToPosition(int x); @@ -141,6 +141,7 @@ afx_msg void OnEditCopy(); afx_msg void OnEditPaste(); afx_msg void OnEditUndo(); + afx_msg void OnEditRedo(); afx_msg void OnSetLoop(); afx_msg void OnSetSustainLoop(); afx_msg void On8BitConvert(); @@ -166,6 +167,8 @@ afx_msg LRESULT OnMidiMsg(WPARAM, LPARAM); afx_msg LRESULT OnCustomKeyMsg(WPARAM, LPARAM); //rewbs.customKeys afx_msg BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint pt); + afx_msg void OnUpdateUndo(CCmdUI *pCmdUI); + afx_msg void OnUpdateRedo(CCmdUI *pCmdUI); //}}AFX_MSG DECLARE_MESSAGE_MAP() }; Modified: trunk/OpenMPT/mptrack/View_tre.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_tre.cpp 2014-02-10 21:23:39 UTC (rev 3694) +++ trunk/OpenMPT/mptrack/View_tre.cpp 2014-02-10 23:01:57 UTC (rev 3695) @@ -1482,7 +1482,7 @@ wsprintf(s, _T("Remove sample %u?"), modItemID); if(Reporting::Confirm(s, false, true) == cnfYes) { - modDoc->GetSampleUndo().PrepareUndo((SAMPLEINDEX)modItemID, sundo_replace); + modDoc->GetSampleUndo().PrepareUndo((SAMPLEINDEX)modItemID, sundo_replace, "Delete"); const SAMPLEINDEX oldNumSamples = modDoc->GetNumSamples(); if (modDoc->RemoveSample((SAMPLEINDEX)modItemID)) { Modified: trunk/OpenMPT/soundlib/Sndfile.cpp =================================================================== --- trunk/OpenMPT/soundlib/Sndfile.cpp 2014-02-10 21:23:39 UTC (rev 3694) +++ trunk/OpenMPT/soundlib/Sndfile.cpp 2014-02-10 23:01:57 UTC (rev 3695) @@ -1604,7 +1604,7 @@ #ifdef MODPLUG_TRACKER if(GetpModDoc()) { - GetpModDoc()->GetSampleUndo().PrepareUndo(nSmp, sundo_replace); + GetpModDoc()->GetSampleUndo().PrepareUndo(nSmp, sundo_replace, "Remove Sample"); } #endif // MODPLUG_TRACKER This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <man...@us...> - 2014-02-11 13:48:47
|
Revision: 3699 http://sourceforge.net/p/modplug/code/3699 Author: manxorist Date: 2014-02-11 13:48:40 +0000 (Tue, 11 Feb 2014) Log Message: ----------- [Ref] Kill LPDWORD, LPLONG and LPVOID in soundlib/ . Modified Paths: -------------- trunk/OpenMPT/common/typedefs.h trunk/OpenMPT/soundlib/Dlsbank.cpp trunk/OpenMPT/soundlib/Dlsbank.h trunk/OpenMPT/soundlib/Load_med.cpp Modified: trunk/OpenMPT/common/typedefs.h =================================================================== --- trunk/OpenMPT/common/typedefs.h 2014-02-11 13:25:10 UTC (rev 3698) +++ trunk/OpenMPT/common/typedefs.h 2014-02-11 13:48:40 UTC (rev 3699) @@ -415,10 +415,7 @@ typedef std::int32_t LONG; typedef std::uint32_t UINT; typedef std::uint32_t ULONG; -typedef void * LPVOID; typedef BYTE * LPBYTE; -typedef DWORD * LPDWORD; -typedef LONG * LPLONG; // for BOOL #define TRUE (1) Modified: trunk/OpenMPT/soundlib/Dlsbank.cpp =================================================================== --- trunk/OpenMPT/soundlib/Dlsbank.cpp 2014-02-11 13:25:10 UTC (rev 3698) +++ trunk/OpenMPT/soundlib/Dlsbank.cpp 2014-02-11 13:48:40 UTC (rev 3699) @@ -592,8 +592,8 @@ /////////////////////////////////////////////////////////////// // Update DLS instrument definition from an IFF chunk -BOOL CDLSBank::UpdateInstrumentDefinition(DLSINSTRUMENT *pDlsIns, LPVOID pvchunk, DWORD dwMaxLen) -//-------------------------------------------------------------------------------------------- +BOOL CDLSBank::UpdateInstrumentDefinition(DLSINSTRUMENT *pDlsIns, void *pvchunk, DWORD dwMaxLen) +//---------------------------------------------------------------------------------------------- { IFFCHUNK *pchunk = (IFFCHUNK *)pvchunk; if ((!pchunk->len) || (pchunk->len+8 > dwMaxLen)) return FALSE; @@ -805,8 +805,8 @@ /////////////////////////////////////////////////////////////// // Converts SF2 chunks to DLS -BOOL CDLSBank::UpdateSF2PresetData(LPVOID pvsf2, LPVOID pvchunk, DWORD dwMaxLen) -//------------------------------------------------------------------------------ +BOOL CDLSBank::UpdateSF2PresetData(void *pvsf2, void *pvchunk, DWORD dwMaxLen) +//---------------------------------------------------------------------------- { SF2LOADERINFO *psf2 = (SF2LOADERINFO *)pvsf2; IFFCHUNK *pchunk = (IFFCHUNK *)pvchunk; @@ -956,8 +956,8 @@ // Convert all instruments to the DLS format -BOOL CDLSBank::ConvertSF2ToDLS(LPVOID pvsf2info) -//---------------------------------------------- +BOOL CDLSBank::ConvertSF2ToDLS(void *pvsf2info) +//--------------------------------------------- { SF2LOADERINFO *psf2; DLSINSTRUMENT *pDlsIns; Modified: trunk/OpenMPT/soundlib/Dlsbank.h =================================================================== --- trunk/OpenMPT/soundlib/Dlsbank.h 2014-02-11 13:25:10 UTC (rev 3698) +++ trunk/OpenMPT/soundlib/Dlsbank.h 2014-02-11 13:48:40 UTC (rev 3699) @@ -153,9 +153,9 @@ // Internal Loader Functions protected: - BOOL UpdateInstrumentDefinition(DLSINSTRUMENT *pDlsIns, LPVOID pchunk, DWORD dwMaxLen); - BOOL UpdateSF2PresetData(LPVOID psf2info, LPVOID pchunk, DWORD dwMaxLen); - BOOL ConvertSF2ToDLS(LPVOID psf2info); + BOOL UpdateInstrumentDefinition(DLSINSTRUMENT *pDlsIns, void *pchunk, DWORD dwMaxLen); + BOOL UpdateSF2PresetData(void *psf2info, void *pchunk, DWORD dwMaxLen); + BOOL ConvertSF2ToDLS(void *psf2info); public: // DLS Unit conversion Modified: trunk/OpenMPT/soundlib/Load_med.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_med.cpp 2014-02-11 13:25:10 UTC (rev 3698) +++ trunk/OpenMPT/soundlib/Load_med.cpp 2014-02-11 13:48:40 UTC (rev 3699) @@ -508,7 +508,7 @@ const MMD2SONGHEADER *pmsh2; const MMD0EXP *pmex; DWORD dwBlockArr, dwSmplArr, dwExpData, wNumBlocks; - LPDWORD pdwTable; + DWORD *pdwTable; CHAR version; UINT deftempo; int playtransp = 0; @@ -700,7 +700,7 @@ if ((playseqtable) && (playseqtable < dwMemLength) && (nplayseq*4 < dwMemLength - playseqtable)) { - pseq = BigEndian(((LPDWORD)(lpStream+playseqtable))[nplayseq]); + pseq = BigEndian(((DWORD*)(lpStream+playseqtable))[nplayseq]); } if ((pseq) && (pseq < dwMemLength - sizeof(MMD2PLAYSEQ))) { @@ -799,7 +799,7 @@ } // Reading samples if (dwSmplArr > dwMemLength - 4*m_nSamples) return true; - pdwTable = (LPDWORD)(lpStream + dwSmplArr); + pdwTable = (DWORD*)(lpStream + dwSmplArr); for (UINT iSmp=0; iSmp<m_nSamples; iSmp++) if (pdwTable[iSmp]) { UINT dwPos = BigEndian(pdwTable[iSmp]); @@ -849,7 +849,7 @@ } if (wNumBlocks > MAX_PATTERNS) wNumBlocks = MAX_PATTERNS; if ((!dwBlockArr) || (dwBlockArr > dwMemLength - 4*wNumBlocks)) return true; - pdwTable = (LPDWORD)(lpStream + dwBlockArr); + pdwTable = (DWORD*)(lpStream + dwBlockArr); playtransp += (version == '3') ? 24 : 48; for (PATTERNINDEX iBlk=0; iBlk<wNumBlocks; iBlk++) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <man...@us...> - 2014-02-12 13:37:15
|
Revision: 3703 http://sourceforge.net/p/modplug/code/3703 Author: manxorist Date: 2014-02-12 13:37:08 +0000 (Wed, 12 Feb 2014) Log Message: ----------- [Mod] build: When using Makefile, build test suite along-side the library by default and make it possible to build both with a single make invocation by using seperate intermediate file extensions for test suite object files. This allows for the more standard invocation of make in the form of "make all && make check" to do the expected thing. In order to only build the test suite without the library, use ONLY_TEST=1, in order to not build the test suite, use TEST=0. [Doc] libopenmpt: Update docs accordingly. Modified Paths: -------------- trunk/OpenMPT/Makefile trunk/OpenMPT/libopenmpt/dox/changelog.md trunk/OpenMPT/libopenmpt/dox/quickstart.md trunk/OpenMPT/libopenmpt/dox/tests.md Property Changed: ---------------- trunk/OpenMPT/common/ trunk/OpenMPT/libopenmpt/ trunk/OpenMPT/soundlib/ trunk/OpenMPT/test/ Modified: trunk/OpenMPT/Makefile =================================================================== --- trunk/OpenMPT/Makefile 2014-02-12 12:54:00 UTC (rev 3702) +++ trunk/OpenMPT/Makefile 2014-02-12 13:37:08 UTC (rev 3703) @@ -42,9 +42,10 @@ # EXAMPLES=1 Build examples # OPENMPT123=1 Build openmpt123 # SHARED_SONAME=1 Set SONAME of shared library -# TEST=0 Build libopenmpt in test mode # DEBUG=0 Build debug binaries without optimization and with symbols # OPTIMIZE=1 Build optimized binaries +# TEST=1 Include test suite in default target. +# ONLY_TEST=0 Only build the test suite. # # # Build flags for libopenmpt (provide on each `make` invocation) @@ -80,7 +81,7 @@ # make clean # make [all] # make doc -# make TEST=1 check +# make check # make dist # make dist-doc # make install @@ -124,6 +125,8 @@ SHARED_SONAME=1 DEBUG=0 OPTIMIZE=1 +TEST=1 +ONLY_TEST=0 # get commandline or defaults @@ -226,10 +229,6 @@ endif endif -ifeq ($(TEST),1) -CPPFLAGS += -DLIBOPENMPT_BUILD_TEST -endif - CXXFLAGS += -Wall -Wextra -Wcast-align CFLAGS += -Wall -Wextra -Wcast-align @@ -328,7 +327,7 @@ %: %.o - $(INFO) [LD ] $@ + $(INFO) [LD] $@ $(SILENT)$(LINK.cc) $^ $(LOADLIBES) $(LDLIBS) -o $@ %.o: %.cpp @@ -337,10 +336,20 @@ $(SILENT)$(COMPILE.cc) $(OUTPUT_OPTION) $< %.o: %.c - $(INFO) [CC ] $< + $(INFO) [CC] $< $(VERYSILENT)$(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -M -MT$@ $< > $*.d $(SILENT)$(COMPILE.c) $(OUTPUT_OPTION) $< +%.test.o: %.cpp + $(INFO) [CXX-TEST] $< + $(VERYSILENT)$(CXX) -DLIBOPENMPT_BUILD_TEST $(CXXFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -M -MT$@ $< > $*.test.d + $(SILENT)$(COMPILE.cc) -DLIBOPENMPT_BUILD_TEST $(OUTPUT_OPTION) $< + +%.test.o: %.c + $(INFO) [CC-TEST] $< + $(VERYSILENT)$(CC) -DLIBOPENMPT_BUILD_TEST $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -M -MT$@ $< > $*.test.d + $(SILENT)$(COMPILE.c) -DLIBOPENMPT_BUILD_TEST $(OUTPUT_OPTION) $< + %.tar.gz: %.tar $(INFO) [GZIP] $< $(SILENT)gzip --rsyncable --no-name --best > $@ < $< @@ -429,8 +438,10 @@ LIBOPENMPTTEST_CXX_SOURCES += \ libopenmpt/libopenmpt_test.cpp \ -LIBOPENMPTTEST_OBJECTS += $(LIBOPENMPTTEST_CXX_SOURCES:.cpp=.o) $(LIBOPENMPTTEST_C_SOURCES:.c=.o) -LIBOPENMPTTEST_DEPENDS = $(LIBOPENMPTEST_OBJECTS:.o=.d) +LIBOPENMPTTEST_CXX_SOURCES += $(LIBOPENMPT_CXX_SOURCES) +LIBOPENMPTTEST_C_SOURCES += $(LIBOPENMPT_C_SOURCES) +LIBOPENMPTTEST_OBJECTS += $(LIBOPENMPTTEST_CXX_SOURCES:.cpp=.test.o) $(LIBOPENMPTTEST_C_SOURCES:.c=.test.o) +LIBOPENMPTTEST_DEPENDS = $(LIBOPENMPTEST_OBJECTS:.test.o=.test.d) ALL_OBJECTS += $(LIBOPENMPTTEST_OBJECTS) ALL_DEPENDS += $(LIBOPENMPTTEST_DEPENDS) @@ -473,7 +484,7 @@ endif ifeq ($(TEST),1) OUTPUTS += bin/libopenmpt_test$(EXESUFFIX) -else +endif ifeq ($(HOST),unix) OUTPUTS += bin/libopenmpt.pc endif @@ -482,7 +493,6 @@ OUTPUTS += bin/openmpt123.1 endif endif -endif ifeq ($(SHARED_SONAME),1) LIBOPENMPT_LDFLAGS += -Wl,-soname,$(LIBOPENMPT_SONAME) endif @@ -503,7 +513,11 @@ MISC_OUTPUTDIRS += bin/docs +ifeq ($(ONLY_TEST),1) +all: bin/libopenmpt_test$(EXESUFFIX) +else all: $(OUTPUTS) +endif .PHONY: docs docs: bin/made.docs @@ -524,9 +538,9 @@ test: bin/libopenmpt_test$(EXESUFFIX) bin/libopenmpt_test$(EXESUFFIX) -bin/libopenmpt_test$(EXESUFFIX): $(LIBOPENMPTTEST_OBJECTS) $(OBJECTS_LIBOPENMPT) $(OUTPUT_LIBOPENMPT) - $(INFO) [LD ] $@ - $(SILENT)$(LINK.cc) $(LDFLAGS_RPATH) $(LDFLAGS_LIBOPENMPT) $(LIBOPENMPTTEST_OBJECTS) $(OBJECTS_LIBOPENMPT) $(LOADLIBES) $(LDLIBS) $(LDLIBS_LIBOPENMPT) -o $@ +bin/libopenmpt_test$(EXESUFFIX): $(LIBOPENMPTTEST_OBJECTS) + $(INFO) [LD-TEST] $@ + $(SILENT)$(LINK.cc) $(LDFLAGS_RPATH) $(LIBOPENMPTTEST_OBJECTS) $(LOADLIBES) $(LDLIBS) -o $@ bin/libopenmpt.pc: $(INFO) [GEN] $@ @@ -700,11 +714,11 @@ cd bin/dist-zip/OpenMPT-src-$(DIST_OPENMPT_VERSION)/ && zip -r ../OpenMPT-src-$(DIST_OPENMPT_VERSION).zip --compression-method deflate -9 * bin/openmpt.a: $(LIBOPENMPT_OBJECTS) - $(INFO) [AR ] $@ + $(INFO) [AR] $@ $(SILENT)$(AR) $(ARFLAGS) $@ $^ bin/libopenmpt.so: $(LIBOPENMPT_OBJECTS) - $(INFO) [LD ] $@ + $(INFO) [LD] $@ $(SILENT)$(LINK.cc) -shared $(LIBOPENMPT_LDFLAGS) $^ $(LOADLIBES) $(LDLIBS) -o $@ ifeq ($(SHARED_SONAME),1) $(SILENT)mv bin/libopenmpt.so bin/$(LIBOPENMPT_SONAME) @@ -712,7 +726,7 @@ endif bin/libopenmpt_modplug.so: $(LIBOPENMPT_MODPLUG_OBJECTS) $(OUTPUT_LIBOPENMPT) - $(INFO) [LD ] $@ + $(INFO) [LD] $@ $(SILENT)$(LINK.cc) -shared $(LDFLAGS_LIBOPENMPT) $(LIBOPENMPT_MODPLUG_OBJECTS) $(OBJECTS_LIBOPENMPT) $(LOADLIBES) $(LDLIBS) $(LDLIBS_LIBOPENMPT) -o $@ bin/openmpt123.1: bin/openmpt123$(EXESUFFIX) @@ -724,20 +738,20 @@ $(VERYSILENT)$(CXX) $(CXXFLAGS) $(CXXFLAGS_OPENMPT123) $(CPPFLAGS) $(CPPFLAGS_OPENMPT123) $(TARGET_ARCH) -M -MT$@ $< > $*.d $(SILENT)$(COMPILE.cc) $(CXXFLAGS_OPENMPT123) $(CPPFLAGS_OPENMPT123) $(OUTPUT_OPTION) $< bin/openmpt123$(EXESUFFIX): $(OPENMPT123_OBJECTS) $(OBJECTS_LIBOPENMPT) $(OUTPUT_LIBOPENMPT) - $(INFO) [LD ] $@ + $(INFO) [LD] $@ $(SILENT)$(LINK.cc) $(LDFLAGS_LIBOPENMPT) $(LDFLAGS_OPENMPT123) $(OPENMPT123_OBJECTS) $(OBJECTS_LIBOPENMPT) $(LOADLIBES) $(LDLIBS) $(LDLIBS_LIBOPENMPT) $(LDLIBS_OPENMPT123) -o $@ ifeq ($(HOST),unix) $(SILENT)mv $@ $@.norpath - $(INFO) [LD ] $@ + $(INFO) [LD] $@ $(SILENT)$(LINK.cc) $(LDFLAGS_RPATH) $(LDFLAGS_LIBOPENMPT) $(LDFLAGS_OPENMPT123) $(OPENMPT123_OBJECTS) $(OBJECTS_LIBOPENMPT) $(LOADLIBES) $(LDLIBS) $(LDLIBS_LIBOPENMPT) $(LDLIBS_OPENMPT123) -o $@ endif libopenmpt/examples/libopenmpt_example_c.o: libopenmpt/examples/libopenmpt_example_c.c - $(INFO) [CC ] $< + $(INFO) [CC] $< $(VERYSILENT)$(CC) $(CFLAGS) $(CFLAGS_EXAMPLES) $(CPPFLAGS) $(CPPFLAGS_EXAMPLES) $(TARGET_ARCH) -M -MT$@ $< > $*.d $(SILENT)$(COMPILE.c) $(CFLAGS_EXAMPLES) $(CPPFLAGS_EXAMPLES) $(OUTPUT_OPTION) $< libopenmpt/examples/libopenmpt_example_c_mem.o: libopenmpt/examples/libopenmpt_example_c_mem.c - $(INFO) [CC ] $< + $(INFO) [CC] $< $(VERYSILENT)$(CC) $(CFLAGS) $(CFLAGS_EXAMPLES) $(CPPFLAGS) $(CPPFLAGS_EXAMPLES) $(TARGET_ARCH) -M -MT$@ $< > $*.d $(SILENT)$(COMPILE.c) $(CFLAGS_EXAMPLES) $(CPPFLAGS_EXAMPLES) $(OUTPUT_OPTION) $< libopenmpt/examples/libopenmpt_example_cxx.o: libopenmpt/examples/libopenmpt_example_cxx.cpp @@ -745,27 +759,27 @@ $(VERYSILENT)$(CXX) $(CXXFLAGS) $(CXXFLAGS_EXAMPLES) $(CPPFLAGS) $(CPPFLAGS_EXAMPLES) $(TARGET_ARCH) -M -MT$@ $< > $*.d $(SILENT)$(COMPILE.cc) $(CXXFLAGS_EXAMPLES) $(CPPFLAGS_EXAMPLES) $(OUTPUT_OPTION) $< bin/libopenmpt_example_c$(EXESUFFIX): libopenmpt/examples/libopenmpt_example_c.o $(OBJECTS_LIBOPENMPT) $(OUTPUT_LIBOPENMPT) - $(INFO) [LD ] $@ + $(INFO) [LD] $@ $(SILENT)$(LINK.cc) $(LDFLAGS_LIBOPENMPT) $(LDFLAGS_EXAMPLES) libopenmpt/examples/libopenmpt_example_c.o $(OBJECTS_LIBOPENMPT) $(LOADLIBES) $(LDLIBS) $(LDLIBS_LIBOPENMPT) $(LDLIBS_EXAMPLES) -o $@ ifeq ($(HOST),unix) $(SILENT)mv $@ $@.norpath - $(INFO) [LD ] $@ + $(INFO) [LD] $@ $(SILENT)$(LINK.cc) $(LDFLAGS_RPATH) $(LDFLAGS_LIBOPENMPT) $(LDFLAGS_EXAMPLES) libopenmpt/examples/libopenmpt_example_c.o $(OBJECTS_LIBOPENMPT) $(LOADLIBES) $(LDLIBS) $(LDLIBS_LIBOPENMPT) $(LDLIBS_EXAMPLES) -o $@ endif bin/libopenmpt_example_c_mem$(EXESUFFIX): libopenmpt/examples/libopenmpt_example_c_mem.o $(OBJECTS_LIBOPENMPT) $(OUTPUT_LIBOPENMPT) - $(INFO) [LD ] $@ + $(INFO) [LD] $@ $(SILENT)$(LINK.cc) $(LDFLAGS_LIBOPENMPT) $(LDFLAGS_EXAMPLES) libopenmpt/examples/libopenmpt_example_c_mem.o $(OBJECTS_LIBOPENMPT) $(LOADLIBES) $(LDLIBS) $(LDLIBS_LIBOPENMPT) $(LDLIBS_EXAMPLES) -o $@ ifeq ($(HOST),unix) $(SILENT)mv $@ $@.norpath - $(INFO) [LD ] $@ + $(INFO) [LD] $@ $(SILENT)$(LINK.cc) $(LDFLAGS_RPATH) $(LDFLAGS_LIBOPENMPT) $(LDFLAGS_EXAMPLES) libopenmpt/examples/libopenmpt_example_c_mem.o $(OBJECTS_LIBOPENMPT) $(LOADLIBES) $(LDLIBS) $(LDLIBS_LIBOPENMPT) $(LDLIBS_EXAMPLES) -o $@ endif bin/libopenmpt_example_cxx$(EXESUFFIX): libopenmpt/examples/libopenmpt_example_cxx.o $(OBJECTS_LIBOPENMPT) $(OUTPUT_LIBOPENMPT) - $(INFO) [LD ] $@ + $(INFO) [LD] $@ $(SILENT)$(LINK.cc) $(LDFLAGS_LIBOPENMPT) $(LDFLAGS_EXAMPLES) libopenmpt/examples/libopenmpt_example_cxx.o $(OBJECTS_LIBOPENMPT) $(LOADLIBES) $(LDLIBS) $(LDLIBS_LIBOPENMPT) $(LDLIBS_EXAMPLES) -o $@ ifeq ($(HOST),unix) $(SILENT)mv $@ $@.norpath - $(INFO) [LD ] $@ + $(INFO) [LD] $@ $(SILENT)$(LINK.cc) $(LDFLAGS_RPATH) $(LDFLAGS_LIBOPENMPT) $(LDFLAGS_EXAMPLES) libopenmpt/examples/libopenmpt_example_cxx.o $(OBJECTS_LIBOPENMPT) $(LOADLIBES) $(LDLIBS) $(LDLIBS_LIBOPENMPT) $(LDLIBS_EXAMPLES) -o $@ endif Index: trunk/OpenMPT/common =================================================================== --- trunk/OpenMPT/common 2014-02-12 12:54:00 UTC (rev 3702) +++ trunk/OpenMPT/common 2014-02-12 13:37:08 UTC (rev 3703) Property changes on: trunk/OpenMPT/common ___________________________________________________________________ Modified: svn:ignore ## -1,2 +1,3 ## *.d +*.o svn_version Index: trunk/OpenMPT/libopenmpt =================================================================== --- trunk/OpenMPT/libopenmpt 2014-02-12 12:54:00 UTC (rev 3702) +++ trunk/OpenMPT/libopenmpt 2014-02-12 13:37:08 UTC (rev 3703) Property changes on: trunk/OpenMPT/libopenmpt ___________________________________________________________________ Modified: svn:ignore ## -1,4 +1,5 ## *.d +*.o *.sdf *.suo *.opensdf Modified: trunk/OpenMPT/libopenmpt/dox/changelog.md =================================================================== --- trunk/OpenMPT/libopenmpt/dox/changelog.md 2014-02-12 12:54:00 UTC (rev 3702) +++ trunk/OpenMPT/libopenmpt/dox/changelog.md 2014-02-12 13:37:08 UTC (rev 3703) @@ -7,6 +7,9 @@ ### libopenmpt svn + * [Change] The test suite is now built by default with Makefile based builds. + Use `TEST=0` to skip building the tests. `make check` runs the test suite. + * [Bug] Crash in MOD loader on architectures not supporting unaligned memory access. * [Bug] MMCMP, PP20 and XPK unpackers should now work on non-x86 hardware and Modified: trunk/OpenMPT/libopenmpt/dox/quickstart.md =================================================================== --- trunk/OpenMPT/libopenmpt/dox/quickstart.md 2014-02-12 12:54:00 UTC (rev 3702) +++ trunk/OpenMPT/libopenmpt/dox/quickstart.md 2014-02-12 13:37:08 UTC (rev 3703) @@ -22,12 +22,10 @@ svn checkout http://svn.code.sf.net/p/modplug/code/trunk/OpenMPT/ openmpt-trunk cd openmpt-trunk - make TEST=1 clean - make TEST=1 - make TEST=1 check make clean make make doc + make check sudo make install # installs into /usr/local by default sudo make install-doc # installs into /usr/local by default openmpt123 $SOMEMODULE Modified: trunk/OpenMPT/libopenmpt/dox/tests.md =================================================================== --- trunk/OpenMPT/libopenmpt/dox/tests.md 2014-02-12 12:54:00 UTC (rev 3702) +++ trunk/OpenMPT/libopenmpt/dox/tests.md 2014-02-12 13:37:08 UTC (rev 3703) @@ -14,15 +14,14 @@ Compile with - make TEST=1 $YOURMAKEOPTIONS clean - make TEST=1 $YOURMAKEOPTIONS - make TEST=1 $YOURMAKEOPTIONS check - -In order to build your normal binaries again, run - make $YOURMAKEOPTIONS clean make $YOURMAKEOPTIONS +and run + + make $YOURMAKEOPTIONS check + +. As the build system retains no state between make invocations, you have to provide your make options on every make invocation. Index: trunk/OpenMPT/soundlib =================================================================== --- trunk/OpenMPT/soundlib 2014-02-12 12:54:00 UTC (rev 3702) +++ trunk/OpenMPT/soundlib 2014-02-12 13:37:08 UTC (rev 3703) Property changes on: trunk/OpenMPT/soundlib ___________________________________________________________________ Modified: svn:ignore ## -1 +1,2 ## *.d +*.o Index: trunk/OpenMPT/test =================================================================== --- trunk/OpenMPT/test 2014-02-12 12:54:00 UTC (rev 3702) +++ trunk/OpenMPT/test 2014-02-12 13:37:08 UTC (rev 3703) Property changes on: trunk/OpenMPT/test ___________________________________________________________________ Modified: svn:ignore ## -2,3 +2,4 ## test.saved.s3m test.saved.xm *.d +*.o This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2014-02-12 15:24:48
|
Revision: 3705 http://sourceforge.net/p/modplug/code/3705 Author: saga-games Date: 2014-02-12 15:24:37 +0000 (Wed, 12 Feb 2014) Log Message: ----------- [Mod] Update smbPitchShift to v1.2 [Mod] Use better quality default for pitch shifting. [Mod] Fix 8-bit conversion code for pitch shifting so that upsampling is no longer required. [Mod] OpenMPT: Version is now 1.22.07.21 Modified Paths: -------------- trunk/OpenMPT/common/versionNumber.h trunk/OpenMPT/include/smbPitchShift/smbPitchShift.cpp trunk/OpenMPT/include/smbPitchShift/smbPitchShift.h trunk/OpenMPT/mptrack/Ctrl_smp.cpp trunk/OpenMPT/soundlib/SampleFormatConverters.h Modified: trunk/OpenMPT/common/versionNumber.h =================================================================== --- trunk/OpenMPT/common/versionNumber.h 2014-02-12 13:59:49 UTC (rev 3704) +++ trunk/OpenMPT/common/versionNumber.h 2014-02-12 15:24:37 UTC (rev 3705) @@ -17,7 +17,7 @@ #define VER_MAJORMAJOR 1 #define VER_MAJOR 22 #define VER_MINOR 07 -#define VER_MINORMINOR 20 +#define VER_MINORMINOR 21 //Version string. For example "1.17.02.28" #define MPT_VERSION_STR VER_STRINGIZE(VER_MAJORMAJOR) "." VER_STRINGIZE(VER_MAJOR) "." VER_STRINGIZE(VER_MINOR) "." VER_STRINGIZE(VER_MINORMINOR) Modified: trunk/OpenMPT/include/smbPitchShift/smbPitchShift.cpp =================================================================== --- trunk/OpenMPT/include/smbPitchShift/smbPitchShift.cpp 2014-02-12 13:59:49 UTC (rev 3704) +++ trunk/OpenMPT/include/smbPitchShift/smbPitchShift.cpp 2014-02-12 15:24:37 UTC (rev 3705) @@ -1,7 +1,7 @@ /**************************************************************************** * * NAME: smbPitchShift.cpp -* VERSION: 1.1 +* VERSION: 1.2 * HOME URL: http://www.dspdimension.com * KNOWN BUGS: none * @@ -15,7 +15,7 @@ * numSampsToProcess-1]. The two buffers can be identical (ie. it can process the * data in-place). fftFrameSize defines the FFT frame size used for the * processing. Typical values are 1024, 2048 and 4096. It may be any value <= -* MAX_FFT_FRAME_LENGTH but it MUST be a power of 2. osamp is the STFT +* MAX_FRAME_LENGTH but it MUST be a power of 2. osamp is the STFT * oversampling factor which also determines the overlap between adjacent STFT * frames. It should at least be 4 for moderate scaling ratios. A value of 32 is * recommended for best quality. sampleRate takes the sample rate for the signal @@ -24,7 +24,7 @@ * for the data, make sure you scale the data accordingly (for 16bit signed integers * you would have to divide (and multiply) by 32768). * -* COPYRIGHT 1999-2003 Stephan M. Bernsee <sm...@ds...> +* COPYRIGHT 1999-2009 Stephan M. Bernsee <smb [AT] dspdimension [DOT] com> * * The Wide Open License (WOL) * @@ -40,8 +40,10 @@ #include <string.h> #include <math.h> -#include "smbPitchShift.h" +#include <stdio.h> +#define M_PI 3.14159265358979323846 +#define MAX_FRAME_LENGTH 8192 void smbFft(float *fftBuffer, long fftFrameSize, long sign); double smbAtan2(double x, double y); @@ -50,14 +52,15 @@ // ----------------------------------------------------------------------------------------------------------------- -void smbPitchShift(float pitchShift, long numSampsToProcess, long fftFrameSize, long osamp, float sampleRate, float *indata, float *outdata, bool gInit) +void smbPitchShift(float pitchShift, long numSampsToProcess, long fftFrameSize, long osamp, float sampleRate, float *indata, float *outdata) /* Routine smbPitchShift(). See top of file for explanation Purpose: doing pitch shifting while maintaining duration using the Short Time Fourier Transform. - Author: (c)1999-2002 Stephan M. Bernsee <sm...@ds...> + Author: (c)1999-2009 Stephan M. Bernsee <smb [AT] dspdimension [DOT] com> */ { + static float gInFIFO[MAX_FRAME_LENGTH]; static float gOutFIFO[MAX_FRAME_LENGTH]; static float gFFTworksp[2*MAX_FRAME_LENGTH]; @@ -68,34 +71,32 @@ static float gAnaMagn[MAX_FRAME_LENGTH]; static float gSynFreq[MAX_FRAME_LENGTH]; static float gSynMagn[MAX_FRAME_LENGTH]; - static long gRover = false; + static long gRover = false, gInit = false; double magn, phase, tmp, window, real, imag; double freqPerBin, expct; - long i,k, qpd, index, inFifoLatency, stepSize, fftFrameSize2, fadeZoneLen; + long i,k, qpd, index, inFifoLatency, stepSize, fftFrameSize2; + /* set up some handy variables */ + fftFrameSize2 = fftFrameSize/2; + stepSize = fftFrameSize/osamp; + freqPerBin = sampleRate/(double)fftFrameSize; + expct = 2.*M_PI*(double)stepSize/(double)fftFrameSize; + inFifoLatency = fftFrameSize-stepSize; + if (gRover == false) gRover = inFifoLatency; + /* initialize our static arrays */ - if (gInit == true) { + if (gInit == false) { memset(gInFIFO, 0, MAX_FRAME_LENGTH*sizeof(float)); memset(gOutFIFO, 0, MAX_FRAME_LENGTH*sizeof(float)); memset(gFFTworksp, 0, 2*MAX_FRAME_LENGTH*sizeof(float)); - memset(gLastPhase, 0, MAX_FRAME_LENGTH*sizeof(float)/2); - memset(gSumPhase, 0, MAX_FRAME_LENGTH*sizeof(float)/2); + memset(gLastPhase, 0, (MAX_FRAME_LENGTH/2+1)*sizeof(float)); + memset(gSumPhase, 0, (MAX_FRAME_LENGTH/2+1)*sizeof(float)); memset(gOutputAccum, 0, 2*MAX_FRAME_LENGTH*sizeof(float)); memset(gAnaFreq, 0, MAX_FRAME_LENGTH*sizeof(float)); memset(gAnaMagn, 0, MAX_FRAME_LENGTH*sizeof(float)); - gRover = false; - gInit = false; + gInit = true; } - /* set up some handy variables */ - fadeZoneLen = fftFrameSize/2; - fftFrameSize2 = fftFrameSize/2; - stepSize = fftFrameSize/osamp; - freqPerBin = sampleRate/(double)fftFrameSize; - expct = 2.*M_PI*(double)stepSize/(double)fftFrameSize; - inFifoLatency = fftFrameSize-stepSize; - if (gRover == false) gRover = inFifoLatency; - /* main processing loop */ for (i = 0; i < numSampsToProcess; i++){ @@ -156,20 +157,18 @@ } - - /* ***************** PROCESSING ******************* */ /* this does the actual pitch shifting */ memset(gSynMagn, 0, fftFrameSize*sizeof(float)); memset(gSynFreq, 0, fftFrameSize*sizeof(float)); - for (k = 0; k <= fftFrameSize2; k++) { - index = k/pitchShift; - if (index <= fftFrameSize2) { - gSynMagn[k] += gAnaMagn[index]; - gSynFreq[k] = gAnaFreq[index] * pitchShift; - } + for (k = 0; k <= fftFrameSize2; k++) { + index = k*pitchShift; + if (index <= fftFrameSize2) { + gSynMagn[index] += gAnaMagn[k]; + gSynFreq[index] = gAnaFreq[k] * pitchShift; + } } - + /* ***************** SYNTHESIS ******************* */ /* this is the synthesis step */ for (k = 0; k <= fftFrameSize2; k++) { @@ -253,7 +252,7 @@ *p1 = *p2; *p2 = temp; } } - for (k = 0, le = 2; k < (long)(log((double)fftFrameSize)/log(2.)); k++) { + for (k = 0, le = 2; k < (long)(log((double)fftFrameSize)/log(2.)+.5); k++) { le <<= 1; le2 = le>>1; ur = 1.0; Modified: trunk/OpenMPT/include/smbPitchShift/smbPitchShift.h =================================================================== --- trunk/OpenMPT/include/smbPitchShift/smbPitchShift.h 2014-02-12 13:59:49 UTC (rev 3704) +++ trunk/OpenMPT/include/smbPitchShift/smbPitchShift.h 2014-02-12 15:24:37 UTC (rev 3705) @@ -1,9 +1,7 @@ #ifndef SMBPITCHSHIFT_H #define SMBPITCHSHIFT_H -#define M_PI 3.14159265358979323846 +extern void smbPitchShift(float pitchShift, long numSampsToProcess, long fftFrameSize, long osamp, float sampleRate, float *indata, float *outdata); #define MAX_FRAME_LENGTH 8192 -extern void smbPitchShift(float pitchShift, long numSampsToProcess, long fftFrameSize, long osamp, float sampleRate, float *indata, float *outdata, bool gInit); - #endif \ No newline at end of file Modified: trunk/OpenMPT/mptrack/Ctrl_smp.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_smp.cpp 2014-02-12 13:59:49 UTC (rev 3704) +++ trunk/OpenMPT/mptrack/Ctrl_smp.cpp 2014-02-12 15:24:37 UTC (rev 3705) @@ -30,6 +30,7 @@ #include "../common/StringFixer.h" #include "MemoryMappedFile.h" #include "../soundlib/FileReader.h" +#include "../soundlib/SampleFormatConverters.h" #include <Shlwapi.h> #include "FileDialog.h" @@ -46,26 +47,27 @@ // Float point comparison bool EqualTof(const float a, const float b) { - return (fabs(a - b) <= FLOAT_ERROR); + return (fabs(a - b) <= FLOAT_ERROR); } // Round floating point value to "digit" number of digits float Round(const float value, const int digit) { float v = 0.1f * (value * powf(10.0f, (float)(digit + 1)) + (value < 0.0f ? -5.0f : 5.0f)); - modff(v, &v); - return v / powf(10.0f, (float)digit); + modff(v, &v); + return v / powf(10.0f, (float)digit); } -// Deduce exponent from equation : v = 2^exponent -int PowerOf2Exponent(const unsigned int v) +template<int v> +int PowerOf2Exponent() { - return (int)_logb((double)v); - //float v2f = (float)v; - //return ( (*(int *)&v2f >> 23) & 0xff ) - 127; + if(v <= 1) + return 0; + else + return 1 + PowerOf2Exponent<v / 2>(); } -// -! TEST#0029 + #define BASENOTE_MIN (1*12) // C-1 #define BASENOTE_MAX (9*12) // C-9 @@ -284,15 +286,16 @@ // Quality selection combo = (CComboBox *)GetDlgItem(IDC_COMBO5); - if(combo){ + if(combo) + { // Allow quality from 4 to 128 for(int i = 4 ; i <= 128 ; i++) { wsprintf(str,"%d",i); combo->SetItemData(combo->AddString(str), i-4); } - // Set 4 as default quality - combo->SetCurSel(0); + // Set 32 as default quality + combo->SetCurSel(32 - 4); } // FFT size selection @@ -300,14 +303,15 @@ if(combo) { // Deduce exponent from equation : MAX_FRAME_LENGTH = 2^exponent - int exponent = PowerOf2Exponent(MAX_FRAME_LENGTH); + const int exponent = PowerOf2Exponent<MAX_FRAME_LENGTH>(); // Allow FFT size from 2^8 (256) to 2^exponent (MAX_FRAME_LENGTH) - for(int i = 8 ; i <= exponent ; i++){ + for(int i = 8 ; i <= exponent ; i++) + { wsprintf(str,"%d",1<<i); combo->SetItemData(combo->AddString(str), i-8); } - // Set 2048 as default FFT size - combo->SetCurSel(3); + // Set 4096 as default FFT size + combo->SetCurSel(4); } // Stretch ratio @@ -1163,9 +1167,9 @@ m_modDoc.GetSampleUndo().PrepareUndo(iSmp, sundo_update, "Normalize", selStart, selEnd); - if(sample.uFlags & CHN_STEREO) { selStart *= 2; selEnd *= 2; } + if(sample.uFlags[CHN_STEREO]) { selStart *= 2; selEnd *= 2; } - if(sample.uFlags & CHN_16BIT) + if(sample.uFlags[CHN_16BIT]) { int16 *p = (int16 *)sample.pSample; int max = 1; @@ -1234,10 +1238,10 @@ m_modDoc.GetSampleUndo().PrepareUndo(m_nSample, sundo_update, "Amplify", selection.nStart, selection.nEnd); - if (sample.uFlags & CHN_STEREO) { selection.nStart *= 2; selection.nEnd *= 2; } + if (sample.uFlags[CHN_STEREO]) { selection.nStart *= 2; selection.nEnd *= 2; } SmpLength len = selection.nEnd - selection.nStart; if ((bFadeIn) && (bFadeOut)) lAmp *= 4; - if (sample.uFlags & CHN_16BIT) + if (sample.uFlags[CHN_16BIT]) { signed short *p = ((signed short *)sample.pSample) + selection.nStart; @@ -1426,7 +1430,7 @@ { SmpLength len = dwEnd - dwStart; int maxndx = sample.nLength; - if (sample.uFlags & CHN_16BIT) + if (sample.uFlags[CHN_16BIT]) { signed short *psrc = ((signed short *)pOriginal)+iCh; signed short *pdest = ((signed short *)pNewSample)+dwStart*nCh+iCh; @@ -1563,7 +1567,7 @@ { int len = dwRemove; int maxndx = sample.nLength; - if (sample.uFlags & CHN_16BIT) + if (sample.uFlags[CHN_16BIT]) { signed short *psrc = ((signed short *)pOriginal)+iCh; signed short *pdest = ((signed short *)pNewSample)+dwStart*nCh+iCh; @@ -1701,7 +1705,7 @@ CPSRatioCalc dlg(m_sndFile, m_nSample, m_dTimeStretchRatio, this); if (dlg.DoModal() != IDOK) return; - //Update ratio value&textbox + //Update ratio value&textbox m_dTimeStretchRatio = dlg.m_dRatio; UpdateData(FALSE); //end rewbs.timeStretchMods @@ -1994,6 +1998,7 @@ return 0; } + int CCtrlSamples::PitchShift(float pitch) //--------------------------------------- { @@ -2005,8 +2010,8 @@ ModSample &sample = m_sndFile.GetSample(m_nSample); // Get number of channels & sample size - BYTE smpsize = sample.GetElementarySampleSize(); - UINT nChn = sample.GetNumChannels(); + const uint8 smpsize = sample.GetElementarySampleSize(); + const uint8 nChn = sample.GetNumChannels(); // Get selected oversampling - quality - (also refered as FFT overlapping) factor CComboBox *combo = (CComboBox *)GetDlgItem(IDC_COMBO5); @@ -2038,33 +2043,21 @@ // Show wait mouse cursor BeginWaitCursor(); - - // PitchShift seems to work only with 16-bit samples. - if(smpsize != 2) - { - // This has to be converted to 16-bit first. - SetSelectionPoints(0, 0); // avoid partial upsampling. - OnUpsample(); - smpsize = sample.GetElementarySampleSize(); - } - // Get original sample rate - long lSampleRate = sample.GetSampleRate(m_sndFile.GetType()); + const float sampleRate = static_cast<float>(sample.GetSampleRate(m_sndFile.GetType())); - // Deduce max sample value (float conversion step) - float maxSampleValue = float(( 1 << (smpsize * 8 - 1) ) - 1); + // Allocate working buffer + const size_t bufferSize = MAX_BUFFER_LENGTH + fft; + float *buffer = new float[bufferSize]; - // Allocate working buffers - float * buffer = new float[MAX_BUFFER_LENGTH + fft]; - float * outbuf = new float[MAX_BUFFER_LENGTH + fft]; - m_modDoc.GetSampleUndo().PrepareUndo(m_nSample, sundo_replace, "Pitch Shift"); // Process each channel separately - for(UINT i = 0 ; i < nChn ; i++){ + for(uint8 i = 0 ; i < nChn ; i++) + { - UINT pos = 0; - UINT len = MAX_BUFFER_LENGTH; + SmpLength pos = 0; + SmpLength len = MAX_BUFFER_LENGTH; // Process sample buffer using MAX_BUFFER_LENGTH (max) sized chunk steps (in order to allow // the processing of BIG samples...) @@ -2077,16 +2070,16 @@ // TRICK : output buffer offset management // as the pitch-shifter adds some blank signal in head of output buffer (matching FFT // length - in short it needs a certain amount of data before being able to output some - // meaningfull processed samples) , in order to avoid this behaviour , we will ignore + // meaningfull processed samples) , in order to avoid this behaviour , we will ignore // the first FFT_length samples and process the same amount of extra blank samples // (all 0.0f) at the end of the buffer (those extra samples will benefit from internal // FFT data computed during the previous steps resulting in a correct and consistent // signal output). bool bufstart = ( pos == 0 ); bool bufend = ( pos + MAX_BUFFER_LENGTH >= sample.nLength ); - UINT startoffset = ( bufstart ? fft : 0 ); - UINT inneroffset = ( bufstart ? 0 : fft ); - UINT finaloffset = ( bufend ? fft : 0 ); + SmpLength startoffset = ( bufstart ? fft : 0 ); + SmpLength inneroffset = ( bufstart ? 0 : fft ); + SmpLength finaloffset = ( bufend ? fft : 0 ); // Show progress bar using process button painting & text label CHAR progress[16]; @@ -2103,49 +2096,43 @@ ::GdiFlush(); // Re-initialize pitch-shifter with blank FFT before processing 1st chunk of current channel - if(bufstart){ - for(UINT j = 0 ; j < fft ; j++) buffer[j] = 0.0f; - smbPitchShift(pitch, fft, fft, ovs, (float)lSampleRate, buffer, outbuf, true); + if(bufstart) + { + for(UINT j = 0; j < fft; j++) buffer[j] = 0.0f; + smbPitchShift(pitch, fft, fft, ovs, sampleRate, buffer, buffer); } // Convert current channel's data chunk to float - BYTE * ptr = (BYTE *)sample.pSample + pos * smpsize * nChn + i * smpsize; + int8 *ptr = (int8 *)sample.pSample + pos * smpsize * nChn + i * smpsize; - for(UINT j = 0 ; j < len ; j++){ - switch(smpsize){ - case 2: - buffer[j] = ((float)(*(SHORT *)ptr)) / maxSampleValue; - break; - case 1: - buffer[j] = ((float)*ptr) / maxSampleValue; - break; - } - ptr += smpsize * nChn; + switch(smpsize) + { + case 1: + CopySample<SC::ConversionChain<SC::Convert<float, int8>, SC::DecodeIdentity<int8> > >(buffer, len, 1, ptr, sizeof(int8) * len, nChn); + break; + case 2: + CopySample<SC::ConversionChain<SC::Convert<float, int16>, SC::DecodeIdentity<int16> > >(buffer, len, 1, (int16 *)ptr, sizeof(int16) * len, nChn); + break; } // Fills extra blank samples (read TRICK description comment above) - if(bufend) for(UINT j = len ; j < len + finaloffset ; j++) buffer[j] = 0.0f; + if(bufend) for(SmpLength j = len ; j < len + finaloffset ; j++) buffer[j] = 0.0f; // Apply pitch shifting - smbPitchShift(pitch, len + finaloffset, fft, ovs, (float)lSampleRate, buffer, outbuf, false); + smbPitchShift(pitch, static_cast<long>(len + finaloffset), fft, ovs, sampleRate, buffer, buffer); // Restore pitched-shifted float sample into original sample buffer - ptr = (BYTE *)sample.pSample + (pos - inneroffset) * smpsize * nChn + i * smpsize; + ptr = (int8 *)sample.pSample + (pos - inneroffset) * smpsize * nChn + i * smpsize; + const SmpLength copyLength = len + finaloffset - startoffset + 1; - for(UINT j = startoffset ; j < len + finaloffset ; j++){ - // Just perform a little bit of clipping... - float v = outbuf[j]; - CLIP_SOUND(v); - // ...before converting back to buffer - switch(smpsize){ - case 2: - *(SHORT *)ptr = (SHORT)(v * maxSampleValue); - break; - case 1: - *ptr = (BYTE)(v * maxSampleValue); - break; - } - ptr += smpsize * nChn; + switch(smpsize) + { + case 1: + CopySample<SC::ConversionChain<SC::Convert<int8, float>, SC::DecodeIdentity<float> > >((int8 *)ptr, copyLength, nChn, buffer + startoffset, sizeof(float) * bufferSize, 1); + break; + case 2: + CopySample<SC::ConversionChain<SC::Convert<int16, float>, SC::DecodeIdentity<float> > >((int16 *)ptr, copyLength, nChn, buffer + startoffset, sizeof(float) * bufferSize, 1); + break; } // Next buffer chunk @@ -2153,9 +2140,8 @@ } } - // Free working buffers + // Free working buffer delete [] buffer; - delete [] outbuf; // Free progress bar brushes DeleteObject((HBRUSH)green); @@ -2412,10 +2398,12 @@ int nPan = GetDlgItemInt(IDC_EDIT9); if (nPan < 0) nPan = 0; //rewbs.fix36944: sample pan range to 0-64. - if (m_sndFile.m_nType == MOD_TYPE_XM) { - if (nPan>255) nPan = 255; // displayed panning will be 0-255 with XM - } else { - if (nPan>64) nPan = 64; // displayed panning will be 0-64 with anything but XM. + if (m_sndFile.GetType() == MOD_TYPE_XM) + { + if (nPan > 255) nPan = 255; // displayed panning will be 0-255 with XM + } else + { + if (nPan > 64) nPan = 64; // displayed panning will be 0-64 with anything but XM. nPan = nPan << 2; // so we x4 to get MPT's internal 0-256 range. } //end rewbs.fix36944 Modified: trunk/OpenMPT/soundlib/SampleFormatConverters.h =================================================================== --- trunk/OpenMPT/soundlib/SampleFormatConverters.h 2014-02-12 13:59:49 UTC (rev 3704) +++ trunk/OpenMPT/soundlib/SampleFormatConverters.h 2014-02-12 15:24:37 UTC (rev 3705) @@ -362,6 +362,28 @@ }; template <> +struct Convert<float32, int8> +{ + typedef int8 input_t; + typedef float32 output_t; + forceinline output_t operator() (input_t val) + { + return val * (1.0f / static_cast<float>((unsigned int)1<<7)); + } +}; + +template <> +struct Convert<float32, int16> +{ + typedef int16 input_t; + typedef float32 output_t; + forceinline output_t operator() (input_t val) + { + return val * (1.0f / static_cast<float>((unsigned int)1<<15)); + } +}; + +template <> struct Convert<float32, int32> { typedef int32 input_t; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <man...@us...> - 2014-02-13 18:09:17
|
Revision: 3710 http://sourceforge.net/p/modplug/code/3710 Author: manxorist Date: 2014-02-13 18:09:09 +0000 (Thu, 13 Feb 2014) Log Message: ----------- [Ref] ASIO: Display ASIO features queried by the driver in the settings' statistics field. If the driver uses features which OpenMPT does not support, display a warning there. Modified Paths: -------------- trunk/OpenMPT/mptrack/Mpdlgs.cpp trunk/OpenMPT/sounddev/SoundDevice.h trunk/OpenMPT/sounddev/SoundDeviceASIO.cpp trunk/OpenMPT/sounddev/SoundDeviceASIO.h Modified: trunk/OpenMPT/mptrack/Mpdlgs.cpp =================================================================== --- trunk/OpenMPT/mptrack/Mpdlgs.cpp 2014-02-13 16:49:51 UTC (rev 3709) +++ trunk/OpenMPT/mptrack/Mpdlgs.cpp 2014-02-13 18:09:09 UTC (rev 3710) @@ -691,7 +691,8 @@ s += mpt::String::Print("Buffer: %1%%\r\n", (bufferAttributes.Latency > 0.0) ? Util::Round<int64>(currentLatency / bufferAttributes.Latency * 100.0) : 0); } s += mpt::String::Print("Latency: %1 ms (current: %2 ms, %3 frames)\r\n", mpt::Format("%4.1f").ToString(bufferAttributes.Latency * 1000.0), mpt::Format("%4.1f").ToString(currentLatency * 1000.0), Util::Round<int64>(currentLatency * samplerate)); - s += mpt::String::Print("Update Interval: %1 ms (current: %2 ms, %3 frames)\r\n", mpt::Format("%4.1f").ToString(bufferAttributes.UpdateInterval * 1000.0), mpt::Format("%4.1f").ToString(currentUpdateInterval * 1000.0), Util::Round<int64>(currentUpdateInterval * samplerate)); + s += mpt::String::Print("Period: %1 ms (current: %2 ms, %3 frames)\r\n", mpt::Format("%4.1f").ToString(bufferAttributes.UpdateInterval * 1000.0), mpt::Format("%4.1f").ToString(currentUpdateInterval * 1000.0), Util::Round<int64>(currentUpdateInterval * samplerate)); + s += pMainFrm->gpSoundDevice->GetStatistics(); m_EditStatistics.SetWindowText(s.c_str()); } else { Modified: trunk/OpenMPT/sounddev/SoundDevice.h =================================================================== --- trunk/OpenMPT/sounddev/SoundDevice.h 2014-02-13 16:49:51 UTC (rev 3709) +++ trunk/OpenMPT/sounddev/SoundDevice.h 2014-02-13 18:09:09 UTC (rev 3710) @@ -448,7 +448,10 @@ int64 GetStreamPositionFrames() const; + virtual std::string GetStatistics() const { return std::string(); } + virtual bool OpenDriverSettings() { return false; }; + }; Modified: trunk/OpenMPT/sounddev/SoundDeviceASIO.cpp =================================================================== --- trunk/OpenMPT/sounddev/SoundDeviceASIO.cpp 2014-02-13 16:49:51 UTC (rev 3709) +++ trunk/OpenMPT/sounddev/SoundDeviceASIO.cpp 2014-02-13 18:09:09 UTC (rev 3710) @@ -201,6 +201,9 @@ m_BufferIndex = 0; InterlockedExchange(&m_RenderSilence, 0); InterlockedExchange(&m_RenderingSilence, 0); + + m_QueriedFeatures.reset(); + m_UsedFeatures.reset(); } @@ -1020,7 +1023,10 @@ //----------------------------------------------------------------------------------------------------------- { ASSERT(directProcess); // !directProcess is not handled correctly in OpenMPT, would require a separate thread and potentially additional buffering - MPT_UNREFERENCED_PARAMETER(directProcess); + if(!directProcess) + { + m_UsedFeatures.set(AsioFeatureNoDirectProcess); + } if(m_Settings.UseHardwareTiming) { if(params) @@ -1087,6 +1093,35 @@ } +static std::string AsioFeaturesToString(FlagSet<AsioFeatures> features) +//--------------------------------------------------------------------- +{ + std::string result; + bool first = true; + if(features[AsioFeatureResetRequest]) { if(!first) { result += ","; } first = false; result += "reset"; } + if(features[AsioFeatureResyncRequest]) { if(!first) { result += ","; } first = false; result += "resync"; } + if(features[AsioFeatureLatenciesChanged]) { if(!first) { result += ","; } first = false; result += "latency"; } + if(features[AsioFeatureBufferSizeChange]) { if(!first) { result += ","; } first = false; result += "buffer"; } + if(features[AsioFeatureOverload]) { if(!first) { result += ","; } first = false; result += "load"; } + if(features[AsioFeatureNoDirectProcess]) { if(!first) { result += ","; } first = false; result += "nodirect"; } + return result; +} + + +std::string CASIODevice::GetStatistics() const +//-------------------------------------------- +{ + if(m_UsedFeatures.any()) + { + return mpt::String::Print("WARNING: unsupported features used: %1", AsioFeaturesToString(m_UsedFeatures)); + } else if(m_QueriedFeatures.any()) + { + return mpt::String::Print("features queried: %1", AsioFeaturesToString(m_QueriedFeatures)); + } + return std::string(); +} + + long CASIODevice::AsioMessage(long selector, long value, void* message, double* opt) //---------------------------------------------------------------------------------- { @@ -1104,10 +1139,30 @@ result = m_Settings.UseHardwareTiming ? 1 : 0; break; case kAsioResetRequest: + m_QueriedFeatures.set(AsioFeatureResetRequest); + // unsupported + result = 0; + break; case kAsioBufferSizeChange: + m_QueriedFeatures.set(AsioFeatureBufferSizeChange); + // unsupported + result = 0; + break; case kAsioResyncRequest: + m_QueriedFeatures.set(AsioFeatureResyncRequest); + // unsupported + result = 0; + break; case kAsioLatenciesChanged: + m_QueriedFeatures.set(AsioFeatureLatenciesChanged); + // unsupported + result = 0; + break; case kAsioOverload: + m_QueriedFeatures.set(AsioFeatureOverload); + // unsupported + result = 0; + break; default: // unsupported result = 0; @@ -1121,10 +1176,30 @@ result = m_Settings.UseHardwareTiming ? 1 : 0; break; case kAsioResetRequest: + m_UsedFeatures.set(AsioFeatureResetRequest); + // unsupported + result = 0; + break; case kAsioBufferSizeChange: + m_UsedFeatures.set(AsioFeatureBufferSizeChange); + // unsupported + result = 0; + break; case kAsioResyncRequest: + m_UsedFeatures.set(AsioFeatureResyncRequest); + // unsupported + result = 0; + break; case kAsioLatenciesChanged: + m_UsedFeatures.set(AsioFeatureLatenciesChanged); + // unsupported + result = 0; + break; case kAsioOverload: + m_UsedFeatures.set(AsioFeatureOverload); + // unsupported + result = 0; + break; default: // unsupported result = 0; Modified: trunk/OpenMPT/sounddev/SoundDeviceASIO.h =================================================================== --- trunk/OpenMPT/sounddev/SoundDeviceASIO.h 2014-02-13 16:49:51 UTC (rev 3709) +++ trunk/OpenMPT/sounddev/SoundDeviceASIO.h 2014-02-13 18:09:09 UTC (rev 3710) @@ -13,6 +13,8 @@ #include "SoundDevices.h" +#include "../common/FlagSet.h" + #ifndef NO_ASIO #include <iasiodrv.h> #endif @@ -24,6 +26,18 @@ #ifndef NO_ASIO +enum AsioFeatures +{ + AsioFeatureResetRequest = 1<<0, + AsioFeatureResyncRequest = 1<<1, + AsioFeatureLatenciesChanged = 1<<2, + AsioFeatureBufferSizeChange = 1<<3, + AsioFeatureOverload = 1<<4, + AsioFeatureNoDirectProcess = 1<<5, + AsioFeatureNone = 0 +}; +DECLARE_FLAGSET(AsioFeatures) + //==================================== class CASIODevice: public ISoundDevice //==================================== @@ -54,6 +68,9 @@ int64 m_StreamPositionOffset; + FlagSet<AsioFeatures> m_QueriedFeatures; + FlagSet<AsioFeatures> m_UsedFeatures; + private: void UpdateTimeInfo(AsioTimeInfo asioTimeInfo); @@ -83,6 +100,8 @@ SoundDeviceCaps GetDeviceCaps(const std::vector<uint32> &baseSampleRates); bool OpenDriverSettings(); + std::string GetStatistics() const; + public: static std::vector<SoundDeviceInfo> EnumerateDevices(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2014-02-14 20:06:24
|
Revision: 3713 http://sourceforge.net/p/modplug/code/3713 Author: saga-games Date: 2014-02-14 20:06:12 +0000 (Fri, 14 Feb 2014) Log Message: ----------- [Ref] Add SNDMIXPLUGIN::Destroy to unify plugin destroy code (shouldn't leak anymore when throwing away the last plugin due to moving around other slots) Modified Paths: -------------- trunk/OpenMPT/mptrack/SelectPluginDialog.cpp trunk/OpenMPT/mptrack/View_gen.cpp trunk/OpenMPT/soundlib/Sndfile.cpp trunk/OpenMPT/soundlib/plugins/PlugInterface.h Modified: trunk/OpenMPT/mptrack/SelectPluginDialog.cpp =================================================================== --- trunk/OpenMPT/mptrack/SelectPluginDialog.cpp 2014-02-14 00:16:27 UTC (rev 3712) +++ trunk/OpenMPT/mptrack/SelectPluginDialog.cpp 2014-02-14 20:06:12 UTC (rev 3713) @@ -123,20 +123,9 @@ { CriticalSection cs; - if (pCurrentPlugin != nullptr) - { - pCurrentPlugin->Release(); - } + // Destroy old plugin, if there was one. + m_pPlugin->Destroy(); - // Just in case... - m_pPlugin->pMixPlugin = nullptr; - m_pPlugin->pMixState = nullptr; - - // Remove old state - m_pPlugin->nPluginDataSize = 0; - if (m_pPlugin->pPluginData) delete[] m_pPlugin->pPluginData; - m_pPlugin->pPluginData = nullptr; - // Initialize plugin info MemsetZero(m_pPlugin->Info); m_pPlugin->Info.dwPluginId1 = pFactory->pluginId1; Modified: trunk/OpenMPT/mptrack/View_gen.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_gen.cpp 2014-02-14 00:16:27 UTC (rev 3712) +++ trunk/OpenMPT/mptrack/View_gen.cpp 2014-02-14 20:06:12 UTC (rev 3713) @@ -1342,9 +1342,7 @@ MovePlug(MAX_MIXPLUGINS - 1, MAX_MIXPLUGINS - 2, true); } else { - pSndFile->m_MixPlugins[MAX_MIXPLUGINS - 1].pMixPlugin->Release(); - memset(&(pSndFile->m_MixPlugins[MAX_MIXPLUGINS - 1]), 0, sizeof(SNDMIXPLUGIN)); - //possible mem leak here... + pSndFile->m_MixPlugins[MAX_MIXPLUGINS - 1].Destroy(); } } Modified: trunk/OpenMPT/soundlib/Sndfile.cpp =================================================================== --- trunk/OpenMPT/soundlib/Sndfile.cpp 2014-02-14 00:16:27 UTC (rev 3712) +++ trunk/OpenMPT/soundlib/Sndfile.cpp 2014-02-14 20:06:12 UTC (rev 3713) @@ -1016,18 +1016,7 @@ } for(PLUGINDEX i = 0; i < MAX_MIXPLUGINS; i++) { - if ((m_MixPlugins[i].nPluginDataSize) && (m_MixPlugins[i].pPluginData)) - { - m_MixPlugins[i].nPluginDataSize = 0; - delete[] m_MixPlugins[i].pPluginData; - m_MixPlugins[i].pPluginData = NULL; - } - m_MixPlugins[i].pMixState = NULL; - if (m_MixPlugins[i].pMixPlugin) - { - m_MixPlugins[i].pMixPlugin->Release(); - m_MixPlugins[i].pMixPlugin = NULL; - } + m_MixPlugins[i].Destroy(); } m_nType = MOD_TYPE_NONE; @@ -2150,7 +2139,7 @@ { UpgradePatternData(CSoundFile &sf) : sndFile(sf), chn(0) { } - void operator()(ModCommand& m) + void operator() (ModCommand &m) { if(m.IsPcNote()) { @@ -2165,7 +2154,7 @@ // Out-of-range global volume commands should be ignored. // OpenMPT 1.17.03.02 fixed this in compatible mode, OpenMPT 1.20 fixes it in normal mode as well. // So for tracks made with older versions than OpenMPT 1.17.03.02 or tracks made with 1.17.03.02 <= version < 1.20, we limit invalid global volume commands. - LimitMax(m.param, (sndFile.GetType() & (MOD_TYPE_IT | MOD_TYPE_MPT)) ? BYTE(128): BYTE(64)); + LimitMax(m.param, ModCommand::PARAM((sndFile.GetType() & (MOD_TYPE_IT | MOD_TYPE_MPT)) ? 128: 64)); } else if(m.command == CMD_S3MCMDEX && (sndFile.GetType() & (MOD_TYPE_IT | MOD_TYPE_MPT))) { // SC0 and SD0 should be interpreted as SC1 and SD1 in IT files. @@ -2231,8 +2220,7 @@ // OpenMPT 1.20 fixes multiple fine pattern delays on the same row. Previously, only the last command was considered, // but all commands should be added up. Since Scream Tracker 3 itself doesn't support S6x, we also use Impulse Tracker's behaviour here, // since we can assume that most S3Ms that make use of S6x were composed with Impulse Tracker. - ModCommand *fixCmd = (&m) - chn; - for(CHANNELINDEX i = 0; i < chn; i++, fixCmd++) + for(ModCommand *fixCmd = (&m) - chn; fixCmd < &m; fixCmd++) { if((fixCmd->command == CMD_S3MCMDEX || fixCmd->command == CMD_XFINEPORTAUPDOWN) && (fixCmd->param & 0xF0) == 0x60) { @@ -2245,8 +2233,7 @@ { // OpenMPT 1.20 fixes multiple pattern delays on the same row. Previously, only the *last* command was considered, // but Scream Tracker 3 and Impulse Tracker only consider the *first* command. - ModCommand *fixCmd = (&m) - chn; - for(CHANNELINDEX i = 0; i < chn; i++, fixCmd++) + for(ModCommand *fixCmd = (&m) - chn; fixCmd < &m; fixCmd++) { if(fixCmd->command == CMD_S3MCMDEX && (fixCmd->param & 0xF0) == 0xE0) { Modified: trunk/OpenMPT/soundlib/plugins/PlugInterface.h =================================================================== --- trunk/OpenMPT/soundlib/plugins/PlugInterface.h 2014-02-14 00:16:27 UTC (rev 3712) +++ trunk/OpenMPT/soundlib/plugins/PlugInterface.h 2014-02-14 20:06:12 UTC (rev 3713) @@ -208,7 +208,20 @@ void SetOutputPlugin(PLUGINDEX plugin) { if(plugin < MAX_MIXPLUGINS) Info.dwOutputRouting = plugin + 0x80; else Info.dwOutputRouting = 0; } -}; // rewbs.dryRatio: Hopefully this doesn't need to be a fixed size. + void Destroy() + { + delete[] pPluginData; + pPluginData = nullptr; + nPluginDataSize = 0; + pMixState = nullptr; + if(pMixPlugin) + { + pMixPlugin->Release(); + pMixPlugin = nullptr; + } + } +}; + class CSoundFile; typedef bool (*PMIXPLUGINCREATEPROC)(SNDMIXPLUGIN &, CSoundFile &); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <man...@us...> - 2014-02-14 21:04:32
|
Revision: 3714 http://sourceforge.net/p/modplug/code/3714 Author: manxorist Date: 2014-02-14 21:04:24 +0000 (Fri, 14 Feb 2014) Log Message: ----------- [Fix] ASIO: Implement all driver to host messages that are required to be handled by the ASIO 2.1 specification. [Ref] sounddev: Add an idle time callback into the sound drivers. ASIO needs this to requery the latencies. [Ref] sounddev: Add stop, restart and reset requests from the driver to OpenMPT. This is needed to implement ASIO. [Ref] sounddev: Poll these driver requests in idle processing and in the 200ms GUI timer and handle them appropriately. ASIO requires this to be done at idle time and not from within a driver callback. Modified Paths: -------------- trunk/OpenMPT/mptrack/MainFrm.cpp trunk/OpenMPT/mptrack/Mainfrm.h trunk/OpenMPT/mptrack/Mptrack.cpp trunk/OpenMPT/sounddev/SoundDevice.cpp trunk/OpenMPT/sounddev/SoundDevice.h trunk/OpenMPT/sounddev/SoundDeviceASIO.cpp trunk/OpenMPT/sounddev/SoundDeviceASIO.h Modified: trunk/OpenMPT/mptrack/MainFrm.cpp =================================================================== --- trunk/OpenMPT/mptrack/MainFrm.cpp 2014-02-14 20:06:12 UTC (rev 3713) +++ trunk/OpenMPT/mptrack/MainFrm.cpp 2014-02-14 21:04:24 UTC (rev 3714) @@ -1213,6 +1213,23 @@ } +bool CMainFrame::RestartPlayback() +//-------------------------------- +{ + if(!m_pSndFile) return false; // nothing to play + if(!IsAudioDeviceOpen()) return false; + if(!gpSoundDevice->IsPlaying()) return false; + gpSoundDevice->Stop(true); + if(m_NotifyTimer) + { + KillTimer(m_NotifyTimer); + m_NotifyTimer = 0; + } + ResetNotificationBuffer(); + return StartPlayback(); +} + + bool CMainFrame::PausePlayback() //------------------------------ { @@ -1594,11 +1611,42 @@ } -BOOL CMainFrame::SetupSoundCard(const SoundDeviceSettings &deviceSettings, SoundDeviceID deviceID) -//------------------------------------------------------------------------------------------------ +void CMainFrame::IdleHandlerSounddevice() +//--------------------------------------- { - if((TrackerSettings::Instance().GetSoundDeviceID() != deviceID) || (TrackerSettings::Instance().GetSoundDeviceSettings(deviceID) != deviceSettings)) + if(gpSoundDevice) { + const LONG requestFlags = gpSoundDevice->GetRequestFlags(); + if(requestFlags & ISoundDevice::RequestFlagClose) + { + StopPlayback(); + audioCloseDevice(); + } else if(requestFlags & ISoundDevice::RequestFlagReset) + { + ResetSoundCard(); + } else if(requestFlags & ISoundDevice::RequestFlagRestart) + { + RestartPlayback(); + } else + { + gpSoundDevice->OnIdle(); + } + } +} + + +BOOL CMainFrame::ResetSoundCard() +//------------------------------- +{ + return CMainFrame::SetupSoundCard(TrackerSettings::Instance().GetSoundDeviceSettings(TrackerSettings::Instance().GetSoundDeviceID()), TrackerSettings::Instance().GetSoundDeviceID(), true); +} + + +BOOL CMainFrame::SetupSoundCard(const SoundDeviceSettings &deviceSettings, SoundDeviceID deviceID, bool forceReset) +//----------------------------------------------------------------------------------------------------------------- +{ + if(forceReset || (TrackerSettings::Instance().GetSoundDeviceID() != deviceID) || (TrackerSettings::Instance().GetSoundDeviceSettings(deviceID) != deviceSettings)) + { CModDoc *pActiveMod = nullptr; if(IsPlaying()) { @@ -1944,6 +1992,9 @@ void CMainFrame::OnTimerGUI() //--------------------------- { + + IdleHandlerSounddevice(); + // Display Time in status bar CSoundFile::samplecount_t time = 0; if(m_pSndFile != nullptr && m_pSndFile->GetSampleRate() != 0) Modified: trunk/OpenMPT/mptrack/Mainfrm.h =================================================================== --- trunk/OpenMPT/mptrack/Mainfrm.h 2014-02-14 20:06:12 UTC (rev 3713) +++ trunk/OpenMPT/mptrack/Mainfrm.h 2014-02-14 21:04:24 UTC (rev 3714) @@ -435,6 +435,7 @@ bool PreparePlayback(); bool StartPlayback(); void StopPlayback(); + bool RestartPlayback(); bool PausePlayback(); static bool IsValidSoundFile(CSoundFile &sndFile) { return sndFile.GetType() ? true : false; } static bool IsValidSoundFile(CSoundFile *pSndFile) { return pSndFile && pSndFile->GetType(); } @@ -464,7 +465,10 @@ BOOL StopRenderer(CSoundFile*); void SwitchToActiveView(); - BOOL SetupSoundCard(const SoundDeviceSettings &deviceSettings, SoundDeviceID deviceID); + void IdleHandlerSounddevice(); + + BOOL ResetSoundCard(); + BOOL SetupSoundCard(const SoundDeviceSettings &deviceSettings, SoundDeviceID deviceID, bool forceReset = false); BOOL SetupMiscOptions(); BOOL SetupPlayer(); Modified: trunk/OpenMPT/mptrack/Mptrack.cpp =================================================================== --- trunk/OpenMPT/mptrack/Mptrack.cpp 2014-02-14 20:06:12 UTC (rev 3713) +++ trunk/OpenMPT/mptrack/Mptrack.cpp 2014-02-14 21:04:24 UTC (rev 3714) @@ -1684,6 +1684,12 @@ //--------------------------------- { BOOL b = CWinApp::OnIdle(lCount); + + if(CMainFrame::GetMainFrame()) + { + CMainFrame::GetMainFrame()->IdleHandlerSounddevice(); + } + if ((gpSplashScreen) && (m_bInitialized)) { if (timeGetTime() - m_dwTimeStarted > 1000) //Set splash screen duration here -rewbs Modified: trunk/OpenMPT/sounddev/SoundDevice.cpp =================================================================== --- trunk/OpenMPT/sounddev/SoundDevice.cpp 2014-02-14 20:06:12 UTC (rev 3713) +++ trunk/OpenMPT/sounddev/SoundDevice.cpp 2014-02-14 21:04:24 UTC (rev 3714) @@ -136,6 +136,8 @@ m_CurrentUpdateInterval = 0.0; m_StreamPositionRenderFrames = 0; m_StreamPositionOutputFrames = 0; + + InterlockedExchange(&m_RequestFlags, 0); } @@ -221,6 +223,7 @@ m_BufferAttributes.Latency = m_Settings.LatencyMS / 1000.0; m_BufferAttributes.UpdateInterval = m_Settings.UpdateIntervalMS / 1000.0; m_BufferAttributes.NumBuffers = 0; + InterlockedExchange(&m_RequestFlags, 0); return InternalOpen(); } @@ -230,7 +233,9 @@ { if(!IsOpen()) return true; Stop(); - return InternalClose(); + bool result = InternalClose(); + InterlockedExchange(&m_RequestFlags, 0); + return result; } @@ -331,6 +336,7 @@ m_StreamPositionOutputFrames = 0; } m_Clock.SetResolution(1); + _InterlockedAnd(&m_RequestFlags, ~RequestFlagRestart); if(!InternalStart()) { m_Clock.SetResolution(0); @@ -342,13 +348,20 @@ } -void ISoundDevice::Stop() -//----------------------- +void ISoundDevice::Stop(bool force) +//--------------------------------- { if(!IsOpen()) return; if(IsPlaying()) { - InternalStop(); + if(force) + { + InternalStopForce(); + } else + { + InternalStop(); + } + _InterlockedAnd(&m_RequestFlags, ~RequestFlagRestart); m_Clock.SetResolution(0); m_IsPlaying = false; { Modified: trunk/OpenMPT/sounddev/SoundDevice.h =================================================================== --- trunk/OpenMPT/sounddev/SoundDevice.h 2014-02-14 20:06:12 UTC (rev 3713) +++ trunk/OpenMPT/sounddev/SoundDevice.h 2014-02-14 21:04:24 UTC (rev 3714) @@ -376,6 +376,12 @@ int64 m_StreamPositionRenderFrames; int64 m_StreamPositionOutputFrames; + mutable LONG m_RequestFlags; +public: + static const LONG RequestFlagClose = 1<<0; + static const LONG RequestFlagReset = 1<<1; + static const LONG RequestFlagRestart = 1<<2; + protected: virtual void InternalFillAudioBuffer() = 0; @@ -387,6 +393,10 @@ void SourceAudioRead(void *buffer, std::size_t numFrames); void SourceAudioDone(std::size_t numFrames, int32 framesLatency); + void RequestClose() { _InterlockedOr(&m_RequestFlags, RequestFlagClose); } + void RequestReset() { _InterlockedOr(&m_RequestFlags, RequestFlagReset); } + void RequestRestart() { _InterlockedOr(&m_RequestFlags, RequestFlagRestart); } + void AudioSendMessage(const std::string &str); protected: @@ -408,6 +418,7 @@ virtual bool InternalOpen() = 0; virtual bool InternalStart() = 0; virtual void InternalStop() = 0; + virtual void InternalStopForce() { InternalStop(); } virtual bool InternalClose() = 0; public: @@ -430,11 +441,15 @@ bool Open(const SoundDeviceSettings &settings); bool Close(); bool Start(); - void Stop(); + void Stop(bool force = false); + LONG GetRequestFlags() const { return InterlockedExchangeAdd(&m_RequestFlags, 0); /* read */ } + bool IsOpen() const { return InternalIsOpen(); } bool IsPlaying() const { return m_IsPlaying; } + virtual bool OnIdle() { return false; } // return true if any work has been done + SoundDeviceSettings GetSettings() const { return m_Settings; } SampleFormat GetActualSampleFormat() const { return IsOpen() ? m_Settings.sampleFormat : SampleFormatInvalid; } Modified: trunk/OpenMPT/sounddev/SoundDeviceASIO.cpp =================================================================== --- trunk/OpenMPT/sounddev/SoundDeviceASIO.cpp 2014-02-14 20:06:12 UTC (rev 3713) +++ trunk/OpenMPT/sounddev/SoundDeviceASIO.cpp 2014-02-14 21:04:24 UTC (rev 3714) @@ -29,6 +29,9 @@ #ifndef NO_ASIO +static const double AsioSampleRateTolerance = 0.05; + + // Helper class to temporarily open a driver for a query. class TemporaryASIODriverOpener { @@ -177,6 +180,8 @@ : ISoundDevice(id, internalID) { Init(); + m_QueriedFeatures.reset(); + m_UsedFeatures.reset(); } @@ -202,11 +207,24 @@ InterlockedExchange(&m_RenderSilence, 0); InterlockedExchange(&m_RenderingSilence, 0); - m_QueriedFeatures.reset(); - m_UsedFeatures.reset(); + InterlockedExchange(&m_AsioRequestFlags, 0); } +bool CASIODevice::HandleRequests() +//-------------------------------- +{ + bool result = false; + LONG flags = InterlockedExchange(&m_AsioRequestFlags, 0); + if(flags & AsioRequestFlagLatenciesChanged) + { + UpdateLatency(); + result = true; + } + return result; +} + + CASIODevice::~CASIODevice() //------------------------- { @@ -421,29 +439,7 @@ m_StreamPositionOffset = m_nAsioBufferLen; - SoundBufferAttributes bufferAttributes; - long inputLatency = 0; - long outputLatency = 0; - try - { - asioCall(getLatencies(&inputLatency, &outputLatency)); - } catch(...) - { - // continue, failure is not fatal here - inputLatency = 0; - outputLatency = 0; - } - if(outputLatency >= (long)m_nAsioBufferLen) - { - bufferAttributes.Latency = (double)(outputLatency + m_nAsioBufferLen) / (double)m_Settings.Samplerate; // ASIO and OpenMPT semantics of 'latency' differ by one chunk/buffer - } else - { - // pointless value returned from asio driver, use a sane estimate - bufferAttributes.Latency = 2.0 * (double)m_nAsioBufferLen / (double)m_Settings.Samplerate; - } - bufferAttributes.UpdateInterval = (double)m_nAsioBufferLen / (double)m_Settings.Samplerate; - bufferAttributes.NumBuffers = 2; - UpdateBufferAttributes(bufferAttributes); + UpdateLatency(); return true; @@ -459,6 +455,35 @@ } +void CASIODevice::UpdateLatency() +//------------------------------- +{ + SoundBufferAttributes bufferAttributes; + long inputLatency = 0; + long outputLatency = 0; + try + { + asioCall(getLatencies(&inputLatency, &outputLatency)); + } catch(...) + { + // continue, failure is not fatal here + inputLatency = 0; + outputLatency = 0; + } + if(outputLatency >= (long)m_nAsioBufferLen) + { + bufferAttributes.Latency = (double)(outputLatency + m_nAsioBufferLen) / (double)m_Settings.Samplerate; // ASIO and OpenMPT semantics of 'latency' differ by one chunk/buffer + } else + { + // pointless value returned from asio driver, use a sane estimate + bufferAttributes.Latency = 2.0 * (double)m_nAsioBufferLen / (double)m_Settings.Samplerate; + } + bufferAttributes.UpdateInterval = (double)m_nAsioBufferLen / (double)m_Settings.Samplerate; + bufferAttributes.NumBuffers = 2; + UpdateBufferAttributes(bufferAttributes); +} + + void CASIODevice::SetRenderSilence(bool silence, bool wait) //--------------------------------------------------------- { @@ -527,12 +552,24 @@ } +void CASIODevice::InternalStopForce() +//----------------------------------- +{ + InternalStopImpl(true); +} + void CASIODevice::InternalStop() //------------------------------ { + InternalStopImpl(false); +} + +void CASIODevice::InternalStopImpl(bool force) +//-------------------------------------------- +{ ALWAYS_ASSERT_WARN_MESSAGE(!CriticalSection::IsLocked(), "AudioCriticalSection locked while stopping ASIO"); - if(m_Settings.KeepDeviceRunning) + if(m_Settings.KeepDeviceRunning && !force) { SetRenderSilence(true, true); return; @@ -1089,7 +1126,19 @@ void CASIODevice::SampleRateDidChange(ASIOSampleRate sRate) //--------------------------------------------------------- { - MPT_UNREFERENCED_PARAMETER(sRate); + if(Util::Round<uint32>(sRate) == m_Settings.Samplerate) + { + // not different, ignore it + return; + } + m_UsedFeatures.set(AsioFeatureSampleRateChange); + if((double)m_Settings.Samplerate * (1.0 - AsioSampleRateTolerance) <= sRate && sRate <= (double)m_Settings.Samplerate * (1.0 + AsioSampleRateTolerance)) + { + // ignore slight differences which might me due to a unstable external ASIO clock source + return; + } + // play safe and close the device + RequestClose(); } @@ -1104,6 +1153,7 @@ if(features[AsioFeatureBufferSizeChange]) { if(!first) { result += ","; } first = false; result += "buffer"; } if(features[AsioFeatureOverload]) { if(!first) { result += ","; } first = false; result += "load"; } if(features[AsioFeatureNoDirectProcess]) { if(!first) { result += ","; } first = false; result += "nodirect"; } + if(features[AsioFeatureSampleRateChange]) { if(!first) { result += ","; } first = false; result += "srate"; } return result; } @@ -1111,12 +1161,18 @@ std::string CASIODevice::GetStatistics() const //-------------------------------------------- { - if(m_UsedFeatures.any()) + const FlagSet<AsioFeatures> unsupported((AsioFeatures)(AsioFeatureNoDirectProcess | AsioFeatureOverload | AsioFeatureBufferSizeChange | AsioFeatureSampleRateChange)); + FlagSet<AsioFeatures> unsupportedFeatues = m_UsedFeatures; + unsupportedFeatues &= unsupported; + if(unsupportedFeatues.any()) { - return mpt::String::Print("WARNING: unsupported features used: %1", AsioFeaturesToString(m_UsedFeatures)); + return mpt::String::Print("WARNING: unsupported features: %1", AsioFeaturesToString(unsupportedFeatues)); + } else if(m_UsedFeatures.any()) + { + return mpt::String::Print("OK, features used: %1", AsioFeaturesToString(m_UsedFeatures)); } else if(m_QueriedFeatures.any()) { - return mpt::String::Print("features queried: %1", AsioFeaturesToString(m_QueriedFeatures)); + return mpt::String::Print("OK, features queried: %1", AsioFeaturesToString(m_QueriedFeatures)); } return std::string("OK."); } @@ -1140,23 +1196,19 @@ break; case kAsioResetRequest: m_QueriedFeatures.set(AsioFeatureResetRequest); - // unsupported - result = 0; + result = 1; break; case kAsioBufferSizeChange: m_QueriedFeatures.set(AsioFeatureBufferSizeChange); - // unsupported result = 0; break; case kAsioResyncRequest: m_QueriedFeatures.set(AsioFeatureResyncRequest); - // unsupported - result = 0; + result = 1; break; case kAsioLatenciesChanged: m_QueriedFeatures.set(AsioFeatureLatenciesChanged); - // unsupported - result = 0; + result = 1; break; case kAsioOverload: m_QueriedFeatures.set(AsioFeatureOverload); @@ -1177,23 +1229,23 @@ break; case kAsioResetRequest: m_UsedFeatures.set(AsioFeatureResetRequest); - // unsupported - result = 0; + RequestReset(); + result = 1; break; case kAsioBufferSizeChange: m_UsedFeatures.set(AsioFeatureBufferSizeChange); - // unsupported + // We do not support kAsioBufferSizeChange. + // This should cause a driver to send a kAsioResetRequest. result = 0; break; case kAsioResyncRequest: m_UsedFeatures.set(AsioFeatureResyncRequest); - // unsupported - result = 0; + RequestRestart(); + result = 1; break; case kAsioLatenciesChanged: - m_UsedFeatures.set(AsioFeatureLatenciesChanged); - // unsupported - result = 0; + _InterlockedOr(&m_AsioRequestFlags, AsioRequestFlagLatenciesChanged); + result = 1; break; case kAsioOverload: m_UsedFeatures.set(AsioFeatureOverload); Modified: trunk/OpenMPT/sounddev/SoundDeviceASIO.h =================================================================== --- trunk/OpenMPT/sounddev/SoundDeviceASIO.h 2014-02-14 20:06:12 UTC (rev 3713) +++ trunk/OpenMPT/sounddev/SoundDeviceASIO.h 2014-02-14 21:04:24 UTC (rev 3714) @@ -34,6 +34,7 @@ AsioFeatureBufferSizeChange = 1<<3, AsioFeatureOverload = 1<<4, AsioFeatureNoDirectProcess = 1<<5, + AsioFeatureSampleRateChange = 1<<6, AsioFeatureNone = 0 }; DECLARE_FLAGSET(AsioFeatures) @@ -68,6 +69,9 @@ int64 m_StreamPositionOffset; + static const LONG AsioRequestFlagLatenciesChanged = 1<<0; + LONG m_AsioRequestFlags; + FlagSet<AsioFeatures> m_QueriedFeatures; FlagSet<AsioFeatures> m_UsedFeatures; @@ -88,16 +92,24 @@ private: void Init(); + bool HandleRequests(); // return true if any work has been done + void UpdateLatency(); + void InternalStopImpl(bool force); + public: bool InternalOpen(); bool InternalClose(); void InternalFillAudioBuffer(); bool InternalStart(); void InternalStop(); + void InternalStopForce(); bool InternalIsOpen() const { return m_BuffersCreated; } + bool OnIdle() { return HandleRequests(); } + SoundDeviceCaps GetDeviceCaps(const std::vector<uint32> &baseSampleRates); + bool OpenDriverSettings(); std::string GetStatistics() const; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <man...@us...> - 2014-02-15 17:12:19
|
Revision: 3720 http://sourceforge.net/p/modplug/code/3720 Author: manxorist Date: 2014-02-15 17:12:09 +0000 (Sat, 15 Feb 2014) Log Message: ----------- [Mod] sounddev: Windows since Vista has a limiter/compressor with way too high release time in the audio path that kicks in as soon as there are samples > 0dBFs (i.e. the absolute float value is greater than 1.0). This happens for all APIs that get processed through the system-wide audio engine. It does not happen for exclusive mode WASAPI streams or direct WaveRT (labeled WDM-KS in PortAudio) streams. As there is no known way to disable this annoying behavior, avoid unclipped samples on affected Windows versions and APIs and clip them ourselves before handing them to the APIs. Modified Paths: -------------- trunk/OpenMPT/mptrack/MainFrm.cpp trunk/OpenMPT/mptrack/Mainfrm.h trunk/OpenMPT/mptrack/Mod2wave.cpp trunk/OpenMPT/sounddev/SoundDevice.cpp trunk/OpenMPT/sounddev/SoundDevice.h trunk/OpenMPT/sounddev/SoundDeviceDirectSound.cpp trunk/OpenMPT/sounddev/SoundDevicePortAudio.cpp trunk/OpenMPT/sounddev/SoundDeviceWaveout.cpp trunk/OpenMPT/soundlib/AudioReadTarget.h trunk/OpenMPT/soundlib/SampleFormatConverters.h Modified: trunk/OpenMPT/mptrack/MainFrm.cpp =================================================================== --- trunk/OpenMPT/mptrack/MainFrm.cpp 2014-02-15 16:54:10 UTC (rev 3719) +++ trunk/OpenMPT/mptrack/MainFrm.cpp 2014-02-15 17:12:09 UTC (rev 3720) @@ -669,11 +669,13 @@ { private: const SampleFormat sampleFormat; + bool clipFloat; Dither &dither; void *buffer; public: - StereoVuMeterTargetWrapper(SampleFormat sampleFormat_, Dither &dither_, void *buffer_) + StereoVuMeterTargetWrapper(SampleFormat sampleFormat_, bool clipFloat_, Dither &dither_, void *buffer_) : sampleFormat(sampleFormat_) + , clipFloat(clipFloat_) , dither(dither_) , buffer(buffer_) { @@ -713,10 +715,16 @@ } break; case SampleFormatFloat32: + if(clipFloat) { typedef SampleFormatToType<SampleFormatFloat32>::type Tsample; - AudioReadTargetBuffer<Tsample> target(dither, reinterpret_cast<Tsample*>(buffer), nullptr); + AudioReadTargetBuffer<Tsample, true> target(dither, reinterpret_cast<Tsample*>(buffer), nullptr); target.DataCallback(MixSoundBuffer, channels, countChunk); + } else + { + typedef SampleFormatToType<SampleFormatFloat32>::type Tsample; + AudioReadTargetBuffer<Tsample, false> target(dither, reinterpret_cast<Tsample*>(buffer), nullptr); + target.DataCallback(MixSoundBuffer, channels, countChunk); } break; } @@ -726,8 +734,8 @@ }; -void CMainFrame::AudioRead(const SoundDeviceSettings &settings, const SoundBufferAttributes &bufferAttributes, SoundTimeInfo timeInfo, std::size_t numFrames, void *buffer) -//------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +void CMainFrame::AudioRead(const SoundDeviceSettings &settings, const SoundDeviceFlags &flags, const SoundBufferAttributes &bufferAttributes, SoundTimeInfo timeInfo, std::size_t numFrames, void *buffer) +//-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- { ASSERT(InAudioThread()); OPENMPT_PROFILE_FUNCTION(Profiler::Audio); @@ -738,7 +746,7 @@ timingInfo.Speed = timeInfo.Speed; m_pSndFile->m_TimingInfo = timingInfo; m_Dither.SetMode((DitherMode)settings.DitherType); - StereoVuMeterTargetWrapper target(settings.sampleFormat, m_Dither, buffer); + StereoVuMeterTargetWrapper target(settings.sampleFormat, flags.NeedsClippedFloat, m_Dither, buffer); CSoundFile::samplecount_t renderedFrames = m_pSndFile->Read(numFrames, target); ASSERT(renderedFrames <= numFrames); CSoundFile::samplecount_t remainingFrames = numFrames - renderedFrames; @@ -758,10 +766,11 @@ } -void CMainFrame::AudioDone(const SoundDeviceSettings &settings, const SoundBufferAttributes &bufferAttributes, SoundTimeInfo timeInfo, std::size_t numFrames, int64 streamPosition) -//--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +void CMainFrame::AudioDone(const SoundDeviceSettings &settings, const SoundDeviceFlags &flags, const SoundBufferAttributes &bufferAttributes, SoundTimeInfo timeInfo, std::size_t numFrames, int64 streamPosition) +//---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- { MPT_UNREFERENCED_PARAMETER(settings); + MPT_UNREFERENCED_PARAMETER(flags); MPT_UNREFERENCED_PARAMETER(bufferAttributes); MPT_UNREFERENCED_PARAMETER(timeInfo); ASSERT(InAudioThread()); Modified: trunk/OpenMPT/mptrack/Mainfrm.h =================================================================== --- trunk/OpenMPT/mptrack/Mainfrm.h 2014-02-15 16:54:10 UTC (rev 3719) +++ trunk/OpenMPT/mptrack/Mainfrm.h 2014-02-15 17:12:09 UTC (rev 3720) @@ -352,8 +352,8 @@ // from ISoundSource void FillAudioBufferLocked(IFillAudioBuffer &callback); - void AudioRead(const SoundDeviceSettings &settings, const SoundBufferAttributes &bufferAttributes, SoundTimeInfo timeInfo, std::size_t numFrames, void *buffer); - void AudioDone(const SoundDeviceSettings &settings, const SoundBufferAttributes &bufferAttributes, SoundTimeInfo timeInfo, std::size_t numFrames, int64 streamPosition); + void AudioRead(const SoundDeviceSettings &settings, const SoundDeviceFlags &flags, const SoundBufferAttributes &bufferAttributes, SoundTimeInfo timeInfo, std::size_t numFrames, void *buffer); + void AudioDone(const SoundDeviceSettings &settings, const SoundDeviceFlags &flags, const SoundBufferAttributes &bufferAttributes, SoundTimeInfo timeInfo, std::size_t numFrames, int64 streamPosition); // from ISoundMessageReceiver void AudioMessage(const std::string &str); Modified: trunk/OpenMPT/mptrack/Mod2wave.cpp =================================================================== --- trunk/OpenMPT/mptrack/Mod2wave.cpp 2014-02-15 16:54:10 UTC (rev 3719) +++ trunk/OpenMPT/mptrack/Mod2wave.cpp 2014-02-15 17:12:09 UTC (rev 3720) @@ -1242,10 +1242,10 @@ dither.Process(mixbuffer, framesChunk, channels, m_Settings.FinalSampleFormat.GetBitsPerSample()); switch(m_Settings.FinalSampleFormat.value) { - case SampleFormatUnsigned8: ConvertInterleavedFixedPointToInterleaved<MIXING_FRACTIONAL_BITS>(reinterpret_cast<uint8*>(buffer), mixbuffer, channels, framesChunk); break; - case SampleFormatInt16: ConvertInterleavedFixedPointToInterleaved<MIXING_FRACTIONAL_BITS>(reinterpret_cast<int16*>(buffer), mixbuffer, channels, framesChunk); break; - case SampleFormatInt24: ConvertInterleavedFixedPointToInterleaved<MIXING_FRACTIONAL_BITS>(reinterpret_cast<int24*>(buffer), mixbuffer, channels, framesChunk); break; - case SampleFormatInt32: ConvertInterleavedFixedPointToInterleaved<MIXING_FRACTIONAL_BITS>(reinterpret_cast<int32*>(buffer), mixbuffer, channels, framesChunk); break; + case SampleFormatUnsigned8: ConvertInterleavedFixedPointToInterleaved<MIXING_FRACTIONAL_BITS,false>(reinterpret_cast<uint8*>(buffer), mixbuffer, channels, framesChunk); break; + case SampleFormatInt16: ConvertInterleavedFixedPointToInterleaved<MIXING_FRACTIONAL_BITS,false>(reinterpret_cast<int16*>(buffer), mixbuffer, channels, framesChunk); break; + case SampleFormatInt24: ConvertInterleavedFixedPointToInterleaved<MIXING_FRACTIONAL_BITS,false>(reinterpret_cast<int24*>(buffer), mixbuffer, channels, framesChunk); break; + case SampleFormatInt32: ConvertInterleavedFixedPointToInterleaved<MIXING_FRACTIONAL_BITS,false>(reinterpret_cast<int32*>(buffer), mixbuffer, channels, framesChunk); break; default: ASSERT(false); break; } fileEnc->WriteInterleavedConverted(framesChunk, buffer); Modified: trunk/OpenMPT/sounddev/SoundDevice.cpp =================================================================== --- trunk/OpenMPT/sounddev/SoundDevice.cpp 2014-02-15 16:54:10 UTC (rev 3719) +++ trunk/OpenMPT/sounddev/SoundDevice.cpp 2014-02-15 17:12:09 UTC (rev 3720) @@ -220,6 +220,7 @@ { return false; } + m_Flags = SoundDeviceFlags(); m_BufferAttributes.Latency = m_Settings.LatencyMS / 1000.0; m_BufferAttributes.UpdateInterval = m_Settings.UpdateIntervalMS / 1000.0; m_BufferAttributes.NumBuffers = 0; @@ -290,7 +291,7 @@ { return; } - m_Source->AudioRead(m_Settings, m_BufferAttributes, m_TimeInfo, numFrames, buffer); + m_Source->AudioRead(m_Settings, m_Flags, m_BufferAttributes, m_TimeInfo, numFrames, buffer); } @@ -309,7 +310,7 @@ m_StreamPositionOutputFrames = m_StreamPositionRenderFrames - framesLatency; framesRendered = m_StreamPositionRenderFrames; } - m_Source->AudioDone(m_Settings, m_BufferAttributes, m_TimeInfo, numFrames, framesRendered); + m_Source->AudioDone(m_Settings, m_Flags, m_BufferAttributes, m_TimeInfo, numFrames, framesRendered); } Modified: trunk/OpenMPT/sounddev/SoundDevice.h =================================================================== --- trunk/OpenMPT/sounddev/SoundDevice.h 2014-02-15 16:54:10 UTC (rev 3719) +++ trunk/OpenMPT/sounddev/SoundDevice.h 2014-02-15 17:12:09 UTC (rev 3720) @@ -31,6 +31,7 @@ struct SoundDeviceSettings; +struct SoundDeviceFlags; struct SoundBufferAttributes; @@ -73,8 +74,8 @@ { public: virtual void FillAudioBufferLocked(IFillAudioBuffer &callback) = 0; // take any locks needed while rendering audio and then call FillAudioBuffer - virtual void AudioRead(const SoundDeviceSettings &settings, const SoundBufferAttributes &bufferAttributes, SoundTimeInfo timeInfo, std::size_t numFrames, void *buffer) = 0; - virtual void AudioDone(const SoundDeviceSettings &settings, const SoundBufferAttributes &bufferAttributes, SoundTimeInfo timeInfo, std::size_t numFrames, int64 streamPosition) = 0; // in sample frames + virtual void AudioRead(const SoundDeviceSettings &settings, const SoundDeviceFlags &flags, const SoundBufferAttributes &bufferAttributes, SoundTimeInfo timeInfo, std::size_t numFrames, void *buffer) = 0; + virtual void AudioDone(const SoundDeviceSettings &settings, const SoundDeviceFlags &flags, const SoundBufferAttributes &bufferAttributes, SoundTimeInfo timeInfo, std::size_t numFrames, int64 streamPosition) = 0; // in sample frames }; @@ -292,6 +293,25 @@ }; +struct SoundDeviceFlags +{ + // Windows since Vista has a limiter/compressor in the audio path that kicks + // in as soon as there are samples > 0dBFs (i.e. the absolute float value > + // 1.0). This happens for all APIs that get processed through the system- + // wide audio engine. It does not happen for exclusive mode WASAPI streams + // or direct WaveRT (labeled WDM-KS in PortAudio) streams. As there is no + // known way to disable this annoying behavior, avoid unclipped samples on + // affected windows versions and clip them ourselves before handing them to + // the APIs. + bool NeedsClippedFloat; + SoundDeviceFlags() + : NeedsClippedFloat(false) + { + return; + } +}; + + struct SoundDeviceCaps { uint32 currentSampleRate; @@ -361,6 +381,7 @@ protected: SoundDeviceSettings m_Settings; + SoundDeviceFlags m_Flags; private: Modified: trunk/OpenMPT/sounddev/SoundDeviceDirectSound.cpp =================================================================== --- trunk/OpenMPT/sounddev/SoundDeviceDirectSound.cpp 2014-02-15 16:54:10 UTC (rev 3719) +++ trunk/OpenMPT/sounddev/SoundDeviceDirectSound.cpp 2014-02-15 17:12:09 UTC (rev 3720) @@ -261,6 +261,7 @@ } m_dwWritePos = 0xFFFFFFFF; SetWakeupInterval(std::min(m_Settings.UpdateIntervalMS / 1000.0, m_nDSoundBufferSize / (2.0 * m_Settings.GetBytesPerSecond()))); + m_Flags.NeedsClippedFloat = (mpt::Windows::GetWinNTVersion() >= mpt::Windows::VerWinVista); SoundBufferAttributes bufferAttributes; bufferAttributes.Latency = m_nDSoundBufferSize * 1.0 / m_Settings.GetBytesPerSecond(); bufferAttributes.UpdateInterval = std::min(m_Settings.UpdateIntervalMS / 1000.0, m_nDSoundBufferSize / (2.0 * m_Settings.GetBytesPerSecond())); Modified: trunk/OpenMPT/sounddev/SoundDevicePortAudio.cpp =================================================================== --- trunk/OpenMPT/sounddev/SoundDevicePortAudio.cpp 2014-02-15 16:54:10 UTC (rev 3719) +++ trunk/OpenMPT/sounddev/SoundDevicePortAudio.cpp 2014-02-15 17:12:09 UTC (rev 3720) @@ -83,6 +83,7 @@ { if(m_Settings.ExclusiveMode) { + m_Flags.NeedsClippedFloat = false; m_StreamParameters.suggestedLatency = 0.0; // let portaudio choose framesPerBuffer = paFramesPerBufferUnspecified; // let portaudio choose MemsetZero(m_WasapiStreamInfo); @@ -91,10 +92,23 @@ m_WasapiStreamInfo.version = 1; m_WasapiStreamInfo.flags = paWinWasapiExclusive; m_StreamParameters.hostApiSpecificStreamInfo = &m_WasapiStreamInfo; + } else + { + m_Flags.NeedsClippedFloat = true; } } else if(m_HostApi == Pa_HostApiTypeIdToHostApiIndex(paWDMKS)) { + m_Flags.NeedsClippedFloat = false; framesPerBuffer = paFramesPerBufferUnspecified; // let portaudio choose + } else if(m_HostApi == Pa_HostApiTypeIdToHostApiIndex(paMME)) + { + m_Flags.NeedsClippedFloat = (mpt::Windows::GetWinNTVersion() >= mpt::Windows::VerWinVista); + } else if(m_HostApi == Pa_HostApiTypeIdToHostApiIndex(paDirectSound)) + { + m_Flags.NeedsClippedFloat = (mpt::Windows::GetWinNTVersion() >= mpt::Windows::VerWinVista); + } else + { + m_Flags.NeedsClippedFloat = false; } if(Pa_IsFormatSupported(NULL, &m_StreamParameters, m_Settings.Samplerate) != paFormatIsSupported) return false; PaStreamFlags flags = paNoFlag; Modified: trunk/OpenMPT/sounddev/SoundDeviceWaveout.cpp =================================================================== --- trunk/OpenMPT/sounddev/SoundDeviceWaveout.cpp 2014-02-15 16:54:10 UTC (rev 3719) +++ trunk/OpenMPT/sounddev/SoundDeviceWaveout.cpp 2014-02-15 17:12:09 UTC (rev 3720) @@ -103,6 +103,7 @@ m_nWriteBuffer = 0; SetWakeupEvent(m_ThreadWakeupEvent); SetWakeupInterval(m_nWaveBufferSize * 1.0 / m_Settings.GetBytesPerSecond()); + m_Flags.NeedsClippedFloat = (mpt::Windows::GetWinNTVersion() >= mpt::Windows::VerWinVista); SoundBufferAttributes bufferAttributes; bufferAttributes.Latency = m_nWaveBufferSize * m_nPreparedHeaders * 1.0 / m_Settings.GetBytesPerSecond(); bufferAttributes.UpdateInterval = m_nWaveBufferSize * 1.0 / m_Settings.GetBytesPerSecond(); Modified: trunk/OpenMPT/soundlib/AudioReadTarget.h =================================================================== --- trunk/OpenMPT/soundlib/AudioReadTarget.h 2014-02-15 16:54:10 UTC (rev 3719) +++ trunk/OpenMPT/soundlib/AudioReadTarget.h 2014-02-15 17:12:09 UTC (rev 3720) @@ -16,7 +16,7 @@ #include "Mixer.h" -template<typename Tsample> +template<typename Tsample, bool clipOutput = false> class AudioReadTargetBuffer : public IAudioReadTarget { @@ -51,7 +51,7 @@ if(outputBuffer) { - ConvertInterleavedFixedPointToInterleaved<MIXING_FRACTIONAL_BITS>(outputBuffer + (channels * countRendered), MixSoundBuffer, channels, countChunk); + ConvertInterleavedFixedPointToInterleaved<MIXING_FRACTIONAL_BITS, clipOutput>(outputBuffer + (channels * countRendered), MixSoundBuffer, channels, countChunk); } if(outputBuffers) { @@ -60,7 +60,7 @@ { buffers[channel] = outputBuffers[channel] + countRendered; } - ConvertInterleavedFixedPointToNonInterleaved<MIXING_FRACTIONAL_BITS>(buffers, MixSoundBuffer, channels, countChunk); + ConvertInterleavedFixedPointToNonInterleaved<MIXING_FRACTIONAL_BITS, clipOutput>(buffers, MixSoundBuffer, channels, countChunk); } countRendered += countChunk; Modified: trunk/OpenMPT/soundlib/SampleFormatConverters.h =================================================================== --- trunk/OpenMPT/soundlib/SampleFormatConverters.h 2014-02-15 16:54:10 UTC (rev 3719) +++ trunk/OpenMPT/soundlib/SampleFormatConverters.h 2014-02-15 17:12:09 UTC (rev 3720) @@ -428,11 +428,11 @@ }; -template <typename Tdst, typename Tsrc, int fractionalBits> +template <typename Tdst, typename Tsrc, int fractionalBits, bool clipOutput> struct ConvertFixedPoint; -template <int fractionalBits> -struct ConvertFixedPoint<uint8, int32, fractionalBits> +template <int fractionalBits, bool clipOutput> +struct ConvertFixedPoint<uint8, int32, fractionalBits, clipOutput> { typedef int32 input_t; typedef uint8 output_t; @@ -448,8 +448,8 @@ } }; -template <int fractionalBits> -struct ConvertFixedPoint<int16, int32, fractionalBits> +template <int fractionalBits, bool clipOutput> +struct ConvertFixedPoint<int16, int32, fractionalBits, clipOutput> { typedef int32 input_t; typedef int16 output_t; @@ -465,8 +465,8 @@ } }; -template <int fractionalBits> -struct ConvertFixedPoint<int24, int32, fractionalBits> +template <int fractionalBits, bool clipOutput> +struct ConvertFixedPoint<int24, int32, fractionalBits, clipOutput> { typedef int32 input_t; typedef int24 output_t; @@ -482,8 +482,8 @@ } }; -template <int fractionalBits> -struct ConvertFixedPoint<int32, int32, fractionalBits> +template <int fractionalBits, bool clipOutput> +struct ConvertFixedPoint<int32, int32, fractionalBits, clipOutput> { typedef int32 input_t; typedef int32 output_t; @@ -494,8 +494,8 @@ } }; -template <int fractionalBits> -struct ConvertFixedPoint<float32, int32, fractionalBits> +template <int fractionalBits, bool clipOutput> +struct ConvertFixedPoint<float32, int32, fractionalBits, clipOutput> { typedef int32 input_t; typedef float32 output_t; @@ -508,7 +508,16 @@ forceinline output_t operator() (input_t val) { STATIC_ASSERT(fractionalBits >= 0 && fractionalBits <= sizeof(input_t)*8-1); - return val * factor; + if(clipOutput) + { + float32 out = val * factor; + if(out < -1.0f) out = -1.0f; + if(out > 1.0f) out = 1.0f; + return out; + } else + { + return val * factor; + } } }; @@ -826,11 +835,11 @@ } -template<int fractionalBits, typename Tsample, typename Tfixed> +template<int fractionalBits, bool clipOutput, typename Tsample, typename Tfixed> void ConvertInterleavedFixedPointToInterleaved(Tsample * MPT_RESTRICT p, const Tfixed * MPT_RESTRICT mixbuffer, std::size_t channels, std::size_t count) //------------------------------------------------------------------------------------------------------------------------------------------------------ { - SC::ConvertFixedPoint<Tsample, int, fractionalBits> conv; + SC::ConvertFixedPoint<Tsample, int, fractionalBits, clipOutput> conv; count *= channels; for(std::size_t i = 0; i < count; ++i) { @@ -838,11 +847,11 @@ } } -template<int fractionalBits, typename Tsample, typename Tfixed> +template<int fractionalBits, bool clipOutput, typename Tsample, typename Tfixed> void ConvertInterleavedFixedPointToNonInterleaved(Tsample * const * const MPT_RESTRICT buffers, const Tfixed * MPT_RESTRICT mixbuffer, std::size_t channels, std::size_t count) //----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- { - SC::ConvertFixedPoint<Tsample, int, fractionalBits> conv; + SC::ConvertFixedPoint<Tsample, int, fractionalBits, clipOutput> conv; for(std::size_t i = 0; i < count; ++i) { for(std::size_t channel = 0; channel < channels; ++channel) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2014-02-16 15:11:01
|
Revision: 3723 http://sourceforge.net/p/modplug/code/3723 Author: saga-games Date: 2014-02-16 15:10:50 +0000 (Sun, 16 Feb 2014) Log Message: ----------- [Fix] Scroll/num/caps lock keys should now work better with toggle-able shortcuts (http://bugs.openmpt.org/view.php?id=13) [Mod] OpenMPT: Version is now 1.22.07.22 Modified Paths: -------------- trunk/OpenMPT/common/versionNumber.h trunk/OpenMPT/mptrack/InputHandler.cpp trunk/OpenMPT/mptrack/InputHandler.h Modified: trunk/OpenMPT/common/versionNumber.h =================================================================== --- trunk/OpenMPT/common/versionNumber.h 2014-02-16 00:45:51 UTC (rev 3722) +++ trunk/OpenMPT/common/versionNumber.h 2014-02-16 15:10:50 UTC (rev 3723) @@ -17,7 +17,7 @@ #define VER_MAJORMAJOR 1 #define VER_MAJOR 22 #define VER_MINOR 07 -#define VER_MINORMINOR 21 +#define VER_MINORMINOR 22 //Version string. For example "1.17.02.28" #define MPT_VERSION_STR VER_STRINGIZE(VER_MAJORMAJOR) "." VER_STRINGIZE(VER_MAJOR) "." VER_STRINGIZE(VER_MINOR) "." VER_STRINGIZE(VER_MINORMINOR) Modified: trunk/OpenMPT/mptrack/InputHandler.cpp =================================================================== --- trunk/OpenMPT/mptrack/InputHandler.cpp 2014-02-16 00:45:51 UTC (rev 3722) +++ trunk/OpenMPT/mptrack/InputHandler.cpp 2014-02-16 15:10:50 UTC (rev 3723) @@ -39,8 +39,8 @@ // 1. Try to load keybindings from the path saved in the settings. // 2. If the setting doesn't exist or the loading fails, try to load from default location. // 3. If neither one of these worked, load default keybindings from resources. - // 4. If there were no keybinging setting already, create a keybinding file to default location - // and set it's path to settings. + // 4. If there were no keybinding setting already, create a keybinding file to default location + // and set its path to settings. if (bNoExistingKbdFileSetting || !(activeCommandSet->LoadFile(TrackerSettings::Instance().m_szKbdFile))) { @@ -49,7 +49,7 @@ bool bSuccess = false; if (PathFileExistsW(sDefaultPath.AsNative().c_str()) == TRUE) bSuccess = activeCommandSet->LoadFile(sDefaultPath); - if (bSuccess == false) + if (!bSuccess) { // Load keybindings from resources. Log("Loading keybindings from resources\n"); @@ -59,7 +59,7 @@ activeCommandSet->SaveFile(TrackerSettings::Instance().m_szKbdFile); } } - if (bSuccess == false) + if (!bSuccess) ErrorBox(IDS_UNABLE_TO_LOAD_KEYBINDINGS); } // We will only overwrite the default Keybindings.mkb file from now on. @@ -68,7 +68,6 @@ //Get Keymap activeCommandSet->GenKeyMap(keyMap); SetupSpecialKeyInterception(); // Feature: use Windows keys as modifier keys, intercept special keys - m_nSkipGeneratedKeypresses = 0; m_bBypass = false; modifierMask=0; @@ -84,8 +83,8 @@ } -CommandID CInputHandler::GeneralKeyEvent(InputTargetContext context, int code, WPARAM wParam , LPARAM lParam) -//----------------------------------------------------------------------------------------------------------- +CommandID CInputHandler::GeneralKeyEvent(InputTargetContext context, int code, WPARAM wParam, LPARAM lParam) +//---------------------------------------------------------------------------------------------------------- { KeyMap::const_iterator cmd = keyMap.end(); KeyEventType keyEventType; @@ -113,7 +112,7 @@ CatchModifierChange(wParam, keyEventType, scancode); } - if(!InterceptSpecialKeys( wParam, lParam ) && !IsBypassed()) + if(!InterceptSpecialKeys(wParam, lParam, true) && !IsBypassed()) { // only execute command when the input handler is not locked // and the input is not a consequence of special key interception. @@ -140,9 +139,11 @@ } -CommandID CInputHandler::KeyEvent(InputTargetContext context, UINT &nChar, UINT &/*nRepCnt*/, UINT &/*nFlags*/, KeyEventType keyEventType, CWnd* pSourceWnd) +CommandID CInputHandler::KeyEvent(InputTargetContext context, UINT &nChar, UINT &/*nRepCnt*/, UINT &nFlags, KeyEventType keyEventType, CWnd* pSourceWnd) //---------------------------------------------------------------------------------------------------------------------------------------------------------- { + if(InterceptSpecialKeys(nChar, nFlags, false)) + return kcNull; KeyMap::const_iterator cmd = keyMap.find(KeyCombination(context, modifierMask, nChar, keyEventType)); CommandID executeCommand = kcNull; @@ -164,51 +165,51 @@ // Feature: use Windows keys as modifier keys, intercept special keys -bool CInputHandler::InterceptSpecialKeys(UINT nChar, UINT nFlags) -//--------------------------------------------------------------- +bool CInputHandler::InterceptSpecialKeys(UINT nChar, UINT nFlags, bool generateMsg) +//--------------------------------------------------------------------------------- { - KeyEventType keyEventType = GetKeyEventType( HIWORD(nFlags) ); + KeyEventType keyEventType = GetKeyEventType(HIWORD(nFlags)); enum { VK_NonExistentKey = VK_F24+1 }; - if( nChar == VK_NonExistentKey ) + if(nChar == VK_NonExistentKey) { return true; - } else if( m_bInterceptWindowsKeys && ( nChar == VK_LWIN || nChar == VK_RWIN ) ) + } else if(m_bInterceptWindowsKeys && (nChar == VK_LWIN || nChar == VK_RWIN)) { - if( keyEventType == kKeyEventDown ) + if(keyEventType == kKeyEventDown) { INPUT inp[2]; inp[0].type = inp[1].type = INPUT_KEYBOARD; inp[0].ki.time = inp[1].ki.time = 0; - inp[0].ki.dwExtraInfo = inp[0].ki.dwExtraInfo = 0; + inp[0].ki.dwExtraInfo = inp[1].ki.dwExtraInfo = 0; inp[0].ki.wVk = inp[1].ki.wVk = VK_NonExistentKey; inp[0].ki.wScan = inp[1].ki.wScan = 0; inp[0].ki.dwFlags = 0; inp[1].ki.dwFlags = KEYEVENTF_KEYUP; - SendInput( 2, inp, sizeof(INPUT) ); + SendInput(2, inp, sizeof(INPUT)); } } - if( ( nChar == VK_NUMLOCK && m_bInterceptNumLock ) || - ( nChar == VK_CAPITAL && m_bInterceptCapsLock ) || - ( nChar == VK_SCROLL && m_bInterceptScrollLock ) ) + if((nChar == VK_NUMLOCK && m_bInterceptNumLock) + || (nChar == VK_CAPITAL && m_bInterceptCapsLock) + || (nChar == VK_SCROLL && m_bInterceptScrollLock)) { - if( m_nSkipGeneratedKeypresses > 0 ) + if(GetMessageExtraInfo() == 0xC0FFEE) { - m_nSkipGeneratedKeypresses -- ; + SetMessageExtraInfo(0); return true; - } else if( keyEventType == kKeyEventDown ) + } else if(keyEventType == kKeyEventDown && generateMsg) { - m_nSkipGeneratedKeypresses = 2; + // Prevent keys from lighting up by simulating a second press. INPUT inp[2]; inp[0].type = inp[1].type = INPUT_KEYBOARD; inp[0].ki.time = inp[1].ki.time = 0; - inp[0].ki.dwExtraInfo = inp[0].ki.dwExtraInfo = 0; + inp[0].ki.dwExtraInfo = inp[1].ki.dwExtraInfo = 0xC0FFEE; inp[0].ki.wVk = inp[1].ki.wVk = static_cast<WORD>(nChar); inp[0].ki.wScan = inp[1].ki.wScan = 0; inp[0].ki.dwFlags = KEYEVENTF_KEYUP; inp[1].ki.dwFlags = 0; - SendInput( 2, inp, sizeof(INPUT) ); + SendInput(2, inp, sizeof(INPUT)); } } return false; Modified: trunk/OpenMPT/mptrack/InputHandler.h =================================================================== --- trunk/OpenMPT/mptrack/InputHandler.h 2014-02-16 00:45:51 UTC (rev 3722) +++ trunk/OpenMPT/mptrack/InputHandler.h 2014-02-16 15:10:50 UTC (rev 3723) @@ -41,8 +41,7 @@ bool m_bNoAltMenu; bool CatchModifierChange(WPARAM wParam, KeyEventType keyEventType, int scancode); bool m_bInterceptWindowsKeys, m_bInterceptNumLock, m_bInterceptCapsLock, m_bInterceptScrollLock; - int m_nSkipGeneratedKeypresses; - bool InterceptSpecialKeys( UINT nChar , UINT nFlags ); + bool InterceptSpecialKeys(UINT nChar , UINT nFlags, bool generateMsg); void SetupSpecialKeyInterception(); public: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <man...@us...> - 2014-02-18 18:33:29
|
Revision: 3732 http://sourceforge.net/p/modplug/code/3732 Author: manxorist Date: 2014-02-18 18:33:07 +0000 (Tue, 18 Feb 2014) Log Message: ----------- [Var] Time Stretch: Update SoundTouch to v1.8.0 [Ref] Time Stretch: Use floating point instead of integer samples for soundtouch and rename the DLL to OpenMPT_SoundTouch_f32.dll. This allows soundtouch to optionally use SSE instead of MMX internally which is way faster on modern CPUs and potentially allows for better signal-to-noise ratio in libsoundtouch's internal processing (I did not verify this). This also avoids any modification to any soundtouch source file at all. [Mod] Time Stretch: Remove pointless m_nStretchProcessStepLength parameter. Always use a chunk size of 1024 frames now. [Ref] Time Stretch: Rate-limit progress bar to GuiUpdateInterval (defaulting to 15ms) instead of coupling to the chunk size where GUI repainting would slow down the whole process for fast CPUs. [Fix] Time Stretch: Fix possible buffer overflow and memleak in some corner cases. [Mod] Time Stretch: SoundTouch does not really work great for really short samples. Before, the code used an arbitrarily chosen value of 256 frames as the limit, but this seems too low. Instead, query SoundTouch itself about the minimum required processing samples. This is not really what we want here, but gives a close enough approximation where SoundTouch starts outputting meaningful stretched data (for shorter samples, the output is mostly silence anyway). [Mod] Time Stretch: Allow time-stretching 8bit samples without converting them to 16bit first. Modified Paths: -------------- trunk/OpenMPT/build/auto/package_openmpt_win32.cmd trunk/OpenMPT/build/auto/package_openmpt_win64.cmd trunk/OpenMPT/build/gen/soundtouch.vcproj trunk/OpenMPT/build/gen/soundtouch.vcxproj trunk/OpenMPT/build/gen/soundtouch.vcxproj.filters trunk/OpenMPT/include/premake4.lua trunk/OpenMPT/include/soundtouch/COPYING.TXT trunk/OpenMPT/include/soundtouch/OpenMPT.txt trunk/OpenMPT/include/soundtouch/README.html trunk/OpenMPT/installer/install.iss trunk/OpenMPT/mptrack/Ctrl_smp.cpp trunk/OpenMPT/mptrack/Ctrl_smp.h trunk/OpenMPT/mptrack/mptrack_08.vcproj trunk/OpenMPT/mptrack/mptrack_10.vcxproj trunk/OpenMPT/soundlib/SampleFormatConverters.h Added Paths: ----------- trunk/OpenMPT/include/soundtouch/Makefile.am trunk/OpenMPT/include/soundtouch/bin/ trunk/OpenMPT/include/soundtouch/bin/run_test trunk/OpenMPT/include/soundtouch/bin/run_test.cmd trunk/OpenMPT/include/soundtouch/bootstrap trunk/OpenMPT/include/soundtouch/config/ trunk/OpenMPT/include/soundtouch/config/README.TXT trunk/OpenMPT/include/soundtouch/config/am_include.mk trunk/OpenMPT/include/soundtouch/config/m4/ trunk/OpenMPT/include/soundtouch/configure-file-README.txt trunk/OpenMPT/include/soundtouch/configure.ac trunk/OpenMPT/include/soundtouch/include/ trunk/OpenMPT/include/soundtouch/include/BPMDetect.h trunk/OpenMPT/include/soundtouch/include/FIFOSampleBuffer.h trunk/OpenMPT/include/soundtouch/include/FIFOSamplePipe.h trunk/OpenMPT/include/soundtouch/include/Makefile.am trunk/OpenMPT/include/soundtouch/include/STTypes.h trunk/OpenMPT/include/soundtouch/include/SoundTouch.h trunk/OpenMPT/include/soundtouch/lib/ trunk/OpenMPT/include/soundtouch/make-win.bat trunk/OpenMPT/include/soundtouch/soundtouch-1.4.pc.in trunk/OpenMPT/include/soundtouch/soundtouch.m4 trunk/OpenMPT/include/soundtouch/soundtouch.pc.in trunk/OpenMPT/include/soundtouch/source/ trunk/OpenMPT/include/soundtouch/source/Android-lib/ trunk/OpenMPT/include/soundtouch/source/Android-lib/README-SoundTouch-Android.html trunk/OpenMPT/include/soundtouch/source/Android-lib/jni/ trunk/OpenMPT/include/soundtouch/source/Android-lib/jni/Android.mk trunk/OpenMPT/include/soundtouch/source/Android-lib/jni/Application.mk trunk/OpenMPT/include/soundtouch/source/Android-lib/jni/soundtouch-jni.cpp trunk/OpenMPT/include/soundtouch/source/Android-lib/src/ trunk/OpenMPT/include/soundtouch/source/Android-lib/src/net/ trunk/OpenMPT/include/soundtouch/source/Android-lib/src/net/surina/ trunk/OpenMPT/include/soundtouch/source/Android-lib/src/net/surina/soundtouch/ trunk/OpenMPT/include/soundtouch/source/Android-lib/src/net/surina/soundtouch/SoundTouch.java trunk/OpenMPT/include/soundtouch/source/Makefile.am trunk/OpenMPT/include/soundtouch/source/SoundStretch/ trunk/OpenMPT/include/soundtouch/source/SoundStretch/Makefile.am trunk/OpenMPT/include/soundtouch/source/SoundStretch/RunParameters.cpp trunk/OpenMPT/include/soundtouch/source/SoundStretch/RunParameters.h trunk/OpenMPT/include/soundtouch/source/SoundStretch/WavFile.cpp trunk/OpenMPT/include/soundtouch/source/SoundStretch/WavFile.h trunk/OpenMPT/include/soundtouch/source/SoundStretch/main.cpp trunk/OpenMPT/include/soundtouch/source/SoundStretch/soundstretch.dsp trunk/OpenMPT/include/soundtouch/source/SoundStretch/soundstretch.dsw trunk/OpenMPT/include/soundtouch/source/SoundStretch/soundstretch.sln trunk/OpenMPT/include/soundtouch/source/SoundStretch/soundstretch.vcproj trunk/OpenMPT/include/soundtouch/source/SoundTouch/ trunk/OpenMPT/include/soundtouch/source/SoundTouch/AAFilter.cpp trunk/OpenMPT/include/soundtouch/source/SoundTouch/AAFilter.h trunk/OpenMPT/include/soundtouch/source/SoundTouch/BPMDetect.cpp trunk/OpenMPT/include/soundtouch/source/SoundTouch/FIFOSampleBuffer.cpp trunk/OpenMPT/include/soundtouch/source/SoundTouch/FIRFilter.cpp trunk/OpenMPT/include/soundtouch/source/SoundTouch/FIRFilter.h trunk/OpenMPT/include/soundtouch/source/SoundTouch/InterpolateCubic.cpp trunk/OpenMPT/include/soundtouch/source/SoundTouch/InterpolateCubic.h trunk/OpenMPT/include/soundtouch/source/SoundTouch/InterpolateLinear.cpp trunk/OpenMPT/include/soundtouch/source/SoundTouch/InterpolateLinear.h trunk/OpenMPT/include/soundtouch/source/SoundTouch/InterpolateShannon.cpp trunk/OpenMPT/include/soundtouch/source/SoundTouch/InterpolateShannon.h trunk/OpenMPT/include/soundtouch/source/SoundTouch/Makefile.am trunk/OpenMPT/include/soundtouch/source/SoundTouch/PeakFinder.cpp trunk/OpenMPT/include/soundtouch/source/SoundTouch/PeakFinder.h trunk/OpenMPT/include/soundtouch/source/SoundTouch/RateTransposer.cpp trunk/OpenMPT/include/soundtouch/source/SoundTouch/RateTransposer.h trunk/OpenMPT/include/soundtouch/source/SoundTouch/SoundTouch.cpp trunk/OpenMPT/include/soundtouch/source/SoundTouch/SoundTouch.dsp trunk/OpenMPT/include/soundtouch/source/SoundTouch/SoundTouch.dsw trunk/OpenMPT/include/soundtouch/source/SoundTouch/SoundTouch.sln trunk/OpenMPT/include/soundtouch/source/SoundTouch/SoundTouch.vcproj trunk/OpenMPT/include/soundtouch/source/SoundTouch/TDStretch.cpp trunk/OpenMPT/include/soundtouch/source/SoundTouch/TDStretch.h trunk/OpenMPT/include/soundtouch/source/SoundTouch/cpu_detect.h trunk/OpenMPT/include/soundtouch/source/SoundTouch/cpu_detect_x86.cpp trunk/OpenMPT/include/soundtouch/source/SoundTouch/mmx_optimized.cpp trunk/OpenMPT/include/soundtouch/source/SoundTouch/sse_optimized.cpp trunk/OpenMPT/include/soundtouch/source/SoundTouchDLL/ trunk/OpenMPT/include/soundtouch/source/SoundTouchDLL/SoundTouchDLL.cpp trunk/OpenMPT/include/soundtouch/source/SoundTouchDLL/SoundTouchDLL.h trunk/OpenMPT/include/soundtouch/source/SoundTouchDLL/SoundTouchDLL.pas trunk/OpenMPT/include/soundtouch/source/SoundTouchDLL/SoundTouchDLL.rc trunk/OpenMPT/include/soundtouch/source/SoundTouchDLL/SoundTouchDLL.sln trunk/OpenMPT/include/soundtouch/source/SoundTouchDLL/SoundTouchDLL.vcproj trunk/OpenMPT/include/soundtouch/source/SoundTouchDLL/resource.h Removed Paths: ------------- trunk/OpenMPT/include/soundtouch/AAFilter.cpp trunk/OpenMPT/include/soundtouch/AAFilter.h trunk/OpenMPT/include/soundtouch/BPMDetect.cpp trunk/OpenMPT/include/soundtouch/BPMDetect.h trunk/OpenMPT/include/soundtouch/FIFOSampleBuffer.cpp trunk/OpenMPT/include/soundtouch/FIFOSampleBuffer.h trunk/OpenMPT/include/soundtouch/FIFOSamplePipe.h trunk/OpenMPT/include/soundtouch/FIRFilter.cpp trunk/OpenMPT/include/soundtouch/FIRFilter.h trunk/OpenMPT/include/soundtouch/PeakFinder.cpp trunk/OpenMPT/include/soundtouch/PeakFinder.h trunk/OpenMPT/include/soundtouch/RateTransposer.cpp trunk/OpenMPT/include/soundtouch/RateTransposer.h trunk/OpenMPT/include/soundtouch/STTypes.h trunk/OpenMPT/include/soundtouch/SoundTouch.cpp trunk/OpenMPT/include/soundtouch/SoundTouch.h trunk/OpenMPT/include/soundtouch/SoundTouchDLL.cpp trunk/OpenMPT/include/soundtouch/SoundTouchDLL.h trunk/OpenMPT/include/soundtouch/SoundTouchDLL.rc trunk/OpenMPT/include/soundtouch/TDStretch.cpp trunk/OpenMPT/include/soundtouch/TDStretch.h trunk/OpenMPT/include/soundtouch/cpu_detect.h trunk/OpenMPT/include/soundtouch/cpu_detect_x86_win.cpp trunk/OpenMPT/include/soundtouch/mmx_optimized.cpp trunk/OpenMPT/include/soundtouch/resource.h trunk/OpenMPT/include/soundtouch/sse_optimized.cpp Modified: trunk/OpenMPT/build/auto/package_openmpt_win32.cmd =================================================================== --- trunk/OpenMPT/build/auto/package_openmpt_win32.cmd 2014-02-18 18:24:10 UTC (rev 3731) +++ trunk/OpenMPT/build/auto/package_openmpt_win32.cmd 2014-02-18 18:33:07 UTC (rev 3732) @@ -9,7 +9,7 @@ del /f /q openmpt-win32.tar del /f /q openmpt-win32-r%GOT_REVISION%.7z copy /y ..\..\LICENSE .\ || goto error -"C:\Program Files\7-Zip\7z.exe" a -t7z -mx=9 openmpt-win32-r%GOT_REVISION%.7z mptrack.exe OpenMPT_SoundTouch_i16.dll "MIDI Input Output.dll" LICENSE || goto error +"C:\Program Files\7-Zip\7z.exe" a -t7z -mx=9 openmpt-win32-r%GOT_REVISION%.7z mptrack.exe OpenMPT_SoundTouch_f32.dll "MIDI Input Output.dll" LICENSE || goto error "C:\Program Files\7-Zip\7z.exe" a -ttar openmpt-win32.tar openmpt-win32-r%GOT_REVISION%.7z || goto error del /f /q openmpt-win32-r%GOT_REVISION%.7z cd ..\.. || goto error Modified: trunk/OpenMPT/build/auto/package_openmpt_win64.cmd =================================================================== --- trunk/OpenMPT/build/auto/package_openmpt_win64.cmd 2014-02-18 18:24:10 UTC (rev 3731) +++ trunk/OpenMPT/build/auto/package_openmpt_win64.cmd 2014-02-18 18:33:07 UTC (rev 3732) @@ -9,7 +9,7 @@ del /f /q openmpt-win64.tar del /f /q openmpt-win64-r%GOT_REVISION%.7z copy /y ..\..\LICENSE .\ || goto error -"C:\Program Files\7-Zip\7z.exe" a -t7z -mx=9 openmpt-win64-r%GOT_REVISION%.7z mptrack.exe OpenMPT_SoundTouch_i16.dll "MIDI Input Output.dll" LICENSE || goto error +"C:\Program Files\7-Zip\7z.exe" a -t7z -mx=9 openmpt-win64-r%GOT_REVISION%.7z mptrack.exe OpenMPT_SoundTouch_f32.dll "MIDI Input Output.dll" LICENSE || goto error "C:\Program Files\7-Zip\7z.exe" a -ttar openmpt-win64.tar openmpt-win64-r%GOT_REVISION%.7z || goto error del /f /q openmpt-win64-r%GOT_REVISION%.7z cd ..\.. || goto error Modified: trunk/OpenMPT/build/gen/soundtouch.vcproj =================================================================== --- trunk/OpenMPT/build/gen/soundtouch.vcproj 2014-02-18 18:24:10 UTC (rev 3731) +++ trunk/OpenMPT/build/gen/soundtouch.vcproj 2014-02-18 18:33:07 UTC (rev 3732) @@ -43,14 +43,15 @@ <Tool Name="VCCLCompilerTool" Optimization="0" - PreprocessorDefinitions="DLL_EXPORTS;SOUNDTOUCH_INTEGER_SAMPLES=1;DEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS" + AdditionalIncludeDirectories="..\..\include\soundtouch\include" + PreprocessorDefinitions="DLL_EXPORTS;DEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS" MinimalRebuild="true" BasicRuntimeChecks="3" RuntimeLibrary="3" EnableFunctionLevelLinking="true" UsePrecompiledHeader="0" WarningLevel="3" - ProgramDataBaseFileName="$(OutDir)\OpenMPT_SoundTouch_i16.pdb" + ProgramDataBaseFileName="$(OutDir)\OpenMPT_SoundTouch_f32.pdb" DebugInformationFormat="4" /> <Tool @@ -58,20 +59,21 @@ /> <Tool Name="VCResourceCompilerTool" - PreprocessorDefinitions="DLL_EXPORTS;SOUNDTOUCH_INTEGER_SAMPLES=1;DEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS" + PreprocessorDefinitions="DLL_EXPORTS;DEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS" + AdditionalIncludeDirectories="..\..\include\soundtouch\include" /> <Tool Name="VCPreLinkEventTool" /> <Tool Name="VCLinkerTool" - OutputFile="$(OutDir)\OpenMPT_SoundTouch_i16.dll" + OutputFile="$(OutDir)\OpenMPT_SoundTouch_f32.dll" LinkIncremental="2" AdditionalLibraryDirectories="" GenerateDebugInformation="true" - ProgramDataBaseFileName="$(OutDir)\OpenMPT_SoundTouch_i16.pdb" + ProgramDataBaseFileName="$(OutDir)\OpenMPT_SoundTouch_f32.pdb" SubSystem="2" - ImportLibrary="..\..\bin\Win32-Debug\OpenMPT_SoundTouch_i16.lib" + ImportLibrary="..\..\bin\Win32-Debug\OpenMPT_SoundTouch_f32.lib" TargetMachine="1" /> <Tool @@ -125,14 +127,15 @@ <Tool Name="VCCLCompilerTool" Optimization="0" - PreprocessorDefinitions="DLL_EXPORTS;SOUNDTOUCH_INTEGER_SAMPLES=1;DEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS" + AdditionalIncludeDirectories="..\..\include\soundtouch\include" + PreprocessorDefinitions="DLL_EXPORTS;DEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS" MinimalRebuild="true" BasicRuntimeChecks="3" RuntimeLibrary="3" EnableFunctionLevelLinking="true" UsePrecompiledHeader="0" WarningLevel="3" - ProgramDataBaseFileName="$(OutDir)\OpenMPT_SoundTouch_i16.pdb" + ProgramDataBaseFileName="$(OutDir)\OpenMPT_SoundTouch_f32.pdb" DebugInformationFormat="3" /> <Tool @@ -140,20 +143,21 @@ /> <Tool Name="VCResourceCompilerTool" - PreprocessorDefinitions="DLL_EXPORTS;SOUNDTOUCH_INTEGER_SAMPLES=1;DEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS" + PreprocessorDefinitions="DLL_EXPORTS;DEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS" + AdditionalIncludeDirectories="..\..\include\soundtouch\include" /> <Tool Name="VCPreLinkEventTool" /> <Tool Name="VCLinkerTool" - OutputFile="$(OutDir)\OpenMPT_SoundTouch_i16.dll" + OutputFile="$(OutDir)\OpenMPT_SoundTouch_f32.dll" LinkIncremental="2" AdditionalLibraryDirectories="" GenerateDebugInformation="true" - ProgramDataBaseFileName="$(OutDir)\OpenMPT_SoundTouch_i16.pdb" + ProgramDataBaseFileName="$(OutDir)\OpenMPT_SoundTouch_f32.pdb" SubSystem="2" - ImportLibrary="..\..\bin\x64-Debug\OpenMPT_SoundTouch_i16.lib" + ImportLibrary="..\..\bin\x64-Debug\OpenMPT_SoundTouch_f32.lib" TargetMachine="17" /> <Tool @@ -207,14 +211,15 @@ Name="VCCLCompilerTool" AdditionalOptions="/MP" Optimization="3" - PreprocessorDefinitions="DLL_EXPORTS;SOUNDTOUCH_INTEGER_SAMPLES=1;NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS" + AdditionalIncludeDirectories="..\..\include\soundtouch\include" + PreprocessorDefinitions="DLL_EXPORTS;NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS" StringPooling="true" RuntimeLibrary="0" EnableFunctionLevelLinking="true" FloatingPointModel="2" UsePrecompiledHeader="0" WarningLevel="3" - ProgramDataBaseFileName="$(OutDir)\OpenMPT_SoundTouch_i16.pdb" + ProgramDataBaseFileName="$(OutDir)\OpenMPT_SoundTouch_f32.pdb" DebugInformationFormat="3" /> <Tool @@ -222,22 +227,23 @@ /> <Tool Name="VCResourceCompilerTool" - PreprocessorDefinitions="DLL_EXPORTS;SOUNDTOUCH_INTEGER_SAMPLES=1;NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS" + PreprocessorDefinitions="DLL_EXPORTS;NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS" + AdditionalIncludeDirectories="..\..\include\soundtouch\include" /> <Tool Name="VCPreLinkEventTool" /> <Tool Name="VCLinkerTool" - OutputFile="$(OutDir)\OpenMPT_SoundTouch_i16.dll" + OutputFile="$(OutDir)\OpenMPT_SoundTouch_f32.dll" LinkIncremental="1" AdditionalLibraryDirectories="" GenerateDebugInformation="true" - ProgramDataBaseFileName="$(OutDir)\OpenMPT_SoundTouch_i16.pdb" + ProgramDataBaseFileName="$(OutDir)\OpenMPT_SoundTouch_f32.pdb" SubSystem="2" OptimizeReferences="2" EnableCOMDATFolding="2" - ImportLibrary="..\..\bin\Win32\OpenMPT_SoundTouch_i16.lib" + ImportLibrary="..\..\bin\Win32\OpenMPT_SoundTouch_f32.lib" TargetMachine="1" /> <Tool @@ -292,14 +298,15 @@ Name="VCCLCompilerTool" AdditionalOptions="/MP" Optimization="3" - PreprocessorDefinitions="DLL_EXPORTS;SOUNDTOUCH_INTEGER_SAMPLES=1;NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS" + AdditionalIncludeDirectories="..\..\include\soundtouch\include" + PreprocessorDefinitions="DLL_EXPORTS;NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS" StringPooling="true" RuntimeLibrary="0" EnableFunctionLevelLinking="true" FloatingPointModel="2" UsePrecompiledHeader="0" WarningLevel="3" - ProgramDataBaseFileName="$(OutDir)\OpenMPT_SoundTouch_i16.pdb" + ProgramDataBaseFileName="$(OutDir)\OpenMPT_SoundTouch_f32.pdb" DebugInformationFormat="3" /> <Tool @@ -307,22 +314,23 @@ /> <Tool Name="VCResourceCompilerTool" - PreprocessorDefinitions="DLL_EXPORTS;SOUNDTOUCH_INTEGER_SAMPLES=1;NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS" + PreprocessorDefinitions="DLL_EXPORTS;NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS" + AdditionalIncludeDirectories="..\..\include\soundtouch\include" /> <Tool Name="VCPreLinkEventTool" /> <Tool Name="VCLinkerTool" - OutputFile="$(OutDir)\OpenMPT_SoundTouch_i16.dll" + OutputFile="$(OutDir)\OpenMPT_SoundTouch_f32.dll" LinkIncremental="1" AdditionalLibraryDirectories="" GenerateDebugInformation="true" - ProgramDataBaseFileName="$(OutDir)\OpenMPT_SoundTouch_i16.pdb" + ProgramDataBaseFileName="$(OutDir)\OpenMPT_SoundTouch_f32.pdb" SubSystem="2" OptimizeReferences="2" EnableCOMDATFolding="2" - ImportLibrary="..\..\bin\x64\OpenMPT_SoundTouch_i16.lib" + ImportLibrary="..\..\bin\x64\OpenMPT_SoundTouch_f32.lib" TargetMachine="17" /> <Tool @@ -376,14 +384,15 @@ Name="VCCLCompilerTool" AdditionalOptions="/GL- /MP" Optimization="3" - PreprocessorDefinitions="DLL_EXPORTS;SOUNDTOUCH_INTEGER_SAMPLES=1;NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS" + AdditionalIncludeDirectories="..\..\include\soundtouch\include" + PreprocessorDefinitions="DLL_EXPORTS;NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS" StringPooling="true" RuntimeLibrary="0" EnableFunctionLevelLinking="true" FloatingPointModel="2" UsePrecompiledHeader="0" WarningLevel="3" - ProgramDataBaseFileName="$(OutDir)\OpenMPT_SoundTouch_i16.pdb" + ProgramDataBaseFileName="$(OutDir)\OpenMPT_SoundTouch_f32.pdb" DebugInformationFormat="0" /> <Tool @@ -391,21 +400,22 @@ /> <Tool Name="VCResourceCompilerTool" - PreprocessorDefinitions="DLL_EXPORTS;SOUNDTOUCH_INTEGER_SAMPLES=1;NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS" + PreprocessorDefinitions="DLL_EXPORTS;NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS" + AdditionalIncludeDirectories="..\..\include\soundtouch\include" /> <Tool Name="VCPreLinkEventTool" /> <Tool Name="VCLinkerTool" - OutputFile="$(OutDir)\OpenMPT_SoundTouch_i16.dll" + OutputFile="$(OutDir)\OpenMPT_SoundTouch_f32.dll" LinkIncremental="1" AdditionalLibraryDirectories="" GenerateDebugInformation="false" SubSystem="2" OptimizeReferences="2" EnableCOMDATFolding="2" - ImportLibrary="..\..\bin\Win32\OpenMPT_SoundTouch_i16.lib" + ImportLibrary="..\..\bin\Win32\OpenMPT_SoundTouch_f32.lib" TargetMachine="1" /> <Tool @@ -460,14 +470,15 @@ Name="VCCLCompilerTool" AdditionalOptions="/GL- /MP" Optimization="3" - PreprocessorDefinitions="DLL_EXPORTS;SOUNDTOUCH_INTEGER_SAMPLES=1;NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS" + AdditionalIncludeDirectories="..\..\include\soundtouch\include" + PreprocessorDefinitions="DLL_EXPORTS;NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS" StringPooling="true" RuntimeLibrary="0" EnableFunctionLevelLinking="true" FloatingPointModel="2" UsePrecompiledHeader="0" WarningLevel="3" - ProgramDataBaseFileName="$(OutDir)\OpenMPT_SoundTouch_i16.pdb" + ProgramDataBaseFileName="$(OutDir)\OpenMPT_SoundTouch_f32.pdb" DebugInformationFormat="0" /> <Tool @@ -475,21 +486,22 @@ /> <Tool Name="VCResourceCompilerTool" - PreprocessorDefinitions="DLL_EXPORTS;SOUNDTOUCH_INTEGER_SAMPLES=1;NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS" + PreprocessorDefinitions="DLL_EXPORTS;NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS" + AdditionalIncludeDirectories="..\..\include\soundtouch\include" /> <Tool Name="VCPreLinkEventTool" /> <Tool Name="VCLinkerTool" - OutputFile="$(OutDir)\OpenMPT_SoundTouch_i16.dll" + OutputFile="$(OutDir)\OpenMPT_SoundTouch_f32.dll" LinkIncremental="1" AdditionalLibraryDirectories="" GenerateDebugInformation="false" SubSystem="2" OptimizeReferences="2" EnableCOMDATFolding="2" - ImportLibrary="..\..\bin\x64\OpenMPT_SoundTouch_i16.lib" + ImportLibrary="..\..\bin\x64\OpenMPT_SoundTouch_f32.lib" TargetMachine="17" /> <Tool @@ -529,102 +541,146 @@ Name="soundtouch" Filter="" > - <File - RelativePath="..\..\include\soundtouch\AAFilter.cpp" + <Filter + Name="include" + Filter="" > - </File> - <File - RelativePath="..\..\include\soundtouch\BPMDetect.cpp" + <File + RelativePath="..\..\include\soundtouch\include\BPMDetect.h" + > + </File> + <File + RelativePath="..\..\include\soundtouch\include\FIFOSampleBuffer.h" + > + </File> + <File + RelativePath="..\..\include\soundtouch\include\FIFOSamplePipe.h" + > + </File> + <File + RelativePath="..\..\include\soundtouch\include\SoundTouch.h" + > + </File> + <File + RelativePath="..\..\include\soundtouch\include\STTypes.h" + > + </File> + </Filter> + <Filter + Name="source" + Filter="" > - </File> - <File - RelativePath="..\..\include\soundtouch\cpu_detect_x86_win.cpp" - > - </File> - <File - RelativePath="..\..\include\soundtouch\FIFOSampleBuffer.cpp" - > - </File> - <File - RelativePath="..\..\include\soundtouch\FIRFilter.cpp" - > - </File> - <File - RelativePath="..\..\include\soundtouch\mmx_optimized.cpp" - > - </File> - <File - RelativePath="..\..\include\soundtouch\PeakFinder.cpp" - > - </File> - <File - RelativePath="..\..\include\soundtouch\RateTransposer.cpp" - > - </File> - <File - RelativePath="..\..\include\soundtouch\SoundTouch.cpp" - > - </File> - <File - RelativePath="..\..\include\soundtouch\SoundTouchDLL.cpp" - > - </File> - <File - RelativePath="..\..\include\soundtouch\sse_optimized.cpp" - > - </File> - <File - RelativePath="..\..\include\soundtouch\TDStretch.cpp" - > - </File> - <File - RelativePath="..\..\include\soundtouch\AAFilter.h" - > - </File> - <File - RelativePath="..\..\include\soundtouch\BPMDetect.h" - > - </File> - <File - RelativePath="..\..\include\soundtouch\cpu_detect.h" - > - </File> - <File - RelativePath="..\..\include\soundtouch\FIFOSampleBuffer.h" - > - </File> - <File - RelativePath="..\..\include\soundtouch\FIFOSamplePipe.h" - > - </File> - <File - RelativePath="..\..\include\soundtouch\FIRFilter.h" - > - </File> - <File - RelativePath="..\..\include\soundtouch\PeakFinder.h" - > - </File> - <File - RelativePath="..\..\include\soundtouch\RateTransposer.h" - > - </File> - <File - RelativePath="..\..\include\soundtouch\SoundTouch.h" - > - </File> - <File - RelativePath="..\..\include\soundtouch\SoundTouchDLL.h" - > - </File> - <File - RelativePath="..\..\include\soundtouch\STTypes.h" - > - </File> - <File - RelativePath="..\..\include\soundtouch\TDStretch.h" - > - </File> + <Filter + Name="SoundTouch" + Filter="" + > + <File + RelativePath="..\..\include\soundtouch\source\SoundTouch\AAFilter.cpp" + > + </File> + <File + RelativePath="..\..\include\soundtouch\source\SoundTouch\BPMDetect.cpp" + > + </File> + <File + RelativePath="..\..\include\soundtouch\source\SoundTouch\cpu_detect_x86.cpp" + > + </File> + <File + RelativePath="..\..\include\soundtouch\source\SoundTouch\FIFOSampleBuffer.cpp" + > + </File> + <File + RelativePath="..\..\include\soundtouch\source\SoundTouch\FIRFilter.cpp" + > + </File> + <File + RelativePath="..\..\include\soundtouch\source\SoundTouch\InterpolateCubic.cpp" + > + </File> + <File + RelativePath="..\..\include\soundtouch\source\SoundTouch\InterpolateLinear.cpp" + > + </File> + <File + RelativePath="..\..\include\soundtouch\source\SoundTouch\InterpolateShannon.cpp" + > + </File> + <File + RelativePath="..\..\include\soundtouch\source\SoundTouch\mmx_optimized.cpp" + > + </File> + <File + RelativePath="..\..\include\soundtouch\source\SoundTouch\PeakFinder.cpp" + > + </File> + <File + RelativePath="..\..\include\soundtouch\source\SoundTouch\RateTransposer.cpp" + > + </File> + <File + RelativePath="..\..\include\soundtouch\source\SoundTouch\SoundTouch.cpp" + > + </File> + <File + RelativePath="..\..\include\soundtouch\source\SoundTouch\sse_optimized.cpp" + > + </File> + <File + RelativePath="..\..\include\soundtouch\source\SoundTouch\TDStretch.cpp" + > + </File> + <File + RelativePath="..\..\include\soundtouch\source\SoundTouch\AAFilter.h" + > + </File> + <File + RelativePath="..\..\include\soundtouch\source\SoundTouch\cpu_detect.h" + > + </File> + <File + RelativePath="..\..\include\soundtouch\source\SoundTouch\FIRFilter.h" + > + </File> + <File + RelativePath="..\..\include\soundtouch\source\SoundTouch\InterpolateCubic.h" + > + </File> + <File + RelativePath="..\..\include\soundtouch\source\SoundTouch\InterpolateLinear.h" + > + </File> + <File + RelativePath="..\..\include\soundtouch\source\SoundTouch\InterpolateShannon.h" + > + </File> + <File + RelativePath="..\..\include\soundtouch\source\SoundTouch\PeakFinder.h" + > + </File> + <File + RelativePath="..\..\include\soundtouch\source\SoundTouch\RateTransposer.h" + > + </File> + <File + RelativePath="..\..\include\soundtouch\source\SoundTouch\TDStretch.h" + > + </File> + </Filter> + <Filter + Name="SoundTouchDLL" + Filter="" + > + <File + RelativePath="..\..\include\soundtouch\source\SoundTouchDLL\SoundTouchDLL.cpp" + > + </File> + <File + RelativePath="..\..\include\soundtouch\source\SoundTouchDLL\SoundTouchDLL.h" + > + </File> + </Filter> + </Filter> </Filter> </Filter> </Files> Modified: trunk/OpenMPT/build/gen/soundtouch.vcxproj =================================================================== --- trunk/OpenMPT/build/gen/soundtouch.vcxproj 2014-02-18 18:24:10 UTC (rev 3731) +++ trunk/OpenMPT/build/gen/soundtouch.vcxproj 2014-02-18 18:33:07 UTC (rev 3732) @@ -92,39 +92,40 @@ <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\..\bin\Win32-Debug\</OutDir> <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\obj\soundtouch\x32\Debug\</IntDir> - <TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">OpenMPT_SoundTouch_i16</TargetName> + <TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">OpenMPT_SoundTouch_f32</TargetName> <IgnoreImportLibrary Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</IgnoreImportLibrary> <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental> <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">..\..\bin\x64-Debug\</OutDir> <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">..\obj\soundtouch\x64\Debug\</IntDir> - <TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">OpenMPT_SoundTouch_i16</TargetName> + <TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">OpenMPT_SoundTouch_f32</TargetName> <IgnoreImportLibrary Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</IgnoreImportLibrary> <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental> <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\..\bin\Win32\</OutDir> <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\obj\soundtouch\x32\Release\</IntDir> - <TargetName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">OpenMPT_SoundTouch_i16</TargetName> + <TargetName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">OpenMPT_SoundTouch_f32</TargetName> <IgnoreImportLibrary Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</IgnoreImportLibrary> <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental> <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">..\..\bin\x64\</OutDir> <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">..\obj\soundtouch\x64\Release\</IntDir> - <TargetName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">OpenMPT_SoundTouch_i16</TargetName> + <TargetName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">OpenMPT_SoundTouch_f32</TargetName> <IgnoreImportLibrary Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</IgnoreImportLibrary> <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental> <OutDir Condition="'$(Configuration)|$(Platform)'=='ReleaseNoLTCG|Win32'">..\..\bin\Win32\</OutDir> <IntDir Condition="'$(Configuration)|$(Platform)'=='ReleaseNoLTCG|Win32'">..\obj\soundtouch\x32\ReleaseNoLTCG\</IntDir> - <TargetName Condition="'$(Configuration)|$(Platform)'=='ReleaseNoLTCG|Win32'">OpenMPT_SoundTouch_i16</TargetName> + <TargetName Condition="'$(Configuration)|$(Platform)'=='ReleaseNoLTCG|Win32'">OpenMPT_SoundTouch_f32</TargetName> <IgnoreImportLibrary Condition="'$(Configuration)|$(Platform)'=='ReleaseNoLTCG|Win32'">false</IgnoreImportLibrary> <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='ReleaseNoLTCG|Win32'">false</LinkIncremental> <OutDir Condition="'$(Configuration)|$(Platform)'=='ReleaseNoLTCG|x64'">..\..\bin\x64\</OutDir> <IntDir Condition="'$(Configuration)|$(Platform)'=='ReleaseNoLTCG|x64'">..\obj\soundtouch\x64\ReleaseNoLTCG\</IntDir> - <TargetName Condition="'$(Configuration)|$(Platform)'=='ReleaseNoLTCG|x64'">OpenMPT_SoundTouch_i16</TargetName> + <TargetName Condition="'$(Configuration)|$(Platform)'=='ReleaseNoLTCG|x64'">OpenMPT_SoundTouch_f32</TargetName> <IgnoreImportLibrary Condition="'$(Configuration)|$(Platform)'=='ReleaseNoLTCG|x64'">false</IgnoreImportLibrary> <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='ReleaseNoLTCG|x64'">false</LinkIncremental> </PropertyGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <ClCompile> <Optimization>Disabled</Optimization> - <PreprocessorDefinitions>DLL_EXPORTS;SOUNDTOUCH_INTEGER_SAMPLES=1;DEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <AdditionalIncludeDirectories>..\..\include\soundtouch\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>DLL_EXPORTS;DEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <MinimalRebuild>true</MinimalRebuild> <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> @@ -134,22 +135,24 @@ <DebugInformationFormat>EditAndContinue</DebugInformationFormat> </ClCompile> <ResourceCompile> - <PreprocessorDefinitions>DLL_EXPORTS;SOUNDTOUCH_INTEGER_SAMPLES=1;DEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <PreprocessorDefinitions>DLL_EXPORTS;DEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <AdditionalIncludeDirectories>..\..\include\soundtouch\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> </ResourceCompile> <Link> - <OutputFile>$(OutDir)OpenMPT_SoundTouch_i16.dll</OutputFile> + <OutputFile>$(OutDir)OpenMPT_SoundTouch_f32.dll</OutputFile> <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> <SubSystem>Windows</SubSystem> <GenerateDebugInformation>true</GenerateDebugInformation> - <ProgramDataBaseFileName>$(OutDir)OpenMPT_SoundTouch_i16.pdb</ProgramDataBaseFileName> - <ImportLibrary>..\..\bin\Win32-Debug\OpenMPT_SoundTouch_i16.lib</ImportLibrary> + <ProgramDataBaseFileName>$(OutDir)OpenMPT_SoundTouch_f32.pdb</ProgramDataBaseFileName> + <ImportLibrary>..\..\bin\Win32-Debug\OpenMPT_SoundTouch_f32.lib</ImportLibrary> <TargetMachine>MachineX86</TargetMachine> </Link> </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <ClCompile> <Optimization>Disabled</Optimization> - <PreprocessorDefinitions>DLL_EXPORTS;SOUNDTOUCH_INTEGER_SAMPLES=1;DEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <AdditionalIncludeDirectories>..\..\include\soundtouch\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>DLL_EXPORTS;DEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <MinimalRebuild>true</MinimalRebuild> <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> @@ -159,15 +162,16 @@ <DebugInformationFormat>OldStyle</DebugInformationFormat> </ClCompile> <ResourceCompile> - <PreprocessorDefinitions>DLL_EXPORTS;SOUNDTOUCH_INTEGER_SAMPLES=1;DEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <PreprocessorDefinitions>DLL_EXPORTS;DEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <AdditionalIncludeDirectories>..\..\include\soundtouch\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> </ResourceCompile> <Link> - <OutputFile>$(OutDir)OpenMPT_SoundTouch_i16.dll</OutputFile> + <OutputFile>$(OutDir)OpenMPT_SoundTouch_f32.dll</OutputFile> <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> <SubSystem>Windows</SubSystem> <GenerateDebugInformation>true</GenerateDebugInformation> - <ProgramDataBaseFileName>$(OutDir)OpenMPT_SoundTouch_i16.pdb</ProgramDataBaseFileName> - <ImportLibrary>..\..\bin\x64-Debug\OpenMPT_SoundTouch_i16.lib</ImportLibrary> + <ProgramDataBaseFileName>$(OutDir)OpenMPT_SoundTouch_f32.pdb</ProgramDataBaseFileName> + <ImportLibrary>..\..\bin\x64-Debug\OpenMPT_SoundTouch_f32.lib</ImportLibrary> <TargetMachine>MachineX64</TargetMachine> </Link> </ItemDefinitionGroup> @@ -175,7 +179,8 @@ <ClCompile> <AdditionalOptions>/MP %(AdditionalOptions)</AdditionalOptions> <Optimization>Full</Optimization> - <PreprocessorDefinitions>DLL_EXPORTS;SOUNDTOUCH_INTEGER_SAMPLES=1;NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <AdditionalIncludeDirectories>..\..\include\soundtouch\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>DLL_EXPORTS;NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <MinimalRebuild>false</MinimalRebuild> <StringPooling>true</StringPooling> <RuntimeLibrary>MultiThreaded</RuntimeLibrary> @@ -186,17 +191,18 @@ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> </ClCompile> <ResourceCompile> - <PreprocessorDefinitions>DLL_EXPORTS;SOUNDTOUCH_INTEGER_SAMPLES=1;NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <PreprocessorDefinitions>DLL_EXPORTS;NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <AdditionalIncludeDirectories>..\..\include\soundtouch\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> </ResourceCompile> <Link> - <OutputFile>$(OutDir)OpenMPT_SoundTouch_i16.dll</OutputFile> + <OutputFile>$(OutDir)OpenMPT_SoundTouch_f32.dll</OutputFile> <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> <SubSystem>Windows</SubSystem> <GenerateDebugInformation>true</GenerateDebugInformation> <OptimizeReferences>true</OptimizeReferences> <EnableCOMDATFolding>true</EnableCOMDATFolding> - <ProgramDataBaseFileName>$(OutDir)OpenMPT_SoundTouch_i16.pdb</ProgramDataBaseFileName> - <ImportLibrary>..\..\bin\Win32\OpenMPT_SoundTouch_i16.lib</ImportLibrary> + <ProgramDataBaseFileName>$(OutDir)OpenMPT_SoundTouch_f32.pdb</ProgramDataBaseFileName> + <ImportLibrary>..\..\bin\Win32\OpenMPT_SoundTouch_f32.lib</ImportLibrary> <TargetMachine>MachineX86</TargetMachine> </Link> </ItemDefinitionGroup> @@ -204,7 +210,8 @@ <ClCompile> <AdditionalOptions>/MP %(AdditionalOptions)</AdditionalOptions> <Optimization>Full</Optimization> - <PreprocessorDefinitions>DLL_EXPORTS;SOUNDTOUCH_INTEGER_SAMPLES=1;NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <AdditionalIncludeDirectories>..\..\include\soundtouch\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>DLL_EXPORTS;NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <MinimalRebuild>false</MinimalRebuild> <StringPooling>true</StringPooling> <RuntimeLibrary>MultiThreaded</RuntimeLibrary> @@ -215,17 +222,18 @@ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> </ClCompile> <ResourceCompile> - <PreprocessorDefinitions>DLL_EXPORTS;SOUNDTOUCH_INTEGER_SAMPLES=1;NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <PreprocessorDefinitions>DLL_EXPORTS;NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <AdditionalIncludeDirectories>..\..\include\soundtouch\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> </ResourceCompile> <Link> - <OutputFile>$(OutDir)OpenMPT_SoundTouch_i16.dll</OutputFile> + <OutputFile>$(OutDir)OpenMPT_SoundTouch_f32.dll</OutputFile> <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> <SubSystem>Windows</SubSystem> <GenerateDebugInformation>true</GenerateDebugInformation> <OptimizeReferences>true</OptimizeReferences> <EnableCOMDATFolding>true</EnableCOMDATFolding> - <ProgramDataBaseFileName>$(OutDir)OpenMPT_SoundTouch_i16.pdb</ProgramDataBaseFileName> - <ImportLibrary>..\..\bin\x64\OpenMPT_SoundTouch_i16.lib</ImportLibrary> + <ProgramDataBaseFileName>$(OutDir)OpenMPT_SoundTouch_f32.pdb</ProgramDataBaseFileName> + <ImportLibrary>..\..\bin\x64\OpenMPT_SoundTouch_f32.lib</ImportLibrary> <TargetMachine>MachineX64</TargetMachine> </Link> </ItemDefinitionGroup> @@ -233,7 +241,8 @@ <ClCompile> <AdditionalOptions>/GL- /MP %(AdditionalOptions)</AdditionalOptions> <Optimization>Full</Optimization> - <PreprocessorDefinitions>DLL_EXPORTS;SOUNDTOUCH_INTEGER_SAMPLES=1;NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <AdditionalIncludeDirectories>..\..\include\soundtouch\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>DLL_EXPORTS;NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <MinimalRebuild>false</MinimalRebuild> <StringPooling>true</StringPooling> <RuntimeLibrary>MultiThreaded</RuntimeLibrary> @@ -244,16 +253,17 @@ <DebugInformationFormat></DebugInformationFormat> </ClCompile> <ResourceCompile> - <PreprocessorDefinitions>DLL_EXPORTS;SOUNDTOUCH_INTEGER_SAMPLES=1;NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <PreprocessorDefinitions>DLL_EXPORTS;NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <AdditionalIncludeDirectories>..\..\include\soundtouch\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> </ResourceCompile> <Link> - <OutputFile>$(OutDir)OpenMPT_SoundTouch_i16.dll</OutputFile> + <OutputFile>$(OutDir)OpenMPT_SoundTouch_f32.dll</OutputFile> <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> <SubSystem>Windows</SubSystem> <GenerateDebugInformation>false</GenerateDebugInformation> <OptimizeReferences>true</OptimizeReferences> <EnableCOMDATFolding>true</EnableCOMDATFolding> - <ImportLibrary>..\..\bin\Win32\OpenMPT_SoundTouch_i16.lib</ImportLibrary> + <ImportLibrary>..\..\bin\Win32\OpenMPT_SoundTouch_f32.lib</ImportLibrary> <TargetMachine>MachineX86</TargetMachine> </Link> </ItemDefinitionGroup> @@ -261,7 +271,8 @@ <ClCompile> <AdditionalOptions>/GL- /MP %(AdditionalOptions)</AdditionalOptions> <Optimization>Full</Optimization> - <PreprocessorDefinitions>DLL_EXPORTS;SOUNDTOUCH_INTEGER_SAMPLES=1;NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <AdditionalIncludeDirectories>..\..\include\soundtouch\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>DLL_EXPORTS;NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <MinimalRebuild>false</MinimalRebuild> <StringPooling>true</StringPooling> <RuntimeLibrary>MultiThreaded</RuntimeLibrary> @@ -272,58 +283,68 @@ <DebugInformationFormat></DebugInformationFormat> </ClCompile> <ResourceCompile> - <PreprocessorDefinitions>DLL_EXPORTS;SOUNDTOUCH_INTEGER_SAMPLES=1;NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <PreprocessorDefinitions>DLL_EXPORTS;NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <AdditionalIncludeDirectories>..\..\include\soundtouch\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> </ResourceCompile> <Link> - <OutputFile>$(OutDir)OpenMPT_SoundTouch_i16.dll</OutputFile> + <OutputFile>$(OutDir)OpenMPT_SoundTouch_f32.dll</OutputFile> <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> <SubSystem>Windows</SubSystem> <GenerateDebugInformation>false</GenerateDebugInformation> <OptimizeReferences>true</OptimizeReferences> <EnableCOMDATFolding>true</EnableCOMDATFolding> - <ImportLibrary>..\..\bin\x64\OpenMPT_SoundTouch_i16.lib</ImportLibrary> + <ImportLibrary>..\..\bin\x64\OpenMPT_SoundTouch_f32.lib</ImportLibrary> <TargetMachine>MachineX64</TargetMachine> </Link> </ItemDefinitionGroup> <ItemGroup> - <ClInclude Include="..\..\include\soundtouch\AAFilter.h" /> - <ClInclude Include="..\..\include\soundtouch\BPMDetect.h" /> - <ClInclude Include="..\..\include\soundtouch\cpu_detect.h" /> - <ClInclude Include="..\..\include\soundtouch\FIFOSampleBuffer.h" /> - <ClInclude Include="..\..\include\soundtouch\FIFOSamplePipe.h" /> - <ClInclude Include="..\..\include\soundtouch\FIRFilter.h" /> - <ClInclude Include="..\..\include\soundtouch\PeakFinder.h" /> - <ClInclude Include="..\..\include\soundtouch\RateTransposer.h" /> - <ClInclude Include="..\..\include\soundtouch\SoundTouch.h" /> - <ClInclude Include="..\..\include\soundtouch\SoundTouchDLL.h" /> - <ClInclude Include="..\..\include\soundtouch\STTypes.h" /> - <ClInclude Include="..\..\include\soundtouch\TDStretch.h" /> + <ClInclude Include="..\..\include\soundtouch\include\BPMDetect.h" /> + <ClInclude Include="..\..\include\soundtouch\include\FIFOSampleBuffer.h" /> + <ClInclude Include="..\..\include\soundtouch\include\FIFOSamplePipe.h" /> + <ClInclude Include="..\..\include\soundtouch\include\SoundTouch.h" /> + <ClInclude Include="..\..\include\soundtouch\include\STTypes.h" /> + <ClInclude Include="..\..\include\soundtouch\source\SoundTouch\AAFilter.h" /> + <ClInclude Include="..\..\include\soundtouch\source\SoundTouch\cpu_detect.h" /> + <ClInclude Include="..\..\include\soundtouch\source\SoundTouch\FIRFilter.h" /> + <ClInclude Include="..\..\include\soundtouch\source\SoundTouch\InterpolateCubic.h" /> + <ClInclude Include="..\..\include\soundtouch\source\SoundTouch\InterpolateLinear.h" /> + <ClInclude Include="..\..\include\soundtouch\source\SoundTouch\InterpolateShannon.h" /> + <ClInclude Include="..\..\include\soundtouch\source\SoundTouch\PeakFinder.h" /> + <ClInclude Include="..\..\include\soundtouch\source\SoundTouch\RateTransposer.h" /> + <ClInclude Include="..\..\include\soundtouch\source\SoundTouch\TDStretch.h" /> + <ClInclude Include="..\..\include\soundtouch\source\SoundTouchDLL\SoundTouchDLL.h" /> </ItemGroup> <ItemGroup> - <ClCompile Include="..\..\include\soundtouch\AAFilter.cpp"> + <ClCompile Include="..\..\include\soundtouch\source\SoundTouch\AAFilter.cpp"> </ClCompile> - <ClCompile Include="..\..\include\soundtouch\BPMDetect.cpp"> + <ClCompile Include="..\..\include\soundtouch\source\SoundTouch\BPMDetect.cpp"> </ClCompile> - <ClCompile Include="..\..\include\soundtouch\cpu_detect_x86_win.cpp"> + <ClCompile Include="..\..\include\soundtouch\source\SoundTouch\cpu_detect_x86.cpp"> </ClCompile> - <ClCompile Include="..\..\include\soundtouch\FIFOSampleBuffer.cpp"> + <ClCompile Include="..\..\include\soundtouch\source\SoundTouch\FIFOSampleBuffer.cpp"> </ClCompile> - <ClCompile Include="..\..\include\soundtouch\FIRFilter.cpp"> + <ClCompile Include="..\..\include\soundtouch\source\SoundTouch\FIRFilter.cpp"> </ClCompile> - <ClCompile Include="..\..\include\soundtouch\mmx_optimized.cpp"> + <ClCompile Include="..\..\include\soundtouch\source\SoundTouch\InterpolateCubic.cpp"> </ClCompile> - <ClCompile Include="..\..\include\soundtouch\PeakFinder.cpp"> + <ClCompile Include="..\..\include\soundtouch\source\SoundTouch\InterpolateLinear.cpp"> </ClCompile> - <ClCompile Include="..\..\include\soundtouch\RateTransposer.cpp"> + <ClCompile Include="..\..\include\soundtouch\source\SoundTouch\InterpolateShannon.cpp"> </ClCompile> - <ClCompile Include="..\..\include\soundtouch\SoundTouch.cpp"> + <ClCompile Include="..\..\include\soundtouch\source\SoundTouch\mmx_optimized.cpp"> </ClCompile> - <ClCompile Include="..\..\include\soundtouch\SoundTouchDLL.cpp"> + <ClCompile Include="..\..\include\soundtouch\source\SoundTouch\PeakFinder.cpp"> </ClCompile> - <ClCompile Include="..\..\include\soundtouch\sse_optimized.cpp"> + <ClCompile Include="..\..\include\soundtouch\source\SoundTouch\RateTransposer.cpp"> </ClCompile> - <ClCompile Include="..\..\include\soundtouch\TDStretch.cpp"> + <ClCompile Include="..\..\include\soundtouch\source\SoundTouch\SoundTouch.cpp"> </ClCompile> + <ClCompile Include="..\..\include\soundtouch\source\SoundTouch\sse_optimized.cpp"> + </ClCompile> + <ClCompile Include="..\..\include\soundtouch\source\SoundTouch\TDStretch.cpp"> + </ClCompile> + <ClCompile Include="..\..\include\soundtouch\source\SoundTouchDLL\SoundTouchDLL.cpp"> + </ClCompile> </ItemGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <ImportGroup Label="ExtensionTargets"> Modified: trunk/OpenMPT/build/gen/soundtouch.vcxproj.filters =================================================================== --- trunk/OpenMPT/build/gen/soundtouch.vcxproj.filters 2014-02-18 18:24:10 UTC (rev 3731) +++ trunk/OpenMPT/build/gen/soundtouch.vcxproj.filters 2014-02-18 18:33:07 UTC (rev 3732) @@ -2,86 +2,116 @@ <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <ItemGroup> <Filter Include="include"> - <UniqueIdentifier>{F54B9B70-BA56-594A-9347-689ABAFC85B4}</UniqueIdentifier> + <UniqueIdentifier>{EC94FF61-92CE-D540-8483-022259E6CC22}</UniqueIdentifier> </Filter> <Filter Include="include\soundtouch"> - <UniqueIdentifier>{5F68B75A-F80A-FD42-A74F-8F1E3F02F8C2}</UniqueIdentifier> + <UniqueIdentifier>{096855C4-7196-DE47-93F1-9CAA87B3A2EA}</UniqueIdentifier> </Filter> + <Filter Include="include\soundtouch\include"> + <UniqueIdentifier>{5BD4D5F4-7413-FF4E-B177-2528F918972D}</UniqueIdentifier> + </Filter> + <Filter Include="include\soundtouch\source"> + <UniqueIdentifier>{252F8EF8-C266-744C-949A-480BF85F38F8}</UniqueIdentifier> + </Filter> + <Filter Include="include\soundtouch\source\SoundTouch"> + <UniqueIdentifier>{AAD5A647-EBAD-BB42-9365-B9052B18971F}</UniqueIdentifier> + </Filter> + <Filter Include="include\soundtouch\source\SoundTouchDLL"> + <UniqueIdentifier>{DD1934CE-E4B6-D54A-8C92-B014F31BD7CD}</UniqueIdentifier> + </Filter> </ItemGroup> <ItemGroup> - <ClInclude Include="..\..\include\soundtouch\AAFilter.h"> - <Filter>include\soundtouch</Filter> + <ClInclude Include="..\..\include\soundtouch\include\BPMDetect.h"> + <Filter>include\soundtouch\include</Filter> </ClInclude> - <ClInclude Include="..\..\include\soundtouch\BPMDetect.h"> - <Filter>include\soundtouch</Filter> + <ClInclude Include="..\..\include\soundtouch\include\FIFOSampleBuffer.h"> + <Filter>include\soundtouch\include</Filter> </ClInclude> - <ClInclude Include="..\..\include\soundtouch\cpu_detect.h"> - <Filter>include\soundtouch</Filter> + <ClInclude Include="..\..\include\soundtouch\include\FIFOSamplePipe.h"> + <Filter>include\soundtouch\include</Filter> </ClInclude> - <ClInclude Include="..\..\include\soundtouch\FIFOSampleBuffer.h"> - <Filter>include\soundtouch</Filter> + <ClInclude Include="..\..\include\soundtouch\include\SoundTouch.h"> + <Filter>include\soundtouch\include</Filter> </ClInclude> - <ClInclude Include="..\..\include\soundtouch\FIFOSamplePipe.h"> - <Filter>include\soundtouch</Filter> + <ClInclude Include="..\..\include\soundtouch\include\STTypes.h"> + <Filter>include\soundtouch\include</Filter> </ClInclude> - <ClInclude Include="..\..\include\soundtouch\FIRFilter.h"> - <Filter>include\soundtouch</Filter> + <ClInclude Include="..\..\include\soundtouch\source\SoundTouch\AAFilter.h"> + <Filter>include\soundtouch\source\SoundTouch</Filter> </ClInclude> - <ClInclude Include="..\..\include\soundtouch\PeakFinder.h"> - <Filter>include\soundtouch</Filter> + <ClInclude Include="..\..\include\soundtouch\source\SoundTouch\cpu_detect.h"> + <Filter>include\soundtouch\source\SoundTouch</Filter> </ClInclude> - <ClInclude Include="..\..\include\soundtouch\RateTransposer.h"> - <Filter>include\soundtouch</Filter> + <ClInclude Include="..\..\include\soundtouch\source\SoundTouch\FIRFilter.h"> + <Filter>include\soundtouch\source\SoundTouch</Filter> </ClInclude> - <ClInclude Include="..\..\include\soundtouch\SoundTouch.h"> - <Filter>include\soundtouch</Filter> + <ClInclude Include="..\..\include\soundtouch\source\SoundTouch\InterpolateCubic.h"> + <Filter>include\soundtouch\source\SoundTouch</Filter> </ClInclude> - <ClInclude Include="..\..\include\soundtouch\SoundTouchDLL.h"> - <Filter>include\soundtouch</Filter> + <ClInclude Include="..\..\include\soundtouch\source\SoundTouch\InterpolateLinear.h"> + <Filter>include\soundtouch\source\SoundTouch</Filter> </ClInclude> - <ClInclude Include="..\..\include\soundtouch\STTypes.h"> - <Filter>include\soundtouch</Filter> + <ClInclude Include="..\..\include\soundtouch\source\SoundTouch\InterpolateShannon.h"> + <Filter>include\soundtouch\source\SoundTouch</Filter> </ClInclude> - <ClInclude Include="..\..\include\soundtouch\TDStretch.h"> - <Filter>include\soundtouch</Filter> + <ClInclude Include="..\..\include\soundtouch\source\SoundTouch\PeakFinder.h"> + <Filter>include\soundtouch\source\SoundTouch</Filter> </ClInclude> + <ClInclude Include="..\..\include\soundtouch\source\SoundTouch\RateTransposer.h"> + <Filter>include\soundtouch\source\SoundTouch</Filter> + </ClInclude> + <ClInclude Include="..\..\include\soundtouch\source\SoundTouch\TDStretch.h"> + <Filter>include\soundtouch\source\SoundTouch</Filter> + </ClInclude> + <ClInclude Include="..\..\include\soundtouch\source\SoundTouchDLL\SoundTouchDLL.h"> + <Filter>include\soundtouch\source\SoundTouchDLL</Filter> + </ClInclude> </ItemGroup> <ItemGroup> - <ClCompile Include="..\..\include\soundtouch\AAFilter.cpp"> - <Filter>include\soundtouch</Filter> + <ClCompile Include="..\..\include\soundtouch\source\SoundTouch\AAFilter.cpp"> + <Filter>include\soundtouch\source\SoundTouch</Filter> </ClCompile> - <ClCompile Include="..\..\include\soundtouch\BPMDetect.cpp"> - <Filter>include\soundtouch</Filter> + <ClCompile Include="..\..\include\soundtouch\source\SoundTouch\BPMDetect.cpp"> + <Filter>include\soundtouch\source\SoundTouch</Filter> </ClCompile> - <ClCompile Include="..\..\include\soundtouch\cpu_detect_x86_win.cpp"> - <Filter>include\soundtouch</Filter> + <ClCompile Include="..\..\include\soundtouch\source\SoundTouch\cpu_detect_x86.cpp"> + <Filter>include\soundtouch\source\SoundTouch</Filter> </ClCompile> - <ClCompile Include="..\..\include\soundtouch\FIFOSampleBuffer.cpp"> - <Filter>include\soundtouch</Filter> + <ClCompile Include="..\..\include\soundtouch\source\SoundTouch\FIFOSampleBuffer.cpp"> + <Filter>include\soundtouch\source\SoundTouch</Filter> </ClCompile> - <ClCompile Include="..\..\include\soundtouch\FIRFilter.cpp"> - <Filter>include\soundtouch</Filter> + <ClCompile Include="..\..\include\soundtouch\source\SoundTouch\FIRFilter.cpp"> + <Filter>include\soundtouch\source\SoundTouch</Filter> </ClCompile> - <ClCompile Include="..\..\include\soundtouch\mmx_optimized.cpp"> - <Filter>include\soundtouch</Filter> + <ClCompile Include="..\..\include\soundtouch\source\SoundTouch\InterpolateCubic.cpp"> + <Filter>include\soundtouch\source\SoundTouch</Filter> </ClCompile> - <ClCompile Include="..\..\include\soundtouch\PeakFinder.cpp"> - <Filter>include\soundtouch</Filter> + <ClCompile Include="..\..\include\soundtouch\source\SoundTouch\InterpolateLinear.cpp"> + <Filter>include\soundtouch\source\SoundTouch</Filter> </ClCompile> - <ClCompile Include="..\..\include\soundtouch\RateTransposer.cpp"> - <Filter>include\soundtouch</Filter> + <ClCompile Include="..\..\include\soundtouch\source\SoundTouch\InterpolateShannon.cpp"> + <Filter>include\soundtouch\source\SoundTouch</Filter> </ClCompile> - <ClCompile Include="..\..\include\soundtouch\SoundTouch.cpp"> - <Filter>include\soundtouch</Filter> + <ClCompile Include="..\..\include\soundtouch\source\SoundTouch\mmx_optimized.cpp"> + <Filter>include\soundtouch\source\SoundTouch</Filter> </ClCompile> - <ClCompile Include="..\..\include\soundtouch\SoundTouchDLL.cpp"> - <Filter>include\soundtouch</Filter> + <ClCompile Include="..\..\include\soundtouch\source\SoundTouch\PeakFinder.cpp"> + <Filter>include\soundtouch\source\SoundTouch</Filter> </ClCompile> - <ClCompile Include="..\..\include\soundtouch\sse_optimized.cpp"> - <Filter>include\soundtouch</Filter> + <ClCompile Include="..\..\include\soundtouch\source\SoundTouch\RateTransposer.cpp"> + <Filter>include\soundtouch\source\SoundTouch</Filter> </ClCompile> - <ClCompile Include="..\..\include\soundtouch\TDStretch.cpp"> - <Filter>include\soundtouch</Filter> + <ClCompile Include="..\..\include\soundtouch\source\SoundTouch\SoundTouch.cpp"> + <Filter>include\soundtouch\source\SoundTouch</Filter> </ClCompile> + <ClCompile Include="..\..\include\soundtouch\source\SoundTouch\sse_optimized.cpp"> + <Filter>include\soundtouch\source\SoundTouch</Filter> + </ClCompile> + <ClCompile Include="..\..\include\soundtouch\source\SoundTouch\TDStretch.cpp"> + <Filter>include\soundtouch\source\SoundTouch</Filt... [truncated message content] |
From: <man...@us...> - 2014-02-18 18:42:39
|
Revision: 3733 http://sourceforge.net/p/modplug/code/3733 Author: manxorist Date: 2014-02-18 18:42:29 +0000 (Tue, 18 Feb 2014) Log Message: ----------- [Var] Update readme.txt about SoundTouch. Copy current SoundTouch README.html to packageTemplate/SoundTouch/ . Modified Paths: -------------- trunk/OpenMPT/installer/packageTemplate/readme.txt trunk/OpenMPT/packageTemplate/SoundTouch/README.html trunk/OpenMPT/packageTemplate/readme.txt Modified: trunk/OpenMPT/installer/packageTemplate/readme.txt =================================================================== --- trunk/OpenMPT/installer/packageTemplate/readme.txt 2014-02-18 18:33:07 UTC (rev 3732) +++ trunk/OpenMPT/installer/packageTemplate/readme.txt 2014-02-18 18:42:29 UTC (rev 3733) @@ -47,8 +47,7 @@ what can be done in OpenMPT with only a few kilobytes. History.txt: Version history. mptrack.exe: Main executable. -OpenMPT_SoundTouch_i16.dll: Slightly customized SoundTouch library used in time - stretching feature. +OpenMPT_SoundTouch_f32.dll: SoundTouch library used in time stretching feature. readme.txt: this document unmo3.dll: Used in MO3-file import. OMPT_1.20_ReleaseNotes.html: Release notes for this version. Modified: trunk/OpenMPT/packageTemplate/SoundTouch/README.html =================================================================== --- trunk/OpenMPT/packageTemplate/SoundTouch/README.html 2014-02-18 18:33:07 UTC (rev 3732) +++ trunk/OpenMPT/packageTemplate/SoundTouch/README.html 2014-02-18 18:42:29 UTC (rev 3733) @@ -2,69 +2,253 @@ <html> <head> <title>SoundTouch library README</title> - <style> -<!-- -.normal { font-family: Arial } ---> - </style> + <meta http-equiv="Content-Type" + content="text/html; charset=windows-1252"> + <meta http-equiv="Content-Language" content="en-us"> + <meta name="author" content="Olli Parviainen"> + <meta name="description" + content="Readme file for SoundTouch audio processing library"> + <meta name="GENERATOR" content="Microsoft FrontPage 4.0"> + <meta name="ProgId" content="FrontPage.Editor.Document"> + <style> <!-- .normal { font-family: Arial } + --></style> </head> <body class="normal"> <hr> -<font color=red><h5>Note: This readme is shortened version of the original -SoundTouch readme providing documentation for the time stretching feature.<br> -SoundTouch WWW page: <a href="http://www.surina.net/soundtouch">www.surina.net/soundtouch</a> -</h5></font> -<h1>SoundTouch audio processing library v1.5.0 -</h1> -<p class="normal">SoundTouch library Copyright (c) Olli -Parviainen 2002-2009 </p> +<h1>SoundTouch audio processing library v1.8.0</h1> +<p class="normal">SoundTouch library Copyright \xA9 Olli Parviainen 2001-2014</p> <hr> -<h2>3. About implementation & Usage tips</h2> +<h2>1. Introduction </h2> +<p>SoundTouch is an open-source audio processing library that allows +changing the sound tempo, pitch and playback rate parameters +independently from each other, i.e.:</p> +<ul> + <li> Sound tempo can be increased or decreased while maintaining the +original pitch </li> + <li> Sound pitch can be increased or decreased while maintaining the +original tempo </li> + <li> Change playback rate that affects both tempo and pitch at the +same time </li> + <li> Choose any combination of tempo/pitch/rate</li> +</ul> +<h3>1.1 Contact information </h3> +<p>Author email: oparviai 'at' iki.fi </p> +<p>SoundTouch WWW page: <a href="http://soundtouch.surina.net">http://soundtouch.surina.net</a></p> +<hr> +<h2>2. Compiling SoundTouch</h2> +<p>Before compiling, notice that you can choose the sample data format +if it's desirable to use floating point sample data instead of 16bit +integers. See section "sample data format" for more information.</p> +<h3>2.1. Building in Microsoft Windows</h3> +<p>Project files for Microsoft Visual C++ are supplied with the source +code package. Go to Microsoft WWW page to download +<a href="http://www.visualstudio.com/en-US/products/visual-studio-express-vs"> +Microsoft Visual Studio Express version for free</a>. +</p> +<p>To build the binaries with Visual C++ compiler, either run +"make-win.bat" script, or open the appropriate project files in source +code directories with Visual Studio. The final executable will appear +under the "SoundTouch\bin" directory. If using the Visual Studio IDE +instead of the make-win.bat script, directories bin and lib may need to +be created manually to the SoundTouch package root for the final +executables. The make-win.bat script creates these directories +automatically. </p> +<h3>2.2. Building in Gnu platforms</h3> +<p>The SoundTouch library compiles in practically any platform +supporting GNU compiler (GCC) tools. SoundTouch requires GCC version 4.3 or later.</p> +<p>To build and install the binaries, run the following commands in +/soundtouch directory:</p> +<table border="0" cellpadding="0" cellspacing="4"> + <tbody> + <tr> + <td style="vertical-align: top;"> + <pre>./bootstrap -</pre> + </td> + <td style="vertical-align: top;">Creates "configure" file with +local autoconf/automake toolset.<br> + </td> + </tr> + <tr valign="top"> + <td> + <pre>./configure -</pre> + </td> + <td> + <p>Configures the SoundTouch package for the local environment. +Notice that "configure" file is not available before running the +"./bootstrap" command as above.<br> + </p> + </td> + </tr> + <tr valign="top"> + <td> + <pre>make -</pre> + </td> + <td> + <p>Builds the SoundTouch library & SoundStretch utility.</p> + </td> + </tr> + <tr valign="top"> + <td> + <pre>make install -</pre> + </td> + <td> + <p>Installs the SoundTouch & BPM libraries to <b>/usr/local/lib</b> +and SoundStretch utility to <b>/usr/local/bin</b>. Please notice that +'root' privileges may be required to install the binaries to the +destination locations.</p> + </td> + </tr> + </tbody> +</table> +<h4><b>2.2.1 Required GNU tools</b> </h4> +<p> <span style="font-weight: bold;">Bash shell</span>, <span + style="font-weight: bold;">GNU C++ compiler</span>, <span + style="font-weight: bold;">libtool</span>, <span + style="font-weight: bold;">autoconf</span> and <span + style="font-weight: bold;">automake</span> tools +are required for compiling the SoundTouch library. These are usually +included with the GNU/Linux distribution, but if not, install these +packages first. For example, Ubuntu Linux can acquire and install +these with the following command:</p> +<pre><b>sudo apt-get install automake autoconf libtool build-essential</b></pre> +<h4><b>2.2.2 Problems with GCC compiler compatibility</b></h4> +<p>At the release time the SoundTouch package has been tested to +compile in GNU/Linux platform. However, If you have problems getting the +SoundTouch library compiled, try disabling optimizations that are specific for +x86 processors by running <b>./configure</b> script with switch +<blockquote> +<pre>--enable-x86-optimizations=no</pre> +</blockquote> + +Alternatively, if you don't use GNU Configure system, edit file "include/STTypes.h" +directly and remove the following definition:<blockquote> + <pre>#define SOUNDTOUCH_ALLOW_X86_OPTIMIZATIONS 1</pre> +</blockquote> + +<h4><b>2.2.3 Compiling Shared Library / DLL version</b></h4> + <p> + The GNU compilation does not automatically create a shared-library version of + SoundTouch (.so or .dll). If such is desired, then you can create it as follows + after running the usual compilation:</p> + <blockquote> + <pre>g++ -shared -static -DDLL_EXPORTS -I../../include -o SoundTouch.dll \ + SoundTouchDLL.cpp ../SoundTouch/.libs/libSoundTouch.a +sstrip SoundTouch.dll</pre> +</blockquote> + +<h3>2.1. Building in Android</h3> +<p>Android compilation instructions are within the + source code package, see file "<b>source/Android-lib/README-SoundTouch-Android.html</b>" + in the package.</p> + +<hr> +<h2>3. About implementation & Usage tips <h3>3.1. Supported sample data formats</h3> +<p>The sample data format can be chosen between 16bit signed integer +and 32bit floating point values, the default is 32bit floating point. </p> +<p> In Windows environment, the sample data format is chosen in file +"STTypes.h" by choosing one of the following defines:</p> +<ul> + <li> <span style="font-weight: bold;">#define +SOUNDTOUCH_INTEGER_SAMPLES</span> for 16bit signed integer </li> + <li> <span style="font-weight: bold;">#define </span><span + style="font-weight: bold;">SOUNDTOUCH_</span><span + style="font-weight: bold;">FLOAT_SAMPLES</span> for 32bit floating +point</li> +</ul> +<p> In GNU environment, the floating sample format is used by default, +but integer sample format can be chosen by giving the following switch +to the configure script: </p> +<blockquote> + <pre>./configure --enable-integer-samples</pre> +</blockquote> +<p>The sample data can have either single (mono) or double (stereo) +audio channel. Stereo data is interleaved so that every other data +value is for left channel and every second for right channel. Notice +that while it'd be possible in theory to process stereo sound as two +separate mono channels, this isn't recommended because processing the +channels separately would result in losing the phase coherency between +the channels, which consequently would ruin the stereo effect.</p> +<p>Sample rates between 8000-48000H are supported.</p> +<h3>3.2. Processing latency</h3> +<p>The processing and latency constraints of the SoundTouch library are:</p> +<ul> + <li> Input/output processing latency for the SoundTouch processor is +around 100 ms. This is when time-stretching is used. If the rate +transposing effect alone is used, the latency requirement is much +shorter, see section 'About algorithms'. </li> + <li> Processing CD-quality sound (16bit stereo sound with 44100H +sample rate) in real-time or faster is possible starting from +processors equivalent to Intel Pentium 133Mh or better, if using the +"quick" processing algorithm. If not using the "quick" mode or if +floating point sample data are being used, several times more CPU power +is typically required.</li> +</ul> <h3>3.3. About algorithms</h3> -<p><em>Time-stretching </em>means changing -the audio stream duration without affecting it's pitch. SoundTouch -uses WSOLA-like time-stretching routines that operate in the time -domain. Compared to sample rate transposing, time-stretching is a -much heavier operation and also requires a longer processing -"window" of sound samples used by the -processing algorithm, thus increasing the algorithm input/output -latency. Typical i/o latency for the SoundTouch -time-stretch algorithm is around 100 ms.</p> +<p>SoundTouch provides three seemingly independent effects: tempo, +pitch and playback rate control. These three controls are implemented +as combination of two primary effects, <em>sample rate transposing</em> +and <em>time-stretching</em>.</p> +<p><em>Sample rate transposing</em> affects both the audio stream +duration and pitch. It's implemented simply by converting the original +audio sample stream to the desired duration by interpolating from +the original audio samples. In SoundTouch, linear interpolation with +anti-alias filtering is used. Theoretically a higher-order +interpolation provide better result than 1st order linear +interpolation, but in audio application linear interpolation together +with anti-alias filtering performs subjectively about as well as +higher-order filtering would.</p> +<p><em>Time-stretching </em>means changing the audio stream duration +without affecting it's pitch. SoundTouch uses WSOLA-like +time-stretching routines that operate in the time domain. Compared to +sample rate transposing, time-stretching is a much heavier operation +and also requires a longer processing "window" of sound samples used by +the processing algorithm, thus increasing the algorithm input/output +latency. Typical i/o latency for the SoundTouch time-stretch algorithm +is around 100 ms.</p> +<p>Sample rate transposing and time-stretching are then used together +to produce the tempo, pitch and rate controls:</p> +<ul> + <li> <strong>'Tempo'</strong> control is implemented purely by +time-stretching. </li> + <li> <strong>'Rate</strong>' control is implemented purely by sample +rate transposing. </li> + <li> <strong>'Pitch</strong>' control is implemented as a +combination of time-stretching and sample rate transposing. For +example, to increase pitch the audio stream is first time-stretched to +longer duration (without affecting pitch) and then transposed back to +original duration by sample rate transposing, which simultaneously +reduces duration and increases pitch. The result is original duration +but increased pitch.</li> +</ul> <h3>3.4 Tuning the algorithm parameters</h3> -<p>The time-stretch algorithm has few -parameters that can be tuned to optimize sound quality for -certain application. The current default parameters have been -chosen by iterative if-then analysis (read: "trial and error") -to obtain best subjective sound quality in pop/rock music -processing, but in applications processing different kind of -sound the default parameter set may result into a sub-optimal -result.</p> -<p>The time-stretch algorithm default -parameter values are set by the following #defines in file "TDStretch.h":</p> +<p>The time-stretch algorithm has few parameters that can be tuned to +optimize sound quality for certain application. The current default +parameters have been chosen by iterative if-then analysis (read: "trial +and error") to obtain best subjective sound quality in pop/rock music +processing, but in applications processing different kind of sound the +default parameter set may result into a sub-optimal result.</p> +<p>The time-stretch algorithm default parameter values are set by the +following #defines in file "TDStretch.h":</p> <blockquote> - <pre>#define DEFAULT_SEQUENCE_MS AUTOMATIC -#define DEFAULT_SEEKWINDOW_MS AUTOMATIC -#define DEFAULT_OVERLAP_MS 8</pre> + <pre>#define DEFAULT_SEQUENCE_MS AUTOMATIC<br>#define DEFAULT_SEEKWINDOW_MS AUTOMATIC<br>#define DEFAULT_OVERLAP_MS 8</pre> </blockquote> -<p>These parameters affect to the time-stretch -algorithm as follows:</p> +<p>These parameters affect to the time-stretch algorithm as follows:</p> <ul> - <li><strong>DEFAULT_SEQUENCE_MS</strong>: This is -the default length of a single processing sequence in milliseconds -which determines the how the original sound is chopped in -the time-stretch algorithm. Larger values mean fewer sequences -are used in processing. In principle a larger value sounds better when -slowing down the tempo, but worse when increasing the tempo and vice -versa. <br> + <li> <strong>DEFAULT_SEQUENCE_MS</strong>: This is the default +length of a single processing sequence in milliseconds which determines +the how the original sound is chopped in the time-stretch algorithm. +Larger values mean fewer sequences are used in processing. In principle +a larger value sounds better when slowing down the tempo, but worse +when increasing the tempo and vice versa. <br> <br> - By default, this setting value is calculated automatically according to - tempo value.<br> +By default, this setting value is calculated automatically according to +tempo value.<br> </li> - <li><strong>DEFAULT_SEEKWINDOW_MS</strong>: The seeking window + <li> <strong>DEFAULT_SEEKWINDOW_MS</strong>: The seeking window default length in milliseconds is for the algorithm that seeks the best -possible overlapping location. This determines from how -wide a sample "window" the algorithm can use to find an optimal mixing -location when the sound sequences are to be linked back together. <br> +possible overlapping location. This determines from how wide a sample +"window" the algorithm can use to find an optimal mixing location when +the sound sequences are to be linked back together. <br> <br> The bigger this window setting is, the higher the possibility to find a better mixing position becomes, but at the same time large values may @@ -73,237 +257,528 @@ sounds as if a constant frequency was drifting around, try reducing this setting.<br> <br> - By default, this setting value is calculated automatically according to - tempo value.<br> +By default, this setting value is calculated automatically according to +tempo value.<br> </li> - <li><strong>DEFAULT_OVERLAP_MS</strong>: Overlap -length in milliseconds. When the sound sequences are mixed back -together to form again a continuous sound stream, this parameter -defines how much the ends of the consecutive sequences will overlap with each other.<br> + <li> <strong>DEFAULT_OVERLAP_MS</strong>: Overlap length in +milliseconds. When the sound sequences are mixed back together to form +again a continuous sound stream, this parameter defines how much the +ends of the consecutive sequences will overlap with each other.<br> <br> - This shouldn't be that critical parameter. If you reduce the +This shouldn't be that critical parameter. If you reduce the DEFAULT_SEQUENCE_MS setting by a large amount, you might wish to try a smaller value on this.</li> </ul> -<p>Notice that these parameters can also be -set during execution time with functions "<strong>TDStretch::setParameters()</strong>" -and "<strong>SoundTouch::setSetting()</strong>".</p> -<p>The table below summaries how the -parameters can be adjusted for different applications:</p> +<p>Notice that these parameters can also be set during execution time +with functions "<strong>TDStretch::setParameters()</strong>" and "<strong>SoundTouch::setSetting()</strong>".</p> +<p>The table below summaries how the parameters can be adjusted for +different applications:</p> <table border="1"> <tbody> <tr> <td valign="top"><strong>Parameter name</strong></td> - <td valign="top"><strong>Default value -magnitude</strong></td> - <td valign="top"><strong>Larger value -affects...</strong></td> - <td valign="top"><strong>Smaller value -affects...</strong></td> + <td valign="top"><strong>Default value magnitude</strong></td> + <td valign="top"><strong>Larger value affects...</strong></td> + <td valign="top"><strong>Smaller value affects...</strong></td> <td valign="top"><strong>Effect to CPU burden</strong></td> </tr> <tr> <td valign="top"> <pre>SEQUENCE_MS</pre> </td> - <td valign="top">Default value is relatively -large, chosen for slowing down music tempo</td> - <td valign="top">Larger value is usually -better for slowing down tempo. Growing the value decelerates the -"echoing" artifact when slowing down the tempo.</td> - <td valign="top">Smaller value might be better -for speeding up tempo. Reducing the value accelerates the "echoing" -artifact when slowing down the tempo </td> - <td valign="top">Increasing the parameter -value reduces computation burden</td> + <td valign="top">Default value is relatively large, chosen for +slowing down music tempo</td> + <td valign="top">Larger value is usually better for slowing down +tempo. Growing the value decelerates the "echoing" artifact when +slowing down the tempo.</td> + <td valign="top">Smaller value might be better for speeding up +tempo. Reducing the value accelerates the "echoing" artifact when +slowing down the tempo </td> + <td valign="top">Increasing the parameter value reduces +computation burden</td> </tr> <tr> <td valign="top"> <pre>SEEKWINDOW_MS</pre> </td> - <td valign="top">Default value is relatively -large, chosen for slowing down music tempo</td> - <td valign="top">Larger value eases finding a -good mixing position, but may cause a "drifting" artifact</td> - <td valign="top">Smaller reduce possibility to -find a good mixing position, but reduce the "drifting" artifact.</td> - <td valign="top">Increasing the parameter -value increases computation burden</td> + <td valign="top">Default value is relatively large, chosen for +slowing down music tempo</td> + <td valign="top">Larger value eases finding a good mixing +position, but may cause a "drifting" artifact</td> + <td valign="top">Smaller reduce possibility to find a good mixing +position, but reduce the "drifting" artifact.</td> + <td valign="top">Increasing the parameter value increases +computation burden</td> </tr> <tr> <td valign="top"> <pre>OVERLAP_MS</pre> </td> - <td valign="top">Default value is relatively -large, chosen to suit with above parameters.</td> + <td valign="top">Default value is relatively large, chosen to +suit with above parameters.</td> <td valign="top"> </td> - <td valign="top">If you reduce the "sequence -ms" setting, you might wish to try a smaller value.</td> - <td valign="top">Increasing the parameter -value increases computation burden</td> + <td valign="top">If you reduce the "sequence ms" setting, you +might wish to try a smaller value.</td> + <td valign="top">Increasing the parameter value increases +computation burden</td> </tr> </tbody> </table> +<h3>3.5 Performance Optimizations </h3> +<p><strong>General optimizations:</strong></p> +<p>The time-stretch routine has a 'quick' mode that substantially +speeds up the algorithm but may degrade the sound quality by a small +amount. This mode is activated by calling SoundTouch::setSetting() +function with parameter id of SETTING_USE_QUICKSEEK and value +"1", i.e. </p> +<blockquote> + <p>setSetting(SETTING_USE_QUICKSEEK, 1);</p> +</blockquote> +<p><strong>CPU-specific optimizations:</strong></p> +<ul> + <li> Intel MMX optimized routines are used with compatible CPUs when +16bit integer sample type is used. MMX optimizations are available both +in Win32 and Gnu/x86 platforms. Compatible processors are Intel +PentiumMMX and later; AMD K6-2, Athlon and later. </li> + <li> Intel SSE optimized routines are used with compatible CPUs when +floating point sample type is used. SSE optimizations are currently +implemented for Win32 platform only. Processors compatible with SSE +extension are Intel processors starting from Pentium-III, and AMD +processors starting from Athlon XP. </li> + <li> AMD 3DNow! optimized routines are used with compatible CPUs when +floating point sample type is used, but SSE extension isn't supported . +3DNow! optimizations are currently implemented for Win32 platform only. +These optimizations are used in AMD K6-2 and Athlon (classic) CPU's; +better performing SSE routines are used with AMD processor starting +from Athlon XP. </li> +</ul> <hr> +<h2><a name="SoundStretch"></a>4. SoundStretch audio processing utility +</h2> +<p>SoundStretch audio processing utility<br> + Copyright (c) Olli Parviainen 2002-2012</p> +<p>SoundStretch is a simple command-line application that can change +tempo, pitch and playback rates of WAV sound files. This program is +intended primarily to demonstrate how the "SoundTouch" library can be +used to process sound in your own program, but it can as well be used +for processing sound files.</p> +<h3>4.1. SoundStretch Usage Instructions</h3> +<p>SoundStretch Usage syntax:</p> +<blockquote> + <pre>soundstretch infilename outfilename [switches]</pre> +</blockquote> +<p>Where: </p> +<table width="100%" border="0" cellpadding="2"> + <tbody> + <tr> + <td valign="top"> + <pre>"infilename"</pre> + </td> + <td valign="top">Name of the input sound data file (in .WAV audio +file format). Give "stdin" as filename to use standard input pipe. </td> + </tr> + <tr> + <td valign="top"> + <pre>"outfilename"</pre> + </td> + <td valign="top">Name of the output sound file where the +resulting sound is saved (in .WAV audio file format). This parameter +may be omitted if you don't want to save the output (e.g. when +only calculating BPM rate with '-bpm' switch). Give "stdout" as +filename to use standard output pipe.</td> + </tr> + <tr> + <td valign="top"> + <pre> [switches]</pre> + </td> + <td valign="top">Are one or more control switches.</td> + </tr> + </tbody> +</table> +<p>Available control switches are:</p> +<table width="100%" border="0" cellpadding="2"> + <tbody> + <tr> + <td valign="top"> + <pre>-tempo=n </pre> + </td> + <td valign="top">Change the sound tempo by n percents (n = -95.0 +.. +5000.0 %) </td> + </tr> + <tr> + <td valign="top"> + <pre>-pitch=n</pre> + </td> + <td valign="top">Change the sound pitch by n semitones (n = -60.0 +.. + 60.0 semitones) </td> + </tr> + <tr> + <td valign="top"> + <pre>-rate=n</pre> + </td> + <td valign="top">Change the sound playback rate by n percents (n += -95.0 .. +5000.0 %) </td> + </tr> + <tr> + <td valign="top"> + <pre>-bpm=n</pre> + </td> + <td valign="top">Detect the Beats-Per-Minute (BPM) rate of the +sound and adjust the tempo to meet 'n' BPMs. When this switch is +applied, the "-tempo" switch is ignored. If "=n" is omitted, i.e. +switch "-bpm" is used alone, then the BPM rate is estimated and +displayed, but tempo not adjusted according to the BPM value. </td> + </tr> + <tr> + <td valign="top"> + <pre>-quick</pre> + </td> + <td valign="top">Use quicker tempo change algorithm. Gains speed +but loses sound quality. </td> + </tr> + <tr> + <td valign="top"> + <pre>-naa</pre> + </td> + <td valign="top">Don't use anti-alias filtering in sample rate +transposing. Gains speed but loses sound quality. </td> + </tr> + <tr> + <td valign="top"> + <pre>-license</pre> + </td> + <td valign="top">Displays the program license text (LGPL)</td> + </tr> + </tbody> +</table> +<p>Notes:</p> +<ul> + <li> To use standard input/output pipes for processing, give "stdin" +and "stdout" as input/output filenames correspondingly. The standard +input/output pipes will still carry the audio data in .wav audio file +format. </li> + <li> The numerical switches allow both integer (e.g. "-tempo=123") +and decimal (e.g. "-tempo=123.45") numbers. </li> + <li> The "-naa" and/or "-quick" switches can be used to reduce CPU +usage while compromising some sound quality </li> + <li> The BPM detection algorithm works by detecting repeating bass or +drum patterns at low frequencies of <250Hz. A lower-than-expected +BPM figure may be reported for music with uneven or complex bass +patterns. </li> +</ul> +<h3>4.2. SoundStretch usage examples </h3> +<p><strong>Example 1</strong></p> +<p>The following command increases tempo of the sound file +"originalfile.wav" by 12.5% and stores result to file +"destinationfile.wav":</p> +<blockquote> + <pre>soundstretch originalfile.wav destinationfile.wav -tempo=12.5</pre> +</blockquote> +<p><strong>Example 2</strong></p> +<p>The following command decreases the sound pitch (key) of the sound +file "orig.wav" by two semitones and stores the result to file +"dest.wav":</p> +<blockquote> + <pre>soundstretch orig.wav dest.wav -pitch=-2</pre> +</blockquote> +<p><strong>Example 3</strong></p> +<p>The following command processes the file "orig.wav" by decreasing +the sound tempo by 25.3% and increasing the sound pitch (key) by 1.5 +semitones. Resulting .wav audio data is directed to standard output +pipe:</p> +<blockquote> + <pre>soundstretch orig.wav stdout -tempo=-25.3 -pitch=1.5</pre> +</blockquote> +<p><strong>Example 4</strong></p> +<p>The following command detects the BPM rate of the file "orig.wav" +and adjusts the tempo to match 100 beats per minute. Result is stored +to file "dest.wav":</p> +<blockquote> + <pre>soundstretch orig.wav dest.wav -bpm=100</pre> +</blockquote> +<p><strong>Example 5</strong></p> +<p>The following command reads .wav sound data from standard input pipe +and estimates the BPM rate:</p> +<blockquote> + <pre>soundstretch stdin -bpm</pre> +</blockquote> +<hr> <h2>5. Change History</h2> <h3>5.1. SoundTouch library Change History </h3> - +<p><b>1.8.0:</b></p> +<ul> + <li>Added support for multi-channel audio processing</li> + <li>Added support for <b>cubic</b> and <b>shannon</b> interpolation for rate and pitch shift effects besides + the original <b>linear</b> interpolation, to reduce aliasing at high frequencies due to interpolation. + Cubic interpolation is used as default for floating point processing, and linear interpolation for integer + processing.</li> + <li>Fixed bug in anti-alias filtering that limited stop-band attenuation to -10 dB instead of <-50dB, and + increased filter length from 32 to 64 taps to further reduce aliasing due to frequency folding.</li> + <li>Performance improvements in cross-correlation algorithm</li> + <li>Other bug and compatibility fixes</li> +</ul> +<p><b>1.7.1:</b></p> +<ul> + <li>Added files for Android compilation +</ul> +<p><b>1.7.0:</b></p> +<ul> + <li>Sound quality improvements/li> + <li>Improved flush() to adjust output sound stream duration to match better with + ideal duration</li> + <li>Rewrote x86 cpu feature check to resolve compatibility problems</li> + <li>Configure script automatically checks if CPU supports mmx & sse compatibility for GNU platform, and + the script support now "--enable-x86-optimizations" switch to allow disabling x86-specific optimizations.</li> + <li>Revised #define conditions for 32bit/64bit compatibility</li> + <li>gnu autoconf/automake script compatibility fixes</li> + <li>Tuned beat-per-minute detection algorithm</li> +</ul> +<p><b>1.6.0:</b></p> +<ul> + <li> Added automatic cutoff threshold adaptation to beat detection +routine to better adapt BPM calculation to different types of music </li> + <li> Retired 3DNow! optimization support as 3DNow! is nowadays +obsoleted and assembler code is nuisance to maintain</li> + <li>Retired "configure" file from source code package due to +autoconf/automake versio conflicts, so that it is from now on to be +generated by invoking "boostrap" script that uses locally available +toolchain version for generating the "configure" file</li> + <li>Resolved namespace/label naming conflicts with other libraries by +replacing global labels such as INTEGER_SAMPLES with more specific +SOUNDTOUCH_INTEGER_SAMPLES etc.<br> + </li> + <li>Updated windows build scripts & project files for Visual +Studio 2008 support</li> + <li> Updated SoundTouch.dll API for .NET compatibility</li> + <li> Added API for querying nominal processing input & output +sample batch sizes</li> +</ul> <p><strong>1.5.0:</strong></p> <ul> -<li>Added normalization to correlation calculation and improvement automatic seek/sequence parameter calculation to improve sound quality</li> - -<li>Bugfixes: - <ul> - <li>Fixed negative array indexing in quick seek algorithm</li> - <li>FIR autoalias filter running too far in processing buffer</li> - <li>Check against zero sample count in rate transposing</li> - <li>Fix for x86-64 support: Removed pop/push instructions from the cpu detection algorithm. </li> - <li>Check against empty buffers in FIFOSampleBuffer</li> - <li>Other minor fixes & code cleanup</li> - </ul> -</li> - -<li>Fixes in compilation scripts for non-Intel platforms</li> -<li>Added Dynamic-Link-Library (DLL) version of SoundTouch library build, - provided with Delphi/Pascal wrapper for calling the dll routines</li> -<li>Added #define PREVENT_CLICK_AT_RATE_CROSSOVER that prevents a click artifact - when crossing the nominal pitch from either positive to negative side or vice - versa</li> - + <li> Added normalization to correlation calculation and improvement +automatic seek/sequence parameter calculation to improve sound quality </li> + <li> Bugfixes: + <ul> + <li> Fixed negative array indexing in quick seek algorithm </li> + <li> FIR autoalias filter running too far in processing buffer </li> + <li> Check against zero sample count in rate transposing </li> + <li> Fix for x86-64 support: Removed pop/push instructions from +the cpu detection algorithm. </li> + <li> Check against empty buffers in FIFOSampleBuffer </li> + <li> Other minor fixes & code cleanup</li> + </ul> + </li> + <li> Fixes in compilation scripts for non-Intel platforms </li> + <li> Added Dynamic-Link-Library (DLL) version of SoundTouch library +build, provided with Delphi/Pascal wrapper for calling the dll routines + </li> + <li> Added #define PREVENT_CLICK_AT_RATE_CROSSOVER that prevents a +click artifact when crossing the nominal pitch from either positive to +negative side or vice versa</li> </ul> - <p><strong>1.4.1:</strong></p> <ul> -<li>Fixed a buffer overflow bug in BPM detect algorithm routines if processing - more than 2048 samples at one call </li> - + <li> Fixed a buffer overflow bug in BPM detect algorithm routines if +processing more than 2048 samples at one call </li> </ul> - <p><strong>1.4.0:</strong></p> <ul> -<li>Improved sound quality by automatic calculation of time stretch algorithm - processing parameters according to tempo setting</li> -<li>Moved BPM detection routines from SoundStretch application into SoundTouch - library</li> -<li>Bugfixes: Usage of uninitialied variables, GNU build scripts, compiler errors - due to 'const' keyword mismatch.</li> -<li>Source code cleanup</li> - + <li> Improved sound quality by automatic calculation of time stretch +algorithm processing parameters according to tempo setting </li> + <li> Moved BPM detection routines from SoundStretch application into +SoundTouch library </li> + <li> Bugfixes: Usage of uninitialied variables, GNU build scripts, +compiler errors due to 'const' keyword mismatch. </li> + <li> Source code cleanup</li> </ul> - -<p><strong>v1.3.1: -</strong></p> +<p><strong>1.3.1: </strong> </p> <ul> -<li>Changed static class declaration to GCC 4.x compiler compatible syntax.</li> -<li>Enabled MMX/SSE-optimized routines also for GCC compilers. Earlier -the MMX/SSE-optimized routines were written in compiler-specific inline -assembler, now these routines are migrated to use compiler intrinsic -syntax which allows compiling the same MMX/SSE-optimized source code with -both Visual C++ and GCC compilers. </li> -<li>Set floating point as the default sample format and added switch to -the GNU configure script for selecting the other sample format.</li> - + <li> Changed static class declaration to GCC 4.x compiler compatible +syntax. </li> + <li> Enabled MMX/SSE-optimized routines also for GCC compilers. +Earlier the MMX/SSE-optimized routines were written in +compiler-specific inline assembler, now these routines are migrated to +use compiler intrinsic syntax which allows compiling the same +MMX/SSE-optimized source code with both Visual C++ and GCC compilers. </li> + <li> Set floating point as the default sample format and added switch +to the GNU configure script for selecting the other sample format.</li> </ul> - -<p><strong>v1.3.0: -</strong></p> +<p><strong>1.3.0: </strong> </p> <ul> - <li>Fixed tempo routine output duration inaccuracy due to rounding + <li> Fixed tempo routine output duration inaccuracy due to rounding error </li> - <li>Implemented separate processing routines for integer and + <li> Implemented separate processing routines for integer and floating arithmetic to allow improvements to floating point routines (earlier used algorithms mostly optimized for integer arithmetic also for floating point samples) </li> - <li>Fixed a bug that distorts sound if sample rate changes during the -sound stream </li> - <li>Fixed a memory leak that appeared in MMX/SSE/3DNow! optimized + <li> Fixed a bug that distorts sound if sample rate changes during +the sound stream </li> + <li> Fixed a memory leak that appeared in MMX/SSE/3DNow! optimized routines </li> - <li>Reduced redundant code pieces in MMX/SSE/3DNow! optimized -routines vs. the standard C routines.</li> - <li>MMX routine incompatibility with new gcc compiler versions </li> - <li>Other miscellaneous bug fixes </li> + <li> Reduced redundant code pieces in MMX/SSE/3DNow! optimized +routines vs. the standard C routines. </li> + <li> MMX routine incompatibility with new gcc compiler versions </li> + <li> Other miscellaneous bug fixes </li> </ul> -<p><strong>v1.2.1: </strong></p> +<p><strong>1.2.1: </strong> </p> <ul> - <li>Added automake/autoconf scripts for GNU -platforms (in courtesy of David Durham)</li> - <li>Fixed SCALE overflow bug in rate transposer -routine.</li> - <li>Fixed 64bit address space bugs.</li> - <li>Created a 'soundtouch' namespace for -SAMPLETYPE definitions.</li> + <li> Added automake/autoconf scripts for GNU platforms (in courtesy +of David Durham) </li> + <li> Fixed SCALE overflow bug in rate transposer routine. </li> + <li> Fixed 64bit address space bugs. </li> + <li> Created a 'soundtouch' namespace for SAMPLETYPE definitions.</li> </ul> -<p><strong>v1.2.0: </strong></p> +<p><strong>1.2.0: </strong> </p> <ul> - <li>Added support for 32bit floating point sample -data type with SSE/3DNow! optimizations for Win32 platform (SSE/3DNow! optimizations currently not supported in GCC environment)</li> - <li>Replaced 'make-gcc' script for GNU environment -by master Makefile</li> - <li>Added time-stretch routine configurability to -SoundTouch main class</li> - <li>Bugfixes</li> + <li> Added support for 32bit floating point sample data type with +SSE/3DNow! optimizations for Win32 platform (SSE/3DNow! optimizations +currently not supported in GCC environment) </li> + <li> Replaced 'make-gcc' script for GNU environment by master +Makefile </li> + <li> Added time-stretch routine configurability to SoundTouch main +class </li> + <li> Bugfixes</li> </ul> -<p><strong>v1.1.1: </strong></p> +<p><strong>1.1.1: </strong> </p> <ul> - <li>Moved SoundTouch under lesser GPL license (LGPL). This allows using SoundTouch library in programs that aren't -released under GPL license. </li> - <li>Changed MMX routine organiation so that MMX optimized routines are now implemented in classes that are derived from -the basic classes having the standard non-mmx routines. </li> - <li>MMX routines to support gcc version 3. </li> - <li>Replaced windows makefiles by script using the .dsw files </li> + <li> Moved SoundTouch under lesser GPL license (LGPL). This allows +using SoundTouch library in programs that aren't released under GPL +license. </li> + <li> Changed MMX routine organiation so that MMX optimized routines +are now implemented in classes that are derived from the basic classes +having the standard non-mmx routines. </li> + <li> MMX routines to support gcc version 3. </li> + <li> Replaced windows makefiles by script using the .dsw files </li> </ul> -<p><strong>v1.01: </strong></p> +<p><strong>1.0.1: </strong> </p> <ul> - <li>"mmx_gcc.cpp": Added "using namespace std" and -removed "return 0" from a function with void return value to fix -compiler errors when compiling the library in Solaris environment. </li> - <li>Moved file "FIFOSampleBuffer.h" to "include" -directory to allow accessing the FIFOSampleBuffer class from external -files. </li> + <li> "mmx_gcc.cpp": Added "using namespace std" and removed "return +0" from a function with void return value to fix compiler errors when +compiling the library in Solaris environment. </li> + <li> Moved file "FIFOSampleBuffer.h" to "include" directory to allow +accessing the FIFOSampleBuffer class from external files. </li> </ul> -<p><strong>v1.0: </strong></p> +<p><strong>1.0: </strong> </p> <ul> - <li>Initial release </li> + <li> Initial release </li> </ul> <p> </p> +<h3>5.2. SoundStretch application Change History </h3> +<p><b>1.7.0:</b></p> +<ul> + <li>Bugfixes in Wavfile: exception string formatting, avoid getLengthMs() integer + precision overflow, support WAV files using 24/32bit sample format.</li> +</ul> + <p><b>1.5.0:</b></p> +<ul> + <li> Added "-speech" switch to activate algorithm parameters more +suitable for speech processing than the default parameters tuned for +music processing.</li> +</ul> +<p><strong>1.4.0:</strong></p> +<ul> + <li> Moved BPM detection routines from SoundStretch application into +SoundTouch library </li> + <li> Allow using standard input/output pipes as audio processing +input/output streams</li> +</ul> +<p><strong>1.3.0:</strong></p> +<ul> + <li> Simplified accessing WAV files with floating point sample +format. </li> +</ul> +<p><strong>1.2.1: </strong> </p> +<ul> + <li> Fixed 64bit address space bugs.</li> +</ul> +<p><strong>1.2.0: </strong> </p> +<ul> + <li> Added support for 32bit floating point sample data type </li> + <li> Restructured the BPM routines into separate library </li> + <li> Fixed big-endian conversion bugs in WAV file routines (hopefully +:)</li> +</ul> +<p><strong>1.1.1: </strong> </p> +<ul> + <li> Fixed bugs in WAV file reading & added byte-order conversion +for big-endian processors. </li> + <li> Moved SoundStretch source code under 'example' directory to +highlight difference from SoundTouch stuff. </li> + <li> Replaced windows makefiles by script using the .dsw files </li> + <li> Output file name isn't required if output isn't desired (e.g. if +using the switch '-bpm' in plain format only) </li> +</ul> +<p><strong>1.1:</strong></p> +<ul> + <li> Fixed "Release" settings in Microsoft Visual C++ project file +(.dsp) </li> + <li> Added beats-per-minute (BPM) detection routine and command-line +switch "-bpm" </li> +</ul> +<p><strong>1.01: </strong> </p> +<ul> + <li> Initial release </li> +</ul> <hr> -<h2 >6. Acknowledgements </h2> -<p >Kudos for these people who have contributed to development or submitted -bugfixes since -SoundTouch v1.3.1: </p> +<h2>6. Acknowledgements </h2> +<p>Kudos for these people who have contributed to development or +submitted bugfixes since SoundTouch v1.3.1: </p> <ul> - <li>Arthur A</li> - <li>Richard Ash</li> - <li>Stanislav Brabec</li> - <li>Christian Budde</li> - <li>Brian Cameron</li> - <li>Jason Champion</li> - <li>Patrick Colis</li> - <li>Justin Frankel</li> - <li>Jason Garland</li> - <li>Takashi Iwai</li> - <li>Paulo Pizarro</li> - <li>RJ Ryan</li> - <li>John Sheehy</li> + <li> Arthur A</li> + <li> Richard Ash</li> + <li> Stanislav Brabec</li> + <li> Christian Budde</li> + <li> Chris Bryan</li> + <li> Jacek Caban</li> + <li> Brian Cameron</li> + <li> Jason Champion</li> + <li> David Clark</li> + <li> Patrick Colis</li> + <li> Miquel Colon</li> + <li> Justin Frankel</li> + <li> Jason Garland</li> + <li> Takashi Iwai</li> + <li> Yuval Naveh</li> + <li> Paulo Pizarro</li> + <li> Blaise Potard</li> + <li> RJ Ryan</li> + <li> Patrick Colis </li> + <li> Miquel Colon </li> + <li> Sandro Cumerlato</li> + <li> Justin Frankel </li> + <li> Jason Garland </li> + <li> Masa H. </li> + <li> Takashi Iwai </li> + <li> Mathias M\xF6hl</li> + <li> Yuval Naveh </li> + <li> Paulo Pizarro </li> + <li> Blaise Potard</li> + <li> RJ Ryan </li> + <li> John Sheehy</li> + <li> Tim Shuttleworth</li> + <li> John Stumpo</li> + <li> Tim Shuttleworth</li> + <li> Katja Vetter</li> </ul> -<p >Moral greetings to all other contributors and users also!</p> +<p>Moral greetings to all other contributors and users also!</p> <hr> -<h2 >7. LICENSE </h2> +<h2>7. LICENSE </h2> <p>SoundTouch audio processing library<br> Copyright (c) Olli Parviainen</p> -<p>This library is free software; you can -redistribute it and/or modify it under the terms of the GNU -Lesser General Public License version 2.1 as published by the Free Software -Foundation.</p> -<p>This library is distributed in the hope -that it will be useful, but WITHOUT ANY WARRANTY; without even -the implied warranty of MERCHANTABILITY or FITNESS FOR A -PARTICULAR PURPOSE. See the GNU Lesser General Public License for -more details.</p> -<p>You should have received a copy of the GNU -Lesser General Public License along with this library; if not, -write to the Free Software Foundation, Inc., 59 Temple Place, -Suite 330, Boston, MA 02111-1307 USA</p> -<hr> +<p>This library is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License version 2.1 +as published by the Free Software Foundation.</p> +<p>This library is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser +General Public License for more details.</p> +<p>You should have received a copy of the GNU Lesser General Public +License along with this library; if not, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA</p> +<hr><!-- +$Id: README.html 191 2014-01-07 20:26:30Z oparviai $ +--> + <p> + <i>RREADME.html file updated on 7-Jan-2014</i></p> </body> </html> Modified: trunk/OpenMPT/packageTemplate/readme.txt =================================================================== --- trunk/OpenMPT/packageTemplate/readme.txt 2014-02-18 18:33:07 UTC (rev 3732) +++ trunk/OpenMPT/packageTemplate/readme.txt 2014-02-18 18:42:29 UTC (rev 3733) @@ -63,8 +63,7 @@ History.txt: Version history. mptrack.exe: Main executable. open_settings_folder.bat: Opens settings folder (%APPDATA\OpenMPT). -OpenMPT_SoundTouch_i16.dll: Slightly customized SoundTouch library used in time - stretching feature. +OpenMPT_SoundTouch_f32.dll: SoundTouch library used in time stretching feature. readme.txt: this document unmo3.dll: Used in MO3-file import. OMPT_1.20_ReleaseNotes.html: Release notes for this version. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2014-02-20 17:32:33
|
Revision: 3739 http://sourceforge.net/p/modplug/code/3739 Author: saga-games Date: 2014-02-20 17:32:24 +0000 (Thu, 20 Feb 2014) Log Message: ----------- [New] Can now clone plugins to another slot. [Mod] OpenMPT: Version is now 1.22.07.23 Modified Paths: -------------- trunk/OpenMPT/common/versionNumber.h trunk/OpenMPT/mptrack/MoveFXSlotDialog.cpp trunk/OpenMPT/mptrack/MoveFXSlotDialog.h trunk/OpenMPT/mptrack/SelectPluginDialog.cpp trunk/OpenMPT/mptrack/View_gen.cpp trunk/OpenMPT/mptrack/mptrack.rc Modified: trunk/OpenMPT/common/versionNumber.h =================================================================== --- trunk/OpenMPT/common/versionNumber.h 2014-02-18 20:53:06 UTC (rev 3738) +++ trunk/OpenMPT/common/versionNumber.h 2014-02-20 17:32:24 UTC (rev 3739) @@ -17,7 +17,7 @@ #define VER_MAJORMAJOR 1 #define VER_MAJOR 22 #define VER_MINOR 07 -#define VER_MINORMINOR 22 +#define VER_MINORMINOR 23 //Version string. For example "1.17.02.28" #define MPT_VERSION_STR VER_STRINGIZE(VER_MAJORMAJOR) "." VER_STRINGIZE(VER_MAJOR) "." VER_STRINGIZE(VER_MINOR) "." VER_STRINGIZE(VER_MINORMINOR) Modified: trunk/OpenMPT/mptrack/MoveFXSlotDialog.cpp =================================================================== --- trunk/OpenMPT/mptrack/MoveFXSlotDialog.cpp 2014-02-18 20:53:06 UTC (rev 3738) +++ trunk/OpenMPT/mptrack/MoveFXSlotDialog.cpp 2014-02-20 17:32:24 UTC (rev 3739) @@ -9,22 +9,26 @@ #include "stdafx.h" -#include "mptrack.h" -#include "afxtempl.h" +#include "Mptrack.h" #include "MoveFXSlotDialog.h" -#include ".\movefxslotdialog.h" -IMPLEMENT_DYNAMIC(CMoveFXSlotDialog, CDialog) -CMoveFXSlotDialog::CMoveFXSlotDialog(CWnd* pParent /*=NULL*/) - : CDialog(CMoveFXSlotDialog::IDD, pParent) +CMoveFXSlotDialog::CMoveFXSlotDialog(CWnd *pParent, PLUGINDEX currentSlot, const std::vector<PLUGINDEX> &emptySlots, PLUGINDEX defaultIndex, bool clone) : + CDialog(CMoveFXSlotDialog::IDD, pParent), + m_nDefaultSlot(defaultIndex), + m_EmptySlots(emptySlots) { + if(clone) + { + m_csPrompt.Format(_T("Clone plugin in slot %d to the following empty slot:"), currentSlot + 1); + m_csTitle = _T("Clone To Slot..."); + } else + { + m_csPrompt.Format(_T("Move plugin in slot %d to the following empty slot:"), currentSlot + 1); + m_csTitle = _T("Move To Slot..."); + } } -CMoveFXSlotDialog::~CMoveFXSlotDialog() -//------------------------------------- -{ -} void CMoveFXSlotDialog::DoDataExchange(CDataExchange* pDX) //-------------------------------------------------------- @@ -35,12 +39,6 @@ } -BEGIN_MESSAGE_MAP(CMoveFXSlotDialog, CDialog) -END_MESSAGE_MAP() - - -// CMoveFXSlotDialog message handlers - void CMoveFXSlotDialog::OnOK() //---------------------------- { @@ -49,16 +47,6 @@ } -void CMoveFXSlotDialog::SetupMove(PLUGINDEX currentSlot, std::vector<PLUGINDEX> &emptySlots, PLUGINDEX defaultIndex) -//------------------------------------------------------------------------------------------------------------------ -{ - m_nDefaultSlot = defaultIndex; - m_csPrompt.Format("Move plugin in slot %d to the following empty slot:", currentSlot + 1); - m_csTitle.Format("Move To Slot.."); - m_EmptySlots = emptySlots; -} - - BOOL CMoveFXSlotDialog::OnInitDialog() //------------------------------------ { @@ -66,10 +54,17 @@ m_EditPrompt.SetWindowText(m_csPrompt); SetWindowText(m_csTitle); - CString slotText; + if(m_EmptySlots.empty()) + { + Reporting::Error("No empty plugin slots are availabe."); + OnCancel(); + return TRUE; + } + + CString slotText; int defaultSlot = 0; bool foundDefault = false; - for(size_t nSlot=0; nSlot < m_EmptySlots.size(); nSlot++) + for(size_t nSlot = 0; nSlot < m_EmptySlots.size(); nSlot++) { slotText.Format("FX%d", m_EmptySlots[nSlot] + 1); m_CbnEmptySlots.SetItemData(m_CbnEmptySlots.AddString(slotText), m_EmptySlots[nSlot]); Modified: trunk/OpenMPT/mptrack/MoveFXSlotDialog.h =================================================================== --- trunk/OpenMPT/mptrack/MoveFXSlotDialog.h 2014-02-18 20:53:06 UTC (rev 3738) +++ trunk/OpenMPT/mptrack/MoveFXSlotDialog.h 2014-02-20 17:32:24 UTC (rev 3739) @@ -9,36 +9,26 @@ #pragma once -#include "afxwin.h" -// CMoveFXSlotDialog dialog - class CMoveFXSlotDialog : public CDialog { - DECLARE_DYNAMIC(CMoveFXSlotDialog) +protected: + const std::vector<PLUGINDEX> &m_EmptySlots; + CString m_csPrompt, m_csTitle; + CEdit m_EditPrompt; + PLUGINDEX m_nDefaultSlot, m_nToSlot; -public: - CMoveFXSlotDialog(CWnd* pParent = NULL); // standard constructor - virtual ~CMoveFXSlotDialog(); - void SetupMove(PLUGINDEX currentSlot, std::vector<PLUGINDEX> &emptySlots, PLUGINDEX defaultIndex); - PLUGINDEX m_nToSlot; - + CComboBox m_CbnEmptySlots; - -// Dialog Data enum { IDD = IDD_MOVEFXSLOT }; +public: + CMoveFXSlotDialog(CWnd *pParent, PLUGINDEX currentSlot, const std::vector<PLUGINDEX> &emptySlots, PLUGINDEX defaultIndex, bool clone); + PLUGINDEX GetSlot() const { return m_nToSlot; } + protected: - CString m_csPrompt, m_csTitle; - CEdit m_EditPrompt; - std::vector<PLUGINDEX> m_EmptySlots; virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support - CComboBox m_CbnEmptySlots; - PLUGINDEX m_nDefaultSlot; - DECLARE_MESSAGE_MAP() virtual void OnOK(); -public: - virtual BOOL OnInitDialog(); }; Modified: trunk/OpenMPT/mptrack/SelectPluginDialog.cpp =================================================================== --- trunk/OpenMPT/mptrack/SelectPluginDialog.cpp 2014-02-18 20:53:06 UTC (rev 3738) +++ trunk/OpenMPT/mptrack/SelectPluginDialog.cpp 2014-02-20 17:32:24 UTC (rev 3739) @@ -165,21 +165,7 @@ { // No effect CriticalSection cs; - if (pCurrentPlugin) - { - pCurrentPlugin->Release(); - changed = true; - } - - // Just in case... - m_pPlugin->pMixPlugin = nullptr; - m_pPlugin->pMixState = nullptr; - - // Remove old state - m_pPlugin->nPluginDataSize = 0; - if (m_pPlugin->pPluginData) delete[] m_pPlugin->pPluginData; - m_pPlugin->pPluginData = nullptr; - + m_pPlugin->Destroy(); // Clear plugin info MemsetZero(m_pPlugin->Info); } Modified: trunk/OpenMPT/mptrack/View_gen.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_gen.cpp 2014-02-18 20:53:06 UTC (rev 3738) +++ trunk/OpenMPT/mptrack/View_gen.cpp 2014-02-20 17:32:24 UTC (rev 3739) @@ -24,6 +24,9 @@ #include "ChannelManagerDlg.h" #include "SelectPluginDialog.h" #include "../common/StringFixer.h" +#include "VstPresets.h" +#include "../soundlib/FileReader.h" +#include <sstream> IMPLEMENT_SERIAL(CViewGlobals, CFormView, 0) @@ -53,9 +56,9 @@ ON_COMMAND(IDC_BUTTON3, OnSetParameter) ON_COMMAND(IDC_BUTTON4, OnNextPlugin) ON_COMMAND(IDC_BUTTON5, OnPrevPlugin) - ON_COMMAND(IDC_MOVEFXSLOT, OnMovePlugToSlot) + ON_COMMAND(IDC_MOVEFXSLOT, OnMovePlugToSlot) ON_COMMAND(IDC_INSERTFXSLOT,OnInsertSlot) - ON_COMMAND(IDC_CLONEPLUG, OnClonePlug) + ON_COMMAND(IDC_CLONEPLUG, OnClonePlug) ON_COMMAND(IDC_BUTTON6, OnLoadParam) @@ -414,7 +417,7 @@ CheckDlgButton(IDC_CHECK9, pPlugin->IsMasterEffect() ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(IDC_CHECK10, pPlugin->IsBypassed() ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(IDC_CHECK11, pPlugin->IsWetMix() ? BST_CHECKED : BST_UNCHECKED); - CVstPlugin *pVstPlugin = (pPlugin->pMixPlugin) ? (CVstPlugin *)pPlugin->pMixPlugin : NULL; + CVstPlugin *pVstPlugin = (pPlugin->pMixPlugin) ? (CVstPlugin *)pPlugin->pMixPlugin : nullptr; m_BtnEdit.EnableWindow((pVstPlugin != nullptr && (pVstPlugin->HasEditor() || pVstPlugin->GetNumParameters())) ? TRUE : FALSE); ::EnableWindow(::GetDlgItem(m_hWnd, IDC_MOVEFXSLOT), (pVstPlugin) ? TRUE : FALSE); ::EnableWindow(::GetDlgItem(m_hWnd, IDC_INSERTFXSLOT), (pVstPlugin) ? TRUE : FALSE); @@ -1166,8 +1169,6 @@ void CViewGlobals::OnMovePlugToSlot() //----------------------------------- { - CMoveFXSlotDialog dlg((CWnd*)this); - // If any plugin routes its output to the current plugin, we shouldn't try to move it before that plugin... PLUGINDEX defaultIndex = 0; const CSoundFile *pSndFile = GetDocument() ? (GetDocument()->GetSoundFile()) : nullptr; @@ -1184,12 +1185,13 @@ std::vector<PLUGINDEX> emptySlots; BuildEmptySlotList(emptySlots); - dlg.SetupMove(m_nCurrentPlugin, emptySlots, defaultIndex); - if (dlg.DoModal() == IDOK) - { - MovePlug(m_nCurrentPlugin, dlg.m_nToSlot); - m_CbnPlugin.SetCurSel(dlg.m_nToSlot); + CMoveFXSlotDialog dlg(this, m_nCurrentPlugin, emptySlots, defaultIndex, false); + + if(dlg.DoModal() == IDOK) + { + MovePlug(m_nCurrentPlugin, dlg.GetSlot()); + m_CbnPlugin.SetCurSel(dlg.GetSlot()); OnPluginChanged(); } @@ -1343,6 +1345,7 @@ } else { pSndFile->m_MixPlugins[MAX_MIXPLUGINS - 1].Destroy(); + MemsetZero(pSndFile->m_MixPlugins[MAX_MIXPLUGINS - 1].Info); } } @@ -1372,7 +1375,42 @@ void CViewGlobals::OnClonePlug() //------------------------------ { - //Reporting::Notification("Not yet implemented."); + if(GetCurrentPlugin() == nullptr || GetDocument() == nullptr) + { + MessageBeep(MB_ICONEXCLAMATION); + return; + } + + std::vector<PLUGINDEX> emptySlots; + BuildEmptySlotList(emptySlots); + + CMoveFXSlotDialog dlg(this, m_nCurrentPlugin, emptySlots, 0, true); + + if(dlg.DoModal() == IDOK) + { + CSoundFile &sndFile = GetDocument()->GetrSoundFile(); + const SNDMIXPLUGIN &curPlugin = sndFile.m_MixPlugins[m_nCurrentPlugin]; + SNDMIXPLUGIN &newPlugin = sndFile.m_MixPlugins[dlg.GetSlot()]; + + newPlugin.Destroy(); + MemCopy(newPlugin.Info, curPlugin.Info); + if(theApp.GetPluginManager()->CreateMixPlugin(newPlugin, sndFile)) + { + CVstPlugin *vstPlug = static_cast<CVstPlugin *>(newPlugin.pMixPlugin); + vstPlug->SetCurrentProgram(GetCurrentPlugin()->GetCurrentProgram()); + + std::ostringstream f(std::ios::out | std::ios::binary); + if(VSTPresets::SaveFile(f, *GetCurrentPlugin(), false)) + { + const std::string data = f.str(); + FileReader file(data.c_str(), data.length()); + VSTPresets::LoadFile(file, *vstPlug); + } + } + + m_CbnPlugin.SetCurSel(dlg.GetSlot()); + OnPluginChanged(); + } } Modified: trunk/OpenMPT/mptrack/mptrack.rc =================================================================== --- trunk/OpenMPT/mptrack/mptrack.rc 2014-02-18 20:53:06 UTC (rev 3738) +++ trunk/OpenMPT/mptrack/mptrack.rc 2014-02-20 17:32:24 UTC (rev 3739) @@ -1012,7 +1012,7 @@ PUSHBUTTON "Edit...",IDC_BUTTON2,231,191,27,13,0,WS_EX_STATICEDGE PUSHBUTTON "Insert...",IDC_INSERTFXSLOT,154,207,34,13,0,WS_EX_STATICEDGE PUSHBUTTON "Move...",IDC_MOVEFXSLOT,53,207,34,13,0,WS_EX_STATICEDGE - PUSHBUTTON "Clone...",IDC_CLONEPLUG,103,207,34,13,NOT WS_VISIBLE,WS_EX_STATICEDGE + PUSHBUTTON "Clone...",IDC_CLONEPLUG,103,207,34,13,0,WS_EX_STATICEDGE PUSHBUTTON "<<",IDC_BUTTON5,11,191,18,13,NOT WS_TABSTOP,WS_EX_STATICEDGE PUSHBUTTON ">>",IDC_BUTTON4,32,191,18,13,NOT WS_TABSTOP,WS_EX_STATICEDGE EDITTEXT IDC_EDIT13,312,191,94,13,ES_CENTER | ES_AUTOHSCROLL This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2014-02-20 20:15:41
|
Revision: 3741 http://sourceforge.net/p/modplug/code/3741 Author: saga-games Date: 2014-02-20 20:15:33 +0000 (Thu, 20 Feb 2014) Log Message: ----------- [Imp] libopenmpt & OpenMPT render export: When exporting an XM file with an F00 command, stop processing as soon as no more voices are playing. Modified Paths: -------------- trunk/OpenMPT/mptrack/Mod2wave.cpp trunk/OpenMPT/soundlib/Fastmix.cpp trunk/OpenMPT/soundlib/Sndmix.cpp Modified: trunk/OpenMPT/mptrack/Mod2wave.cpp =================================================================== --- trunk/OpenMPT/mptrack/Mod2wave.cpp 2014-02-20 17:46:45 UTC (rev 3740) +++ trunk/OpenMPT/mptrack/Mod2wave.cpp 2014-02-20 20:15:33 UTC (rev 3741) @@ -31,6 +31,7 @@ static CSoundFile::samplecount_t ReadInterleaved(CSoundFile &sndFile, void *outputBuffer, CSoundFile::samplecount_t count, SampleFormat sampleFormat, Dither &dither) //------------------------------------------------------------------------------------------------------------------------------------------------------------------- { + sndFile.ResetMixStat(); switch(sampleFormat.value) { case SampleFormatUnsigned8: Modified: trunk/OpenMPT/soundlib/Fastmix.cpp =================================================================== --- trunk/OpenMPT/soundlib/Fastmix.cpp 2014-02-20 17:46:45 UTC (rev 3740) +++ trunk/OpenMPT/soundlib/Fastmix.cpp 2014-02-20 20:15:33 UTC (rev 3741) @@ -277,7 +277,7 @@ StereoFill(MixSoundBuffer, count, gnDryROfsVol, gnDryLOfsVol); if(m_MixerSettings.gnChannels > 2) InitMixBuffer(MixRearBuffer, count*2); - CHANNELINDEX nchused = 0, nchmixed = 0; + CHANNELINDEX nchmixed = 0; const bool ITPingPongMode = IsITPingPongMode(); const bool realtimeMix = !IsRenderingToDisc(); @@ -334,7 +334,6 @@ } } } - nchused++; // Calculate offset of loop wrap-around buffer for this sample. const int8 * const samplePointer = static_cast<const int8 *>(chn.pCurrentSample); @@ -462,7 +461,7 @@ chn.pCurrentSample = samplePointer; nchmixed += naddmix; } - m_nMixStat = std::max<CHANNELINDEX>(m_nMixStat, nchused); + m_nMixStat = std::max<CHANNELINDEX>(m_nMixStat, nchmixed); } Modified: trunk/OpenMPT/soundlib/Sndmix.cpp =================================================================== --- trunk/OpenMPT/soundlib/Sndmix.cpp 2014-02-20 17:46:45 UTC (rev 3740) +++ trunk/OpenMPT/soundlib/Sndmix.cpp 2014-02-20 20:15:33 UTC (rev 3741) @@ -184,6 +184,17 @@ m_PatternCuePoints.push_back(cue); } #endif + + #ifdef MODPLUG_TRACKER + if(IsRenderingToDisc()) + #endif // MODPLUG_TRACKER + { + // Stop playback on F00 if no more voices are active. + if(m_nMusicSpeed == uint16_max && m_nMixStat == 0 && GetType() == MOD_TYPE_XM) + { + m_SongFlags.set(SONG_ENDREACHED); + } + } } else { // no new pattern data #ifdef MODPLUG_TRACKER This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <man...@us...> - 2014-02-21 11:36:20
|
Revision: 3745 http://sourceforge.net/p/modplug/code/3745 Author: manxorist Date: 2014-02-21 11:36:10 +0000 (Fri, 21 Feb 2014) Log Message: ----------- [Var] openmpt123: Update copyright string. It's 2014 now. [Doc] libopenmpt: Update changelog. Modified Paths: -------------- trunk/OpenMPT/libopenmpt/dox/changelog.md trunk/OpenMPT/openmpt123/openmpt123.cpp Modified: trunk/OpenMPT/libopenmpt/dox/changelog.md =================================================================== --- trunk/OpenMPT/libopenmpt/dox/changelog.md 2014-02-20 22:23:10 UTC (rev 3744) +++ trunk/OpenMPT/libopenmpt/dox/changelog.md 2014-02-21 11:36:10 UTC (rev 3745) @@ -10,8 +10,8 @@ * [Change] The test suite is now built by default with Makefile based builds. Use `TEST=0` to skip building the tests. `make check` runs the test suite. - * [Bug] Crash in MOD loader on architectures not supporting unaligned memory - access. + * [Bug] Crash in MOD and XM loaders on architectures not supporting unaligned + memory access. * [Bug] MMCMP, PP20 and XPK unpackers should now work on non-x86 hardware and implement proper bounds checking. * [Bug] openmpt_module_get_num_samples() returned the wrong value. @@ -19,13 +19,14 @@ * [Bug] in_openmpt/xmp-openmpt: Setting name for stereo separation was mis-spelled. This version will revert your stereo separation settings to default. + * [Bug] Crash when loading some corrupted modules with stereo samples. * Support building on Android NDK. * Avoid clicks in sample loops when using interpolation. * IT filters are now done in integer instead of floating point. This improves performances, especially on architectures with no or a slow FPU. * MOD pattern break handling fixes. - * XM playback improvements (especially panning). + * Various XM playback improvements. * Improved and switchable dithering when using 16bit integer API. ### 2014-01-12 - libopenmpt 0.2-beta2 Modified: trunk/OpenMPT/openmpt123/openmpt123.cpp =================================================================== --- trunk/OpenMPT/openmpt123/openmpt123.cpp 2014-02-20 22:23:10 UTC (rev 3744) +++ trunk/OpenMPT/openmpt123/openmpt123.cpp 2014-02-21 11:36:10 UTC (rev 3745) @@ -326,7 +326,7 @@ static void show_info( std::ostream & log, bool verbose ) { log << "openmpt123" << " v" << OPENMPT123_VERSION_STRING << ", libopenmpt " << openmpt::string::get( openmpt::string::library_version ) << " (" << "OpenMPT " << openmpt::string::get( openmpt::string::core_version ) << ")" << std::endl; - log << "Copyright (c) 2013 OpenMPT developers <http://openmpt.org/>" << std::endl; + log << "Copyright (c) 2013-2014 OpenMPT developers <http://openmpt.org/>" << std::endl; if ( !verbose ) { log << std::endl; return; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2014-02-22 23:47:34
|
Revision: 3755 http://sourceforge.net/p/modplug/code/3755 Author: saga-games Date: 2014-02-22 23:47:25 +0000 (Sat, 22 Feb 2014) Log Message: ----------- [Mod] Add SSE2 implementation for min/max finder. Only used if AMD MMX extensions and SSE code generation are disabled, as those won't work on x64 (since __m64 is not available) and the performance difference is marginal. Modified Paths: -------------- trunk/OpenMPT/common/BuildSettings.h trunk/OpenMPT/common/misc_util.cpp trunk/OpenMPT/mptrack/View_smp.cpp Modified: trunk/OpenMPT/common/BuildSettings.h =================================================================== --- trunk/OpenMPT/common/BuildSettings.h 2014-02-22 22:16:25 UTC (rev 3754) +++ trunk/OpenMPT/common/BuildSettings.h 2014-02-22 23:47:25 UTC (rev 3755) @@ -36,8 +36,10 @@ // inline assembly requires MSVC compiler -#if defined(ENABLE_ASM) && MPT_COMPILER_MSVC && defined(_M_IX86) +#if defined(ENABLE_ASM) && MPT_COMPILER_MSVC +#ifdef _M_IX86 + // Generate general x86 inline assembly. #define ENABLE_X86 @@ -47,9 +49,22 @@ // Generate inline assembly using SSE instructions (only used when the CPU supports it). #define ENABLE_SSE +// Generate inline assembly using SSE2 instructions (only used when the CPU supports it). +#define ENABLE_SSE2 + // Generate inline assembly using AMD specific instruction set extensions (only used when the CPU supports it). #define ENABLE_X86_AMD +#elif defined(_M_X64) + +// Generate general x64 inline assembly. +#define ENABLE_X64 + +// Generate inline assembly using SSE2 instructions (only used when the CPU supports it). +#define ENABLE_SSE2 + +#endif + #endif // ENABLE_ASM Modified: trunk/OpenMPT/common/misc_util.cpp =================================================================== --- trunk/OpenMPT/common/misc_util.cpp 2014-02-22 22:16:25 UTC (rev 3754) +++ trunk/OpenMPT/common/misc_util.cpp 2014-02-22 23:47:25 UTC (rev 3755) @@ -218,7 +218,7 @@ uint32 ProcSupport = 0; -#if MPT_COMPILER_MSVC && defined(ENABLE_X86) +#if MPT_COMPILER_MSVC && (defined(ENABLE_X86) || defined(ENABLE_X64)) #include <intrin.h> Modified: trunk/OpenMPT/mptrack/View_smp.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_smp.cpp 2014-02-22 22:16:25 UTC (rev 3754) +++ trunk/OpenMPT/mptrack/View_smp.cpp 2014-02-22 23:47:25 UTC (rev 3755) @@ -579,7 +579,6 @@ //------------------------------------------------------------------------------------------------------- { scanlen *= channels; - __m64 minVal = _mm_cvtsi32_si64(smin); __m64 maxVal = _mm_cvtsi32_si64(smax); @@ -593,7 +592,7 @@ if(scanlen4) { const __m64 *v = static_cast<const __m64 *>(p); - p = static_cast<const uint64 *>(p) + scanlen4; + p = static_cast<const __m64 *>(p) + scanlen4; while(scanlen4--) { @@ -602,15 +601,16 @@ maxVal = _mm_max_pi16(maxVal, curVals); } + // Now we have 4 minima and maxima each, in case of stereo they are interleaved L/R values. + // Move the upper 2 values to the lower half and compute the minima/maxima of that. __m64 minVal2 = _mm_unpackhi_pi32(minVal, minVal); __m64 maxVal2 = _mm_unpackhi_pi32(maxVal, maxVal); - minVal = _mm_min_pi16(minVal, minVal2); maxVal = _mm_max_pi16(maxVal, maxVal2); if(channels < 2) { - // Mono + // Mono: Compute the minima/maxima of the both remaining values minVal2 = _mm_sra_pi32(minVal, _mm_cvtsi32_si64(16)); maxVal2 = _mm_sra_pi32(maxVal, _mm_cvtsi32_si64(16)); minVal = _mm_min_pi16(minVal, minVal2); @@ -665,7 +665,7 @@ if(scanlen8) { const __m64 *v = static_cast<const __m64 *>(p); - p = static_cast<const uint64 *>(p) + scanlen8; + p = static_cast<const __m64 *>(p) + scanlen8; while(scanlen8--) { @@ -674,12 +674,15 @@ maxVal = _mm_max_pu8(maxVal, curVals); } + // Now we have 8 minima and maxima each, in case of stereo they are interleaved L/R values. + // Move the upper 4 values to the lower half and compute the minima/maxima of that. __m64 minVal2 = _mm_unpackhi_pi32(minVal, minVal); __m64 maxVal2 = _mm_unpackhi_pi32(maxVal, maxVal); - minVal = _mm_min_pu8(minVal, minVal2); maxVal = _mm_max_pu8(maxVal, maxVal2); + // Now we have 4 minima and maxima each, in case of stereo they are interleaved L/R values. + // Move the upper 2 values to the lower half and compute the minima/maxima of that. minVal2 = _mm_srl_pi32(minVal, _mm_cvtsi32_si64(16)); maxVal2 = _mm_srl_pi32(maxVal, _mm_cvtsi32_si64(16)); minVal = _mm_min_pu8(minVal, minVal2); @@ -687,7 +690,7 @@ if(channels < 2) { - // Mono + // Mono: Compute the minima/maxima of the both remaining values minVal2 = _mm_srl_pi32(minVal, _mm_cvtsi32_si64(8)); maxVal2 = _mm_srl_pi32(maxVal, _mm_cvtsi32_si64(8)); minVal = _mm_min_pu8(minVal, minVal2); @@ -715,8 +718,146 @@ _mm_empty(); } -#endif +#elif defined(ENABLE_SSE2) +#include <emmintrin.h> + +// SSE2 implementation for min/max finder, packs 8*int16 in a 128-bit XMM register. +// scanlen = How many samples to process on this channel +static void sse2_findminmax16(const void *p, int scanlen, int channels, int &smin, int &smax) +//------------------------------------------------------------------------------------------- +{ + scanlen *= channels; + + // Put minimum / maximum in 8 packed int16 values + __m128i minVal = _mm_set1_epi16(static_cast<int16>(smin)); + __m128i maxVal = _mm_set1_epi16(static_cast<int16>(smax)); + + int scanlen8 = scanlen / 8; + if(scanlen8) + { + const __m128i *v = static_cast<const __m128i *>(p); + p = static_cast<const __m128i *>(p) + scanlen8; + + while(scanlen8--) + { + __m128i curVals = _mm_loadu_si128(v++); + minVal = _mm_min_epi16(minVal, curVals); + maxVal = _mm_max_epi16(maxVal, curVals); + } + + // Now we have 8 minima and maxima each, in case of stereo they are interleaved L/R values. + // Move the upper 4 values to the lower half and compute the minima/maxima of that. + __m128i minVal2 = _mm_unpackhi_epi64(minVal, minVal); + __m128i maxVal2 = _mm_unpackhi_epi64(maxVal, maxVal); + minVal = _mm_min_epi16(minVal, minVal2); + maxVal = _mm_max_epi16(maxVal, maxVal2); + + // Now we have 4 minima and maxima each, in case of stereo they are interleaved L/R values. + // Move the upper 2 values to the lower half and compute the minima/maxima of that. + minVal2 = _mm_shuffle_epi32(minVal, _MM_SHUFFLE(1, 1, 1, 1)); + maxVal2 = _mm_shuffle_epi32(maxVal, _MM_SHUFFLE(1, 1, 1, 1)); + minVal = _mm_min_epi16(minVal, minVal2); + maxVal = _mm_max_epi16(maxVal, maxVal2); + + if(channels < 2) + { + // Mono: Compute the minima/maxima of the both remaining values + minVal2 = _mm_shufflelo_epi16(minVal, _MM_SHUFFLE(1, 1, 1, 1)); + maxVal2 = _mm_shufflelo_epi16(maxVal, _MM_SHUFFLE(1, 1, 1, 1)); + minVal = _mm_min_epi16(minVal, minVal2); + maxVal = _mm_max_epi16(maxVal, maxVal2); + } + } + + const int16 *p16 = static_cast<const int16 *>(p); + while(scanlen & 7) + { + scanlen -= channels; + __m128i curVals = _mm_set1_epi16(*p16); + p16 += channels; + minVal = _mm_min_epi16(minVal, curVals); + maxVal = _mm_max_epi16(maxVal, curVals); + } + + smin = static_cast<int16>(_mm_cvtsi128_si32(minVal)); + smax = static_cast<int16>(_mm_cvtsi128_si32(maxVal)); +} + + +// SSE2 implementation for min/max finder, packs 16*int8 in a 128-bit XMM register. +// scanlen = How many samples to process on this channel +static void sse2_findminmax8(const void *p, int scanlen, int channels, int &smin, int &smax) +//------------------------------------------------------------------------------------------ +{ + scanlen *= channels; + + // Put minimum / maximum in 8 packed int16 values + __m128i minVal = _mm_set1_epi8(static_cast<int8>(smin)); + __m128i maxVal = _mm_set1_epi8(static_cast<int8>(smax)); + + int scanlen16 = scanlen / 16; + if(scanlen16) + { + const __m128i *v = static_cast<const __m128i *>(p); + p = static_cast<const __m128i *>(p) + scanlen16; + + while(scanlen16--) + { + __m128i curVals = _mm_loadu_si128(v++); + minVal = _mm_min_epi8(minVal, curVals); + maxVal = _mm_max_epi8(maxVal, curVals); + } + + // Now we have 16 minima and maxima each, in case of stereo they are interleaved L/R values. + // Move the upper 8 values to the lower half and compute the minima/maxima of that. + __m128i minVal2 = _mm_unpackhi_epi64(minVal, minVal); + __m128i maxVal2 = _mm_unpackhi_epi64(maxVal, maxVal); + minVal = _mm_min_epi8(minVal, minVal2); + maxVal = _mm_max_epi8(maxVal, maxVal2); + + // Now we have 8 minima and maxima each, in case of stereo they are interleaved L/R values. + // Move the upper 4 values to the lower half and compute the minima/maxima of that. + minVal2 = _mm_shuffle_epi32(minVal, _MM_SHUFFLE(1, 1, 1, 1)); + maxVal2 = _mm_shuffle_epi32(maxVal, _MM_SHUFFLE(1, 1, 1, 1)); + minVal = _mm_min_epi8(minVal, minVal2); + maxVal = _mm_max_epi8(maxVal, maxVal2); + + // Now we have 4 minima and maxima each, in case of stereo they are interleaved L/R values. + // Move the upper 2 values to the lower half and compute the minima/maxima of that. + minVal2 = _mm_srai_epi32(minVal, 16); + maxVal2 = _mm_srai_epi32(maxVal, 16); + minVal = _mm_min_epi8(minVal, minVal2); + maxVal = _mm_max_epi8(maxVal, maxVal2); + + if(channels < 2) + { + // Mono: Compute the minima/maxima of the both remaining values + minVal2 = _mm_srai_epi16(minVal, 8); + maxVal2 = _mm_srai_epi16(maxVal, 8); + minVal = _mm_min_epi8(minVal, minVal2); + maxVal = _mm_max_epi8(maxVal, maxVal2); + } + } + + const int8 *p8 = static_cast<const int8 *>(p); + while(scanlen & 15) + { + scanlen -= channels; + __m128i curVals = _mm_set1_epi8(*p8); + p8 += channels; + minVal = _mm_min_epi8(minVal, curVals); + maxVal = _mm_max_epi8(maxVal, curVals); + } + + smin = static_cast<int8>(_mm_cvtsi128_si32(minVal)); + smax = static_cast<int8>(_mm_cvtsi128_si32(maxVal)); +} + + +#endif // defined(ENABLE_SSE) + + // Draw one channel of zoomed-out sample data void CViewSample::DrawSampleData2(HDC hdc, int ymed, int cx, int cy, SmpLength len, int uFlags, const void *pSampleData) //---------------------------------------------------------------------------------------------------------------------- @@ -776,9 +917,14 @@ { amdmmxext_or_sse_findminmax16(p, scanlen, numChannels, smin, smax); } else +#elif defined(ENABLE_SSE2) + if(GetProcSupport() & PROCSUPPORT_SSE2) + { + sse2_findminmax16(p, scanlen, numChannels, smin, smax); + } else #endif { - for (SmpLength i=0; i<scanlen; i++) + for (SmpLength i = 0; i < scanlen; i++) { int s = *p; if (s < smin) smin = s; @@ -799,9 +945,14 @@ { amdmmxext_or_sse_findminmax8(p, scanlen, numChannels, smin, smax); } else +#elif defined(ENABLE_SSE2) + if(GetProcSupport() & PROCSUPPORT_SSE2) + { + sse2_findminmax8(p, scanlen, numChannels, smin, smax); + } else #endif { - for (SmpLength i=0; i<scanlen; i++) + for (SmpLength i = 0; i < scanlen; i++) { int s = *p; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2014-02-23 01:11:30
|
Revision: 3756 http://sourceforge.net/p/modplug/code/3756 Author: saga-games Date: 2014-02-23 01:11:19 +0000 (Sun, 23 Feb 2014) Log Message: ----------- [Imp] Cloning and moving plugin slots allows to move / clone the entire plugin chain now. [Mod] OpenMPT: Version is now 1.22.07.24 Modified Paths: -------------- trunk/OpenMPT/common/versionNumber.h trunk/OpenMPT/mptrack/MoveFXSlotDialog.cpp trunk/OpenMPT/mptrack/MoveFXSlotDialog.h trunk/OpenMPT/mptrack/View_gen.cpp trunk/OpenMPT/mptrack/mptrack.rc Modified: trunk/OpenMPT/common/versionNumber.h =================================================================== --- trunk/OpenMPT/common/versionNumber.h 2014-02-22 23:47:25 UTC (rev 3755) +++ trunk/OpenMPT/common/versionNumber.h 2014-02-23 01:11:19 UTC (rev 3756) @@ -17,7 +17,7 @@ #define VER_MAJORMAJOR 1 #define VER_MAJOR 22 #define VER_MINOR 07 -#define VER_MINORMINOR 23 +#define VER_MINORMINOR 24 //Version string. For example "1.17.02.28" #define MPT_VERSION_STR VER_STRINGIZE(VER_MAJORMAJOR) "." VER_STRINGIZE(VER_MAJOR) "." VER_STRINGIZE(VER_MINOR) "." VER_STRINGIZE(VER_MINORMINOR) Modified: trunk/OpenMPT/mptrack/MoveFXSlotDialog.cpp =================================================================== --- trunk/OpenMPT/mptrack/MoveFXSlotDialog.cpp 2014-02-22 23:47:25 UTC (rev 3755) +++ trunk/OpenMPT/mptrack/MoveFXSlotDialog.cpp 2014-02-23 01:11:19 UTC (rev 3756) @@ -13,10 +13,20 @@ #include "MoveFXSlotDialog.h" -CMoveFXSlotDialog::CMoveFXSlotDialog(CWnd *pParent, PLUGINDEX currentSlot, const std::vector<PLUGINDEX> &emptySlots, PLUGINDEX defaultIndex, bool clone) : +void CMoveFXSlotDialog::DoDataExchange(CDataExchange* pDX) +//-------------------------------------------------------- +{ + CDialog::DoDataExchange(pDX); + DDX_Control(pDX, IDC_COMBO1, m_CbnEmptySlots); + DDX_Control(pDX, IDC_EDIT1, m_EditPrompt); +} + + +CMoveFXSlotDialog::CMoveFXSlotDialog(CWnd *pParent, PLUGINDEX currentSlot, const std::vector<PLUGINDEX> &emptySlots, PLUGINDEX defaultIndex, bool clone, bool hasChain) : CDialog(CMoveFXSlotDialog::IDD, pParent), m_nDefaultSlot(defaultIndex), - m_EmptySlots(emptySlots) + m_EmptySlots(emptySlots), + moveChain(hasChain) { if(clone) { @@ -30,23 +40,6 @@ } -void CMoveFXSlotDialog::DoDataExchange(CDataExchange* pDX) -//-------------------------------------------------------- -{ - CDialog::DoDataExchange(pDX); - DDX_Control(pDX, IDC_COMBO1, m_CbnEmptySlots); - DDX_Control(pDX, IDC_EDIT1, m_EditPrompt); -} - - -void CMoveFXSlotDialog::OnOK() -//---------------------------- -{ - m_nToSlot = static_cast<PLUGINDEX>(m_CbnEmptySlots.GetItemData(m_CbnEmptySlots.GetCurSel())); - CDialog::OnOK(); -} - - BOOL CMoveFXSlotDialog::OnInitDialog() //------------------------------------ { @@ -67,7 +60,7 @@ for(size_t nSlot = 0; nSlot < m_EmptySlots.size(); nSlot++) { slotText.Format("FX%d", m_EmptySlots[nSlot] + 1); - m_CbnEmptySlots.SetItemData(m_CbnEmptySlots.AddString(slotText), m_EmptySlots[nSlot]); + m_CbnEmptySlots.SetItemData(m_CbnEmptySlots.AddString(slotText), nSlot); if(m_EmptySlots[nSlot] >= m_nDefaultSlot && !foundDefault) { defaultSlot = nSlot; @@ -76,5 +69,17 @@ } m_CbnEmptySlots.SetCurSel(defaultSlot); + GetDlgItem(IDC_CHECK1)->EnableWindow(moveChain ? TRUE : FALSE); + CheckDlgButton(IDC_CHECK1, moveChain ? BST_CHECKED : BST_UNCHECKED); + return TRUE; } + + +void CMoveFXSlotDialog::OnOK() +//---------------------------- +{ + m_nToSlot = m_CbnEmptySlots.GetItemData(m_CbnEmptySlots.GetCurSel()); + moveChain = IsDlgButtonChecked(IDC_CHECK1) != BST_UNCHECKED; + CDialog::OnOK(); +} \ No newline at end of file Modified: trunk/OpenMPT/mptrack/MoveFXSlotDialog.h =================================================================== --- trunk/OpenMPT/mptrack/MoveFXSlotDialog.h 2014-02-22 23:47:25 UTC (rev 3755) +++ trunk/OpenMPT/mptrack/MoveFXSlotDialog.h 2014-02-23 01:11:19 UTC (rev 3756) @@ -16,15 +16,19 @@ const std::vector<PLUGINDEX> &m_EmptySlots; CString m_csPrompt, m_csTitle; CEdit m_EditPrompt; - PLUGINDEX m_nDefaultSlot, m_nToSlot; + size_t m_nToSlot; + PLUGINDEX m_nDefaultSlot; + bool moveChain; CComboBox m_CbnEmptySlots; enum { IDD = IDD_MOVEFXSLOT }; public: - CMoveFXSlotDialog(CWnd *pParent, PLUGINDEX currentSlot, const std::vector<PLUGINDEX> &emptySlots, PLUGINDEX defaultIndex, bool clone); - PLUGINDEX GetSlot() const { return m_nToSlot; } + CMoveFXSlotDialog(CWnd *pParent, PLUGINDEX currentSlot, const std::vector<PLUGINDEX> &emptySlots, PLUGINDEX defaultIndex, bool clone, bool hasChain); + PLUGINDEX GetSlot() const { return m_EmptySlots[m_nToSlot]; } + size_t GetSlotIndex() const { return m_nToSlot; } + bool DoMoveChain() const { return moveChain; } protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support Modified: trunk/OpenMPT/mptrack/View_gen.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_gen.cpp 2014-02-22 23:47:25 UTC (rev 3755) +++ trunk/OpenMPT/mptrack/View_gen.cpp 2014-02-23 01:11:19 UTC (rev 3756) @@ -1169,28 +1169,49 @@ void CViewGlobals::OnMovePlugToSlot() //----------------------------------- { + if(GetCurrentPlugin() == nullptr) + { + return; + } + // If any plugin routes its output to the current plugin, we shouldn't try to move it before that plugin... PLUGINDEX defaultIndex = 0; - const CSoundFile *pSndFile = GetDocument() ? (GetDocument()->GetSoundFile()) : nullptr; - if(pSndFile) + CSoundFile &sndFile = GetDocument()->GetrSoundFile(); + for(PLUGINDEX i = 0; i < m_nCurrentPlugin; i++) { - for(PLUGINDEX i = 0; i < m_nCurrentPlugin; i++) + if(sndFile.m_MixPlugins[i].GetOutputPlugin() == m_nCurrentPlugin) { - if(pSndFile->m_MixPlugins[i].GetOutputPlugin() == m_nCurrentPlugin) - { - defaultIndex = i + 1; - } + defaultIndex = i + 1; } } std::vector<PLUGINDEX> emptySlots; BuildEmptySlotList(emptySlots); - CMoveFXSlotDialog dlg(this, m_nCurrentPlugin, emptySlots, defaultIndex, false); + CMoveFXSlotDialog dlg(this, m_nCurrentPlugin, emptySlots, defaultIndex, false, !sndFile.m_MixPlugins[m_nCurrentPlugin].IsOutputToMaster()); if(dlg.DoModal() == IDOK) { - MovePlug(m_nCurrentPlugin, dlg.GetSlot()); + size_t toIndex = dlg.GetSlotIndex(); + do + { + const SNDMIXPLUGIN &curPlugin = sndFile.m_MixPlugins[m_nCurrentPlugin]; + SNDMIXPLUGIN &newPlugin = sndFile.m_MixPlugins[emptySlots[toIndex]]; + const PLUGINDEX nextPlugin = curPlugin.GetOutputPlugin(); + + MovePlug(m_nCurrentPlugin, emptySlots[toIndex]); + + if(nextPlugin == PLUGINDEX_INVALID || toIndex == emptySlots.size() - 1) + { + break; + } + + m_nCurrentPlugin = nextPlugin; + toIndex++; + + newPlugin.SetOutputPlugin(emptySlots[toIndex]); + } while(dlg.DoMoveChain()); + m_CbnPlugin.SetCurSel(dlg.GetSlot()); OnPluginChanged(); } @@ -1372,42 +1393,64 @@ } +static void ClonePlugin(const SNDMIXPLUGIN &curPlugin, SNDMIXPLUGIN &newPlugin) +//----------------------------------------------------------------------------- +{ + CVstPlugin *curVstPlug = static_cast<CVstPlugin *>(curPlugin.pMixPlugin); + newPlugin.Destroy(); + MemCopy(newPlugin.Info, curPlugin.Info); + if(theApp.GetPluginManager()->CreateMixPlugin(newPlugin, curVstPlug->GetSoundFile())) + { + CVstPlugin *newVstPlug = static_cast<CVstPlugin *>(newPlugin.pMixPlugin); + newVstPlug->SetCurrentProgram(curVstPlug->GetCurrentProgram()); + + std::ostringstream f(std::ios::out | std::ios::binary); + if(VSTPresets::SaveFile(f, *curVstPlug, false)) + { + const std::string data = f.str(); + FileReader file(data.c_str(), data.length()); + VSTPresets::LoadFile(file, *newVstPlug); + } + } +} + + void CViewGlobals::OnClonePlug() //------------------------------ { - if(GetCurrentPlugin() == nullptr || GetDocument() == nullptr) + if(GetCurrentPlugin() == nullptr) { - MessageBeep(MB_ICONEXCLAMATION); return; } + CSoundFile &sndFile = GetDocument()->GetrSoundFile(); + std::vector<PLUGINDEX> emptySlots; BuildEmptySlotList(emptySlots); - CMoveFXSlotDialog dlg(this, m_nCurrentPlugin, emptySlots, 0, true); + CMoveFXSlotDialog dlg(this, m_nCurrentPlugin, emptySlots, 0, true, !sndFile.m_MixPlugins[m_nCurrentPlugin].IsOutputToMaster()); if(dlg.DoModal() == IDOK) { - CSoundFile &sndFile = GetDocument()->GetrSoundFile(); - const SNDMIXPLUGIN &curPlugin = sndFile.m_MixPlugins[m_nCurrentPlugin]; - SNDMIXPLUGIN &newPlugin = sndFile.m_MixPlugins[dlg.GetSlot()]; - - newPlugin.Destroy(); - MemCopy(newPlugin.Info, curPlugin.Info); - if(theApp.GetPluginManager()->CreateMixPlugin(newPlugin, sndFile)) + size_t toIndex = dlg.GetSlotIndex(); + do { - CVstPlugin *vstPlug = static_cast<CVstPlugin *>(newPlugin.pMixPlugin); - vstPlug->SetCurrentProgram(GetCurrentPlugin()->GetCurrentProgram()); + const SNDMIXPLUGIN &curPlugin = sndFile.m_MixPlugins[m_nCurrentPlugin]; + SNDMIXPLUGIN &newPlugin = sndFile.m_MixPlugins[emptySlots[toIndex]]; - std::ostringstream f(std::ios::out | std::ios::binary); - if(VSTPresets::SaveFile(f, *GetCurrentPlugin(), false)) + ClonePlugin(curPlugin, newPlugin); + + if(curPlugin.IsOutputToMaster() || toIndex == emptySlots.size() - 1) { - const std::string data = f.str(); - FileReader file(data.c_str(), data.length()); - VSTPresets::LoadFile(file, *vstPlug); + break; } - } + m_nCurrentPlugin = curPlugin.GetOutputPlugin(); + toIndex++; + + newPlugin.SetOutputPlugin(emptySlots[toIndex]); + } while(dlg.DoMoveChain()); + m_CbnPlugin.SetCurSel(dlg.GetSlot()); OnPluginChanged(); } Modified: trunk/OpenMPT/mptrack/mptrack.rc =================================================================== --- trunk/OpenMPT/mptrack/mptrack.rc 2014-02-22 23:47:25 UTC (rev 3755) +++ trunk/OpenMPT/mptrack/mptrack.rc 2014-02-23 01:11:19 UTC (rev 3756) @@ -2572,15 +2572,16 @@ SCROLLBAR IDC_SCROLLBAR1,317,7,12,233,SBS_VERT | WS_DISABLED | WS_TABSTOP END -IDD_MOVEFXSLOT DIALOGEX 0, 0, 133, 78 +IDD_MOVEFXSLOT DIALOGEX 0, 0, 133, 87 STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Dialog" FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN - DEFPUSHBUTTON "OK",IDOK,76,59,50,14 - PUSHBUTTON "Cancel",IDCANCEL,7,59,50,14 - COMBOBOX IDC_COMBO1,42,38,48,172,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - EDITTEXT IDC_EDIT1,7,14,119,19,ES_CENTER | ES_MULTILINE | ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER + DEFPUSHBUTTON "OK",IDOK,78,66,50,14 + PUSHBUTTON "Cancel",IDCANCEL,6,66,50,14 + COMBOBOX IDC_COMBO1,42,30,48,172,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + EDITTEXT IDC_EDIT1,6,6,120,19,ES_CENTER | ES_MULTILINE | ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER + CONTROL "Move plugin chain if possible",IDC_CHECK1,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,48,120,12 END IDD_CONTROL_GRAPH DIALOGEX 0, 0, 424, 145 @@ -2672,7 +2673,7 @@ LEFTMARGIN, 7 RIGHTMARGIN, 126 TOPMARGIN, 7 - BOTTOMMARGIN, 73 + BOTTOMMARGIN, 82 END IDD_CONTROL_GRAPH, DIALOG This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <man...@us...> - 2014-02-23 11:40:03
|
Revision: 3757 http://sourceforge.net/p/modplug/code/3757 Author: manxorist Date: 2014-02-23 11:39:54 +0000 (Sun, 23 Feb 2014) Log Message: ----------- [Ref] Move IT and FLAC compression settings to TrackerSettings. [Ref] Remove a bunch of superflous includes of mptrack/ files in soundlib/. Modified Paths: -------------- trunk/OpenMPT/mptrack/TrackerSettings.cpp trunk/OpenMPT/mptrack/TrackerSettings.h trunk/OpenMPT/soundlib/ITCompression.cpp trunk/OpenMPT/soundlib/Load_imf.cpp trunk/OpenMPT/soundlib/Load_it.cpp trunk/OpenMPT/soundlib/Load_itp.cpp trunk/OpenMPT/soundlib/Load_mo3.cpp trunk/OpenMPT/soundlib/Load_mod.cpp trunk/OpenMPT/soundlib/Load_psm.cpp trunk/OpenMPT/soundlib/Load_s3m.cpp trunk/OpenMPT/soundlib/ModSequence.cpp trunk/OpenMPT/soundlib/SampleFormats.cpp trunk/OpenMPT/soundlib/patternContainer.cpp Modified: trunk/OpenMPT/mptrack/TrackerSettings.cpp =================================================================== --- trunk/OpenMPT/mptrack/TrackerSettings.cpp 2014-02-23 01:11:19 UTC (rev 3756) +++ trunk/OpenMPT/mptrack/TrackerSettings.cpp 2014-02-23 11:39:54 UTC (rev 3757) @@ -152,6 +152,8 @@ , defaultModType(conf, "Misc", "DefaultModType", MOD_TYPE_IT) , DefaultPlugVolumeHandling(conf, "Misc", "DefaultPlugVolumeHandling", PLUGIN_VOLUMEHANDLING_IGNORE) , autoApplySmoothFT2Ramping(conf, "Misc", "SmoothFT2Ramping", false) + , MiscITCompressionStereo(conf, "Misc", "ITCompressionStereo", false) + , MiscITCompressionMono(conf, "Misc", "ITCompressionMono", false) // Sound Settings , m_SoundSampleRates(conf, "Sound Settings", "SampleRates", GetDefaultSampleRates()) , m_MorePortaudio(conf, "Sound Settings", "MorePortaudio", false) @@ -195,6 +197,7 @@ // Sample Editor , m_SampleUndoMaxBufferMB(conf, "Sample Editor", "UndoBufferSize", GetDefaultUndoBufferSize() >> 20) , m_MayNormalizeSamplesOnLoad(conf, "Sample Editor", "MayNormalizeSamplesOnLoad", true) + , SampleEditorFLACCompressionLevel(conf, "Sample Editor", "FLACCompressionLevel", 5) // Export , ExportDefaultToSoundcardSamplerate(conf, "Export", "DefaultToSoundcardSamplerate", true) // Default template Modified: trunk/OpenMPT/mptrack/TrackerSettings.h =================================================================== --- trunk/OpenMPT/mptrack/TrackerSettings.h 2014-02-23 01:11:19 UTC (rev 3756) +++ trunk/OpenMPT/mptrack/TrackerSettings.h 2014-02-23 11:39:54 UTC (rev 3757) @@ -270,6 +270,8 @@ Setting<MODTYPE> defaultModType; Setting<PLUGVOLUMEHANDLING> DefaultPlugVolumeHandling; Setting<bool> autoApplySmoothFT2Ramping; + Setting<bool> MiscITCompressionStereo; + Setting<bool> MiscITCompressionMono; // Sound Settings @@ -341,6 +343,7 @@ Setting<uint32> m_SampleUndoMaxBufferMB; uint32 GetSampleUndoBufferSize() const { return m_SampleUndoMaxBufferMB << 20; } Setting<bool> m_MayNormalizeSamplesOnLoad; + Setting<int32> SampleEditorFLACCompressionLevel; // Custom compression level (0...8) // Export Modified: trunk/OpenMPT/soundlib/ITCompression.cpp =================================================================== --- trunk/OpenMPT/soundlib/ITCompression.cpp 2014-02-23 01:11:19 UTC (rev 3756) +++ trunk/OpenMPT/soundlib/ITCompression.cpp 2014-02-23 11:39:54 UTC (rev 3757) @@ -12,9 +12,6 @@ #include <stdafx.h> #include "ITCompression.h" #include "../common/misc_util.h" -#ifdef MODPLUG_TRACKER -#include "../mptrack/Reporting.h" -#endif // Algorithm parameters for 16-Bit samples struct IT16BitParams Modified: trunk/OpenMPT/soundlib/Load_imf.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_imf.cpp 2014-02-23 01:11:19 UTC (rev 3756) +++ trunk/OpenMPT/soundlib/Load_imf.cpp 2014-02-23 11:39:54 UTC (rev 3757) @@ -11,9 +11,6 @@ #include "stdafx.h" #include "Loaders.h" -#ifdef MODPLUG_TRACKER -#include "../mptrack/moddoc.h" -#endif // MODPLUG_TRACKER #ifdef NEEDS_PRAGMA_PACK #pragma pack(push, 1) Modified: trunk/OpenMPT/soundlib/Load_it.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_it.cpp 2014-02-23 01:11:19 UTC (rev 3756) +++ trunk/OpenMPT/soundlib/Load_it.cpp 2014-02-23 11:39:54 UTC (rev 3757) @@ -14,6 +14,7 @@ #include "tuningcollection.h" #ifdef MODPLUG_TRACKER #include "../mptrack/moddoc.h" +#include "../mptrack/TrackerSettings.h" #endif #include "../common/serialization_utils.h" #include "../common/mptFstream.h" @@ -1110,10 +1111,6 @@ } -#ifdef MODPLUG_TRACKER -#include "../mptrack/Mptrack.h" // For config filename -#endif // MODPLUG_TRACKER - bool CSoundFile::SaveIT(const mpt::PathString &filename, bool compatibilityExport) //-------------------------------------------------------------------------------- { @@ -1567,7 +1564,7 @@ #ifdef MODPLUG_TRACKER int type = GetType() == MOD_TYPE_IT ? 1 : 4; if(compatibilityExport) type = 2; - bool compress = (theApp.GetSettings().Read<int32>("Misc", Samples[nsmp].GetNumChannels() > 1 ? "ITCompressionStereo" : "ITCompressionMono", 0) & type) != 0; + bool compress = (Samples[nsmp].GetNumChannels() > 1) ? TrackerSettings::Instance().MiscITCompressionStereo : TrackerSettings::Instance().MiscITCompressionMono; #else bool compress = false; #endif // MODPLUG_TRACKER Modified: trunk/OpenMPT/soundlib/Load_itp.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_itp.cpp 2014-02-23 01:11:19 UTC (rev 3756) +++ trunk/OpenMPT/soundlib/Load_itp.cpp 2014-02-23 11:39:54 UTC (rev 3757) @@ -19,7 +19,6 @@ #include "Loaders.h" #include "ITTools.h" #ifdef MODPLUG_TRACKER -#include "../mptrack/mptrack.h" #include "../mptrack/TrackerSettings.h" #include "../mptrack/MemoryMappedFile.h" #include "../mptrack/Moddoc.h" Modified: trunk/OpenMPT/soundlib/Load_mo3.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_mo3.cpp 2014-02-23 01:11:19 UTC (rev 3756) +++ trunk/OpenMPT/soundlib/Load_mo3.cpp 2014-02-23 11:39:54 UTC (rev 3757) @@ -11,7 +11,6 @@ #include "stdafx.h" #include "Loaders.h" #ifdef MODPLUG_TRACKER -#include "../mptrack/moddoc.h" #include "../mptrack/Mptrack.h" #endif // MODPLUG_TRACKER Modified: trunk/OpenMPT/soundlib/Load_mod.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_mod.cpp 2014-02-23 01:11:19 UTC (rev 3756) +++ trunk/OpenMPT/soundlib/Load_mod.cpp 2014-02-23 11:39:54 UTC (rev 3757) @@ -1091,10 +1091,6 @@ #ifndef MODPLUG_NO_FILESAVE -#ifdef MODPLUG_TRACKER -#include "../mptrack/moddoc.h" -#endif // MODPLUG_TRACKER - bool CSoundFile::SaveMod(const mpt::PathString &filename) const //------------------------------------------------------------- { Modified: trunk/OpenMPT/soundlib/Load_psm.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_psm.cpp 2014-02-23 01:11:19 UTC (rev 3756) +++ trunk/OpenMPT/soundlib/Load_psm.cpp 2014-02-23 11:39:54 UTC (rev 3757) @@ -23,9 +23,6 @@ #include "stdafx.h" #include "Loaders.h" #include "ChunkReader.h" -#ifdef MODPLUG_TRACKER -#include "../mptrack/moddoc.h" -#endif // MODPLUG_TRACKER #ifdef NEEDS_PRAGMA_PACK #pragma pack(push, 1) Modified: trunk/OpenMPT/soundlib/Load_s3m.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_s3m.cpp 2014-02-23 01:11:19 UTC (rev 3756) +++ trunk/OpenMPT/soundlib/Load_s3m.cpp 2014-02-23 11:39:54 UTC (rev 3757) @@ -12,9 +12,6 @@ #include "Loaders.h" #include "S3MTools.h" #include "../common/version.h" -#ifdef MODPLUG_TRACKER -#include "../mptrack/moddoc.h" // Logging -#endif // MODPLUG_TRACKER void CSoundFile::S3MConvert(ModCommand &m, bool fromIT) const Modified: trunk/OpenMPT/soundlib/ModSequence.cpp =================================================================== --- trunk/OpenMPT/soundlib/ModSequence.cpp 2014-02-23 01:11:19 UTC (rev 3756) +++ trunk/OpenMPT/soundlib/ModSequence.cpp 2014-02-23 11:39:54 UTC (rev 3757) @@ -12,7 +12,6 @@ #include "Sndfile.h" #include "ModSequence.h" #ifdef MODPLUG_TRACKER -#include "../mptrack/moddoc.h" #include "../mptrack/Reporting.h" #endif // MODPLUG_TRACKER #include "../common/version.h" Modified: trunk/OpenMPT/soundlib/SampleFormats.cpp =================================================================== --- trunk/OpenMPT/soundlib/SampleFormats.cpp 2014-02-23 01:11:19 UTC (rev 3756) +++ trunk/OpenMPT/soundlib/SampleFormats.cpp 2014-02-23 11:39:54 UTC (rev 3757) @@ -12,9 +12,10 @@ #include "stdafx.h" #include "Sndfile.h" #ifdef MODPLUG_TRACKER +#include "../mptrack/Mptrack.h" #include "../mptrack/Moddoc.h" -#include "../mptrack/Mainfrm.h" // For ini settings #include "../mptrack/Reporting.h" +#include "../mptrack/TrackerSettings.h" #endif //MODPLUG_TRACKER #include "../common/AudioCriticalSection.h" #include "Wav.h" @@ -2192,9 +2193,7 @@ FLAC__stream_encoder_set_total_samples_estimate(encoder, sample.nLength); FLAC__stream_encoder_set_metadata(encoder, metadata, writeLoopData ? 3 : 2); #ifdef MODPLUG_TRACKER - // Custom compression level (0...8) - static const int compression = theApp.GetSettings().Read<int32>("Sample Editor", "FLACCompressionLevel", 5); - FLAC__stream_encoder_set_compression_level(encoder, compression); + FLAC__stream_encoder_set_compression_level(encoder, TrackerSettings::Instance().SampleEditorFLACCompressionLevel); #endif // MODPLUG_TRACKER encoder.f = mpt_fopen(filename, "wb"); Modified: trunk/OpenMPT/soundlib/patternContainer.cpp =================================================================== --- trunk/OpenMPT/soundlib/patternContainer.cpp 2014-02-23 01:11:19 UTC (rev 3756) +++ trunk/OpenMPT/soundlib/patternContainer.cpp 2014-02-23 11:39:54 UTC (rev 3757) @@ -11,9 +11,6 @@ #include "stdafx.h" #include "patternContainer.h" #include "Sndfile.h" -#ifdef MODPLUG_TRACKER -#include "../mptrack/mainfrm.h" -#endif #include "../common/serialization_utils.h" #include "../common/version.h" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <man...@us...> - 2014-02-23 13:03:43
|
Revision: 3758 http://sourceforge.net/p/modplug/code/3758 Author: manxorist Date: 2014-02-23 13:03:33 +0000 (Sun, 23 Feb 2014) Log Message: ----------- [Ref] Move UI code from CSoundFile::DestroyInstrument into CModDoc::RemoveInstrument . Modified Paths: -------------- trunk/OpenMPT/mptrack/Modedit.cpp trunk/OpenMPT/soundlib/SampleFormats.cpp trunk/OpenMPT/soundlib/Sndfile.h Modified: trunk/OpenMPT/mptrack/Modedit.cpp =================================================================== --- trunk/OpenMPT/mptrack/Modedit.cpp 2014-02-23 11:39:54 UTC (rev 3757) +++ trunk/OpenMPT/mptrack/Modedit.cpp 2014-02-23 13:03:33 UTC (rev 3758) @@ -815,9 +815,13 @@ if ((nIns) && (nIns <= m_SndFile.GetNumInstruments()) && (m_SndFile.Instruments[nIns])) { bool instrumentsLeft = false; - - if(m_SndFile.DestroyInstrument(nIns, askDeleteAssociatedSamples)) + ConfirmAnswer result = Reporting::Confirm("Remove samples associated with an instrument if they are unused?", "Removing instrument", true); + if(result == cnfCancel) { + return false; + } + if(m_SndFile.DestroyInstrument(nIns, (result == cnfYes) ? deleteAssociatedSamples : doNoDeleteAssociatedSamples)) + { CriticalSection cs; if (nIns == m_SndFile.m_nInstruments) m_SndFile.m_nInstruments--; for (UINT i=1; i<MAX_INSTRUMENTS; i++) if (m_SndFile.Instruments[i]) instrumentsLeft = true; Modified: trunk/OpenMPT/soundlib/SampleFormats.cpp =================================================================== --- trunk/OpenMPT/soundlib/SampleFormats.cpp 2014-02-23 11:39:54 UTC (rev 3757) +++ trunk/OpenMPT/soundlib/SampleFormats.cpp 2014-02-23 13:03:33 UTC (rev 3758) @@ -14,7 +14,6 @@ #ifdef MODPLUG_TRACKER #include "../mptrack/Mptrack.h" #include "../mptrack/Moddoc.h" -#include "../mptrack/Reporting.h" #include "../mptrack/TrackerSettings.h" #endif //MODPLUG_TRACKER #include "../common/AudioCriticalSection.h" @@ -163,17 +162,6 @@ { if(nInstr == 0 || nInstr >= MAX_INSTRUMENTS || !Instruments[nInstr]) return true; -#ifdef MODPLUG_TRACKER - if(removeSamples == askDeleteAssociatedSamples) - { - ConfirmAnswer result = Reporting::Confirm("Remove samples associated with an instrument if they are unused?", "Removing instrument", true); - if(result == cnfCancel) - { - return false; - } - removeSamples = (result == cnfYes) ? deleteAssociatedSamples : doNoDeleteAssociatedSamples; - } -#endif // MODPLUG_TRACKER if(removeSamples == deleteAssociatedSamples) { RemoveInstrumentSamples(nInstr); Modified: trunk/OpenMPT/soundlib/Sndfile.h =================================================================== --- trunk/OpenMPT/soundlib/Sndfile.h 2014-02-23 11:39:54 UTC (rev 3757) +++ trunk/OpenMPT/soundlib/Sndfile.h 2014-02-23 13:03:33 UTC (rev 3758) @@ -171,9 +171,6 @@ { deleteAssociatedSamples, doNoDeleteAssociatedSamples, -#ifdef MODPLUG_TRACKER - askDeleteAssociatedSamples, -#endif // MODPLUG_TRACKER }; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <man...@us...> - 2014-02-23 17:52:41
|
Revision: 3761 http://sourceforge.net/p/modplug/code/3761 Author: manxorist Date: 2014-02-23 17:52:33 +0000 (Sun, 23 Feb 2014) Log Message: ----------- [Ref] Flatten header dependencies of the headers that get included via stdafx.h . [Ref] Update comments about which headers get included via our headers in stdafx.h . [Ref] Move logging functions from typedefs.h into Logging.h . [Ref] Always include trivially short header Logging.h in stdafx.h . [Ref] Avoid always dragging in non-standard header strings.h in GCC/Clang builds by un-inlining mpt::strnicmp . Modified Paths: -------------- trunk/OpenMPT/common/Logging.h trunk/OpenMPT/common/mptPathString.h trunk/OpenMPT/common/mptString.cpp trunk/OpenMPT/common/mptString.h trunk/OpenMPT/common/stdafx.h trunk/OpenMPT/common/typedefs.h trunk/OpenMPT/mptrack/Moddoc.h trunk/OpenMPT/soundlib/Sndfile.h Modified: trunk/OpenMPT/common/Logging.h =================================================================== --- trunk/OpenMPT/common/Logging.h 2014-02-23 15:54:25 UTC (rev 3760) +++ trunk/OpenMPT/common/Logging.h 2014-02-23 17:52:33 UTC (rev 3761) @@ -40,3 +40,38 @@ virtual void AddToLog(LogLevel level, const std::string &text) const = 0; }; + +#ifndef NO_LOGGING +void MPT_PRINTF_FUNC(1,2) Log(const char *format, ...); +void Log(const std::string &text); +void Log(const std::wstring &text); +class Logger +{ +private: + const char * const file; + int const line; + const char * const function; +public: + Logger(const char *file_, int line_, const char *function_) : file(file_), line(line_), function(function_) {} + void MPT_PRINTF_FUNC(2,3) operator () (const char *format, ...); + void operator () (const std::string &text); + void operator () (const std::wstring &text); +}; +#define Log Logger(__FILE__, __LINE__, __FUNCTION__) +#else // !NO_LOGGING +static inline void MPT_PRINTF_FUNC(1,2) Log(const char * /*format*/, ...) {} +static inline void Log(const std::string & /*text*/ ) {} +static inline void Log(const std::wstring & /*text*/ ) {} +class Logger +{ +public: + inline void MPT_PRINTF_FUNC(2,3) operator () (const char * /*format*/, ...) {} + inline void operator () (const std::string & /*text*/ ) {} + inline void operator () (const std::wstring & /*text*/ ) {} +}; +#define Log if(true) {} else Logger() // completely compile out arguments to Log() so that they do not even get evaluated +#endif // NO_LOGGING + +// just #undef Log in files, where this Log redefinition causes problems +//#undef Log + Modified: trunk/OpenMPT/common/mptPathString.h =================================================================== --- trunk/OpenMPT/common/mptPathString.h 2014-02-23 15:54:25 UTC (rev 3760) +++ trunk/OpenMPT/common/mptPathString.h 2014-02-23 17:52:33 UTC (rev 3761) @@ -10,6 +10,9 @@ #pragma once +#include <cstdio> +#include <stdio.h> + //#define MPT_DEPRECATED_PATH #define MPT_DEPRECATED_PATH MPT_DEPRECATED Modified: trunk/OpenMPT/common/mptString.cpp =================================================================== --- trunk/OpenMPT/common/mptString.cpp 2014-02-23 15:54:25 UTC (rev 3760) +++ trunk/OpenMPT/common/mptString.cpp 2014-02-23 17:52:33 UTC (rev 3761) @@ -25,11 +25,32 @@ #include <cstdarg> +#if MPT_COMPILER_GCC || MPT_COMPILER_CLANG +#include <strings.h> // for strncasecmp +#endif + #if !defined(MPT_CHARSET_CPP) && !defined(MPT_CHARSET_CUSTOMUTF8) && !defined(WIN32) #include <iconv.h> #endif // !WIN32 +namespace mpt { + + +int strnicmp(const char *a, const char *b, size_t count) +//------------------------------------------------------ +{ +#if MPT_COMPILER_MSVC + return _strnicmp(a, b, count); +#else + return strncasecmp(a, b, count); +#endif +} + + +} // namespace mpt + + namespace mpt { namespace String { Modified: trunk/OpenMPT/common/mptString.h =================================================================== --- trunk/OpenMPT/common/mptString.h 2014-02-23 15:54:25 UTC (rev 3760) +++ trunk/OpenMPT/common/mptString.h 2014-02-23 17:52:33 UTC (rev 3761) @@ -16,12 +16,7 @@ #include <type_traits> #endif -#include <cstdio> #include <cstring> -#include <stdio.h> -#if MPT_COMPILER_GCC || MPT_COMPILER_CLANG -#include <strings.h> // for strcasecmp -#endif namespace mpt @@ -161,15 +156,7 @@ } -static inline int strnicmp(const char *a, const char *b, size_t count) -//-------------------------------------------------------------------- -{ - #if MPT_COMPILER_MSVC - return _strnicmp(a, b, count); - #else - return strncasecmp(a, b, count); - #endif -} +int strnicmp(const char *a, const char *b, size_t count); enum Charset { Modified: trunk/OpenMPT/common/stdafx.h =================================================================== --- trunk/OpenMPT/common/stdafx.h 2014-02-23 15:54:25 UTC (rev 3760) +++ trunk/OpenMPT/common/stdafx.h 2014-02-23 17:52:33 UTC (rev 3761) @@ -60,19 +60,26 @@ #endif // this will be available everywhere + #include "../common/typedefs.h" -// this adds: // <memory> // <new> -// <string> -// <vector> // <cstdarg> // <cstdint> +// <stdint.h> + +#include "../common/mptString.h" +// <limits> +// <string> +// <type_traits> +// <cstring> + +#include "../common/mptPathString.h" // <cstdio> // <stdio.h> -#include "../common/mptString.h" -#include "../common/mptPathString.h" +#include "../common/Logging.h" + //{{AFX_INSERT_LOCATION}} // Microsoft Developer Studio will insert additional declarations immediately before the previous line. Modified: trunk/OpenMPT/common/typedefs.h =================================================================== --- trunk/OpenMPT/common/typedefs.h 2014-02-23 15:54:25 UTC (rev 3760) +++ trunk/OpenMPT/common/typedefs.h 2014-02-23 17:52:33 UTC (rev 3761) @@ -432,8 +432,6 @@ #define MPT_PRINTF_FUNC(formatstringindex,varargsindex) #endif -#include "../common/mptString.h" - //To mark string that should be translated in case of multilingual version. #define GetStrI18N(x) (x) @@ -458,42 +456,6 @@ -#ifndef NO_LOGGING -void MPT_PRINTF_FUNC(1,2) Log(const char *format, ...); -void Log(const std::string &text); -void Log(const std::wstring &text); -class Logger -{ -private: - const char * const file; - int const line; - const char * const function; -public: - Logger(const char *file_, int line_, const char *function_) : file(file_), line(line_), function(function_) {} - void MPT_PRINTF_FUNC(2,3) operator () (const char *format, ...); - void operator () (const std::string &text); - void operator () (const std::wstring &text); -}; -#define Log Logger(__FILE__, __LINE__, __FUNCTION__) -#else // !NO_LOGGING -static inline void MPT_PRINTF_FUNC(1,2) Log(const char * /*format*/, ...) {} -static inline void Log(const std::string & /*text*/ ) {} -static inline void Log(const std::wstring & /*text*/ ) {} -class Logger -{ -public: - inline void MPT_PRINTF_FUNC(2,3) operator () (const char * /*format*/, ...) {} - inline void operator () (const std::string & /*text*/ ) {} - inline void operator () (const std::wstring & /*text*/ ) {} -}; -#define Log if(true) {} else Logger() // completely compile out arguments to Log() so that they do not even get evaluated -#endif // NO_LOGGING - -// just #undef Log in files, where this Log redefinition causes problems -//#undef Log - - - #if MPT_COMPILER_MSVC && defined(UNREFERENCED_PARAMETER) #define MPT_UNREFERENCED_PARAMETER(x) UNREFERENCED_PARAMETER(x) #else Modified: trunk/OpenMPT/mptrack/Moddoc.h =================================================================== --- trunk/OpenMPT/mptrack/Moddoc.h 2014-02-23 15:54:25 UTC (rev 3760) +++ trunk/OpenMPT/mptrack/Moddoc.h 2014-02-23 17:52:33 UTC (rev 3761) @@ -14,7 +14,6 @@ #include "../common/misc_util.h" #include "Undo.h" #include "Notification.h" -#include "../common/Logging.h" #include <time.h> class EncoderFactoryBase; Modified: trunk/OpenMPT/soundlib/Sndfile.h =================================================================== --- trunk/OpenMPT/soundlib/Sndfile.h 2014-02-23 15:54:25 UTC (rev 3760) +++ trunk/OpenMPT/soundlib/Sndfile.h 2014-02-23 17:52:33 UTC (rev 3761) @@ -14,7 +14,6 @@ #include "../soundlib/SoundFilePlayConfig.h" #include "../soundlib/MixerSettings.h" #include "../common/misc_util.h" -#include "../common/Logging.h" #include "mod_specifications.h" #include <vector> #include <bitset> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <man...@us...> - 2014-02-23 19:53:11
|
Revision: 3763 http://sourceforge.net/p/modplug/code/3763 Author: manxorist Date: 2014-02-23 19:53:03 +0000 (Sun, 23 Feb 2014) Log Message: ----------- [Ref] Add -Wmissing-prototypes for clang builds and fix all resulting warnings. Modified Paths: -------------- trunk/OpenMPT/Makefile trunk/OpenMPT/build/make/Makefile.config.clang trunk/OpenMPT/common/serialization_utils.cpp trunk/OpenMPT/common/serialization_utils.h trunk/OpenMPT/openmpt123/openmpt123.cpp trunk/OpenMPT/soundlib/Load_amf.cpp trunk/OpenMPT/soundlib/Load_dmf.cpp trunk/OpenMPT/soundlib/Load_it.cpp trunk/OpenMPT/soundlib/Load_mdl.cpp trunk/OpenMPT/soundlib/Load_okt.cpp trunk/OpenMPT/soundlib/Load_psm.cpp trunk/OpenMPT/soundlib/Load_xm.cpp trunk/OpenMPT/soundlib/MixerLoops.cpp trunk/OpenMPT/soundlib/MixerLoops.h trunk/OpenMPT/soundlib/SampleFormats.cpp trunk/OpenMPT/soundlib/SampleIO.cpp trunk/OpenMPT/soundlib/Sndfile.cpp trunk/OpenMPT/soundlib/Sndfile.h trunk/OpenMPT/soundlib/load_j2b.cpp trunk/OpenMPT/soundlib/tuningcollection.h trunk/OpenMPT/test/test.cpp Modified: trunk/OpenMPT/Makefile =================================================================== --- trunk/OpenMPT/Makefile 2014-02-23 18:49:17 UTC (rev 3762) +++ trunk/OpenMPT/Makefile 2014-02-23 19:53:03 UTC (rev 3763) @@ -229,8 +229,8 @@ endif endif -CXXFLAGS += -Wall -Wextra -Wcast-align -CFLAGS += -Wall -Wextra -Wcast-align +CXXFLAGS += -Wall -Wextra -Wcast-align $(CXXFLAGS_WARNINGS) +CFLAGS += -Wall -Wextra -Wcast-align $(CFLAGS_WARNINGS) ifeq ($(DYNLINK),1) LDFLAGS_RPATH += -Wl,-rpath,./bin Modified: trunk/OpenMPT/build/make/Makefile.config.clang =================================================================== --- trunk/OpenMPT/build/make/Makefile.config.clang 2014-02-23 18:49:17 UTC (rev 3762) +++ trunk/OpenMPT/build/make/Makefile.config.clang 2014-02-23 19:53:03 UTC (rev 3763) @@ -12,4 +12,7 @@ LDLIBS += -lm ARFLAGS := rcs +CXXFLAGS_WARNINGS += -Wmissing-prototypes +CFLAGS_WARNINGS += -Wmissing-prototypes + EXESUFFIX= Modified: trunk/OpenMPT/common/serialization_utils.cpp =================================================================== --- trunk/OpenMPT/common/serialization_utils.cpp 2014-02-23 18:49:17 UTC (rev 3762) +++ trunk/OpenMPT/common/serialization_utils.cpp 2014-02-23 19:53:03 UTC (rev 3763) @@ -20,18 +20,18 @@ static const uint8 HeaderId_FlagByte = 0; // Indexing starts from 0. -inline bool Testbit(uint8 val, uint8 bitindex) {return ((val & (1 << bitindex)) != 0);} +static inline bool Testbit(uint8 val, uint8 bitindex) {return ((val & (1 << bitindex)) != 0);} -inline void Setbit(uint8& val, uint8 bitindex, bool newval) -//---------------------------------------------------------- +static inline void Setbit(uint8& val, uint8 bitindex, bool newval) +//---------------------------------------------------------------- { if(newval) val |= (1 << bitindex); else val &= ~(1 << bitindex); } -bool IsPrintableId(const char* pId, const size_t nLength) -//-------------------------------------------------------- +static bool IsPrintableId(const char* pId, const size_t nLength) +//-------------------------------------------------------------- { for(size_t i = 0; i < nLength; i++) { @@ -42,8 +42,8 @@ } -uint8 GetByteReq1248(const uint64 size) -//------------------------------------- +static uint8 GetByteReq1248(const uint64 size) +//-------------------------------------------- { if((size >> 6) == 0) return 1; if((size >> (1*8+6)) == 0) return 2; @@ -52,8 +52,8 @@ } -uint8 GetByteReq1234(const uint32 num) -//------------------------------------ +static uint8 GetByteReq1234(const uint32 num) +//------------------------------------------- { if((num >> 6) == 0) return 1; if((num >> (1*8+6)) == 0) return 2; @@ -63,7 +63,7 @@ void WriteAdaptive12(std::ostream& oStrm, const uint16 num) -//------------------------------------------------------ +//--------------------------------------------------------- { if(num >> 7 == 0) Binarywrite<uint16>(oStrm, num << 1, 1); @@ -73,7 +73,7 @@ void WriteAdaptive1234(std::ostream& oStrm, const uint32 num) -//-------------------------------------------------------- +//----------------------------------------------------------- { const uint8 bc = GetByteReq1234(num); const uint32 sizeInstruction = (num << 2) | (bc - 1); @@ -82,8 +82,8 @@ //Format: First bit tells whether the size indicator is 1 or 2 bytes. -void WriteAdaptive12String(std::ostream& oStrm, const std::string& str) -//------------------------------------------------------------------ +static void WriteAdaptive12String(std::ostream& oStrm, const std::string& str) +//---------------------------------------------------------------------------- { uint16 s = static_cast<uint16>(str.size()); LimitMax(s, uint16(uint16_max / 2)); @@ -93,8 +93,8 @@ // Works only for arguments 1,2,4,8 -uint8 Log2(const uint8& val) -//-------------------------- +static uint8 Log2(const uint8& val) +//--------------------------------- { if(val == 1) return 0; else if(val == 2) return 1; @@ -102,8 +102,9 @@ else return 3; } + void WriteAdaptive1248(std::ostream& oStrm, const uint64& num) -//--------------------------------------------------------- +//------------------------------------------------------------ { const uint8 bc = GetByteReq1248(num); const uint64 sizeInstruction = (num << 2) | Log2(bc); @@ -112,7 +113,7 @@ void ReadAdaptive12(std::istream& iStrm, uint16& val) -//----------------------------------------------- +//--------------------------------------------------- { Binaryread<uint16>(iStrm, val, 1); if(val & 1) @@ -127,7 +128,7 @@ void ReadAdaptive1234(std::istream& iStrm, uint32& val) -//------------------------------------------------- +//----------------------------------------------------- { Binaryread<uint32>(iStrm, val, 1); const uint8 bc = 1 + static_cast<uint8>(val & 3); @@ -142,13 +143,15 @@ val >>= 2; } -const uint8 pow2xTable[] = {1, 2, 4, 8, 16, 32, 64, 128}; +static const uint8 pow2xTable[] = {1, 2, 4, 8, 16, 32, 64, 128}; + // Returns 2^n. n must be within {0,...,7}. -inline uint8 Pow2xSmall(const uint8& exp) {ASSERT(exp <= 7); return pow2xTable[exp];} +static inline uint8 Pow2xSmall(const uint8& exp) {ASSERT(exp <= 7); return pow2xTable[exp];} + void ReadAdaptive1248(std::istream& iStrm, uint64& val) -//------------------------------------------------- +//----------------------------------------------------- { Binaryread<uint64>(iStrm, val, 1); uint8 bc = Pow2xSmall(static_cast<uint8>(val & 3)); @@ -212,8 +215,8 @@ } -std::string IdToString(const char* const pvId, const size_t nLength) -//------------------------------------------------------------- +static std::string IdToString(const char* const pvId, const size_t nLength) +//------------------------------------------------------------------------- { const char* pId = static_cast<const char*>(pvId); if (nLength == 0) Modified: trunk/OpenMPT/common/serialization_utils.h =================================================================== --- trunk/OpenMPT/common/serialization_utils.h 2014-02-23 18:49:17 UTC (rev 3762) +++ trunk/OpenMPT/common/serialization_utils.h 2014-02-23 19:53:03 UTC (rev 3763) @@ -67,10 +67,16 @@ SNW_INSUFFICIENT_DATASIZETYPE = (0x16) | SNT_FAILURE }; -bool IsPrintableId(const char* pvId, const size_t nLength); // Return true if given id is printable, false otherwise. + +void ReadAdaptive12(std::istream& iStrm, uint16& val); +void ReadAdaptive1234(std::istream& iStrm, uint32& val); void ReadAdaptive1248(std::istream& iStrm, uint64& val); + +void WriteAdaptive12(std::ostream& oStrm, const uint16 num); +void WriteAdaptive1234(std::ostream& oStrm, const uint32 num); void WriteAdaptive1248(std::ostream& oStrm, const uint64& val); + enum { IdSizeVariable = uint16_max, Modified: trunk/OpenMPT/openmpt123/openmpt123.cpp =================================================================== --- trunk/OpenMPT/openmpt123/openmpt123.cpp 2014-02-23 18:49:17 UTC (rev 3762) +++ trunk/OpenMPT/openmpt123/openmpt123.cpp 2014-02-23 19:53:03 UTC (rev 3763) @@ -209,7 +209,7 @@ } }; -std::ostream & operator << ( std::ostream & s, const commandlineflags & flags ) { +static std::ostream & operator << ( std::ostream & s, const commandlineflags & flags ) { s << "Quiet: " << flags.quiet << std::endl; s << "Verbose: " << flags.verbose << std::endl; s << "Mode : " << mode_to_string( flags.mode ) << std::endl; Modified: trunk/OpenMPT/soundlib/Load_amf.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_amf.cpp 2014-02-23 18:49:17 UTC (rev 3762) +++ trunk/OpenMPT/soundlib/Load_amf.cpp 2014-02-23 19:53:03 UTC (rev 3763) @@ -190,8 +190,8 @@ // Read a single AMF track (channel) into a pattern. -void AMFReadPattern(CPattern &pattern, CHANNELINDEX chn, FileReader &fileChunk) -//----------------------------------------------------------------------------- +static void AMFReadPattern(CPattern &pattern, CHANNELINDEX chn, FileReader &fileChunk) +//------------------------------------------------------------------------------------ { fileChunk.Rewind(); ModCommand::INSTR lastInstr = 0; Modified: trunk/OpenMPT/soundlib/Load_dmf.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_dmf.cpp 2014-02-23 18:49:17 UTC (rev 3762) +++ trunk/OpenMPT/soundlib/Load_dmf.cpp 2014-02-23 19:53:03 UTC (rev 3763) @@ -1123,8 +1123,8 @@ // DMF Huffman ReadBits -BYTE DMFReadBits(DMFHTree *tree, uint32 nbits) -//-------------------------------------------- +static BYTE DMFReadBits(DMFHTree *tree, uint32 nbits) +//--------------------------------------------------- { uint8 x = 0, bitv = 1; while(nbits--) @@ -1148,8 +1148,8 @@ // tree: [8-bit value][12-bit index][12-bit index] = 32-bit // -void DMFNewNode(DMFHTree *tree) -//----------------------------- +static void DMFNewNode(DMFHTree *tree) +//------------------------------------ { uint8 isleft, isright; int actnode; Modified: trunk/OpenMPT/soundlib/Load_it.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_it.cpp 2014-02-23 18:49:17 UTC (rev 3762) +++ trunk/OpenMPT/soundlib/Load_it.cpp 2014-02-23 19:53:03 UTC (rev 3763) @@ -1052,8 +1052,8 @@ #ifndef MODPLUG_NO_FILESAVE // Save edit history. Pass a null pointer for *f to retrieve the number of bytes that would be written. -uint32 SaveITEditHistory(const CSoundFile *pSndFile, FILE *f) -//----------------------------------------------------------- +static uint32 SaveITEditHistory(const CSoundFile *pSndFile, FILE *f) +//------------------------------------------------------------------ { size_t num = pSndFile->GetFileHistory().size(); #ifdef MODPLUG_TRACKER Modified: trunk/OpenMPT/soundlib/Load_mdl.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_mdl.cpp 2014-02-23 18:49:17 UTC (rev 3762) +++ trunk/OpenMPT/soundlib/Load_mdl.cpp 2014-02-23 19:53:03 UTC (rev 3763) @@ -101,8 +101,8 @@ #endif -void ConvertMDLCommand(ModCommand *m, UINT eff, UINT data) -//-------------------------------------------------------- +static void ConvertMDLCommand(ModCommand *m, UINT eff, UINT data) +//--------------------------------------------------------------- { UINT command = 0, param = data; switch(eff) @@ -178,8 +178,8 @@ // Convert MDL envelope data (env points and flags) -void ConvertMDLEnvelope(const unsigned char *pMDLEnv, InstrumentEnvelope *pMPTEnv) -//-------------------------------------------------------------------------------- +static void ConvertMDLEnvelope(const unsigned char *pMDLEnv, InstrumentEnvelope *pMPTEnv) +//--------------------------------------------------------------------------------------- { WORD nCurTick = 1; pMPTEnv->nNodes = 15; @@ -202,8 +202,8 @@ } -void UnpackMDLTrack(ModCommand *pat, UINT nChannels, UINT nRows, UINT nTrack, const BYTE *lpTracks) -//------------------------------------------------------------------------------------------------- +static void UnpackMDLTrack(ModCommand *pat, UINT nChannels, UINT nRows, UINT nTrack, const BYTE *lpTracks) +//-------------------------------------------------------------------------------------------------------- { ModCommand cmd, *m = pat; UINT len = *((WORD *)lpTracks); Modified: trunk/OpenMPT/soundlib/Load_okt.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_okt.cpp 2014-02-23 18:49:17 UTC (rev 3762) +++ trunk/OpenMPT/soundlib/Load_okt.cpp 2014-02-23 19:53:03 UTC (rev 3763) @@ -71,8 +71,8 @@ #endif // Parse the sample header block -void ReadOKTSamples(FileReader &chunk, std::vector<bool> &sample7bit, CSoundFile *pSndFile) -//----------------------------------------------------------------------------------------- +static void ReadOKTSamples(FileReader &chunk, std::vector<bool> &sample7bit, CSoundFile *pSndFile) +//------------------------------------------------------------------------------------------------ { pSndFile->m_nSamples = MIN((SAMPLEINDEX)(chunk.BytesLeft() / sizeof(OktSample)), MAX_SAMPLES - 1); // typically 36 sample7bit.resize(pSndFile->GetNumSamples()); @@ -112,8 +112,8 @@ // Parse a pattern block -void ReadOKTPattern(FileReader &chunk, PATTERNINDEX nPat, CSoundFile &sndFile) -//---------------------------------------------------------------------------- +static void ReadOKTPattern(FileReader &chunk, PATTERNINDEX nPat, CSoundFile &sndFile) +//----------------------------------------------------------------------------------- { if(!chunk.CanRead(2)) { Modified: trunk/OpenMPT/soundlib/Load_psm.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_psm.cpp 2014-02-23 18:49:17 UTC (rev 3762) +++ trunk/OpenMPT/soundlib/Load_psm.cpp 2014-02-23 19:53:03 UTC (rev 3763) @@ -241,8 +241,8 @@ // Portamento effect conversion (depending on format version) -uint8 ConvertPSMPorta(uint8 param, bool newFormat) -//------------------------------------------------ +static uint8 ConvertPSMPorta(uint8 param, bool newFormat) +//------------------------------------------------------- { return (newFormat ? param Modified: trunk/OpenMPT/soundlib/Load_xm.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_xm.cpp 2014-02-23 18:49:17 UTC (rev 3762) +++ trunk/OpenMPT/soundlib/Load_xm.cpp 2014-02-23 19:53:03 UTC (rev 3763) @@ -117,8 +117,8 @@ // Read .XM patterns -void ReadXMPatterns(FileReader &file, const XMFileHeader &fileHeader, CSoundFile &sndFile) -//---------------------------------------------------------------------------------------- +static void ReadXMPatterns(FileReader &file, const XMFileHeader &fileHeader, CSoundFile &sndFile) +//----------------------------------------------------------------------------------------------- { // Reading patterns sndFile.Patterns.ResizeArray(fileHeader.patterns); Modified: trunk/OpenMPT/soundlib/MixerLoops.cpp =================================================================== --- trunk/OpenMPT/soundlib/MixerLoops.cpp 2014-02-23 18:49:17 UTC (rev 3762) +++ trunk/OpenMPT/soundlib/MixerLoops.cpp 2014-02-23 19:53:03 UTC (rev 3763) @@ -17,6 +17,9 @@ #include "stdafx.h" + +#include "MixerLoops.h" + #include "Sndfile.h" Modified: trunk/OpenMPT/soundlib/MixerLoops.h =================================================================== --- trunk/OpenMPT/soundlib/MixerLoops.h 2014-02-23 18:49:17 UTC (rev 3762) +++ trunk/OpenMPT/soundlib/MixerLoops.h 2014-02-23 19:53:03 UTC (rev 3763) @@ -11,6 +11,9 @@ #pragma once +#include "Mixer.h" + + struct ModChannel; Modified: trunk/OpenMPT/soundlib/SampleFormats.cpp =================================================================== --- trunk/OpenMPT/soundlib/SampleFormats.cpp 2014-02-23 18:49:17 UTC (rev 3762) +++ trunk/OpenMPT/soundlib/SampleFormats.cpp 2014-02-23 19:53:03 UTC (rev 3763) @@ -334,8 +334,6 @@ //////////////////////////////////////////////////////////////////////////////// // WAV Open -extern bool IMAADPCMUnpack16(int16 *target, SmpLength sampleLen, FileReader file, uint16 blockAlign); - bool CSoundFile::ReadWAVSample(SAMPLEINDEX nSample, FileReader &file, bool mayNormalize, FileReader *wsmpChunk) //------------------------------------------------------------------------------------------------------------- { @@ -621,8 +619,8 @@ } -void PatchToSample(CSoundFile *that, SAMPLEINDEX nSample, LPBYTE lpStream, DWORD dwMemLength) -//------------------------------------------------------------------------------------------- +static void PatchToSample(CSoundFile *that, SAMPLEINDEX nSample, LPBYTE lpStream, DWORD dwMemLength) +//-------------------------------------------------------------------------------------------------- { ModSample &sample = that->GetSample(nSample); DWORD dwMemPos = sizeof(GF1SAMPLEHEADER); Modified: trunk/OpenMPT/soundlib/SampleIO.cpp =================================================================== --- trunk/OpenMPT/soundlib/SampleIO.cpp 2014-02-23 18:49:17 UTC (rev 3762) +++ trunk/OpenMPT/soundlib/SampleIO.cpp 2014-02-23 19:53:03 UTC (rev 3763) @@ -17,12 +17,6 @@ #include "ITCompression.h" -// External decompressors -extern void AMSUnpack(const int8 * const source, size_t sourceSize, void * const dest, const size_t destSize, char packCharacter); -extern uint16 MDLReadBits(uint32 &bitbuf, uint32 &bitnum, const uint8 *(&ibuf), int8 n); -extern uintptr_t DMFUnpack(LPBYTE psample, const uint8 *ibuf, const uint8 *ibufmax, uint32 maxlen); - - #if MPT_COMPILER_GCC #if MPT_GCC_AT_LEAST(4,6,0) #pragma GCC diagnostic push Modified: trunk/OpenMPT/soundlib/Sndfile.cpp =================================================================== --- trunk/OpenMPT/soundlib/Sndfile.cpp 2014-02-23 18:49:17 UTC (rev 3762) +++ trunk/OpenMPT/soundlib/Sndfile.cpp 2014-02-23 19:53:03 UTC (rev 3763) @@ -30,12 +30,7 @@ #include "../unarchiver/unarchiver.h" #endif // NO_ARCHIVE_SUPPORT -bool UnpackXPK(std::vector<char> &unpackedData, FileReader &file); -bool UnpackPP20(std::vector<char> &unpackedData, FileReader &file); -bool UnpackMMCMP(std::vector<char> &unpackedData, FileReader &file); - - // -> CODE#0027 // -> DESC="per-instrument volume ramping setup (refered as attack)" Modified: trunk/OpenMPT/soundlib/Sndfile.h =================================================================== --- trunk/OpenMPT/soundlib/Sndfile.h 2014-02-23 18:49:17 UTC (rev 3762) +++ trunk/OpenMPT/soundlib/Sndfile.h 2014-02-23 19:53:03 UTC (rev 3763) @@ -58,7 +58,17 @@ // -------------------------------------------------------------------------------------------- // -------------------------------------------------------------------------------------------- +// Sample decompression +void AMSUnpack(const int8 * const source, size_t sourceSize, void * const dest, const size_t destSize, char packCharacter); +uint16 MDLReadBits(uint32 &bitbuf, uint32 &bitnum, const uint8 *(&ibuf), int8 n); +uintptr_t DMFUnpack(LPBYTE psample, const uint8 *ibuf, const uint8 *ibufmax, uint32 maxlen); +bool IMAADPCMUnpack16(int16 *target, SmpLength sampleLen, FileReader file, uint16 blockAlign); +// Module decompression +bool UnpackXPK(std::vector<char> &unpackedData, FileReader &file); +bool UnpackPP20(std::vector<char> &unpackedData, FileReader &file); +bool UnpackMMCMP(std::vector<char> &unpackedData, FileReader &file); + //////////////////////////////////////////////////////////////////////// // Reverberation Modified: trunk/OpenMPT/soundlib/load_j2b.cpp =================================================================== --- trunk/OpenMPT/soundlib/load_j2b.cpp 2014-02-23 18:49:17 UTC (rev 3762) +++ trunk/OpenMPT/soundlib/load_j2b.cpp 2014-02-23 19:53:03 UTC (rev 3763) @@ -581,8 +581,8 @@ // Convert RIFF AM(FF) pattern data to MPT pattern data. -bool ConvertAMPattern(FileReader chunk, PATTERNINDEX pat, bool isAM, CSoundFile &sndFile) -//--------------------------------------------------------------------------------------- +static bool ConvertAMPattern(FileReader chunk, PATTERNINDEX pat, bool isAM, CSoundFile &sndFile) +//---------------------------------------------------------------------------------------------- { // Effect translation LUT static const ModCommand::COMMAND amEffTrans[] = Modified: trunk/OpenMPT/soundlib/tuningcollection.h =================================================================== --- trunk/OpenMPT/soundlib/tuningcollection.h 2014-02-23 18:49:17 UTC (rev 3762) +++ trunk/OpenMPT/soundlib/tuningcollection.h 2014-02-23 19:53:03 UTC (rev 3763) @@ -19,6 +19,7 @@ namespace CTuningS11n { void ReadTuning(std::istream& iStrm, CTuningCollection& Tc, const size_t); + void WriteTuning(std::ostream& oStrm, const CTuning& t); } Modified: trunk/OpenMPT/test/test.cpp =================================================================== --- trunk/OpenMPT/test/test.cpp 2014-02-23 18:49:17 UTC (rev 3762) +++ trunk/OpenMPT/test/test.cpp 2014-02-23 19:53:03 UTC (rev 3763) @@ -966,8 +966,8 @@ // Check if our test file was loaded correctly. -void TestLoadXMFile(const CSoundFile &sndFile) -//-------------------------------------------- +static void TestLoadXMFile(const CSoundFile &sndFile) +//--------------------------------------------------- { #ifdef MODPLUG_TRACKER const CModDoc *pModDoc = sndFile.GetpModDoc(); @@ -1165,8 +1165,8 @@ // Check if our test file was loaded correctly. -void TestLoadMPTMFile(const CSoundFile &sndFile) -//---------------------------------------------- +static void TestLoadMPTMFile(const CSoundFile &sndFile) +//----------------------------------------------------- { // Global Variables @@ -1422,8 +1422,8 @@ // Check if our test file was loaded correctly. -void TestLoadS3MFile(const CSoundFile &sndFile, bool resaved) -//----------------------------------------------------------- +static void TestLoadS3MFile(const CSoundFile &sndFile, bool resaved) +//------------------------------------------------------------------ { // Global Variables @@ -1778,8 +1778,8 @@ } -void RunITCompressionTest(const std::vector<int8> &sampleData, ChannelFlags smpFormat, bool it215, int testcount) -//--------------------------------------------------------------------------------------------------------------- +static void RunITCompressionTest(const std::vector<int8> &sampleData, ChannelFlags smpFormat, bool it215, int testcount) +//---------------------------------------------------------------------------------------------------------------------- { mpt::PathString filename = GetTestFilenameBase() + MPT_PATHSTRING("itcomp") + mpt::PathString::FromWide(StringifyW(testcount)) + MPT_PATHSTRING(".raw"); @@ -1854,15 +1854,15 @@ } -double Rand01() {return rand() / double(RAND_MAX);} +static double Rand01() {return rand() / double(RAND_MAX);} template <class T> T Rand(const T& min, const T& max) {return Util::Round<T>(min + Rand01() * (max - min));} -void GenerateCommands(CPattern& pat, const double dProbPcs, const double dProbPc) -//------------------------------------------------------------------------------- +static void GenerateCommands(CPattern& pat, const double dProbPcs, const double dProbPc) +//-------------------------------------------------------------------------------------- { const double dPcxProb = dProbPcs + dProbPc; const CPattern::const_iterator end = pat.End(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2014-02-23 20:46:01
|
Revision: 3764 http://sourceforge.net/p/modplug/code/3764 Author: saga-games Date: 2014-02-23 20:45:52 +0000 (Sun, 23 Feb 2014) Log Message: ----------- [New] Added options tab for sample and instrument editor settings. [New] Added two new key behaviours for how to stop sample editor note previews. [Mod] The following settings are no longer hidden: DefaultFormat, FinetuneStep, FLACCompressionLevel, MayNormalizeSamplesOnLoad, UndoBufferSize, DefaultPlugVolumeHandling [Mod] OpenMPT: Version is now 1.22.07.25 Modified Paths: -------------- trunk/OpenMPT/common/versionNumber.h trunk/OpenMPT/mptrack/Ctrl_ins.cpp trunk/OpenMPT/mptrack/Ctrl_smp.cpp trunk/OpenMPT/mptrack/Ctrl_smp.h trunk/OpenMPT/mptrack/FileDialog.cpp trunk/OpenMPT/mptrack/FileDialog.h trunk/OpenMPT/mptrack/MainFrm.cpp trunk/OpenMPT/mptrack/Moptions.cpp trunk/OpenMPT/mptrack/Moptions.h trunk/OpenMPT/mptrack/TrackerSettings.cpp trunk/OpenMPT/mptrack/TrackerSettings.h trunk/OpenMPT/mptrack/Undo.cpp trunk/OpenMPT/mptrack/Undo.h trunk/OpenMPT/mptrack/View_smp.cpp trunk/OpenMPT/mptrack/View_smp.h trunk/OpenMPT/mptrack/View_tre.cpp trunk/OpenMPT/mptrack/mptrack.rc trunk/OpenMPT/mptrack/resource.h trunk/OpenMPT/soundlib/SampleFormats.cpp Modified: trunk/OpenMPT/common/versionNumber.h =================================================================== --- trunk/OpenMPT/common/versionNumber.h 2014-02-23 19:53:03 UTC (rev 3763) +++ trunk/OpenMPT/common/versionNumber.h 2014-02-23 20:45:52 UTC (rev 3764) @@ -17,7 +17,7 @@ #define VER_MAJORMAJOR 1 #define VER_MAJOR 22 #define VER_MINOR 07 -#define VER_MINORMINOR 24 +#define VER_MINORMINOR 25 //Version string. For example "1.17.02.28" #define MPT_VERSION_STR VER_STRINGIZE(VER_MAJORMAJOR) "." VER_STRINGIZE(VER_MAJOR) "." VER_STRINGIZE(VER_MINOR) "." VER_STRINGIZE(VER_MINORMINOR) Modified: trunk/OpenMPT/mptrack/Ctrl_ins.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_ins.cpp 2014-02-23 19:53:03 UTC (rev 3763) +++ trunk/OpenMPT/mptrack/Ctrl_ins.cpp 2014-02-23 20:45:52 UTC (rev 3764) @@ -1681,6 +1681,7 @@ FileDialog dlg = OpenFileDialog() .AllowMultiSelect() + .EnableAudioPreview() .ExtensionFilter( "All Instruments|*.xi;*.pat;*.iti;*.flac;*.wav;*.aif;*.aiff|" "FastTracker II Instruments (*.xi)|*.xi|" @@ -1734,7 +1735,7 @@ } SanitizeFilename(szFileName); - int index = 0; + int index = (m_sndFile.GetType() == MOD_TYPE_XM || !TrackerSettings::Instance().compressITI) ? 0 : 1; FileDialog dlg = SaveFileDialog() .DefaultExtension(m_sndFile.GetType() == MOD_TYPE_XM ? "xi" : "iti") .DefaultFilename(szFileName) @@ -2724,9 +2725,9 @@ uint16 ptl = 0; if(m_EditPitchTempoLock.GetWindowTextLength() > 0) { - char buffer[7]; - m_EditPitchTempoLock.GetWindowText(buffer, 6); - ptl = atoi(buffer); + TCHAR buffer[8]; + m_EditPitchTempoLock.GetWindowText(buffer, CountOf(buffer)); + ptl = _ttoi(buffer); } if(!ptl) { Modified: trunk/OpenMPT/mptrack/Ctrl_smp.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_smp.cpp 2014-02-23 19:53:03 UTC (rev 3763) +++ trunk/OpenMPT/mptrack/Ctrl_smp.cpp 2014-02-23 20:45:52 UTC (rev 3764) @@ -408,8 +408,6 @@ } SetCurrentSample((lParam > 0) ? ((SAMPLEINDEX)lParam) : m_nSample); - m_nFinetuneStep = (uint16)theApp.GetSettings().Read<int32>("Sample Editor", "FinetuneStep", 25); - // Initial Update if (!m_bInitialized) UpdateView((m_nSample << HINT_SHIFT_SMP) | HINT_SAMPLEINFO | HINT_MODTYPE, NULL); CChildFrame *pFrame = (CChildFrame *)GetParentFrame(); @@ -966,6 +964,7 @@ static int nLastIndex = 0; FileDialog dlg = OpenFileDialog() .AllowMultiSelect() + .EnableAudioPreview() .ExtensionFilter("All Samples|*.wav;*.flac;*.pat;*.s3i;*.smp;*.snd;*.raw;*.xi;*.aif;*.aiff;*.its;*.8sv;*.8svx;*.svx;*.pcm;*.mp1;*.mp2;*.mp3|" "Wave Files (*.wav)|*.wav|" #ifndef NO_FLAC @@ -1008,7 +1007,7 @@ { mpt::PathString fileName; bool doBatchSave = CMainFrame::GetInputHandler()->ShiftPressed(); - bool defaultFLAC = false; + SampleEditorDefaultFormat defaultFormat = TrackerSettings::Instance().m_defaultSampleFormat; if(!doBatchSave) { @@ -1024,7 +1023,10 @@ } if(fileName.empty()) fileName = mpt::PathString::FromLocale(m_sndFile.m_szNames[m_nSample]); if(fileName.empty()) fileName = MPT_PATHSTRING("untitled"); - if(mpt::PathString::CompareNoCase(fileName.GetFileExt(), MPT_PATHSTRING(".flac"))) defaultFLAC = true; + + const mpt::PathString ext = fileName.GetFileExt(); + if(!mpt::PathString::CompareNoCase(ext, MPT_PATHSTRING(".flac"))) defaultFormat = dfFLAC; + else if(!mpt::PathString::CompareNoCase(ext, MPT_PATHSTRING(".wav"))) defaultFormat = dfWAV; } else { // save all samples @@ -1039,15 +1041,21 @@ } SanitizeFilename(fileName); - mpt::PathString format = theApp.GetSettings().Read<mpt::PathString>("Sample Editor", "DefaultFormat", defaultFLAC ? MPT_PATHSTRING("flac") : MPT_PATHSTRING("wav")); - int filter = 1; - if(!mpt::PathString::CompareNoCase(format, MPT_PATHSTRING("flac"))) + int filter; + switch(defaultFormat) + { + case dfWAV: + filter = 0; + break; + case dfFLAC: + default: + filter = 1; + case dfRAW: filter = 2; - else if(!mpt::PathString::CompareNoCase(format, MPT_PATHSTRING("raw"))) - filter = 3; + } FileDialog dlg = SaveFileDialog() - .DefaultExtension(format) + .DefaultExtension(ToSettingValue(defaultFormat).as<std::string>()) .DefaultFilename(fileName) .ExtensionFilter("Wave File (*.wav)|*.wav|" "FLAC File (*.flac)|*.flac|" @@ -2993,8 +3001,8 @@ { uint32 d = sample.nC5Speed; if (d < 1) d = 8363; - if(d < m_nFinetuneStep) d = m_nFinetuneStep; - d += (pos * m_nFinetuneStep); + if(d < TrackerSettings::Instance().m_nFinetuneStep) d = TrackerSettings::Instance().m_nFinetuneStep; + d += (pos * TrackerSettings::Instance().m_nFinetuneStep); sample.nC5Speed = Clamp(d, 1u, 9999999u); // 9999999 is max. in Impulse Tracker int transp = ModSample::FrequencyToTranspose(sample.nC5Speed) >> 7; int basenote = 60 - transp; Modified: trunk/OpenMPT/mptrack/Ctrl_smp.h =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_smp.h 2014-02-23 19:53:03 UTC (rev 3763) +++ trunk/OpenMPT/mptrack/Ctrl_smp.h 2014-02-23 20:45:52 UTC (rev 3764) @@ -40,7 +40,6 @@ uint32 m_nSequenceMs; uint32 m_nSeekWindowMs; uint32 m_nOverlapMs; - uint16 m_nFinetuneStep; // Increment finetune by x when using spin control. Default = 25 SampleIO m_nPreviousRawFormat; bool rememberRawFormat; Modified: trunk/OpenMPT/mptrack/FileDialog.cpp =================================================================== --- trunk/OpenMPT/mptrack/FileDialog.cpp 2014-02-23 19:53:03 UTC (rev 3763) +++ trunk/OpenMPT/mptrack/FileDialog.cpp 2014-02-23 20:45:52 UTC (rev 3764) @@ -29,16 +29,18 @@ // Prepare filename buffer. std::vector<WCHAR> filenameBuffer(uint16_max, 0); - filenameBuffer.insert(filenameBuffer.begin(), defaultFilename.begin(), defaultFilename.end()); - filenameBuffer.push_back(0); + wcscpy(&filenameBuffer[0], defaultFilename.c_str()); + //filenameBuffer.insert(filenameBuffer.begin(), defaultFilename.begin(), defaultFilename.end()); + //filenameBuffer.push_back(0); + preview = preview && TrackerSettings::Instance().previewInFileDialogs; const std::wstring workingDirectoryNative = workingDirectory.AsNative(); // First, set up the dialog... OPENFILENAMEW ofn; MemsetZero(ofn); - ofn.lStructSize = sizeof(OPENFILENAMEW); - ofn.hwndOwner = (parent != nullptr ? parent : theApp.m_pMainWnd)->GetSafeHwnd(); + ofn.lStructSize = sizeof(ofn); + ofn.hwndOwner = (parent != nullptr ? parent : theApp.m_pMainWnd)->m_hWnd; ofn.hInstance = theApp.m_hInstance; ofn.lpstrFilter = extFilter.c_str(); ofn.lpstrCustomFilter = NULL; @@ -50,12 +52,12 @@ ofn.nMaxFileTitle = 0; ofn.lpstrInitialDir = workingDirectory.empty() ? NULL : workingDirectoryNative.c_str(); ofn.lpstrTitle = NULL; - ofn.Flags = OFN_EXPLORER | OFN_HIDEREADONLY | OFN_ENABLESIZING | OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST | (multiSelect ? OFN_ALLOWMULTISELECT : 0) | (load ? 0 : (OFN_OVERWRITEPROMPT | OFN_NOREADONLYRETURN)); + ofn.Flags = OFN_EXPLORER | OFN_HIDEREADONLY | OFN_ENABLESIZING | OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST | (multiSelect ? OFN_ALLOWMULTISELECT : 0) | (load ? 0 : (OFN_OVERWRITEPROMPT | OFN_NOREADONLYRETURN)) | (preview ? OFN_ENABLEHOOK : 0); ofn.nFileOffset = 0; ofn.nFileExtension = 0; ofn.lpstrDefExt = defaultExtension.empty() ? NULL : defaultExtension.c_str(); - ofn.lCustData = NULL; - ofn.lpfnHook = NULL; + ofn.lCustData = reinterpret_cast<LPARAM>(this); + ofn.lpfnHook = OFNHookProc; ofn.lpTemplateName = NULL; ofn.pvReserved = NULL; ofn.dwReserved = 0; @@ -66,6 +68,11 @@ BOOL result = load ? GetOpenFileNameW(&ofn) : GetSaveFileNameW(&ofn); CMainFrame::GetInputHandler()->Bypass(false); + if(stopPreview) + { + CMainFrame::GetMainFrame()->StopPreview(); + } + if(result == FALSE) { return false; @@ -108,6 +115,31 @@ } +// Callback function for instrument preview +UINT_PTR CALLBACK FileDialog::OFNHookProc(HWND hdlg, UINT uiMsg, WPARAM /*wParam*/, LPARAM lParam) +//------------------------------------------------------------------------------------------------ +{ + if(uiMsg == WM_NOTIFY) + { + OFNOTIFY *ofn = reinterpret_cast<OFNOTIFY *>(lParam); + WCHAR path[MAX_PATH]; + if(ofn->hdr.code == CDN_SELCHANGE && CommDlg_OpenSave_GetFilePathW(GetParent(hdlg), path, CountOf(path)) > 0) + { + FileDialog *that = reinterpret_cast<FileDialog *>(ofn->lpOFN->lCustData); + if(path[0] && that->lastPreviewFile != path) + { + that->lastPreviewFile = path; + if(CMainFrame::GetMainFrame()->PlaySoundFile(mpt::PathString::FromNative(path), NOTE_MIDDLEC)) + { + that->stopPreview = true; + } + } + } + } + return 0; +} + + // Helper callback to set start path. int CALLBACK BrowseForFolder::BrowseCallbackProc(HWND hwnd, UINT uMsg, LPARAM /*lParam*/, LPARAM lpData) //------------------------------------------------------------------------------------------------------ @@ -130,7 +162,7 @@ BROWSEINFOW bi; MemsetZero(bi); - bi.hwndOwner = (parent != nullptr ? parent : theApp.m_pMainWnd)->GetSafeHwnd(); + bi.hwndOwner = (parent != nullptr ? parent : theApp.m_pMainWnd)->m_hWnd; bi.lpszTitle = caption.empty() ? NULL : caption.c_str(); bi.pszDisplayName = path; bi.ulFlags = BIF_RETURNONLYFSDIRS | BIF_USENEWUI; Modified: trunk/OpenMPT/mptrack/FileDialog.h =================================================================== --- trunk/OpenMPT/mptrack/FileDialog.h 2014-02-23 19:53:03 UTC (rev 3763) +++ trunk/OpenMPT/mptrack/FileDialog.h 2014-02-23 20:45:52 UTC (rev 3764) @@ -22,16 +22,17 @@ std::wstring defaultExtension; std::wstring defaultFilename; std::wstring extFilter; + std::wstring lastPreviewFile; mpt::PathString workingDirectory; - mpt::PathString lastPreviewFile; mpt::PathString extension; PathList filenames; int *filterIndex; bool load; bool multiSelect; + bool preview, stopPreview; protected: - FileDialog(bool load) : filterIndex(nullptr), load(load), multiSelect(false) { } + FileDialog(bool load) : filterIndex(nullptr), load(load), multiSelect(false), preview(false), stopPreview(false) { } public: // Default extension to use if none is specified. @@ -50,6 +51,8 @@ FileDialog &WorkingDirectory(const mpt::PathString &dir) { workingDirectory = dir; return *this; } // Pointer to a variable holding the index of the last extension filter to use. Holds the selected filter after the dialog has been closed. FileDialog &FilterIndex(int *index) { filterIndex = index; return *this; } + // Enable preview of instrument files (if globally enabled). + FileDialog &EnableAudioPreview() { preview = true; return *this; } // Show the file selection dialog. bool Show(const CWnd *parent = nullptr); @@ -96,6 +99,7 @@ }; +// Folder browser. class BrowseForFolder { protected: Modified: trunk/OpenMPT/mptrack/MainFrm.cpp =================================================================== --- trunk/OpenMPT/mptrack/MainFrm.cpp 2014-02-23 19:53:03 UTC (rev 3763) +++ trunk/OpenMPT/mptrack/MainFrm.cpp 2014-02-23 20:45:52 UTC (rev 3764) @@ -1838,6 +1838,7 @@ CPropertySheet dlg("OpenMPT Setup", this, m_nLastOptionsPage); COptionsGeneral general; COptionsSoundcard sounddlg(TrackerSettings::Instance().GetSoundDeviceID()); + COptionsSampleEditor smpeditor; COptionsKeyboard keyboard; COptionsColors colors; COptionsPlayer playerdlg; @@ -1860,6 +1861,7 @@ #ifndef NO_EQ dlg.AddPage(&eqdlg); #endif + dlg.AddPage(&smpeditor); dlg.AddPage(&keyboard); dlg.AddPage(&colors); dlg.AddPage(&mididlg); @@ -2373,7 +2375,7 @@ return 0; } -//rewbs.customKeys + LRESULT CMainFrame::OnCustomKeyMsg(WPARAM wParam, LPARAM lParam) //--------------------------------------------------------------- { @@ -2454,8 +2456,8 @@ return wParam; } -//end rewbs.customKeys + void CMainFrame::OnInitMenu(CMenu* pMenu) //--------------------------------------- { @@ -2500,8 +2502,8 @@ pSndFile->m_bIsRendering = false; return true; } -//end rewbs.VSTTimeInfo + // We have swicthed focus to a new module - might need to update effect keys to reflect module type bool CMainFrame::UpdateEffectKeys() //--------------------------------- Modified: trunk/OpenMPT/mptrack/Moptions.cpp =================================================================== --- trunk/OpenMPT/mptrack/Moptions.cpp 2014-02-23 19:53:03 UTC (rev 3763) +++ trunk/OpenMPT/mptrack/Moptions.cpp 2014-02-23 20:45:52 UTC (rev 3764) @@ -690,7 +690,110 @@ } +BEGIN_MESSAGE_MAP(COptionsSampleEditor, CPropertyPage) + ON_EN_CHANGE(IDC_EDIT_UNDOSIZE, OnUndoSizeChanged) + ON_EN_CHANGE(IDC_EDIT_FINETUNE, OnSettingsChanged) + ON_EN_CHANGE(IDC_FLAC_COMPRESSION, OnSettingsChanged) + ON_CBN_SELCHANGE(IDC_DEFAULT_FORMAT, OnSettingsChanged) + ON_CBN_SELCHANGE(IDC_VOLUME_HANDLING, OnSettingsChanged) + ON_COMMAND(IDC_RADIO1, OnSettingsChanged) + ON_COMMAND(IDC_RADIO2, OnSettingsChanged) + ON_COMMAND(IDC_RADIO3, OnSettingsChanged) + ON_COMMAND(IDC_COMPRESS_ITI, OnSettingsChanged) + ON_COMMAND(IDC_PREVIEW_SAMPLES, OnSettingsChanged) + ON_COMMAND(IDC_NORMALIZE, OnSettingsChanged) +END_MESSAGE_MAP() + +void COptionsSampleEditor::DoDataExchange(CDataExchange* pDX) +//----------------------------------------------------------- +{ + CPropertyPage::DoDataExchange(pDX); + //{{AFX_DATA_MAP(COptionsSampleEditor) + DDX_Control(pDX, IDC_DEFAULT_FORMAT, m_cbnDefaultSampleFormat); + DDX_Control(pDX, IDC_VOLUME_HANDLING, m_cbnDefaultVolumeHandling); + //}}AFX_DATA_MAP +} + + +BOOL COptionsSampleEditor::OnInitDialog() +//--------------------------------------- +{ + CPropertyPage::OnInitDialog(); + SetDlgItemInt(IDC_EDIT_FINETUNE, TrackerSettings::Instance().m_nFinetuneStep); + SetDlgItemInt(IDC_EDIT_UNDOSIZE, TrackerSettings::Instance().m_SampleUndoBufferSize.Get().GetSizeInPercent()); + OnUndoSizeChanged(); + + m_cbnDefaultSampleFormat.SetItemData(m_cbnDefaultSampleFormat.AddString("FLAC"), dfFLAC); + m_cbnDefaultSampleFormat.SetItemData(m_cbnDefaultSampleFormat.AddString("WAV"), dfWAV); + m_cbnDefaultSampleFormat.SetItemData(m_cbnDefaultSampleFormat.AddString("RAW"), dfRAW); + m_cbnDefaultSampleFormat.SetCurSel(TrackerSettings::Instance().m_defaultSampleFormat); + + SetDlgItemInt(IDC_FLAC_COMPRESSION, TrackerSettings::Instance().m_FLACCompressionLevel); + CSpinButtonCtrl *spin = (CSpinButtonCtrl *)GetDlgItem(IDC_SPIN1); + if(spin) + { + spin->SetRange(0, 8); + spin->SetPos(TrackerSettings::Instance().m_FLACCompressionLevel); + } + + CheckRadioButton(IDC_RADIO1, IDC_RADIO3, IDC_RADIO1 + TrackerSettings::Instance().sampleEditorKeyBehaviour); + + CheckDlgButton(IDC_COMPRESS_ITI, TrackerSettings::Instance().compressITI ? MF_CHECKED : MF_UNCHECKED); + + m_cbnDefaultSampleFormat.SetItemData(m_cbnDefaultVolumeHandling.AddString("MIDI volume"), PLUGIN_VOLUMEHANDLING_MIDI); + m_cbnDefaultSampleFormat.SetItemData(m_cbnDefaultVolumeHandling.AddString("Dry/Wet ratio"), PLUGIN_VOLUMEHANDLING_DRYWET); + m_cbnDefaultSampleFormat.SetItemData(m_cbnDefaultVolumeHandling.AddString("None"), PLUGIN_VOLUMEHANDLING_IGNORE); + m_cbnDefaultVolumeHandling.SetCurSel(TrackerSettings::Instance().DefaultPlugVolumeHandling); + + CheckDlgButton(IDC_PREVIEW_SAMPLES, TrackerSettings::Instance().previewInFileDialogs ? MF_CHECKED : MF_UNCHECKED); + CheckDlgButton(IDC_NORMALIZE, TrackerSettings::Instance().m_MayNormalizeSamplesOnLoad ? MF_CHECKED : MF_UNCHECKED); + + return TRUE; +} + + +void COptionsSampleEditor::OnOK() +//------------------------------- +{ + CPropertyPage::OnOK(); + + TrackerSettings::Instance().m_nFinetuneStep = GetDlgItemInt(IDC_EDIT_FINETUNE); + TrackerSettings::Instance().m_SampleUndoBufferSize = SampleUndoBufferSize(GetDlgItemInt(IDC_EDIT_UNDOSIZE)); + TrackerSettings::Instance().m_defaultSampleFormat = static_cast<SampleEditorDefaultFormat>(m_cbnDefaultSampleFormat.GetItemData(m_cbnDefaultSampleFormat.GetCurSel())); + TrackerSettings::Instance().m_FLACCompressionLevel = GetDlgItemInt(IDC_FLAC_COMPRESSION); + TrackerSettings::Instance().sampleEditorKeyBehaviour = static_cast<SampleEditorKeyBehaviour>(GetCheckedRadioButton(IDC_RADIO1, IDC_RADIO3) -IDC_RADIO1); + TrackerSettings::Instance().compressITI = IsDlgButtonChecked(IDC_COMPRESS_ITI) != MF_UNCHECKED; + TrackerSettings::Instance().DefaultPlugVolumeHandling = static_cast<PLUGVOLUMEHANDLING>(m_cbnDefaultVolumeHandling.GetItemData(m_cbnDefaultVolumeHandling.GetCurSel())); + TrackerSettings::Instance().previewInFileDialogs = IsDlgButtonChecked(IDC_PREVIEW_SAMPLES) != MF_UNCHECKED; + TrackerSettings::Instance().m_MayNormalizeSamplesOnLoad = IsDlgButtonChecked(IDC_NORMALIZE) != MF_UNCHECKED; + + std::vector<CModDoc *> docs = theApp.GetOpenDocuments(); + for(std::vector<CModDoc *>::iterator i = docs.begin(); i != docs.end(); i++) + { + (**i).GetSampleUndo().RestrictBufferSize(); + } +} + + +BOOL COptionsSampleEditor::OnSetActive() +//-------------------------------------- +{ + CMainFrame::m_nLastOptionsPage = OPTIONS_PAGE_SAMPLEDITOR; + return CPropertyPage::OnSetActive(); +} + + +void COptionsSampleEditor::OnUndoSizeChanged() +//-------------------------------------------- +{ + uint32 sizeMB = mpt::saturate_cast<uint32>(SampleUndoBufferSize(GetDlgItemInt(IDC_EDIT_UNDOSIZE)).GetSizeInBytes() >> 20); + CString text; + text.Format("%% of physical memory (%u MiB)", sizeMB); + SetDlgItemText(IDC_UNDOSIZE, text); +} + + #if defined(MPT_SETTINGS_CACHE) BEGIN_MESSAGE_MAP(COptionsAdvanced, CPropertyPage) Modified: trunk/OpenMPT/mptrack/Moptions.h =================================================================== --- trunk/OpenMPT/mptrack/Moptions.h 2014-02-23 19:53:03 UTC (rev 3763) +++ trunk/OpenMPT/mptrack/Moptions.h 2014-02-23 20:45:52 UTC (rev 3764) @@ -19,6 +19,7 @@ OPTIONS_PAGE_MIXER, OPTIONS_PAGE_PLAYER, OPTIONS_PAGE_EQ, + OPTIONS_PAGE_SAMPLEDITOR, OPTIONS_PAGE_KEYBOARD, OPTIONS_PAGE_COLORS, OPTIONS_PAGE_MIDI, @@ -126,3 +127,26 @@ afx_msg void OnPreviewChanged(); DECLARE_MESSAGE_MAP(); }; + + +//=============================================== +class COptionsSampleEditor : public CPropertyPage +//=============================================== +{ +protected: + CComboBox m_cbnDefaultSampleFormat, m_cbnDefaultVolumeHandling; + +public: + COptionsSampleEditor() : CPropertyPage(IDD_OPTIONS_SAMPLEEDITOR) { } + +protected: + + virtual BOOL OnInitDialog(); + virtual void OnOK(); + virtual void DoDataExchange(CDataExchange* pDX); + virtual BOOL OnSetActive(); + + afx_msg void OnSettingsChanged() { SetModified(TRUE); } + afx_msg void OnUndoSizeChanged(); + DECLARE_MESSAGE_MAP(); +}; Modified: trunk/OpenMPT/mptrack/TrackerSettings.cpp =================================================================== --- trunk/OpenMPT/mptrack/TrackerSettings.cpp 2014-02-23 19:53:03 UTC (rev 3763) +++ trunk/OpenMPT/mptrack/TrackerSettings.cpp 2014-02-23 20:45:52 UTC (rev 3764) @@ -108,16 +108,22 @@ } -static uint32 GetDefaultUndoBufferSize() -//-------------------------------------- +void SampleUndoBufferSize::CalculateSize() +//---------------------------------------- { - MEMORYSTATUS gMemStatus; - MemsetZero(gMemStatus); - GlobalMemoryStatus(&gMemStatus); - // Allow allocations of at least 16MB - if(gMemStatus.dwTotalPhys < 16*1024*1024) - gMemStatus.dwTotalPhys = 16*1024*1024; - return std::max<uint32>(gMemStatus.dwTotalPhys / 10, 1 << 20);; + if(sizePercent < 0) + sizePercent = 0; + // Don't use GlobalMemoryStatusEx here since we want a percentage of the memory that's actually *available* to OpenMPT, which is a max of 4GB in 32-bit mode. + MEMORYSTATUS memStatus; + memStatus.dwLength = sizeof(MEMORYSTATUS); + GlobalMemoryStatus(&memStatus); + sizeByte = mpt::saturate_cast<size_t>(memStatus.dwTotalPhys * uint64(sizePercent) / 100); + + // Pretend there's at least one MiB of memory (haha) + if(sizePercent != 0 && sizeByte < 1 * 1024 * 1024) + { + sizeByte = 1 * 1024 * 1024; + } } @@ -195,9 +201,14 @@ , orderlistMargins(conf, "Pattern Editor", "DefaultSequenceMargins", 0) , rowDisplayOffset(conf, "Pattern Editor", "RowDisplayOffset", 0) // Sample Editor - , m_SampleUndoMaxBufferMB(conf, "Sample Editor", "UndoBufferSize", GetDefaultUndoBufferSize() >> 20) + , m_SampleUndoBufferSize(conf, "Sample Editor", "UndoBufferSize", SampleUndoBufferSize()) + , sampleEditorKeyBehaviour(conf, "Sample Editor", "KeyBehaviour", seNoteOffOnNewKey) + , m_defaultSampleFormat(conf, "Sample Editor", "DefaultFormat", dfFLAC) + , m_nFinetuneStep(conf, "Sample Editor", "FinetuneStep", 25) + , m_FLACCompressionLevel(conf, "Sample Editor", "FLACCompressionLevel", 5) + , compressITI(conf, "Sample Editor", "CompressITI", true) , m_MayNormalizeSamplesOnLoad(conf, "Sample Editor", "MayNormalizeSamplesOnLoad", true) - , SampleEditorFLACCompressionLevel(conf, "Sample Editor", "FLACCompressionLevel", 5) + , previewInFileDialogs(conf, "Sample Editor", "PreviewInFileDialogs", false) // Export , ExportDefaultToSoundcardSamplerate(conf, "Export", "DefaultToSoundcardSamplerate", true) , ExportStreamEncoderSettings(conf, "Export") @@ -510,6 +521,13 @@ } m_szKbdFile = theApp.RelativePathToAbsolute(m_szKbdFile); + // Sample undo buffer size (used to be a hidden, absolute setting in MiB) + int64 oldUndoSize = m_SampleUndoBufferSize.Get().GetSizeInPercent(); + if(storedVersion < MAKE_VERSION_NUMERIC(1,22,07,25) && oldUndoSize != SampleUndoBufferSize::defaultSize && oldUndoSize != 0) + { + m_SampleUndoBufferSize = SampleUndoBufferSize(static_cast<int32>(100 * (oldUndoSize << 20) / SampleUndoBufferSize(100).GetSizeInBytes())); + } + // Last fixup: update config version IniVersion = MptVersion::str; @@ -902,7 +920,7 @@ for(size_t i = 0; i < CountOf(chords); i++) { uint32 chord; - if((chord = conf.Read<int32>("Chords", CSoundFile::GetNoteName(i + NOTE_MIN), -1)) >= 0) + if((chord = conf.Read<int32>("Chords", CSoundFile::GetNoteName(ModCommand::NOTE(i + NOTE_MIN)), -1)) >= 0) { if((chord & 0xFFFFFFC0) || (!chords[i].notes[0])) { @@ -922,7 +940,7 @@ for(size_t i = 0; i < CountOf(chords); i++) { int32 s = (chords[i].key) | (chords[i].notes[0] << 6) | (chords[i].notes[1] << 12) | (chords[i].notes[2] << 18); - conf.Write<int32>("Chords", CSoundFile::GetNoteName(i + NOTE_MIN), s); + conf.Write<int32>("Chords", CSoundFile::GetNoteName(ModCommand::NOTE(i + NOTE_MIN)), s); } } Modified: trunk/OpenMPT/mptrack/TrackerSettings.h =================================================================== --- trunk/OpenMPT/mptrack/TrackerSettings.h 2014-02-23 19:53:03 UTC (rev 3763) +++ trunk/OpenMPT/mptrack/TrackerSettings.h 2014-02-23 20:45:52 UTC (rev 3764) @@ -139,10 +139,12 @@ #endif STATIC_ASSERT(sizeof(EQPreset) == 60); -template<> inline SettingValue ToSettingValue(const EQPreset &val) { +template<> inline SettingValue ToSettingValue(const EQPreset &val) +{ return SettingValue(EncodeBinarySetting<EQPreset>(val), "EQPreset"); } -template<> inline EQPreset FromSettingValue(const SettingValue &val) { +template<> inline EQPreset FromSettingValue(const SettingValue &val) +{ ASSERT(val.GetTypeTag() == "EQPreset"); return DecodeBinarySetting<EQPreset>(val.as<std::vector<char> >()); } @@ -172,6 +174,47 @@ atRecordAsMacro, }; +// Sample editor preview behaviour +enum SampleEditorKeyBehaviour +{ + seNoteOffOnNewKey, + seNoteOffOnKeyUp, + seNoteOffOnKeyRestrike, +}; + +enum SampleEditorDefaultFormat +{ + dfFLAC, + dfWAV, + dfRAW, +}; + + +class SampleUndoBufferSize +{ +protected: + size_t sizeByte; + int32 sizePercent; + + void CalculateSize(); + +public: + enum + { + defaultSize = 10, // In percent + }; + + SampleUndoBufferSize(int32 percent = defaultSize) : sizePercent(percent) { CalculateSize(); } + void Set(int32 percent) { sizePercent = percent; CalculateSize(); } + + int32 GetSizeInPercent() const { return sizePercent; } + size_t GetSizeInBytes() const { return sizeByte; } +}; + +template<> inline SettingValue ToSettingValue(const SampleUndoBufferSize &val) { return SettingValue(val.GetSizeInPercent()); } +template<> inline SampleUndoBufferSize FromSettingValue(const SettingValue &val) { return SampleUndoBufferSize(val.as<int32>()); } + + std::string IgnoredCCsToString(const std::bitset<128> &midiIgnoreCCs); std::bitset<128> StringToIgnoredCCs(const std::string &in); @@ -182,6 +225,9 @@ template<> inline SettingValue ToSettingValue(const RecordAftertouchOptions &val) { return SettingValue(int32(val)); } template<> inline RecordAftertouchOptions FromSettingValue(const SettingValue &val) { return RecordAftertouchOptions(val.as<int32>()); } +template<> inline SettingValue ToSettingValue(const SampleEditorKeyBehaviour &val) { return SettingValue(int32(val)); } +template<> inline SampleEditorKeyBehaviour FromSettingValue(const SettingValue &val) { return SampleEditorKeyBehaviour(val.as<int32>()); } + template<> inline SettingValue ToSettingValue(const MODTYPE &val) { return SettingValue(SettingsModTypeToString(val), "MODTYPE"); } template<> inline MODTYPE FromSettingValue(const SettingValue &val) { ASSERT(val.GetTypeTag() == "MODTYPE"); return SettingsStringToModType(val.as<std::string>()); } @@ -224,6 +270,34 @@ return StringToIgnoredCCs(val.as<std::string>()); } +template<> inline SettingValue ToSettingValue(const SampleEditorDefaultFormat &val) +{ + const char *format; + switch(val) + { + case dfWAV: + format = "wav"; + break; + case dfFLAC: + default: + format = "flac"; + break; + case dfRAW: + format = "raw"; + } + return SettingValue(format); +} +template<> inline SampleEditorDefaultFormat FromSettingValue(const SettingValue &val) +{ + std::string format = val.as<std::string>(); + for(std::string::iterator c = format.begin(); c != format.end(); c++) *c = std::string::value_type(::tolower(*c)); + if(format == "wav") + return dfWAV; + if(format == "raw") + return dfRAW; + else // if(format == "flac") + return dfFLAC; +} //=================== @@ -341,10 +415,14 @@ // Sample Editor - Setting<uint32> m_SampleUndoMaxBufferMB; - uint32 GetSampleUndoBufferSize() const { return m_SampleUndoMaxBufferMB << 20; } + Setting<SampleUndoBufferSize> m_SampleUndoBufferSize; + Setting<SampleEditorKeyBehaviour> sampleEditorKeyBehaviour; + Setting<SampleEditorDefaultFormat> m_defaultSampleFormat; + Setting<uint32> m_nFinetuneStep; // Increment finetune by x when using spin control. Default = 25 + Setting<int32> m_FLACCompressionLevel; // FLAC compression level for saving (0...8) + Setting<bool> compressITI; Setting<bool> m_MayNormalizeSamplesOnLoad; - Setting<int32> SampleEditorFLACCompressionLevel; // Custom compression level (0...8) + Setting<bool> previewInFileDialogs; // Export Modified: trunk/OpenMPT/mptrack/Undo.cpp =================================================================== --- trunk/OpenMPT/mptrack/Undo.cpp 2014-02-23 19:53:03 UTC (rev 3763) +++ trunk/OpenMPT/mptrack/Undo.cpp 2014-02-23 20:45:52 UTC (rev 3764) @@ -540,7 +540,7 @@ //------------------------------------ { size_t capacity = GetBufferCapacity(UndoBuffer) + GetBufferCapacity(RedoBuffer); - while(capacity > TrackerSettings::Instance().GetSampleUndoBufferSize()) + while(capacity > TrackerSettings::Instance().m_SampleUndoBufferSize.Get().GetSizeInBytes()) { RestrictBufferSize(UndoBuffer, capacity); RestrictBufferSize(RedoBuffer, capacity); @@ -553,7 +553,7 @@ { for(SAMPLEINDEX smp = 1; smp <= buffer.size(); smp++) { - if(capacity <= TrackerSettings::Instance().GetSampleUndoBufferSize()) return; + if(capacity <= TrackerSettings::Instance().m_SampleUndoBufferSize.Get().GetSizeInBytes()) return; for(size_t i = 0; i < buffer[smp - 1].size(); i++) { if(buffer[smp - 1][i].samplePtr != nullptr) Modified: trunk/OpenMPT/mptrack/Undo.h =================================================================== --- trunk/OpenMPT/mptrack/Undo.h 2014-02-23 19:53:03 UTC (rev 3763) +++ trunk/OpenMPT/mptrack/Undo.h 2014-02-23 20:45:52 UTC (rev 3764) @@ -144,7 +144,6 @@ void ClearUndo(undobuf_t &buffer, const SAMPLEINDEX smp); void DeleteStep(undobuf_t &buffer, const SAMPLEINDEX smp, const size_t step); bool SampleBufferExists(const undobuf_t &buffer, const SAMPLEINDEX smp) const; - void RestrictBufferSize(); void RestrictBufferSize(undobuf_t &buffer, size_t &capacity); size_t GetBufferCapacity(const undobuf_t &buffer) const; @@ -164,6 +163,7 @@ void RemoveLastUndoStep(const SAMPLEINDEX smp); const char *GetUndoName(const SAMPLEINDEX smp) const; const char *GetRedoName(const SAMPLEINDEX smp) const; + void RestrictBufferSize(); CSampleUndo(CModDoc &parent) : modDoc(parent) { } Modified: trunk/OpenMPT/mptrack/View_smp.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_smp.cpp 2014-02-23 19:53:03 UTC (rev 3763) +++ trunk/OpenMPT/mptrack/View_smp.cpp 2014-02-23 20:45:52 UTC (rev 3764) @@ -130,6 +130,7 @@ MemsetZero(m_NcButtonState); m_bmpEnvBar.Create(IDB_SMPTOOLBAR, 20, 0, RGB(192,192,192)); m_lastDrawPoint.SetPoint(-1, -1); + noteChannel.assign(NOTE_MAX - NOTE_MIN + 1, CHANNELINDEX_INVALID); offScreenDC = nullptr; offScreenBitmap = nullptr; } @@ -2365,7 +2366,7 @@ if (note >= NOTE_MIN_SPECIAL) { pModDoc->NoteOff(0, (note == NOTE_NOTECUT)); - } else if(ModCommand::IsNote((ModCommand::NOTE)note)) + } else { if(m_dwStatus[SMPSTATUS_KEYDOWN]) pModDoc->NoteOff(note, true); @@ -2373,10 +2374,13 @@ pModDoc->NoteOff(0, true); SmpLength loopstart = m_dwBeginSel, loopend = m_dwEndSel; - if (loopend - loopstart < (SmpLength)(4 << m_nZoom)) - loopend = loopstart = 0; // selection is too small -> no loop + // If selection is too small -> no loop + if(m_nZoom >= 0 && loopend - loopstart < (SmpLength)(4 << m_nZoom)) + loopend = loopstart = 0; + else if(m_nZoom < 0 && loopend - loopstart < 4) + loopend = loopstart = 0; - pModDoc->PlayNote(note, 0, m_nSample, false, -1, loopstart, loopend, CHANNELINDEX_INVALID, nStartPos); + noteChannel[note - NOTE_MIN] = pModDoc->PlayNote(note, 0, m_nSample, false, -1, loopstart, loopend, CHANNELINDEX_INVALID, nStartPos); m_dwStatus.set(SMPSTATUS_KEYDOWN); @@ -2391,7 +2395,16 @@ pMainFrm->SetInfoText(s.c_str()); } } +} + +void CViewSample::NoteOff(ModCommand::NOTE note) +//---------------------------------------------- +{ + CSoundFile &sndFile = GetDocument()->GetrSoundFile(); + sndFile.KeyOff(noteChannel[note - NOTE_MIN]); + sndFile.Chn[noteChannel[note - NOTE_MIN]].dwFlags.set(CHN_NOTEFADE); + noteChannel[note - NOTE_MIN] = CHANNELINDEX_INVALID; } @@ -2906,15 +2919,49 @@ case kcNoteCut: PlayNote(NOTE_NOTECUT); return wParam; } - if (wParam >= kcSampStartNotes && wParam <= kcSampEndNotes) + if(wParam >= kcSampStartNotes && wParam <= kcSampEndNotes) { - PlayNote(static_cast<ModCommand::NOTE>(wParam - kcSampStartNotes + 1 + pMainFrm->GetBaseOctave() * 12)); - return wParam; - } - if (wParam >= kcSampStartNoteStops && wParam <= kcSampEndNoteStops) + const ModCommand::NOTE note = static_cast<ModCommand::NOTE>(wParam - kcSampStartNotes + NOTE_MIN + pMainFrm->GetBaseOctave() * 12); + if(ModCommand::IsNote(note)) + { + switch(TrackerSettings::Instance().sampleEditorKeyBehaviour) + { + case seNoteOffOnKeyRestrike: + if(noteChannel[note - NOTE_MIN] != CHANNELINDEX_INVALID) + { + NoteOff(note); + break; + } + // Fall-through + default: + PlayNote(note); + } + return wParam; + } + } else if(wParam >= kcSampStartNoteStops && wParam <= kcSampEndNoteStops) { - m_dwStatus.reset(SMPSTATUS_KEYDOWN); - return wParam; + const ModCommand::NOTE note = static_cast<ModCommand::NOTE>(wParam - kcSampStartNoteStops + NOTE_MIN + pMainFrm->GetBaseOctave() * 12); + if(ModCommand::IsNote(note)) + { + switch(TrackerSettings::Instance().sampleEditorKeyBehaviour) + { + case seNoteOffOnNewKey: + m_dwStatus.reset(SMPSTATUS_KEYDOWN); + if(noteChannel[note - NOTE_MIN] != CHANNELINDEX_INVALID) + { + // Release sustain loop on key up + pModDoc->GetrSoundFile().KeyOff(noteChannel[note - NOTE_MIN]); + } + break; + case seNoteOffOnKeyUp: + if(noteChannel[note - NOTE_MIN] != CHANNELINDEX_INVALID) + { + NoteOff(note); + } + break; + } + return wParam; + } } return NULL; Modified: trunk/OpenMPT/mptrack/View_smp.h =================================================================== --- trunk/OpenMPT/mptrack/View_smp.h 2014-02-23 19:53:03 UTC (rev 3763) +++ trunk/OpenMPT/mptrack/View_smp.h 2014-02-23 20:45:52 UTC (rev 3764) @@ -64,6 +64,7 @@ int32 SampleToScreen(SmpLength pos) const; SmpLength ScreenToSample(int32 x) const; void PlayNote(ModCommand::NOTE note, const SmpLength nStartPos = 0); + void NoteOff(ModCommand::NOTE note); void InvalidateSample(); void SetCurSel(SmpLength nBegin, SmpLength nEnd); void ScrollToPosition(int x); Modified: trunk/OpenMPT/mptrack/View_tre.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_tre.cpp 2014-02-23 19:53:03 UTC (rev 3763) +++ trunk/OpenMPT/mptrack/View_tre.cpp 2014-02-23 20:45:52 UTC (rev 3764) @@ -1557,6 +1557,7 @@ //--------------------------------------------- { FileDialog dlg = OpenFileDialog() + .EnableAudioPreview() .ExtensionFilter( "All Instruments and Banks|*.xi;*.pat;*.iti;*.wav;*.aif;*.aiff;*.sf2;*.sbk;*.dls;*.flac;*.mp1;*.mp2;*.mp3|" "FastTracker II Instruments (*.xi)|*.xi|" Modified: trunk/OpenMPT/mptrack/mptrack.rc =================================================================== --- trunk/OpenMPT/mptrack/mptrack.rc 2014-02-23 19:53:03 UTC (rev 3763) +++ trunk/OpenMPT/mptrack/mptrack.rc 2014-02-23 20:45:52 UTC (rev 3764) @@ -125,6 +125,38 @@ PUSHBUTTON "Add",IDC_BUTTON_ADD,174,78,50,14 END +IDD_OPTIONS_SAMPLEEDITOR DIALOGEX 0, 0, 286, 269 +STYLE DS_SETFONT | DS_3DLOOK | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "Samples" +FONT 8, "MS Shell Dlg", 400, 0, 0x1 +BEGIN + GROUPBOX "Sample Editor",IDC_STATIC,6,6,270,138 + LTEXT "Sample Undo Buffer:",IDC_STATIC,12,20,78,8 + EDITTEXT IDC_EDIT_UNDOSIZE,114,18,42,12,ES_AUTOHSCROLL | ES_NUMBER + LTEXT "%",IDC_UNDOSIZE,162,20,108,16 + LTEXT "Frequency Finetune Steps:",IDC_STATIC,12,38,114,8 + EDITTEXT IDC_EDIT_FINETUNE,114,36,42,12,ES_AUTOHSCROLL | ES_NUMBER + LTEXT "Hz",IDC_STATIC,162,38,30,8 + LTEXT "Default Sample Format:",IDC_STATIC,12,56,102,8 + COMBOBOX IDC_DEFAULT_FORMAT,114,54,42,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + LTEXT "FLAC Compression Level:",IDC_STATIC,12,74,90,8 + EDITTEXT IDC_FLAC_COMPRESSION,114,72,42,12,ES_AUTOHSCROLL | ES_NUMBER + CONTROL "",IDC_SPIN1,"msctls_updown32",UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,150,72,11,11 + LTEXT "Note Cuts:",IDC_STATIC,12,90,252,12 + CONTROL "On New Note",IDC_RADIO1,"Button",BS_AUTORADIOBUTTON,18,102,246,12 + CONTROL "On Key Release",IDC_RADIO2,"Button",BS_AUTORADIOBUTTON,18,114,246,12 + CONTROL "Press Again",IDC_RADIO3,"Button",BS_AUTORADIOBUTTON,18,126,246,12 + GROUPBOX "Instrument Editor",IDC_STATIC,6,150,270,48 + CONTROL "Compress ITI Files",IDC_COMPRESS_ITI,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,162,258,12 + LTEXT "Default Plugin Volume Command Handling:",IDC_STATIC,12,182,150,8 + COMBOBOX IDC_VOLUME_HANDLING,162,180,78,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + GROUPBOX "Common",IDC_STATIC,6,204,270,48 + CONTROL "Preview Samples / Instruments in File Browser",IDC_PREVIEW_SAMPLES, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,217,258,12 + CONTROL "Normalize 24-/32-bit Samples on Load",IDC_NORMALIZE, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,234,258,12 +END + IDD_EDITHISTORY DIALOGEX 0, 0, 316, 185 STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Module edit history" @@ -308,6 +340,14 @@ BOTTOMMARGIN, 94 END + IDD_OPTIONS_SAMPLEEDITOR, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 279 + TOPMARGIN, 7 + BOTTOMMARGIN, 262 + END + IDD_EDITHISTORY, DIALOG BEGIN LEFTMARGIN, 7 Modified: trunk/OpenMPT/mptrack/resource.h =================================================================== --- trunk/OpenMPT/mptrack/resource.h 2014-02-23 19:53:03 UTC (rev 3763) +++ trunk/OpenMPT/mptrack/resource.h 2014-02-23 20:45:52 UTC (rev 3764) @@ -132,7 +132,8 @@ #define IDD_AUTOTUNE 531 #define IDD_INPUT 532 #define IDD_CLIPBOARD 533 -#define IDD_OPTIONS_ADVANCED 540 +#define IDD_OPTIONS_ADVANCED 534 +#define IDD_OPTIONS_SAMPLEEDITOR 535 #define IDC_BUTTON1 1001 #define IDC_BUTTON2 1002 #define IDC_BUTTON3 1003 @@ -926,6 +927,15 @@ #define IDC_FIND 2438 #define IDC_PITCHWHEELDEPTH 2439 #define IDC_PROMPT 2440 +#define IDC_EDIT_FINETUNE 2441 +#define IDC_EDIT_UNDOSIZE 2442 +#define IDC_FLAC_COMPRESSION 2443 +#define IDC_DEFAULT_FORMAT 2444 +#define IDC_COMPRESS_ITI 2445 +#define IDC_PREVIEW_SAMPLES 2446 +#define IDC_VOLUME_HANDLING 2447 +#define IDC_NORMALIZE 2448 +#define IDC_UNDOSIZE 2449 #define IDC_SLIDER_NUMBUFFERS 2454 #define IDC_EDIT_STATISTICS 2455 #define IDC_VUMETER 2456 @@ -1229,7 +1239,7 @@ #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_3D_CONTROLS 1 -#define _APS_NEXT_RESOURCE_VALUE 541 +#define _APS_NEXT_RESOURCE_VALUE 536 #define _APS_NEXT_COMMAND_VALUE 44643 #define _APS_NEXT_CONTROL_VALUE 2479 #define _APS_NEXT_SYMED_VALUE 901 Modified: trunk/OpenMPT/soundlib/SampleFormats.cpp =================================================================== --- trunk/OpenMPT/soundlib/SampleFormats.cpp 2014-02-23 19:53:03 UTC (rev 3763) +++ trunk/OpenMPT/soundlib/SampleFormats.cpp 2014-02-23 20:45:52 UTC (rev 3764) @@ -2179,7 +2179,7 @@ FLAC__stream_encoder_set_total_samples_estimate(encoder, sample.nLength); FLAC__stream_encoder_set_metadata(encoder, metadata, writeLoopData ? 3 : 2); #ifdef MODPLUG_TRACKER - FLAC__stream_encoder_set_compression_level(encoder, TrackerSettings::Instance().SampleEditorFLACCompressionLevel); + FLAC__stream_encoder_set_compression_level(encoder, TrackerSettings::Instance().m_FLACCompressionLevel); #endif // MODPLUG_TRACKER encoder.f = mpt_fopen(filename, "wb"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2014-02-23 22:43:46
|
Revision: 3765 http://sourceforge.net/p/modplug/code/3765 Author: saga-games Date: 2014-02-23 22:43:39 +0000 (Sun, 23 Feb 2014) Log Message: ----------- [Imp] Add SSE3 implementation for sample autotuner (for big samples, this doubles the processing speed for me) [Mod] Added command line switch /noAssembly which turns off MMX/SSE/3DNow!-accelerated code Modified Paths: -------------- trunk/OpenMPT/common/BuildSettings.h trunk/OpenMPT/mptrack/Autotune.cpp trunk/OpenMPT/mptrack/Autotune.h trunk/OpenMPT/mptrack/Mptrack.cpp Modified: trunk/OpenMPT/common/BuildSettings.h =================================================================== --- trunk/OpenMPT/common/BuildSettings.h 2014-02-23 20:45:52 UTC (rev 3764) +++ trunk/OpenMPT/common/BuildSettings.h 2014-02-23 22:43:39 UTC (rev 3765) @@ -40,7 +40,7 @@ #ifdef _M_IX86 -// Generate general x86 inline assembly. +// Generate general x86 inline assembly / intrinsics. #define ENABLE_X86 // Generate inline assembly using MMX instructions (only used when the CPU supports it). @@ -49,7 +49,7 @@ // Generate inline assembly using SSE instructions (only used when the CPU supports it). #define ENABLE_SSE -// Generate inline assembly using SSE2 instructions (only used when the CPU supports it). +// Generate inline assembly using SSE2/SSE3 instructions (only used when the CPU supports it). #define ENABLE_SSE2 // Generate inline assembly using AMD specific instruction set extensions (only used when the CPU supports it). @@ -57,10 +57,10 @@ #elif defined(_M_X64) -// Generate general x64 inline assembly. +// Generate general x64 inline assembly / intrinsics. #define ENABLE_X64 -// Generate inline assembly using SSE2 instructions (only used when the CPU supports it). +// Generate inline assembly using SSE2/SSE3 instructions (only used when the CPU supports it). #define ENABLE_SSE2 #endif Modified: trunk/OpenMPT/mptrack/Autotune.cpp =================================================================== --- trunk/OpenMPT/mptrack/Autotune.cpp 2014-02-23 20:45:52 UTC (rev 3764) +++ trunk/OpenMPT/mptrack/Autotune.cpp 2014-02-23 22:43:39 UTC (rev 3765) @@ -14,6 +14,9 @@ #include "../common/thread.h" #include "../soundlib/Sndfile.h" #include "Autotune.h" +#ifdef ENABLE_SSE2 +#include <emmintrin.h> +#endif // The more bins, the more autocorrelations are done and the more precise the result is. @@ -66,16 +69,16 @@ const T* sample = origSample + pos; - int16 data = 0; // Enough for 256 channels... :) + int32 data = 0; // More than enough for 256 channels... :) for(uint8 chn = 0; chn < channels; chn++) { // We only want the MSB. - data += static_cast<int16>(sample[chn] >> ((sizeof(T) - 1) * 8)); + data += static_cast<int32>(sample[chn] >> ((sizeof(T) - 1) * 8)); } data /= channels; - sampleData[i] = static_cast<int8>(data); + sampleData[i] = static_cast<int16>(data); } } @@ -109,12 +112,13 @@ // We should analyse at least a one second (= GetSampleRate() samples) long sample. sampleLength = std::max<SmpLength>(sampleLoopEnd, sample.GetSampleRate(modType)) + maxShift; + sampleLength = (sampleLength + 7) & ~7; if(sampleData != nullptr) { delete[] sampleData; } - sampleData = new (std::nothrow) int8[sampleLength]; + sampleData = new int16[sampleLength]; if(sampleData == nullptr) { return false; @@ -148,18 +152,21 @@ { std::vector<uint64> histogram; double pitchReference; - int8 *sampleData; + int16 *sampleData; SmpLength processLength; uint32 sampleFreq; int startNote, endNote; - }; + DWORD WINAPI Autotune::AutotuneThread(void *i) //-------------------------------------------- { AutotuneThreadData &info = *static_cast<AutotuneThreadData *>(i); info.histogram.resize(HISTORY_BINS, 0); +#ifdef ENABLE_SSE2 + const bool useSSE = (ProcSupport & PROCSUPPORT_SSE3) != 0; +#endif // Do autocorrelation and save results in a note histogram (restriced to one octave). for(int note = info.startNote, noteBin = note; note < info.endNote; note++, noteBin++) @@ -173,13 +180,35 @@ const SmpLength autocorrShift = NoteToShift(info.sampleFreq, note, info.pitchReference); uint64 autocorrSum = 0; - const int8 *normalData = info.sampleData; - const int8 *shiftedData = info.sampleData + autocorrShift; - // Add up squared differences of all values - for(SmpLength i = info.processLength; i != 0; i--, normalData++, shiftedData++) + +#ifdef ENABLE_SSE2 + if(useSSE) { - autocorrSum += (*normalData - *shiftedData) * (*normalData - *shiftedData); + const __m128i *normalData = reinterpret_cast<const __m128i *>(info.sampleData); + const __m128i *shiftedData = reinterpret_cast<const __m128i *>(info.sampleData + autocorrShift); + for(SmpLength i = info.processLength / 8; i != 0; i--) + { + __m128i normal = _mm_load_si128(normalData++); + __m128i shifted = _mm_loadu_si128(shiftedData++); + __m128i diff = _mm_sub_epi16(normal, shifted); // 8 16-bit differences + __m128i squares = _mm_madd_epi16(diff, diff); // Multiply and add: 4 32-bit squares + squares = _mm_hadd_epi32(squares, squares); // This is SSE3! + squares = _mm_hadd_epi32(squares, squares); + autocorrSum += _mm_cvtsi128_si32(squares); + //autocorrSum += squares.m128i_i32[0] +squares.m128i_i32[1] + squares.m128i_i32[2] + squares.m128i_i32[3]; // For SSE2 only + } + } else +#endif + { + const int16 *normalData = info.sampleData; + const int16 *shiftedData = info.sampleData + autocorrShift; + // Add up squared differences of all values + for(SmpLength i = info.processLength; i != 0; i--, normalData++, shiftedData++) + { + autocorrSum += (*normalData - *shiftedData) * (*normalData - *shiftedData); + } } + info.histogram[noteBin] += autocorrSum; } return 0; Modified: trunk/OpenMPT/mptrack/Autotune.h =================================================================== --- trunk/OpenMPT/mptrack/Autotune.h 2014-02-23 20:45:52 UTC (rev 3764) +++ trunk/OpenMPT/mptrack/Autotune.h 2014-02-23 22:43:39 UTC (rev 3765) @@ -23,7 +23,7 @@ SmpLength selectionStart, selectionEnd; - int8 *sampleData; + int16 *sampleData; SmpLength sampleLength; public: Modified: trunk/OpenMPT/mptrack/Mptrack.cpp =================================================================== --- trunk/OpenMPT/mptrack/Mptrack.cpp 2014-02-23 20:45:52 UTC (rev 3764) +++ trunk/OpenMPT/mptrack/Mptrack.cpp 2014-02-23 22:43:39 UTC (rev 3765) @@ -317,12 +317,13 @@ { if ((lpszParam) && (bFlag)) { - if (!lstrcmpi(lpszParam, "nologo")) { m_bShowSplash = FALSE; return; } else - if (!lstrcmpi(lpszParam, "nodls")) { m_bNoDls = true; return; } else - if (!lstrcmpi(lpszParam, "noplugs")) { m_bNoPlugins = true; return; } else - if (!lstrcmpi(lpszParam, "portable")) { m_bPortable = true; return; } else - if (!lstrcmpi(lpszParam, "noSettingsOnNewVersion")) { m_bNoSettingsOnNewVersion = true; return; } - if (!lstrcmpi(lpszParam, "fullMemDump")) { ExceptionHandler::fullMemDump = true; return; } + if (!lstrcmpi(lpszParam, _T("nologo"))) { m_bShowSplash = FALSE; return; } else + if (!lstrcmpi(lpszParam, _T("nodls"))) { m_bNoDls = true; return; } else + if (!lstrcmpi(lpszParam, _T("noplugs"))) { m_bNoPlugins = true; return; } else + if (!lstrcmpi(lpszParam, _T("portable"))) { m_bPortable = true; return; } else + if (!lstrcmpi(lpszParam, _T("noSettingsOnNewVersion"))) { m_bNoSettingsOnNewVersion = true; return; } + if (!lstrcmpi(lpszParam, _T("fullMemDump"))) { ExceptionHandler::fullMemDump = true; return; } + if (!lstrcmpi(lpszParam, _T("noAssembly"))) { ProcSupport = 0; return; } } CCommandLineInfo::ParseParam(lpszParam, bFlag, bLast); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <man...@us...> - 2014-02-24 19:10:49
|
Revision: 3768 http://sourceforge.net/p/modplug/code/3768 Author: manxorist Date: 2014-02-24 19:10:40 +0000 (Mon, 24 Feb 2014) Log Message: ----------- [Ref] Split ENABLE_SSE3 from ENABLE_SSE2. Modified Paths: -------------- trunk/OpenMPT/common/BuildSettings.h trunk/OpenMPT/mptrack/Autotune.cpp Modified: trunk/OpenMPT/common/BuildSettings.h =================================================================== --- trunk/OpenMPT/common/BuildSettings.h 2014-02-23 23:39:18 UTC (rev 3767) +++ trunk/OpenMPT/common/BuildSettings.h 2014-02-24 19:10:40 UTC (rev 3768) @@ -49,9 +49,12 @@ // Generate inline assembly using SSE instructions (only used when the CPU supports it). #define ENABLE_SSE -// Generate inline assembly using SSE2/SSE3 instructions (only used when the CPU supports it). +// Generate inline assembly using SSE2 instructions (only used when the CPU supports it). #define ENABLE_SSE2 +// Generate inline assembly using SSE3 instructions (only used when the CPU supports it). +#define ENABLE_SSE3 + // Generate inline assembly using AMD specific instruction set extensions (only used when the CPU supports it). #define ENABLE_X86_AMD @@ -60,9 +63,12 @@ // Generate general x64 inline assembly / intrinsics. #define ENABLE_X64 -// Generate inline assembly using SSE2/SSE3 instructions (only used when the CPU supports it). +// Generate inline assembly using SSE2 instructions (only used when the CPU supports it). #define ENABLE_SSE2 +// Generate inline assembly using SSE3 instructions (only used when the CPU supports it). +#define ENABLE_SSE3 + #endif #endif // ENABLE_ASM Modified: trunk/OpenMPT/mptrack/Autotune.cpp =================================================================== --- trunk/OpenMPT/mptrack/Autotune.cpp 2014-02-23 23:39:18 UTC (rev 3767) +++ trunk/OpenMPT/mptrack/Autotune.cpp 2014-02-24 19:10:40 UTC (rev 3768) @@ -14,7 +14,7 @@ #include "../common/thread.h" #include "../soundlib/Sndfile.h" #include "Autotune.h" -#ifdef ENABLE_SSE2 +#ifdef ENABLE_SSE3 #include <emmintrin.h> #endif @@ -164,7 +164,7 @@ { AutotuneThreadData &info = *static_cast<AutotuneThreadData *>(i); info.histogram.resize(HISTORY_BINS, 0); -#ifdef ENABLE_SSE2 +#ifdef ENABLE_SSE3 const bool useSSE = (ProcSupport & PROCSUPPORT_SSE3) != 0; #endif @@ -181,7 +181,7 @@ uint64 autocorrSum = 0; -#ifdef ENABLE_SSE2 +#ifdef ENABLE_SSE3 if(useSSE) { const __m128i *normalData = reinterpret_cast<const __m128i *>(info.sampleData); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |