From: <sag...@us...> - 2013-03-11 15:49:42
|
Revision: 1559 http://sourceforge.net/p/modplug/code/1559 Author: saga-games Date: 2013-03-11 15:49:33 +0000 (Mon, 11 Mar 2013) Log Message: ----------- [Ref] A lot of small refactoring in the pattern editor (flagsets and rearranging stuff) Modified Paths: -------------- trunk/OpenMPT/common/FlagSet.h trunk/OpenMPT/mptrack/Ctrl_pat.cpp trunk/OpenMPT/mptrack/Draw_pat.cpp trunk/OpenMPT/mptrack/PatternEditorDialogs.cpp trunk/OpenMPT/mptrack/PatternEditorDialogs.h trunk/OpenMPT/mptrack/View_pat.cpp trunk/OpenMPT/mptrack/View_pat.h Modified: trunk/OpenMPT/common/FlagSet.h =================================================================== --- trunk/OpenMPT/common/FlagSet.h 2013-03-11 14:13:23 UTC (rev 1558) +++ trunk/OpenMPT/common/FlagSet.h 2013-03-11 15:49:33 UTC (rev 1559) @@ -152,14 +152,17 @@ }; +// Declare typesafe logical operators for flag set +#define DECLARE_FLAGSET(enum_t) \ + inline enum_t operator | (enum_t a, enum_t b) { return static_cast<enum_t>(+a | +b); } \ + inline enum_t operator & (enum_t a, enum_t b) { return static_cast<enum_t>(+a & +b); } \ + inline enum_t &operator &= (enum_t &a, enum_t b) { a = (a & b); return a; } \ + inline enum_t &operator |= (enum_t &a, enum_t b) { a = (a | b); return a; } \ + inline enum_t operator ~ (enum_t a) { return static_cast<enum_t>(~(+a)); } + // Declaration of a typesafe flag set enum. // Usage: FLAGSET(enumName) { foo = 1, bar = 2, ... } #define FLAGSET(enum_t) \ enum enum_t; \ - /* Declare typesafe logical operators for flag set */ \ - inline enum_t operator | (enum_t a, enum_t b) { return static_cast<enum_t>(+a | +b); } \ - inline enum_t operator & (enum_t a, enum_t b) { return static_cast<enum_t>(+a & +b); } \ - inline enum_t &operator &= (enum_t &a, enum_t b) { a = (a & b); return a; } \ - inline enum_t &operator |= (enum_t &a, enum_t b) { a = (a | b); return a; } \ - inline enum_t operator ~ (enum_t a) { return static_cast<enum_t>(~(+a)); } \ + DECLARE_FLAGSET(enum_t) \ enum enum_t Modified: trunk/OpenMPT/mptrack/Ctrl_pat.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_pat.cpp 2013-03-11 14:13:23 UTC (rev 1558) +++ trunk/OpenMPT/mptrack/Ctrl_pat.cpp 2013-03-11 15:49:33 UTC (rev 1559) @@ -15,9 +15,9 @@ #include "childfrm.h" #include "moddoc.h" #include "globals.h" -#include "PatternEditorDialogs.h" #include "ctrl_pat.h" #include "view_pat.h" +#include "PatternEditorDialogs.h" #include "ChannelManagerDlg.h" #include "../common/StringFixer.h" #include "MIDIMacroDialog.h" Modified: trunk/OpenMPT/mptrack/Draw_pat.cpp =================================================================== --- trunk/OpenMPT/mptrack/Draw_pat.cpp 2013-03-11 14:13:23 UTC (rev 1558) +++ trunk/OpenMPT/mptrack/Draw_pat.cpp 2013-03-11 15:49:33 UTC (rev 1559) @@ -200,8 +200,8 @@ int oldx = m_szCell.cx; m_szHeader.cx = ROWHDR_WIDTH; m_szHeader.cy = COLHDR_HEIGHT; - if (m_dwStatus & psShowVUMeters) m_szHeader.cy += VUMETERS_HEIGHT; - if (m_dwStatus & psShowPluginNames) m_szHeader.cy += PLUGNAME_HEIGHT; + if(m_Status[psShowVUMeters]) m_szHeader.cy += VUMETERS_HEIGHT; + if(m_Status[psShowPluginNames]) m_szHeader.cy += PLUGNAME_HEIGHT; m_szCell.cx = 4 + pfnt->nEltWidths[0]; if (m_nDetailLevel >= PatternCursor::instrColumn) m_szCell.cx += pfnt->nEltWidths[1]; if (m_nDetailLevel >= PatternCursor::volumeColumn) m_szCell.cx += pfnt->nEltWidths[2]; @@ -590,7 +590,7 @@ pModDoc->IsChannelRecord(static_cast<CHANNELINDEX>(ncolhdr)) ? DT_RIGHT : DT_CENTER); // When dragging around channel headers, mark insertion position - if(m_bDragging && !m_bInItemRect + if(m_Status[psDragging] && !m_bInItemRect && (m_nDragItem & DRAGITEM_MASK) == DRAGITEM_CHNHEADER && (m_nDropItem & DRAGITEM_MASK) == DRAGITEM_CHNHEADER && (m_nDropItem & DRAGITEM_VALUEMASK) == ncolhdr) @@ -599,7 +599,7 @@ r.top = rect.top; r.bottom = rect.bottom; // Drop position depends on whether hovered channel is left or right of dragged item. - r.left = ((m_nDropItem & DRAGITEM_VALUEMASK) < (m_nDragItem & DRAGITEM_VALUEMASK) || m_bShiftDragging) ? rect.left : rect.right - 2; + r.left = ((m_nDropItem & DRAGITEM_VALUEMASK) < (m_nDragItem & DRAGITEM_VALUEMASK) || m_Status[psShiftDragging]) ? rect.left : rect.right - 2; r.right = r.left + 2; ::FillRect(hdc, &r, CMainFrame::brushText); } @@ -632,14 +632,14 @@ } // -! NEW_FEATURE#0012 - if (m_dwStatus & psShowVUMeters) + if(m_Status[psShowVUMeters]) { OldVUMeters[ncolhdr] = 0; DrawChannelVUMeter(hdc, rect.left + 1, rect.bottom, ncolhdr); rect.top+=VUMETERS_HEIGHT; rect.bottom+=VUMETERS_HEIGHT; } - if (m_dwStatus & psShowPluginNames) + if(m_Status[psShowPluginNames]) { rect.top+=PLUGNAME_HEIGHT; rect.bottom+=PLUGNAME_HEIGHT; @@ -755,7 +755,7 @@ DrawButtonRect(hdc, &rc, ""); } // Drawing pattern selection - if (m_dwStatus & psDragnDropping) + if(m_Status[psDragnDropping]) { DrawDragSel(hdc); } @@ -883,12 +883,12 @@ } if (row == GetCurrentRow()) { - if (m_dwStatus & psFocussed) + if(m_Status[psFocussed]) { row_col = MODCOLOR_TEXTCURROW; row_bkcol = MODCOLOR_BACKCURROW; } else - if ((m_dwStatus & psFollowSong) && (isPlaying)) + if(m_Status[psFollowSong] && isPlaying) { row_col = MODCOLOR_TEXTPLAYCURSOR; row_bkcol = MODCOLOR_BACKPLAYCURSOR; @@ -1429,9 +1429,9 @@ void CViewPattern::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar) //--------------------------------------------------------------------------- { - if (nSBCode == (SB_THUMBTRACK|SB_THUMBPOSITION)) m_dwStatus |= psDragVScroll; + if (nSBCode == (SB_THUMBTRACK|SB_THUMBPOSITION)) m_Status.set(psDragVScroll); CModScrollView::OnVScroll(nSBCode, nPos, pScrollBar); - if (nSBCode == SB_ENDSCROLL) m_dwStatus &= ~psDragVScroll; + if (nSBCode == SB_ENDSCROLL) m_Status.reset(psDragVScroll); } @@ -1576,9 +1576,9 @@ { nChn = m_Cursor.GetChannel(); s[0] = 0; - if ((!(m_dwStatus & (psKeyboardDragSelect/*|PATSTATUS_MOUSEDRAGSEL*/))) //rewbs.xinfo: update indicator even when dragging - && (m_Selection.GetUpperLeft() == m_Selection.GetLowerRight()) && (pSndFile->Patterns[m_nPattern]) - && (GetCurrentRow() < pSndFile->Patterns[m_nPattern].GetNumRows()) && (nChn < pSndFile->m_nChannels)) + if(!m_Status[psKeyboardDragSelect] + && (m_Selection.GetUpperLeft() == m_Selection.GetLowerRight()) && (pSndFile->Patterns[m_nPattern]) + && (GetCurrentRow() < pSndFile->Patterns[m_nPattern].GetNumRows()) && (nChn < pSndFile->m_nChannels)) { const ModCommand *m = pSndFile->Patterns[m_nPattern].GetpModCommand(GetCurrentRow(), nChn); Modified: trunk/OpenMPT/mptrack/PatternEditorDialogs.cpp =================================================================== --- trunk/OpenMPT/mptrack/PatternEditorDialogs.cpp 2013-03-11 14:13:23 UTC (rev 1558) +++ trunk/OpenMPT/mptrack/PatternEditorDialogs.cpp 2013-03-11 15:49:33 UTC (rev 1559) @@ -12,8 +12,9 @@ #include "stdafx.h" #include "mptrack.h" #include "Mainfrm.h" +#include "Moddoc.h" +#include "view_pat.h" #include "PatternEditorDialogs.h" -#include "view_pat.h" // -> CODE#0010 @@ -125,27 +126,27 @@ CSoundFile *pSndFile; CPropertyPage::OnInitDialog(); - if (!m_pModDoc) return TRUE; + if(!m_pModDoc) return TRUE; pSndFile = m_pModDoc->GetSoundFile(); // Search flags - if (m_dwFlags & PATSEARCH_NOTE) CheckDlgButton(IDC_CHECK1, MF_CHECKED); - if (m_dwFlags & PATSEARCH_INSTR) CheckDlgButton(IDC_CHECK2, MF_CHECKED); - if (m_dwFlags & PATSEARCH_VOLCMD) CheckDlgButton(IDC_CHECK3, MF_CHECKED); - if (m_dwFlags & PATSEARCH_VOLUME) CheckDlgButton(IDC_CHECK4, MF_CHECKED); - if (m_dwFlags & PATSEARCH_COMMAND) CheckDlgButton(IDC_CHECK5, MF_CHECKED); - if (m_dwFlags & PATSEARCH_PARAM) CheckDlgButton(IDC_CHECK6, MF_CHECKED); - if (m_bReplace) + CheckDlgButton(IDC_CHECK1, m_Flags[FindReplace::Note] ? MF_CHECKED : MF_UNCHECKED); + CheckDlgButton(IDC_CHECK2, m_Flags[FindReplace::Instr] ? MF_CHECKED : MF_UNCHECKED); + CheckDlgButton(IDC_CHECK3, m_Flags[FindReplace::VolCmd] ? MF_CHECKED : MF_UNCHECKED); + CheckDlgButton(IDC_CHECK4, m_Flags[FindReplace::Volume] ? MF_CHECKED : MF_UNCHECKED); + CheckDlgButton(IDC_CHECK5, m_Flags[FindReplace::Command] ? MF_CHECKED : MF_UNCHECKED); + CheckDlgButton(IDC_CHECK6, m_Flags[FindReplace::Param] ? MF_CHECKED : MF_UNCHECKED); + if(m_bReplace) { - if (m_dwFlags & PATSEARCH_REPLACE) CheckDlgButton(IDC_CHECK7, MF_CHECKED); - if (m_dwFlags & PATSEARCH_REPLACEALL) CheckDlgButton(IDC_CHECK8, MF_CHECKED); + CheckDlgButton(IDC_CHECK7, m_Flags[FindReplace::Replace] ? MF_CHECKED : MF_UNCHECKED); + CheckDlgButton(IDC_CHECK8, m_Flags[FindReplace::ReplaceAll] ? MF_CHECKED : MF_UNCHECKED); } else { - if (m_dwFlags & PATSEARCH_CHANNEL) CheckDlgButton(IDC_CHECK7, MF_CHECKED); + CheckDlgButton(IDC_CHECK7, m_Flags[FindReplace::InChannels] ? MF_CHECKED : MF_UNCHECKED); int nButton = IDC_RADIO1; - if((m_dwFlags & PATSEARCH_FULLSEARCH)) + if(m_Flags[FindReplace::FullSearch]) { nButton = IDC_RADIO2; - } else if(/*(m_dwFlags & PATSEARCH_PATSELECTION) &&*/ m_bPatSel) + } else if(m_bPatSel) { nButton = IDC_RADIO3; } @@ -360,22 +361,22 @@ CComboBox *combo; // Search flags - m_dwFlags = 0; - if (IsDlgButtonChecked(IDC_CHECK1)) m_dwFlags |= PATSEARCH_NOTE; - if (IsDlgButtonChecked(IDC_CHECK2)) m_dwFlags |= PATSEARCH_INSTR; - if (IsDlgButtonChecked(IDC_CHECK3)) m_dwFlags |= PATSEARCH_VOLCMD; - if (IsDlgButtonChecked(IDC_CHECK4)) m_dwFlags |= PATSEARCH_VOLUME; - if (IsDlgButtonChecked(IDC_CHECK5)) m_dwFlags |= PATSEARCH_COMMAND; - if (IsDlgButtonChecked(IDC_CHECK6)) m_dwFlags |= PATSEARCH_PARAM; - if (m_bReplace) + m_Flags.reset(); + m_Flags.set(FindReplace::Note, !!IsDlgButtonChecked(IDC_CHECK1)); + m_Flags.set(FindReplace::Instr, !!IsDlgButtonChecked(IDC_CHECK2)); + m_Flags.set(FindReplace::VolCmd, !!IsDlgButtonChecked(IDC_CHECK3)); + m_Flags.set(FindReplace::Volume, !!IsDlgButtonChecked(IDC_CHECK4)); + m_Flags.set(FindReplace::Command, !!IsDlgButtonChecked(IDC_CHECK5)); + m_Flags.set(FindReplace::Param, !!IsDlgButtonChecked(IDC_CHECK6)); + if(m_bReplace) { - if (IsDlgButtonChecked(IDC_CHECK7)) m_dwFlags |= PATSEARCH_REPLACE; - if (IsDlgButtonChecked(IDC_CHECK8)) m_dwFlags |= PATSEARCH_REPLACEALL; + m_Flags.set(FindReplace::Replace, !!IsDlgButtonChecked(IDC_CHECK7)); + m_Flags.set(FindReplace::ReplaceAll, !!IsDlgButtonChecked(IDC_CHECK8)); } else { - if (IsDlgButtonChecked(IDC_CHECK7)) m_dwFlags |= PATSEARCH_CHANNEL; - if (IsDlgButtonChecked(IDC_RADIO2)) m_dwFlags |= PATSEARCH_FULLSEARCH; - if (IsDlgButtonChecked(IDC_RADIO3)) m_dwFlags |= PATSEARCH_PATSELECTION; + m_Flags.set(FindReplace::InChannels, !!IsDlgButtonChecked(IDC_CHECK7)); + m_Flags.set(FindReplace::FullSearch, !!IsDlgButtonChecked(IDC_RADIO2)); + m_Flags.set(FindReplace::InPatSelection, !!IsDlgButtonChecked(IDC_RADIO3)); } // Note if ((combo = (CComboBox *)GetDlgItem(IDC_COMBO1)) != NULL) Modified: trunk/OpenMPT/mptrack/PatternEditorDialogs.h =================================================================== --- trunk/OpenMPT/mptrack/PatternEditorDialogs.h 2013-03-11 14:13:23 UTC (rev 1558) +++ trunk/OpenMPT/mptrack/PatternEditorDialogs.h 2013-03-11 15:49:33 UTC (rev 1559) @@ -19,18 +19,6 @@ ///////////////////////////////////////////////////////////////////////// // Search/Replace -#define PATSEARCH_NOTE 0x01 // Search for note -#define PATSEARCH_INSTR 0x02 // Search for instrument -#define PATSEARCH_VOLCMD 0x04 // Search for volume effect -#define PATSEARCH_VOLUME 0x08 // Search for volume -#define PATSEARCH_COMMAND 0x10 // Search for effect -#define PATSEARCH_PARAM 0x20 // Search for effect parameter -#define PATSEARCH_CHANNEL 0x40 // Limit search to channels -#define PATSEARCH_FULLSEARCH 0x100 // Search whole song -#define PATSEARCH_PATSELECTION 0x200 // Search in current pattern selection -#define PATSEARCH_REPLACE 0x400 // Replace -#define PATSEARCH_REPLACEALL 0x800 // Replace all - //========================================= class CFindReplaceTab: public CPropertyPage //========================================= @@ -41,11 +29,11 @@ EffectInfo effectInfo; public: + FlagSet<FindReplace::Flags> m_Flags; UINT m_nNote, m_nInstr, m_nVolCmd, m_nVol, m_nCommand, m_nParam; CHANNELINDEX m_nMinChannel, m_nMaxChannel; signed char cInstrRelChange; bool m_bPatSel; - DWORD m_dwFlags; enum findItem { Modified: trunk/OpenMPT/mptrack/View_pat.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_pat.cpp 2013-03-11 14:13:23 UTC (rev 1558) +++ trunk/OpenMPT/mptrack/View_pat.cpp 2013-03-11 15:49:33 UTC (rev 1559) @@ -33,13 +33,13 @@ #pragma warning(disable:4244) //"conversion from 'type1' to 'type2', possible loss of data" -FindReplaceStruct CViewPattern::m_findReplace = +FindReplace CViewPattern::m_findReplace = { ModCommand::Empty(), ModCommand::Empty(), - PATSEARCH_FULLSEARCH, PATSEARCH_REPLACEALL, + FlagSet<FindReplace::Flags>(FindReplace::FullSearch), FlagSet<FindReplace::Flags>(FindReplace::ReplaceAll), + PatternRect(), 0, 0, - 0, - PatternRect() + 0 }; // Static initializers @@ -170,18 +170,13 @@ // -> DESC="midi keyboard split" memset(splitActiveNoteChannel, 0xFF, sizeof(splitActiveNoteChannel)); memset(activeNoteChannel, 0xFF, sizeof(activeNoteChannel)); - oldrow = -1; - oldchn = -1; - oldsplitchn = -1; m_nPlayPat = PATTERNINDEX_INVALID; m_nPlayRow = 0; m_nMidRow = 0; m_nDragItem = 0; - m_bDragging = false; m_bInItemRect = false; m_bContinueSearch = false; - //m_dwStatus = 0; - m_dwStatus = psShowPluginNames; + m_Status = psShowPluginNames; m_nXScroll = m_nYScroll = 0; m_nPattern = 0; m_nSpacing = 0; @@ -271,7 +266,7 @@ { if ((int)row < 0) { - if (m_dwStatus & (psKeyboardDragSelect|psMouseDragSelect)) + if(m_Status[psKeyboardDragSelect | psMouseDragSelect]) { row = 0; } else @@ -299,7 +294,7 @@ } else //row >= 0 if (row >= pSndFile->Patterns[m_nPattern].GetNumRows()) { - if(m_dwStatus & (psKeyboardDragSelect|psMouseDragSelect)) + if(m_Status[psKeyboardDragSelect | psMouseDragSelect]) { row = pSndFile->Patterns[m_nPattern].GetNumRows()-1; } else if(CMainFrame::GetSettings().m_dwPatternSetup & PATTERN_CONTSCROLL) @@ -341,7 +336,7 @@ InvalidateRow(); PatternCursor selStart(m_Cursor); - if((m_dwStatus & (psKeyboardDragSelect | psMouseDragSelect)) && (!(m_dwStatus & psDragnDropEdit))) + if(m_Status[psKeyboardDragSelect | psMouseDragSelect] && !m_Status[psDragnDropEdit]) { selStart.Set(m_StartSel); } @@ -371,7 +366,7 @@ PatternCursor selStart(m_Cursor); - if((m_dwStatus & (psKeyboardDragSelect | psMouseDragSelect)) && (!(m_dwStatus & psDragnDropEdit))) + if(m_Status[psKeyboardDragSelect | psMouseDragSelect] && !m_Status[psDragnDropEdit]) { selStart = m_StartSel; } @@ -500,7 +495,7 @@ const CHANNELINDEX nmax = pSndFile->GetNumChannels(); // Checking channel headers //rewbs.patPlugNames - if (m_dwStatus & psShowPluginNames) + if (m_Status[psShowPluginNames]) { n = xofs; for(UINT ihdr=0; n<nmax; ihdr++, n++) @@ -708,7 +703,7 @@ { // Open quick channel properties dialog if we're middle-clicking a channel header. CPoint point(GET_X_LPARAM(pMsg->lParam), GET_Y_LPARAM(pMsg->lParam)); - if(point.y < m_szHeader.cy - ((m_dwStatus & psShowPluginNames) ? PLUGNAME_HEIGHT : 0)) + if(point.y < m_szHeader.cy - (m_Status[psShowPluginNames] ? PLUGNAME_HEIGHT : 0)) { PatternCursor cursor = GetPositionFromPoint(point); if(cursor.GetChannel() < GetDocument()->GetNumChannels()) @@ -767,7 +762,7 @@ //------------------------------------------ { CScrollView::OnSetFocus(pOldWnd); - m_dwStatus |= psFocussed; + m_Status.set(psFocussed); InvalidateRow(); CModDoc *pModDoc = GetDocument(); if (pModDoc) @@ -783,14 +778,7 @@ { CScrollView::OnKillFocus(pNewWnd); - //rewbs.customKeys - //Unset all selection - m_dwStatus &= ~psKeyboardDragSelect; - m_dwStatus &= ~psCtrlDragSelect; -// CMainFrame::GetMainFrame()->GetInputHandler()->SetModifierMask(0); - //end rewbs.customKeys - - m_dwStatus &= ~psFocussed; + m_Status.reset(psKeyboardDragSelect | psCtrlDragSelect | psFocussed); InvalidateRow(); } @@ -1138,14 +1126,14 @@ SetFocus(); m_nDropItem = m_nDragItem = GetDragItem(point, &m_rcDragItem); - m_bDragging = true; + m_Status.set(psDragging); m_bInItemRect = true; - m_bShiftDragging = false; + m_Status.reset(psShiftDragging); PatternCursor pointCursor(GetPositionFromPoint(point)); SetCapture(); - if(point.x >= m_szHeader.cx && point.y <= m_szHeader.cy - ((m_dwStatus & psShowPluginNames) ? PLUGNAME_HEIGHT : 0)) + if(point.x >= m_szHeader.cx && point.y <= m_szHeader.cy - (m_Status[psShowPluginNames] ? PLUGNAME_HEIGHT : 0)) { // Click on channel header if (nFlags & MK_CONTROL) @@ -1157,7 +1145,7 @@ // Click on pattern data if(CMainFrame::GetInputHandler()->SelectionPressed() - && ((m_dwStatus & psShiftSelect) + && (m_Status[psShiftSelect] || m_Selection.GetUpperLeft() == m_Selection.GetLowerRight() || !m_Selection.Contains(pointCursor))) { @@ -1168,24 +1156,24 @@ // * Shift-clicking outside the current selection. // This is necessary so that selections can still be moved properly while the shift button is pressed (for copy-move). DragToSel(pointCursor, true, true); - m_dwStatus |= psShiftSelect; + m_Status.set(psShiftSelect); } else { // Set first selection point m_StartSel = pointCursor; if(m_StartSel.GetChannel() < pSndFile->GetNumChannels()) { - m_dwStatus |= psMouseDragSelect; + m_Status.set(psMouseDragSelect); - if (m_dwStatus & psCtrlDragSelect) + if(m_Status[psCtrlDragSelect]) { SetCurSel(m_StartSel); } if((CMainFrame::GetSettings().m_dwPatternSetup & PATTERN_DRAGNDROPEDIT) - && ((m_Selection.GetUpperLeft() != m_Selection.GetLowerRight()) || (m_dwStatus & psCtrlDragSelect)) + && ((m_Selection.GetUpperLeft() != m_Selection.GetLowerRight()) || m_Status[psCtrlDragSelect]) && m_Selection.Contains(m_StartSel)) { - m_dwStatus |= psDragnDropEdit; + m_Status.set(psDragnDropEdit); } else if (CMainFrame::GetSettings().m_dwPatternSetup & PATTERN_CENTERROW) { SetCurSel(m_StartSel); @@ -1204,7 +1192,7 @@ { m_StartSel.Set(pointCursor); SetCurSel(pointCursor, PatternCursor(pointCursor.GetRow(), pSndFile->GetNumChannels() - 1, PatternCursor::lastColumn)); - m_dwStatus |= psRowSelection; + m_Status.set(psRowSelection); } } @@ -1226,8 +1214,7 @@ if((CMainFrame::GetSettings().m_dwPatternSetup & PATTERN_DBLCLICKSELECT)) { OnSelectCurrentColumn(); - m_dwStatus |= psChannelSelection; - m_bDragging = true; + m_Status.set(psChannelSelection |psDragging); return; } else { @@ -1247,17 +1234,16 @@ const bool bItemSelected = m_bInItemRect || ((m_nDragItem & DRAGITEM_MASK) == DRAGITEM_CHNHEADER); if (/*(!m_bDragging) ||*/ (!pModDoc)) return; - m_bDragging = false; m_bInItemRect = false; ReleaseCapture(); - m_dwStatus &= ~(psMouseDragSelect | psRowSelection | psChannelSelection); + m_Status.reset(psMouseDragSelect | psRowSelection | psChannelSelection | psDragging); // Drag & Drop Editing - if (m_dwStatus & psDragnDropEdit) + if(m_Status[psDragnDropEdit]) { - if (m_dwStatus & psDragnDropping) + if(m_Status[psDragnDropping]) { OnDrawDragSel(); - m_dwStatus &= ~psDragnDropping; + m_Status.reset(psDragnDropping); OnDropSelection(); } @@ -1266,7 +1252,7 @@ SetCurSel(m_StartSel); } SetCursor(CMainFrame::curArrow); - m_dwStatus &= ~psDragnDropEdit; + m_Status.reset(psDragnDropEdit); } if (((m_nDragItem & DRAGITEM_MASK) != DRAGITEM_CHNHEADER) && ((m_nDragItem & DRAGITEM_MASK) != DRAGITEM_PATTERNHEADER) @@ -1393,17 +1379,17 @@ } // Handle drag n drop - if (m_dwStatus & psDragnDropEdit) + if (m_Status[psDragnDropEdit]) { - if (m_dwStatus & psDragnDropping) + if (m_Status[psDragnDropping]) { OnDrawDragSel(); - m_dwStatus &= ~psDragnDropping; + m_Status.reset(psDragnDropping); } - m_dwStatus &= ~(psDragnDropEdit|psMouseDragSelect); - if (m_bDragging) + m_Status.reset(psDragnDropEdit | psMouseDragSelect); + if(m_Status[psDragging]) { - m_bDragging = false; + m_Status.reset(psDragging); m_bInItemRect = false; ReleaseCapture(); } @@ -1442,7 +1428,7 @@ CInputHandler *ih = (CMainFrame::GetMainFrame())->GetInputHandler(); //------ Plugin Header Menu --------- : - if ((m_dwStatus & psShowPluginNames) && + if(m_Status[psShowPluginNames] && (pt.y > m_szHeader.cy-PLUGNAME_HEIGHT) && (pt.y < m_szHeader.cy)) { BuildPluginCtxMenu(hMenu, nChn, pSndFile); @@ -1534,7 +1520,7 @@ void CViewPattern::OnMouseMove(UINT nFlags, CPoint point) //------------------------------------------------------- { - if(!m_bDragging) + if(!m_Status[psDragging]) { return; } @@ -1545,7 +1531,7 @@ const CRect oldDropRect = m_rcDropItem; const DWORD oldDropItem = m_nDropItem; - m_bShiftDragging = (nFlags & MK_SHIFT) != 0; + m_Status.set(psShiftDragging, (nFlags & MK_SHIFT) != 0); m_nDropItem = GetDragItem(point, &m_rcDropItem); const bool b = (m_nDropItem == m_nDragItem); @@ -1564,7 +1550,7 @@ } } - if((m_dwStatus & psChannelSelection)) + if(m_Status[psChannelSelection]) { // Double-clicked a pattern cell to select whole channel. // Continue dragging to select more channels. @@ -1579,7 +1565,7 @@ DragToSel(endSel, true, false, false); - } else if((m_dwStatus & psRowSelection) && point.y > m_szHeader.cy) + } else if(m_Status[psRowSelection] && point.y > m_szHeader.cy) { // Mark row number => mark whole row (continue) InvalidateSelection(); @@ -1588,7 +1574,7 @@ cursor.SetColumn(GetDocument()->GetNumChannels() - 1, PatternCursor::lastColumn); DragToSel(cursor, false, true, false); - } else if(m_dwStatus & psMouseDragSelect) + } else if(m_Status[psMouseDragSelect]) { PatternCursor cursor(GetPositionFromPoint(point)); @@ -1602,21 +1588,21 @@ } // Drag & Drop editing - if (m_dwStatus & psDragnDropEdit) + if (m_Status[psDragnDropEdit]) { const bool moved = m_DragPos.GetChannel() != cursor.GetChannel() || m_DragPos.GetRow() != cursor.GetRow(); - if(!(m_dwStatus & psDragnDropping)) + if(!m_Status[psDragnDropping]) { SetCursor(CMainFrame::curDragging); } - if(!(m_dwStatus & psDragnDropping) || moved) + if(!m_Status[psDragnDropping] || moved) { - if(m_dwStatus & psDragnDropping) OnDrawDragSel(); - m_dwStatus &= ~psDragnDropping; + if(m_Status[psDragnDropping]) OnDrawDragSel(); + m_Status.reset(psDragnDropping); DragToSel(cursor, true, true, true); m_DragPos = cursor; - m_dwStatus |= psDragnDropping; + m_Status.set(psDragnDropping); OnDrawDragSel(); } } else @@ -1948,9 +1934,9 @@ pageFind.m_nVol = m_findReplace.cmdFind.vol; pageFind.m_nCommand = m_findReplace.cmdFind.command; pageFind.m_nParam = m_findReplace.cmdFind.param; - pageFind.m_dwFlags = m_findReplace.dwFindFlags; - pageFind.m_nMinChannel = m_findReplace.nFindMinChn; - pageFind.m_nMaxChannel = m_findReplace.nFindMaxChn; + pageFind.m_Flags = m_findReplace.findFlags; + pageFind.m_nMinChannel = m_findReplace.findMinChn; + pageFind.m_nMaxChannel = m_findReplace.findMaxChn; pageFind.m_bPatSel = (m_Selection.GetUpperLeft() != m_Selection.GetLowerRight()); pageReplace.m_nNote = m_findReplace.cmdReplace.note; pageReplace.m_nInstr = m_findReplace.cmdReplace.instr; @@ -1958,16 +1944,16 @@ pageReplace.m_nVol = m_findReplace.cmdReplace.vol; pageReplace.m_nCommand = m_findReplace.cmdReplace.command; pageReplace.m_nParam = m_findReplace.cmdReplace.param; - pageReplace.m_dwFlags = m_findReplace.dwReplaceFlags; - pageReplace.cInstrRelChange = m_findReplace.cInstrRelChange; + pageReplace.m_Flags = m_findReplace.replaceFlags; + pageReplace.cInstrRelChange = m_findReplace.instrRelChange; if(m_Selection.GetUpperLeft() != m_Selection.GetLowerRight()) { - pageFind.m_dwFlags |= PATSEARCH_PATSELECTION; - pageFind.m_dwFlags &= ~PATSEARCH_FULLSEARCH; + pageFind.m_Flags.set(FindReplace::InPatSelection); + pageFind.m_Flags.reset(FindReplace::FullSearch); } dlg.AddPage(&pageFind); dlg.AddPage(&pageReplace); - if (dlg.DoModal() == IDOK) + if(dlg.DoModal() == IDOK) { m_findReplace.cmdFind.note = pageFind.m_nNote; m_findReplace.cmdFind.instr = pageFind.m_nInstr; @@ -1975,17 +1961,17 @@ m_findReplace.cmdFind.vol = pageFind.m_nVol; m_findReplace.cmdFind.command = pageFind.m_nCommand; m_findReplace.cmdFind.param = pageFind.m_nParam; - m_findReplace.nFindMinChn = pageFind.m_nMinChannel; - m_findReplace.nFindMaxChn = pageFind.m_nMaxChannel; - m_findReplace.dwFindFlags = pageFind.m_dwFlags; + m_findReplace.findMinChn = pageFind.m_nMinChannel; + m_findReplace.findMaxChn = pageFind.m_nMaxChannel; + m_findReplace.findFlags = pageFind.m_Flags; m_findReplace.cmdReplace.note = pageReplace.m_nNote; m_findReplace.cmdReplace.instr = pageReplace.m_nInstr; m_findReplace.cmdReplace.volcmd = pageReplace.m_nVolCmd; m_findReplace.cmdReplace.vol = pageReplace.m_nVol; m_findReplace.cmdReplace.command = pageReplace.m_nCommand; m_findReplace.cmdReplace.param = pageReplace.m_nParam; - m_findReplace.dwReplaceFlags = pageReplace.m_dwFlags; - m_findReplace.cInstrRelChange = pageReplace.cInstrRelChange; + m_findReplace.replaceFlags = pageReplace.m_Flags; + m_findReplace.instrRelChange = pageReplace.cInstrRelChange; m_findReplace.selection = m_Selection; m_bContinueSearch = false; OnEditFindNext(); @@ -2050,7 +2036,7 @@ return; } - if(!(m_findReplace.dwFindFlags & ~PATSEARCH_FULLSEARCH)) + if(!m_findReplace.findFlags[~FindReplace::FullSearch]) { PostMessage(WM_COMMAND, ID_EDIT_FIND); return; @@ -2059,27 +2045,27 @@ EffectInfo effectInfo(*pSndFile); - PATTERNINDEX nPatStart = m_nPattern; - PATTERNINDEX nPatEnd = m_nPattern + 1; + PATTERNINDEX patStart = m_nPattern; + PATTERNINDEX patEnd = m_nPattern + 1; - if(m_findReplace.dwFindFlags & PATSEARCH_FULLSEARCH) + if(m_findReplace.findFlags[FindReplace::FullSearch]) { - nPatStart = 0; - nPatEnd = pSndFile->Patterns.Size(); - } else if(m_findReplace.dwFindFlags & PATSEARCH_PATSELECTION) + patStart = 0; + patEnd = pSndFile->Patterns.Size(); + } else if(m_findReplace.findFlags[FindReplace::InPatSelection]) { - nPatStart = m_nPattern; - nPatEnd = nPatStart + 1; + patStart = m_nPattern; + patEnd = patStart + 1; } if(m_bContinueSearch) { - nPatStart = m_nPattern; + patStart = m_nPattern; } // Do we search for an extended effect? bool isExtendedEffect = false; - if(m_findReplace.dwFindFlags & PATSEARCH_COMMAND) + if(m_findReplace.findFlags[FindReplace::Command]) { UINT fxndx = effectInfo.GetIndexFromEffect(m_findReplace.cmdFind.command, m_findReplace.cmdFind.param); isExtendedEffect = effectInfo.IsExtendedEffect(fxndx); @@ -2088,21 +2074,21 @@ CHANNELINDEX firstChannel = 0; CHANNELINDEX lastChannel = pSndFile->GetNumChannels() - 1; - if(m_findReplace.dwFindFlags & PATSEARCH_CHANNEL) + if(m_findReplace.findFlags[FindReplace::InChannels]) { // Limit search to given channels - firstChannel = min(m_findReplace.nFindMinChn, lastChannel); - lastChannel = min(m_findReplace.nFindMaxChn, lastChannel); + firstChannel = min(m_findReplace.findMinChn, lastChannel); + lastChannel = min(m_findReplace.findMaxChn, lastChannel); } - if(m_findReplace.dwFindFlags & PATSEARCH_PATSELECTION) + if(m_findReplace.findFlags[FindReplace::InPatSelection]) { // Limit search to pattern selection firstChannel = min(m_findReplace.selection.GetStartChannel(), lastChannel); lastChannel = min(m_findReplace.selection.GetEndChannel(), lastChannel); } - for(PATTERNINDEX pat = nPatStart; pat < nPatEnd; pat++) + for(PATTERNINDEX pat = patStart; pat < patEnd; pat++) { if(!pSndFile->Patterns.IsValidPat(pat)) { @@ -2111,7 +2097,7 @@ ROWINDEX row = 0; CHANNELINDEX chn = firstChannel; - if(m_bContinueSearch && pat == nPatStart && pat == m_nPattern) + if(m_bContinueSearch && pat == patStart && pat == m_nPattern) { // Continue search from cursor position row = GetCurrentRow(); @@ -2137,7 +2123,7 @@ { RowMask findWhere; - if(m_findReplace.dwFindFlags & PATSEARCH_PATSELECTION) + if(m_findReplace.findFlags[FindReplace::InPatSelection]) { // Limit search to pattern selection if((chn == m_findReplace.selection.GetStartChannel() || chn == m_findReplace.selection.GetEndChannel()) @@ -2172,23 +2158,23 @@ bool foundHere = true; - if(((m_findReplace.dwFindFlags & PATSEARCH_NOTE) && (!findWhere.note || (m->note != m_findReplace.cmdFind.note && (m_findReplace.cmdFind.note != CFindReplaceTab::findAny || !m->IsNote())))) - || ((m_findReplace.dwFindFlags & PATSEARCH_INSTR) && (!findWhere.instrument || m->instr != m_findReplace.cmdFind.instr)) - || ((m_findReplace.dwFindFlags & PATSEARCH_VOLCMD) && (!findWhere.volume || m->volcmd != m_findReplace.cmdFind.volcmd)) - || ((m_findReplace.dwFindFlags & PATSEARCH_VOLUME) && (!findWhere.volume || m->vol != m_findReplace.cmdFind.vol)) - || ((m_findReplace.dwFindFlags & PATSEARCH_COMMAND) && (!findWhere.command || m->command != m_findReplace.cmdFind.command)) - || ((m_findReplace.dwFindFlags & PATSEARCH_PARAM) && (!findWhere.parameter || m->param != m_findReplace.cmdFind.param))) + if((m_findReplace.findFlags[FindReplace::Note] && (!findWhere.note || (m->note != m_findReplace.cmdFind.note && (m_findReplace.cmdFind.note != CFindReplaceTab::findAny || !m->IsNote())))) + || (m_findReplace.findFlags[FindReplace::Instr] && (!findWhere.instrument || m->instr != m_findReplace.cmdFind.instr)) + || (m_findReplace.findFlags[FindReplace::VolCmd] && (!findWhere.volume || m->volcmd != m_findReplace.cmdFind.volcmd)) + || (m_findReplace.findFlags[FindReplace::Volume] && (!findWhere.volume || m->vol != m_findReplace.cmdFind.vol)) + || (m_findReplace.findFlags[FindReplace::Command] && (!findWhere.command || m->command != m_findReplace.cmdFind.command)) + || (m_findReplace.findFlags[FindReplace::Param] && (!findWhere.parameter || m->param != m_findReplace.cmdFind.param))) { foundHere = false; } else { - if((m_findReplace.dwFindFlags & (PATSEARCH_COMMAND | PATSEARCH_PARAM)) == PATSEARCH_COMMAND && isExtendedEffect) + if((m_findReplace.findFlags & (FindReplace::Command | FindReplace::Param)) == FindReplace::Command && isExtendedEffect) { if((m->param & 0xF0) != (m_findReplace.cmdFind.param & 0xF0)) foundHere = false; } // Ignore modcommands with PC/PCS notes when searching from volume or effect column. - if(m->IsPcNote() && m_findReplace.dwFindFlags & (PATSEARCH_VOLCMD | PATSEARCH_VOLUME | PATSEARCH_COMMAND | PATSEARCH_PARAM)) + if(m->IsPcNote() && m_findReplace.findFlags[FindReplace::VolCmd | FindReplace::Volume | FindReplace::Command | FindReplace::Param]) { foundHere = false; } @@ -2198,7 +2184,7 @@ if(foundHere) { // Do we want to jump to the finding in this pattern? - const bool updatePos = ((m_findReplace.dwReplaceFlags & (PATSEARCH_REPLACEALL | PATSEARCH_REPLACE)) != (PATSEARCH_REPLACEALL | PATSEARCH_REPLACE)); + const bool updatePos = !m_findReplace.replaceFlags.test_all(FindReplace::ReplaceAll | FindReplace::Replace); nFound++; if(updatePos) @@ -2206,7 +2192,7 @@ if(IsLiveRecord()) { // turn off "follow song" - m_dwStatus &= ~psFollowSong; + m_Status.reset(psFollowSong); SendCtrlMessage(CTRLMSG_PAT_FOLLOWSONG, 0); } // This doesn't find the order if it's in another sequence :( @@ -2220,15 +2206,15 @@ } PatternCursor::Columns foundCol = PatternCursor::firstColumn; - if((m_findReplace.dwFindFlags & PATSEARCH_NOTE)) + if(m_findReplace.findFlags[FindReplace::Note]) foundCol = PatternCursor::noteColumn; - else if((m_findReplace.dwFindFlags & PATSEARCH_INSTR)) + else if(m_findReplace.findFlags[FindReplace::Instr]) foundCol = PatternCursor::instrColumn; - else if((m_findReplace.dwFindFlags & (PATSEARCH_VOLCMD | PATSEARCH_VOLUME))) + else if(m_findReplace.findFlags[FindReplace::VolCmd | FindReplace::Volume]) foundCol = PatternCursor::volumeColumn; - else if((m_findReplace.dwFindFlags & PATSEARCH_COMMAND)) + else if(m_findReplace.findFlags[FindReplace::Command]) foundCol = PatternCursor::effectColumn; - else if((m_findReplace.dwFindFlags & PATSEARCH_PARAM)) + else if(m_findReplace.findFlags[FindReplace::Param]) foundCol = PatternCursor::paramColumn; if(updatePos) @@ -2237,11 +2223,11 @@ SetCursorPosition(PatternCursor(row, chn, foundCol)); } - if(!(m_findReplace.dwReplaceFlags & PATSEARCH_REPLACE)) goto EndSearch; + if(!m_findReplace.replaceFlags[FindReplace::Replace]) goto EndSearch; bool replace = true; - if(!(m_findReplace.dwReplaceFlags & PATSEARCH_REPLACEALL)) + if(!m_findReplace.replaceFlags[FindReplace::ReplaceAll]) { ConfirmAnswer result = Reporting::Confirm("Replace this occurrence?", "Replace", true); if(result == cnfCancel) @@ -2254,7 +2240,7 @@ } if(replace) { - if((m_findReplace.dwReplaceFlags & PATSEARCH_REPLACEALL)) + if(m_findReplace.replaceFlags[FindReplace::ReplaceAll]) { // Just create one logic undo step per pattern when auto-replacing all occurences. if(firstInPat) @@ -2268,7 +2254,7 @@ GetDocument()->GetPatternUndo().PrepareUndo(pat, chn, row, 1, 1); } - if ((m_findReplace.dwReplaceFlags & PATSEARCH_NOTE)) + if(m_findReplace.replaceFlags[FindReplace::Note]) { if (m_findReplace.cmdReplace.note == CFindReplaceTab::replaceNoteMinusOctave) { @@ -2298,14 +2284,14 @@ } } - if ((m_findReplace.dwReplaceFlags & PATSEARCH_INSTR)) + if(m_findReplace.replaceFlags[FindReplace::Instr]) { - if (m_findReplace.cInstrRelChange == -1) + if (m_findReplace.instrRelChange == -1) { // Instr-- if(m->instr > 1) m->instr--; - } else if (m_findReplace.cInstrRelChange == 1) + } else if (m_findReplace.instrRelChange == 1) { // Instr++ if(m->instr > 0 && m->instr < (MAX_INSTRUMENTS - 1)) @@ -2316,17 +2302,17 @@ } } - if ((m_findReplace.dwReplaceFlags & PATSEARCH_VOLCMD)) + if(m_findReplace.replaceFlags[FindReplace::VolCmd]) { m->volcmd = m_findReplace.cmdReplace.volcmd; } - if ((m_findReplace.dwReplaceFlags & PATSEARCH_VOLUME)) + if(m_findReplace.replaceFlags[FindReplace::Volume]) { m->vol = m_findReplace.cmdReplace.vol; } - if ((m_findReplace.dwReplaceFlags & (PATSEARCH_VOLCMD | PATSEARCH_VOLUME)) && m->volcmd != VOLCMD_NONE) + if(m_findReplace.replaceFlags[FindReplace::VolCmd | FindReplace::Volume] && m->volcmd != VOLCMD_NONE) { // Fix volume command parameters if necessary. This is necesary e.g. // When there was a command "v24" and the user searched for v and replaced it by d. @@ -2338,14 +2324,14 @@ } } - if ((m_findReplace.dwReplaceFlags & PATSEARCH_COMMAND)) + if(m_findReplace.replaceFlags[FindReplace::Command]) { m->command = m_findReplace.cmdReplace.command; } - if ((m_findReplace.dwReplaceFlags & PATSEARCH_PARAM)) + if(m_findReplace.replaceFlags[FindReplace::Param]) { - if ((isExtendedEffect) && (!(m_findReplace.dwReplaceFlags & PATSEARCH_COMMAND))) + if ((isExtendedEffect) && !m_findReplace.replaceFlags[FindReplace::Command]) m->param = (BYTE)((m->param & 0xF0) | (m_findReplace.cmdReplace.param & 0x0F)); else m->param = m_findReplace.cmdReplace.param; @@ -2362,12 +2348,12 @@ } EndSearch: - if(m_findReplace.dwReplaceFlags & PATSEARCH_REPLACEALL) + if(m_findReplace.replaceFlags[FindReplace::ReplaceAll]) { InvalidatePattern(); } - if((m_findReplace.dwFindFlags & PATSEARCH_PATSELECTION) && (nFound == 0 || (m_findReplace.dwReplaceFlags & (PATSEARCH_REPLACE | PATSEARCH_REPLACEALL)) == PATSEARCH_REPLACE)) + if(m_findReplace.findFlags[FindReplace::InPatSelection] && (nFound == 0 || (m_findReplace.replaceFlags & (FindReplace::Replace | FindReplace::ReplaceAll)) == FindReplace::Replace)) { // Restore original selection if we didn't find anything or just replaced stuff manually. m_Selection = m_findReplace.selection; @@ -2386,7 +2372,7 @@ result = "Cannot find \""; // Note - if(m_findReplace.dwFindFlags & PATSEARCH_NOTE) + if(m_findReplace.findFlags[FindReplace::Note]) { result.Append(GetNoteStr(m_findReplace.cmdFind.note)); } else @@ -2396,7 +2382,7 @@ result.AppendChar(' '); // Instrument - if(m_findReplace.dwFindFlags & PATSEARCH_INSTR) + if(m_findReplace.findFlags[FindReplace::Instr]) { if (m_findReplace.cmdFind.instr) { @@ -2412,7 +2398,7 @@ result.AppendChar(' '); // Volume Command - if(m_findReplace.dwFindFlags & PATSEARCH_VOLCMD) + if(m_findReplace.findFlags[FindReplace::VolCmd]) { if(m_findReplace.cmdFind.volcmd) { @@ -2427,7 +2413,7 @@ } // Volume Parameter - if(m_findReplace.dwFindFlags & PATSEARCH_VOLUME) + if(m_findReplace.findFlags[FindReplace::Volume]) { result.AppendFormat("%02d", m_findReplace.cmdFind.vol); } else @@ -2437,7 +2423,7 @@ result.AppendChar(' '); // Effect Command - if(m_findReplace.dwFindFlags & PATSEARCH_COMMAND) + if(m_findReplace.findFlags[FindReplace::Command]) { if(m_findReplace.cmdFind.command) { @@ -2452,7 +2438,7 @@ } // Effect Parameter - if(m_findReplace.dwFindFlags & PATSEARCH_PARAM) + if(m_findReplace.findFlags[FindReplace::Param]) { result.AppendFormat("%02X", m_findReplace.cmdFind.param); } else @@ -2489,7 +2475,7 @@ CriticalSection cs; // Cut instruments/samples in virtual channels - for (CHANNELINDEX i = pSndFile->GetNumChannels(); i < MAX_CHANNELS; i++) + for(CHANNELINDEX i = pSndFile->GetNumChannels(); i < MAX_CHANNELS; i++) { pSndFile->Chn[i].dwFlags.set(CHN_NOTEFADE | CHN_KEYOFF); } @@ -2588,7 +2574,7 @@ SetModified(false); - if(GetSoundFile()->IsPaused() || !(m_dwStatus & psFollowSong) || (CMainFrame::GetMainFrame() && CMainFrame::GetMainFrame()->GetFollowSong(GetDocument()) != m_hWnd)) + if(GetSoundFile()->IsPaused() || !m_Status[psFollowSong] || (CMainFrame::GetMainFrame() && CMainFrame::GetMainFrame()->GetFollowSong(GetDocument()) != m_hWnd)) { InvalidateCell(m_Cursor); SetCurrentRow(GetCurrentRow() + m_nSpacing); @@ -3073,7 +3059,7 @@ end.Sanitize(pSndFile->Patterns[m_nPattern].GetNumRows(), pSndFile->GetNumChannels()); PatternRect destination(begin, end); - const bool moveSelection = !(m_dwStatus & (psKeyboardDragSelect | psCtrlDragSelect)); + const bool moveSelection = !m_Status[psKeyboardDragSelect | psCtrlDragSelect]; BeginWaitCursor(); pModDoc->GetPatternUndo().PrepareUndo(m_nPattern, 0, 0, pSndFile->GetNumChannels(), pSndFile->Patterns[m_nPattern].GetNumRows()); @@ -3566,7 +3552,7 @@ } // Don't follow song if user drags selections or scrollbars. - if((m_dwStatus & (psFollowSong | psDragActive)) == psFollowSong) + if((m_Status & (psFollowSong | psDragActive)) == psFollowSong) { if (nPat < pSndFile->Patterns.Size()) { @@ -3596,7 +3582,7 @@ } //Ends condition "if(pnotify->dwType & MPTNOTIFY_POSITION)" - if((pnotify->dwType & (MPTNOTIFY_VUMETERS|MPTNOTIFY_STOP)) && (m_dwStatus & psShowVUMeters)) + if((pnotify->dwType & (MPTNOTIFY_VUMETERS|MPTNOTIFY_STOP)) && m_Status[psShowVUMeters]) { UpdateAllVUMeters(pnotify); } @@ -3699,19 +3685,19 @@ } -CViewPattern::ModCommandPos CViewPattern::GetEditPos(CSoundFile& rSf, const bool bLiveRecord) const -//------------------------------------------------------------------------------------------------- +ModCommandPos CViewPattern::GetEditPos(CSoundFile& rSf, const bool bLiveRecord) const +//----------------------------------------------------------------------------------- { ModCommandPos editpos; if(bLiveRecord) { - SetEditPos(rSf, editpos.nRow, editpos.nPat, rSf.m_nRow, rSf.m_nPattern); + SetEditPos(rSf, editpos.row, editpos.pattern, rSf.m_nRow, rSf.m_nPattern); } else { - editpos.nPat = m_nPattern; - editpos.nRow = GetCurrentRow(); + editpos.pattern = m_nPattern; + editpos.row = GetCurrentRow(); } - editpos.nChn = GetCurrentChannel(); + editpos.channel = GetCurrentChannel(); return editpos; } @@ -3740,8 +3726,8 @@ //------------------------------------------------------------------------------------ { static ModCommand dummy; - if(sndFile.Patterns.IsValidPat(pos.nPat) && pos.nRow < sndFile.Patterns[pos.nPat].GetNumRows() && pos.nChn < sndFile.GetNumChannels()) - return *sndFile.Patterns[pos.nPat].GetpModCommand(pos.nRow, pos.nChn); + if(sndFile.Patterns.IsValidPat(pos.pattern) && pos.row < sndFile.Patterns[pos.pattern].GetNumRows() && pos.channel < sndFile.GetNumChannels()) + return *sndFile.Patterns[pos.pattern].GetpModCommand(pos.row, pos.channel); else return dummy; } @@ -3812,10 +3798,10 @@ ModCommandPos editpos = GetEditPos(*pSndFile, liveRecord); ModCommand &m = GetModCommand(*pSndFile, editpos); - pModDoc->GetPatternUndo().PrepareUndo(editpos.nPat, editpos.nChn, editpos.nRow, 1, 1); + pModDoc->GetPatternUndo().PrepareUndo(editpos.pattern, editpos.channel, editpos.row, 1, 1); m.Set(NOTE_PCS, mappedIndex, static_cast<uint16>(paramIndex), static_cast<uint16>((paramValue * ModCommand::maxColumnValue) / 127)); if(!liveRecord) - InvalidateRow(editpos.nRow); + InvalidateRow(editpos.row); pMainFrm->ThreadSafeSetModified(pModDoc); } @@ -3874,14 +3860,14 @@ 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.nPat, editpos.nChn, editpos.nRow, 1, 1); + pModDoc->GetPatternUndo().PrepareUndo(editpos.pattern, editpos.channel, editpos.row, 1, 1); m.command = CMD_SMOOTHMIDI; m.param = nByte2; pMainFrm->ThreadSafeSetModified(pModDoc); // Update GUI only if not recording live. if(!liveRecord) - InvalidateRow(editpos.nRow); + InvalidateRow(editpos.row); } } @@ -3952,12 +3938,12 @@ return (m_nPattern << 16) | GetCurrentRow(); case VIEWMSG_FOLLOWSONG: - m_dwStatus &= ~psFollowSong; + m_Status.reset(psFollowSong); if (lParam) { CMainFrame *pMainFrm = CMainFrame::GetMainFrame(); CModDoc *pModDoc = GetDocument(); - m_dwStatus |= psFollowSong; + m_Status.set(psFollowSong); if (pModDoc) pModDoc->SetFollowWnd(m_hWnd, MPTNOTIFY_POSITION|MPTNOTIFY_VUMETERS); if (pMainFrm) pMainFrm->SetFollowSong(pModDoc, m_hWnd, TRUE, MPTNOTIFY_POSITION|MPTNOTIFY_VUMETERS); SetFocus(); @@ -3972,7 +3958,7 @@ break; case VIEWMSG_SETRECORD: - if (lParam) m_dwStatus |= psRecordingEnabled; else m_dwStatus &= ~psRecordingEnabled; + m_Status.set(psRecordingEnabled, !!lParam); break; case VIEWMSG_SETSPACING: @@ -3985,14 +3971,14 @@ break; case VIEWMSG_SETVUMETERS: - if (lParam) m_dwStatus |= psShowVUMeters; else m_dwStatus &= ~psShowVUMeters; + m_Status.set(psShowVUMeters, !!lParam); UpdateSizes(); UpdateScrollSize(); InvalidatePattern(true); break; case VIEWMSG_SETPLUGINNAMES: - if (lParam) m_dwStatus |= psShowPluginNames; else m_dwStatus &= ~psShowPluginNames; + m_Status.set(psShowPluginNames, !!lParam); UpdateSizes(); UpdateScrollSize(); InvalidatePattern(true); @@ -4012,9 +3998,9 @@ { CModDoc *pModDoc = GetDocument(); CMainFrame *pMainFrm = CMainFrame::GetMainFrame(); - if ((!(m_dwStatus & psFollowSong)) - || (pMainFrm->GetFollowSong(pModDoc) != m_hWnd) - || (pModDoc->GetSoundFile()->IsPaused())) + if(!m_Status[psFollowSong] + || (pMainFrm->GetFollowSong(pModDoc) != m_hWnd) + || (pModDoc->GetSoundFile()->IsPaused())) { SetCurrentRow(GetCurrentRow() + m_nSpacing); } @@ -4285,20 +4271,20 @@ } case kcSelectWithCopySelect: case kcSelectWithNav: - case kcSelect: if (!(m_dwStatus & (psDragnDropEdit|psRowSelection))) m_StartSel = m_Cursor; - m_dwStatus |= psKeyboardDragSelect; + case kcSelect: if(!m_Status[psDragnDropEdit | psRowSelection]) m_StartSel = m_Cursor; + m_Status.set(psKeyboardDragSelect); return wParam; case kcSelectOffWithCopySelect: case kcSelectOffWithNav: - case kcSelectOff: m_dwStatus &= ~(psKeyboardDragSelect | psShiftSelect); + case kcSelectOff: m_Status.reset(psKeyboardDragSelect | psShiftSelect); return wParam; case kcCopySelectWithSelect: case kcCopySelectWithNav: - case kcCopySelect: if (!(m_dwStatus & (psDragnDropEdit | psRowSelection))) m_StartSel = m_Cursor; - m_dwStatus |= psCtrlDragSelect; return wParam; + case kcCopySelect: if(!m_Status[psDragnDropEdit | psRowSelection]) m_StartSel = m_Cursor; + m_Status.set(psCtrlDragSelect); return wParam; case kcCopySelectOffWithSelect: case kcCopySelectOffWithNav: - case kcCopySelectOff: m_dwStatus &= ~psCtrlDragSelect; return wParam; + case kcCopySelectOff: m_Status.reset(psCtrlDragSelect); return wParam; case kcSelectBeat: case kcSelectMeasure: @@ -4730,7 +4716,7 @@ if(bChordMode == true) { - m_dwStatus &= ~psChordPlaying; + m_Status.reset(psChordPlaying); pModDoc->NoteOff(0, true, ins, GetCurrentChannel()); // XXX this doesn't stop VSTi notes! } else @@ -5384,7 +5370,7 @@ if (chordplaylist[kplchrd]) { pModDoc->PlayNote(chordplaylist[kplchrd], nPlayIns, 0, false, -1, 0, 0, nChn); //rewbs.vstiLive - - added extra args - m_dwStatus |= psChordPlaying; + m_Status.set(psChordPlaying); } } } @@ -5686,7 +5672,7 @@ UpdateIndicator(); } - if(step && (pSndFile->IsPaused() || !(m_dwStatus & psFollowSong) || + if(step && (pSndFile->IsPaused() || !m_Status[psFollowSong] || (CMainFrame::GetMainFrame() != nullptr && CMainFrame::GetMainFrame()->GetFollowSong(GetDocument()) != m_hWnd))) { if ((m_nSpacing > 0) && (m_nSpacing <= MAX_SPACING)) @@ -5702,13 +5688,6 @@ //----------------------------------------- { CModScrollView::OnInitMenu(pMenu); - - //rewbs: ensure modifiers are reset when we go into menu -/* m_dwStatus &= ~PATSTATUS_KEYDRAGSEL; - m_dwStatus &= ~PATSTATUS_CTRLDRAGSEL; - CMainFrame::GetMainFrame()->GetInputHandler()->SetModifierMask(0); -*/ //end rewbs - } void CViewPattern::TogglePluginEditor(int chan) Modified: trunk/OpenMPT/mptrack/View_pat.h =================================================================== --- trunk/OpenMPT/mptrack/View_pat.h 2013-03-11 14:13:23 UTC (rev 1558) +++ trunk/OpenMPT/mptrack/View_pat.h 2013-03-11 15:49:33 UTC (rev 1559) @@ -13,8 +13,6 @@ #include "globals.h" #include "PatternCursor.h" -#include "PatternClipboard.h" -#include "PatternEditorDialogs.h" class CModDoc; class CEditCommand; @@ -38,11 +36,11 @@ // Struct for controlling selection clearing. This is used to define which data fields should be cleared. struct RowMask { - bool note; - bool instrument; - bool volume; - bool command; - bool parameter; + bool note : 1; + bool instrument : 1; + bool volume : 1; + bool command : 1; + bool parameter : 1; // Default row mask (all rows are selected) RowMask() @@ -80,16 +78,45 @@ // Find/Replace data -struct FindReplaceStruct +struct FindReplace { - ModCommand cmdFind, cmdReplace; // Find/replace notes/instruments/effects - DWORD dwFindFlags, dwReplaceFlags; // PATSEARCH_XXX flags (=> PatternEditorDialogs.h) - CHANNELINDEX nFindMinChn, nFindMaxChn; // Find in these channels (if PATSEARCH_CHANNEL is set) - signed char cInstrRelChange; // relative instrument change (quick'n'dirty fix, this should be implemented in a less cryptic way) - PatternRect selection; // Find in this selection (if PATSEARCH_PATSELECTION is set) + enum Flags + { + Note = 0x01, // Search for note + Instr = 0x02, // Search for instrument + VolCmd = 0x04, // Search for volume effect + Volume = 0x08, // Search for volume + Command = 0x10, // Search for effect + Param = 0x20, // Search for effect parameter + InChannels = 0x40, // Limit search to channels + FullSearch = 0x100, // Search whole song + InPatSelection = 0x200, // Search in current pattern selection + Replace = 0x400, // Replace + ReplaceAll = 0x800, // Replace all + }; + + ModCommand cmdFind, cmdReplace; // Find/replace notes/instruments/effects + FlagSet<Flags> findFlags, replaceFlags; // See Flags + PatternRect selection; // Find in this selection (if FindReplace::InPatSelection is set) + CHANNELINDEX findMinChn, findMaxChn; // Find in these channels (if FindReplace::InChannels is set) + signed char instrRelChange; // relative instrument change (quick'n'dirty fix, this should be implemented in a less cryptic way) }; +DECLARE_FLAGSET(FindReplace::Flags); + +struct ModCommandPos +{ + ROWINDEX row; + PATTERNINDEX pattern; + CHANNELINDEX channel; +}; + + +#include "PatternClipboard.h" +#include "PatternEditorDialogs.h" + + ////////////////////////////////////////////////////////////////// // Pattern editing class @@ -98,7 +125,7 @@ class CViewPattern: public CModScrollView //======================================= { -protected: +public: // Pattern status flags enum PatternStatus @@ -119,29 +146,26 @@ psShowPluginNames = 0x2000, // Show plugin names in channel headers psRowSelection = 0x4000, // Selecting a whole pattern row by clicking the row numbers psChannelSelection = 0x8000, // Double-clicked pattern to select a whole channel + psDragging = 0x10000, // Drag&Drop: Dragging an item around + psShiftDragging = 0x20000, // Drag&Drop: Dragging an item around and holding shift // All possible drag flags, to test if user is dragging a selection or a scrollbar psDragActive = psDragVScroll | psDragHScroll | psMouseDragSelect | psRowSelection | psChannelSelection, }; - struct ModCommandPos - { - PATTERNINDEX nPat; - ROWINDEX nRow; - CHANNELINDEX nChn; - }; +protected: CFastBitmap m_Dib; CEditCommand *m_pEditWnd; CPatternGotoDialog *m_pGotoWnd; SIZE m_szHeader, m_szCell; - PATTERNINDEX m_nPattern; UINT m_nMidRow, m_nSpacing, m_nAccelChar, m_nLastPlayedRow, m_nLastPlayedOrder; - PATTERNINDEX m_nPlayPat; + FlagSet<PatternStatus> m_Status; ROWINDEX m_nPlayRow; + PATTERNINDEX m_nPattern, m_nPlayPat; int m_nXScroll, m_nYScroll; - PatternCursor::Columns m_nDetailLevel; // Visible Columns + PatternCursor::Columns m_nDetailLevel; // Visible Columns // Cursor and selection positions PatternCursor m_Cursor; // Current cursor position in pattern. @@ -152,35 +176,31 @@ // Drag&Drop DWORD m_nDragItem; // Currently dragged item DWORD m_nDropItem; // Currently hovered item during dragondrop - bool m_bDragging, m_bInItemRect, m_bShiftDragging; RECT m_rcDragItem, m_rcDropItem; + bool m_bInItemRect; - bool m_bContinueSearch, m_bWholePatternFitsOnScreen; - DWORD m_dwStatus; - WORD ChnVUMeters[MAX_BASECHANNELS]; - WORD OldVUMeters[MAX_BASECHANNELS]; UINT m_nFoundInstrument; DWORD m_dwLastNoteEntryTime; //rewbs.customkeys - UINT m_nLastPlayedChannel; //rewbs.customkeys bool m_bLastNoteEntryBlocked; + bool m_bContinueSearch, m_bWholePatternFitsOnScreen; - ModCommand m_PCNoteEditMemory; // PC Note edit memory - static ModCommand m_cmdOld; // Quick cursor copy/paste data - static FindReplaceStruct m_findReplace; // Find/replace data + ModCommand m_PCNoteEditMemory; // PC Note edit memory + static ModCommand m_cmdOld; // Quick cursor copy/paste data + static FindReplace m_findReplace; // Find/replace data // Internal pattern clipboard static PatternClipboard patternClipboard; -// -> CODE#0012 -// -> DESC="midi keyboard split" + QuickChannelProperties quickChannelProperties; + + vector<ModCommand::NOTE> octaveKeyMemory; + + WORD ChnVUMeters[MAX_BASECHANNELS]; + WORD OldVUMeters[MAX_BASECHANNELS]; + BYTE activeNoteChannel[NOTE_MAX + 1]; BYTE splitActiveNoteChannel[NOTE_MAX + 1]; - vector<ModCommand::NOTE> octaveKeyMemory; - int oldrow, oldchn, oldsplitchn; -// -! NEW_FEATURE#0012 - QuickChannelProperties quickChannelProperties; - public: CEffectVis *m_pEffectVis; //rewbs.fxVis @@ -361,10 +381,7 @@ afx_msg void OnMuteChannel(bool current); //rewbs.customKeys afx_msg void OnUnmuteAll(); afx_msg void OnRecordSelect(); -// -> CODE#0012 -// -> DESC="midi keyboard split" afx_msg void OnSplitRecordSelect(); -// -! NEW_FEATURE#0012 afx_msg void OnDeleteRows(); afx_msg void OnDeleteRowsEx(); afx_msg void OnInsertRows(); @@ -374,11 +391,6 @@ afx_msg void OnNextOrder(); afx_msg void OnPrevInstrument() { PostCtrlMessage(CTRLMSG_PAT_PREVINSTRUMENT); } afx_msg void OnNextInstrument() { PostCtrlMessage(CTRLMSG_PAT_NEXTINSTRUMENT); } -//rewbs.customKeys - now implemented at ModDoc level -/* afx_msg void OnPatternRestart() {} - afx_msg void OnPatternPlay() {} - afx_msg void OnPatternPlayNoLoop() {} */ -//end rewbs.customKeys afx_msg void OnPatternRecord() { PostCtrlMessage(CTRLMSG_SETRECORD, -1); } afx_msg void OnInterpolateVolume() { Interpolate(PatternCursor::volumeColumn); } afx_msg void OnInterpolateEffect() { Interpolate(PatternCursor::effectColumn); } @@ -467,8 +479,8 @@ { return false; } - // (following song) && (following in correct document) && (playback is on) - return (m_dwStatus & psFollowSong) && mainFrm->GetFollowSong(GetDocument()) == m_hWnd && !sndFile->IsPaused(); + // (following song) && (following in correct document) && (playback is on) + return m_Status[psFollowSong] && mainFrm->GetFollowSong(GetDocument()) == m_hWnd && !sndFile->IsPaused(); }; // If given edit positions are valid, sets them to iRow and iPat. @@ -486,7 +498,7 @@ ModCommand &GetModCommand(CSoundFile &sndFile, const ModCommandPos &pos); // Returns true if pattern editing is enabled. - bool IsEditingEnabled() const { return ((m_dwStatus & psRecordingEnabled) != 0); } + bool IsEditingEnabled() const { return m_Status[psRecordingEnabled]; } // Like IsEditingEnabled(), but shows some notification when editing is not enabled. bool IsEditingEnabled_bmsg(); @@ -508,3 +520,6 @@ public: afx_msg void OnRButtonUp(UINT nFlags, CPoint point); }; + +DECLARE_FLAGSET(CViewPattern::PatternStatus); + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2013-03-11 22:47:57
|
Revision: 1560 http://sourceforge.net/p/modplug/code/1560 Author: saga-games Date: 2013-03-11 22:47:40 +0000 (Mon, 11 Mar 2013) Log Message: ----------- [New] Can now copy multiple patterns at once. [New] Pattern Clipboard Manager: Can now have more than one internal clipboard. Accessible through shortcuts only for now. [Reg] Removed "Copy Orders" in favour of multi-pattern copying [Mod] OpenMPT: Version is now 1.21.01.19 Modified Paths: -------------- trunk/OpenMPT/common/version.h trunk/OpenMPT/mptrack/CommandSet.cpp trunk/OpenMPT/mptrack/CommandSet.h trunk/OpenMPT/mptrack/Ctrl_pat.h trunk/OpenMPT/mptrack/Ctrl_seq.cpp trunk/OpenMPT/mptrack/KeyConfigDlg.cpp trunk/OpenMPT/mptrack/Moddoc.h trunk/OpenMPT/mptrack/PatternClipboard.cpp trunk/OpenMPT/mptrack/PatternClipboard.h trunk/OpenMPT/mptrack/TrackerSettings.cpp trunk/OpenMPT/mptrack/View_pat.cpp trunk/OpenMPT/mptrack/View_pat.h trunk/OpenMPT/mptrack/mptrack.rc trunk/OpenMPT/mptrack/resource.h Modified: trunk/OpenMPT/common/version.h =================================================================== --- trunk/OpenMPT/common/version.h 2013-03-11 15:49:33 UTC (rev 1559) +++ trunk/OpenMPT/common/version.h 2013-03-11 22:47:40 UTC (rev 1560) @@ -19,7 +19,7 @@ #define VER_MAJORMAJOR 1 #define VER_MAJOR 21 #define VER_MINOR 01 -#define VER_MINORMINOR 18 +#define VER_MINORMINOR 19 //Creates version number from version parts that appears in version string. //For example MAKE_VERSION_NUMERIC(1,17,02,28) gives version number of Modified: trunk/OpenMPT/mptrack/CommandSet.cpp =================================================================== --- trunk/OpenMPT/mptrack/CommandSet.cpp 2013-03-11 15:49:33 UTC (rev 1559) +++ trunk/OpenMPT/mptrack/CommandSet.cpp 2013-03-11 22:47:40 UTC (rev 1560) @@ -652,6 +652,9 @@ DefineKeyCommand(kcFindInstrument, 1897, _T("Pick up nearest instrument number")); DefineKeyCommand(kcPlaySongFromPattern, 1898, _T("Play Song from Pattern Start")); DefineKeyCommand(kcVSTGUIToggleRecordMIDIOut, 1899, _T("Record MIDI Out to Pattern Editor")); + DefineKeyCommand(kcToggleClipboardManager, 1900, _T("Toggle Clipboard Manager")); + DefineKeyCommand(kcClipboardPrev, 1901, _T("Cycle to Previous Clipboard")); + DefineKeyCommand(kcClipboardNext, 1902, _T("Cycle to Next Clipboard")); // Add new key commands here. Modified: trunk/OpenMPT/mptrack/CommandSet.h =================================================================== --- trunk/OpenMPT/mptrack/CommandSet.h 2013-03-11 15:49:33 UTC (rev 1559) +++ trunk/OpenMPT/mptrack/CommandSet.h 2013-03-11 22:47:40 UTC (rev 1560) @@ -257,6 +257,12 @@ kcToggleNoteOffRecordMIDI, kcEndPatternEditMisc=kcToggleNoteOffRecordMIDI, + kcStartPatternClipboard, + kcToggleClipboardManager = kcStartPatternClipboard, + kcClipboardPrev, + kcClipboardNext, + kcEndPatternClipboard = kcClipboardNext, + kcStartChannelKeys, kcChannelMute = kcStartChannelKeys, kcChannelSolo, Modified: trunk/OpenMPT/mptrack/Ctrl_pat.h =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_pat.h 2013-03-11 15:49:33 UTC (rev 1559) +++ trunk/OpenMPT/mptrack/Ctrl_pat.h 2013-03-11 22:47:40 UTC (rev 1560) @@ -110,7 +110,6 @@ // Clipboard. void OnEditCopy(); void OnEditCut(); - void OnEditPaste(); // Helper function for entering pattern number void EnterPatternNum(int enterNum); Modified: trunk/OpenMPT/mptrack/Ctrl_seq.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_seq.cpp 2013-03-11 15:49:33 UTC (rev 1559) +++ trunk/OpenMPT/mptrack/Ctrl_seq.cpp 2013-03-11 22:47:40 UTC (rev 1560) @@ -60,8 +60,7 @@ ON_COMMAND(ID_ORDERLIST_RENDER, OnRenderOrder) ON_COMMAND(ID_ORDERLIST_EDIT_COPY, OnEditCopy) ON_COMMAND(ID_ORDERLIST_EDIT_CUT, OnEditCut) - ON_COMMAND(ID_ORDERLIST_EDIT_PASTE, OnEditPaste) - + ON_COMMAND(ID_PATTERN_PROPERTIES, OnPatternProperties) ON_COMMAND(ID_PLAYER_PLAY, OnPlayerPlay) ON_COMMAND(ID_PLAYER_PAUSE, OnPlayerPause) @@ -421,7 +420,7 @@ case kcEditCut: OnEditCut(); return wParam; case kcEditPaste: - OnEditPaste(); return wParam; + OnPatternPaste(); return wParam; // Orderlist navigation case kcOrderlistNavigateLeftSelect: @@ -573,11 +572,6 @@ } -static const char szClipboardOrdersHdr[] = "OpenMPT %3s\r\n"; -static const char szClipboardOrdCountFieldHdr[] = "OrdNum: %u\r\n"; -static const char szClipboardOrdersFieldHdr[] = "OrdLst: "; - - void COrderList::OnEditCut() //-------------------------- { @@ -586,138 +580,13 @@ } -void COrderList::OnEditPaste() -//---------------------------- -{ - CMainFrame *pMainFrm = CMainFrame::GetMainFrame(); - CSoundFile* pSf = m_pModDoc->GetSoundFile(); - if (!pMainFrm) - return; - BeginWaitCursor(); - if (pMainFrm->OpenClipboard()) - { - HGLOBAL hCpy = ::GetClipboardData(CF_TEXT); - LPCSTR p; - - if ((hCpy) && ((p = (LPCSTR)GlobalLock(hCpy)) != NULL)) - { - const DWORD dwMemSize = GlobalSize(hCpy); - - if (dwMemSize > sizeof(szClipboardOrdersHdr) && - memcmp(p, "OpenMPT ", 8) == 0 && - memcmp(p + 11, "\r\n", 2) == 0) - { - char buf[8]; - p += sizeof(szClipboardOrdersHdr) - 1; - std::istrstream iStrm(p, dwMemSize - sizeof(szClipboardOrdersHdr) + 1); - ORDERINDEX nCount = 0; - std::vector<PATTERNINDEX> vecPat; - while (iStrm.get(buf, sizeof(buf), '\n')) - { - if (memcmp(buf, "OrdNum:", 8) == 0) // Read expected order count. - iStrm >> nCount; - else if (memcmp(buf, "OrdLst:", 8) != 0) - { // Unrecognized data -> skip line. - iStrm.ignore((std::numeric_limits<std::streamsize>::max)(), '\n'); - continue; - } - else // Read orders. - { - LimitMax(nCount, pSf->GetModSpecifications().ordersMax); - vecPat.reserve(nCount); - char bufItem[16]; - while (iStrm.peek() >= 32 && iStrm.getline(bufItem, sizeof(bufItem), ' ')) - { - if (vecPat.size() >= pSf->GetModSpecifications().ordersMax) - break; - if (!(isdigit(bufItem[0]) || bufItem[0] == '+' || bufItem[0] == '-')) - continue; - PATTERNINDEX nPat = pSf->Order.GetInvalidPatIndex(); - if (bufItem[0] == '+') - { - nPat = pSf->Order.GetIgnoreIndex(); - if(!pSf->GetModSpecifications().hasIgnoreIndex) continue; - } - else if (isdigit(bufItem[0])) - { - nPat = ConvertStrTo<PATTERNINDEX>(bufItem); - if (nPat >= pSf->GetModSpecifications().patternsMax) - nPat = pSf->Order.GetInvalidPatIndex(); - } - vecPat.push_back(nPat); - } - nCount = pSf->Order.Insert(m_nScrollPos, (ORDERINDEX)vecPat.size()); - for (ORDERINDEX nOrd = 0; nOrd < nCount; nOrd++) - pSf->Order[m_nScrollPos + nOrd] = vecPat[nOrd]; - } - m_pModDoc->SetModified(); - m_pModDoc->UpdateAllViews(NULL, HINT_MODSEQUENCE, NULL); - } - } - GlobalUnlock(hCpy); - } - CloseClipboard(); - } - EndWaitCursor(); -} - - void COrderList::OnEditCopy() //--------------------------- { - CMainFrame *pMainFrm = CMainFrame::GetMainFrame(); - if ((!pMainFrm)) return; - const OrdSelection ordsel = GetCurSel(false); - - DWORD dwMemSize; - HGLOBAL hCpy; - BeginWaitCursor(); - dwMemSize = sizeof(szClipboardOrdersHdr) + sizeof(szClipboardOrdersFieldHdr) + sizeof(szClipboardOrdCountFieldHdr); - dwMemSize += ordsel.GetSelCount() * 6 + 8; - if ((pMainFrm->OpenClipboard()) && ((hCpy = GlobalAlloc(GMEM_MOVEABLE|GMEM_DDESHARE, dwMemSize))!=NULL)) - { - LPCSTR pszFormatName; - EmptyClipboard(); - switch(m_pModDoc->GetSoundFile()->GetType()) - { - case MOD_TYPE_S3M: pszFormatName = "S3M"; break; - case MOD_TYPE_XM: pszFormatName = "XM"; break; - case MOD_TYPE_IT: pszFormatName = "IT"; break; - case MOD_TYPE_MPT: pszFormatName = "MPT"; break; - default: pszFormatName = "MOD"; break; - } - LPSTR p = (LPSTR)GlobalLock(hCpy); - if (p) - { - const ModSequence& seq = m_pModDoc->GetSoundFile()->Order; - wsprintf(p, szClipboardOrdersHdr, pszFormatName); - p += strlen(p); - wsprintf(p, szClipboardOrdCountFieldHdr, ordsel.GetSelCount()); - strcat(p, szClipboardOrdersFieldHdr); - p += strlen(p); - for(ORDERINDEX i = ordsel.firstOrd; i <= ordsel.lastOrd; i++) - { - std::string str; - if (seq[i] == seq.GetInvalidPatIndex()) - str = "-"; - else if (seq[i] == seq.GetIgnoreIndex()) - str = "+"; - else - str = Stringify(seq[i]); - memcpy(p, str.c_str(), str.size()); - p += str.size(); - *p++ = ' '; - } - *p++ = '\r'; - *p++ = '\n'; - *p = 0; - } - GlobalUnlock(hCpy); - SetClipboardData(CF_TEXT, (HANDLE) hCpy); - CloseClipboard(); - } + CViewPattern::GetPatternClipboard().Copy(*m_pModDoc->GetSoundFile(), ordsel.firstOrd, ordsel.lastOrd); + CViewPattern::GetPatternClipboardDialog().UpdateList(); EndWaitCursor(); } @@ -725,7 +594,7 @@ void COrderList::UpdateView(DWORD dwHintMask, CObject *pObj) //---------------------------------------------------------- { - if ((pObj != this) && (dwHintMask & HINT_MODSEQUENCE)) + if(pObj != this && (dwHintMask & HINT_MODSEQUENCE)) { InvalidateRect(NULL, FALSE); UpdateInfoText(); @@ -1093,35 +962,32 @@ HMENU hMenu = ::CreatePopupMenu(); if(!hMenu) return; - // check if at least one pattern in the current selection exists - bool bPatternExists = false; + // Check if at least one pattern in the current selection exists + bool patExists = false; OrdSelection selection = GetCurSel(false); - for(ORDERINDEX nOrd = selection.firstOrd; nOrd <= selection.lastOrd; nOrd++) + for(ORDERINDEX ord = selection.firstOrd; ord <= selection.lastOrd && !patExists; ord++) { - bPatternExists = ((pSndFile->Order[nOrd] < pSndFile->Patterns.Size()) - && (pSndFile->Patterns[pSndFile->Order[nOrd]] != nullptr)); - if(bPatternExists) break; + patExists = pSndFile->Patterns.IsValidPat(pSndFile->Order[ord]); } - const DWORD greyed = bPatternExists ? 0 : MF_GRAYED; + const DWORD greyed = patExists ? 0 : MF_GRAYED; CInputHandler* ih = (CMainFrame::GetMainFrame())->GetInputHandler(); if(multiSelection) { - // several patterns are selected. + // Several patterns are selected. AppendMenu(hMenu, MF_STRING, ID_ORDERLIST_INSERT, "&Insert Patterns\t" + ih->GetKeyTextFromCommand(kcOrderlistEditInsert)); AppendMenu(hMenu, MF_STRING, ID_ORDERLIST_DELETE, "&Remove Patterns\t" + ih->GetKeyTextFromCommand(kcOrderlistEditDelete)); AppendMenu(hMenu, MF_SEPARATOR, NULL, ""); - AppendMenu(hMenu, MF_STRING, ID_ORDERLIST_EDIT_COPY, "&Copy Orders\t" + ih->GetKeyTextFromCommand(kcEditCopy)); - AppendMenu(hMenu, MF_STRING, ID_ORDERLIST_EDIT_CUT, "&C&ut Orders\t" + ih->GetKeyTextFromCommand(kcEditCut)); - AppendMenu(hMenu, MF_STRING, ID_ORDERLIST_EDIT_PASTE, "&Paste Orders\t" + ih->GetKeyTextFromCommand(kcEditPaste)); + AppendMenu(hMenu, MF_STRING, ID_ORDERLIST_EDIT_COPY, "&Copy Patterns\t" + ih->GetKeyTextFromCommand(kcEditCopy)); + AppendMenu(hMenu, MF_STRING, ID_ORDERLIST_EDIT_CUT, "&C&ut Patterns\t" + ih->GetKeyTextFromCommand(kcEditCut)); + AppendMenu(hMenu, MF_STRING | greyed, ID_PATTERNPASTE, "P&aste Patterns\t" + ih->GetKeyTextFromCommand(kcEditPaste)); AppendMenu(hMenu, MF_SEPARATOR, NULL, ""); AppendMenu(hMenu, MF_STRING | greyed, ID_ORDERLIST_COPY, "&Duplicate Patterns\t" + ih->GetKeyTextFromCommand(kcDuplicatePattern)); - } - else + } else { - // only one pattern is selected + // Only one pattern is selected AppendMenu(hMenu, MF_STRING, ID_ORDERLIST_INSERT, "&Insert Pattern\t" + ih->GetKeyTextFromCommand(kcOrderlistEditInsert)); if(pSndFile->GetModSpecifications().hasIgnoreIndex) { @@ -1132,12 +998,11 @@ AppendMenu(hMenu, MF_STRING, ID_ORDERLIST_NEW, "Create &New Pattern\t" + ih->GetKeyTextFromCommand(kcNewPattern)); AppendMenu(hMenu, MF_STRING | greyed, ID_ORDERLIST_COPY, "&Duplicate Pattern\t" + ih->GetKeyTextFromCommand(kcDuplicatePattern)); AppendMenu(hMenu, MF_STRING | greyed, ID_PATTERNCOPY, "&Copy Pattern"); - AppendMenu(hMenu, MF_STRING | greyed, ID_PATTERNPASTE, "P&aste Pattern"); - AppendMenu(hMenu, MF_STRING, ID_ORDERLIST_EDIT_PASTE, "&Paste Orders\t" + ih->GetKeyTextFromCommand(kcEditPaste)); + AppendMenu(hMenu, MF_STRING, ID_PATTERNPASTE, "P&aste Pattern\t" + ih->GetKeyTextFromCommand(kcEditPaste)); if (pSndFile->TypeIsIT_MPT_XM()) { AppendMenu(hMenu, MF_SEPARATOR, NULL, ""); - AppendMenu(hMenu, MF_STRING | greyed, ID_PATTERN_PROPERTIES, "&Pattern properties..."); + AppendMenu(hMenu, MF_STRING | greyed, ID_PATTERN_PROPERTIES, "&Pattern Properties..."); } if (pSndFile->GetType() == MOD_TYPE_MPT) { Modified: trunk/OpenMPT/mptrack/KeyConfigDlg.cpp =================================================================== --- trunk/OpenMPT/mptrack/KeyConfigDlg.cpp 2013-03-11 15:49:33 UTC (rev 1559) +++ trunk/OpenMPT/mptrack/KeyConfigDlg.cpp 2013-03-11 22:47:40 UTC (rev 1560) @@ -285,6 +285,9 @@ for(int c = kcStartPatternEditMisc; c <= kcEndPatternEditMisc; c++) newCat.commands.Add(c); newCat.separators.Add(kcEndPatternEditMisc); //-------------------------------------- + for(int c = kcStartPatternClipboard; c <= kcEndPatternClipboard; c++) + newCat.commands.Add(c); + newCat.separators.Add(kcEndPatternClipboard); //-------------------------------------- commandCategories.Add(newCat); } Modified: trunk/OpenMPT/mptrack/Moddoc.h =================================================================== --- trunk/OpenMPT/mptrack/Moddoc.h 2013-03-11 15:49:33 UTC (rev 1559) +++ trunk/OpenMPT/mptrack/Moddoc.h 2013-03-11 22:47:40 UTC (rev 1560) @@ -182,6 +182,8 @@ public: CSoundFile *GetSoundFile() { return &m_SndFile; } const CSoundFile *GetSoundFile() const { return &m_SndFile; } + CSoundFile &GetrSoundFile() { return m_SndFile; } + const CSoundFile &GetrSoundFile() const { return m_SndFile; } void InitPlayer(); void SetPause(BOOL bPause) { m_bPaused = bPause; } Modified: trunk/OpenMPT/mptrack/PatternClipboard.cpp =================================================================== --- trunk/OpenMPT/mptrack/PatternClipboard.cpp 2013-03-11 15:49:33 UTC (rev 1559) +++ trunk/OpenMPT/mptrack/PatternClipboard.cpp 2013-03-11 22:47:40 UTC (rev 1560) @@ -12,18 +12,25 @@ #include "PatternClipboard.h" #include "Mainfrm.h" #include "Moddoc.h" +#include "View_pat.h" -// Currently just one slot for fall-back pasting. -PatternClipboard::clipindex_t PatternClipboard::clipboardSize = 1; +/* Clipboard format: + * Hdr: "ModPlug Tracker S3M\r\n" + * Full: '|C#401v64A06' + * Reset: '|...........' + * Empty: '| ' + * End of row: '\r\n' + * + * When pasting multiple patterns, the header line is followed by the order list: + * Orders: 0,1,2,+,-,1\r\n + * After that, the individual pattern headers and pattern data follows: + * 'Rows: 64\r\n' (must be first) + * 'Name: Pattern Name\r\n' (optional) + * 'Signature: 4/16\r\n' (optional) + * Pattern data... + */ -// Clipboard format: -// Hdr: "ModPlug Tracker S3M\r\n" -// Full: '|C#401v64A06' -// Reset: '|...........' -// Empty: '| ' -// End of row: '\n' - CString PatternClipboard::GetFileExtension(const char *ext) const //--------------------------------------------------------------- { @@ -41,15 +48,107 @@ } +// Copy a range of patterns to both the system clipboard and the internal clipboard. +bool PatternClipboard::Copy(CSoundFile &sndFile, ORDERINDEX first, ORDERINDEX last) +//--------------------------------------------------------------------------------- +{ + LimitMax(first, sndFile.Order.GetLength()); + LimitMax(last, sndFile.Order.GetLength()); + + // Set up clipboard header. + CString data = "ModPlug Tracker " + GetFileExtension(sndFile.GetModSpecifications().fileExtension) + "\r\nOrders: "; + CString patternData; + + // Pattern => Order list assignment + std::vector<PATTERNINDEX> patList(sndFile.Patterns.Size(), PATTERNINDEX_INVALID); + PATTERNINDEX insertedPats = 0; + + // Add order list and pattern information to header. + for(ORDERINDEX ord = first; ord <= last; ord++) + { + PATTERNINDEX pattern = sndFile.Order[ord]; + + if(ord != first) + { + data.AppendChar(','); + } + if(pattern == sndFile.Order.GetInvalidPatIndex()) + { + data.AppendChar('-'); + } else if(pattern == sndFile.Order.GetIgnoreIndex()) + { + data.AppendChar('+'); + } else if(sndFile.Patterns.IsValidPat(pattern)) + { + if(patList[pattern] == PATTERNINDEX_INVALID) + { + // New pattern + patList[pattern] = insertedPats++; + + patternData.AppendFormat("Rows: %u\r\n", sndFile.Patterns[pattern].GetNumRows()); + CString name = sndFile.Patterns[pattern].GetName(); + if(!name.IsEmpty()) + { + patternData.Append("Name: " + name + "\r\n"); + } + if(sndFile.Patterns[pattern].GetOverrideSignature()) + { + patternData.AppendFormat("Signature: %u/%u\r\n", sndFile.Patterns[pattern].GetRowsPerBeat(), sndFile.Patterns[pattern].GetRowsPerMeasure()); + } + patternData.Append(CreateClipboardString(sndFile, pattern, PatternRect(PatternCursor(), PatternCursor(sndFile.Patterns[pattern].GetNumRows() - 1, sndFile.GetNumChannels() - 1, PatternCursor::lastColumn)))); + } + + data.AppendFormat("%u", patList[pattern]); + } + } + data.Append("\r\n" + patternData); + + if(activeClipboard < clipboards.size()) + { + // Copy to internal clipboard + CString desc; + desc.Format("%u Patterns (%u to %u)", last - first + 1, first, last); + clipboards[activeClipboard] = PatternClipboardElement(data, desc); + } + + return ToSystemClipboard(data); +} + + // Copy a pattern selection to both the system clipboard and the internal clipboard. bool PatternClipboard::Copy(CSoundFile &sndFile, PATTERNINDEX pattern, PatternRect selection) //------------------------------------------------------------------------------------------- { - if(!sndFile.Patterns.IsValidPat(pattern)) + CString data = CreateClipboardString(sndFile, pattern, selection); + if(data.IsEmpty()) { return false; } + // Set up clipboard header. + data = "ModPlug Tracker " + GetFileExtension(sndFile.GetModSpecifications().fileExtension) + "\r\n" + data; + + if(activeClipboard < clipboards.size()) + { + // Copy to internal clipboard + CString desc; + desc.Format("%u rows, %u channels (pattern %u)", selection.GetNumRows(), selection.GetNumChannels(), pattern); + clipboards[activeClipboard] = PatternClipboardElement(data, desc); + } + + return ToSystemClipboard(data); +} + + +// Create the clipboard text for a pattern selection +CString PatternClipboard::CreateClipboardString(CSoundFile &sndFile, PATTERNINDEX pattern, PatternRect selection) +//--------------------------------------------------------------------------------------------------------------- +{ + if(!sndFile.Patterns.IsValidPat(pattern)) + { + return ""; + } + if(selection.GetStartColumn() == PatternCursor::paramColumn) { // Special case: If selection starts with a parameter column, extend it to include the effect letter as well. @@ -61,16 +160,9 @@ const ROWINDEX startRow = selection.GetStartRow(), numRows = selection.GetNumRows(); const CHANNELINDEX startChan = selection.GetStartChannel(), numChans = selection.GetNumChannels(); - // XXX - size_t memSize = 21 + numRows * (numChans * 12 + 2) + 1; - CString data; - data.Preallocate(memSize); + data.Preallocate(numRows * (numChans * 12 + 2)); - // Set up clipboard header. - // XXX - data = "ModPlug Tracker " + GetFileExtension(sndFile.GetModSpecifications().fileExtension) + "\r\n"; - for(ROWINDEX row = 0; row < numRows; row++) { if(row + startRow >= sndFile.Patterns[pattern].GetNumRows()) @@ -80,9 +172,9 @@ const ModCommand *m = sndFile.Patterns[pattern].GetpModCommand(row + startRow, startChan); - for(CHANNELINDEX chan = 0; chan < numChans; chan++, m++) + for(CHANNELINDEX chn = 0; chn < numChans; chn++, m++) { - PatternCursor cursor(0, startChan + chan); + PatternCursor cursor(0, startChan + chn); data.AppendChar('|'); // Note @@ -182,55 +274,42 @@ data.Append("\r\n"); } - activeClipboard = 0; - - if(clipboardSize > 0) - { - // Copy to internal clipboard - if(clipboards.size() == clipboardSize) - { - clipboards.pop_back(); - } - - clipboards.push_front(PatternClipboardElement(data)); - } - - return ToSystemClipboard(data); - + return data; } // Try pasting a pattern selection from the system clipboard. -bool PatternClipboard::Paste(CSoundFile &sndFile, PATTERNINDEX pattern, const PatternCursor &pastePos, PasteModes mode) -//--------------------------------------------------------------------------------------------------------------------- +bool PatternClipboard::Paste(CSoundFile &sndFile, ModCommandPos &pastePos, PasteModes mode, ORDERINDEX curOrder) +//-------------------------------------------------------------------------------------------------------------- { CString data; - if(!FromSystemClipboard(data) || !HandlePaste(sndFile, pattern, pastePos, mode, data)) + if(!FromSystemClipboard(data) || !HandlePaste(sndFile, pastePos, mode, data, curOrder)) { // Fall back to internal clipboard if there's no valid pattern data in the system clipboard. - return Paste(sndFile, pattern, pastePos, mode, 0); + return Paste(sndFile, pastePos, mode, curOrder, activeClipboard); } return true; } // Try pasting a pattern selection from an internal clipboard. -bool PatternClipboard::Paste(CSoundFile &sndFile, PATTERNINDEX pattern, const PatternCursor &pastePos, PasteModes mode, clipindex_t internalClipboard) -//---------------------------------------------------------------------------------------------------------------------------------------------------- +bool PatternClipboard::Paste(CSoundFile &sndFile, ModCommandPos &pastePos, PasteModes mode, ORDERINDEX curOrder, clipindex_t internalClipboard) +//--------------------------------------------------------------------------------------------------------------------------------------------- { if(internalClipboard >= clipboards.size()) { return false; } - return HandlePaste(sndFile, pattern, pastePos, mode, clipboards[internalClipboard].content); + return HandlePaste(sndFile, pastePos, mode, clipboards[internalClipboard].content, curOrder); } -// Perform the pasting operation. -bool PatternClipboard::HandlePaste(CSoundFile &sndFile, PATTERNINDEX pattern, const PatternCursor &pastePos, PasteModes mode, const CString &data) -//------------------------------------------------------------------------------------------------------------------------------------------------ +// Parse clipboard string and perform the pasting operation. +bool PatternClipboard::HandlePaste(CSoundFile &sndFile, ModCommandPos &pastePos, PasteModes mode, const CString &data, ORDERINDEX curOrder) +//----------------------------------------------------------------------------------------------------------------------------------------- { - if(!sndFile.Patterns.IsValidPat(pattern) || sndFile.GetpModDoc() == nullptr) + PATTERNINDEX pattern = pastePos.pattern; + if(sndFile.GetpModDoc() == nullptr) { return false; } @@ -239,32 +318,10 @@ const TEMPO tempoMin = sndFile.GetModSpecifications().tempoMin; - CHANNELINDEX startChan = pastePos.GetChannel(), col; - ROWINDEX startRow = pastePos.GetRow(); - ROWINDEX curRow = startRow; bool success = false; bool prepareUndo = true; // prepare pattern for undo next time - bool firstUndo = true; // for chaining undos (see overflow paste) + bool firstUndo = true; // for chaining undos (see overflow / multi-pattern paste) - const bool overflowPaste = (CMainFrame::GetSettings().m_dwPatternSetup & PATTERN_OVERFLOWPASTE) && (mode != pmPasteFlood) && (mode != pmPushForward); - const bool doITStyleMix = (mode == pmMixPasteIT); - const bool doMixPaste = (mode == pmMixPaste) || doITStyleMix; - - // We need to know the current order for overflow paste - ORDERINDEX currentOrder = 0; - if(overflowPaste) - { - ROWINDEX rTemp; - PATTERNINDEX pTemp; - modDoc.GetEditPosition(rTemp, pTemp, currentOrder); - } - - // Can we actually paste at this position? - if(startRow >= sndFile.Patterns[pattern].GetNumRows() || startChan >= sndFile.GetNumChannels()) - { - return false; - } - // Search for signature int pos, startPos = 0; MODTYPE pasteFormat = MOD_TYPE_NONE; @@ -292,16 +349,114 @@ return false; } + // Skip whitespaces + while(data[startPos] == '\r' || data[startPos] == '\n' || data[startPos] == ' ') + { + startPos++; + } + + std::vector<PATTERNINDEX> patList; + bool multiPaste = false; + if(data.Mid(startPos, 8) == "Orders: ") + { + // Pasting several patterns at once. + multiPaste = true; + mode = pmOverwrite; + + if(sndFile.Patterns.IsValidPat(sndFile.Order[curOrder])) + { + // Put new patterns after current pattern, if it exists + curOrder++; + } + + pos = startPos + 8; + startPos = data.Find("\n", pos) + 1; + ORDERINDEX writeOrder = curOrder; + + while(pos < startPos && pos != 0) + { + PATTERNINDEX insertPat; + if(data[pos] == '+') + { + insertPat = sndFile.Order.GetIgnoreIndex(); + } else if(data[pos] == '-') + { + insertPat = sndFile.Order.GetInvalidPatIndex(); + } else + { + insertPat = ConvertStrTo<PATTERNINDEX>(data.Mid(pos, 16)); + + if(insertPat < patList.size()) + { + // Duplicate pattern + insertPat = patList[insertPat]; + } else + { + // New pattern + if(insertPat >= patList.size()) + { + patList.resize(insertPat + 1, PATTERNINDEX_INVALID); + } + + patList[insertPat] = sndFile.Patterns.Insert(64); + insertPat = patList[insertPat]; + } + } + + // Next order item, please + pos = data.Find(",", pos + 1) + 1; + + if((insertPat == sndFile.Order.GetIgnoreIndex() && !sndFile.GetModSpecifications().hasIgnoreIndex) || insertPat == PATTERNINDEX_INVALID) + { + continue; + } + + if(sndFile.Order.Insert(writeOrder, 1) == 0) + { + break; + } + sndFile.Order[writeOrder++] = insertPat; + } + + if(!patList.empty()) + { + // First pattern we're going to paste in. + pattern = patList[0]; + } + + // We already modified the order list... + success = true; + + pastePos.pattern = pattern; + pastePos.row = 0; + pastePos.channel = 0; + } + + size_t curPattern = 0; // Currently pasted pattern for multi-paste + ROWINDEX startRow = pastePos.row; + ROWINDEX curRow = startRow; + CHANNELINDEX startChan = pastePos.channel, col; + + // Can we actually paste at this position? + if(!sndFile.Patterns.IsValidPat(pattern) || startRow >= sndFile.Patterns[pattern].GetNumRows() || startChan >= sndFile.GetNumChannels()) + { + return success; + } + const CModSpecifications &sourceSpecs = CSoundFile::GetModSpecifications(pasteFormat); + const bool overflowPaste = ((CMainFrame::GetSettings().m_dwPatternSetup & PATTERN_OVERFLOWPASTE) && mode != pmPasteFlood && mode != pmPushForward) && !multiPaste; + const bool doITStyleMix = (mode == pmMixPasteIT); + const bool doMixPaste = (mode == pmMixPaste) || doITStyleMix; const bool clipboardHasS3MCommands = (pasteFormat & (MOD_TYPE_IT | MOD_TYPE_MPT | MOD_TYPE_S3M)) != 0; - ModCommand *m = sndFile.Patterns[pattern].GetpModCommand(startRow, 0); + ModCommand *patData = sndFile.Patterns[pattern].GetpModCommand(startRow, 0); pos = startPos; - while(curRow < sndFile.Patterns[pattern].GetNumRows()) + while(curRow < sndFile.Patterns[pattern].GetNumRows() || multiPaste) { + const int nextPatStart = data.Find('|', pos); // Search for column separator or end of paste data. - if((pos = data.Find('|', pos)) == -1) + if(nextPatStart == -1) { // End of paste if(mode == pmPasteFlood && curRow != startRow) @@ -309,20 +464,78 @@ // Restarting pasting from beginning. pos = startPos; continue; - } - else + } else { // Prevent infinite loop with malformed clipboard data. break; } } + // Handle multi-paste: Read pattern information + if(multiPaste) + { + // Skip whitespaces + while(data[pos] == '\r' || data[pos] == '\n' || data[pos] == ' ') + { + pos++; + } + + // Parse pattern header lines + while(pos < nextPatStart) + { + int eol = data.Find("\n", pos + 1) + 1; + if(eol == -1) + { + break; + } + if(data.Mid(pos, 6) == "Rows: ") + { + pos += 6; + // Advance to next pattern + do + { + if(curPattern >= patList.size()) + { + return success; + } + pattern = patList[curPattern++]; + } while (pattern == PATTERNINDEX_INVALID); + ROWINDEX numRows = ConvertStrTo<ROWINDEX>(data.Mid(pos, eol - pos)); + sndFile.Patterns[pattern].Resize(numRows); + patData = sndFile.Patterns[pattern].GetpModCommand(0, 0); + curRow = 0; + prepareUndo = true; + } else if(data.Mid(pos, 6) == "Name: ") + { + pos += 6; + sndFile.Patterns[pattern].SetName(data.Mid(pos, eol - pos - 2).TrimRight()); + } else if(data.Mid(pos, 11) == "Signature: ") + { + pos += 11; + int pos2 = data.Find("/", pos + 1) + 1; + ROWINDEX rpb = ConvertStrTo<ROWINDEX>(data.Mid(pos, pos2 - pos)); + ROWINDEX rpm = ConvertStrTo<ROWINDEX>(data.Mid(pos2, eol - pos2)); + sndFile.Patterns[pattern].SetSignature(rpb, rpm); + } else + { + break; + } + pos = eol; + } + } + + // Search for column separator or end of paste data. + pos = nextPatStart; + success = true; col = startChan; // Paste columns - while((data[pos] == '|') && (pos + 11 < data.GetLength())) + while((pos + 11 < data.GetLength()) && (data[pos] == '|')) { pos++; + // Handle pasting large pattern into smaller pattern (e.g. 128-row pattern into MOD, which only allows 64 rows) + static ModCommand dummy; + ModCommand &m = curRow < sndFile.Patterns[pattern].GetNumRows() ? patData[col] : dummy; // Check valid paste condition. Paste will be skipped if // - col is not a valid channelindex or @@ -330,50 +543,50 @@ // - doing mix paste and trying to paste PCnote on non-empty modcommand. const bool skipPaste = col >= sndFile.GetNumChannels() || - (doMixPaste && m[col].IsPcNote()) || - (doMixPaste && data[pos] == 'P' && !m[col].IsEmpty()); + (doMixPaste && m.IsPcNote()) || + (doMixPaste && data[pos] == 'P' && !m.IsEmpty()); if(skipPaste == false) { // 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; } // ITSyle mixpaste requires that we keep a copy of the thing we are about to paste on // so that we can refer back to check if there was anything in e.g. the note column before we pasted. - const ModCommand origModCmd = m[col]; + const ModCommand origModCmd = m; // push channel data below paste point first. if(mode == pmPushForward) { - for(ROWINDEX nPushRow = sndFile.Patterns[pattern].GetNumRows() - 1 - curRow; nPushRow > 0; nPushRow--) + for(ROWINDEX pushRow = sndFile.Patterns[pattern].GetNumRows() - 1 - curRow; pushRow > 0; pushRow--) { - m[col + nPushRow * sndFile.GetNumChannels()] = m[col + (nPushRow - 1) * sndFile.GetNumChannels()]; + patData[col + pushRow * sndFile.GetNumChannels()] = patData[col + (pushRow - 1) * sndFile.GetNumChannels()]; } - m[col].Clear(); + m.Clear(); } // Note if(data[pos] != ' ' && (!doMixPaste || ((!doITStyleMix && origModCmd.note == NOTE_NONE) || (doITStyleMix && origModCmd.note == NOTE_NONE && origModCmd.instr == 0 && origModCmd.volcmd == VOLCMD_NONE)))) { - m[col].note = NOTE_NONE; + m.note = NOTE_NONE; if(data[pos] == '=') - m[col].note = NOTE_KEYOFF; + m.note = NOTE_KEYOFF; else if(data[pos] == '^') - m[col].note = NOTE_NOTECUT; + m.note = NOTE_NOTECUT; else if(data[pos] == '~') - m[col].note = NOTE_FADE; + m.note = NOTE_FADE; else if(data[pos] == 'P') { if(data[pos + 2] == 'S') - m[col].note = NOTE_PCS; + m.note = NOTE_PCS; else - m[col].note = NOTE_PC; + m.note = NOTE_PC; } else if (data[pos] != '.') { // Check note names @@ -381,18 +594,18 @@ { if(data[pos] == szNoteNames[i][0] && data[pos + 1] == szNoteNames[i][1]) { - m[col].note = ModCommand::NOTE(i + NOTE_MIN); + m.note = ModCommand::NOTE(i + NOTE_MIN); break; } } - if(m[col].note != NOTE_NONE) + if(m.note != NOTE_NONE) { // Check octave - m[col].note += (data[pos + 2] - '0') * 12; - if(!m[col].IsNote()) + m.note += (data[pos + 2] - '0') * 12; + if(!m.IsNote()) { // Invalid octave - m[col].note = NOTE_NONE; + m.note = NOTE_NONE; } } } @@ -404,8 +617,8 @@ { if(data[pos + 3] >= '0' && data[pos + 3] <= ('0' + (MAX_SAMPLES / 10))) { - m[col].instr = (data[pos + 3] - '0') * 10 + (data[pos + 4] - '0'); - } else m[col].instr = 0; + m.instr = (data[pos + 3] - '0') * 10 + (data[pos + 4] - '0'); + } else m.instr = 0; } // Volume @@ -414,45 +627,44 @@ { if(data[pos + 5] != '.') { - if(m[col].IsPcNote()) + if(m.IsPcNote()) { - m[col].SetValueVolCol(ConvertStrTo<uint16>(data.Mid(pos + 5, 3))); + m.SetValueVolCol(ConvertStrTo<uint16>(data.Mid(pos + 5, 3))); } else { - m[col].volcmd = VOLCMD_NONE; + m.volcmd = VOLCMD_NONE; for(ModCommand::VOLCMD i = 1; i < MAX_VOLCMDS; i++) { const char cmd = sourceSpecs.GetVolEffectLetter(i); if(data[pos + 5] == cmd && cmd != '?') { - m[col].volcmd = i; + m.volcmd = i; break; } } - m[col].vol = (data[pos + 6] - '0') * 10 + (data[pos + 7] - '0'); + m.vol = (data[pos + 6] - '0') * 10 + (data[pos + 7] - '0'); } } else { - m[col].volcmd = VOLCMD_NONE; - m[col].vol = 0; + m.volcmd = VOLCMD_NONE; + m.vol = 0; } } // Effect - if(m[col].IsPcNote()) + if(m.IsPcNote()) { if(data[pos + 8] != '.' && data[pos + 8] > ' ') { - m[col].SetValueEffectCol(ConvertStrTo<uint16>(data.Mid(pos + 8, 3))); + m.SetValueEffectCol(ConvertStrTo<uint16>(data.Mid(pos + 8, 3))); } - } - else + } else { if(data[pos + 8] > ' ' && (!doMixPaste || ((!doITStyleMix && origModCmd.command == CMD_NONE) || (doITStyleMix && origModCmd.command == CMD_NONE && origModCmd.param == 0)))) { - m[col].command = CMD_NONE; + m.command = CMD_NONE; if(data[pos + 8] != '.') { for(ModCommand::COMMAND i = 1; i < MAX_EFFECTS; i++) @@ -460,7 +672,7 @@ const char cmd = sourceSpecs.GetEffectLetter(i); if(data[pos + 8] == cmd && cmd != '?') { - m[col].command = i; + m.command = i; break; } } @@ -471,13 +683,13 @@ if(data[pos + 9] > ' ' && (!doMixPaste || ((!doITStyleMix && (origModCmd.command == CMD_NONE || origModCmd.param == 0)) || (doITStyleMix && origModCmd.command == CMD_NONE && origModCmd.param == 0)))) { - m[col].param = 0; + m.param = 0; if(data[pos + 9] != '.') { for(size_t i = 0; i < 16; i++) { - if(data[pos + 9] == szHexChar[i]) m[col].param |= (i << 4); - if(data[pos + 10] == szHexChar[i]) m[col].param |= i; + if(data[pos + 9] == szHexChar[i]) m.param |= (i << 4); + if(data[pos + 10] == szHexChar[i]) m.param |= i; } } } @@ -485,45 +697,45 @@ // Speed / tempo command conversion if (sndFile.GetType() & (MOD_TYPE_MOD | MOD_TYPE_XM)) { - switch(m[col].command) + switch(m.command) { case CMD_SPEED: case CMD_TEMPO: if(!clipboardHasS3MCommands) { - if(m[col].param < tempoMin) + if(m.param < tempoMin) { - m[col].command = CMD_SPEED; + m.command = CMD_SPEED; } else { - m[col].command = CMD_TEMPO; + m.command = CMD_TEMPO; } } else { - if(m[col].command == CMD_SPEED && m[col].param >= tempoMin) + if(m.command == CMD_SPEED && m.param >= tempoMin) { - m[col].param = CMD_TEMPO; - } else if(m[col].command == CMD_TEMPO && m[col].param < tempoMin) + m.param = CMD_TEMPO; + } else if(m.command == CMD_TEMPO && m.param < tempoMin) { - m[col].param = CMD_SPEED; + m.param = CMD_SPEED; } } break; } } else { - switch(m[col].command) + switch(m.command) { case CMD_SPEED: case CMD_TEMPO: if(!clipboardHasS3MCommands) { - if(m[col].param < tempoMin) + if(m.param < tempoMin) { - m[col].command = CMD_SPEED; + m.command = CMD_SPEED; } else { - m[col].command = CMD_TEMPO; + m.command = CMD_TEMPO; } } break; @@ -536,14 +748,14 @@ // of the old modcommand would falsely be interpreted being of type // origFormat and ConvertCommand could change them. if (pasteFormat != sndFile.GetType() && (!doMixPaste || origModCmd.IsEmpty(false))) - m[col].Convert(pasteFormat, sndFile.GetType()); + m.Convert(pasteFormat, sndFile.GetType()); } pos += 11; col++; } // Next row - m += sndFile.GetNumChannels(); + patData += sndFile.GetNumChannels(); curRow++; if(overflowPaste) @@ -553,12 +765,12 @@ while(curRow >= sndFile.Patterns[pattern].GetNumRows()) { curRow = 0; - ORDERINDEX nextOrder = sndFile.Order.GetNextOrderIgnoringSkips(currentOrder); + ORDERINDEX nextOrder = sndFile.Order.GetNextOrderIgnoringSkips(curOrder); if(nextOrder == 0 || nextOrder >= sndFile.Order.size()) return success; pattern = sndFile.Order[nextOrder]; if(sndFile.Patterns.IsValidPat(pattern) == false) return success; - m = sndFile.Patterns[pattern]; - currentOrder = nextOrder; + patData = sndFile.Patterns[pattern]; + curOrder = nextOrder; prepareUndo = true; startRow = 0; } @@ -578,6 +790,7 @@ return ToSystemClipboard(clipboards[activeClipboard]); } + // Switch to the next internal clipboard. bool PatternClipboard::CycleForward() //----------------------------------- @@ -612,32 +825,11 @@ void PatternClipboard::SetClipboardSize(clipindex_t maxEntries) //------------------------------------------------------------- { - clipboardSize = maxEntries; - RestrictClipboardSize(); + clipboards.resize(maxEntries, PatternClipboardElement("", "unused")); + LimitMax(activeClipboard, maxEntries - 1); } -// Remove all clipboard contents. -void PatternClipboard::Clear() -//---------------------------- -{ - clipboards.clear(); - activeClipboard = 0; -} - - -// Keep the number of clipboards consistent with the maximum number of allowed clipboards. -void PatternClipboard::RestrictClipboardSize() -//-------------------------------------------- -{ - if(clipboards.size() > clipboardSize) - { - clipboards.resize(clipboardSize); - activeClipboard = 0; - } -} - - // System-specific clipboard functions bool PatternClipboard::ToSystemClipboard(const CString &data) //----------------------------------------------------------- @@ -692,4 +884,102 @@ ::CloseClipboard(); return(p != nullptr); -} \ No newline at end of file +} + + +BEGIN_MESSAGE_MAP(PatternClipboardDialog, CDialog) + ON_EN_UPDATE(IDC_EDIT1, OnNumClipboardsChanged) + ON_LBN_SELCHANGE(IDC_LIST1, OnSelectClipboard) +END_MESSAGE_MAP() + + +void PatternClipboardDialog::DoDataExchange(CDataExchange* pDX) +//------------------------------------------------------------- +{ + DDX_Control(pDX, IDC_SPIN1, numClipboardsSpin); + DDX_Control(pDX, IDC_LIST1, clipList); +} + + +PatternClipboardDialog::PatternClipboardDialog(PatternClipboard &c) : clipboards(c), isLocked(true), isCreated(false), posX(-1) +//----------------------------------------------------------------------------------------------------------------------------- +{ +} + + +void PatternClipboardDialog::Show() +//--------------------------------- +{ + isLocked = true; + if(!isCreated) + { + Create(IDD_CLIPBOARD, CMainFrame::GetMainFrame()); + numClipboardsSpin.SetRange(0, int16_max); + } + SetDlgItemInt(IDC_EDIT1, clipboards.GetClipboardSize(), FALSE); + isLocked = false; + isCreated = true; + UpdateList(); + + SetWindowPos(nullptr, posX, posY, 0, 0, SWP_SHOWWINDOW | SWP_NOOWNERZORDER | SWP_NOSIZE | SWP_NOZORDER | (posX == -1 ? SWP_NOMOVE : 0)); +} + + +void PatternClipboardDialog::OnNumClipboardsChanged() +//--------------------------------------------------- +{ + if(isLocked) + { + return; + } + clipboards.SetClipboardSize(GetDlgItemInt(IDC_EDIT1, nullptr, FALSE)); + UpdateList(); +} + + +void PatternClipboardDialog::UpdateList() +//--------------------------------------- +{ + if(isLocked) + { + return; + } + clipList.ResetContent(); + PatternClipboard::clipindex_t i = 0; + for(std::deque<PatternClipboardElement>::const_iterator clip = clipboards.clipboards.cbegin(); clip != clipboards.clipboards.cend(); clip++, i++) + { + const int item = clipList.AddString(clip->description); + clipList.SetItemDataPtr(item, reinterpret_cast<void *>(i)); + if(clipboards.activeClipboard == i) + { + clipList.SetCurSel(item); + } + } +} + + +void PatternClipboardDialog::OnSelectClipboard() +//---------------------------------------------- +{ + if(isLocked) + { + return; + } + PatternClipboard::clipindex_t item = reinterpret_cast<PatternClipboard::clipindex_t>(clipList.GetItemDataPtr(clipList.GetCurSel())); + clipboards.SelectClipboard(item); +} + + +void PatternClipboardDialog::OnCancel() +//------------------------------------- +{ + isCreated = false; + isLocked = true; + + RECT rect; + GetWindowRect(&rect); + posX = rect.left; + posY = rect.top; + + DestroyWindow(); +} Modified: trunk/OpenMPT/mptrack/PatternClipboard.h =================================================================== --- trunk/OpenMPT/mptrack/PatternClipboard.h 2013-03-11 15:49:33 UTC (rev 1559) +++ trunk/OpenMPT/mptrack/PatternClipboard.h 2013-03-11 22:47:40 UTC (rev 1560) @@ -14,6 +14,8 @@ #include "Sndfile.h" #include "PatternCursor.h" +struct ModCommandPos; + //=========================== class PatternClipboardElement //=========================== @@ -21,11 +23,12 @@ public: CString content; + CString description; public: PatternClipboardElement() { }; - PatternClipboardElement(CString &data) : content(data) { }; + PatternClipboardElement(const CString &data, const CString &desc) : content(data), description(desc) { }; }; @@ -33,6 +36,8 @@ class PatternClipboard //==================== { + friend class PatternClipboardDialog; + public: enum PasteModes @@ -49,8 +54,6 @@ protected: - // Maximum number of internal clipboard entries - static clipindex_t clipboardSize; // Active internal clipboard index clipindex_t activeClipboard; // Internal clipboard collection @@ -58,14 +61,16 @@ public: - PatternClipboard() : activeClipboard(0) { }; + PatternClipboard() : activeClipboard(0) { SetClipboardSize(1); }; + // Copy a range of patterns to both the system clipboard and the internal clipboard. + bool Copy(CSoundFile &sndFile, ORDERINDEX first, ORDERINDEX last); // Copy a pattern selection to both the system clipboard and the internal clipboard. bool Copy(CSoundFile &sndFile, PATTERNINDEX pattern, PatternRect selection); // Try pasting a pattern selection from the system clipboard. - bool Paste(CSoundFile &sndFile, PATTERNINDEX pattern, const PatternCursor &pastePos, PasteModes mode); + bool Paste(CSoundFile &sndFile, ModCommandPos &pastePos, PasteModes mode, ORDERINDEX curOrder); // Try pasting a pattern selection from an internal clipboard. - bool Paste(CSoundFile &sndFile, PATTERNINDEX pattern, const PatternCursor &pastePos, PasteModes mode, clipindex_t internalClipboard); + bool Paste(CSoundFile &sndFile, ModCommandPos &pastePos, PasteModes mode, ORDERINDEX curOrder, clipindex_t internalClipboard); // Copy one of the internal clipboards to the system clipboard. bool SelectClipboard(clipindex_t which); // Switch to the next internal clipboard. @@ -76,18 +81,16 @@ void SetClipboardSize(clipindex_t maxEntries); // Return the current number of clipboards. clipindex_t GetClipboardSize() const { return clipboards.size(); }; - // Remove all clipboard contents. - void Clear(); protected: + // Create the clipboard text for a pattern selection + CString CreateClipboardString(CSoundFile &sndFile, PATTERNINDEX pattern, PatternRect selection); + CString GetFileExtension(const char *ext) const; - // Perform the pasting operation. - bool HandlePaste(CSoundFile &sndFile, PATTERNINDEX pattern, const PatternCursor &pastePos, PasteModes mode, const CString &data); + // Parse clipboard string and perform the pasting operation. + bool HandlePaste(CSoundFile &sndFile, ModCommandPos &pastePos, PasteModes mode, const CString &data, ORDERINDEX curOrder); - // Keep the number of clipboards consistent with the maximum number of allowed clipboards. - void RestrictClipboardSize(); - // System-specific clipboard functions bool ToSystemClipboard(const PatternClipboardElement &clipboard) { return ToSystemClipboard(clipboard.content); }; bool ToSystemClipboard(const CString &data); @@ -95,15 +98,28 @@ }; -//========================== -class PatternClipboardDialog -//========================== +//=========================================== +class PatternClipboardDialog : public CDialog +//=========================================== { protected: - PatternClipboard &clipboards; + CSpinButtonCtrl numClipboardsSpin; + CListBox clipList; + int posX, posY; + bool isLocked, isCreated; public: + PatternClipboardDialog(PatternClipboard &c); + void UpdateList(); + void Show(); + void Toggle() { if(isCreated) OnCancel(); else Show(); } - PatternClipboardDialog(PatternClipboard &c) : clipboards(c) { }; +protected: + virtual void DoDataExchange(CDataExchange* pDX); + DECLARE_MESSAGE_MAP(); + + afx_msg void OnCancel(); + afx_msg void OnNumClipboardsChanged(); + afx_msg void OnSelectClipboard(); }; Modified: trunk/OpenMPT/mptrack/TrackerSettings.cpp =================================================================== --- trunk/OpenMPT/mptrack/TrackerSettings.cpp 2013-03-11 15:49:33 UTC (rev 1559) +++ trunk/OpenMPT/mptrack/TrackerSettings.cpp 2013-03-11 22:47:40 UTC (rev 1560) @@ -22,6 +22,7 @@ #include "../common/StringFixer.h" #include "TrackerSettings.h" #include "../common/misc_util.h" +#include "View_pat.h" const TCHAR *TrackerSettings::m_szDirectoryToSettingsName[NUM_DIRS] = { _T("Songs_Directory"), _T("Samples_Directory"), _T("Instruments_Directory"), _T("Plugins_Directory"), _T("Plugin_Presets_Directory"), _T("Export_Directory"), _T(""), _T("") }; @@ -396,6 +397,7 @@ m_nSampleUndoMaxBuffer = CMainFrame::GetPrivateProfileLong("Sample Editor" , "UndoBufferSize", m_nSampleUndoMaxBuffer >> 20, iniFile); m_nSampleUndoMaxBuffer = max(1, m_nSampleUndoMaxBuffer) << 20; + CViewPattern::GetPatternClipboard().SetClipboardSize(GetPrivateProfileInt("Pattern Editor", "NumClipboards", CViewPattern::GetPatternClipboard().GetClipboardSize(), iniFile)); // Default Paths TCHAR szPath[_MAX_PATH] = ""; @@ -754,6 +756,8 @@ CMainFrame::WritePrivateProfileDWord("Pattern Editor", "AutoChordWaitTime", gnAutoChordWaitTime, iniFile); CMainFrame::WritePrivateProfileDWord("Pattern Editor", "RecordQuantize", recordQuantizeRows, iniFile); + CMainFrame::WritePrivateProfileDWord("Pattern Editor", "NumClipboards", CViewPattern::GetPatternClipboard().GetClipboardSize(), iniFile); + // Write default paths const bool bConvertPaths = theApp.IsPortableMode(); TCHAR szPath[_MAX_PATH] = ""; Modified: trunk/OpenMPT/mptrack/View_pat.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_pat.cpp 2013-03-11 15:49:33 UTC (rev 1559) +++ trunk/OpenMPT/mptrack/View_pat.cpp 2013-03-11 22:47:40 UTC (rev 1560) @@ -45,6 +45,7 @@ // Static initializers ModCommand CViewPattern::m_cmdOld = ModCommand::Empty(); PatternClipboard CViewPattern::patternClipboard; +PatternClipboardDialog CViewPattern::patternClipboardDialog(CViewPattern::patternClipboard); IMPLEMENT_SERIAL(CViewPattern, CModScrollView, 0) @@ -272,7 +273,7 @@ } else if (CMainFrame::GetSettings().m_dwPatternSetup & PATTERN_CONTSCROLL) { - UINT nCurOrder = SendCtrlMessage(CTRLMSG_GETCURRENTORDER); + ORDERINDEX nCurOrder = SendCtrlMessage(CTRLMSG_GETCURRENTORDER); if ((nCurOrder > 0) && (nCurOrder < pSndFile->Order.size()) && (m_nPattern == pSndFile->Order[nCurOrder])) { const ORDERINDEX prevOrd = pSndFile->Order.GetPreviousOrderIgnoringSkips(nCurOrder); @@ -343,10 +344,10 @@ SetCurSel(selStart, m_Cursor); UpdateIndicator(); - Log("Row: %d; Chan: %d; ColType: %d;\n", - selStart.GetRow(), - selStart.GetChannel(), - selStart.GetColumnType()); +// Log("Row: %d; Chan: %d; ColType: %d;\n", +// selStart.GetRow(), +// selStart.GetChannel(), +// selStart.GetColumnType()); return true; } @@ -4077,7 +4078,7 @@ case VIEWMSG_PASTEPATTERN: { - PastePattern(m_nPattern, 0, PatternClipboard::pmOverwrite); + PastePattern(m_nPattern, PatternCursor(0), PatternClipboard::pmOverwrite); InvalidatePattern(); } break; @@ -4366,6 +4367,19 @@ if(m_nSpacing < MAX_SPACING) SetSpacing(m_nSpacing + 1); break; + // Clipboard Manager + case kcToggleClipboardManager: + patternClipboardDialog.Toggle(); + break; + case kcClipboardPrev: + patternClipboard.CycleBackward(); + patternClipboardDialog.UpdateList(); + break; + case kcClipboardNext: + patternClipboard.CycleForward(); + patternClipboardDialog.UpdateList(); + break; + } //Ranges: if(wParam >= kcVPStartNotes && wParam <= kcVPEndNotes) @@ -4784,7 +4798,7 @@ } // Create undo-point. - pModDoc->GetPatternUndo().PrepareUndo(nPat, nChn, nRow, 1, 1, "Note Stop Entry"); + pModDoc->GetPatternUndo().PrepareUndo(nPat, nChn, nRow, 1, 1); // -- write sdx if playing live if(usePlaybackPosition && nTick && pTarget->command == CMD_NONE && !doQuantize) @@ -4937,41 +4951,41 @@ { CMainFrame *pMainFrm = CMainFrame::GetMainFrame(); CModDoc *pModDoc = GetDocument(); - CSoundFile *pSndFile; - if(pMainFrm == nullptr || pModDoc == nullptr || (pSndFile = pModDoc->GetSoundFile()) == nullptr) + if(pMainFrm == nullptr || pModDoc == nullptr) { return; } + CSoundFile &sndFile = pModDoc->GetrSoundFile(); ROWINDEX nRow = GetCurrentRow(); - const ROWINDEX nRowPlayback = pSndFile->m_nRow; - const UINT nTick = pSndFile->m_nTickCount; - const PATTERNINDEX nPatPlayback = pSndFile->m_nPattern; + const ROWINDEX nRowPlayback = sndFile.m_nRow; + const UINT nTick = sndFile.m_nTickCount; + const PATTERNINDEX nPatPlayback = sndFile.m_nPattern; const bool recordEnabled = IsEditingEnabled(); CHANNELINDEX nChn = GetCurrentChannel(); if(note < NOTE_MIN_SPECIAL) { - Limit(note, pSndFile->GetModSpecifications().noteMin, pSndFile->GetModSpecifications().noteMax); + Limit(note, sndFile.GetModSpecifications().noteMin, sndFile.GetModSpecifications().noteMax); } // Special case: Convert note off commands to C00 for MOD files - if((pSndFile->GetType() == MOD_TYPE_MOD) && (note == NOTE_NOTECUT || note == NOTE_FADE || note == NOTE_KEYOFF)) + if((sndFile.GetType() == MOD_TYPE_MOD) && (note == NOTE_NOTECUT || note == NOTE_FADE || note == NOTE_KEYOFF)) { TempEnterFX(CMD_VOLUME, 0); return; } // Check whether the module format supports the note. - if(pSndFile->GetModSpecifications().HasNote(note) == false) + if(sndFile.GetModSpecifications().HasNote(note) == false) { return; } BYTE recordGroup = pModDoc->IsChannelRecord(nChn); const bool liveRecord = IsLiveRecord(); - const bool usePlaybackPosition = (liveRecord && (CMainFrame::GetSettings().m_dwPatternSetup & PATTERN_AUTODELAY) && !pSndFile->m_SongFlags[SONG_STEP]); + const bool usePlaybackPosition = (liveRecord && (CMainFrame::GetSettings().m_dwPatternSetup & PATTERN_AUTODELAY) && !sndFile.m_SongFlags[SONG_STEP]); const bool isSplit = IsNoteSplit(note); if(pModDoc->GetSplitKeyboardSettings().IsSplitActive() @@ -5004,7 +5018,7 @@ PATTERNINDEX nPat = m_nPattern; if(usePlaybackPosition) - SetEditPos(*pSndFile, nRow, nPat, nRowPlayback, nPatPlayback); + SetEditPos(sndFile, nRow, nPat, nRowPlayback, nPatPlayback); // Quantize const bool doQuantize = (liveRecord || (fromMidi && (CMainFrame::GetSettings().m_dwMidiSetup & MIDISETUP_PLAYPATTERNONMIDIIN))) && CMainFrame::GetSettings().recordQuantizeRows != 0; @@ -5012,14 +5026,14 @@ { QuantizeRow(nPat, nRow); // "Grace notes" are stuffed into the next row, if possible - if(pSndFile->Patterns[nPat].GetpModCommand(nRow, nChn)->IsNote() && nRow < pSndFile->Patterns[nPat].GetNumRows() - 1) + if(sndFile.Patterns[nPat].GetpModCommand(nRow, nChn)->IsNote() && nRow < sndFile.Patterns[nPat].GetNumRows() - 1) { nRow++; } } // -- Work out where to put the new note - ModCommand *pTarget = pSndFile->Patterns[nPat].GetpModCommand(nRow, nChn); + ModCommand *pTarget = sndFile.Patterns[nPat].GetpModCommand(nRow, nChn); ModCommand newcmd = *pTarget; // Param control 'note' @@ -5070,7 +5084,7 @@ if(volWrite != -1) { - if(pSndFile->GetModSpecifications().HasVolCommand(VOLCMD_VOLUME)) + if(sndFile.GetModSpecifications().HasVolCommand(VOLCMD_VOLUME)) { newcmd.volcmd = VOLCMD_VOLUME; newcmd.vol = (ModCommand::VOL)volWrite; @@ -5086,9 +5100,9 @@ { if(newcmd.command == CMD_NONE) //make sure we don't overwrite any existing commands. { - newcmd.command = (pSndFile->TypeIsS3M_IT_MPT()) ? CMD_S3MCMDEX : CMD_MODCMDEX; + newcmd.command = (sndFile.TypeIsS3M_IT_MPT()) ? CMD_S3MCMDEX : CMD_MODCMDEX; UINT maxSpeed = 0x0F; - if(pSndFile->m_nMusicSpeed > 0) maxSpeed = min(0x0F, pSndFile->m_nMusicSpeed - 1); + if(sndFile.m_nMusicSpeed > 0) maxSpeed = min(0x0F, sndFile.m_nMusicSpeed - 1); newcmd.param = 0xD0 + min(maxSpeed, nTick); } } @@ -5131,7 +5145,7 @@ ROWINDEX srow = nRow; while(srow-- > 0) { - search -= pSndFile->GetNumChannels(); + search -= sndFile.GetNumChannels(); if (search->instr && !search->IsPcNote()) { nPlayIns = search->instr; @@ -5174,7 +5188,7 @@ { if((m_nSpacing > 0) && (m_nSpacing <= MAX_SPACING)) { - if(nRow + m_nSpacing < pSndFile->Patterns[nPat].GetNumRows() || (CMainFrame::GetSettings().m_dwPatternSetup & PATTERN_CONTSCROLL)) + if(nRow + m_nSpacing < sndFile.Patterns[nPat].GetNumRows() || (CMainFrame::GetSettings().m_dwPatternSetup & PATTERN_CONTSCROLL)) { SetCurrentRow(nRow + m_nSpacing, (CMainFrame::GetSettings().m_dwPatternSetup & PATTERN_CONTSCROLL) ? true: false); m_bLastNoteEntryBlocked = false; @@ -5217,11 +5231,11 @@ { CMainFrame *pMainFrm = CMainFrame::GetMainFrame(); CModDoc *pModDoc = GetDocument(); - CSoundFile *pSndFile; - if(pMainFrm == nullptr || pModDoc == nullptr || (pSndFile = pModDoc->GetSoundFile()) == nullptr) + if(pMainFrm == nullptr || pModDoc == nullptr) { return; } + CSoundFile &sndFile = pModDoc->GetrSoundFile(); UINT nPlayChord = 0; BYTE chordplaylist[3]; @@ -5229,13 +5243,13 @@ const CHANNELINDEX nChn = GetCurrentChannel(); UINT nPlayIns = 0; // Simply backup the whole row. - pModDoc->GetPatternUndo().PrepareUndo(m_nPattern, nChn, GetCurrentRow(), pSndFile->GetNumChannels(), 1); + pModDoc->GetPatternUndo().PrepareUndo(m_nPattern, nChn, GetCurrentRow(), sndFile.GetNumChannels(), 1); - const PatternRow rowBase = pSndFile->Patterns[m_nPattern].GetRow(GetCurrentRow()); + const PatternRow rowBase = sndFile.Patterns[m_nPattern].GetRow(GetCurrentRow()); ModCommand* pTarget = &rowBase[nChn]; // Save old row contents - vector<ModCommand> newrow(pSndFile->GetNumChannels()); - for(CHANNELINDEX n = 0; n < pSndFile->GetNumChannels(); n++) + vector<ModCommand> newrow(sndFile.GetNumChannels()); + for(CHANNELINDEX n = 0; n < sndFile.GetNumChannels(); n++) { newrow[n] = rowBase[n]; } @@ -5272,10 +5286,10 @@ recordGroup = pModDoc->IsChannelRecord(nChn); - for (UINT kchrd=1; kchrd<pSndFile->m_nChannels; kchrd++) + for (UINT kchrd=1; kchrd < sndFile.m_nChannels; kchrd++) { if ((nchno > 2) || (!pChords[nchord].notes[nchno])) break; - if (++nchordch >= pSndFile->m_nChannels) nchordch = 0; + if (++nchordch >= sndFile.m_nChannels) nchordch = 0; currentRecordGroup = pModDoc->IsChannelRecord(nchordch); if (!recordGroup) @@ -5316,7 +5330,7 @@ if(modified) { - for(CHANNELINDEX n = 0; n < pSndFile->GetNumChannels(); n++) + for(CHANNELINDEX n = 0; n < sndFile.GetNumChannels(); n++) { rowBase[n] = newrow[n]; } @@ -5354,7 +5368,7 @@ ROWINDEX srow = GetCurrentRow(); while (srow-- > 0) { - search -= pSndFile->GetNumChannels(); + search -= sndFile.GetNumChannels(); if (search->instr) { nPlayIns = search->instr; @@ -6655,6 +6669,7 @@ BeginWaitCursor(); bool result = GetPatternClipboard().Copy(*GetSoundFile(), nPattern, selection); EndWaitCursor(); + patternClipboardDialog.UpdateList(); return result; } @@ -6664,13 +6679,26 @@ //---------------------------------------------------------------------------------------------------------------------- { BeginWaitCursor(); - bool result = GetPatternClipboard().Paste(*GetSoundFile(), nPattern, pastePos, mode); + ModCommandPos pos; + pos.pattern = nPattern; + pos.row = pastePos.GetRow(); + pos.channel = pastePos.GetChannel(); + bool result = GetPatternClipboard().Paste(*GetSoundFile(), pos, mode, SendCtrlMessage(CTRLMSG_GETCURRENTORDER)); EndWaitCursor(); + if(pos.pattern != nPattern) + { + // Multipaste: Switch to pasted pattern. + SetCurrentPattern(pos.pattern); + ORDERINDEX curOrder = SendCtrlMessage(CTRLMSG_GETCURRENTORDER); + curOrder = GetSoundFile()->Order.FindOrder(pos.pattern, curOrder); + SendCtrlMessage(CTRLMSG_SETCURRENTORDER, curOrder); + } + if(result) { GetDocument()->SetModified(); - GetDocument()->UpdateAllViews(NULL, HINT_PATTERNDATA | (nPattern << HINT_SHIFT_PAT), NULL); + GetDocument()->UpdateAllViews(NULL, HINT_MODSEQUENCE | HINT_PATTERNDATA | (pos.pattern << HINT_SHIFT_PAT), NULL); } return result; Modified: trunk/OpenMPT/mptrack/View_pat.h =================================================================== --- trunk/OpenMPT/mptrack/View_pat.h 2013-03-11 15:49:33 UTC (rev 1559) +++ trunk/OpenMPT/mptrack/View_pat.h 2013-03-11 22:47:40 UTC (rev 1560) @@ -190,6 +190,7 @@ // Internal pattern clipboard static PatternClipboard patternClipboard; + static PatternClipboardDialog patternClipboardDialog; QuickChannelProperties quickChannelProperties; @@ -215,6 +216,7 @@ void SetModified(bool updateAllViews = true); static PatternClipboard &GetPatternClipboard() { return patternClipboard; } + static PatternClipboardDialog &GetPatternClipboardDialog() { return patternClipboardDialog; } bool UpdateSizes(); void UpdateScrollSize(); Modified: trunk/OpenMPT/mptrack/mptrack.rc =================================================================== --- trunk/OpenMPT/mptrack/mptrack.rc 2013-03-11 15:49:33 UTC (rev 1559) +++ trunk/OpenMPT/mptrack/mptrack.rc 2013-03-11 22:47:40 UTC (rev 1560) @@ -243,6 +243,19 @@ CONTROL "&Surround",IDC_CHECK2,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | WS_TABSTOP,192,54,42,12 END +IDD_CLIPBOARD DIALOGEX 0, 0, 166, 201 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTERMOUSE | WS_POPUP | WS_CAPTION | WS_SYSMENU +EXSTYLE WS_EX_TOOLWINDOW +CAPTION "Clipboard Manager" +FONT 8, "MS Shell Dlg", 400, 0, 0x1 +BEGIN + LISTBOX IDC_LIST1,6,6,156,156,LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP + LTEXT "Number of clipboards:",IDC_... [truncated message content] |
From: <sag...@us...> - 2013-03-12 01:41:52
|
Revision: 1562 http://sourceforge.net/p/modplug/code/1562 Author: saga-games Date: 2013-03-12 01:41:35 +0000 (Tue, 12 Mar 2013) Log Message: ----------- [Imp] Added clipboard manager to main menu [Ref] Made TrackerSettings, PatternClipboard and PatternClipboardDialog singletons (not stored in other objects anymore) [Ref] More TrackerSettings related refactoring. Modified Paths: -------------- trunk/OpenMPT/mptrack/Childfrm.cpp trunk/OpenMPT/mptrack/Ctrl_com.cpp trunk/OpenMPT/mptrack/Ctrl_com.h trunk/OpenMPT/mptrack/Ctrl_gen.cpp trunk/OpenMPT/mptrack/Ctrl_gen.h trunk/OpenMPT/mptrack/Ctrl_ins.cpp trunk/OpenMPT/mptrack/Ctrl_ins.h trunk/OpenMPT/mptrack/Ctrl_pat.cpp trunk/OpenMPT/mptrack/Ctrl_pat.h trunk/OpenMPT/mptrack/Ctrl_seq.cpp trunk/OpenMPT/mptrack/Ctrl_smp.cpp trunk/OpenMPT/mptrack/Ctrl_smp.h trunk/OpenMPT/mptrack/Draw_pat.cpp trunk/OpenMPT/mptrack/Globals.cpp trunk/OpenMPT/mptrack/InputHandler.cpp trunk/OpenMPT/mptrack/KeyConfigDlg.cpp trunk/OpenMPT/mptrack/MainFrm.cpp trunk/OpenMPT/mptrack/Mainbar.cpp trunk/OpenMPT/mptrack/Mainfrm.h trunk/OpenMPT/mptrack/Mod2wave.cpp trunk/OpenMPT/mptrack/Moddoc.cpp trunk/OpenMPT/mptrack/Moptions.cpp trunk/OpenMPT/mptrack/Mpdlgs.cpp trunk/OpenMPT/mptrack/Mpdlgs.h trunk/OpenMPT/mptrack/Mpt_midi.cpp trunk/OpenMPT/mptrack/Mptrack.cpp trunk/OpenMPT/mptrack/Mptrack.h trunk/OpenMPT/mptrack/PatternClipboard.cpp trunk/OpenMPT/mptrack/PatternClipboard.h trunk/OpenMPT/mptrack/PatternEditorDialogs.cpp trunk/OpenMPT/mptrack/SelectPluginDialog.cpp trunk/OpenMPT/mptrack/TrackerSettings.cpp trunk/OpenMPT/mptrack/TrackerSettings.h trunk/OpenMPT/mptrack/TuningDialog.cpp trunk/OpenMPT/mptrack/Undo.cpp trunk/OpenMPT/mptrack/UpdateCheck.cpp trunk/OpenMPT/mptrack/View_ins.cpp trunk/OpenMPT/mptrack/View_pat.cpp trunk/OpenMPT/mptrack/View_pat.h trunk/OpenMPT/mptrack/View_smp.cpp trunk/OpenMPT/mptrack/View_tre.cpp trunk/OpenMPT/mptrack/Vstplug.cpp trunk/OpenMPT/mptrack/dlg_misc.cpp trunk/OpenMPT/mptrack/mptrack.rc trunk/OpenMPT/mptrack/resource.h trunk/OpenMPT/soundlib/Load_mid.cpp trunk/OpenMPT/soundlib/MixerSettings.cpp trunk/OpenMPT/soundlib/MixerSettings.h trunk/OpenMPT/soundlib/Snd_defs.h trunk/OpenMPT/soundlib/Snd_eq.cpp trunk/OpenMPT/soundlib/Sndfile.cpp trunk/OpenMPT/soundlib/Sndmix.cpp trunk/OpenMPT/soundlib/WindowedFIR.h Modified: trunk/OpenMPT/mptrack/Childfrm.cpp =================================================================== --- trunk/OpenMPT/mptrack/Childfrm.cpp 2013-03-11 22:50:59 UTC (rev 1561) +++ trunk/OpenMPT/mptrack/Childfrm.cpp 2013-03-12 01:41:35 UTC (rev 1562) @@ -92,7 +92,7 @@ { if ((--glMdiOpenCount) == 0) { - CMainFrame::GetSettings().gbMdiMaximize = m_bMaxWhenClosed; + TrackerSettings::Instance().gbMdiMaximize = m_bMaxWhenClosed; } } @@ -104,7 +104,7 @@ if (!m_wndSplitter.CreateStatic(this, 2, 1)) return FALSE; // add the first splitter pane - the default view in row 0 - int cy = CMainFrame::GetSettings().glGeneralWindowHeight; //rewbs.varWindowSize - default to general tab. + int cy = TrackerSettings::Instance().glGeneralWindowHeight; //rewbs.varWindowSize - default to general tab. if (cy <= 1) cy = (lpcs->cy*2) / 3; if (!m_wndSplitter.CreateView(0, 0, pContext->m_pNewViewClass, CSize(0, cy), pContext)) return FALSE; @@ -140,7 +140,7 @@ void CChildFrame::ActivateFrame(int nCmdShow) //------------------------------------------- { - if ((glMdiOpenCount == 1) && (CMainFrame::GetSettings().gbMdiMaximize) && (nCmdShow == -1)) + if ((glMdiOpenCount == 1) && (TrackerSettings::Instance().gbMdiMaximize) && (nCmdShow == -1)) { nCmdShow = SW_SHOWMAXIMIZED; } @@ -245,7 +245,7 @@ CRect rect; m_bMaxWhenClosed = IsZoomed(); - if (bForce) CMainFrame::GetSettings().gbMdiMaximize = m_bMaxWhenClosed; + if (bForce) TrackerSettings::Instance().gbMdiMaximize = m_bMaxWhenClosed; if (!IsIconic()) { CWnd *pWnd = m_wndSplitter.GetPane(0, 0); @@ -255,18 +255,18 @@ LONG l = rect.Height(); //rewbs.varWindowSize - not the nicest piece of code, but we need to distinguish btw the views: if (strcmp("CViewGlobals",m_szCurrentViewClassName) == 0) - CMainFrame::GetSettings().glGeneralWindowHeight = l; + TrackerSettings::Instance().glGeneralWindowHeight = l; else if (strcmp("CViewPattern", m_szCurrentViewClassName) == 0) - CMainFrame::GetSettings().glPatternWindowHeight = l; + TrackerSettings::Instance().glPatternWindowHeight = l; else if (strcmp("CViewSample", m_szCurrentViewClassName) == 0) - CMainFrame::GetSettings().glSampleWindowHeight = l; + TrackerSettings::Instance().glSampleWindowHeight = l; else if (strcmp("CViewInstrument", m_szCurrentViewClassName) == 0) - CMainFrame::GetSettings().glInstrumentWindowHeight = l; + TrackerSettings::Instance().glInstrumentWindowHeight = l; else if (strcmp("CViewComments", m_szCurrentViewClassName) == 0) - CMainFrame::GetSettings().glCommentsWindowHeight = l; + TrackerSettings::Instance().glCommentsWindowHeight = l; //rewbs.graph else if (strcmp("CViewGraph", m_szCurrentViewClassName) == 0) - CMainFrame::GetSettings().glGraphWindowHeight = l; + TrackerSettings::Instance().glGraphWindowHeight = l; //end rewbs.graph } Modified: trunk/OpenMPT/mptrack/Ctrl_com.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_com.cpp 2013-03-11 22:50:59 UTC (rev 1561) +++ trunk/OpenMPT/mptrack/Ctrl_com.cpp 2013-03-12 01:41:35 UTC (rev 1562) @@ -93,7 +93,7 @@ rect.right = rcClient.right - rect.left; if ((rect.right > rect.left) && (rect.bottom > rect.top)) { - int cxmax = (CMainFrame::GetSettings().m_dwPatternSetup & PATTERN_LARGECOMMENTS) ? 80*8 : 80*6; + int cxmax = (TrackerSettings::Instance().m_dwPatternSetup & PATTERN_LARGECOMMENTS) ? 80*8 : 80*6; int cx = rect.Width(), cy = rect.Height(); if (cx > cxmax) cx = cxmax; if ((cx != cx0) || (cy != cy0)) m_EditComments.SetWindowPos(NULL, 0,0, cx, cy, SWP_NOMOVE|SWP_NOZORDER|SWP_DRAWFRAME); @@ -108,7 +108,7 @@ if (m_nLockCount) return; m_nLockCount++; HFONT newfont; - if (CMainFrame::GetSettings().m_dwPatternSetup & PATTERN_LARGECOMMENTS) + if (TrackerSettings::Instance().m_dwPatternSetup & PATTERN_LARGECOMMENTS) newfont = CMainFrame::GetLargeFixedFont(); else newfont = CMainFrame::GetFixedFont(); Modified: trunk/OpenMPT/mptrack/Ctrl_com.h =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_com.h 2013-03-11 22:50:59 UTC (rev 1561) +++ trunk/OpenMPT/mptrack/Ctrl_com.h 2013-03-12 01:41:35 UTC (rev 1562) @@ -21,7 +21,7 @@ public: CCtrlComments(); - LONG* GetSplitPosRef() {return &CMainFrame::GetSettings().glCommentsWindowHeight;} //rewbs.varWindowSize + LONG* GetSplitPosRef() {return &TrackerSettings::Instance().glCommentsWindowHeight;} //rewbs.varWindowSize public: //{{AFX_DATA(CCtrlComments) Modified: trunk/OpenMPT/mptrack/Ctrl_gen.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_gen.cpp 2013-03-11 22:50:59 UTC (rev 1561) +++ trunk/OpenMPT/mptrack/Ctrl_gen.cpp 2013-03-12 01:41:35 UTC (rev 1562) @@ -250,7 +250,7 @@ } if (dwHint & HINT_MPTSETUP) { - CheckDlgButton(IDC_CHECK_LOOPSONG, (CMainFrame::GetSettings().gbLoopSong) ? TRUE : FALSE); + CheckDlgButton(IDC_CHECK_LOOPSONG, (TrackerSettings::Instance().gbLoopSong) ? TRUE : FALSE); } if (dwHint & HINT_MPTOPTIONS) { @@ -512,12 +512,12 @@ void CCtrlGeneral::OnLoopSongChanged() //------------------------------------ { - CMainFrame::GetSettings().gbLoopSong = IsDlgButtonChecked(IDC_CHECK_LOOPSONG); + TrackerSettings::Instance().gbLoopSong = IsDlgButtonChecked(IDC_CHECK_LOOPSONG); CModDoc *pModDoc = GetDocument(); if (pModDoc) { CSoundFile *pSndFile = pModDoc->GetSoundFile(); - if (pSndFile) pSndFile->SetRepeatCount((CMainFrame::GetSettings().gbLoopSong) ? -1 : 0); + if (pSndFile) pSndFile->SetRepeatCount((TrackerSettings::Instance().gbLoopSong) ? -1 : 0); } } Modified: trunk/OpenMPT/mptrack/Ctrl_gen.h =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_gen.h 2013-03-11 22:50:59 UTC (rev 1561) +++ trunk/OpenMPT/mptrack/Ctrl_gen.h 2013-03-12 01:41:35 UTC (rev 1562) @@ -43,7 +43,7 @@ { public: CCtrlGeneral(); - LONG* GetSplitPosRef() {return &CMainFrame::GetSettings().glGeneralWindowHeight;} //rewbs.varWindowSize + LONG* GetSplitPosRef() {return &TrackerSettings::Instance().glGeneralWindowHeight;} //rewbs.varWindowSize private: void setAsDecibels(LPSTR stringToSet, double value, double valueAtZeroDB); Modified: trunk/OpenMPT/mptrack/Ctrl_ins.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_ins.cpp 2013-03-11 22:50:59 UTC (rev 1561) +++ trunk/OpenMPT/mptrack/Ctrl_ins.cpp 2013-03-12 01:41:35 UTC (rev 1562) @@ -1487,7 +1487,7 @@ { TCHAR szName[_MAX_FNAME], szExt[_MAX_EXT]; _tsplitpath(lpszFileName, nullptr, nullptr, szName, szExt); - CMainFrame::GetSettings().SetWorkingDirectory(lpszFileName, DIR_INSTRUMENTS, true); + TrackerSettings::Instance().SetWorkingDirectory(lpszFileName, DIR_INSTRUMENTS, true); if (!pIns->name[0] && m_pSndFile->GetModSpecifications().instrNameLengthMax > 0) { @@ -1763,12 +1763,12 @@ "GF1 Patches (*.pat)|*.pat|" "Impulse Tracker Instruments (*.iti)|*.iti|" "All Files (*.*)|*.*||", - CMainFrame::GetSettings().GetWorkingDirectory(DIR_INSTRUMENTS), + TrackerSettings::Instance().GetWorkingDirectory(DIR_INSTRUMENTS), true, &nLastIndex); if(files.abort) return; - CMainFrame::GetSettings().SetWorkingDirectory(files.workingDirectory.c_str(), DIR_INSTRUMENTS, true); + TrackerSettings::Instance().SetWorkingDirectory(files.workingDirectory.c_str(), DIR_INSTRUMENTS, true); for(size_t counter = 0; counter < files.filenames.size(); counter++) { @@ -1820,7 +1820,7 @@ "Impulse Tracker Instruments (*.iti)|*.iti|" "Compressed Impulse Tracker Instruments (*.iti)|*.iti|" "FastTracker II Instruments (*.xi)|*.xi||", - CMainFrame::GetSettings().GetWorkingDirectory(DIR_INSTRUMENTS), false, &index); + TrackerSettings::Instance().GetWorkingDirectory(DIR_INSTRUMENTS), false, &index); if(files.abort) return; BeginWaitCursor(); @@ -1846,7 +1846,7 @@ strcpy(szFileName, drive); strcat(szFileName, path); - CMainFrame::GetSettings().SetWorkingDirectory(files.workingDirectory.c_str(), DIR_INSTRUMENTS); + TrackerSettings::Instance().SetWorkingDirectory(files.workingDirectory.c_str(), DIR_INSTRUMENTS); // -> CODE#0023 // -> DESC="IT project files (.itp)" Modified: trunk/OpenMPT/mptrack/Ctrl_ins.h =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_ins.h 2013-03-11 22:50:59 UTC (rev 1561) +++ trunk/OpenMPT/mptrack/Ctrl_ins.h 2013-03-12 01:41:35 UTC (rev 1562) @@ -130,7 +130,7 @@ BOOL OpenInstrument(CSoundFile *pSndFile, UINT nInstr); BOOL EditSample(UINT nSample); VOID UpdateFilterText(); - LONG* GetSplitPosRef() {return &CMainFrame::GetSettings().glInstrumentWindowHeight;} //rewbs.varWindowSize + LONG* GetSplitPosRef() {return &TrackerSettings::Instance().glInstrumentWindowHeight;} //rewbs.varWindowSize public: //{{AFX_VIRTUAL(CCtrlInstruments) Modified: trunk/OpenMPT/mptrack/Ctrl_pat.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_pat.cpp 2013-03-11 22:50:59 UTC (rev 1561) +++ trunk/OpenMPT/mptrack/Ctrl_pat.cpp 2013-03-12 01:41:35 UTC (rev 1562) @@ -105,9 +105,9 @@ { m_nInstrument = 0; - m_bVUMeters = CMainFrame::GetSettings().gbPatternVUMeters; - m_bPluginNames = CMainFrame::GetSettings().gbPatternPluginNames; //rewbs.patPlugNames - m_bRecord = CMainFrame::GetSettings().gbPatternRecord; + m_bVUMeters = TrackerSettings::Instance().gbPatternVUMeters; + m_bPluginNames = TrackerSettings::Instance().gbPatternPluginNames; //rewbs.patPlugNames + m_bRecord = TrackerSettings::Instance().gbPatternRecord; m_nDetailLevel = PatternCursor::lastColumn; } @@ -157,7 +157,7 @@ m_ToolBar.AddButton(ID_PATTERNDETAIL_MED, TIMAGE_PATTERN_DETAIL_MED, TBSTYLE_CHECK, TBSTATE_ENABLED); m_ToolBar.AddButton(ID_PATTERNDETAIL_HI, TIMAGE_PATTERN_DETAIL_HI, TBSTYLE_CHECK, TBSTATE_ENABLED|TBSTATE_CHECKED); m_ToolBar.AddButton(ID_SEPARATOR, 0, TBSTYLE_SEP); - m_ToolBar.AddButton(ID_OVERFLOWPASTE, TIMAGE_PATTERN_OVERFLOWPASTE, TBSTYLE_CHECK, ((CMainFrame::GetSettings().m_dwPatternSetup & PATTERN_OVERFLOWPASTE) ? TBSTATE_CHECKED : 0) | TBSTATE_ENABLED); + m_ToolBar.AddButton(ID_OVERFLOWPASTE, TIMAGE_PATTERN_OVERFLOWPASTE, TBSTYLE_CHECK, ((TrackerSettings::Instance().m_dwPatternSetup & PATTERN_OVERFLOWPASTE) ? TBSTATE_CHECKED : 0) | TBSTATE_ENABLED); // Special edit controls -> tab switch to view m_EditSequence.SetParent(this); @@ -168,12 +168,12 @@ m_EditOrderListMargins.SetLimitText(3); // Spin controls m_SpinSpacing.SetRange(0, MAX_SPACING); - m_SpinSpacing.SetPos(CMainFrame::GetSettings().gnPatternSpacing); + m_SpinSpacing.SetPos(TrackerSettings::Instance().gnPatternSpacing); m_SpinInstrument.SetRange(-1, 1); m_SpinInstrument.SetPos(0); - if(CMainFrame::GetSettings().gbShowHackControls == true) + if(TrackerSettings::Instance().gbShowHackControls == true) { m_SpinOrderListMargins.ShowWindow(SW_SHOW); m_EditOrderListMargins.ShowWindow(SW_SHOW); @@ -186,9 +186,9 @@ m_EditOrderListMargins.ShowWindow(SW_HIDE); } - SetDlgItemInt(IDC_EDIT_SPACING, CMainFrame::GetSettings().gnPatternSpacing); + SetDlgItemInt(IDC_EDIT_SPACING, TrackerSettings::Instance().gnPatternSpacing); SetDlgItemInt(IDC_EDIT_ORDERLIST_MARGINS, m_OrderList.GetMargins()); - CheckDlgButton(IDC_PATTERN_FOLLOWSONG, !(CMainFrame::GetSettings().m_dwPatternSetup & PATTERN_FOLLOWSONGOFF)); //rewbs.noFollow - set to unchecked + CheckDlgButton(IDC_PATTERN_FOLLOWSONG, !(TrackerSettings::Instance().m_dwPatternSetup & PATTERN_FOLLOWSONGOFF)); //rewbs.noFollow - set to unchecked m_SpinSequence.SetRange(0, m_pSndFile->Order.GetNumSequences() - 1); m_SpinSequence.SetPos(m_pSndFile->Order.GetCurrentSequenceIndex()); @@ -278,8 +278,8 @@ m_ToolBar.UpdateStyle(); // -> CODE#0007 // -> DESC="uncheck follow song checkbox by default" - //CheckDlgButton(IDC_PATTERN_FOLLOWSONG, (CMainFrame::GetSettings().m_dwPatternSetup & PATTERN_FOLLOWSONGOFF) ? MF_UNCHECKED : MF_CHECKED); - m_ToolBar.SetState(ID_OVERFLOWPASTE, ((CMainFrame::GetSettings().m_dwPatternSetup & PATTERN_OVERFLOWPASTE) ? TBSTATE_CHECKED : 0) | TBSTATE_ENABLED); + //CheckDlgButton(IDC_PATTERN_FOLLOWSONG, (TrackerSettings::Instance().m_dwPatternSetup & PATTERN_FOLLOWSONGOFF) ? MF_UNCHECKED : MF_CHECKED); + m_ToolBar.SetState(ID_OVERFLOWPASTE, ((TrackerSettings::Instance().m_dwPatternSetup & PATTERN_OVERFLOWPASTE) ? TBSTATE_CHECKED : 0) | TBSTATE_ENABLED); // -! BEHAVIOUR_CHANGE#0007 } if(dwHintMask & (HINT_MODTYPE|HINT_INSNAMES|HINT_SMPNAMES|HINT_PATNAMES)) @@ -452,7 +452,7 @@ case CTRLMSG_SETRECORD: if (lParam >= 0) m_bRecord = (BOOL)(lParam); else m_bRecord = !m_bRecord; m_ToolBar.SetState(IDC_PATTERN_RECORD, ((m_bRecord) ? TBSTATE_CHECKED : 0)|TBSTATE_ENABLED); - CMainFrame::GetSettings().gbPatternRecord = m_bRecord; + TrackerSettings::Instance().gbPatternRecord = m_bRecord; SendViewMessage(VIEWMSG_SETRECORD, m_bRecord); break; @@ -723,13 +723,13 @@ { if ((m_EditSpacing.m_hWnd) && (m_EditSpacing.GetWindowTextLength() > 0)) { - CMainFrame::GetSettings().gnPatternSpacing = GetDlgItemInt(IDC_EDIT_SPACING); - if (CMainFrame::GetSettings().gnPatternSpacing > MAX_SPACING) + TrackerSettings::Instance().gnPatternSpacing = GetDlgItemInt(IDC_EDIT_SPACING); + if (TrackerSettings::Instance().gnPatternSpacing > MAX_SPACING) { - CMainFrame::GetSettings().gnPatternSpacing = MAX_SPACING; - SetDlgItemInt(IDC_EDIT_SPACING, CMainFrame::GetSettings().gnPatternSpacing, FALSE); + TrackerSettings::Instance().gnPatternSpacing = MAX_SPACING; + SetDlgItemInt(IDC_EDIT_SPACING, TrackerSettings::Instance().gnPatternSpacing, FALSE); } - SendViewMessage(VIEWMSG_SETSPACING, CMainFrame::GetSettings().gnPatternSpacing); + SendViewMessage(VIEWMSG_SETSPACING, TrackerSettings::Instance().gnPatternSpacing); } } @@ -984,7 +984,7 @@ { UINT nState = m_ToolBar.GetState(IDC_PATTERN_RECORD); m_bRecord = ((nState & TBSTATE_CHECKED) != 0); - CMainFrame::GetSettings().gbPatternRecord = m_bRecord; + TrackerSettings::Instance().gbPatternRecord = m_bRecord; SendViewMessage(VIEWMSG_SETRECORD, m_bRecord); SwitchToView(); } @@ -995,7 +995,7 @@ { UINT nState = m_ToolBar.GetState(ID_PATTERN_VUMETERS); m_bVUMeters = ((nState & TBSTATE_CHECKED) != 0); - CMainFrame::GetSettings().gbPatternVUMeters = m_bVUMeters; + TrackerSettings::Instance().gbPatternVUMeters = m_bVUMeters; SendViewMessage(VIEWMSG_SETVUMETERS, m_bVUMeters); SwitchToView(); } @@ -1006,7 +1006,7 @@ { UINT nState = m_ToolBar.GetState(ID_VIEWPLUGNAMES); m_bPluginNames = ((nState & TBSTATE_CHECKED) != 0); - CMainFrame::GetSettings().gbPatternPluginNames = m_bPluginNames; + TrackerSettings::Instance().gbPatternPluginNames = m_bPluginNames; SendViewMessage(VIEWMSG_SETPLUGINNAMES, m_bPluginNames); SwitchToView(); } @@ -1235,7 +1235,7 @@ void CCtrlPatterns::OnToggleOverflowPaste() //------------------------------------- { - CMainFrame::GetSettings().m_dwPatternSetup ^= PATTERN_OVERFLOWPASTE; + TrackerSettings::Instance().m_dwPatternSetup ^= PATTERN_OVERFLOWPASTE; UpdateView(HINT_MPTOPTIONS, NULL); SwitchToView(); } Modified: trunk/OpenMPT/mptrack/Ctrl_pat.h =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_pat.h 2013-03-11 22:50:59 UTC (rev 1561) +++ trunk/OpenMPT/mptrack/Ctrl_pat.h 2013-03-12 01:41:35 UTC (rev 1562) @@ -192,7 +192,7 @@ public: CCtrlPatterns(); - LONG* GetSplitPosRef() {return &CMainFrame::GetSettings().glPatternWindowHeight;} //rewbs.varWindowSize + LONG* GetSplitPosRef() {return &TrackerSettings::Instance().glPatternWindowHeight;} //rewbs.varWindowSize public: void SetCurrentPattern(PATTERNINDEX nPat); Modified: trunk/OpenMPT/mptrack/Ctrl_seq.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_seq.cpp 2013-03-11 22:50:59 UTC (rev 1561) +++ trunk/OpenMPT/mptrack/Ctrl_seq.cpp 2013-03-12 01:41:35 UTC (rev 1562) @@ -15,7 +15,7 @@ #include "moddoc.h" #include "globals.h" #include "ctrl_pat.h" -#include "view_pat.h" +#include "PatternClipboard.h" ////////////////////////////////////////////////////////////// // CPatEdit @@ -122,7 +122,7 @@ m_pModDoc = nullptr; m_nScrollPos = m_nXScroll = 0; m_nScrollPos2nd = ORDERINDEX_INVALID; - m_nOrderlistMargins = CMainFrame::GetSettings().orderlistMargins; + m_nOrderlistMargins = TrackerSettings::Instance().orderlistMargins; m_bScrolling = false; m_bDragging = false; } @@ -585,8 +585,8 @@ { const OrdSelection ordsel = GetCurSel(false); BeginWaitCursor(); - CViewPattern::GetPatternClipboard().Copy(*m_pModDoc->GetSoundFile(), ordsel.firstOrd, ordsel.lastOrd); - CViewPattern::GetPatternClipboardDialog().UpdateList(); + PatternClipboard::Instance().Copy(*m_pModDoc->GetSoundFile(), ordsel.firstOrd, ordsel.lastOrd); + PatternClipboardDialog::Instance().UpdateList(); EndWaitCursor(); } @@ -622,7 +622,7 @@ // MOD orderlist always ends after first empty pattern const ORDERINDEX nLength = (pSndFile->GetType() & MOD_TYPE_MOD) ? pSndFile->Order.GetLengthFirstEmpty() : pSndFile->Order.GetLengthTailTrimmed(); - if(CMainFrame::GetSettings().m_dwPatternSetup & PATTERN_HEXDISPLAY) + if(TrackerSettings::Instance().m_dwPatternSetup & PATTERN_HEXDISPLAY) { wsprintf(s, "Position %02Xh of %02Xh", m_nScrollPos, nLength); } Modified: trunk/OpenMPT/mptrack/Ctrl_smp.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_smp.cpp 2013-03-11 22:50:59 UTC (rev 1561) +++ trunk/OpenMPT/mptrack/Ctrl_smp.cpp 2013-03-12 01:41:35 UTC (rev 1562) @@ -831,7 +831,7 @@ if (bOk) { ModSample &sample = m_pSndFile->GetSample(m_nSample); - CMainFrame::GetSettings().SetWorkingDirectory(lpszFileName, DIR_SAMPLES, true); + TrackerSettings::Instance().SetWorkingDirectory(lpszFileName, DIR_SAMPLES, true); if (!sample.filename[0]) { CHAR szFullFilename[_MAX_PATH]; @@ -989,12 +989,12 @@ "AIFF Files (*.aiff;*.8svx)|*.aif;*.aiff;*.8sv;*.8svx;*.svx|" "Raw Samples (*.raw,*.snd,*.pcm)|*.raw;*.snd;*.pcm|" "All Files (*.*)|*.*||", - CMainFrame::GetSettings().GetWorkingDirectory(DIR_SAMPLES), + TrackerSettings::Instance().GetWorkingDirectory(DIR_SAMPLES), true, &nLastIndex); if(files.abort) return; - CMainFrame::GetSettings().SetWorkingDirectory(files.workingDirectory.c_str(), DIR_SAMPLES, true); + TrackerSettings::Instance().SetWorkingDirectory(files.workingDirectory.c_str(), DIR_SAMPLES, true); for(size_t counter = 0; counter < files.filenames.size(); counter++) { @@ -1069,7 +1069,7 @@ "Wave File (*.wav)|*.wav|" "FLAC File (*.flac)|*.flac|" "RAW Audio (*.raw)|*.raw||", - CMainFrame::GetSettings().GetWorkingDirectory(DIR_SAMPLES), false, &filter); + TrackerSettings::Instance().GetWorkingDirectory(DIR_SAMPLES), false, &filter); if(files.abort) return; BeginWaitCursor(); @@ -1122,7 +1122,7 @@ ErrorBox(IDS_ERR_SAVESMP, this); } else { - CMainFrame::GetSettings().SetWorkingDirectory(files.workingDirectory.c_str(), DIR_SAMPLES, true); + TrackerSettings::Instance().SetWorkingDirectory(files.workingDirectory.c_str(), DIR_SAMPLES, true); } SwitchToView(); } Modified: trunk/OpenMPT/mptrack/Ctrl_smp.h =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_smp.h 2013-03-11 22:50:59 UTC (rev 1561) +++ trunk/OpenMPT/mptrack/Ctrl_smp.h 2013-03-12 01:41:35 UTC (rev 1562) @@ -67,7 +67,7 @@ bool SetCurrentSample(SAMPLEINDEX nSmp, LONG lZoom = -1, bool bUpdNum = true); bool OpenSample(LPCSTR lpszFileName); bool OpenSample(const CSoundFile *pSndFile, SAMPLEINDEX nSample); - LONG* GetSplitPosRef() {return &CMainFrame::GetSettings().glSampleWindowHeight;} //rewbs.varWindowSize + LONG* GetSplitPosRef() {return &TrackerSettings::Instance().glSampleWindowHeight;} //rewbs.varWindowSize public: //{{AFX_VIRTUAL(CCtrlSamples) Modified: trunk/OpenMPT/mptrack/Draw_pat.cpp =================================================================== --- trunk/OpenMPT/mptrack/Draw_pat.cpp 2013-03-11 22:50:59 UTC (rev 1561) +++ trunk/OpenMPT/mptrack/Draw_pat.cpp 2013-03-12 01:41:35 UTC (rev 1562) @@ -149,7 +149,7 @@ inline PCPATTERNFONT GetCurrentPatternFont() //------------------------------------------ { - return (CMainFrame::GetSettings().m_dwPatternSetup & PATTERN_SMALLFONT) ? &gSmallPatternFont : &gDefaultPatternFont; + return (TrackerSettings::Instance().m_dwPatternSetup & PATTERN_SMALLFONT) ? &gSmallPatternFont : &gDefaultPatternFont; } @@ -171,25 +171,25 @@ { BYTE r,g,b; - m_Dib.SetAllColors(0, MAX_MODCOLORS, CMainFrame::GetSettings().rgbCustomColors); + m_Dib.SetAllColors(0, MAX_MODCOLORS, TrackerSettings::Instance().rgbCustomColors); - r = hilightcolor(GetRValue(CMainFrame::GetSettings().rgbCustomColors[MODCOLOR_BACKHILIGHT]), - GetRValue(CMainFrame::GetSettings().rgbCustomColors[MODCOLOR_BACKNORMAL])); - g = hilightcolor(GetGValue(CMainFrame::GetSettings().rgbCustomColors[MODCOLOR_BACKHILIGHT]), - GetGValue(CMainFrame::GetSettings().rgbCustomColors[MODCOLOR_BACKNORMAL])); - b = hilightcolor(GetBValue(CMainFrame::GetSettings().rgbCustomColors[MODCOLOR_BACKHILIGHT]), - GetBValue(CMainFrame::GetSettings().rgbCustomColors[MODCOLOR_BACKNORMAL])); + r = hilightcolor(GetRValue(TrackerSettings::Instance().rgbCustomColors[MODCOLOR_BACKHILIGHT]), + GetRValue(TrackerSettings::Instance().rgbCustomColors[MODCOLOR_BACKNORMAL])); + g = hilightcolor(GetGValue(TrackerSettings::Instance().rgbCustomColors[MODCOLOR_BACKHILIGHT]), + GetGValue(TrackerSettings::Instance().rgbCustomColors[MODCOLOR_BACKNORMAL])); + b = hilightcolor(GetBValue(TrackerSettings::Instance().rgbCustomColors[MODCOLOR_BACKHILIGHT]), + GetBValue(TrackerSettings::Instance().rgbCustomColors[MODCOLOR_BACKNORMAL])); m_Dib.SetColor(MODCOLOR_2NDHIGHLIGHT, RGB(r,g,b)); - r = hilightcolor(GetRValue(CMainFrame::GetSettings().rgbCustomColors[MODCOLOR_VOLUME]), - GetRValue(CMainFrame::GetSettings().rgbCustomColors[MODCOLOR_BACKNORMAL])); - g = hilightcolor(GetGValue(CMainFrame::GetSettings().rgbCustomColors[MODCOLOR_VOLUME]), - GetGValue(CMainFrame::GetSettings().rgbCustomColors[MODCOLOR_BACKNORMAL])); - b = hilightcolor(GetBValue(CMainFrame::GetSettings().rgbCustomColors[MODCOLOR_VOLUME]), - GetBValue(CMainFrame::GetSettings().rgbCustomColors[MODCOLOR_BACKNORMAL])); + r = hilightcolor(GetRValue(TrackerSettings::Instance().rgbCustomColors[MODCOLOR_VOLUME]), + GetRValue(TrackerSettings::Instance().rgbCustomColors[MODCOLOR_BACKNORMAL])); + g = hilightcolor(GetGValue(TrackerSettings::Instance().rgbCustomColors[MODCOLOR_VOLUME]), + GetGValue(TrackerSettings::Instance().rgbCustomColors[MODCOLOR_BACKNORMAL])); + b = hilightcolor(GetBValue(TrackerSettings::Instance().rgbCustomColors[MODCOLOR_VOLUME]), + GetBValue(TrackerSettings::Instance().rgbCustomColors[MODCOLOR_BACKNORMAL])); m_Dib.SetColor(MODCOLOR_DEFAULTVOLUME, RGB(r,g,b)); - m_Dib.SetBlendColor(CMainFrame::GetSettings().rgbCustomColors[MODCOLOR_BLENDCOLOR]); + m_Dib.SetBlendColor(TrackerSettings::Instance().rgbCustomColors[MODCOLOR_BLENDCOLOR]); } @@ -670,7 +670,7 @@ PATTERNINDEX nPrevPat = PATTERNINDEX_INVALID; // Display previous pattern - if (CMainFrame::GetSettings().m_dwPatternSetup & PATTERN_SHOWPREVIOUS) + if (TrackerSettings::Instance().m_dwPatternSetup & PATTERN_SHOWPREVIOUS) { const ORDERINDEX startOrder = static_cast<ORDERINDEX>(SendCtrlMessage(CTRLMSG_GETCURRENTORDER)); if(startOrder > 0) @@ -713,7 +713,7 @@ DrawPatternData(hdc, pSndFile, m_nPattern, TRUE, (pMainFrm->GetModPlaying() == pModDoc), yofs, nrows, xofs, rcClient, &ypaint); // Display next pattern - if ((CMainFrame::GetSettings().m_dwPatternSetup & PATTERN_SHOWPREVIOUS) && (ypaint < rcClient.bottom) && (ypaint == ypatternend)) + if ((TrackerSettings::Instance().m_dwPatternSetup & PATTERN_SHOWPREVIOUS) && (ypaint < rcClient.bottom) && (ypaint == ypatternend)) { int nVisRows = (rcClient.bottom - ypaint + m_szCell.cy - 1) / m_szCell.cy; if ((nVisRows > 0) && (m_nMidRow)) @@ -825,9 +825,9 @@ for (UINT row=startRow; row<numRows; row++) { UINT col, xbmp, nbmp, oldrowcolor; - const int compRow = row + CMainFrame::GetSettings().rowDisplayOffset; + const int compRow = row + TrackerSettings::Instance().rowDisplayOffset; - if((CMainFrame::GetSettings().m_dwPatternSetup & PATTERN_HEXDISPLAY)) + if((TrackerSettings::Instance().m_dwPatternSetup & PATTERN_HEXDISPLAY)) wsprintf(s, "%s%02X", compRow < 0 ? "-" : "", abs(compRow)); else wsprintf(s, "%d", compRow); @@ -857,7 +857,7 @@ nMeasure = pSndFile->Patterns[nPattern].GetRowsPerMeasure(); } // secondary highlight (beats) - if ((CMainFrame::GetSettings().m_dwPatternSetup & PATTERN_2NDHIGHLIGHT) + if ((TrackerSettings::Instance().m_dwPatternSetup & PATTERN_2NDHIGHLIGHT) && (nBeat) && (nBeat < numRows)) { if(!(compRow % nBeat)) @@ -866,7 +866,7 @@ } } // primary highlight (measures) - if((CMainFrame::GetSettings().m_dwPatternSetup & PATTERN_STDHIGHLIGHT) + if((TrackerSettings::Instance().m_dwPatternSetup & PATTERN_STDHIGHLIGHT) && (nMeasure) && (nMeasure < numRows)) { if(!(compRow % nMeasure)) @@ -962,7 +962,7 @@ { tx_col = row_col; bk_col = row_bkcol; - if((CMainFrame::GetSettings().m_dwPatternSetup & PATTERN_EFFECTHILIGHT) && m->IsNote()) + if((TrackerSettings::Instance().m_dwPatternSetup & PATTERN_EFFECTHILIGHT) && m->IsNote()) { tx_col = MODCOLOR_NOTE; @@ -1000,7 +1000,7 @@ { tx_col = row_col; bk_col = row_bkcol; - if ((CMainFrame::GetSettings().m_dwPatternSetup & PATTERN_EFFECTHILIGHT) && (m->instr)) + if ((TrackerSettings::Instance().m_dwPatternSetup & PATTERN_EFFECTHILIGHT) && (m->instr)) { tx_col = MODCOLOR_INSTRUMENT; } @@ -1026,7 +1026,7 @@ { tx_col = MODCOLOR_TEXTSELECTED; bk_col = MODCOLOR_BACKSELECTED; - } else if (!m->IsPcNote() && (CMainFrame::GetSettings().m_dwPatternSetup & PATTERN_EFFECTHILIGHT)) + } else if (!m->IsPcNote() && (TrackerSettings::Instance().m_dwPatternSetup & PATTERN_EFFECTHILIGHT)) { if(m->volcmd != VOLCMD_NONE && m->volcmd < MAX_VOLCMDS && volEffectColors[m->volcmd] != 0) { @@ -1049,7 +1049,7 @@ uint16 val = m->GetValueEffectCol(); if(val > ModCommand::maxColumnValue) val = ModCommand::maxColumnValue; fx_col = row_col; - if (!isPCnote && m->command != CMD_NONE && m->command < MAX_EFFECTS && (CMainFrame::GetSettings().m_dwPatternSetup & PATTERN_EFFECTHILIGHT)) + if (!isPCnote && m->command != CMD_NONE && m->command < MAX_EFFECTS && (TrackerSettings::Instance().m_dwPatternSetup & PATTERN_EFFECTHILIGHT)) { if(effectColors[m->command] != 0) fx_col = effectColors[m->command]; @@ -1310,7 +1310,7 @@ sizePage.cy = sizeLine.cy * 8; GetClientRect(&rect); m_nMidRow = 0; - if (CMainFrame::GetSettings().m_dwPatternSetup & PATTERN_CENTERROW) m_nMidRow = (rect.Height() - m_szHeader.cy) / (m_szCell.cy << 1); + if (TrackerSettings::Instance().m_dwPatternSetup & PATTERN_CENTERROW) m_nMidRow = (rect.Height() - m_szHeader.cy) / (m_szCell.cy << 1); if (m_nMidRow) sizeTotal.cy += m_nMidRow * m_szCell.cy * 2; SetScrollSizes(MM_TEXT, sizeTotal, sizePage, sizeLine); //UpdateScrollPos(); //rewbs.FixLPsOddScrollingIssue Modified: trunk/OpenMPT/mptrack/Globals.cpp =================================================================== --- trunk/OpenMPT/mptrack/Globals.cpp 2013-03-11 22:50:59 UTC (rev 1561) +++ trunk/OpenMPT/mptrack/Globals.cpp 2013-03-12 01:41:35 UTC (rev 1562) @@ -723,7 +723,7 @@ if (m_hWnd) { LONG lStyleOld = GetWindowLong(m_hWnd, GWL_STYLE); - if (CMainFrame::GetSettings().m_dwPatternSetup & PATTERN_FLATBUTTONS) + if (TrackerSettings::Instance().m_dwPatternSetup & PATTERN_FLATBUTTONS) lStyleOld |= TBSTYLE_FLAT; else lStyleOld &= ~TBSTYLE_FLAT; Modified: trunk/OpenMPT/mptrack/InputHandler.cpp =================================================================== --- trunk/OpenMPT/mptrack/InputHandler.cpp 2013-03-11 22:50:59 UTC (rev 1561) +++ trunk/OpenMPT/mptrack/InputHandler.cpp 2013-03-12 01:41:35 UTC (rev 1562) @@ -35,7 +35,7 @@ if (sDefaultPath.GetLength() > MAX_PATH - 1) sDefaultPath = ""; - const bool bNoExistingKbdFileSetting = (CMainFrame::GetSettings().m_szKbdFile[0] == 0); + const bool bNoExistingKbdFileSetting = (TrackerSettings::Instance().m_szKbdFile[0] == 0); // 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. @@ -43,10 +43,10 @@ // 4. If there were no keybinging setting already, create a keybinding file to default location // and set it's path to settings. - if (bNoExistingKbdFileSetting || !(activeCommandSet->LoadFile(CMainFrame::GetSettings().m_szKbdFile))) + if (bNoExistingKbdFileSetting || !(activeCommandSet->LoadFile(TrackerSettings::Instance().m_szKbdFile))) { if (bNoExistingKbdFileSetting) - _tcscpy(CMainFrame::GetSettings().m_szKbdFile, sDefaultPath); + _tcscpy(TrackerSettings::Instance().m_szKbdFile, sDefaultPath); bool bSuccess = false; if (PathFileExists(sDefaultPath) == TRUE) bSuccess = activeCommandSet->LoadFile(sDefaultPath); @@ -57,14 +57,14 @@ bSuccess = activeCommandSet->LoadDefaultKeymap(); if (bSuccess && bNoExistingKbdFileSetting) { - activeCommandSet->SaveFile(CMainFrame::GetSettings().m_szKbdFile); + activeCommandSet->SaveFile(TrackerSettings::Instance().m_szKbdFile); } } if (bSuccess == false) ErrorBox(IDS_UNABLE_TO_LOAD_KEYBINDINGS); } // We will only overwrite the default Keybindings.mkb file from now on. - _tcscpy(CMainFrame::GetSettings().m_szKbdFile, sDefaultPath); + _tcscpy(TrackerSettings::Instance().m_szKbdFile, sDefaultPath); //Get Keymap activeCommandSet->GenKeyMap(keyMap); @@ -541,6 +541,7 @@ case ID_HELP: s="&Help"; c = kcHelp; break; case ID_PLUGIN_SETUP: s="Pl&ugin Manager...\t"; c = kcViewAddPlugin; break; case ID_CHANNEL_MANAGER: s="Ch&annel Manager...\t"; c = kcViewChannelManager; break; + case ID_CLIPBOARD_MANAGER: s="C&lipboard Manager...\t"; c = kcToggleClipboardManager; break; case ID_VIEW_SONGPROPERTIES:s="Song P&roperties...\t"; c = kcViewSongProperties; break; //rewbs.graph case ID_VIEW_MIDIMAPPING: s="&MIDI Mapping...\t"; c = kcViewMIDImapping; break; case ID_VIEW_EDITHISTORY: s="Edit &History...\t"; c = kcViewEditHistory; break; @@ -613,6 +614,7 @@ 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)); Modified: trunk/OpenMPT/mptrack/KeyConfigDlg.cpp =================================================================== --- trunk/OpenMPT/mptrack/KeyConfigDlg.cpp 2013-03-11 22:50:59 UTC (rev 1561) +++ trunk/OpenMPT/mptrack/KeyConfigDlg.cpp 2013-03-12 01:41:35 UTC (rev 1562) @@ -161,7 +161,7 @@ m_nCurKeyChoice = -1; m_bModified = false; m_bChoiceModified = false; - m_sFullPathName = CMainFrame::GetSettings().m_szKbdFile; + m_sFullPathName = TrackerSettings::Instance().m_szKbdFile; plocalCmdSet = new CCommandSet(); plocalCmdSet->Copy(CMainFrame::GetInputHandler()->activeCommandSet); @@ -182,7 +182,7 @@ m_eReport.SetWindowText(""); CString s; - s.Format("%d", CMainFrame::GetSettings().gnAutoChordWaitTime); + s.Format("%d", TrackerSettings::Instance().gnAutoChordWaitTime); m_eChordWaitTime.SetWindowText(s); return TRUE; } @@ -820,7 +820,7 @@ CString cs; m_eChordWaitTime.GetWindowText(cs); - CMainFrame::GetSettings().gnAutoChordWaitTime = atoi(cs); + TrackerSettings::Instance().gnAutoChordWaitTime = atoi(cs); CPropertyPage::OnOK(); } @@ -840,7 +840,7 @@ std::string filename = m_sFullPathName; FileDlgResult files = CTrackApp::ShowOpenSaveFileDialog(true, "mkb", filename, "OpenMPT Key Bindings (*.mkb)|*.mkb||", - CMainFrame::GetSettings().m_szKbdFile); + TrackerSettings::Instance().m_szKbdFile); if(files.abort) return; m_sFullPathName = files.first_file.c_str(); @@ -856,7 +856,7 @@ std::string filename = m_sFullPathName; FileDlgResult files = CTrackApp::ShowOpenSaveFileDialog(false, "mkb", filename, "OpenMPT Key Bindings (*.mkb)|*.mkb||", - CMainFrame::GetSettings().m_szKbdFile); + TrackerSettings::Instance().m_szKbdFile); if(files.abort) return; m_sFullPathName = files.first_file.c_str(); Modified: trunk/OpenMPT/mptrack/MainFrm.cpp =================================================================== --- trunk/OpenMPT/mptrack/MainFrm.cpp 2013-03-11 22:50:59 UTC (rev 1561) +++ trunk/OpenMPT/mptrack/MainFrm.cpp 2013-03-12 01:41:35 UTC (rev 1562) @@ -34,6 +34,7 @@ #include "CloseMainDialog.h" #include "SelectPluginDialog.h" #include "ExceptionHandler.h" +#include "PatternClipboard.h" #ifdef _DEBUG #define new DEBUG_NEW @@ -70,15 +71,9 @@ ON_WM_RBUTTONDOWN() ON_COMMAND(ID_VIEW_OPTIONS, OnViewOptions) -// -> CODE#0002 -// -> DESC="list box to choose VST plugin presets (programs)" ON_COMMAND(ID_PLUGIN_SETUP, OnPluginManager) -// -! NEW_FEATURE#0002 - -// -> CODE#0015 -// -> DESC="channels management dlg" ON_COMMAND(ID_CHANNEL_MANAGER, OnChannelManager) -// -! NEW_FEATURE#0015 + ON_COMMAND(ID_CLIPBOARD_MANAGER, OnClipboardManager) ON_COMMAND(ID_VIEW_MIDIMAPPING, OnViewMIDIMapping) //ON_COMMAND(ID_HELP, CMDIFrameWnd::OnHelp) ON_COMMAND(ID_VIEW_SONGPROPERTIES, OnSongProperties) @@ -123,8 +118,6 @@ static DWORD gsdwTotalSamples = 0; static DWORD gdwPlayLatency = 0; -TrackerSettings CMainFrame::m_Settings; - // Globals DWORD CMainFrame::gdwNotificationType = MPTNOTIFY_DEFAULT; UINT CMainFrame::m_nLastOptionsPage = 0; @@ -238,7 +231,7 @@ MemsetZero(g_csAudio); InitializeCriticalSection(&g_csAudio); - m_Settings.LoadSettings(); + TrackerSettings::Instance().LoadSettings(); m_InputHandler = new CInputHandler(this); //rewbs.customKeys //m_pPerfCounter= new CPerformanceCounter(); @@ -270,12 +263,12 @@ OnUpdateFrameTitle(false); // Check for valid sound device - if (!EnumerateSoundDevices(SNDDEV_GET_TYPE(GetSettings().m_nWaveDevice), SNDDEV_GET_NUMBER(GetSettings().m_nWaveDevice), nullptr, 0)) + if (!EnumerateSoundDevices(SNDDEV_GET_TYPE(TrackerSettings::Instance().m_nWaveDevice), SNDDEV_GET_NUMBER(TrackerSettings::Instance().m_nWaveDevice), nullptr, 0)) { - GetSettings().m_nWaveDevice = SNDDEV_BUILD_ID(0, SNDDEV_DSOUND); - if (!EnumerateSoundDevices(SNDDEV_GET_TYPE(GetSettings().m_nWaveDevice), SNDDEV_GET_NUMBER(GetSettings().m_nWaveDevice), nullptr, 0)) + TrackerSettings::Instance().m_nWaveDevice = SNDDEV_BUILD_ID(0, SNDDEV_DSOUND); + if (!EnumerateSoundDevices(SNDDEV_GET_TYPE(TrackerSettings::Instance().m_nWaveDevice), SNDDEV_GET_NUMBER(TrackerSettings::Instance().m_nWaveDevice), nullptr, 0)) { - GetSettings().m_nWaveDevice = SNDDEV_BUILD_ID(0, SNDDEV_WAVEOUT); + TrackerSettings::Instance().m_nWaveDevice = SNDDEV_BUILD_ID(0, SNDDEV_WAVEOUT); } } @@ -386,7 +379,7 @@ AddControlBar(&m_wndStatusBar); //Restore statusbar to mainframe. - if(GetSettings().m_dwPatternSetup & PATTERN_MIDIRECORD) OnMidiRecord(); + if(TrackerSettings::Instance().m_dwPatternSetup & PATTERN_MIDIRECORD) OnMidiRecord(); return 0; } @@ -486,7 +479,7 @@ void CMainFrame::OnClose() //------------------------ { - if(!(GetSettings().m_dwPatternSetup & PATTERN_NOCLOSEDIALOG)) + if(!(TrackerSettings::Instance().m_dwPatternSetup & PATTERN_NOCLOSEDIALOG)) { // Show modified documents window CloseMainDialog dlg; @@ -511,12 +504,12 @@ } // Save Settings RemoveControlBar(&m_wndStatusBar); // Remove statusbar so that its state won't get saved. - m_Settings.SaveSettings(); + TrackerSettings::Instance().SaveSettings(); AddControlBar(&m_wndStatusBar); // Restore statusbar to mainframe. if(m_InputHandler && m_InputHandler->activeCommandSet) { - m_InputHandler->activeCommandSet->SaveFile(GetSettings().m_szKbdFile); + m_InputHandler->activeCommandSet->SaveFile(TrackerSettings::Instance().m_szKbdFile); } EndWaitCursor(); @@ -751,7 +744,7 @@ { ULONG nMaxSleep = CMainFrame::gpSoundDevice->GetMaxFillInterval(); bWait = FALSE; - nSleep = CMainFrame::GetSettings().m_nBufferLength / 8; + nSleep = TrackerSettings::Instance().m_nBufferLength / 8; if (nSleep > nMaxSleep) nSleep = nMaxSleep; if (nSleep < 10) nSleep = 10; if (nSleep > 40) nSleep = 40; @@ -873,7 +866,7 @@ //---------------------------------------------------------------------------------- { WAVEFORMATEXTENSIBLE WaveFormat; - UINT buflen = GetSettings().m_nBufferLength; + UINT buflen = TrackerSettings::Instance().m_nBufferLength; if (!m_pSndFile) return -1; slSampleSize = (bits/8) * channels; @@ -905,14 +898,14 @@ } WaveFormat.SubFormat = guid_MEDIASUBTYPE_PCM; } - if (GetSettings().m_dwSoundSetup & SOUNDSETUP_STREVERSE) CSoundFile::gdwSoundSetup |= SNDMIX_REVERSESTEREO; + if (TrackerSettings::Instance().m_dwSoundSetup & SOUNDSETUP_STREVERSE) CSoundFile::gdwSoundSetup |= SNDMIX_REVERSESTEREO; else CSoundFile::gdwSoundSetup &= ~SNDMIX_REVERSESTEREO; - m_pSndFile->SetWaveConfig(samplespersec, bits, channels, (GetSettings().m_dwSoundSetup & SOUNDSETUP_ENABLEMMX) ? TRUE : FALSE); + m_pSndFile->SetWaveConfig(samplespersec, bits, channels, (TrackerSettings::Instance().m_dwSoundSetup & SOUNDSETUP_ENABLEMMX) ? TRUE : FALSE); // Maybe we failed because someone is playing sound already. // Shut any sound off, and try once more before giving up. - UINT nDevType = SNDDEV_GET_TYPE(GetSettings().m_nWaveDevice); - UINT nDevNo = SNDDEV_GET_NUMBER(GetSettings().m_nWaveDevice); - UINT fulOptions = (GetSettings().m_dwSoundSetup & SOUNDSETUP_SECONDARY) ? SNDDEV_OPTIONS_SECONDARY : 0; + UINT nDevType = SNDDEV_GET_TYPE(TrackerSettings::Instance().m_nWaveDevice); + UINT nDevNo = SNDDEV_GET_NUMBER(TrackerSettings::Instance().m_nWaveDevice); + UINT fulOptions = (TrackerSettings::Instance().m_dwSoundSetup & SOUNDSETUP_SECONDARY) ? SNDDEV_OPTIONS_SECONDARY : 0; if ((gpSoundDevice) && (gpSoundDevice->GetDeviceType() != nDevType)) { gpSoundDevice->Release(); @@ -922,11 +915,11 @@ { if (!CreateSoundDevice(nDevType, &gpSoundDevice)) return -1; } - gpSoundDevice->Configure(m_hWnd, NUM_AUDIO_BUFFERS, GetSettings().m_nBufferLength, fulOptions); + gpSoundDevice->Configure(m_hWnd, NUM_AUDIO_BUFFERS, TrackerSettings::Instance().m_nBufferLength, fulOptions); gbStopSent = FALSE; - m_pSndFile->SetResamplingMode(GetSettings().m_nSrcMode); + m_pSndFile->SetResamplingMode(TrackerSettings::Instance().m_nSrcMode); m_pSndFile->UPDATEDSPEFFECTS(); - m_pSndFile->SetAGC(GetSettings().m_dwQuality & QUALITY_AGC); + m_pSndFile->SetAGC(TrackerSettings::Instance().m_dwQuality & QUALITY_AGC); if (!gpSoundDevice->Open(nDevNo, &WaveFormat.Format)) return -1; return 0; } @@ -940,25 +933,25 @@ if ((!m_pSndFile) || (!m_pSndFile->GetType())) return FALSE; if (m_dwStatus & MODSTATUS_PLAYING) return TRUE; - if (!GetSettings().m_dwRate) GetSettings().m_dwRate = 22050; - if ((GetSettings().m_nChannels != 1) && (GetSettings().m_nChannels != 2) && (GetSettings().m_nChannels != 4)) GetSettings().m_nChannels = 2; - err = audioTryOpeningDevice(GetSettings().m_nChannels, - GetSettings().m_nBitsPerSample, - GetSettings().m_dwRate); + if (!TrackerSettings::Instance().m_dwRate) TrackerSettings::Instance().m_dwRate = 22050; + if ((TrackerSettings::Instance().m_nChannels != 1) && (TrackerSettings::Instance().m_nChannels != 2) && (TrackerSettings::Instance().m_nChannels != 4)) TrackerSettings::Instance().m_nChannels = 2; + err = audioTryOpeningDevice(TrackerSettings::Instance().m_nChannels, + TrackerSettings::Instance().m_nBitsPerSample, + TrackerSettings::Instance().m_dwRate); nFixedBitsPerSample = (gpSoundDevice) ? gpSoundDevice->HasFixedBitsPerSample() : 0; - if ((err) && ((GetSettings().m_dwRate > 44100) || (GetSettings().m_nChannels > 2) || (GetSettings().m_nBitsPerSample > 16) - || ((nFixedBitsPerSample) && (nFixedBitsPerSample != GetSettings().m_nBitsPerSample)))) + if ((err) && ((TrackerSettings::Instance().m_dwRate > 44100) || (TrackerSettings::Instance().m_nChannels > 2) || (TrackerSettings::Instance().m_nBitsPerSample > 16) + || ((nFixedBitsPerSample) && (nFixedBitsPerSample != TrackerSettings::Instance().m_nBitsPerSample)))) { - DWORD oldrate = GetSettings().m_dwRate; + DWORD oldrate = TrackerSettings::Instance().m_dwRate; - GetSettings().m_dwRate = 44100; - if (GetSettings().m_nChannels > 2) GetSettings().m_nChannels = 2; - if (nFixedBitsPerSample) GetSettings().m_nBitsPerSample = nFixedBitsPerSample; - else if (GetSettings().m_nBitsPerSample > 16) GetSettings().m_nBitsPerSample = 16; - err = audioTryOpeningDevice(GetSettings().m_nChannels, - GetSettings().m_nBitsPerSample, - GetSettings().m_dwRate); - if (err) GetSettings().m_dwRate = oldrate; + TrackerSettings::Instance().m_dwRate = 44100; + if (TrackerSettings::Instance().m_nChannels > 2) TrackerSettings::Instance().m_nChannels = 2; + if (nFixedBitsPerSample) TrackerSettings::Instance().m_nBitsPerSample = nFixedBitsPerSample; + else if (TrackerSettings::Instance().m_nBitsPerSample > 16) TrackerSettings::Instance().m_nBitsPerSample = 16; + err = audioTryOpeningDevice(TrackerSettings::Instance().m_nChannels, + TrackerSettings::Instance().m_nBitsPerSample, + TrackerSettings::Instance().m_dwRate); + if (err) TrackerSettings::Instance().m_dwRate = oldrate; } // Display error message box if (err != 0) @@ -1117,7 +1110,7 @@ if (rVu > 0x10000) rVu = 0x10000; p->dwPos[0] = lVu; p->dwPos[1] = rVu; - DWORD dwVuDecay = _muldiv(dwSamplesRead, 120000, GetSettings().m_dwRate) + 1; + DWORD dwVuDecay = _muldiv(dwSamplesRead, 120000, TrackerSettings::Instance().m_dwRate) + 1; if (lVu >= dwVuDecay) gnLVuMeter = (lVu - dwVuDecay) << 11; else gnLVuMeter = 0; if (rVu >= dwVuDecay) gnRVuMeter = (rVu - dwVuDecay) << 11; else gnRVuMeter = 0; } @@ -1132,32 +1125,32 @@ void CMainFrame::UpdateAudioParameters(BOOL bReset) //------------------------------------------------- { - if ((GetSettings().m_nBitsPerSample != 8) && (GetSettings().m_nBitsPerSample != 32)) GetSettings().m_nBitsPerSample = 16; - CSoundFile::SetWaveConfig(GetSettings().m_dwRate, - GetSettings().m_nBitsPerSample, - GetSettings().m_nChannels, - (GetSettings().m_dwSoundSetup & SOUNDSETUP_ENABLEMMX) ? TRUE : FALSE); - if (GetSettings().m_dwSoundSetup & SOUNDSETUP_STREVERSE) + if ((TrackerSettings::Instance().m_nBitsPerSample != 8) && (TrackerSettings::Instance().m_nBitsPerSample != 32)) TrackerSettings::Instance().m_nBitsPerSample = 16; + CSoundFile::SetWaveConfig(TrackerSettings::Instance().m_dwRate, + TrackerSettings::Instance().m_nBitsPerSample, + TrackerSettings::Instance().m_nChannels, + (TrackerSettings::Instance().m_dwSoundSetup & SOUNDSETUP_ENABLEMMX) ? TRUE : FALSE); + if (TrackerSettings::Instance().m_dwSoundSetup & SOUNDSETUP_STREVERSE) CSoundFile::gdwSoundSetup |= SNDMIX_REVERSESTEREO; else CSoundFile::gdwSoundSetup &= ~SNDMIX_REVERSESTEREO; // Soft panning - if (GetSettings().m_dwSoundSetup & SOUNDSETUP_SOFTPANNING) + if (TrackerSettings::Instance().m_dwSoundSetup & SOUNDSETUP_SOFTPANNING) CSoundFile::gdwSoundSetup |= SNDMIX_SOFTPANNING; else CSoundFile::gdwSoundSetup &= ~SNDMIX_SOFTPANNING; - if (GetSettings().m_dwPatternSetup & PATTERN_MUTECHNMODE) + if (TrackerSettings::Instance().m_dwPatternSetup & PATTERN_MUTECHNMODE) CSoundFile::gdwSoundSetup |= SNDMIX_MUTECHNMODE; else CSoundFile::gdwSoundSetup &= ~SNDMIX_MUTECHNMODE; - CSoundFile::SetResamplingMode(GetSettings().m_nSrcMode); + CSoundFile::SetResamplingMode(TrackerSettings::Instance().m_nSrcMode); CSoundFile::UPDATEDSPEFFECTS(); - CSoundFile::SetAGC(GetSettings().m_dwQuality & QUALITY_AGC); - CSoundFile::SetEQGains( GetSettings().m_EqSettings.Gains, MAX_EQ_BANDS, GetSettings().m_EqSettings.Freqs, bReset ); + CSoundFile::SetAGC(TrackerSettings::Instance().m_dwQuality & QUALITY_AGC); + CSoundFile::SetEQGains( TrackerSettings::Instance().m_EqSettings.Gains, MAX_EQ_BANDS, TrackerSettings::Instance().m_EqSettings.Freqs, bReset ); if (bReset) { - CSoundFile::SetMixerSettings(GetSettings().m_MixerSettings); + CSoundFile::SetMixerSettings(TrackerSettings::Instance().m_MixerSettings); CSoundFile::InitPlayer(TRUE); } } @@ -1194,7 +1187,7 @@ void CMainFrame::UpdateColors() //----------------------------- { - COLORREF (&colors)[MAX_MODCOLORS] = GetSettings().rgbCustomColors; + COLORREF (&colors)[MAX_MODCOLORS] = TrackerSettings::Instance().rgbCustomColors; if (bmpPatterns) { bmpPatterns->bmiColors[7] = rgb2quad(GetSysColor(COLOR_BTNFACE)); @@ -1291,8 +1284,8 @@ void CMainFrame::SetPreAmp(UINT n) //-------------------------------- { - GetSettings().m_nPreAmp = n; - if (m_pSndFile) m_pSndFile->SetMasterVolume(GetSettings().m_nPreAmp, true); + TrackerSettings::Instance().m_nPreAmp = n; + if (m_pSndFile) m_pSndFile->SetMasterVolume(TrackerSettings::Instance().m_nPreAmp, true); } @@ -1355,10 +1348,10 @@ pModDoc->SetPause(FALSE); } } - pSndFile->SetRepeatCount((GetSettings().gbLoopSong) ? -1 : 0); + pSndFile->SetRepeatCount((TrackerSettings::Instance().gbLoopSong) ? -1 : 0); - m_pSndFile->SetMasterVolume(GetSettings().m_nPreAmp, true); - m_pSndFile->SetMixerSettings(GetSettings().m_MixerSettings); + m_pSndFile->SetMasterVolume(TrackerSettings::Instance().m_nPreAmp, true); + m_pSndFile->SetMixerSettings(TrackerSettings::Instance().m_MixerSettings); m_pSndFile->InitPlayer(TRUE); MemsetZero(NotifyBuffer); m_dwStatus |= MODSTATUS_PLAYING; @@ -1452,8 +1445,8 @@ return FALSE; } gsdwTotalSamples = 0; - m_pSndFile->SetMasterVolume(GetSettings().m_nPreAmp, true); - m_pSndFile->SetMixerSettings(GetSettings().m_MixerSettings); + m_pSndFile->SetMasterVolume(TrackerSettings::Instance().m_nPreAmp, true); + m_pSndFile->SetMixerSettings(TrackerSettings::Instance().m_MixerSettings); m_pSndFile->InitPlayer(TRUE); m_dwStatus |= MODSTATUS_PLAYING; if (gpSoundDevice) gpSoundDevice->Start(); @@ -1663,9 +1656,9 @@ //------------------------------------------------------------------------------------------------- { const bool isPlaying = (m_dwStatus & MODSTATUS_PLAYING) != 0; - if ((GetSettings().m_dwRate != rate) || ((GetSettings().m_dwSoundSetup & SOUNDSETUP_RESTARTMASK) != (q & SOUNDSETUP_RESTARTMASK)) - || (GetSettings().m_nWaveDevice != wd) || (GetSettings().m_nBufferLength != bufsize) || (nBits != GetSettings().m_nBitsPerSample) - || (GetSettings().m_nChannels != nChns)) + if ((TrackerSettings::Instance().m_dwRate != rate) || ((TrackerSettings::Instance().m_dwSoundSetup & SOUNDSETUP_RESTARTMASK) != (q & SOUNDSETUP_RESTARTMASK)) + || (TrackerSettings::Instance().m_nWaveDevice != wd) || (TrackerSettings::Instance().m_nBufferLength != bufsize) || (nBits != TrackerSettings::Instance().m_nBitsPerSample) + || (TrackerSettings::Instance().m_nChannels != nChns)) { CModDoc *pActiveMod = NULL; HWND hFollow = m_hFollowSong; @@ -1674,12 +1667,12 @@ if ((m_pSndFile) && (!m_pSndFile->IsPaused())) pActiveMod = m_pModPlaying; PauseMod(); } - GetSettings().m_nWaveDevice = wd; - GetSettings().m_dwRate = rate; - GetSettings().m_dwSoundSetup = q; - GetSettings().m_nBufferLength = bufsize; - GetSettings().m_nBitsPerSample = nBits; - GetSettings().m_nChannels = nChns; + TrackerSettings::Instance().m_nWaveDevice = wd; + TrackerSettings::Instance().m_dwRate = rate; + TrackerSettings::Instance().m_dwSoundSetup = q; + TrackerSettings::Instance().m_nBufferLength = bufsize; + TrackerSettings::Instance().m_nBitsPerSample = nBits; + TrackerSettings::Instance().m_nChannels = nChns; { CriticalSection cs; UpdateAudioParameters(FALSE); @@ -1689,9 +1682,9 @@ } else { // No need to restart playback - GetSettings().m_dwSoundSetup = q; - CSoundFile::EnableMMX((GetSettings().m_dwSoundSetup & SOUNDSETUP_ENABLEMMX) != 0); - if (GetSettings().m_dwSoundSetup & SOUNDSETUP_STREVERSE) + TrackerSettings::Instance().m_dwSoundSetup = q; + CSoundFile::EnableMMX((TrackerSettings::Instance().m_dwSoundSetup & SOUNDSETUP_ENABLEMMX) != 0); + if (TrackerSettings::Instance().m_dwSoundSetup & SOUNDSETUP_STREVERSE) CSoundFile::gdwSoundSetup |= SNDMIX_REVERSESTEREO; else CSoundFile::gdwSoundSetup &= ~SNDMIX_REVERSESTEREO; @@ -1703,16 +1696,16 @@ BOOL CMainFrame::SetupPlayer(DWORD q, DWORD srcmode, BOOL bForceUpdate) //--------------------------------------------------------------------- { - if ((q != GetSettings().m_dwQuality) || (srcmode != GetSettings().m_nSrcMode) || (bForceUpdate)) + if ((q != TrackerSettings::Instance().m_dwQuality) || (srcmode != TrackerSettings::Instance().m_nSrcMode) || (bForceUpdate)) { - GetSettings().m_nSrcMode = srcmode; - GetSettings().m_dwQuality = q; + TrackerSettings::Instance().m_nSrcMode = srcmode; + TrackerSettings::Instance().m_dwQuality = q; { CriticalSection cs; - CSoundFile::SetMixerSettings(GetSettings().m_MixerSettings); - CSoundFile::SetResamplingMode(GetSettings().m_nSrcMode); + CSoundFile::SetMixerSettings(TrackerSettings::Instance().m_MixerSettings); + CSoundFile::SetResamplingMode(TrackerSettings::Instance().m_nSrcMode); CSoundFile::UPDATEDSPEFFECTS(); - CSoundFile::SetAGC(GetSettings().m_dwQuality & QUALITY_AGC); + CSoundFile::SetAGC(TrackerSettings::Instance().m_dwQuality & QUALITY_AGC); } PostMessage(WM_MOD_INVALIDATEPATTERNS, HINT_MPTSETUP); } @@ -1724,23 +1717,23 @@ //--------------------------------------------------------------------------------------------------------------------------------- { // will also set working directory - GetSettings().SetDefaultDirectory(szModDir, DIR_MODS); - GetSettings().SetDefaultDirectory(szSampleDir, DIR_SAMPLES); - GetSettings().SetDefaultDirectory(szInstrDir, DIR_INSTRUMENTS); - GetSettings().SetDefaultDirectory(szVstDir, DIR_PLUGINS); - GetSettings().SetDefaultDirectory(szPresetDir, DIR_PLUGINPRESETS); + TrackerSettings::Instance().SetDefaultDirectory(szModDir, DIR_MODS); + TrackerSettings::Instance().SetDefaultDirectory(szSampleDir, DIR_SAMPLES); + TrackerSettings::Instance().SetDefaultDirectory(szInstrDir, DIR_INSTRUMENTS); + TrackerSettings::Instance().SetDefaultDirectory(szVstDir, DIR_PLUGINS); + TrackerSettings::Instance().SetDefaultDirectory(szPresetDir, DIR_PLUGINPRESETS); return TRUE; } BOOL CMainFrame::SetupMiscOptions() //--------------------------------- { - if (CMainFrame::GetSettings().m_dwPatternSetup & PATTERN_MUTECHNMODE) + if (TrackerSettings::Instance().m_dwPatternSetup & PATTERN_MUTECHNMODE) CSoundFile::gdwSoundSetup |= SNDMIX_MUTECHNMODE; else CSoundFile::gdwSoundSetup &= ~SNDMIX_MUTECHNMODE; - m_wndToolBar.EnableFlatButtons(GetSettings().m_dwPatternSetup & PATTERN_FLATBUTTONS); + m_wndToolBar.EnableFlatButtons(TrackerSettings::Instance().m_dwPatternSetup & PATTERN_FLATBUTTONS); UpdateTree(NULL, HINT_MPTOPTIONS); UpdateAllViews(HINT_MPTOPTIONS, NULL); @@ -1751,8 +1744,8 @@ BOOL CMainFrame::SetupMidi(DWORD d, LONG n) //----------------------------------------- { - GetSettings().m_dwMidiSetup = d; - GetSettings().m_nMidiDevice = n; + TrackerSettings::Instance().m_dwMidiSetup = d; + TrackerSettings::Instance().m_nMidiDevice = n; return TRUE; } @@ -1851,12 +1844,12 @@ CPropertySheet dlg("OpenMPT Setup", this, m_nLastOptionsPage); COptionsGeneral general; - COptionsSoundcard sounddlg(GetSettings().m_dwRate, GetSettings().m_dwSoundSetup, GetSettings().m_nBitsPerSample, GetSettings().m_nChannels, GetSettings().m_nBufferLength, GetSettings().m_nWaveDevice); + COptionsSoundcard sounddlg(TrackerSettings::Instance().m_dwRate, TrackerSettings::Instance().m_dwSoundSetup, TrackerSettings::Instance().m_nBitsPerSample, TrackerSettings::Instance().m_nChannels, TrackerSettings::Instance().m_nBufferLength, TrackerSettings::Instance().m_nWaveDevice); COptionsKeyboard keyboard; COptionsColors colors; COptionsPlayer playerdlg; - CMidiSetupDlg mididlg(GetSettings().m_dwMidiSetup, GetSettings().m_nMidiDevice); - CEQSetupDlg eqdlg(&GetSettings().m_EqSettings); + CMidiSetupDlg mididlg(TrackerSettings::Instance().m_dwMidiSetup, TrackerSettings::Instance().m_nMidiDevice); + CEQSetupDlg eqdlg(&TrackerSettings::Instance().m_EqSettings); CAutoSaverGUI autosavedlg(m_pAutoSaver); //rewbs.AutoSaver CUpdateSetupDlg updatedlg; dlg.AddPage(&general); @@ -1921,8 +1914,6 @@ // -! NEW_FEATURE#0002 -// -> CODE#0015 -// -> DESC="channels management dlg" void CMainFrame::OnChannelManager() //--------------------------------- { @@ -1937,7 +1928,15 @@ } } } -// -! NEW_FEATURE#0015 + + +void CMainFrame::OnClipboardManager() +//----------------------------------- +{ + PatternClipboardDialog::Instance().Show(); +} + + void CMainFrame::OnAddDlsBank() //----------------------------- { Modified: trunk/OpenMPT/mptrack/Mainbar.cpp =================================================================== --- trunk/OpenMPT/mptrack/Mainbar.cpp 2013-03-11 22:50:59 UTC (rev 1561) +++ trunk/OpenMPT/mptrack/Mainbar.cpp 2013-03-12 01:41:35 UTC (rev 1562) @@ -316,7 +316,7 @@ void CMainToolBar::Init(CMainFrame *pMainFrm) //------------------------------------------- { - EnableFlatButtons(CMainFrame::GetSettings().m_dwPatternSetup & PATTERN_FLATBUTTONS); + EnableFlatButtons(TrackerSettings::Instance().m_dwPatternSetup & PATTERN_FLATBUTTONS); SetHorizontal(); pMainFrm->DockControlBar(this); } @@ -610,7 +610,7 @@ //------------------------ { m_pModTree = m_pModTreeData = NULL; - m_nTreeSplitRatio = CMainFrame::GetSettings().glTreeSplitRatio; + m_nTreeSplitRatio = TrackerSettings::Instance().glTreeSplitRatio; } @@ -623,7 +623,7 @@ m_pModTree = new CModTree(m_pModTreeData); if (m_pModTree) m_pModTree->SubclassDlgItem(IDC_TREEVIEW, this); m_dwStatus = 0; - m_sizeDefault.cx = CMainFrame::GetSettings().glTreeWindowWidth + 3; + m_sizeDefault.cx = TrackerSettings::Instance().glTreeWindowWidth + 3; m_sizeDefault.cy = 32767; return l; } @@ -648,7 +648,7 @@ void CModTreeBar::Init() //---------------------- { - m_nTreeSplitRatio = CMainFrame::GetSettings().glTreeSplitRatio; + m_nTreeSplitRatio = TrackerSettings::Instance().glTreeSplitRatio; if (m_pModTree) { m_pModTreeData->Init(); @@ -702,9 +702,9 @@ //-------------------------------------------- { CSize sz; - m_sizeDefault.cx = CMainFrame::GetSettings().glTreeWindowWidth; + m_sizeDefault.cx = TrackerSettings::Instance().glTreeWindowWidth; m_sizeDefault.cy = 32767; - sz.cx = CMainFrame::GetSettings().glTreeWindowWidth + 3; + sz.cx = TrackerSettings::Instance().glTreeWindowWidth + 3; if (sz.cx < 4) sz.cx = 4; sz.cy = 32767; return sz; @@ -842,7 +842,7 @@ if (ratio < 0) ratio = 0; if (ratio > 256) ratio = 256; m_nTreeSplitRatio = ratio; - CMainFrame::GetSettings().glTreeSplitRatio = ratio; + TrackerSettings::Instance().glTreeSplitRatio = ratio; RecalcLayout(); } else { @@ -852,7 +852,7 @@ CMainFrame *pMainFrm = CMainFrame::GetMainFrame(); if ((m_nTrackPos != (UINT)rect.Width()) && (pMainFrm)) { - CMainFrame::GetSettings().glTreeWindowWidth = m_nTrackPos - 3; + TrackerSettings::Instance().glTreeWindowWidth = m_nTrackPos - 3; m_sizeDefault.cx = m_nTrackPos; m_sizeDefault.cy = 32767; pMainFrm->RecalcLayout(); Modified: trunk/OpenMPT/mptrack/Mainfrm.h =================================================================== --- trunk/OpenMPT/mptrack/Mainfrm.h 2013-03-11 22:50:59 UTC (rev 1561) +++ trunk/OpenMPT/mptrack/Mainfrm.h 2013-03-12 01:41:35 UTC (rev 1562) @@ -129,91 +129,9 @@ #define QUALITY_EQ 0x80 -// User-defined colors -enum -{ - MODCOLOR_BACKNORMAL = 0, - MODCOLOR_TEXTNORMAL, - MODCOLOR_BACKCURROW, - MODCOLOR_TEXTCURROW, - MODCOLOR_BACKSELECTED, - MODCOLOR_TEXTSELECTED, - MODCOLOR_SAMPLE, - MODCOLOR_BACKPLAYCURSOR, - MODCOLOR_TEXTPLAYCURSOR, - MODCOLOR_BACKHILIGHT, - MODCOLOR_NOTE, - MODCOLOR_INSTRUMENT, - MODCOLOR_VOLUME, - MODCOLOR_PANNING, - MODCOLOR_PITCH, - MODCOLOR_GLOBALS, - MODCOLOR_ENVELOPES, - MODCOLOR_VUMETER_LO, - MODCOLOR_VUMETER_MED, - MODCOLOR_VUMETER_HI, - MODCOLOR_SEPSHADOW, - MODCOLOR_SEPFACE, - MODCOLOR_SEPHILITE, - MODCOLOR_BLENDCOLOR, - MODCOLOR_DODGY_COMMANDS, - MAX_MODCOLORS, - // Internal color codes (not saved to color preset files) - MODCOLOR_2NDHIGHLIGHT, - MODCOLOR_DEFAULTVOLUME, - MAX_MODPALETTECOLORS -}; - #define NUM_VUMETER_PENS 32 -// Pattern Setup (contains also non-pattern related settings) -// Feel free to replace the deprecated flags by new flags, but be sure to -// update TrackerSettings::LoadINISettings() / TrackerSettings::LoadRegistrySettings() as well. -#define PATTERN_PLAYNEWNOTE 0x01 // play new notes while recording -#define PATTERN_LARGECOMMENTS 0x02 // use large font in comments -#define PATTERN_STDHIGHLIGHT 0x04 // enable primary highlight (measures) -#define PATTERN_SMALLFONT 0x08 // use small font in pattern editor -#define PATTERN_CENTERROW 0x10 // always center active row -#define PATTERN_WRAP 0x20 // wrap around cursor i... [truncated message content] |
From: <sag...@us...> - 2013-03-12 16:48:30
|
Revision: 1565 http://sourceforge.net/p/modplug/code/1565 Author: saga-games Date: 2013-03-12 16:48:18 +0000 (Tue, 12 Mar 2013) Log Message: ----------- [Imp] Treeview: Previewing samples does not open the audio device for every new sample playback anymore. Previewing the same file multiple times in a row does not unload and reload it everytime. Modified Paths: -------------- trunk/OpenMPT/mptrack/MainFrm.cpp trunk/OpenMPT/mptrack/Mainfrm.h trunk/OpenMPT/mptrack/View_tre.cpp trunk/OpenMPT/soundlib/Sndfile.cpp trunk/OpenMPT/soundlib/pattern.cpp Modified: trunk/OpenMPT/mptrack/MainFrm.cpp =================================================================== --- trunk/OpenMPT/mptrack/MainFrm.cpp 2013-03-12 02:33:25 UTC (rev 1564) +++ trunk/OpenMPT/mptrack/MainFrm.cpp 2013-03-12 16:48:18 UTC (rev 1565) @@ -226,7 +226,7 @@ m_szXInfoText[0]= 0; //rewbs.xinfo MemsetZero(gpenVuMeter); - + // Create Audio Critical Section MemsetZero(g_csAudio); InitializeCriticalSection(&g_csAudio); @@ -280,7 +280,7 @@ // Setup timer OnUpdateUser(NULL); m_nTimer = SetTimer(1, MPTTIMER_PERIOD, NULL); - + //rewbs: reduce to normal priority during debug for easier hang debugging //SetPriorityClass(GetCurrentProcess(), HIGH_PRIORITY_CLASS); SetPriorityClass(GetCurrentProcess(), NORMAL_PRIORITY_CLASS); @@ -291,7 +291,7 @@ UpdateAudioParameters(TRUE); // Update the tree m_wndTree.Init(); - + CreateExampleModulesMenu(); CreateTemplateModulesMenu(); } @@ -347,9 +347,9 @@ penHalfDarkGray = ::CreatePen(PS_DOT, 0, GetSysColor(COLOR_BTNSHADOW)); penBlack = (HPEN)::GetStockObject(BLACK_PEN); penWhite = (HPEN)::GetStockObject(WHITE_PEN); - - - + + + // Cursors curDragging = theApp.LoadCursor(IDC_DRAGGING); curArrow = theApp.LoadStandardCursor(IDC_ARROW); @@ -554,7 +554,7 @@ return static_cast<DWORD>(atol(valueBuffer)); } -bool CMainFrame::WritePrivateProfileCString(const CString section, const CString key, const CString value, const CString iniFile) +bool CMainFrame::WritePrivateProfileCString(const CString section, const CString key, const CString value, const CString iniFile) { return (WritePrivateProfileString(section, key, value, iniFile) != 0); } @@ -612,7 +612,7 @@ CWnd* pWnd = CWnd::FromHandlePermanent(pMsg->hwnd); CControlBar* pBar = NULL; HWND hwnd = (pWnd) ? pWnd->m_hWnd : NULL; - + if ((hwnd) && (pMsg->message == WM_RBUTTONDOWN)) pBar = DYNAMIC_DOWNCAST(CControlBar, pWnd); if ((pBar != NULL) || ((pMsg->message == WM_NCRBUTTONDOWN) && (pMsg->wParam == HTMENU))) { @@ -712,10 +712,10 @@ //rewbs: reduce to normal priority during debug for easier hang debugging #ifdef NDEBUG SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_ABOVE_NORMAL ); -#endif +#endif #ifdef _DEBUG SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_NORMAL); -#endif +#endif // SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_NORMAL); // -! BEHAVIOUR_CHANGE#0021 for (;;) @@ -867,7 +867,7 @@ { WAVEFORMATEXTENSIBLE WaveFormat; UINT buflen = TrackerSettings::Instance().m_nBufferLength; - + if (!m_pSndFile) return -1; slSampleSize = (bits/8) * channels; sdwAudioBufferSize = ((samplespersec * buflen) / 1000) * slSampleSize; @@ -1134,7 +1134,7 @@ CSoundFile::gdwSoundSetup |= SNDMIX_REVERSESTEREO; else CSoundFile::gdwSoundSetup &= ~SNDMIX_REVERSESTEREO; - + // Soft panning if (TrackerSettings::Instance().m_dwSoundSetup & SOUNDSETUP_SOFTPANNING) CSoundFile::gdwSoundSetup |= SNDMIX_SOFTPANNING; @@ -1264,7 +1264,7 @@ brushYellow = CreateSolidBrush(RGB(0xFF,0xFF,0x00)); if (brushWindow) DeleteObject(brushWindow); - brushWindow = CreateSolidBrush(crBkgnd); + brushWindow = CreateSolidBrush(crBkgnd); if (penSeparator) DeleteObject(penSeparator); penSeparator = CreatePen(PS_SOLID, 0, RGB(GetRValue(crBkgnd)/2, GetGValue(crBkgnd)/2, GetBValue(crBkgnd)/2)); } @@ -1436,8 +1436,8 @@ BOOL CMainFrame::PlaySoundFile(CSoundFile *pSndFile) //-------------------------------------------------- { - if (m_pSndFile) PauseMod(NULL); if ((!pSndFile) || (!pSndFile->GetType())) return FALSE; + if (m_pSndFile && m_pSndFile != pSndFile) PauseMod(NULL); m_pSndFile = pSndFile; if (!audioOpenDevice()) { @@ -1448,8 +1448,8 @@ m_pSndFile->SetMasterVolume(TrackerSettings::Instance().m_nPreAmp, true); m_pSndFile->SetMixerSettings(TrackerSettings::Instance().m_MixerSettings); m_pSndFile->InitPlayer(TRUE); + if(gpSoundDevice && !(m_dwStatus & MODSTATUS_PLAYING)) gpSoundDevice->Start(); m_dwStatus |= MODSTATUS_PLAYING; - if (gpSoundDevice) gpSoundDevice->Start(); SetEvent(m_hAudioWakeUp); return TRUE; } @@ -1460,71 +1460,47 @@ { if(nDLSBank >= CTrackApp::gpDLSBanks.size() || !CTrackApp::gpDLSBanks[nDLSBank]) return FALSE; BeginWaitCursor(); - PlaySoundFile((LPCSTR)NULL); - m_WaveFile.m_nInstruments = 1; + InitPreview(); if (CTrackApp::gpDLSBanks[nDLSBank]->ExtractInstrument(&m_WaveFile, 1, nIns, nRgn)) { + PreparePreview(NOTE_MIDDLEC); PlaySoundFile(&m_WaveFile); - m_WaveFile.SetRepeatCount(-1); } EndWaitCursor(); return TRUE; } -BOOL CMainFrame::PlaySoundFile(LPCSTR lpszFileName, UINT nNote) -//------------------------------------------------------------- +BOOL CMainFrame::PlaySoundFile(LPCSTR lpszFileName, ModCommand::NOTE note) +//------------------------------------------------------------------------ { - CMappedFile f; - bool bOk = false; + static CString prevFile; + bool bOk = (prevFile == lpszFileName && m_pSndFile == &m_WaveFile); - if (lpszFileName) + CriticalSection cs; + if(!bOk && lpszFileName) { + CMappedFile f; + BeginWaitCursor(); - if (!f.Open(lpszFileName)) + if(!f.Open(lpszFileName)) { EndWaitCursor(); return FALSE; } - } - StopPreview(); - m_WaveFile.Create(NULL, 0); - //Avoid global volume ramping when trying samples in the treeview. - m_WaveFile.m_pConfig->setGlobalVolumeAppliesToMaster(false); - m_WaveFile.m_nDefaultGlobalVolume=64; + m_WaveFile.Destroy(); + m_WaveFile.Create(NULL, 0); + InitPreview(); - m_WaveFile.m_nDefaultTempo = 125; - m_WaveFile.m_nGlobalVolume=64; - m_WaveFile.m_nDefaultSpeed = 4; - m_WaveFile.SetRepeatCount(0); - m_WaveFile.m_nType = MOD_TYPE_IT; - m_WaveFile.m_nChannels = 4; - m_WaveFile.m_nInstruments = 1; - m_WaveFile.m_nSamples = 1; - m_WaveFile.Order.resize(3); - m_WaveFile.Order[0] = 0; - m_WaveFile.Order[1] = 1; - m_WaveFile.Order[2] = m_WaveFile.Order.GetInvalidPatIndex(); - m_WaveFile.Patterns.Insert(0,64); - m_WaveFile.Patterns.Insert(1,64); - if (m_WaveFile.Patterns[0]) - { - if (!nNote) nNote = NOTE_MIDDLEC; - ModCommand *m = m_WaveFile.Patterns[0]; - m[0].note = (BYTE)nNote; - m[0].instr = 1; - m[1].note = (BYTE)nNote; - m[1].instr = 1; - } - if (lpszFileName) - { DWORD dwLen = f.GetLength(); - if (dwLen) + if(dwLen) { LPBYTE p = f.Lock(); - if (p) + if(p) { + m_WaveFile.m_SongFlags.set(SONG_PAUSED); + cs.Leave(); // Avoid hanging audio while reading file bOk = m_WaveFile.ReadInstrumentFromFile(1, p, dwLen); if(!bOk) { @@ -1533,45 +1509,32 @@ } f.Unlock(); } - if (bOk) - { - if ((m_WaveFile.m_nSamples > 1) || (m_WaveFile.GetSample(1).uFlags & CHN_LOOP)) - { - ModCommand *m = m_WaveFile.Patterns[0]; - m[32*4].note = NOTE_KEYOFF; - m[32*4+1].note = NOTE_KEYOFF; - m[63*4].note = NOTE_NOTECUT; - m[63*4+1].note = NOTE_NOTECUT; - } else - { - ModCommand *m = m_WaveFile.Patterns[1]; - if (m) - { - m[63*4].command = CMD_POSITIONJUMP; - m[63*4].param = 1; - } - } - bOk = PlaySoundFile(&m_WaveFile) != FALSE; - } } f.Close(); EndWaitCursor(); } + + if(bOk) + { + cs.Enter(); + PreparePreview(note); + bOk = PlaySoundFile(&m_WaveFile) != FALSE; + + prevFile = lpszFileName; + } return bOk; } -BOOL CMainFrame::PlaySoundFile(CSoundFile *pSong, UINT nInstrument, UINT nSample, UINT nNote) -//------------------------------------------------------------------------------------------- +BOOL CMainFrame::PlaySoundFile(CSoundFile *pSong, INSTRUMENTINDEX nInstrument, SAMPLEINDEX nSample, ModCommand::NOTE note) +//------------------------------------------------------------------------------------------------------------------------ { - StopPreview(); + CriticalSection cs; + m_WaveFile.Destroy(); m_WaveFile.Create(NULL, 0); - m_WaveFile.m_nDefaultTempo = 125; - m_WaveFile.m_nDefaultSpeed = 6; - m_WaveFile.SetRepeatCount(0); + InitPreview(); m_WaveFile.m_nType = pSong->m_nType; - m_WaveFile.m_nChannels = 4; - if ((nInstrument) && (nInstrument <= pSong->m_nInstruments)) + if ((nInstrument) && (nInstrument <= pSong->GetNumInstruments())) { m_WaveFile.m_nInstruments = 1; m_WaveFile.m_nSamples = 32; @@ -1580,34 +1543,67 @@ m_WaveFile.m_nInstruments = 0; m_WaveFile.m_nSamples = 1; } - m_WaveFile.Order.resize(3); + if (nInstrument != INSTRUMENTINDEX_INVALID && nInstrument <= pSong->GetNumInstruments()) + { + m_WaveFile.ReadInstrumentFromSong(1, pSong, nInstrument); + } else if(nSample != SAMPLEINDEX_INVALID && nSample <= pSong->GetNumSamples()) + { + m_WaveFile.ReadSampleFromSong(1, pSong, nSample); + } + PreparePreview(note); + return PlaySoundFile(&m_WaveFile); +} + + +void CMainFrame::InitPreview() +//---------------------------- +{ + // Avoid global volume ramping when trying samples in the treeview. + m_WaveFile.m_pConfig->setGlobalVolumeAppliesToMaster(false); + m_WaveFile.m_nDefaultGlobalVolume = m_WaveFile.m_nGlobalVolume = MAX_GLOBAL_VOLUME; + m_WaveFile.m_nDefaultTempo = 125; + m_WaveFile.m_nDefaultSpeed = 4; + m_WaveFile.m_nType = MOD_TYPE_IT; + m_WaveFile.m_nChannels = 4; + m_WaveFile.m_nInstruments = 1; + m_WaveFile.Order.resize(2); m_WaveFile.Order[0] = 0; m_WaveFile.Order[1] = 1; - m_WaveFile.Order[2] = m_WaveFile.Order.GetInvalidPatIndex(); m_WaveFile.Patterns.Insert(0, 64); - m_WaveFile.Patterns.Insert(1, 64); - if (m_WaveFile.Patterns[0]) + m_WaveFile.Patterns.Insert(1, 1); +} + + +void CMainFrame::PreparePreview(ModCommand::NOTE note) +//---------------------------------------------------- +{ + m_WaveFile.m_SongFlags.reset(SONG_PAUSED); + m_WaveFile.SetRepeatCount(-1); + m_WaveFile.SetCurrentPos(0); + + ModCommand *m = m_WaveFile.Patterns[0]; + if(m) { - if (!nNote) nNote = NOTE_MIDDLEC; - ModCommand *m = m_WaveFile.Patterns[0]; - m[0].note = (BYTE)nNote; + m[0].note = note; m[0].instr = 1; - m[1].note = (BYTE)nNote; + m[1].note = note; m[1].instr = 1; - m = m_WaveFile.Patterns[1]; - m[32*4].note = NOTE_FADE; - m[32*4+1].note = NOTE_FADE; - m[63*4].note = NOTE_KEYOFF; - m[63*4+1].note = NOTE_KEYOFF; + + if(m_WaveFile.m_nSamples > 1 || m_WaveFile.GetSample(1).uFlags[CHN_LOOP]) + { + m[32 * 4].note = NOTE_KEYOFF; + m[32 * 4 + 1].note = NOTE_KEYOFF; + m[63 * 4].note = NOTE_NOTECUT; + m[63 * 4 + 1].note = NOTE_NOTECUT; + } } - if ((nInstrument) && (nInstrument <= pSong->GetNumInstruments())) + + m = m_WaveFile.Patterns[1]; + if(m) { - m_WaveFile.ReadInstrumentFromSong(1, pSong, nInstrument); - } else - { - m_WaveFile.ReadSampleFromSong(1, pSong, nSample); + m->command = CMD_POSITIONJUMP; + m->param = 1; } - return PlaySoundFile(&m_WaveFile); } @@ -1772,7 +1768,7 @@ if (lpszText[0] | m_szUserText[0]) { strcpy(m_szUserText, lpszText); - OnUpdateUser(NULL); + OnUpdateUser(NULL); } } @@ -1819,7 +1815,7 @@ if (pModDoc == m_pModPlaying) PauseMod(); // Make sure that OnTimer() won't try to set the closed document modified anymore. - if (pModDoc == m_pJustModifiedDoc) m_pJustModifiedDoc = nullptr; + if (pModDoc == m_pJustModifiedDoc) m_pJustModifiedDoc = nullptr; m_wndTree.OnDocumentClosed(pModDoc); } @@ -1841,7 +1837,7 @@ { if (m_bOptionsLocked) //rewbs.customKeys return; - + CPropertySheet dlg("OpenMPT Setup", this, m_nLastOptionsPage); COptionsGeneral general; COptionsSoundcard sounddlg(TrackerSettings::Instance().m_dwRate, TrackerSettings::Instance().m_dwSoundSetup, TrackerSettings::Instance().m_nBitsPerSample, TrackerSettings::Instance().m_nChannels, TrackerSettings::Instance().m_nBufferLength, TrackerSettings::Instance().m_nWaveDevice); @@ -2042,7 +2038,7 @@ OnViewOptions(); } } - + // Ensure the modified flag gets set in the WinMain thread, even if modification // originated from Audio Thread (access to CWnd is not thread safe). // Flaw: if 2 docs are modified in between Timer ticks (very rare), one mod will be lost. @@ -2213,7 +2209,7 @@ AfxFormatString1(str, IDS_FILE_EXISTS_BUT_IS_NOT_READABLE, (LPCTSTR)sPath); else AfxFormatString1(str, IDS_FILE_DOES_NOT_EXIST, (LPCTSTR)sPath); - Reporting::Notification(str); + Reporting::Notification(str); } } else @@ -2405,7 +2401,7 @@ case kcViewPattern: case kcViewSamples: case kcViewInstruments: - case kcViewComments: + case kcViewComments: case kcViewGraph: //rewbs.graph case kcViewSongProperties: case kcPlayPatternFromCursor: @@ -2451,7 +2447,7 @@ return; CMDIFrameWnd::OnInitMenu(pMenu); - + } //end rewbs.VSTTimeInfo @@ -2514,7 +2510,7 @@ return m_InputHandler->SetEffectLetters(pSndFile->GetModSpecifications()); } } - + return false; } //end rewbs.customKeys @@ -2525,7 +2521,7 @@ //----------------------------------------- { CMDIFrameWnd::OnKillFocus(pNewWnd); - + //rewbs: ensure modifiers are reset when we leave the window (e.g. alt-tab) CMainFrame::GetMainFrame()->GetInputHandler()->SetModifierMask(0); //end rewbs Modified: trunk/OpenMPT/mptrack/Mainfrm.h =================================================================== --- trunk/OpenMPT/mptrack/Mainfrm.h 2013-03-12 02:33:25 UTC (rev 1564) +++ trunk/OpenMPT/mptrack/Mainfrm.h 2013-03-12 16:48:18 UTC (rev 1565) @@ -311,7 +311,7 @@ static UINT m_nLastOptionsPage; static HHOOK ghKbdHook; static DWORD gdwNotificationType; - + // GDI static HICON m_hIcon; static HFONT m_hGUIFont, m_hFixedFont, m_hLargeFixedFont; @@ -362,8 +362,8 @@ public: CMainFrame(/*CString regKeyExtension*/); void Initialize(); - + // Low-Level Audio public: static void UpdateAudioParameters(BOOL bReset=FALSE); @@ -412,8 +412,8 @@ static DWORD GetPrivateProfileDWord(const CString section, const CString key, const DWORD defaultValue, const CString iniFile); static bool WritePrivateProfileCString(const CString section, const CString key, const CString value, const CString iniFile); static CString GetPrivateProfileCString(const CString section, const CString key, const CString defaultValue, const CString iniFile); - + // Misc functions public: void SetUserText(LPCSTR lpszText); @@ -455,17 +455,19 @@ BOOL StopMod(CModDoc *pDoc=NULL); BOOL PauseMod(CModDoc *pDoc=NULL); BOOL PlaySoundFile(CSoundFile *); - BOOL PlaySoundFile(LPCSTR lpszFileName, UINT nNote = 0); - BOOL PlaySoundFile(CSoundFile *pSong, UINT nInstrument, UINT nSample, UINT nNote=0); + BOOL PlaySoundFile(LPCSTR lpszFileName, ModCommand::NOTE note = NOTE_MIDDLEC); + BOOL PlaySoundFile(CSoundFile *pSong, INSTRUMENTINDEX nInstrument, SAMPLEINDEX nSample, ModCommand::NOTE note = NOTE_MIDDLEC); BOOL PlayDLSInstrument(UINT nDLSBank, UINT nIns, UINT nRgn); BOOL StopSoundFile(CSoundFile *); + void InitPreview(); + void PreparePreview(ModCommand::NOTE note); void StopPreview(); - inline BOOL IsPlaying() const { return (m_dwStatus & MODSTATUS_PLAYING); } - inline BOOL IsRendering() const { return (m_dwStatus & MODSTATUS_RENDERING); } //rewbs.VSTTimeInfo + inline BOOL IsPlaying() const { return (m_dwStatus & MODSTATUS_PLAYING); } + inline BOOL IsRendering() const { return (m_dwStatus & MODSTATUS_RENDERING); } inline CModDoc *GetModPlaying() const { return (IsPlaying()||IsRendering()) ? m_pModPlaying : NULL; } - inline CSoundFile *GetSoundFilePlaying() const { return (IsPlaying()||IsRendering()) ? m_pSndFile : NULL; } //rewbs.VSTTimeInfo - BOOL InitRenderer(CSoundFile*); //rewbs.VSTTimeInfo - BOOL StopRenderer(CSoundFile*); //rewbs.VSTTimeInfo + inline CSoundFile *GetSoundFilePlaying() const { return (IsPlaying()||IsRendering()) ? m_pSndFile : NULL; } + BOOL InitRenderer(CSoundFile*); + BOOL StopRenderer(CSoundFile*); void SwitchToActiveView(); BOOL SetupSoundCard(DWORD q, DWORD rate, UINT nbits, UINT chns, UINT bufsize, LONG wd); BOOL SetupDirectories(LPCTSTR szModDir, LPCTSTR szSampleDir, LPCTSTR szInstrDir, LPCTSTR szVstDir, LPCTSTR szPresetDir); @@ -518,8 +520,8 @@ afx_msg void OnPluginManager(); // -! NEW_FEATURE#0002 - + afx_msg void OnChannelManager(); afx_msg void OnClipboardManager(); @@ -552,13 +554,13 @@ DECLARE_MESSAGE_MAP() public: afx_msg void OnInitMenu(CMenu* pMenu); - bool UpdateEffectKeys(); + bool UpdateEffectKeys(); afx_msg void OnKillFocus(CWnd* pNewWnd); afx_msg void OnShowWindow(BOOL bShow, UINT nStatus); // Defines maximum number of items in example modules menu. - static const size_t nMaxItemsInExampleModulesMenu = 50; - static const size_t nMaxItemsInTemplateModulesMenu = 50; + static const size_t nMaxItemsInExampleModulesMenu = 50; + static const size_t nMaxItemsInTemplateModulesMenu = 50; /// Array of paths of example modules that are available from help menu. static std::vector<CString> s_ExampleModulePaths; Modified: trunk/OpenMPT/mptrack/View_tre.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_tre.cpp 2013-03-12 02:33:25 UTC (rev 1564) +++ trunk/OpenMPT/mptrack/View_tre.cpp 2013-03-12 16:48:18 UTC (rev 1565) @@ -205,22 +205,22 @@ } } return TRUE; - } - } + } + } //rewbs.customKeys //We handle keypresses before Windows has a chance to handle them (for alt etc..) - if ((pMsg->message == WM_SYSKEYUP) || (pMsg->message == WM_KEYUP) || + if ((pMsg->message == WM_SYSKEYUP) || (pMsg->message == WM_KEYUP) || (pMsg->message == WM_SYSKEYDOWN) || (pMsg->message == WM_KEYDOWN)) { CInputHandler* ih = (CMainFrame::GetMainFrame())->GetInputHandler(); - + //Translate message manually UINT nChar = pMsg->wParam; UINT nRepCnt = LOWORD(pMsg->lParam); UINT nFlags = HIWORD(pMsg->lParam); KeyEventType kT = ih->GetKeyEventType(nFlags); InputTargetContext ctx = (InputTargetContext)(kCtxViewTree); - + if (ih->KeyEvent(ctx, nChar, nRepCnt, nFlags, kT) != kcNull) return true; // Mapped to a command, no need to pass message on. } @@ -1185,7 +1185,7 @@ case MODITEM_COMMENTS: if (pModDoc) pModDoc->ActivateView(IDD_CONTROL_COMMENTS, 0); return TRUE; - + /*case MODITEM_SEQUENCE: if (pModDoc) pModDoc->ActivateView(IDD_CONTROL_PATTERNS, (dwItem << 16) | 0x8000); return TRUE;*/ @@ -1215,7 +1215,7 @@ case MODITEM_EFFECT: case MODITEM_INSLIB_SAMPLE: case MODITEM_INSLIB_INSTRUMENT: - PlayItem(hItem); + PlayItem(hItem, NOTE_MIDDLEC); return TRUE; case MODITEM_INSLIB_SONG: @@ -1308,10 +1308,10 @@ { if (modItemType == MODITEM_INSLIB_INSTRUMENT) { - pMainFrm->PlaySoundFile(&m_SongFile, static_cast<INSTRUMENTINDEX>(n), SAMPLEINDEX_INVALID, nParam); + pMainFrm->PlaySoundFile(&m_SongFile, static_cast<INSTRUMENTINDEX>(n), SAMPLEINDEX_INVALID, static_cast<ModCommand::NOTE>(nParam)); } else { - pMainFrm->PlaySoundFile(&m_SongFile, INSTRUMENTINDEX_INVALID, static_cast<SAMPLEINDEX>(n), nParam); + pMainFrm->PlaySoundFile(&m_SongFile, INSTRUMENTINDEX_INVALID, static_cast<SAMPLEINDEX>(n), static_cast<ModCommand::NOTE>(nParam)); } } } else @@ -1346,7 +1346,7 @@ { CDLSBank *pDLSBank = CTrackApp::gpDLSBanks[bank]; UINT rgn = 0, instr = (modItem & 0x00007FFF); - // Drum + // Drum if (modItem & 0x80000000) { rgn = (modItem & 0x007F0000) >> 16; @@ -1585,7 +1585,7 @@ { TV_INSERTSTRUCT tvis; char s[_MAX_PATH+32], szPath[_MAX_PATH] = ""; - + if (!m_hInsLib) return; SetRedraw(FALSE); if ((m_szSongName[0]) && (!m_pDataTree)) @@ -1641,7 +1641,7 @@ if (m_pDataTree) { strcpy(s, "?:\\"); - for (UINT iDrive='A'; iDrive<='Z'; iDrive++) //rewbs.fix3112: < became <= + for (UINT iDrive='A'; iDrive<='Z'; iDrive++) { s[0] = (CHAR)iDrive; UINT nDriveType = GetDriveType(s); @@ -1710,7 +1710,7 @@ strcpy(szFileName, m_szInstrLibPath); strncat(szFileName, wfd.cFileName, sizeof(szFileName)); _splitpath(szFileName, NULL, NULL, NULL, s); - + if(s[0]) { const size_t len = strlen(s); @@ -1870,7 +1870,7 @@ { CHAR s[_MAX_PATH+80], sdrive[_MAX_DRIVE]; BOOL bOk = FALSE, bSong = FALSE; - + if ((!lpszDir) || (!lpszDir[0])) return FALSE; BeginWaitCursor(); if (!GetCurrentDirectory(CountOf(s), s)) s[0] = 0; @@ -1955,7 +1955,7 @@ case MODITEM_PATTERN: pdropinfo->dwDropType = DRAGONDROP_PATTERN; break; - + case MODITEM_SAMPLE: pdropinfo->dwDropType = DRAGONDROP_SAMPLE; break; @@ -2021,7 +2021,7 @@ pdropinfo->dwDropItem = (DWORD)((m_qwItemDrag & 0x3F000000) >> 24); // bank # // Melodic: (Instrument) // Drums: (0x80000000) | (Region << 16) | (Instrument) - pdropinfo->lDropParam = (LPARAM)((m_qwItemDrag & 0x80FF7FFF)); // + pdropinfo->lDropParam = (LPARAM)((m_qwItemDrag & 0x80FF7FFF)); break; } } @@ -2308,7 +2308,7 @@ if (!(m_dwStatus & TREESTATUS_DRAGGING)) { bool bDrag = false; - + m_hDropWnd = NULL; m_hItemDrag = hItem; if (m_hItemDrag != NULL) @@ -2455,7 +2455,7 @@ nDefault = ID_MODTREE_EXECUTE; AppendMenu(hMenu, MF_STRING, nDefault, "&View Comments"); break; - + case MODITEM_ORDER: case MODITEM_PATTERN: nDefault = ID_MODTREE_EXECUTE; @@ -2745,7 +2745,7 @@ { HTREEITEM hItem; UINT flags; - + // Bug? if (!(nFlags & (MK_LBUTTON|MK_RBUTTON))) { @@ -3019,7 +3019,7 @@ //---------------------------------- { HTREEITEM hItem = GetSelectedItem(); - + const uint64 modItem = GetModItem(hItem); const ModItemType modItemType = GetModItemType(modItem); const uint32 modItemID = GetModItemID(modItem); @@ -3282,7 +3282,7 @@ HDROP hDropInfo; UINT nFiles; BOOL bOk = FALSE; - + if (!pDataObject) return FALSE; if (!pDataObject->GetData(CF_HDROP, &stgm)) return FALSE; if (stgm.tymed != TYMED_HGLOBAL) return FALSE; @@ -3315,7 +3315,7 @@ //-------------------------------- { HTREEITEM hActive; - + BeginWaitCursor(); RefreshInstrumentLibrary(); if (m_pDataTree) @@ -3392,7 +3392,7 @@ { if (wParam == kcNull) return NULL; - + CMainFrame *pMainFrm = CMainFrame::GetMainFrame(); if (wParam>=kcTreeViewStartNotes && wParam<=kcTreeViewEndNotes) @@ -3401,7 +3401,7 @@ return wParam; } if (wParam>=kcTreeViewStartNoteStops && wParam<=kcTreeViewEndNoteStops) - { + { return wParam; } @@ -3414,7 +3414,7 @@ { CTreeCtrl::OnKillFocus(pNewWnd); CMainFrame::GetMainFrame()->m_bModTreeHasFocus = false; - + } @@ -3519,7 +3519,7 @@ } break; } - + if(text) { CMainFrame::GetMainFrame()->GetInputHandler()->Bypass(true); Modified: trunk/OpenMPT/soundlib/Sndfile.cpp =================================================================== --- trunk/OpenMPT/soundlib/Sndfile.cpp 2013-03-12 02:33:25 UTC (rev 1564) +++ trunk/OpenMPT/soundlib/Sndfile.cpp 2013-03-12 16:48:18 UTC (rev 1565) @@ -820,21 +820,29 @@ BOOL CSoundFile::Destroy() //------------------------ { - size_t i; + for(CHANNELINDEX i = 0; i < MAX_CHANNELS; i++) + { + Chn[i].pModInstrument = nullptr; + Chn[i].pModSample = nullptr; + Chn[i].pCurrentSample = nullptr; + Chn[i].pSample = nullptr; + Chn[i].nLength = 0; + } + Patterns.DestroyPatterns(); FreeMessage(); - for (i=1; i<MAX_SAMPLES; i++) + for(SAMPLEINDEX i = 1; i < MAX_SAMPLES; i++) { Samples[i].FreeSample(); } - for (i = 0; i < MAX_INSTRUMENTS; i++) + for(INSTRUMENTINDEX i = 0; i < MAX_INSTRUMENTS; i++) { delete Instruments[i]; Instruments[i] = nullptr; } - for (i=0; i<MAX_MIXPLUGINS; i++) + for(PLUGINDEX i = 0; i < MAX_MIXPLUGINS; i++) { if ((m_MixPlugins[i].nPluginDataSize) && (m_MixPlugins[i].pPluginData)) { @@ -849,6 +857,7 @@ m_MixPlugins[i].pMixPlugin = NULL; } } + m_nType = MOD_TYPE_NONE; m_nChannels = m_nSamples = m_nInstruments = 0; return TRUE; @@ -1768,7 +1777,7 @@ default: return (gdwMixingFreq * 5 * m_nTempoFactor) / (tempo << 8); - case tempo_mode_alternative: + case tempo_mode_alternative: return gdwMixingFreq / tempo; case tempo_mode_modern: @@ -1779,11 +1788,11 @@ //tick-to-tick tempo correction: if(m_dBufferDiff >= 1) - { + { bufferCount++; m_dBufferDiff--; } else if(m_dBufferDiff <= -1) - { + { bufferCount--; m_dBufferDiff++; } @@ -2195,4 +2204,4 @@ } Patterns.ForEachModCommand(UpgradePatternData(this)); -} \ No newline at end of file +} Modified: trunk/OpenMPT/soundlib/pattern.cpp =================================================================== --- trunk/OpenMPT/soundlib/pattern.cpp 2013-03-12 02:33:25 UTC (rev 1564) +++ trunk/OpenMPT/soundlib/pattern.cpp 2013-03-12 16:48:18 UTC (rev 1565) @@ -97,7 +97,7 @@ void CPattern::ClearCommands() //---------------------------- { - if (m_ModCommands != nullptr) + if(m_ModCommands != nullptr) memset(m_ModCommands, 0, GetNumRows() * GetNumChannels() * sizeof(ModCommand)); } @@ -105,19 +105,24 @@ bool CPattern::AllocatePattern(ROWINDEX rows) //------------------------------------------- { - ModCommand *m = AllocatePattern(rows, GetNumChannels()); - if(m != nullptr) + ModCommand *m = m_ModCommands; + if(m != nullptr && rows == GetNumRows()) { - Deallocate(); - m_ModCommands = m; - m_Rows = rows; - m_RowsPerBeat = m_RowsPerMeasure = 0; - return true; + // Re-use allocated memory + ClearCommands(); + m_ModCommands = nullptr; } else { - return false; + m = AllocatePattern(rows, GetNumChannels()); + if(m == nullptr) + { + return false; + } } - + Deallocate(); + m_ModCommands = m; + m_Rows = rows; + return true; } @@ -414,16 +419,13 @@ ModCommand *CPattern::AllocatePattern(ROWINDEX rows, CHANNELINDEX nchns) //---------------------------------------------------------------------- { - try + size_t patSize = rows * nchns; + ModCommand *p = new (std::nothrow) ModCommand[patSize]; + if(p != nullptr) { - size_t patSize = rows * nchns; - ModCommand *p = new ModCommand[patSize]; memset(p, 0, patSize * sizeof(ModCommand)); - return p; - } catch(MPTMemoryException) - { - return nullptr; } + return p; } @@ -557,7 +559,7 @@ chval |= IT_bitmask_patternChanEnabled_c; Binarywrite<uint8>(oStrm, chval); - + if(diffmask) { lastChnMC[c] = m; @@ -608,7 +610,7 @@ continue; } - CHANNELINDEX ch = (t & IT_bitmask_patternChanField_c); + CHANNELINDEX ch = (t & IT_bitmask_patternChanField_c); if(ch > 0) ch--; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rel...@us...> - 2013-03-12 18:49:38
|
Revision: 1566 http://sourceforge.net/p/modplug/code/1566 Author: relabsoluness Date: 2013-03-12 18:49:28 +0000 (Tue, 12 Mar 2013) Log Message: ----------- [Ref] Cleaned up some compiler warnings, fixed faulty definition of nullptr on compilers that supports it and some other minor tweaks. Modified Paths: -------------- trunk/OpenMPT/common/misc_util.h trunk/OpenMPT/common/serialization_utils.cpp trunk/OpenMPT/common/serialization_utils.h trunk/OpenMPT/common/stdafx.h trunk/OpenMPT/common/typedefs.h trunk/OpenMPT/mptrack/Vstplug.cpp trunk/OpenMPT/soundlib/plugins/PluginEventQueue.h trunk/OpenMPT/soundlib/tuning.cpp trunk/OpenMPT/soundlib/tuning.h Modified: trunk/OpenMPT/common/misc_util.h =================================================================== --- trunk/OpenMPT/common/misc_util.h 2013-03-12 16:48:18 UTC (rev 1565) +++ trunk/OpenMPT/common/misc_util.h 2013-03-12 18:49:28 UTC (rev 1566) @@ -298,6 +298,18 @@ namespace Util { + // Numeric traits provide compile time values for integer min, max limits. + template <class T> struct NumericTraits {}; + template <> struct NumericTraits<int8> {static const int8 maxValue = int8_max; static const int8 minValue = int8_min;}; + template <> struct NumericTraits<int16> {static const int16 maxValue = int16_max; static const int16 minValue = int16_min;}; + template <> struct NumericTraits<int32> {static const int32 maxValue = int32_max; static const int32 minValue = int32_min;}; + template <> struct NumericTraits<int64> {static const int64 maxValue = int64_max; static const int64 minValue = int64_min;}; + + template <> struct NumericTraits<uint8> {static const uint8 maxValue = uint8_max; static const uint8 minValue = 0;}; + template <> struct NumericTraits<uint16> {static const uint16 maxValue = uint16_max; static const uint16 minValue = 0;}; + template <> struct NumericTraits<uint32> {static const uint32 maxValue = uint32_max; static const uint32 minValue = 0;}; + template <> struct NumericTraits<uint64> {static const uint64 maxValue = uint64_max; static const uint64 minValue = 0;}; + // Like std::max, but avoids conflict with max-macro. template <class T> inline const T& Max(const T& a, const T& b) {return (std::max)(a, b);} Modified: trunk/OpenMPT/common/serialization_utils.cpp =================================================================== --- trunk/OpenMPT/common/serialization_utils.cpp 2013-03-12 16:48:18 UTC (rev 1565) +++ trunk/OpenMPT/common/serialization_utils.cpp 2013-03-12 18:49:28 UTC (rev 1566) @@ -441,7 +441,7 @@ m_Status |= SNW_SUBENTRY_FAILURE; delete m_pSubEntry; m_pSubEntry = nullptr; - WriteMapItem(pId, nIdLength, m_posSubEntryStart - m_posStart, m_pOstrm->tellp() - m_posSubEntryStart, ""); + WriteMapItem(pId, nIdLength, static_cast<RposType>(m_posSubEntryStart - m_posStart), static_cast<DataSize>(m_pOstrm->tellp() - m_posSubEntryStart), ""); IncrementWriteCounter(); } @@ -533,8 +533,8 @@ else if (GetFlag(RwfRMapHasId) == false) // Not ID's in map. { ReadEntry e; - e.rposStart = posReadBegin - m_posStart; - e.nSize = m_pIstrm->tellg() - posReadBegin; + e.rposStart = static_cast<RposType>(posReadBegin - m_posStart); + e.nSize = static_cast<DataSize>(m_pIstrm->tellg() - posReadBegin); AddReadNote(&e, m_nCounter); } else // Entry not found. @@ -551,8 +551,13 @@ void Ssb::OnWroteItem(const void* pId, const size_t nIdSize, const Postype& posBeforeWrite) //----------------------------------------------------------------------------------------- { - RposType nEntrySize = m_pOstrm->tellp() - posBeforeWrite; + const Offtype nRawEntrySize = m_pOstrm->tellp() - posBeforeWrite; + if (nRawEntrySize > DataSize_max) + { AddWriteNote(SNW_INSUFFICIENT_DATASIZETYPE); return; } + + DataSize nEntrySize = static_cast<DataSize>(nRawEntrySize); + if(GetFlag(RwfRMapHasSize) && nEntrySize > (uint64_max >> 2)) { AddWriteNote(SNW_DATASIZETYPE_OVERFLOW); return; } @@ -569,10 +574,10 @@ { AddWriteNote(SNW_INSUFFICIENT_FIXEDSIZE); return; } } if (GetFlag(RwfRwHasMap)) - WriteMapItem(pId, nIdSize, posBeforeWrite - m_posStart, nEntrySize, ""); + WriteMapItem(pId, nIdSize, static_cast<RposType>(posBeforeWrite - m_posStart), nEntrySize, ""); if (m_fpLogFunc != nullptr) - AddWriteNote(pId, nIdSize, m_nCounter, nEntrySize, posBeforeWrite - m_posStart); + AddWriteNote(pId, nIdSize, m_nCounter, nEntrySize, static_cast<RposType>(posBeforeWrite - m_posStart)); IncrementWriteCounter(); } @@ -725,7 +730,13 @@ if(tempU64 > Offtype_max) { AddReadNote(SNR_INSUFFICIENT_STREAM_OFFTYPE); return; } } - m_rposEndofHdrData = iStrm.tellg() - m_posStart; + + const Offtype rawEndOfHdrData = iStrm.tellg() - m_posStart; + + if (rawEndOfHdrData < 0 || rawEndOfHdrData > RposType_max) + { AddReadNote(SNR_INSUFFICIENT_RPOSTYPE); return; } + + m_rposEndofHdrData = static_cast<RposType>(rawEndOfHdrData); m_rposMapBegin = (GetFlag(RwfRwHasMap)) ? static_cast<RposType>(tempU64) : m_rposEndofHdrData; if (GetFlag(RwfRwHasMap) == false) @@ -822,8 +833,9 @@ // startpos. if (GetFlag(RwfRMapHasStartpos) == false && (GetFlag(RwfRMapHasSize) || m_nFixedEntrySize > 0)) { + const RposType offset = static_cast<RposType>(m_posDataBegin - m_posStart); for(size_t i = 0; i < m_nReadEntrycount; i++) - mapData[i].rposStart += (m_posDataBegin - m_posStart); + mapData[i].rposStart += offset; } } Modified: trunk/OpenMPT/common/serialization_utils.h =================================================================== --- trunk/OpenMPT/common/serialization_utils.h 2013-03-12 16:48:18 UTC (rev 1565) +++ trunk/OpenMPT/common/serialization_utils.h 2013-03-12 18:49:28 UTC (rev 1566) @@ -34,16 +34,19 @@ typedef Offtype Postype; typedef std::streamsize Streamsize; -typedef UINT_PTR DataSize; // Data size type. -typedef UINT_PTR RposType; // Relative position type. -typedef UINT_PTR NumType; // Entry count type. -const DataSize DataSize_max = MAXUINT_PTR; -const RposType RposType_max = MAXUINT_PTR; -const NumType NumType_max = MAXUINT_PTR; +//typedef uintptr_t DataSize; // Data size type. +//typedef uintptr_t RposType; // Relative position type. +//typedef uintptr_t NumType; // Entry count type. +typedef uintptr_t DataSize; // Data size type. +typedef uintptr_t RposType; // Relative position type. +typedef uintptr_t NumType; // Entry count type. +const DataSize DataSize_max = Util::NumericTraits<DataSize>::maxValue; +const RposType RposType_max = Util::NumericTraits<RposType>::maxValue; +const NumType NumType_max = Util::NumericTraits<NumType>::maxValue; const DataSize invalidDatasize = DataSize_max; -const Offtype Offtype_min = (std::numeric_limits<Offtype>::min)(); -const Offtype Offtype_max = (std::numeric_limits<Offtype>::max)(); +const Offtype Offtype_min = Util::NumericTraits<Offtype>::minValue; +const Offtype Offtype_max = Util::NumericTraits<Offtype>::maxValue; typedef std::basic_string<TCHAR> String; @@ -66,6 +69,7 @@ SNR_INSUFFICIENT_STREAM_OFFTYPE = 5 | SNT_FAILURE, SNR_OBJECTCLASS_IDMISMATCH = 6 | SNT_FAILURE, SNR_TOO_MANY_ENTRIES_TO_READ = 7 | SNT_FAILURE, + SNR_INSUFFICIENT_RPOSTYPE = 8 | SNT_FAILURE, // Read notes and warnings. SNR_ZEROENTRYCOUNT = 0x80 | SNT_NOTE, // 0x80 == 1 << 7 @@ -79,6 +83,7 @@ SNW_DATASIZETYPE_OVERFLOW = (0x13) | SNT_FAILURE, SNW_MAX_WRITE_COUNT_REACHED = (0x14) | SNT_FAILURE, SNW_SUBENTRY_FAILURE = (0x15) | SNT_FAILURE, + SNW_INSUFFICIENT_DATASIZETYPE = (0x16) | SNT_FAILURE, }; bool IsPrintableId(const void* pvId, const size_t nLength); // Return true if given id is printable, false otherwise. Modified: trunk/OpenMPT/common/stdafx.h =================================================================== --- trunk/OpenMPT/common/stdafx.h 2013-03-12 16:48:18 UTC (rev 1565) +++ trunk/OpenMPT/common/stdafx.h 2013-03-12 18:49:28 UTC (rev 1566) @@ -111,16 +111,6 @@ #pragma warning(error : 4309) // Treat "truncation of constant value"-warning as error. -// Definitions for MSVC versions to write more understandable conditional-compilation, -// e.g. #if (_MSC_VER > MSVC_VER_2008) instead of #if (_MSC_VER > 1500) -#define MSVC_VER_VC71 1310 -#define MSVC_VER_2003 MSVC_VER_VC71 -#define MSVC_VER_VC8 1400 -#define MSVC_VER_2005 MSVC_VER_VC8 -#define MSVC_VER_VC9 1500 -#define MSVC_VER_2008 MSVC_VER_VC9 -#define MSVC_VER_VC10 1600 -#define MSVC_VER_2010 MSVC_VER_VC10 //{{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 2013-03-12 16:48:18 UTC (rev 1565) +++ trunk/OpenMPT/common/typedefs.h 2013-03-12 18:49:28 UTC (rev 1566) @@ -10,12 +10,23 @@ #pragma once -#ifndef nullptr -#define nullptr 0 +// Definitions for MSVC versions to write more understandable conditional-compilation, +// e.g. #if (_MSC_VER > MSVC_VER_2008) instead of #if (_MSC_VER > 1500) +#define MSVC_VER_VC71 1310 +#define MSVC_VER_2003 MSVC_VER_VC71 +#define MSVC_VER_VC8 1400 +#define MSVC_VER_2005 MSVC_VER_VC8 +#define MSVC_VER_VC9 1500 +#define MSVC_VER_2008 MSVC_VER_VC9 +#define MSVC_VER_VC10 1600 +#define MSVC_VER_2010 MSVC_VER_VC10 + +#if (_MSC_VER < MSVC_VER_2010) + #define nullptr 0 #endif // CountOf macro computes the number of elements in a statically-allocated array. -#if _MSC_VER >= 1400 +#if _MSC_VER >= MSVC_VER_2005 #define CountOf(x) _countof(x) #else #define CountOf(x) (sizeof(x)/sizeof(x[0])) @@ -26,8 +37,9 @@ #define C_ASSERT(expr) typedef char __C_ASSERT__[(expr)?1:-1] #endif #define STATIC_ASSERT(expr) C_ASSERT(expr) -#ifndef static_assert -#define static_assert(expr, msg) C_ASSERT(expr) + +#if (_MSC_VER < MSVC_VER_2010) + #define static_assert(expr, msg) C_ASSERT(expr) #endif typedef __int8 int8; Modified: trunk/OpenMPT/mptrack/Vstplug.cpp =================================================================== --- trunk/OpenMPT/mptrack/Vstplug.cpp 2013-03-12 16:48:18 UTC (rev 1565) +++ trunk/OpenMPT/mptrack/Vstplug.cpp 2013-03-12 18:49:28 UTC (rev 1566) @@ -251,7 +251,7 @@ void GetPluginInformation(AEffect *effect, VSTPluginLib &library) //--------------------------------------------------------------- { - library.category = static_cast<VSTPluginLib::PluginCategory>(effect->dispatcher(effect, effGetPlugCategory, 0, nullptr, nullptr, 0.0f)); + library.category = static_cast<VSTPluginLib::PluginCategory>(effect->dispatcher(effect, effGetPlugCategory, 0, 0, nullptr, 0.0f)); library.isInstrument = ((effect->flags & effFlagsIsSynth) || !effect->numInputs); if(library.isInstrument) @@ -1593,7 +1593,7 @@ bool CVstPlugin::CanAutomateParameter(PlugParamIndex index) //--------------------------------------------------------- { - return (Dispatch(effCanBeAutomated, index, nullptr, nullptr, 0.0f) != 0); + return (Dispatch(effCanBeAutomated, index, 0, nullptr, 0.0f) != 0); } @@ -1910,7 +1910,7 @@ CString paramName; - if(Dispatch(effGetParameterProperties, param, nullptr, &properties, 0.0f) == 1) + if(Dispatch(effGetParameterProperties, param, 0, &properties, 0.0f) == 1) { StringFixer::SetNullTerminator(properties.label); paramName = properties.label; @@ -2753,7 +2753,7 @@ UINT nLen = nParams * sizeof(float); ULONG nType = *(ULONG *)m_pMixStruct->pPluginData; - if ((Dispatch(effIdentify, 0, nullptr, nullptr, 0) == 'NvEf') && (nType == 'NvEf')) + if ((Dispatch(effIdentify, 0, 0, nullptr, 0) == 'NvEf') && (nType == 'NvEf')) { void *p = nullptr; Dispatch(effGetChunk, 0,0, &p, 0); //init plug for chunk reception @@ -2826,7 +2826,7 @@ { if (m_pEffect) { - return Dispatch(effGetParamName, nIndex, nullptr, pszName, 0.0f); + return Dispatch(effGetParamName, nIndex, 0, pszName, 0.0f); } return 0; } @@ -2845,7 +2845,7 @@ { m_pMixStruct->Info.SetBypass(bypass); - Dispatch(effSetBypass, bypass ? 1 : 0, nullptr, nullptr, 0.0f); + Dispatch(effSetBypass, bypass ? 1 : 0, 0, nullptr, 0.0f); #ifdef MODPLUG_TRACKER if(m_pModDoc) @@ -2913,7 +2913,7 @@ bool CVstPlugin::CanRecieveMidiEvents() //------------------------------------- { - return (CVstPlugin::Dispatch(effCanDo, 0, nullptr, "receiveVstMidiEvent", 0.0f) != 0); + return (CVstPlugin::Dispatch(effCanDo, 0, 0, "receiveVstMidiEvent", 0.0f) != 0); } Modified: trunk/OpenMPT/soundlib/plugins/PluginEventQueue.h =================================================================== --- trunk/OpenMPT/soundlib/plugins/PluginEventQueue.h 2013-03-12 16:48:18 UTC (rev 1565) +++ trunk/OpenMPT/soundlib/plugins/PluginEventQueue.h 2013-03-12 18:49:28 UTC (rev 1566) @@ -59,7 +59,7 @@ PluginEventQueue() { numEvents = 0; - reserved = nullptr; + reserved = 0; MemsetZero(events); MemsetZero(criticalSection); InitializeCriticalSection(&criticalSection); Modified: trunk/OpenMPT/soundlib/tuning.cpp =================================================================== --- trunk/OpenMPT/soundlib/tuning.cpp 2013-03-12 16:48:18 UTC (rev 1565) +++ trunk/OpenMPT/soundlib/tuning.cpp 2013-03-12 18:49:28 UTC (rev 1566) @@ -458,96 +458,6 @@ } -CTuningRTI* CTuningRTI::DeserializeOLD(istream& inStrm) -//----------------------------------------------------------- -{ - if(!inStrm.good()) - return 0; - - char begin[8]; - char end[8]; - int16 version; - - const long startPos = inStrm.tellg(); - - //First checking is there expected begin sequence. - inStrm.read(reinterpret_cast<char*>(&begin), sizeof(begin)); - if(memcmp(begin, "CTRTI_B.", 8)) - { - //Returning stream position if beginmarker was not found. - inStrm.seekg(startPos); - return 0; - } - - //Version - inStrm.read(reinterpret_cast<char*>(&version), sizeof(version)); - if(version != 3) - return 0; - - CTuningRTI* pT = new CTuningRTI; - - //Baseclass deserialization - if(pT->CTuning::DeserializeOLD(inStrm) == SERIALIZATION_FAILURE) - { - delete pT; - return 0; - } - - //Ratiotable - if(VectorFromBinaryStream<RATIOTYPE, uint16>(inStrm, pT->m_RatioTable)) - { - delete pT; - return 0; - } - - //Fineratios - if(VectorFromBinaryStream<RATIOTYPE, uint16>(inStrm, pT->m_RatioTableFine)) - { - delete pT; - return 0; - } - else - pT->m_FineStepCount = pT->m_RatioTableFine.size(); - - //m_StepMin - inStrm.read(reinterpret_cast<char*>(&pT->m_StepMin), sizeof(pT->m_StepMin)); - if (pT->m_StepMin < -200 || pT->m_StepMin > 200) - { - delete pT; - return nullptr; - } - - //m_GroupSize - inStrm.read(reinterpret_cast<char*>(&pT->m_GroupSize), sizeof(pT->m_GroupSize)); - if(pT->m_GroupSize < 0) - { - delete pT; - return 0; - } - - //m_GroupRatio - inStrm.read(reinterpret_cast<char*>(&pT->m_GroupRatio), sizeof(pT->m_GroupRatio)); - if(pT->m_GroupRatio < 0) - { - delete pT; - return 0; - } - - if(pT->GetFineStepCount() > 0) pT->ProSetFineStepCount(pT->GetFineStepCount() - 1); - - inStrm.read(reinterpret_cast<char*>(&end), sizeof(end)); - if(memcmp(end, "CTRTI_E.", 8)) - { - delete pT; - return 0; - } - - - return pT; -} - - - CTUNINGBASE::SERIALIZATION_RETURN_TYPE CTuningRTI::Serialize(ostream& outStrm) const //---------------------------------------------------------------------------------- { Modified: trunk/OpenMPT/soundlib/tuning.h =================================================================== --- trunk/OpenMPT/soundlib/tuning.h 2013-03-12 16:48:18 UTC (rev 1565) +++ trunk/OpenMPT/soundlib/tuning.h 2013-03-12 18:49:28 UTC (rev 1566) @@ -67,8 +67,8 @@ static uint32 GetVersion() {return s_SerializationVersion;} - //Try to read old version (v.3) and return pointer to new instance if succesfull, else 0. - static CTuningRTI* DeserializeOLD(istream& iStrm); + //Try to read old version (v.3) and return pointer to new instance if succesfull, else nullptr. + static CTuningRTI* DeserializeOLD(istream&) {return 0;} SERIALIZATION_RETURN_TYPE Serialize(ostream& out) const; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2013-03-12 19:43:32
|
Revision: 1567 http://sourceforge.net/p/modplug/code/1567 Author: saga-games Date: 2013-03-12 19:43:19 +0000 (Tue, 12 Mar 2013) Log Message: ----------- [Fix] Loading soundfont instruments was broken since... sometime after the 1.21.01.00 release. [Imp] Treeview: Can now also preview soundfont notes other than middle-C. Modified Paths: -------------- trunk/OpenMPT/mptrack/MainFrm.cpp trunk/OpenMPT/mptrack/Mainfrm.h trunk/OpenMPT/mptrack/View_tre.cpp trunk/OpenMPT/soundlib/Dlsbank.cpp Modified: trunk/OpenMPT/mptrack/MainFrm.cpp =================================================================== --- trunk/OpenMPT/mptrack/MainFrm.cpp 2013-03-12 18:49:28 UTC (rev 1566) +++ trunk/OpenMPT/mptrack/MainFrm.cpp 2013-03-12 19:43:19 UTC (rev 1567) @@ -1455,15 +1455,15 @@ } -BOOL CMainFrame::PlayDLSInstrument(UINT nDLSBank, UINT nIns, UINT nRgn) -//--------------------------------------------------------------------- +BOOL CMainFrame::PlayDLSInstrument(UINT nDLSBank, UINT nIns, UINT nRgn, ModCommand::NOTE note) +//-------------------------------------------------------------------------------------------- { if(nDLSBank >= CTrackApp::gpDLSBanks.size() || !CTrackApp::gpDLSBanks[nDLSBank]) return FALSE; BeginWaitCursor(); InitPreview(); - if (CTrackApp::gpDLSBanks[nDLSBank]->ExtractInstrument(&m_WaveFile, 1, nIns, nRgn)) + if(CTrackApp::gpDLSBanks[nDLSBank]->ExtractInstrument(&m_WaveFile, 1, nIns, nRgn)) { - PreparePreview(NOTE_MIDDLEC); + PreparePreview(note); PlaySoundFile(&m_WaveFile); } EndWaitCursor(); @@ -1562,7 +1562,7 @@ m_WaveFile.m_pConfig->setGlobalVolumeAppliesToMaster(false); m_WaveFile.m_nDefaultGlobalVolume = m_WaveFile.m_nGlobalVolume = MAX_GLOBAL_VOLUME; m_WaveFile.m_nDefaultTempo = 125; - m_WaveFile.m_nDefaultSpeed = 4; + m_WaveFile.m_nDefaultSpeed = 6; m_WaveFile.m_nType = MOD_TYPE_IT; m_WaveFile.m_nChannels = 4; m_WaveFile.m_nInstruments = 1; Modified: trunk/OpenMPT/mptrack/Mainfrm.h =================================================================== --- trunk/OpenMPT/mptrack/Mainfrm.h 2013-03-12 18:49:28 UTC (rev 1566) +++ trunk/OpenMPT/mptrack/Mainfrm.h 2013-03-12 19:43:19 UTC (rev 1567) @@ -455,9 +455,9 @@ BOOL StopMod(CModDoc *pDoc=NULL); BOOL PauseMod(CModDoc *pDoc=NULL); BOOL PlaySoundFile(CSoundFile *); - BOOL PlaySoundFile(LPCSTR lpszFileName, ModCommand::NOTE note = NOTE_MIDDLEC); - BOOL PlaySoundFile(CSoundFile *pSong, INSTRUMENTINDEX nInstrument, SAMPLEINDEX nSample, ModCommand::NOTE note = NOTE_MIDDLEC); - BOOL PlayDLSInstrument(UINT nDLSBank, UINT nIns, UINT nRgn); + BOOL PlaySoundFile(LPCSTR lpszFileName, ModCommand::NOTE note); + BOOL PlaySoundFile(CSoundFile *pSong, INSTRUMENTINDEX nInstrument, SAMPLEINDEX nSample, ModCommand::NOTE note); + BOOL PlayDLSInstrument(UINT nDLSBank, UINT nIns, UINT nRgn, ModCommand::NOTE note); BOOL StopSoundFile(CSoundFile *); void InitPreview(); void PreparePreview(ModCommand::NOTE note); Modified: trunk/OpenMPT/mptrack/View_tre.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_tre.cpp 2013-03-12 18:49:28 UTC (rev 1566) +++ trunk/OpenMPT/mptrack/View_tre.cpp 2013-03-12 19:43:19 UTC (rev 1567) @@ -1320,7 +1320,7 @@ CHAR szFullPath[_MAX_PATH] = ""; InsLibGetFullPath(hItem, szFullPath); CMainFrame *pMainFrm = CMainFrame::GetMainFrame(); - if (pMainFrm) pMainFrm->PlaySoundFile(szFullPath, nParam); + if (pMainFrm) pMainFrm->PlaySoundFile(szFullPath, static_cast<ModCommand::NOTE>(nParam)); } break; @@ -1332,7 +1332,7 @@ if ((lpMidiLib) && (modItemID < 256) && (lpMidiLib->MidiMap[modItemID])) { CMainFrame *pMainFrm = CMainFrame::GetMainFrame(); - if (pMainFrm) pMainFrm->PlaySoundFile(lpMidiLib->MidiMap[modItemID], nParam); + if (pMainFrm) pMainFrm->PlaySoundFile(lpMidiLib->MidiMap[modItemID], static_cast<ModCommand::NOTE>(nParam)); } } break; @@ -1355,9 +1355,9 @@ if (modItem & 0x40000000) { if ((!nParam) || (nParam > NOTE_MAX)) nParam = NOTE_MIDDLEC; - rgn = pDLSBank->GetRegionFromKey(instr, nParam-1); + rgn = pDLSBank->GetRegionFromKey(instr, nParam - NOTE_MIN); } - pMainFrm->PlayDLSInstrument(bank, instr, rgn); + pMainFrm->PlayDLSInstrument(bank, instr, rgn, static_cast<ModCommand::NOTE>(nParam)); } } } Modified: trunk/OpenMPT/soundlib/Dlsbank.cpp =================================================================== --- trunk/OpenMPT/soundlib/Dlsbank.cpp 2013-03-12 18:49:28 UTC (rev 1566) +++ trunk/OpenMPT/soundlib/Dlsbank.cpp 2013-03-12 19:43:19 UTC (rev 1567) @@ -1691,18 +1691,20 @@ StringFixer::SetNullTerminator(pIns->name); } int nTranspose = 0; - for (UINT iNoteMap=0; iNoteMap<NOTE_MAX; iNoteMap++) + if (pDlsIns->ulBank & F_INSTRUMENT_DRUMS) { - if (pDlsIns->ulBank & F_INSTRUMENT_DRUMS) + for (UINT iNoteMap=0; iNoteMap<NOTE_MAX; iNoteMap++) { if (pSndFile->GetType() & (MOD_TYPE_IT|MOD_TYPE_MID|MOD_TYPE_MPT)) { if (iNoteMap < pDlsIns->Regions[nDrumRgn].uKeyMin) pIns->NoteMap[iNoteMap] = (BYTE)(pDlsIns->Regions[nDrumRgn].uKeyMin + 1); if (iNoteMap > pDlsIns->Regions[nDrumRgn].uKeyMax) pIns->NoteMap[iNoteMap] = (BYTE)(pDlsIns->Regions[nDrumRgn].uKeyMax + 1); } else - if (iNoteMap == pDlsIns->Regions[nDrumRgn].uKeyMin) { - nTranspose = pDlsIns->Regions[nDrumRgn].uKeyMin - 60; + if (iNoteMap == pDlsIns->Regions[nDrumRgn].uKeyMin) + { + nTranspose = pDlsIns->Regions[nDrumRgn].uKeyMin - 60; + } } } } @@ -1749,7 +1751,7 @@ nSmp = RgnToSmp[nRgn-1]; } else { - nSample = pSndFile->GetNextFreeSample(nInstr); + nSample = pSndFile->GetNextFreeSample(nInstr, nSample + 1); if (nSample == SAMPLEINDEX_INVALID) break; if (nSample > pSndFile->GetNumSamples()) pSndFile->m_nSamples = nSample; nSmp = nSample; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2013-03-13 00:46:21
|
Revision: 1568 http://sourceforge.net/p/modplug/code/1568 Author: saga-games Date: 2013-03-13 00:46:11 +0000 (Wed, 13 Mar 2013) Log Message: ----------- [Ref] More refactoring, mostly getting rid of unncessary includes. Modified Paths: -------------- trunk/OpenMPT/mptrack/EffectInfo.h trunk/OpenMPT/soundlib/Fastmix.cpp trunk/OpenMPT/soundlib/ITTools.cpp trunk/OpenMPT/soundlib/ITTools.h trunk/OpenMPT/soundlib/Load_itp.cpp trunk/OpenMPT/soundlib/pattern.cpp Modified: trunk/OpenMPT/mptrack/EffectInfo.h =================================================================== --- trunk/OpenMPT/mptrack/EffectInfo.h 2013-03-12 19:43:19 UTC (rev 1567) +++ trunk/OpenMPT/mptrack/EffectInfo.h 2013-03-13 00:46:11 UTC (rev 1568) @@ -10,7 +10,8 @@ #pragma once -#include "Moddoc.h" +#include "modcommand.h" +class CSoundFile; //============== class EffectInfo Modified: trunk/OpenMPT/soundlib/Fastmix.cpp =================================================================== --- trunk/OpenMPT/soundlib/Fastmix.cpp 2013-03-12 19:43:19 UTC (rev 1567) +++ trunk/OpenMPT/soundlib/Fastmix.cpp 2013-03-13 00:46:11 UTC (rev 1568) @@ -339,44 +339,66 @@ // Filter values are clipped to double the input range (assuming input is 16-Bit, which it currently is) #define ClipFilter(x) Clamp(x, 2.0f * (float)int16_min, 2.0f * (float)int16_max) -// Mono -#define MIX_BEGIN_FILTER\ - float fy1 = pChannel->nFilter_Y1;\ - float fy2 = pChannel->nFilter_Y2; +// Resonant filter for Mono samples +static inline void ProcessMonoFilter(int &vol, ModChannel *pChn) +//-------------------------------------------------------------- +{ + float fy1 = pChn->nFilter_Y1; + float fy2 = pChn->nFilter_Y2; -#define MIX_END_FILTER\ - pChannel->nFilter_Y1 = fy1;\ - pChannel->nFilter_Y2 = fy2; - -#define SNDMIX_PROCESSFILTER\ - float fy = ((float)vol * pChn->nFilter_A0 + ClipFilter(fy1) * pChn->nFilter_B0 + ClipFilter(fy2) * pChn->nFilter_B1);\ - fy2 = fy1;\ - fy1 = fy - (float)(vol & pChn->nFilter_HP);\ + float fy = ((float)vol * pChn->nFilter_A0 + ClipFilter(fy1) * pChn->nFilter_B0 + ClipFilter(fy2) * pChn->nFilter_B1); + fy2 = fy1; + fy1 = fy - (float)(vol & pChn->nFilter_HP); vol = (int)fy; - -// Stereo -#define MIX_BEGIN_STEREO_FILTER\ - float fy1 = pChannel->nFilter_Y1;\ - float fy2 = pChannel->nFilter_Y2;\ - float fy3 = pChannel->nFilter_Y3;\ - float fy4 = pChannel->nFilter_Y4; + pChn->nFilter_Y1 = fy1; + pChn->nFilter_Y2 = fy2; +} -#define MIX_END_STEREO_FILTER\ - pChannel->nFilter_Y1 = fy1;\ - pChannel->nFilter_Y2 = fy2;\ - pChannel->nFilter_Y3 = fy3;\ - pChannel->nFilter_Y4 = fy4; -#define SNDMIX_PROCESSSTEREOFILTER\ - float fy = ((float)vol_l * pChn->nFilter_A0 + ClipFilter(fy1) * pChn->nFilter_B0 + ClipFilter(fy2) * pChn->nFilter_B1);\ - fy2 = fy1; fy1 = fy - (float)(vol_l & pChn->nFilter_HP);\ - vol_l = (int)fy;\ - fy = ((float)vol_r * pChn->nFilter_A0 + ClipFilter(fy3) * pChn->nFilter_B0 + ClipFilter(fy4) * pChn->nFilter_B1);\ - fy4 = fy3; fy3 = fy - (float)(vol_r & pChn->nFilter_HP);\ +// Resonant filter for Stereo samples +static inline void ProcessStereoFilter(int &vol_l, int &vol_r, ModChannel *pChn) +//------------------------------------------------------------------------------ +{ + // Left channel + + float fy1 = pChn->nFilter_Y1; + float fy2 = pChn->nFilter_Y2; + + float fy = ((float)vol_l * pChn->nFilter_A0 + ClipFilter(fy1) * pChn->nFilter_B0 + ClipFilter(fy2) * pChn->nFilter_B1); + fy2 = fy1; + fy1 = fy - (float)(vol_l & pChn->nFilter_HP); + vol_l = (int)fy; + + pChn->nFilter_Y1 = fy1; + pChn->nFilter_Y2 = fy2; + + // Right channel + + fy1 = pChn->nFilter_Y3; + fy2 = pChn->nFilter_Y4; + + fy = ((float)vol_r * pChn->nFilter_A0 + ClipFilter(fy1) * pChn->nFilter_B0 + ClipFilter(fy2) * pChn->nFilter_B1); + fy2 = fy1; + fy1 = fy - (float)(vol_r & pChn->nFilter_HP); vol_r = (int)fy; + pChn->nFilter_Y3 = fy1; + pChn->nFilter_Y4 = fy2; +} + +// Mono +#define SNDMIX_PROCESSFILTER \ + ProcessMonoFilter(vol, pChn); + + +// Stereo +#define SNDMIX_PROCESSSTEREOFILTER \ + ProcessStereoFilter(vol_l, vol_r, pChn); + + + ////////////////////////////////////////////////////////// // Interfaces @@ -420,24 +442,20 @@ // Mono Resonant Filters #define BEGIN_MIX_FLT_INTERFACE(func)\ - BEGIN_MIX_INTERFACE(func)\ - MIX_BEGIN_FILTER - + BEGIN_MIX_INTERFACE(func) + #define END_MIX_FLT_INTERFACE()\ SNDMIX_ENDSAMPLELOOP\ - MIX_END_FILTER\ } #define BEGIN_RAMPMIX_FLT_INTERFACE(func)\ BEGIN_MIX_INTERFACE(func)\ LONG nRampRightVol = pChannel->nRampRightVol;\ - LONG nRampLeftVol = pChannel->nRampLeftVol;\ - MIX_BEGIN_FILTER + LONG nRampLeftVol = pChannel->nRampLeftVol; #define END_RAMPMIX_FLT_INTERFACE()\ SNDMIX_ENDSAMPLELOOP\ - MIX_END_FILTER\ pChannel->nRampRightVol = nRampRightVol;\ pChannel->nRightVol = nRampRightVol >> VOLUMERAMPPRECISION;\ pChannel->nRampLeftVol = nRampLeftVol;\ @@ -446,24 +464,20 @@ // Stereo Resonant Filters #define BEGIN_MIX_STFLT_INTERFACE(func)\ - BEGIN_MIX_INTERFACE(func)\ - MIX_BEGIN_STEREO_FILTER - + BEGIN_MIX_INTERFACE(func) + #define END_MIX_STFLT_INTERFACE()\ SNDMIX_ENDSAMPLELOOP\ - MIX_END_STEREO_FILTER\ } #define BEGIN_RAMPMIX_STFLT_INTERFACE(func)\ BEGIN_MIX_INTERFACE(func)\ LONG nRampRightVol = pChannel->nRampRightVol;\ - LONG nRampLeftVol = pChannel->nRampLeftVol;\ - MIX_BEGIN_STEREO_FILTER + LONG nRampLeftVol = pChannel->nRampLeftVol; #define END_RAMPMIX_STFLT_INTERFACE()\ SNDMIX_ENDSAMPLELOOP\ - MIX_END_STEREO_FILTER\ pChannel->nRampRightVol = nRampRightVol;\ pChannel->nRightVol = nRampRightVol >> VOLUMERAMPPRECISION;\ pChannel->nRampLeftVol = nRampLeftVol;\ @@ -1458,7 +1472,7 @@ { LPLONG pOfsL, pOfsR; DWORD nchused, nchmixed; - + if (!count) return 0; BOOL bSurround; if (gnChannels > 2) X86_InitMixBuffer(MixRearBuffer, count*2); @@ -1506,7 +1520,7 @@ //Look for plugins associated with this implicit tracker channel. PLUGINDEX nMixPlugin = GetBestPlugin(ChnMix[nChn], PrioritiseInstrument, RespectMutes); - + //rewbs.instroVSTi /* UINT nMixPlugin=0; if (pChannel->pModInstrument && pChannel->pInstrument) { // first try intrument VST @@ -1514,12 +1528,12 @@ nMixPlugin = pChannel->pModInstrument->nMixPlug; } if (!nMixPlugin && (nMasterCh > 0) && (nMasterCh <= m_nChannels)) { // Then try Channel VST - if(!(pChannel->dwFlags & CHN_NOFX)) + if(!(pChannel->dwFlags & CHN_NOFX)) nMixPlugin = ChnSettings[nMasterCh-1].nMixPlugin; } */ - //end rewbs.instroVSTi + //end rewbs.instroVSTi if ((nMixPlugin > 0) && (nMixPlugin <= MAX_MIXPLUGINS)) { SNDMIXPLUGINSTATE *pPlugin = m_MixPlugins[nMixPlugin - 1].pMixState; @@ -1640,7 +1654,7 @@ // default: ; } } - + //didn't manage to get flag from instrument header, use channel flags. if(pChannel->dwFlags[CHN_HQSRC]) { @@ -1651,7 +1665,7 @@ { return MIXNDX_LINEARSRC; } - + return 0; } @@ -1660,10 +1674,10 @@ //------------------------------------------ { // Setup float inputs - for (UINT iPlug=0; iPlug<MAX_MIXPLUGINS; iPlug++) + for(PLUGINDEX plug = 0; plug < MAX_MIXPLUGINS; plug++) { - SNDMIXPLUGIN &plugin = m_MixPlugins[iPlug]; - if (plugin.pMixPlugin != nullptr && plugin.pMixState != nullptr + SNDMIXPLUGIN &plugin = m_MixPlugins[plug]; + if(plugin.pMixPlugin != nullptr && plugin.pMixState != nullptr && plugin.pMixState->pMixBuffer != nullptr && plugin.pMixState->pOutBufferL != nullptr && plugin.pMixState->pOutBufferR != nullptr) @@ -1703,18 +1717,18 @@ FLOAT *pMixR = MixFloatBuffer + MIXBUFFERSIZE; // Process Plugins - for (UINT iDoPlug=0; iDoPlug<MAX_MIXPLUGINS; iDoPlug++) + for(PLUGINDEX plug = 0; plug < MAX_MIXPLUGINS; plug++) { - SNDMIXPLUGIN &plugin = m_MixPlugins[iDoPlug]; + SNDMIXPLUGIN &plugin = m_MixPlugins[plug]; if (plugin.pMixPlugin != nullptr && plugin.pMixState != nullptr && plugin.pMixState->pMixBuffer != nullptr && plugin.pMixState->pOutBufferL != nullptr && plugin.pMixState->pOutBufferR != nullptr) { - BOOL bMasterMix = FALSE; + bool isMasterMix = false; if (pMixL == plugin.pMixState->pOutBufferL) { - bMasterMix = TRUE; + isMasterMix = true; pMixL = MixFloatBuffer; pMixR = MixFloatBuffer + MIXBUFFERSIZE; } @@ -1726,7 +1740,7 @@ if (!plugin.IsOutputToMaster()) { PLUGINDEX nOutput = plugin.GetOutputPlugin(); - if(nOutput > iDoPlug && nOutput != PLUGINDEX_INVALID + if(nOutput > plug && nOutput != PLUGINDEX_INVALID && m_MixPlugins[nOutput].pMixState != nullptr) { SNDMIXPLUGINSTATE *pOutState = m_MixPlugins[nOutput].pMixState; @@ -1748,13 +1762,12 @@ pOutputs[2 * nOutput] = pOutState->pOutBufferL; pOutputs[2 * (nOutput + 1)] = pOutState->pOutBufferR; } - - } -*/ + }*/ + if (plugin.IsMasterEffect()) { - if (!bMasterMix) + if (!isMasterMix) { FLOAT *pInL = pState->pOutBufferL; FLOAT *pInR = pState->pOutBufferR; @@ -1860,7 +1873,7 @@ return; } } - X86_MonoMixToFloat(pSrc, pOut, nCount, m_pConfig->getIntToFloat()); + X86_MonoMixToFloat(pSrc, pOut, nCount, m_pConfig->getIntToFloat()); } @@ -2373,4 +2386,3 @@ } #endif // NO_AGC - Modified: trunk/OpenMPT/soundlib/ITTools.cpp =================================================================== --- trunk/OpenMPT/soundlib/ITTools.cpp 2013-03-12 19:43:19 UTC (rev 1567) +++ trunk/OpenMPT/soundlib/ITTools.cpp 2013-03-13 00:46:11 UTC (rev 1568) @@ -642,6 +642,8 @@ #ifdef MODPLUG_TRACKER +#include "../mptrack/Moddoc.h" + // Convert all multi-byte numeric values to current platform's endianness or vice versa. void ITHistoryStruct::ConvertEndianness() //--------------------------------------- Modified: trunk/OpenMPT/soundlib/ITTools.h =================================================================== --- trunk/OpenMPT/soundlib/ITTools.h 2013-03-12 19:43:19 UTC (rev 1567) +++ trunk/OpenMPT/soundlib/ITTools.h 2013-03-13 00:46:11 UTC (rev 1568) @@ -300,14 +300,11 @@ STATIC_ASSERT(sizeof(ITSample) == 80); -#pragma pack(pop) #ifdef MODPLUG_TRACKER -#include "../mptrack/Moddoc.h" +struct FileHistory; #endif // MODPLUG_TRACKER -#pragma pack(push, 1) - // IT Header extension: Save history struct ITHistoryStruct { Modified: trunk/OpenMPT/soundlib/Load_itp.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_itp.cpp 2013-03-12 19:43:19 UTC (rev 1567) +++ trunk/OpenMPT/soundlib/Load_itp.cpp 2013-03-13 00:46:11 UTC (rev 1568) @@ -403,7 +403,7 @@ fwrite(&id, 1, sizeof(id), f); // patterns data content - for(UINT npat=0; npat<MAX_PATTERNS; npat++) + for(PATTERNINDEX npat = 0; npat < MAX_PATTERNS; npat++) { // pattern size (number of rows) id = Patterns[npat] ? Patterns[npat].GetNumRows() : 0; Modified: trunk/OpenMPT/soundlib/pattern.cpp =================================================================== --- trunk/OpenMPT/soundlib/pattern.cpp 2013-03-12 19:43:19 UTC (rev 1567) +++ trunk/OpenMPT/soundlib/pattern.cpp 2013-03-13 00:46:11 UTC (rev 1568) @@ -15,6 +15,7 @@ #include "../common/version.h" #include "../common/AudioCriticalSection.h" #include "ITTools.h" +#include "Sndfile.h" CSoundFile& CPattern::GetSoundFile() { return m_rPatternContainer.GetSoundFile(); } @@ -446,14 +447,7 @@ bool CPattern::WriteITPdata(FILE* f) const //---------------------------------------- { - for(ROWINDEX r = 0; r < GetNumRows(); r++) - { - for(CHANNELINDEX c = 0; c < GetNumChannels(); c++) - { - ModCommand mc = GetModCommand(r,c); - fwrite(&mc, sizeof(ModCommand), 1, f); - } - } + fwrite(m_ModCommands, sizeof(ModCommand), GetNumRows() * GetNumChannels(), f); return false; } @@ -465,7 +459,7 @@ //////////////////////////////////////////////////////////////////////// -static enum maskbits +enum maskbits { noteBit = (1 << 0), instrBit = (1 << 1), @@ -511,8 +505,8 @@ } -uint8 CreateDiffMask(ModCommand chnMC, ModCommand newMC) -//------------------------------------------------------ +static uint8 CreateDiffMask(const ModCommand &chnMC, const ModCommand &newMC) +//--------------------------------------------------------------------------- { uint8 mask = 0; if(chnMC.note != newMC.note) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2013-03-13 01:35:29
|
Revision: 1569 http://sourceforge.net/p/modplug/code/1569 Author: saga-games Date: 2013-03-13 01:35:19 +0000 (Wed, 13 Mar 2013) Log Message: ----------- [Imp] Treeview: It is now possible to switch between the uperr and lower part of the treeview by pressing the TAB key (http://bugs.openmpt.org/view.php?id=101). [Mod] OpenMPT: Version is now 1.21.01.20 Modified Paths: -------------- trunk/OpenMPT/common/version.h trunk/OpenMPT/mptrack/Mainbar.h trunk/OpenMPT/mptrack/Mainfrm.h trunk/OpenMPT/mptrack/View_tre.cpp Modified: trunk/OpenMPT/common/version.h =================================================================== --- trunk/OpenMPT/common/version.h 2013-03-13 00:46:11 UTC (rev 1568) +++ trunk/OpenMPT/common/version.h 2013-03-13 01:35:19 UTC (rev 1569) @@ -19,7 +19,7 @@ #define VER_MAJORMAJOR 1 #define VER_MAJOR 21 #define VER_MINOR 01 -#define VER_MINORMINOR 19 +#define VER_MINORMINOR 20 //Creates version number from version parts that appears in version string. //For example MAKE_VERSION_NUMERIC(1,17,02,28) gives version number of Modified: trunk/OpenMPT/mptrack/Mainbar.h =================================================================== --- trunk/OpenMPT/mptrack/Mainbar.h 2013-03-13 00:46:11 UTC (rev 1568) +++ trunk/OpenMPT/mptrack/Mainbar.h 2013-03-13 01:35:19 UTC (rev 1569) @@ -90,7 +90,6 @@ //================================== { protected: - CModTree *m_pModTree, *m_pModTreeData; DWORD m_dwStatus; // MTB_XXXX UINT m_nCursorDrag; CPoint ptDragging; @@ -98,6 +97,8 @@ UINT m_nTreeSplitRatio; public: + CModTree *m_pModTree, *m_pModTreeData; + CModTreeBar(); virtual ~CModTreeBar(); Modified: trunk/OpenMPT/mptrack/Mainfrm.h =================================================================== --- trunk/OpenMPT/mptrack/Mainfrm.h 2013-03-13 00:46:11 UTC (rev 1568) +++ trunk/OpenMPT/mptrack/Mainfrm.h 2013-03-13 01:35:19 UTC (rev 1569) @@ -436,6 +436,9 @@ double GetApproxBPM(); //rewbs.VSTTimeInfo void ThreadSafeSetModified(CModDoc* modified) {m_pJustModifiedDoc=modified;} + CModTree *GetUpperTreeview() { return m_wndTree.m_pModTree; } + CModTree *GetLowerTreeview() { return m_wndTree.m_pModTreeData; } + void CreateExampleModulesMenu(); void CreateTemplateModulesMenu(); Modified: trunk/OpenMPT/mptrack/View_tre.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_tre.cpp 2013-03-13 00:46:11 UTC (rev 1568) +++ trunk/OpenMPT/mptrack/View_tre.cpp 2013-03-13 01:35:19 UTC (rev 1569) @@ -187,8 +187,7 @@ { if (!(pMsg->lParam & 0x40000000)) OnPlayTreeItem(); return TRUE; - } else - if (pMsg->wParam == VK_RETURN) + } else if (pMsg->wParam == VK_RETURN) { if (!(pMsg->lParam & 0x40000000)) { @@ -205,6 +204,13 @@ } } return TRUE; + } else if(pMsg->wParam == VK_TAB) + { + if(this == CMainFrame::GetMainFrame()->GetUpperTreeview()) + CMainFrame::GetMainFrame()->GetLowerTreeview()->SetFocus(); + else + CMainFrame::GetMainFrame()->GetUpperTreeview()->SetFocus(); + return TRUE; } } //rewbs.customKeys This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2013-03-14 00:42:10
|
Revision: 1570 http://sourceforge.net/p/modplug/code/1570 Author: saga-games Date: 2013-03-14 00:42:01 +0000 (Thu, 14 Mar 2013) Log Message: ----------- [Imp] Pause/Stop playback keyboard shortcuts also work when no module is loaded (to stop preview in treeview) [Fix] Treeview: Sample preview using Space bar was accidentally broken. Modified Paths: -------------- trunk/OpenMPT/mptrack/MainFrm.cpp trunk/OpenMPT/mptrack/View_tre.cpp trunk/OpenMPT/mptrack/View_tre.h trunk/OpenMPT/soundlib/Fastmix.cpp Modified: trunk/OpenMPT/mptrack/MainFrm.cpp =================================================================== --- trunk/OpenMPT/mptrack/MainFrm.cpp 2013-03-13 01:35:19 UTC (rev 1569) +++ trunk/OpenMPT/mptrack/MainFrm.cpp 2013-03-14 00:42:01 UTC (rev 1570) @@ -2416,6 +2416,8 @@ { CModDoc* pModDoc = GetActiveDoc(); if (pModDoc) return GetActiveDoc()->OnCustomKeyMsg(wParam, lParam); + else if(wParam == kcPlayPauseSong || wParam == kcStopSong) + StopPreview(); break; } Modified: trunk/OpenMPT/mptrack/View_tre.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_tre.cpp 2013-03-13 01:35:19 UTC (rev 1569) +++ trunk/OpenMPT/mptrack/View_tre.cpp 2013-03-14 00:42:01 UTC (rev 1570) @@ -1236,7 +1236,7 @@ default: if (modItemType & 0x8000) { - PlayItem(hItem); + PlayItem(hItem, NOTE_MIDDLEC); return TRUE; } } @@ -1245,8 +1245,8 @@ } -BOOL CModTree::PlayItem(HTREEITEM hItem, UINT nParam) -//--------------------------------------------------- +BOOL CModTree::PlayItem(HTREEITEM hItem, ModCommand::NOTE nParam) +//--------------------------------------------------------------- { if (hItem) { @@ -1260,7 +1260,6 @@ case MODITEM_SAMPLE: if (pModDoc) { - if (!nParam) nParam = NOTE_MIDDLEC; if (nParam & 0x80) { pModDoc->NoteOff(nParam & 0x7F, true); @@ -1275,7 +1274,6 @@ case MODITEM_INSTRUMENT: if (pModDoc) { - if (!nParam) nParam = NOTE_MIDDLEC; if (nParam & 0x80) { pModDoc->NoteOff(nParam, true); @@ -1314,10 +1312,10 @@ { if (modItemType == MODITEM_INSLIB_INSTRUMENT) { - pMainFrm->PlaySoundFile(&m_SongFile, static_cast<INSTRUMENTINDEX>(n), SAMPLEINDEX_INVALID, static_cast<ModCommand::NOTE>(nParam)); + pMainFrm->PlaySoundFile(&m_SongFile, static_cast<INSTRUMENTINDEX>(n), SAMPLEINDEX_INVALID, nParam); } else { - pMainFrm->PlaySoundFile(&m_SongFile, INSTRUMENTINDEX_INVALID, static_cast<SAMPLEINDEX>(n), static_cast<ModCommand::NOTE>(nParam)); + pMainFrm->PlaySoundFile(&m_SongFile, INSTRUMENTINDEX_INVALID, static_cast<SAMPLEINDEX>(n), nParam); } } } else @@ -1326,7 +1324,7 @@ CHAR szFullPath[_MAX_PATH] = ""; InsLibGetFullPath(hItem, szFullPath); CMainFrame *pMainFrm = CMainFrame::GetMainFrame(); - if (pMainFrm) pMainFrm->PlaySoundFile(szFullPath, static_cast<ModCommand::NOTE>(nParam)); + if (pMainFrm) pMainFrm->PlaySoundFile(szFullPath, nParam); } break; @@ -1360,7 +1358,6 @@ // Melodic if (modItem & 0x40000000) { - if ((!nParam) || (nParam > NOTE_MAX)) nParam = NOTE_MIDDLEC; rgn = pDLSBank->GetRegionFromKey(instr, nParam - NOTE_MIN); } pMainFrm->PlayDLSInstrument(bank, instr, rgn, static_cast<ModCommand::NOTE>(nParam)); @@ -2891,7 +2888,7 @@ void CModTree::OnPlayTreeItem() //----------------------------- { - PlayItem(GetSelectedItem()); + PlayItem(GetSelectedItem(), NOTE_MIDDLEC); } @@ -3403,7 +3400,7 @@ if (wParam>=kcTreeViewStartNotes && wParam<=kcTreeViewEndNotes) { - PlayItem(GetSelectedItem(), wParam - kcTreeViewStartNotes + 1 + pMainFrm->GetBaseOctave() * 12); + PlayItem(GetSelectedItem(), static_cast<ModCommand::NOTE>(wParam - kcTreeViewStartNotes + 1 + pMainFrm->GetBaseOctave() * 12)); return wParam; } if (wParam>=kcTreeViewStartNoteStops && wParam<=kcTreeViewEndNoteStops) Modified: trunk/OpenMPT/mptrack/View_tre.h =================================================================== --- trunk/OpenMPT/mptrack/View_tre.h 2013-03-13 01:35:19 UTC (rev 1569) +++ trunk/OpenMPT/mptrack/View_tre.h 2013-03-14 00:42:01 UTC (rev 1570) @@ -151,7 +151,7 @@ BOOL SetMidiPercussion(UINT nPerc, LPCTSTR lpszFileName); BOOL ExecuteItem(HTREEITEM hItem); BOOL DeleteTreeItem(HTREEITEM hItem); - BOOL PlayItem(HTREEITEM hItem, UINT nParam=0); + BOOL PlayItem(HTREEITEM hItem, ModCommand::NOTE nParam); BOOL OpenTreeItem(HTREEITEM hItem); BOOL OpenMidiInstrument(DWORD dwItem); BOOL InstrumentLibraryChDir(LPCSTR lpszDir); Modified: trunk/OpenMPT/soundlib/Fastmix.cpp =================================================================== --- trunk/OpenMPT/soundlib/Fastmix.cpp 2013-03-13 01:35:19 UTC (rev 1569) +++ trunk/OpenMPT/soundlib/Fastmix.cpp 2013-03-14 00:42:01 UTC (rev 1570) @@ -14,8 +14,12 @@ #include "stdafx.h" #include "sndfile.h" -#ifdef _DEBUG -#include <math.h> + +#if defined(_MSC_VER) +#elif defined(__GNUC__) +#define __forceinline __attribute__((always_inline)) +#else +#define __forceinline inline #endif #include "WindowedFIR.h" @@ -340,8 +344,8 @@ #define ClipFilter(x) Clamp(x, 2.0f * (float)int16_min, 2.0f * (float)int16_max) // Resonant filter for Mono samples -static inline void ProcessMonoFilter(int &vol, ModChannel *pChn) -//-------------------------------------------------------------- +static __forceinline void ProcessMonoFilter(int &vol, ModChannel *pChn) +//--------------------------------------------------------------------- { float fy1 = pChn->nFilter_Y1; float fy2 = pChn->nFilter_Y2; @@ -357,11 +361,10 @@ // Resonant filter for Stereo samples -static inline void ProcessStereoFilter(int &vol_l, int &vol_r, ModChannel *pChn) -//------------------------------------------------------------------------------ +static __forceinline void ProcessStereoFilter(int &vol_l, int &vol_r, ModChannel *pChn) +//------------------------------------------------------------------------------------- { // Left channel - float fy1 = pChn->nFilter_Y1; float fy2 = pChn->nFilter_Y2; @@ -374,7 +377,6 @@ pChn->nFilter_Y2 = fy2; // Right channel - fy1 = pChn->nFilter_Y3; fy2 = pChn->nFilter_Y4; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rel...@us...> - 2013-03-15 20:01:30
|
Revision: 1571 http://sourceforge.net/p/modplug/code/1571 Author: relabsoluness Date: 2013-03-15 20:01:21 +0000 (Fri, 15 Mar 2013) Log Message: ----------- [Ref] Introduced new string class to allow easier replacement of CString-objects in soundlib and made some related changes. Modified Paths: -------------- trunk/OpenMPT/common/misc_util.cpp trunk/OpenMPT/common/misc_util.h trunk/OpenMPT/mptrack/MIDIMapping.cpp trunk/OpenMPT/mptrack/MIDIMapping.h trunk/OpenMPT/mptrack/Vstplug.cpp trunk/OpenMPT/soundlib/Load_xm.cpp trunk/OpenMPT/soundlib/Message.cpp trunk/OpenMPT/soundlib/ModSequence.cpp trunk/OpenMPT/soundlib/ModSequence.h trunk/OpenMPT/soundlib/Snd_defs.h trunk/OpenMPT/soundlib/Sndfile.cpp trunk/OpenMPT/soundlib/Sndfile.h trunk/OpenMPT/soundlib/pattern.h trunk/OpenMPT/soundlib/patternContainer.cpp trunk/OpenMPT/soundlib/plugins/PlugInterface.h Modified: trunk/OpenMPT/common/misc_util.cpp =================================================================== --- trunk/OpenMPT/common/misc_util.cpp 2013-03-14 00:42:01 UTC (rev 1570) +++ trunk/OpenMPT/common/misc_util.cpp 2013-03-15 20:01:21 UTC (rev 1571) @@ -44,8 +44,8 @@ // Returns WinAPI error message corresponding to error code returned by GetLastError(). -CString GetErrorMessage(DWORD nErrorCode) -//--------------------------------------- +std::string GetErrorMessage(DWORD nErrorCode) +//------------------------------------------- { LPVOID lpMsgBuf; @@ -57,7 +57,7 @@ 0, NULL ); - CString msg = (LPTSTR)lpMsgBuf; + std::string msg = (LPTSTR)lpMsgBuf; LocalFree(lpMsgBuf); return msg; Modified: trunk/OpenMPT/common/misc_util.h =================================================================== --- trunk/OpenMPT/common/misc_util.h 2013-03-14 00:42:01 UTC (rev 1570) +++ trunk/OpenMPT/common/misc_util.h 2013-03-15 20:01:21 UTC (rev 1571) @@ -141,7 +141,7 @@ #ifdef MODPLUG_TRACKER LPCCH LoadResource(LPCTSTR lpName, LPCTSTR lpType, LPCCH& pData, size_t& nSize, HGLOBAL& hglob); -CString GetErrorMessage(DWORD nErrorCode); +std::string GetErrorMessage(DWORD nErrorCode); #endif // MODPLUG_TRACKER namespace utilImpl Modified: trunk/OpenMPT/mptrack/MIDIMapping.cpp =================================================================== --- trunk/OpenMPT/mptrack/MIDIMapping.cpp 2013-03-14 00:42:01 UTC (rev 1570) +++ trunk/OpenMPT/mptrack/MIDIMapping.cpp 2013-03-15 20:01:21 UTC (rev 1571) @@ -14,16 +14,15 @@ #include "Mainfrm.h" -CString CMIDIMappingDirective::ToString() const -//--------------------------------------------- +mpt::String CMIDIMappingDirective::ToString() const +//------------------------------------------------- { - CString str; str.Preallocate(20); + mpt::String str; char flags[4] = "000"; if(m_Active) flags[0] = '1'; if(m_CaptureMIDI) flags[1] = '1'; if(m_AllowPatternEdit) flags[2] = '1'; str.Format("%s:%d:%x:%d:%d:%d", flags, (int)GetChannel(), (int)GetEvent(), (int)GetController(), (int)m_PluginIndex, m_Parameter); - str.Trim(); return str; } Modified: trunk/OpenMPT/mptrack/MIDIMapping.h =================================================================== --- trunk/OpenMPT/mptrack/MIDIMapping.h 2013-03-14 00:42:01 UTC (rev 1570) +++ trunk/OpenMPT/mptrack/MIDIMapping.h 2013-03-15 20:01:21 UTC (rev 1571) @@ -14,7 +14,9 @@ #include <algorithm> using std::vector; +namespace mpt { class String; } + //========================= class CMIDIMappingDirective //========================= @@ -57,7 +59,7 @@ bool operator==(const CMIDIMappingDirective& d) const {return memcmp(this, &d, sizeof(CMIDIMappingDirective)) == 0;} - CString ToString() const; + mpt::String ToString() const; BYTE GetChnEvent() const {return m_ChnEvent;} Modified: trunk/OpenMPT/mptrack/Vstplug.cpp =================================================================== --- trunk/OpenMPT/mptrack/Vstplug.cpp 2013-03-14 00:42:01 UTC (rev 1570) +++ trunk/OpenMPT/mptrack/Vstplug.cpp 2013-03-15 20:01:21 UTC (rev 1571) @@ -201,7 +201,7 @@ if(error != ERROR_MOD_NOT_FOUND) // "File not found errors" are annoying. { TCHAR szBuf[256]; - wsprintf(szBuf, "Warning: encountered problem when loading plugin dll. Error %d: %s", error, (LPCTSTR)GetErrorMessage(error)); + wsprintf(szBuf, "Warning: encountered problem when loading plugin dll. Error %d: %s", error, GetErrorMessage(error).c_str()); Reporting::Error(szBuf, "DEBUG: Error when loading plugin dll"); } #endif //_DEBUG @@ -3545,7 +3545,7 @@ #endif // NO_VST -CString SNDMIXPLUGIN::GetParamName(PlugParamIndex index) const +mpt::String SNDMIXPLUGIN::GetParamName(PlugParamIndex index) const //------------------------------------------------------------ { CVstPlugin *vstPlug = dynamic_cast<CVstPlugin *>(pMixPlugin); @@ -3554,6 +3554,6 @@ return vstPlug->GetParamName(index); } else { - return CString(); + return mpt::String(); } } Modified: trunk/OpenMPT/soundlib/Load_xm.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_xm.cpp 2013-03-14 00:42:01 UTC (rev 1570) +++ trunk/OpenMPT/soundlib/Load_xm.cpp 2013-03-15 20:01:21 UTC (rev 1571) @@ -557,7 +557,7 @@ \ if((len > uint16_max - (UINT)x) && GetpModDoc()) /*Reaching the limits of file format?*/ \ { \ - CString str; str.Format("%s (%s %u)\n", str_tooMuchPatternData, str_pattern, pat); \ + mpt::String str; str.Format("%s (%s %u)\n", str_tooMuchPatternData, str_pattern, pat); \ GetpModDoc()->AddToLog(str); \ break; \ } Modified: trunk/OpenMPT/soundlib/Message.cpp =================================================================== --- trunk/OpenMPT/soundlib/Message.cpp 2013-03-14 00:42:01 UTC (rev 1570) +++ trunk/OpenMPT/soundlib/Message.cpp 2013-03-15 20:01:21 UTC (rev 1571) @@ -194,10 +194,10 @@ // [in] lineEnding: line ending formatting of the text in memory. // [in] pTextConverter: Pointer to a callback function which can be used to post-process the written characters, if necessary (nullptr otherwise). // [out] returns formatted song message. -CString CSoundFile::GetSongMessage(const enmLineEndings lineEnding, void (*pTextConverter)(char &)) const +mpt::String CSoundFile::GetSongMessage(const enmLineEndings lineEnding, void (*pTextConverter)(char &)) const //------------------------------------------------------------------------------------------------------- { - CString comments; + mpt::String comments; if(m_lpszSongComments == nullptr) { @@ -205,7 +205,7 @@ } const size_t len = strlen(m_lpszSongComments); - comments.Preallocate(len); + comments.Reserve(len); for(size_t i = 0; i < len; i++) { Modified: trunk/OpenMPT/soundlib/ModSequence.cpp =================================================================== --- trunk/OpenMPT/soundlib/ModSequence.cpp 2013-03-14 00:42:01 UTC (rev 1570) +++ trunk/OpenMPT/soundlib/ModSequence.cpp 2013-03-15 20:01:21 UTC (rev 1571) @@ -717,7 +717,7 @@ if(size > ModSpecs::mptm.ordersMax) { // Hack: Show message here if trying to load longer sequence than what is supported. - CString str; str.Format(str_SequenceTruncationNote, size, ModSpecs::mptm.ordersMax); + mpt::String str; str.Format(str_SequenceTruncationNote, size, ModSpecs::mptm.ordersMax); Reporting::Warning(str); size = ModSpecs::mptm.ordersMax; } @@ -753,7 +753,7 @@ { srlztn::Ssb ssb(oStrm); ssb.BeginWrite(FileIdSequence, MptVersion::num); - ssb.WriteItem((LPCSTR)seq.m_sName, "n"); + ssb.WriteItem((const char*)seq.m_sName, "n"); const uint16 nLength = seq.GetLengthTailTrimmed(); ssb.WriteItem<uint16>(nLength, "l"); ssb.WriteItem(seq.m_pArray, "a", 1, srlztn::ArrayWriter<uint16>(nLength)); Modified: trunk/OpenMPT/soundlib/ModSequence.h =================================================================== --- trunk/OpenMPT/soundlib/ModSequence.h 2013-03-14 00:42:01 UTC (rev 1570) +++ trunk/OpenMPT/soundlib/ModSequence.h 2013-03-15 20:01:21 UTC (rev 1571) @@ -121,7 +121,7 @@ const_iterator end() const {return m_pArray + m_nSize;} public: - CString m_sName; // Sequence name. + mpt::String m_sName; // Sequence name. protected: PATTERNINDEX* m_pArray; // Pointer to sequence array. Modified: trunk/OpenMPT/soundlib/Snd_defs.h =================================================================== --- trunk/OpenMPT/soundlib/Snd_defs.h 2013-03-14 00:42:01 UTC (rev 1570) +++ trunk/OpenMPT/soundlib/Snd_defs.h 2013-03-15 20:01:21 UTC (rev 1571) @@ -380,4 +380,93 @@ VIB_RAMP_UP, VIB_RAMP_DOWN, VIB_RANDOM -}; \ No newline at end of file +}; + +namespace mpt +{ + // Quick and incomplete string class to be used as a replacement for + // CString and std::string in soundlib. + class String : public std::string + { + public: + typedef std::string BaseClass; + typedef char CharT; + + String() {} + String(const CharT* psz) : BaseClass(psz) {} + String(const std::string& other) : BaseClass(other) {} + + // Move constructors and move assignments. + #if (_MSC_VER >= MSVC_VER_2010) + String(BaseClass&& str) : BaseClass(std::move(str)) {} + String(String&& other) : BaseClass(std::move(static_cast<BaseClass&>(other))) {} + String& operator=(BaseClass&& str) {BaseClass::operator=(std::move(str)); return *this;} + String& operator=(String&& other) {BaseClass::operator=(std::move(static_cast<BaseClass&>(other))); return *this;} + #endif + + String& operator=(const CharT* psz) {BaseClass::operator=(psz); return *this;} + + #ifdef MODPLUG_TRACKER + String(const CString& str) {(*this) = str.GetString();} + String& operator=(const CString& str) {return operator=(str.GetString());} + #endif // MODPLUG_TRACKER + + // To allow easy assignment to CString in GUI side. + operator const CharT*() const {return c_str();} + + // Clears string. + void Empty() {clear();} + + // Tests whether string is empty. + bool IsEmpty() const {return empty();} + + // Compares this and other string. + bool Compare(const CharT* psz) const {return ((*this) == psz);} + + // Equivalent to Empty(); Append(psz, nCount); + void SetString(const CharT* psz, const size_t nCount) + { + Empty(); + Append(psz, nCount); + } + + // Append string to this. + void Append(const CharT* psz) {append(psz);} + + // Appends given string to this. Stops after 'nCount' chars if null terminator + // hasn't been encountered before that. + void Append(const CharT* psz, const size_t nCount) {append(psz, nCount);} + + // Appends single character to string. + void AppendChar(const CharT c) {append(1, c);} + + // Difference between Append and AppendChars is that latter can be used to add + // potentially non-null terminated char array. + template <size_t N> + void AppendChars(const CharT (&arr)[N]) + { + append(arr, arr + N); + } + + // Reserves store for the string without resizing. + void Reserve(size_t nSize) {reserve(nSize);} + + // Formats this string, like CString::Format. + void Format(const CharT* pszFormat, ...) + { + va_list argList; + va_start( argList, pszFormat ); + + // Count the needed array size. + const size_t nCount = _vscprintf(pszFormat, argList); // null character not included. + resize(nCount + 1); // + 1 is for null terminator. + + // Hack: directly modify the std::string's string. + // In C++11 std::string is guaranteed to be contiguous. + const int nCount2 = vsprintf_s(&*begin(), size(), pszFormat, argList); + resize(nCount2); // Removes the null character that vsprintf_s adds. + + va_end( argList ); + } + }; +} Modified: trunk/OpenMPT/soundlib/Sndfile.cpp =================================================================== --- trunk/OpenMPT/soundlib/Sndfile.cpp 2013-03-14 00:42:01 UTC (rev 1570) +++ trunk/OpenMPT/soundlib/Sndfile.cpp 2013-03-15 20:01:21 UTC (rev 1571) @@ -1288,19 +1288,15 @@ } -CString CSoundFile::GetInstrumentName(UINT nInstr) const +mpt::String CSoundFile::GetInstrumentName(UINT nInstr) const //------------------------------------------------------ { if ((nInstr >= MAX_INSTRUMENTS) || (!Instruments[nInstr])) return TEXT(""); ASSERT(nInstr <= GetNumInstruments()); - const size_t nSize = CountOf(Instruments[nInstr]->name); - CString str; - LPTSTR p = str.GetBuffer(nSize + 1); - ArrayCopy(p, Instruments[nInstr]->name, nSize); - p[nSize] = 0; - str.ReleaseBuffer(); + mpt::String str; + str.AppendChars(Instruments[nInstr]->name); return str; } @@ -1625,8 +1621,8 @@ } // Load local tunings. - CString sPath; - sPath.Format(TEXT("%slocal_tunings%s"), TrackerSettings::Instance().GetDefaultDirectory(DIR_TUNING), CTuningCollection::s_FileExtension); + mpt::String sPath; + sPath.Format("%slocal_tunings%s", TrackerSettings::Instance().GetDefaultDirectory(DIR_TUNING), CTuningCollection::s_FileExtension); s_pTuningsSharedLocal->SetSavefilePath(sPath); s_pTuningsSharedLocal->Deserialize(); Modified: trunk/OpenMPT/soundlib/Sndfile.h =================================================================== --- trunk/OpenMPT/soundlib/Sndfile.h 2013-03-14 00:42:01 UTC (rev 1570) +++ trunk/OpenMPT/soundlib/Sndfile.h 2013-03-15 20:01:21 UTC (rev 1571) @@ -359,7 +359,7 @@ void SetCurrentOrder(ORDERINDEX nOrder); LPCSTR GetTitle() const { return m_szNames[0]; } LPCTSTR GetSampleName(UINT nSample) const; - CString GetInstrumentName(UINT nInstr) const; + mpt::String GetInstrumentName(UINT nInstr) const; UINT GetMusicSpeed() const { return m_nMusicSpeed; } UINT GetMusicTempo() const { return m_nMusicTempo; } @@ -696,7 +696,7 @@ // [in] lineEnding: line ending formatting of the text in memory. // [in] pTextConverter: Pointer to a callback function which can be used to post-process the written characters, if necessary (nullptr otherwise). // [out] returns formatted song message. - CString GetSongMessage(const enmLineEndings lineEnding, void (*pTextConverter)(char &) = nullptr) const; + mpt::String GetSongMessage(const enmLineEndings lineEnding, void (*pTextConverter)(char &) = nullptr) const; protected: // Read song message from a mapped file. Modified: trunk/OpenMPT/soundlib/pattern.h =================================================================== --- trunk/OpenMPT/soundlib/pattern.h 2013-03-14 00:42:01 UTC (rev 1570) +++ trunk/OpenMPT/soundlib/pattern.h 2013-03-15 20:01:21 UTC (rev 1571) @@ -90,14 +90,13 @@ bool SetSignature(const ROWINDEX rowsPerBeat, const ROWINDEX rowsPerMeasure); void RemoveSignature() { m_RowsPerBeat = m_RowsPerMeasure = 0; } - // Patter name functions (for both CString and char[] arrays) - bool functions return true on success. + // Pattern name functions - bool functions return true on success. bool SetName(const char *newName, size_t maxChars = MAX_PATTERNNAME); template<size_t bufferSize> bool SetName(const char (&buffer)[bufferSize]) { return SetName(buffer, bufferSize); } - bool SetName(const CString newName) { m_PatternName = newName; return true; }; template<size_t bufferSize> bool GetName(char (&buffer)[bufferSize]) const @@ -105,7 +104,7 @@ return GetName(buffer, bufferSize); } bool GetName(char *buffer, size_t maxChars) const; - CString GetName() const { return m_PatternName; }; + const mpt::String& GetName() const { return m_PatternName; }; // Double number of rows bool Expand(); @@ -149,7 +148,7 @@ ROWINDEX m_Rows; ROWINDEX m_RowsPerBeat; // patterns-specific time signature. if != 0, this is implicitely set. ROWINDEX m_RowsPerMeasure; // dito - CString m_PatternName; + mpt::String m_PatternName; CPatternContainer& m_rPatternContainer; //END: DATA }; Modified: trunk/OpenMPT/soundlib/patternContainer.cpp =================================================================== --- trunk/OpenMPT/soundlib/patternContainer.cpp 2013-03-14 00:42:01 UTC (rev 1570) +++ trunk/OpenMPT/soundlib/patternContainer.cpp 2013-03-15 20:01:21 UTC (rev 1571) @@ -190,7 +190,7 @@ } for(PATTERNINDEX nPat = Size(); nPat > 0; nPat--) { - if(m_Patterns[nPat - 1].GetName() != "") + if(!m_Patterns[nPat - 1].GetName().IsEmpty()) { return nPat; } Modified: trunk/OpenMPT/soundlib/plugins/PlugInterface.h =================================================================== --- trunk/OpenMPT/soundlib/plugins/PlugInterface.h 2013-03-14 00:42:01 UTC (rev 1570) +++ trunk/OpenMPT/soundlib/plugins/PlugInterface.h 2013-03-15 20:01:21 UTC (rev 1571) @@ -151,7 +151,7 @@ { return Info.szName; } const char *GetLibraryName() const { return Info.szLibraryName; } - CString GetParamName(PlugParamIndex index) const; + mpt::String GetParamName(PlugParamIndex index) const; // Check if a plugin is loaded into this slot (also returns true if the plugin in this slot has not been found) bool IsValidPlugin() const { return (Info.dwPluginId1 | Info.dwPluginId2) != 0; }; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <man...@us...> - 2013-03-15 22:09:24
|
Revision: 1572 http://sourceforge.net/p/modplug/code/1572 Author: manxorist Date: 2013-03-15 22:09:13 +0000 (Fri, 15 Mar 2013) Log Message: ----------- [Var] Remove unused NO_PACKING macro, remove HAVE_DOT_NET feature macro which was always set and remove all other macro tests for MSVC compilers older than 2008. Modified Paths: -------------- trunk/OpenMPT/common/misc_util.cpp trunk/OpenMPT/common/stdafx.h trunk/OpenMPT/common/typedefs.h trunk/OpenMPT/mptrack/EffectVis.cpp trunk/OpenMPT/mptrack/Mptrack.cpp trunk/OpenMPT/mptrack/mptrack_08.vcproj trunk/OpenMPT/mptrack/mptrack_10.vcxproj Modified: trunk/OpenMPT/common/misc_util.cpp =================================================================== --- trunk/OpenMPT/common/misc_util.cpp 2013-03-15 20:01:21 UTC (rev 1571) +++ trunk/OpenMPT/common/misc_util.cpp 2013-03-15 22:09:13 UTC (rev 1572) @@ -74,15 +74,6 @@ time_t Util::sdTime::MakeGmTime(tm& timeUtc) { -#if (_MSC_VER < MSVC_VER_2005) - // VC++ 2003 doesn't have _mkgmtime - // This does not seem to work properly with DST time zones sometimes - if that's of any concern for you, please upgrade your compiler :) - TIME_ZONE_INFORMATION tzi; - GetTimeZoneInformation(&tzi); - const time_t timeUtcTimeT = mktime(&timeUtc) - tzi.Bias * 60; -#else - const time_t timeUtcTimeT = _mkgmtime(&timeUtc); -#endif - return timeUtcTimeT; + return _mkgmtime(&timeUtc); } Modified: trunk/OpenMPT/common/stdafx.h =================================================================== --- trunk/OpenMPT/common/stdafx.h 2013-03-15 20:01:21 UTC (rev 1571) +++ trunk/OpenMPT/common/stdafx.h 2013-03-15 22:09:13 UTC (rev 1572) @@ -13,11 +13,7 @@ #define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers -#if _MSC_VER >= 1500 - #define _WIN32_WINNT 0x0500 // 0x0500 = Windows 2000 -#else - #define WINVER 0x0401 -#endif +#define _WIN32_WINNT 0x0500 // 0x0500 = Windows 2000 // windows excludes #define NOMCX Modified: trunk/OpenMPT/common/typedefs.h =================================================================== --- trunk/OpenMPT/common/typedefs.h 2013-03-15 20:01:21 UTC (rev 1571) +++ trunk/OpenMPT/common/typedefs.h 2013-03-15 22:09:13 UTC (rev 1572) @@ -12,10 +12,6 @@ // Definitions for MSVC versions to write more understandable conditional-compilation, // e.g. #if (_MSC_VER > MSVC_VER_2008) instead of #if (_MSC_VER > 1500) -#define MSVC_VER_VC71 1310 -#define MSVC_VER_2003 MSVC_VER_VC71 -#define MSVC_VER_VC8 1400 -#define MSVC_VER_2005 MSVC_VER_VC8 #define MSVC_VER_VC9 1500 #define MSVC_VER_2008 MSVC_VER_VC9 #define MSVC_VER_VC10 1600 @@ -26,7 +22,7 @@ #endif // CountOf macro computes the number of elements in a statically-allocated array. -#if _MSC_VER >= MSVC_VER_2005 +#ifdef _MSC_VER #define CountOf(x) _countof(x) #else #define CountOf(x) (sizeof(x)/sizeof(x[0])) Modified: trunk/OpenMPT/mptrack/EffectVis.cpp =================================================================== --- trunk/OpenMPT/mptrack/EffectVis.cpp 2013-03-15 20:01:21 UTC (rev 1571) +++ trunk/OpenMPT/mptrack/EffectVis.cpp 2013-03-15 22:09:13 UTC (rev 1572) @@ -412,26 +412,12 @@ { // draw the grid memDC.BitBlt(0, 0, m_rcDraw.Width(), m_rcDraw.Height(), &m_dcGrid, 0, 0, SRCCOPY) ; -#ifndef HAVE_DOT_NET - - // VC6 TransparentBlit... - // WINGDIAPI BOOL WINAPI TransparentBlt(HDC,int,int,int,int,HDC,int,int,int,int,UINT); - // hDestDC, xDest, yDest, nDestWidth,nDestHeight,xSrc,ySrc,nSrcWidth,nSrcHeight, crTransparent - // 0, , 0 , - unsigned int height = m_rcDraw.Height(); - unsigned int width = m_rcDraw.Width(); - // FIX ME! - memDC.BitBlt(0,0,width, height, &m_dcNodes,width,height,PATCOPY); - memDC.BitBlt(0,0,width, height, &m_dcPlayPos,width,height,PATCOPY); -#endif - -#ifdef HAVE_DOT_NET // merge the nodes image with the grid memDC.TransparentBlt(0, 0, m_rcDraw.Width(), m_rcDraw.Height(), &m_dcNodes, 0, 0, m_rcDraw.Width(), m_rcDraw.Height(), 0x00000000) ; // further merge the playpos memDC.TransparentBlt(0, 0, m_rcDraw.Width(), m_rcDraw.Height(), &m_dcPlayPos, 0, 0, m_rcDraw.Width(), m_rcDraw.Height(), 0x00000000) ; -#endif + // copy the resulting bitmap to the destination pDC->BitBlt(LEFTBORDER, TOPBORDER, m_rcDraw.Width()+LEFTBORDER, m_rcDraw.Height()+TOPBORDER, &memDC, 0, 0, SRCCOPY) ; } Modified: trunk/OpenMPT/mptrack/Mptrack.cpp =================================================================== --- trunk/OpenMPT/mptrack/Mptrack.cpp 2013-03-15 20:01:21 UTC (rev 1571) +++ trunk/OpenMPT/mptrack/Mptrack.cpp 2013-03-15 22:09:13 UTC (rev 1572) @@ -640,7 +640,7 @@ CTrackApp::CTrackApp() //-------------------- { - #if (_MSC_VER >= MSVC_VER_2005) + #ifdef _MSC_VER _CrtSetDebugFillThreshold(0); // Disable buffer filling in secure enhanced CRT functions. #endif Modified: trunk/OpenMPT/mptrack/mptrack_08.vcproj =================================================================== --- trunk/OpenMPT/mptrack/mptrack_08.vcproj 2013-03-15 20:01:21 UTC (rev 1571) +++ trunk/OpenMPT/mptrack/mptrack_08.vcproj 2013-03-15 22:09:13 UTC (rev 1572) @@ -49,7 +49,7 @@ Name="VCCLCompilerTool" Optimization="0" AdditionalIncludeDirectories="..\common;..\soundlib;..\include;..\include\vstsdk2.4\;..\include\ASIOSDK2\common\;..\xsoundlib;..\" - PreprocessorDefinitions="_DEBUG,WIN32,_WINDOWS,ENABLE_EQ,MODPLUG_TRACKER,NO_PACKING,HAVE_DOT_NET,ENABLE_AMD,ENABLE_SSE,ENABLE_AMDNOW,ENABLE_MMX" + PreprocessorDefinitions="_DEBUG,WIN32,_WINDOWS,ENABLE_EQ,MODPLUG_TRACKER,ENABLE_AMD,ENABLE_SSE,ENABLE_AMDNOW,ENABLE_MMX" StringPooling="true" ExceptionHandling="2" BasicRuntimeChecks="3" @@ -157,7 +157,7 @@ Optimization="2" InlineFunctionExpansion="2" AdditionalIncludeDirectories="..\common;..\soundlib;..\include;..\include\vstsdk2.4\;..\include\ASIOSDK2\common\;..\xsoundlib;..\" - PreprocessorDefinitions="NDEBUG,WIN32,_WINDOWS,ENABLE_MMX,ENABLE_EQ,MODPLUG_TRACKER,NO_PACKING,HAVE_DOT_NET,ENABLE_AMD,ENABLE_SSE,ENABLE_AMDNOW" + PreprocessorDefinitions="NDEBUG,WIN32,_WINDOWS,ENABLE_MMX,ENABLE_EQ,MODPLUG_TRACKER,ENABLE_AMD,ENABLE_SSE,ENABLE_AMDNOW" StringPooling="true" ExceptionHandling="2" RuntimeLibrary="0" Modified: trunk/OpenMPT/mptrack/mptrack_10.vcxproj =================================================================== --- trunk/OpenMPT/mptrack/mptrack_10.vcxproj 2013-03-15 20:01:21 UTC (rev 1571) +++ trunk/OpenMPT/mptrack/mptrack_10.vcxproj 2013-03-15 22:09:13 UTC (rev 1572) @@ -64,7 +64,7 @@ <AdditionalOptions>/EHsc %(AdditionalOptions)</AdditionalOptions> <Optimization>Disabled</Optimization> <AdditionalIncludeDirectories>..\common;..\soundlib;..\include;..\include\vstsdk2.4\;..\include\ASIOSDK2\common\;..\xsoundlib;..\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>_DEBUG;WIN32;_WINDOWS;ENABLE_EQ;MODPLUG_TRACKER;NO_PACKING;HAVE_DOT_NET;ENABLE_AMD;ENABLE_SSE;ENABLE_AMDNOW;ENABLE_MMX;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <PreprocessorDefinitions>_DEBUG;WIN32;_WINDOWS;ENABLE_EQ;MODPLUG_TRACKER;ENABLE_AMD;ENABLE_SSE;ENABLE_AMDNOW;ENABLE_MMX;%(PreprocessorDefinitions)</PreprocessorDefinitions> <StringPooling>true</StringPooling> <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> @@ -120,7 +120,7 @@ <Optimization>MaxSpeed</Optimization> <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion> <AdditionalIncludeDirectories>..\common;..\soundlib;..\include;..\include\vstsdk2.4\;..\include\ASIOSDK2\common\;..\xsoundlib;..\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>NDEBUG;WIN32;_WINDOWS;ENABLE_MMX;ENABLE_EQ;MODPLUG_TRACKER;NO_PACKING;HAVE_DOT_NET;ENABLE_AMD;ENABLE_SSE;ENABLE_AMDNOW;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <PreprocessorDefinitions>NDEBUG;WIN32;_WINDOWS;ENABLE_MMX;ENABLE_EQ;MODPLUG_TRACKER;ENABLE_AMD;ENABLE_SSE;ENABLE_AMDNOW;%(PreprocessorDefinitions)</PreprocessorDefinitions> <StringPooling>true</StringPooling> <RuntimeLibrary>MultiThreaded</RuntimeLibrary> <BufferSecurityCheck>true</BufferSecurityCheck> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <man...@us...> - 2013-03-15 22:30:23
|
Revision: 1573 http://sourceforge.net/p/modplug/code/1573 Author: manxorist Date: 2013-03-15 22:30:14 +0000 (Fri, 15 Mar 2013) Log Message: ----------- [Var] ENABLE_AMD and ENABLE_AMDNOW had been used interchangeably, replace them both with ENABLE_3DNOW to better reflect what the feature macro really does. Modified Paths: -------------- trunk/OpenMPT/mptrack/mptrack_08.vcproj trunk/OpenMPT/mptrack/mptrack_10.vcxproj trunk/OpenMPT/soundlib/Fastmix.cpp trunk/OpenMPT/soundlib/Mmx_mix.cpp trunk/OpenMPT/soundlib/Snd_eq.cpp Modified: trunk/OpenMPT/mptrack/mptrack_08.vcproj =================================================================== --- trunk/OpenMPT/mptrack/mptrack_08.vcproj 2013-03-15 22:09:13 UTC (rev 1572) +++ trunk/OpenMPT/mptrack/mptrack_08.vcproj 2013-03-15 22:30:14 UTC (rev 1573) @@ -49,7 +49,7 @@ Name="VCCLCompilerTool" Optimization="0" AdditionalIncludeDirectories="..\common;..\soundlib;..\include;..\include\vstsdk2.4\;..\include\ASIOSDK2\common\;..\xsoundlib;..\" - PreprocessorDefinitions="_DEBUG,WIN32,_WINDOWS,ENABLE_EQ,MODPLUG_TRACKER,ENABLE_AMD,ENABLE_SSE,ENABLE_AMDNOW,ENABLE_MMX" + PreprocessorDefinitions="_DEBUG,WIN32,_WINDOWS,ENABLE_EQ,MODPLUG_TRACKER,ENABLE_3DNOW,ENABLE_SSE,ENABLE_MMX" StringPooling="true" ExceptionHandling="2" BasicRuntimeChecks="3" @@ -157,7 +157,7 @@ Optimization="2" InlineFunctionExpansion="2" AdditionalIncludeDirectories="..\common;..\soundlib;..\include;..\include\vstsdk2.4\;..\include\ASIOSDK2\common\;..\xsoundlib;..\" - PreprocessorDefinitions="NDEBUG,WIN32,_WINDOWS,ENABLE_MMX,ENABLE_EQ,MODPLUG_TRACKER,ENABLE_AMD,ENABLE_SSE,ENABLE_AMDNOW" + PreprocessorDefinitions="NDEBUG,WIN32,_WINDOWS,ENABLE_MMX,ENABLE_EQ,MODPLUG_TRACKER,ENABLE_3DNOW,ENABLE_SSE" StringPooling="true" ExceptionHandling="2" RuntimeLibrary="0" Modified: trunk/OpenMPT/mptrack/mptrack_10.vcxproj =================================================================== --- trunk/OpenMPT/mptrack/mptrack_10.vcxproj 2013-03-15 22:09:13 UTC (rev 1572) +++ trunk/OpenMPT/mptrack/mptrack_10.vcxproj 2013-03-15 22:30:14 UTC (rev 1573) @@ -64,7 +64,7 @@ <AdditionalOptions>/EHsc %(AdditionalOptions)</AdditionalOptions> <Optimization>Disabled</Optimization> <AdditionalIncludeDirectories>..\common;..\soundlib;..\include;..\include\vstsdk2.4\;..\include\ASIOSDK2\common\;..\xsoundlib;..\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>_DEBUG;WIN32;_WINDOWS;ENABLE_EQ;MODPLUG_TRACKER;ENABLE_AMD;ENABLE_SSE;ENABLE_AMDNOW;ENABLE_MMX;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <PreprocessorDefinitions>_DEBUG;WIN32;_WINDOWS;ENABLE_EQ;MODPLUG_TRACKER;ENABLE_3DNOW;ENABLE_SSE;ENABLE_MMX;%(PreprocessorDefinitions)</PreprocessorDefinitions> <StringPooling>true</StringPooling> <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> @@ -120,7 +120,7 @@ <Optimization>MaxSpeed</Optimization> <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion> <AdditionalIncludeDirectories>..\common;..\soundlib;..\include;..\include\vstsdk2.4\;..\include\ASIOSDK2\common\;..\xsoundlib;..\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>NDEBUG;WIN32;_WINDOWS;ENABLE_MMX;ENABLE_EQ;MODPLUG_TRACKER;ENABLE_AMD;ENABLE_SSE;ENABLE_AMDNOW;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <PreprocessorDefinitions>NDEBUG;WIN32;_WINDOWS;ENABLE_MMX;ENABLE_EQ;MODPLUG_TRACKER;ENABLE_3DNOW;ENABLE_SSE;%(PreprocessorDefinitions)</PreprocessorDefinitions> <StringPooling>true</StringPooling> <RuntimeLibrary>MultiThreaded</RuntimeLibrary> <BufferSecurityCheck>true</BufferSecurityCheck> Modified: trunk/OpenMPT/soundlib/Fastmix.cpp =================================================================== --- trunk/OpenMPT/soundlib/Fastmix.cpp 2013-03-15 22:09:13 UTC (rev 1572) +++ trunk/OpenMPT/soundlib/Fastmix.cpp 2013-03-15 22:30:14 UTC (rev 1573) @@ -503,7 +503,7 @@ #endif -#ifdef ENABLE_AMD +#ifdef ENABLE_3DNOW extern void AMD_StereoMixToFloat(const int *pSrc, float *pOut1, float *pOut2, UINT nCount, const float _i2fc); extern void AMD_FloatToStereoMix(const float *pIn1, const float *pIn2, int *pOut, UINT nCount, const float _f2ic); extern void AMD_MonoMixToFloat(const int *pSrc, float *pOut, UINT nCount, const float _i2fc); @@ -1825,7 +1825,7 @@ } if (gdwSysInfo & SYSMIX_3DNOW) { -#ifdef ENABLE_AMD +#ifdef ENABLE_3DNOW AMD_StereoMixToFloat(pSrc, pOut1, pOut2, nCount, m_pConfig->getIntToFloat()); #endif return; @@ -1845,7 +1845,7 @@ { if (gdwSysInfo & SYSMIX_3DNOW) { -#ifdef ENABLE_AMDNOW +#ifdef ENABLE_3DNOW AMD_FloatToStereoMix(pIn1, pIn2, pOut, nCount, m_pConfig->getFloatToInt()); #endif return; @@ -1869,7 +1869,7 @@ } if (gdwSysInfo & SYSMIX_3DNOW) { -#ifdef ENABLE_AMDNOW +#ifdef ENABLE_3DNOW AMD_MonoMixToFloat(pSrc, pOut, nCount, m_pConfig->getIntToFloat()); #endif return; @@ -1887,7 +1887,7 @@ { if (gdwSysInfo & SYSMIX_3DNOW) { -#ifdef ENABLE_AMDNOW +#ifdef ENABLE_3DNOW AMD_FloatToMonoMix(pIn, pOut, nCount, m_pConfig->getFloatToInt()); #endif return; Modified: trunk/OpenMPT/soundlib/Mmx_mix.cpp =================================================================== --- trunk/OpenMPT/soundlib/Mmx_mix.cpp 2013-03-15 22:09:13 UTC (rev 1572) +++ trunk/OpenMPT/soundlib/Mmx_mix.cpp 2013-03-15 22:30:14 UTC (rev 1573) @@ -7,7 +7,7 @@ * This file contains critical code. The basic X86 functions are * defined at the bottom of the file. #define's are used to isolate * the different flavours of functionality: - * ENABLE_MMX, ENABLE_AMDNOW, ENABLE_SSE flags must be set to + * ENABLE_MMX, ENABLE_3DNOW, ENABLE_SSE flags must be set to * to compile the optimized sections of the code. In both cases the * X86_xxxxxx functions will compile. * @@ -172,7 +172,7 @@ //////////////////////////////////////////////////////////////////////////////////// // 3DNow! optimizations -#ifdef ENABLE_AMDNOW +#ifdef ENABLE_3DNOW // Convert integer mix to floating-point void AMD_StereoMixToFloat(const int *pSrc, float *pOut1, float *pOut2, UINT nCount, const float _i2fc) Modified: trunk/OpenMPT/soundlib/Snd_eq.cpp =================================================================== --- trunk/OpenMPT/soundlib/Snd_eq.cpp 2013-03-15 22:09:13 UTC (rev 1572) +++ trunk/OpenMPT/soundlib/Snd_eq.cpp 2013-03-15 22:30:14 UTC (rev 1573) @@ -27,7 +27,7 @@ #ifdef ENABLE_SSE extern void SSE_MonoMixToFloat(const int *pSrc, float *pOut, UINT nCount, const float _i2fc); #endif -#ifdef ENABLE_AMD +#ifdef ENABLE_3DNOW extern void AMD_MonoMixToFloat(const int *pSrc, float *pOut, UINT nCount, const float _i2fc); extern void AMD_FloatToMonoMix(const float *pIn, int *pOut, UINT nCount, const float _f2ic); #endif @@ -139,7 +139,7 @@ void AMD_StereoEQ(EQBANDSTRUCT *pbl, EQBANDSTRUCT *pbr, REAL *pbuffer, UINT nCount) //--------------------------------------------------------------------------------- { -#ifdef ENABLE_AMD +#ifdef ENABLE_3DNOW float tmp[16]; _asm { @@ -377,9 +377,9 @@ } else #endif // ENABLE_SSE -#endif // ENABLE_AMD +#endif // ENABLE_3DNOW -#ifdef ENABLE_AMD +#ifdef ENABLE_3DNOW // We still perform the MMX check because the user can enable/disable this @@ -397,7 +397,7 @@ AMD_FloatToMonoMix(MixFloatBuffer, pbuffer, nCount*2, m_pConfig->getFloatToInt()); } else -#endif // ENABLE_AMD +#endif // ENABLE_3DNOW { X86_StereoMixToFloat(pbuffer, MixFloatBuffer, MixFloatBuffer+MIXBUFFERSIZE, nCount, m_pConfig->getIntToFloat()); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <man...@us...> - 2013-03-15 22:55:28
|
Revision: 1574 http://sourceforge.net/p/modplug/code/1574 Author: manxorist Date: 2013-03-15 22:55:20 +0000 (Fri, 15 Mar 2013) Log Message: ----------- [Var] Move ENABLE_MMX, ENABLE_3DNOW, ENABLE_SSE and ENABLE_EQ from the project settings right next to the NO_* macros in stdafx.h so that all/most global build settings are in one place. Modified Paths: -------------- trunk/OpenMPT/common/stdafx.h trunk/OpenMPT/mptrack/mptrack_08.vcproj trunk/OpenMPT/mptrack/mptrack_10.vcxproj Modified: trunk/OpenMPT/common/stdafx.h =================================================================== --- trunk/OpenMPT/common/stdafx.h 2013-03-15 22:30:14 UTC (rev 1573) +++ trunk/OpenMPT/common/stdafx.h 2013-03-15 22:55:20 UTC (rev 1574) @@ -75,6 +75,18 @@ #define WAVE_FORMAT_EXTENSIBLE 0xFFFE #endif // !defined(WAVE_FORMAT_EXTENSIBLE) +// Generate inline assembly using MMX instructions (only used when the CPU supports it). +#define ENABLE_MMX + +// Generate inline assembly using 3DNOW instructions (only used when the CPU supports it). +#define ENABLE_3DNOW + +// Generate inline assembly using SSE instructions (only used when the CPU supports it). +#define ENABLE_SSE + +// Enable the built-in equalizer. +#define ENABLE_EQ + // Define to build without ASIO support; makes build possible without ASIO SDK. //#define NO_ASIO Modified: trunk/OpenMPT/mptrack/mptrack_08.vcproj =================================================================== --- trunk/OpenMPT/mptrack/mptrack_08.vcproj 2013-03-15 22:30:14 UTC (rev 1573) +++ trunk/OpenMPT/mptrack/mptrack_08.vcproj 2013-03-15 22:55:20 UTC (rev 1574) @@ -49,7 +49,7 @@ Name="VCCLCompilerTool" Optimization="0" AdditionalIncludeDirectories="..\common;..\soundlib;..\include;..\include\vstsdk2.4\;..\include\ASIOSDK2\common\;..\xsoundlib;..\" - PreprocessorDefinitions="_DEBUG,WIN32,_WINDOWS,ENABLE_EQ,MODPLUG_TRACKER,ENABLE_3DNOW,ENABLE_SSE,ENABLE_MMX" + PreprocessorDefinitions="_DEBUG,WIN32,_WINDOWS,MODPLUG_TRACKER" StringPooling="true" ExceptionHandling="2" BasicRuntimeChecks="3" @@ -157,7 +157,7 @@ Optimization="2" InlineFunctionExpansion="2" AdditionalIncludeDirectories="..\common;..\soundlib;..\include;..\include\vstsdk2.4\;..\include\ASIOSDK2\common\;..\xsoundlib;..\" - PreprocessorDefinitions="NDEBUG,WIN32,_WINDOWS,ENABLE_MMX,ENABLE_EQ,MODPLUG_TRACKER,ENABLE_3DNOW,ENABLE_SSE" + PreprocessorDefinitions="NDEBUG,WIN32,_WINDOWS,MODPLUG_TRACKER" StringPooling="true" ExceptionHandling="2" RuntimeLibrary="0" Modified: trunk/OpenMPT/mptrack/mptrack_10.vcxproj =================================================================== --- trunk/OpenMPT/mptrack/mptrack_10.vcxproj 2013-03-15 22:30:14 UTC (rev 1573) +++ trunk/OpenMPT/mptrack/mptrack_10.vcxproj 2013-03-15 22:55:20 UTC (rev 1574) @@ -64,7 +64,7 @@ <AdditionalOptions>/EHsc %(AdditionalOptions)</AdditionalOptions> <Optimization>Disabled</Optimization> <AdditionalIncludeDirectories>..\common;..\soundlib;..\include;..\include\vstsdk2.4\;..\include\ASIOSDK2\common\;..\xsoundlib;..\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>_DEBUG;WIN32;_WINDOWS;ENABLE_EQ;MODPLUG_TRACKER;ENABLE_3DNOW;ENABLE_SSE;ENABLE_MMX;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <PreprocessorDefinitions>_DEBUG;WIN32;_WINDOWS;MODPLUG_TRACKER;%(PreprocessorDefinitions)</PreprocessorDefinitions> <StringPooling>true</StringPooling> <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> @@ -120,7 +120,7 @@ <Optimization>MaxSpeed</Optimization> <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion> <AdditionalIncludeDirectories>..\common;..\soundlib;..\include;..\include\vstsdk2.4\;..\include\ASIOSDK2\common\;..\xsoundlib;..\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>NDEBUG;WIN32;_WINDOWS;ENABLE_MMX;ENABLE_EQ;MODPLUG_TRACKER;ENABLE_3DNOW;ENABLE_SSE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <PreprocessorDefinitions>NDEBUG;WIN32;_WINDOWS;MODPLUG_TRACKER;%(PreprocessorDefinitions)</PreprocessorDefinitions> <StringPooling>true</StringPooling> <RuntimeLibrary>MultiThreaded</RuntimeLibrary> <BufferSecurityCheck>true</BufferSecurityCheck> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rel...@us...> - 2013-03-16 18:15:30
|
Revision: 1575 http://sourceforge.net/p/modplug/code/1575 Author: relabsoluness Date: 2013-03-16 18:15:17 +0000 (Sat, 16 Mar 2013) Log Message: ----------- [Fix] Build fix for VC08. Modified Paths: -------------- trunk/OpenMPT/common/misc_util.h trunk/OpenMPT/mptrack/PatternClipboard.cpp trunk/OpenMPT/mptrack/test/test.cpp Modified: trunk/OpenMPT/common/misc_util.h =================================================================== --- trunk/OpenMPT/common/misc_util.h 2013-03-15 22:55:20 UTC (rev 1574) +++ trunk/OpenMPT/common/misc_util.h 2013-03-16 18:15:17 UTC (rev 1575) @@ -13,6 +13,7 @@ #include <sstream> #include <string> #include <limits> +#include <limits.h> #include "typedefs.h" #include <io.h> // for _taccess @@ -304,11 +305,13 @@ template <> struct NumericTraits<int16> {static const int16 maxValue = int16_max; static const int16 minValue = int16_min;}; template <> struct NumericTraits<int32> {static const int32 maxValue = int32_max; static const int32 minValue = int32_min;}; template <> struct NumericTraits<int64> {static const int64 maxValue = int64_max; static const int64 minValue = int64_min;}; + template <> struct NumericTraits<long> {static const long maxValue = LONG_MAX; static const long minValue = LONG_MIN;}; template <> struct NumericTraits<uint8> {static const uint8 maxValue = uint8_max; static const uint8 minValue = 0;}; template <> struct NumericTraits<uint16> {static const uint16 maxValue = uint16_max; static const uint16 minValue = 0;}; template <> struct NumericTraits<uint32> {static const uint32 maxValue = uint32_max; static const uint32 minValue = 0;}; template <> struct NumericTraits<uint64> {static const uint64 maxValue = uint64_max; static const uint64 minValue = 0;}; + template <> struct NumericTraits<unsigned long> {static const unsigned long maxValue = ULONG_MAX; static const unsigned long minValue = 0;}; // Like std::max, but avoids conflict with max-macro. template <class T> inline const T& Max(const T& a, const T& b) {return (std::max)(a, b);} Modified: trunk/OpenMPT/mptrack/PatternClipboard.cpp =================================================================== --- trunk/OpenMPT/mptrack/PatternClipboard.cpp 2013-03-15 22:55:20 UTC (rev 1574) +++ trunk/OpenMPT/mptrack/PatternClipboard.cpp 2013-03-16 18:15:17 UTC (rev 1575) @@ -949,7 +949,7 @@ } instance.clipList.ResetContent(); PatternClipboard::clipindex_t i = 0; - for(std::deque<PatternClipboardElement>::const_iterator clip = PatternClipboard::instance.clipboards.cbegin(); clip != PatternClipboard::instance.clipboards.cend(); clip++, i++) + for(std::deque<PatternClipboardElement>::const_iterator clip = PatternClipboard::instance.clipboards.begin(); clip != PatternClipboard::instance.clipboards.end(); clip++, i++) { const int item = instance.clipList.AddString(clip->description); instance.clipList.SetItemDataPtr(item, reinterpret_cast<void *>(i)); Modified: trunk/OpenMPT/mptrack/test/test.cpp =================================================================== --- trunk/OpenMPT/mptrack/test/test.cpp 2013-03-15 22:55:20 UTC (rev 1574) +++ trunk/OpenMPT/mptrack/test/test.cpp 2013-03-16 18:15:17 UTC (rev 1575) @@ -199,6 +199,11 @@ VERIFY_EQUAL(int64_min, (std::numeric_limits<int64>::min)()); VERIFY_EQUAL(int64_max, (std::numeric_limits<int64>::max)()); VERIFY_EQUAL(uint64_max, (std::numeric_limits<uint64>::max)()); + + VERIFY_EQUAL(Util::NumericTraits<long>::minValue, (std::numeric_limits<long>::min)()); + VERIFY_EQUAL(Util::NumericTraits<long>::maxValue, (std::numeric_limits<long>::max)()); + VERIFY_EQUAL(Util::NumericTraits<unsigned long>::minValue, (std::numeric_limits<unsigned long>::min)()); + VERIFY_EQUAL(Util::NumericTraits<unsigned long>::maxValue, (std::numeric_limits<unsigned long>::max)()); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <man...@us...> - 2013-03-16 20:17:21
|
Revision: 1577 http://sourceforge.net/p/modplug/code/1577 Author: manxorist Date: 2013-03-16 20:17:13 +0000 (Sat, 16 Mar 2013) Log Message: ----------- [Ref] Replace _muldiv and _muldivr with a straight c implementation using 64bit integers and move the new functions into misc_util.h. Rename them to Util::muldiv and Util::muldivr respectively. [Ref] Add a general ENABLE_ASM macro which, when not set, should eventually disable all uses of inline assembler. [Ref] Replace X86_InitMixBuffer() with a simple memset and add alternate C implementations for X86_InitMixBuffer() and X86_Convert32To32() and take further C implementations for X86_StereoFill() and X86_EndChannelOfs() from libmodplug. C implementations are only used when ENABLE_ASM is not set or the compiler is not MSVC. Modified Paths: -------------- trunk/OpenMPT/common/misc_util.h trunk/OpenMPT/common/stdafx.h trunk/OpenMPT/mptrack/MainFrm.cpp trunk/OpenMPT/mptrack/View_smp.cpp trunk/OpenMPT/mptrack/Vstplug.cpp trunk/OpenMPT/soundlib/Fastmix.cpp trunk/OpenMPT/soundlib/Load_med.cpp trunk/OpenMPT/soundlib/Snd_dsp.cpp trunk/OpenMPT/soundlib/Snd_eq.cpp trunk/OpenMPT/soundlib/Snd_fx.cpp trunk/OpenMPT/soundlib/Sndfile.h trunk/OpenMPT/soundlib/Sndmix.cpp Modified: trunk/OpenMPT/common/misc_util.h =================================================================== --- trunk/OpenMPT/common/misc_util.h 2013-03-16 19:45:42 UTC (rev 1576) +++ trunk/OpenMPT/common/misc_util.h 2013-03-16 20:17:13 UTC (rev 1577) @@ -370,3 +370,17 @@ } } // namespace Util::sdOs #endif // MODPLUG_TRACKER + +namespace Util { + + inline int32 muldiv(int32 a, int32 b, int32 c) + { + return static_cast<int32>( ( static_cast<int64>(a) * b ) / c ); + } + + inline int32 muldivr(int32 a, int32 b, int32 c) + { + return static_cast<int32>( ( static_cast<int64>(a) * b + ( c / 2 ) ) / c ); + } + +} // namespace Util Modified: trunk/OpenMPT/common/stdafx.h =================================================================== --- trunk/OpenMPT/common/stdafx.h 2013-03-16 19:45:42 UTC (rev 1576) +++ trunk/OpenMPT/common/stdafx.h 2013-03-16 20:17:13 UTC (rev 1577) @@ -75,6 +75,15 @@ #define WAVE_FORMAT_EXTENSIBLE 0xFFFE #endif // !defined(WAVE_FORMAT_EXTENSIBLE) +// Use inline assembly at all +#define ENABLE_ASM + +// inline assembly requires MSVC compiler +#if defined(ENABLE_ASM) && defined(_MSC_VER) + +// Generate general x86 inline assembly. +#define ENABLE_X86 + // Generate inline assembly using MMX instructions (only used when the CPU supports it). #define ENABLE_MMX @@ -84,6 +93,8 @@ // Generate inline assembly using SSE instructions (only used when the CPU supports it). #define ENABLE_SSE +#endif // ENABLE_ASM + // Enable the built-in equalizer. #define ENABLE_EQ Modified: trunk/OpenMPT/mptrack/MainFrm.cpp =================================================================== --- trunk/OpenMPT/mptrack/MainFrm.cpp 2013-03-16 19:45:42 UTC (rev 1576) +++ trunk/OpenMPT/mptrack/MainFrm.cpp 2013-03-16 20:17:13 UTC (rev 1577) @@ -1110,7 +1110,7 @@ if (rVu > 0x10000) rVu = 0x10000; p->dwPos[0] = lVu; p->dwPos[1] = rVu; - DWORD dwVuDecay = _muldiv(dwSamplesRead, 120000, TrackerSettings::Instance().m_dwRate) + 1; + DWORD dwVuDecay = Util::muldiv(dwSamplesRead, 120000, TrackerSettings::Instance().m_dwRate) + 1; if (lVu >= dwVuDecay) gnLVuMeter = (lVu - dwVuDecay) << 11; else gnLVuMeter = 0; if (rVu >= dwVuDecay) gnRVuMeter = (rVu - dwVuDecay) << 11; else gnRVuMeter = 0; } Modified: trunk/OpenMPT/mptrack/View_smp.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_smp.cpp 2013-03-16 19:45:42 UTC (rev 1576) +++ trunk/OpenMPT/mptrack/View_smp.cpp 2013-03-16 20:17:13 UTC (rev 1577) @@ -349,7 +349,7 @@ return (n >> ((LONG)m_nZoom-1)) - m_nScrollPos; } else { - return _muldiv(n, m_sizeTotal.cx, nLen); + return Util::muldiv(n, m_sizeTotal.cx, nLen); } } return 0; @@ -373,7 +373,7 @@ } else { if (x < 0) x = 0; - if (m_sizeTotal.cx) n = _muldiv(x, nLen, m_sizeTotal.cx); + if (m_sizeTotal.cx) n = Util::muldiv(x, nLen, m_sizeTotal.cx); } if (n < 0) n = 0; if (n > (LONG)nLen) n = nLen; @@ -685,7 +685,7 @@ } else { xmax = cx; - //posincr = _muldiv(len, 0x10000, cx); + //posincr = Util::muldiv(len, 0x10000, cx); posincr = uint64(len) * uint64(0x10000) / uint64(cx); } ::MoveToEx(hdc, 0, ymed, NULL); Modified: trunk/OpenMPT/mptrack/Vstplug.cpp =================================================================== --- trunk/OpenMPT/mptrack/Vstplug.cpp 2013-03-16 19:45:42 UTC (rev 1576) +++ trunk/OpenMPT/mptrack/Vstplug.cpp 2013-03-16 20:17:13 UTC (rev 1577) @@ -3497,7 +3497,7 @@ DeinterleaveInt16ToFloat(outputs[0], outputs[1], samples); } - m_DataTime += _muldiv(samples, 10000000, m_nSamplesPerSec); + m_DataTime += Util::muldiv(samples, 10000000, m_nSamplesPerSec); } Modified: trunk/OpenMPT/soundlib/Fastmix.cpp =================================================================== --- trunk/OpenMPT/soundlib/Fastmix.cpp 2013-03-16 19:45:42 UTC (rev 1576) +++ trunk/OpenMPT/soundlib/Fastmix.cpp 2013-03-16 20:17:13 UTC (rev 1577) @@ -2023,6 +2023,7 @@ DWORD MPPASMCALL X86_Convert32To32(LPVOID lp16, int *pBuffer, DWORD lSampleCount) //------------------------------------------------------------------------------- { +#ifdef ENABLE_X86 DWORD result; _asm { mov ebx, lp16 // ebx = 32-bit buffer @@ -2054,39 +2055,26 @@ mov result, eax } return result; +#else + int32 * p = (int32*)lp16; + for ( DWORD i=0; i<lSampleCount; i++ ) { + int v = pBuffer[i]; + if ( v < MIXING_CLIPMIN ) { + v = MIXING_CLIPMIN; + } else if ( v > MIXING_CLIPMAX ) { + v = MIXING_CLIPMAX; + } + p[i] = v << MIXING_ATTENUATION; + } + return lSampleCount * 4; +#endif } void MPPASMCALL X86_InitMixBuffer(int *pBuffer, UINT nSamples) //------------------------------------------------------------ { - _asm { - mov ecx, nSamples - mov esi, pBuffer - xor eax, eax - mov edx, ecx - shr ecx, 2 - and edx, 3 - jz unroll4x -loop1x: - add esi, 4 - dec edx - mov dword ptr [esi-4], eax - jnz loop1x -unroll4x: - or ecx, ecx - jnz loop4x - jmp done -loop4x: - add esi, 16 - dec ecx - mov dword ptr [esi-16], eax - mov dword ptr [esi-12], eax - mov dword ptr [esi-8], eax - mov dword ptr [esi-4], eax - jnz loop4x -done:; - } + memset(pBuffer, 0, nSamples * sizeof(int)); } @@ -2100,7 +2088,7 @@ { static int gDitherA, gDitherB; - __asm { + _asm { mov esi, pBuffer // esi = pBuffer+i mov eax, nSamples // ebp = i mov ecx, nBits // ecx = number of bits of noise @@ -2201,6 +2189,7 @@ void MPPASMCALL X86_StereoFill(int *pBuffer, UINT nSamples, LPLONG lpROfs, LPLONG lpLOfs) //--------------------------------------------------------------------------------------- { +#ifdef ENABLE_X86 _asm { mov edi, pBuffer mov ecx, nSamples @@ -2268,12 +2257,34 @@ mov [esi], eax mov [edi], edx } +#else // c implementation taken from libmodplug + int rofs = *lpROfs; + int lofs = *lpLOfs; + + if ((!rofs) && (!lofs)) + { + X86_InitMixBuffer(pBuffer, nSamples*2); + return; + } + for (UINT i=0; i<nSamples; i++) + { + int x_r = (rofs + (((-rofs)>>31) & OFSDECAYMASK)) >> OFSDECAYSHIFT; + int x_l = (lofs + (((-lofs)>>31) & OFSDECAYMASK)) >> OFSDECAYSHIFT; + rofs -= x_r; + lofs -= x_l; + pBuffer[i*2] = x_r; + pBuffer[i*2+1] = x_l; + } + *lpROfs = rofs; + *lpLOfs = lofs; +#endif } void MPPASMCALL X86_EndChannelOfs(ModChannel *pChannel, int *pBuffer, UINT nSamples) //---------------------------------------------------------------------------------- { +#ifdef ENABLE_X86 _asm { mov esi, pChannel mov edi, pBuffer @@ -2310,6 +2321,23 @@ mov dword ptr [esi+ModChannel.nROfs], eax mov dword ptr [esi+ModChannel.nLOfs], edx } +#else // c implementation taken from libmodplug + int rofs = pChannel->nROfs; + int lofs = pChannel->nLOfs; + + if ((!rofs) && (!lofs)) return; + for (UINT i=0; i<nSamples; i++) + { + int x_r = (rofs + (((-rofs)>>31) & OFSDECAYMASK)) >> OFSDECAYSHIFT; + int x_l = (lofs + (((-lofs)>>31) & OFSDECAYMASK)) >> OFSDECAYSHIFT; + rofs -= x_r; + lofs -= x_l; + pBuffer[i*2] += x_r; + pBuffer[i*2+1] += x_l; + } + pChannel->nROfs = rofs; + pChannel->nLOfs = lofs; +#endif } @@ -2326,7 +2354,7 @@ //------------------------------------------------------------- { UINT result; - __asm { + _asm { mov esi, pBuffer // esi = pBuffer+i mov ecx, nSamples // ecx = i mov edi, nAGC // edi = AGC (0..256) Modified: trunk/OpenMPT/soundlib/Load_med.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_med.cpp 2013-03-16 19:45:42 UTC (rev 1576) +++ trunk/OpenMPT/soundlib/Load_med.cpp 2013-03-16 20:17:13 UTC (rev 1577) @@ -320,7 +320,7 @@ // Old tempo if (!(pmsh->flags2 & MMD_FLAG2_BPM)) { - param = _muldiv(param, 5*715909, 2*474326); + param = Util::muldiv(param, 5*715909, 2*474326); } // F.0B - F.F0: Set Tempo (assumes LPB=4) if (param > 0x0A) @@ -591,7 +591,7 @@ #endif } else { - deftempo = _muldiv(deftempo, 5*715909, 2*474326); + deftempo = Util::muldiv(deftempo, 5*715909, 2*474326); #ifdef MED_LOG Log("oldtempo: %3d bpm (bpm=%3d)\n", deftempo, BigEndianW(pmsh->deftempo)); #endif Modified: trunk/OpenMPT/soundlib/Snd_dsp.cpp =================================================================== --- trunk/OpenMPT/soundlib/Snd_dsp.cpp 2013-03-16 19:45:42 UTC (rev 1576) +++ trunk/OpenMPT/soundlib/Snd_dsp.cpp 2013-03-16 20:17:13 UTC (rev 1577) @@ -101,7 +101,7 @@ // sin(x) - sine of x (radians) __inline float sinMPT(float x) { - __asm { + _asm { fld x fsin fstp x Modified: trunk/OpenMPT/soundlib/Snd_eq.cpp =================================================================== --- trunk/OpenMPT/soundlib/Snd_eq.cpp 2013-03-16 19:45:42 UTC (rev 1576) +++ trunk/OpenMPT/soundlib/Snd_eq.cpp 2013-03-16 20:17:13 UTC (rev 1577) @@ -376,8 +376,8 @@ } else +#endif // ENABLE_MMX #endif // ENABLE_SSE -#endif // ENABLE_3DNOW #ifdef ENABLE_3DNOW Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp =================================================================== --- trunk/OpenMPT/soundlib/Snd_fx.cpp 2013-03-16 19:45:42 UTC (rev 1576) +++ trunk/OpenMPT/soundlib/Snd_fx.cpp 2013-03-16 20:17:13 UTC (rev 1577) @@ -2774,7 +2774,7 @@ if(m_SongFlags[SONG_LINEARSLIDES] && !(GetType() & (MOD_TYPE_XM | MOD_TYPE_MT2))) { int oldPeriod = pChn->nPeriod; - pChn->nPeriod = _muldivr(pChn->nPeriod, LinearSlideDownTable[param & 0x0F], 65536); + pChn->nPeriod = Util::muldivr(pChn->nPeriod, LinearSlideDownTable[param & 0x0F], 65536); if(oldPeriod == pChn->nPeriod) { pChn->nPeriod--; @@ -2809,7 +2809,7 @@ if (m_SongFlags[SONG_LINEARSLIDES] && !(GetType() & (MOD_TYPE_XM | MOD_TYPE_MT2))) { int oldPeriod = pChn->nPeriod; - pChn->nPeriod = _muldivr(pChn->nPeriod, LinearSlideUpTable[param & 0x0F], 65536); + pChn->nPeriod = Util::muldivr(pChn->nPeriod, LinearSlideUpTable[param & 0x0F], 65536); if(oldPeriod == pChn->nPeriod) { pChn->nPeriod++; @@ -2844,7 +2844,7 @@ if(m_SongFlags[SONG_LINEARSLIDES] && !(GetType() & (MOD_TYPE_XM | MOD_TYPE_MT2))) { int oldPeriod = pChn->nPeriod; - pChn->nPeriod = _muldivr(pChn->nPeriod, FineLinearSlideDownTable[param & 0x0F], 65536); + pChn->nPeriod = Util::muldivr(pChn->nPeriod, FineLinearSlideDownTable[param & 0x0F], 65536); if(oldPeriod == pChn->nPeriod) { pChn->nPeriod--; @@ -2879,7 +2879,7 @@ if(m_SongFlags[SONG_LINEARSLIDES] && !(GetType() & (MOD_TYPE_XM | MOD_TYPE_MT2))) { int oldPeriod = pChn->nPeriod; - pChn->nPeriod = _muldivr(pChn->nPeriod, FineLinearSlideUpTable[param & 0x0F], 65536); + pChn->nPeriod = Util::muldivr(pChn->nPeriod, FineLinearSlideUpTable[param & 0x0F], 65536); if(oldPeriod == pChn->nPeriod) { pChn->nPeriod++; @@ -2991,7 +2991,7 @@ if (n > 255) n = 255; // Return (a*b+c/2)/c - no divide error // Table is 65536*2(n/192) - delta = _muldivr(pChn->nPeriod, LinearSlideUpTable[n], 65536) - pChn->nPeriod; + delta = Util::muldivr(pChn->nPeriod, LinearSlideUpTable[n], 65536) - pChn->nPeriod; if (delta < 1) delta = 1; } pChn->nPeriod += delta; @@ -3004,7 +3004,7 @@ { UINT n = pChn->nPortamentoSlide >> 2; if (n > 255) n = 255; - delta = _muldivr(pChn->nPeriod, LinearSlideDownTable[n], 65536) - pChn->nPeriod; + delta = Util::muldivr(pChn->nPeriod, LinearSlideDownTable[n], 65536) - pChn->nPeriod; if (delta > -1) delta = -1; } pChn->nPeriod += delta; @@ -3662,13 +3662,13 @@ { // This is "almost" how IT does it - apparently, IT seems to lag one row behind on global volume or channel volume changes. const int swing = (IsCompatibleMode(TRK_IMPULSETRACKER) || GetModFlag(MSF_OLDVOLSWING)) ? pChn->nVolSwing : 0; - const int vol = _muldiv((pChn->nVolume + swing) * m_nGlobalVolume, pChn->nGlobalVol * pChn->nInsVol, 1 << 20); + const int vol = Util::muldiv((pChn->nVolume + swing) * m_nGlobalVolume, pChn->nGlobalVol * pChn->nInsVol, 1 << 20); data = (unsigned char)Clamp(vol / 2, 1, 127); //data = (unsigned char)min((pChn->nVolume * pChn->nGlobalVol * m_nGlobalVolume) >> (1 + 6 + 8), 127); } else if(macro[pos] == 'u') // u: volume (calculated) { // Same note as with velocity applies here, but apparently also for instrument / sample volumes? - const int vol = _muldiv(pChn->nCalcVolume * m_nGlobalVolume, pChn->nGlobalVol * pChn->nInsVol, 1 << 26); + const int vol = Util::muldiv(pChn->nCalcVolume * m_nGlobalVolume, pChn->nGlobalVol * pChn->nInsVol, 1 << 26); data = (unsigned char)Clamp(vol / 2, 1, 127); //data = (unsigned char)min((pChn->nCalcVolume * pChn->nGlobalVol * m_nGlobalVolume) >> (7 + 6 + 8), 127); } else if(macro[pos] == 'x') // x: pan set @@ -4205,7 +4205,7 @@ if (n) { if (n > 255) n = 255; - pChn->nPeriod = _muldivr(pChn->nPeriod, LinearSlideDownTable[n], 65536); + pChn->nPeriod = Util::muldivr(pChn->nPeriod, LinearSlideDownTable[n], 65536); if (pChn->nPeriod == nOldPeriod) pChn->nPeriod = nOldPeriod-1; } } else @@ -4214,7 +4214,7 @@ if (n) { if (n > 255) n = 255; - pChn->nPeriod = _muldivr(pChn->nPeriod, LinearSlideUpTable[n], 65536); + pChn->nPeriod = Util::muldivr(pChn->nPeriod, LinearSlideUpTable[n], 65536); if (pChn->nPeriod == nOldPeriod) pChn->nPeriod = nOldPeriod+1; } } @@ -4581,7 +4581,7 @@ { if (!nC5Speed) nC5Speed = 8363; //(a*b)/c - return _muldiv(8363, (FreqS3MTable[note % 12] << 5), nC5Speed << (note / 12)); + return Util::muldiv(8363, (FreqS3MTable[note % 12] << 5), nC5Speed << (note / 12)); //8363 * freq[note%12] / nC5Speed * 2^(5-note/12) } } else @@ -4648,10 +4648,10 @@ if(m_SongFlags[SONG_LINEARSLIDES]) { if (!nC5Speed) nC5Speed = 8363; - return _muldiv(nC5Speed, 1712L << 8, (period << 8)+nPeriodFrac); + return Util::muldiv(nC5Speed, 1712L << 8, (period << 8)+nPeriodFrac); } else { - return _muldiv(8363, 1712L << 8, (period << 8)+nPeriodFrac); + return Util::muldiv(8363, 1712L << 8, (period << 8)+nPeriodFrac); } } } Modified: trunk/OpenMPT/soundlib/Sndfile.h =================================================================== --- trunk/OpenMPT/soundlib/Sndfile.h 2013-03-16 19:45:42 UTC (rev 1576) +++ trunk/OpenMPT/soundlib/Sndfile.h 2013-03-16 20:17:13 UTC (rev 1577) @@ -780,9 +780,6 @@ #define MOD2XMFineTune(k) ((int)( (signed char)((k)<<4) )) #define XM2MODFineTune(k) ((int)( (k>>4)&0x0f )) -int _muldiv(long a, long b, long c); -int _muldivr(long a, long b, long c); - // Read instrument property with 'code' and 'size' from 'file' to instrument 'pIns'. void ReadInstrumentExtensionField(ModInstrument* pIns, const uint32 code, const uint16 size, FileReader &file); Modified: trunk/OpenMPT/soundlib/Sndmix.cpp =================================================================== --- trunk/OpenMPT/soundlib/Sndmix.cpp 2013-03-16 19:45:42 UTC (rev 1576) +++ trunk/OpenMPT/soundlib/Sndmix.cpp 2013-03-16 20:17:13 UTC (rev 1577) @@ -121,96 +121,7 @@ } -// Return (a*b)/c - no divide error -int _muldiv(long a, long b, long c) -{ - int sign, result; - _asm { - mov eax, a - mov ebx, b - or eax, eax - mov edx, eax - jge aneg - neg eax -aneg: - xor edx, ebx - or ebx, ebx - mov ecx, c - jge bneg - neg ebx -bneg: - xor edx, ecx - or ecx, ecx - mov sign, edx - jge cneg - neg ecx -cneg: - mul ebx - cmp edx, ecx - jae diverr - div ecx - jmp ok -diverr: - mov eax, 0x7fffffff -ok: - mov edx, sign - or edx, edx - jge rneg - neg eax -rneg: - mov result, eax -} - return result; -} - -// Return (a*b+c/2)/c - no divide error -int _muldivr(long a, long b, long c) -{ - int sign, result; - _asm { - mov eax, a - mov ebx, b - or eax, eax - mov edx, eax - jge aneg - neg eax -aneg: - xor edx, ebx - or ebx, ebx - mov ecx, c - jge bneg - neg ebx -bneg: - xor edx, ecx - or ecx, ecx - mov sign, edx - jge cneg - neg ecx -cneg: - mul ebx - mov ebx, ecx - shr ebx, 1 - add eax, ebx - adc edx, 0 - cmp edx, ecx - jae diverr - div ecx - jmp ok -diverr: - mov eax, 0x7fffffff -ok: - mov edx, sign - or edx, edx - jge rneg - neg eax -rneg: - mov result, eax - } - return result; -} - - void CSoundFile::SetMixerSettings(const MixerSettings &mixersettings) //------------------------------------------------------------------- { @@ -265,7 +176,7 @@ BOOL CSoundFile::FadeSong(UINT msec) //---------------------------------- { - samplecount_t nsamples = _muldiv(msec, gdwMixingFreq, 1000); + samplecount_t nsamples = Util::muldiv(msec, gdwMixingFreq, 1000); if (nsamples <= 0) return FALSE; if (nsamples > 0x100000) nsamples = 0x100000; m_nBufferCount = nsamples; @@ -292,7 +203,7 @@ //---------------------------------------- { if(m_SongFlags[SONG_GLOBALFADE]) return FALSE; - m_nGlobalFadeMaxSamples = _muldiv(msec, gdwMixingFreq, 1000); + m_nGlobalFadeMaxSamples = Util::muldiv(msec, gdwMixingFreq, 1000); m_nGlobalFadeSamples = m_nGlobalFadeMaxSamples; m_SongFlags.set(SONG_GLOBALFADE); return TRUE; @@ -1249,11 +1160,11 @@ { l = -l; LimitMax(l, 255); - period = _muldiv(period, LinearSlideUpTable[l], 0x10000); + period = Util::muldiv(period, LinearSlideUpTable[l], 0x10000); } else { LimitMax(l, 255); - period = _muldiv(period, LinearSlideDownTable[l], 0x10000); + period = Util::muldiv(period, LinearSlideDownTable[l], 0x10000); } } //End: Original behavior. } @@ -1641,12 +1552,12 @@ if (l < 0) { l = -l; - vdelta = _muldiv(period, LinearSlideDownTable[l >> 2], 0x10000) - period; - if (l & 0x03) vdelta += _muldiv(period, FineLinearSlideDownTable[l & 0x03], 0x10000) - period; + vdelta = Util::muldiv(period, LinearSlideDownTable[l >> 2], 0x10000) - period; + if (l & 0x03) vdelta += Util::muldiv(period, FineLinearSlideDownTable[l & 0x03], 0x10000) - period; } else { - vdelta = _muldiv(period, LinearSlideUpTable[l >> 2], 0x10000) - period; - if (l & 0x03) vdelta += _muldiv(period, FineLinearSlideUpTable[l & 0x03], 0x10000) - period; + vdelta = Util::muldiv(period, LinearSlideUpTable[l >> 2], 0x10000) - period; + if (l & 0x03) vdelta += Util::muldiv(period, FineLinearSlideUpTable[l & 0x03], 0x10000) - period; } } period += vdelta; @@ -1743,17 +1654,17 @@ int l = abs(vdelta); if(vdelta < 0) { - vdelta = _muldiv(period, LinearSlideDownTable[l >> 2], 0x10000) - period; + vdelta = Util::muldiv(period, LinearSlideDownTable[l >> 2], 0x10000) - period; if (l & 0x03) { - vdelta += _muldiv(period, FineLinearSlideDownTable[l & 0x03], 0x10000) - period; + vdelta += Util::muldiv(period, FineLinearSlideDownTable[l & 0x03], 0x10000) - period; } } else { - vdelta = _muldiv(period, LinearSlideUpTable[l >> 2], 0x10000) - period; + vdelta = Util::muldiv(period, LinearSlideUpTable[l >> 2], 0x10000) - period; if (l & 0x03) { - vdelta += _muldiv(period, FineLinearSlideUpTable[l & 0x03], 0x10000) - period; + vdelta += Util::muldiv(period, FineLinearSlideUpTable[l & 0x03], 0x10000) - period; } } period -= vdelta; @@ -1837,7 +1748,7 @@ df2 = LinearSlideDownTable[n1+1]; } n >>= 2; - period = _muldiv(period, df1 + ((df2 - df1) * (n & 0x3F) >> 6), 256); + period = Util::muldiv(period, df1 + ((df2 - df1) * (n & 0x3F) >> 6), 256); nPeriodFrac = period & 0xFF; period >>= 8; } else @@ -1968,7 +1879,7 @@ if(m_SongFlags[SONG_GLOBALFADE] && m_nGlobalFadeMaxSamples != 0) { - mastervol = _muldiv(mastervol, m_nGlobalFadeSamples, m_nGlobalFadeMaxSamples); + mastervol = Util::muldiv(mastervol, m_nGlobalFadeSamples, m_nGlobalFadeMaxSamples); } if (m_pConfig->getUseGlobalPreAmp()) @@ -2075,7 +1986,7 @@ if (vol) { // IMPORTANT: pChn->nRealVolume is 14 bits !!! - // -> _muldiv( 14+8, 6+6, 18); => RealVolume: 14-bit result (22+12-20) + // -> Util::muldiv( 14+8, 6+6, 18); => RealVolume: 14-bit result (22+12-20) if(pChn->dwFlags[CHN_SYNCMUTE]) { @@ -2084,10 +1995,10 @@ { // Don't let global volume affect level of sample if // Global volume is going to be applied to master output anyway. - pChn->nRealVolume = _muldiv(vol * MAX_GLOBAL_VOLUME, pChn->nGlobalVol * insVol, 1 << 20); + pChn->nRealVolume = Util::muldiv(vol * MAX_GLOBAL_VOLUME, pChn->nGlobalVol * insVol, 1 << 20); } else { - pChn->nRealVolume = _muldiv(vol * m_nGlobalVolume, pChn->nGlobalVol * insVol, 1 << 20); + pChn->nRealVolume = Util::muldiv(vol * m_nGlobalVolume, pChn->nGlobalVol * insVol, 1 << 20); } } @@ -2185,7 +2096,7 @@ // Applying Pitch/Tempo lock. if(GetType() & (MOD_TYPE_IT | MOD_TYPE_MPT) && pIns && pIns->wPitchToTempoLock) { - freq = _muldivr(freq, m_nMusicTempo, pIns->wPitchToTempoLock); + freq = Util::muldivr(freq, m_nMusicTempo, pIns->wPitchToTempoLock); } if ((GetType() & (MOD_TYPE_IT | MOD_TYPE_MPT)) && (freq < 256)) @@ -2196,7 +2107,7 @@ pChn->nCalcVolume = 0; } - UINT ninc = _muldiv(freq, 0x10000, gdwMixingFreq); + UINT ninc = Util::muldiv(freq, 0x10000, gdwMixingFreq); if ((ninc >= 0xFFB0) && (ninc <= 0x10090)) ninc = 0x10000; if (m_nFreqFactor != 128) ninc = (ninc * m_nFreqFactor) >> 7; if (ninc > 0xFF0000) ninc = 0xFF0000; @@ -2608,11 +2519,11 @@ { // Ramping required m_lHighResRampingGlobalVolume += step; - *sample = _muldiv(*sample, m_lHighResRampingGlobalVolume, MAX_GLOBAL_VOLUME << VOLUMERAMPPRECISION); + *sample = Util::muldiv(*sample, m_lHighResRampingGlobalVolume, MAX_GLOBAL_VOLUME << VOLUMERAMPPRECISION); m_nSamplesToGlobalVolRampDest--; } else { - *sample = _muldiv(*sample, m_nGlobalVolume, MAX_GLOBAL_VOLUME); + *sample = Util::muldiv(*sample, m_nGlobalVolume, MAX_GLOBAL_VOLUME); m_lHighResRampingGlobalVolume = m_nGlobalVolume << VOLUMERAMPPRECISION; } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2013-03-17 02:14:33
|
Revision: 1584 http://sourceforge.net/p/modplug/code/1584 Author: saga-games Date: 2013-03-17 02:14:22 +0000 (Sun, 17 Mar 2013) Log Message: ----------- [Fix] Play Whole Row While Recording didn't work properly with Row Spacing values other than 0 (tx coda). [Mod] Play Whole Row While Recording is now also applied to Quick Paste and Clear+Step commands (tx coda). [Mod] OpenMPT: Version is now 1.21.01.21 Modified Paths: -------------- trunk/OpenMPT/common/version.h trunk/OpenMPT/mptrack/View_pat.cpp trunk/OpenMPT/mptrack/View_pat.h Modified: trunk/OpenMPT/common/version.h =================================================================== --- trunk/OpenMPT/common/version.h 2013-03-16 23:32:19 UTC (rev 1583) +++ trunk/OpenMPT/common/version.h 2013-03-17 02:14:22 UTC (rev 1584) @@ -19,7 +19,7 @@ #define VER_MAJORMAJOR 1 #define VER_MAJOR 21 #define VER_MINOR 01 -#define VER_MINORMINOR 20 +#define VER_MINORMINOR 21 //Creates version number from version parts that appears in version string. //For example MAKE_VERSION_NUMERIC(1,17,02,28) gives version number of Modified: trunk/OpenMPT/mptrack/View_pat.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_pat.cpp 2013-03-16 23:32:19 UTC (rev 1583) +++ trunk/OpenMPT/mptrack/View_pat.cpp 2013-03-17 02:14:22 UTC (rev 1584) @@ -2435,12 +2435,12 @@ void CViewPattern::OnPatternStep() //-------------------------------- { - PatternStep(true); + PatternStep(); } -void CViewPattern::PatternStep(bool autoStep) -//------------------------------------------- +void CViewPattern::PatternStep(ROWINDEX row) +//------------------------------------------ { CMainFrame *pMainFrm = CMainFrame::GetMainFrame(); CModDoc *pModDoc = GetDocument(); @@ -2459,7 +2459,7 @@ pSndFile->Chn[i].dwFlags.set(CHN_NOTEFADE | CHN_KEYOFF); } pSndFile->LoopPattern(m_nPattern); - pSndFile->m_nNextRow = GetCurrentRow(); + pSndFile->m_nNextRow = row == ROWINDEX_INVALID ? GetCurrentRow() : row; pSndFile->m_SongFlags.reset(SONG_PAUSED); pSndFile->m_SongFlags.set(SONG_STEP); @@ -2470,7 +2470,7 @@ pMainFrm->PlayMod(pModDoc, m_hWnd, MPTNOTIFY_POSITION|MPTNOTIFY_VUMETERS); } CMainFrame::EnableLowLatencyMode(); - if(autoStep) + if(row == ROWINDEX_INVALID) { if (TrackerSettings::Instance().m_dwPatternSetup & PATTERN_CONTSCROLL) SetCurrentRow(GetCurrentRow() + 1, TRUE); @@ -2552,6 +2552,11 @@ } SetModified(false); + // Preview Row + if((TrackerSettings::Instance().m_dwPatternSetup & PATTERN_PLAYEDITROW) && !IsLiveRecord()) + { + PatternStep(GetCurrentRow()); + } if(GetSoundFile()->IsPaused() || !m_Status[psFollowSong] || (CMainFrame::GetMainFrame() && CMainFrame::GetMainFrame()->GetFollowSong(GetDocument()) != m_hWnd)) { @@ -5111,7 +5116,7 @@ if (playWholeRow) { // play the whole row in "step mode" - PatternStep(false); + PatternStep(nRow); } if (!playWholeRow || !recordEnabled) { @@ -5346,7 +5351,7 @@ if(playWholeRow) { // play the whole row in "step mode" - PatternStep(false); + PatternStep(GetCurrentRow()); } if(!playWholeRow || !recordEnabled) { @@ -5684,6 +5689,12 @@ if(step && (pSndFile->IsPaused() || !m_Status[psFollowSong] || (CMainFrame::GetMainFrame() != nullptr && CMainFrame::GetMainFrame()->GetFollowSong(GetDocument()) != m_hWnd))) { + // Preview Row + if((TrackerSettings::Instance().m_dwPatternSetup & PATTERN_PLAYEDITROW) && !IsLiveRecord()) + { + PatternStep(GetCurrentRow()); + } + if ((m_nSpacing > 0) && (m_nSpacing <= MAX_SPACING)) SetCurrentRow(GetCurrentRow() + m_nSpacing); Modified: trunk/OpenMPT/mptrack/View_pat.h =================================================================== --- trunk/OpenMPT/mptrack/View_pat.h 2013-03-16 23:32:19 UTC (rev 1583) +++ trunk/OpenMPT/mptrack/View_pat.h 2013-03-17 02:14:22 UTC (rev 1584) @@ -505,7 +505,7 @@ bool IsEditingEnabled_bmsg(); // Play one pattern row and stop ("step mode") - void PatternStep(bool autoStep); + void PatternStep(ROWINDEX row = ROWINDEX_INVALID); // Add a channel. void AddChannelBefore(CHANNELINDEX nBefore); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <man...@us...> - 2013-03-17 14:06:08
|
Revision: 1590 http://sourceforge.net/p/modplug/code/1590 Author: manxorist Date: 2013-03-17 14:05:53 +0000 (Sun, 17 Mar 2013) Log Message: ----------- Merged revision(s) 1586-1589 from branches/manx/build-speedup: [Var] Add a seperate project configuration "ReleaseLTCG" for MSVC2010 with Link Time Code Generation and disable LTCG in the default "Release" configuration. This results in faster full rebuilds and especially considerably faster rebuilds when only a few files were changed at the cost of missing full program optimizations. ........ [Var] Fix PCH path in ReleaseLTCG build configuration. ........ [Fix] Rename output file in "Release" configuration to mptrack-noLTCG.exe instead of mptrack.exe to not confuse VisualStudio when switching between configurations. ........ [Var] Rename solution configuration Release to ReleaseNoLTCG and rename ReleaseLTCG to Release so that nothing changes when using "Release" configuration. ........ Modified Paths: -------------- trunk/OpenMPT/include/flac/src/libFLAC/libFLAC_static_10.vcxproj trunk/OpenMPT/include/zlib/contrib/vstudio/vc10/zlibstat.vcxproj trunk/OpenMPT/mptrack/MPTRACK_10.sln trunk/OpenMPT/mptrack/mptrack_10.vcxproj trunk/OpenMPT/soundtouch/soundtouch_10.vcxproj trunk/OpenMPT/ungzip/ungzip_10.vcxproj trunk/OpenMPT/unlha/unlha_10.vcxproj trunk/OpenMPT/unrar/unrar_10.vcxproj trunk/OpenMPT/unzip/unzip_10.vcxproj trunk/OpenMPT/xsoundlib/xsoundlib_10.vcxproj Property Changed: ---------------- trunk/OpenMPT/ trunk/OpenMPT/mptrack/ Index: trunk/OpenMPT =================================================================== --- trunk/OpenMPT 2013-03-17 14:02:00 UTC (rev 1589) +++ trunk/OpenMPT 2013-03-17 14:05:53 UTC (rev 1590) Property changes on: trunk/OpenMPT ___________________________________________________________________ Modified: svn:mergeinfo ## -1,2 +1,3 ## +/branches/manx/build-speedup:1586-1589 /branches/manx/header-dependencies-cleanups:1394-1397,1401-1402,1405-1406 /branches/manx/project-files-cleanups:1378-1382 \ No newline at end of property Modified: trunk/OpenMPT/include/flac/src/libFLAC/libFLAC_static_10.vcxproj =================================================================== --- trunk/OpenMPT/include/flac/src/libFLAC/libFLAC_static_10.vcxproj 2013-03-17 14:02:00 UTC (rev 1589) +++ trunk/OpenMPT/include/flac/src/libFLAC/libFLAC_static_10.vcxproj 2013-03-17 14:05:53 UTC (rev 1590) @@ -19,6 +19,7 @@ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> <ConfigurationType>StaticLibrary</ConfigurationType> + <WholeProgramOptimization>false</WholeProgramOptimization> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> <ConfigurationType>StaticLibrary</ConfigurationType> @@ -64,7 +65,7 @@ <IntrinsicFunctions>true</IntrinsicFunctions> <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed> <OmitFramePointers>true</OmitFramePointers> - <WholeProgramOptimization>true</WholeProgramOptimization> + <WholeProgramOptimization>false</WholeProgramOptimization> <AdditionalIncludeDirectories>.\include;..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <PreprocessorDefinitions>WIN32;NDEBUG;_LIB;FLAC__USE_3DNOW;VERSION="1.2.0";FLAC__NO_DLL;%(PreprocessorDefinitions)</PreprocessorDefinitions> <RuntimeLibrary>MultiThreaded</RuntimeLibrary> @@ -75,6 +76,8 @@ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> <CompileAs>Default</CompileAs> <DisableSpecificWarnings>4267;4996;%(DisableSpecificWarnings)</DisableSpecificWarnings> + <MultiProcessorCompilation>true</MultiProcessorCompilation> + <FunctionLevelLinking>true</FunctionLevelLinking> </ClCompile> <Lib> <OutputFile>..\..\lib\libFLAC_static.lib</OutputFile> Modified: trunk/OpenMPT/include/zlib/contrib/vstudio/vc10/zlibstat.vcxproj =================================================================== --- trunk/OpenMPT/include/zlib/contrib/vstudio/vc10/zlibstat.vcxproj 2013-03-17 14:02:00 UTC (rev 1589) +++ trunk/OpenMPT/include/zlib/contrib/vstudio/vc10/zlibstat.vcxproj 2013-03-17 14:05:53 UTC (rev 1590) @@ -49,6 +49,7 @@ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> <ConfigurationType>StaticLibrary</ConfigurationType> <UseOfMfc>false</UseOfMfc> + <WholeProgramOptimization>false</WholeProgramOptimization> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> <ConfigurationType>StaticLibrary</ConfigurationType> @@ -199,6 +200,7 @@ <ProgramDataBaseFileName>$(OutDir)</ProgramDataBaseFileName> <WarningLevel>Level3</WarningLevel> <MultiProcessorCompilation>true</MultiProcessorCompilation> + <WholeProgramOptimization>false</WholeProgramOptimization> </ClCompile> <ResourceCompile> <Culture>0x040c</Culture> Index: trunk/OpenMPT/mptrack =================================================================== --- trunk/OpenMPT/mptrack 2013-03-17 14:02:00 UTC (rev 1589) +++ trunk/OpenMPT/mptrack 2013-03-17 14:05:53 UTC (rev 1590) Property changes on: trunk/OpenMPT/mptrack ___________________________________________________________________ Modified: svn:ignore ## -4,4 +4,5 ## *.user Debug Release +ReleaseLTCG ipch Modified: trunk/OpenMPT/mptrack/MPTRACK_10.sln =================================================================== --- trunk/OpenMPT/mptrack/MPTRACK_10.sln 2013-03-17 14:02:00 UTC (rev 1589) +++ trunk/OpenMPT/mptrack/MPTRACK_10.sln 2013-03-17 14:05:53 UTC (rev 1590) @@ -25,44 +25,63 @@ GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 Release|Win32 = Release|Win32 + ReleaseNoLTCG|Win32 = ReleaseNoLTCG|Win32 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {21D95071-FB97-4E69-B3B1-050D0D4A5021}.Debug|Win32.ActiveCfg = Debug|Win32 {21D95071-FB97-4E69-B3B1-050D0D4A5021}.Debug|Win32.Build.0 = Debug|Win32 - {21D95071-FB97-4E69-B3B1-050D0D4A5021}.Release|Win32.ActiveCfg = Release|Win32 - {21D95071-FB97-4E69-B3B1-050D0D4A5021}.Release|Win32.Build.0 = Release|Win32 + {21D95071-FB97-4E69-B3B1-050D0D4A5021}.Release|Win32.ActiveCfg = ReleaseLTCG|Win32 + {21D95071-FB97-4E69-B3B1-050D0D4A5021}.Release|Win32.Build.0 = ReleaseLTCG|Win32 + {21D95071-FB97-4E69-B3B1-050D0D4A5021}.ReleaseNoLTCG|Win32.ActiveCfg = Release|Win32 + {21D95071-FB97-4E69-B3B1-050D0D4A5021}.ReleaseNoLTCG|Win32.Build.0 = Release|Win32 {FAE39936-1DC7-40BB-AD3F-3B5B9E9AB0E8}.Debug|Win32.ActiveCfg = Debug|Win32 {FAE39936-1DC7-40BB-AD3F-3B5B9E9AB0E8}.Debug|Win32.Build.0 = Debug|Win32 {FAE39936-1DC7-40BB-AD3F-3B5B9E9AB0E8}.Release|Win32.ActiveCfg = Release|Win32 {FAE39936-1DC7-40BB-AD3F-3B5B9E9AB0E8}.Release|Win32.Build.0 = Release|Win32 + {FAE39936-1DC7-40BB-AD3F-3B5B9E9AB0E8}.ReleaseNoLTCG|Win32.ActiveCfg = Release|Win32 + {FAE39936-1DC7-40BB-AD3F-3B5B9E9AB0E8}.ReleaseNoLTCG|Win32.Build.0 = Release|Win32 {FF541CE2-DAA1-4F84-9883-0A0F111BAA0B}.Debug|Win32.ActiveCfg = Debug|Win32 {FF541CE2-DAA1-4F84-9883-0A0F111BAA0B}.Debug|Win32.Build.0 = Debug|Win32 {FF541CE2-DAA1-4F84-9883-0A0F111BAA0B}.Release|Win32.ActiveCfg = Release|Win32 {FF541CE2-DAA1-4F84-9883-0A0F111BAA0B}.Release|Win32.Build.0 = Release|Win32 + {FF541CE2-DAA1-4F84-9883-0A0F111BAA0B}.ReleaseNoLTCG|Win32.ActiveCfg = Release|Win32 + {FF541CE2-DAA1-4F84-9883-0A0F111BAA0B}.ReleaseNoLTCG|Win32.Build.0 = Release|Win32 {DCC2BB2F-6778-4FD3-9C00-D6CD8DC917B8}.Debug|Win32.ActiveCfg = Debug|Win32 {DCC2BB2F-6778-4FD3-9C00-D6CD8DC917B8}.Debug|Win32.Build.0 = Debug|Win32 {DCC2BB2F-6778-4FD3-9C00-D6CD8DC917B8}.Release|Win32.ActiveCfg = Release|Win32 {DCC2BB2F-6778-4FD3-9C00-D6CD8DC917B8}.Release|Win32.Build.0 = Release|Win32 + {DCC2BB2F-6778-4FD3-9C00-D6CD8DC917B8}.ReleaseNoLTCG|Win32.ActiveCfg = Release|Win32 + {DCC2BB2F-6778-4FD3-9C00-D6CD8DC917B8}.ReleaseNoLTCG|Win32.Build.0 = Release|Win32 {CF3C2CA5-5D45-4635-BBA4-C1F435E10896}.Debug|Win32.ActiveCfg = Debug|Win32 {CF3C2CA5-5D45-4635-BBA4-C1F435E10896}.Debug|Win32.Build.0 = Debug|Win32 {CF3C2CA5-5D45-4635-BBA4-C1F435E10896}.Release|Win32.ActiveCfg = Release|Win32 {CF3C2CA5-5D45-4635-BBA4-C1F435E10896}.Release|Win32.Build.0 = Release|Win32 + {CF3C2CA5-5D45-4635-BBA4-C1F435E10896}.ReleaseNoLTCG|Win32.ActiveCfg = Release|Win32 + {CF3C2CA5-5D45-4635-BBA4-C1F435E10896}.ReleaseNoLTCG|Win32.Build.0 = Release|Win32 {94CD7910-649A-4075-9F33-7EBEE614FD45}.Debug|Win32.ActiveCfg = Debug|Win32 {94CD7910-649A-4075-9F33-7EBEE614FD45}.Debug|Win32.Build.0 = Debug|Win32 {94CD7910-649A-4075-9F33-7EBEE614FD45}.Release|Win32.ActiveCfg = Release|Win32 {94CD7910-649A-4075-9F33-7EBEE614FD45}.Release|Win32.Build.0 = Release|Win32 + {94CD7910-649A-4075-9F33-7EBEE614FD45}.ReleaseNoLTCG|Win32.ActiveCfg = Release|Win32 + {94CD7910-649A-4075-9F33-7EBEE614FD45}.ReleaseNoLTCG|Win32.Build.0 = Release|Win32 {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Debug|Win32.ActiveCfg = Debug|Win32 {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Debug|Win32.Build.0 = Debug|Win32 {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Release|Win32.ActiveCfg = Release|Win32 {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Release|Win32.Build.0 = Release|Win32 + {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.ReleaseNoLTCG|Win32.ActiveCfg = Release|Win32 + {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.ReleaseNoLTCG|Win32.Build.0 = Release|Win32 {4CEFBC84-C215-11DB-8314-0800200C9A66}.Debug|Win32.ActiveCfg = Debug|Win32 {4CEFBC84-C215-11DB-8314-0800200C9A66}.Debug|Win32.Build.0 = Debug|Win32 {4CEFBC84-C215-11DB-8314-0800200C9A66}.Release|Win32.ActiveCfg = Release|Win32 {4CEFBC84-C215-11DB-8314-0800200C9A66}.Release|Win32.Build.0 = Release|Win32 + {4CEFBC84-C215-11DB-8314-0800200C9A66}.ReleaseNoLTCG|Win32.ActiveCfg = Release|Win32 + {4CEFBC84-C215-11DB-8314-0800200C9A66}.ReleaseNoLTCG|Win32.Build.0 = Release|Win32 {F23CC68D-1D58-4EB1-9425-A28F5058EB31}.Debug|Win32.ActiveCfg = Debug|Win32 {F23CC68D-1D58-4EB1-9425-A28F5058EB31}.Debug|Win32.Build.0 = Debug|Win32 {F23CC68D-1D58-4EB1-9425-A28F5058EB31}.Release|Win32.ActiveCfg = Release|Win32 {F23CC68D-1D58-4EB1-9425-A28F5058EB31}.Release|Win32.Build.0 = Release|Win32 + {F23CC68D-1D58-4EB1-9425-A28F5058EB31}.ReleaseNoLTCG|Win32.ActiveCfg = Release|Win32 + {F23CC68D-1D58-4EB1-9425-A28F5058EB31}.ReleaseNoLTCG|Win32.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE Modified: trunk/OpenMPT/mptrack/mptrack_10.vcxproj =================================================================== --- trunk/OpenMPT/mptrack/mptrack_10.vcxproj 2013-03-17 14:02:00 UTC (rev 1589) +++ trunk/OpenMPT/mptrack/mptrack_10.vcxproj 2013-03-17 14:05:53 UTC (rev 1590) @@ -5,6 +5,10 @@ <Configuration>Debug</Configuration> <Platform>Win32</Platform> </ProjectConfiguration> + <ProjectConfiguration Include="ReleaseLTCG|Win32"> + <Configuration>ReleaseLTCG</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> <ProjectConfiguration Include="Release|Win32"> <Configuration>Release</Configuration> <Platform>Win32</Platform> @@ -20,6 +24,12 @@ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> <ConfigurationType>Application</ConfigurationType> <UseOfMfc>Static</UseOfMfc> + <WholeProgramOptimization>false</WholeProgramOptimization> + <PlatformToolset>v100</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseLTCG|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <UseOfMfc>Static</UseOfMfc> <WholeProgramOptimization>true</WholeProgramOptimization> <PlatformToolset>v100</PlatformToolset> </PropertyGroup> @@ -34,6 +44,10 @@ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" /> </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseLTCG|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" /> + </ImportGroup> <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" /> @@ -45,8 +59,12 @@ <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">.\Debug\</IntDir> <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental> <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.\bin\</OutDir> + <OutDir Condition="'$(Configuration)|$(Platform)'=='ReleaseLTCG|Win32'">.\bin\</OutDir> <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)\</IntDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='ReleaseLTCG|Win32'">$(Configuration)\</IntDir> <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='ReleaseLTCG|Win32'">false</LinkIncremental> + <TargetName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(ProjectName)-noLTCG</TargetName> </PropertyGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <Midl> @@ -120,7 +138,7 @@ <StringPooling>true</StringPooling> <RuntimeLibrary>MultiThreaded</RuntimeLibrary> <BufferSecurityCheck>true</BufferSecurityCheck> - <FunctionLevelLinking>false</FunctionLevelLinking> + <FunctionLevelLinking>true</FunctionLevelLinking> <ForceConformanceInForLoopScope>true</ForceConformanceInForLoopScope> <PrecompiledHeader>Use</PrecompiledHeader> <PrecompiledHeaderFile>stdafx.h</PrecompiledHeaderFile> @@ -132,7 +150,6 @@ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> <CompileAs>Default</CompileAs> <ExceptionHandling>Async</ExceptionHandling> - <AdditionalOptions>/O2 %(AdditionalOptions)</AdditionalOptions> <IntrinsicFunctions>true</IntrinsicFunctions> <FloatingPointModel>Fast</FloatingPointModel> <MultiProcessorCompilation>true</MultiProcessorCompilation> @@ -159,11 +176,73 @@ <DataExecutionPrevention>false</DataExecutionPrevention> <IgnoreSpecificDefaultLibraries> </IgnoreSpecificDefaultLibraries> + <LinkTimeCodeGeneration>Default</LinkTimeCodeGeneration> </Link> <Manifest> <AdditionalManifestFiles>$(ProjectDir)res/rt_manif.bin;%(AdditionalManifestFiles)</AdditionalManifestFiles> </Manifest> </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseLTCG|Win32'"> + <Midl> + <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MkTypLibCompatible>true</MkTypLibCompatible> + <SuppressStartupBanner>true</SuppressStartupBanner> + <TargetEnvironment>Win32</TargetEnvironment> + <TypeLibraryName>.\Bin/mptrack.tlb</TypeLibraryName> + </Midl> + <ClCompile> + <Optimization>MaxSpeed</Optimization> + <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion> + <AdditionalIncludeDirectories>..\common;..\soundlib;..\include;..\include\vstsdk2.4\;..\include\ASIOSDK2\common\;..\xsoundlib;..\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>NDEBUG;WIN32;_WINDOWS;MODPLUG_TRACKER;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <StringPooling>true</StringPooling> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <BufferSecurityCheck>true</BufferSecurityCheck> + <FunctionLevelLinking>true</FunctionLevelLinking> + <ForceConformanceInForLoopScope>true</ForceConformanceInForLoopScope> + <PrecompiledHeader>Use</PrecompiledHeader> + <PrecompiledHeaderFile>stdafx.h</PrecompiledHeaderFile> + <PrecompiledHeaderOutputFile>.\ReleaseLTCG/mptrack.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\ReleaseLTCG/</AssemblerListingLocation> + <ObjectFileName>.\ReleaseLTCG/</ObjectFileName> + <ProgramDataBaseFileName>.\ReleaseLTCG/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + <CompileAs>Default</CompileAs> + <ExceptionHandling>Async</ExceptionHandling> + <IntrinsicFunctions>true</IntrinsicFunctions> + <FloatingPointModel>Fast</FloatingPointModel> + <MultiProcessorCompilation>true</MultiProcessorCompilation> + <WholeProgramOptimization>true</WholeProgramOptimization> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0409</Culture> + </ResourceCompile> + <Link> + <AdditionalOptions>/MACHINE:I386 %(AdditionalOptions)</AdditionalOptions> + <AdditionalDependencies>winmm.lib;strmiids.lib;dmoguids.lib;version.lib;Rpcrt4.lib;delayimp.lib;wininet.lib;%(AdditionalDependencies)</AdditionalDependencies> + <OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile> + <Version>5.0</Version> + <SuppressStartupBanner>true</SuppressStartupBanner> + <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <DelayLoadDLLs>OpenMPT_SoundTouch_i16.dll;%(DelayLoadDLLs)</DelayLoadDLLs> + <GenerateDebugInformation>true</GenerateDebugInformation> + <GenerateMapFile>false</GenerateMapFile> + <MapFileName>.\ReleaseLTCG/mptrack.map</MapFileName> + <SubSystem>Windows</SubSystem> + <OptimizeReferences>true</OptimizeReferences> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <RandomizedBaseAddress>true</RandomizedBaseAddress> + <DataExecutionPrevention>false</DataExecutionPrevention> + <IgnoreSpecificDefaultLibraries> + </IgnoreSpecificDefaultLibraries> + <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration> + </Link> + <Manifest> + <AdditionalManifestFiles>$(ProjectDir)res/rt_manif.bin;%(AdditionalManifestFiles)</AdditionalManifestFiles> + </Manifest> + </ItemDefinitionGroup> <ItemGroup> <ClCompile Include="..\common\AudioCriticalSection.cpp" /> <ClCompile Include="..\common\misc_util.cpp" /> @@ -251,9 +330,7 @@ <ClCompile Include="..\soundlib\snd_eq.cpp" /> <ClCompile Include="..\soundlib\snd_flt.cpp" /> <ClCompile Include="..\soundlib\Snd_fx.cpp" /> - <ClCompile Include="..\Soundlib\Snd_rvb.cpp"> - <AssemblerOutput Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AssemblyAndSourceCode</AssemblerOutput> - </ClCompile> + <ClCompile Include="..\Soundlib\Snd_rvb.cpp" /> <ClCompile Include="..\Soundlib\snddev.cpp" /> <ClCompile Include="..\soundlib\Sndfile.cpp" /> <ClCompile Include="..\soundlib\Sndmix.cpp" /> @@ -261,7 +338,9 @@ <ClCompile Include="..\common\stdafx.cpp"> <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader> <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader> + <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='ReleaseLTCG|Win32'">Create</PrecompiledHeader> <MultiProcessorCompilation Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</MultiProcessorCompilation> + <MultiProcessorCompilation Condition="'$(Configuration)|$(Platform)'=='ReleaseLTCG|Win32'">false</MultiProcessorCompilation> </ClCompile> <ClCompile Include="..\soundlib\Tables.cpp" /> <ClCompile Include="tagging.cpp" /> Modified: trunk/OpenMPT/soundtouch/soundtouch_10.vcxproj =================================================================== --- trunk/OpenMPT/soundtouch/soundtouch_10.vcxproj 2013-03-17 14:02:00 UTC (rev 1589) +++ trunk/OpenMPT/soundtouch/soundtouch_10.vcxproj 2013-03-17 14:05:53 UTC (rev 1590) @@ -20,6 +20,7 @@ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> <ConfigurationType>DynamicLibrary</ConfigurationType> <CharacterSet>NotSet</CharacterSet> + <WholeProgramOptimization>false</WholeProgramOptimization> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> <ConfigurationType>DynamicLibrary</ConfigurationType> @@ -85,6 +86,8 @@ <WarningLevel>Level3</WarningLevel> <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> <MultiProcessorCompilation>true</MultiProcessorCompilation> + <WholeProgramOptimization>false</WholeProgramOptimization> + <FunctionLevelLinking>true</FunctionLevelLinking> </ClCompile> <Link> <OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile> @@ -100,6 +103,7 @@ </DataExecutionPrevention> <ImportLibrary>$(OutDir)soundtouch.lib</ImportLibrary> <TargetMachine>MachineX86</TargetMachine> + <LinkTimeCodeGeneration>Default</LinkTimeCodeGeneration> </Link> </ItemDefinitionGroup> <ItemGroup> Modified: trunk/OpenMPT/ungzip/ungzip_10.vcxproj =================================================================== --- trunk/OpenMPT/ungzip/ungzip_10.vcxproj 2013-03-17 14:02:00 UTC (rev 1589) +++ trunk/OpenMPT/ungzip/ungzip_10.vcxproj 2013-03-17 14:05:53 UTC (rev 1590) @@ -19,7 +19,7 @@ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> <ConfigurationType>StaticLibrary</ConfigurationType> <CharacterSet>MultiByte</CharacterSet> - <WholeProgramOptimization>true</WholeProgramOptimization> + <WholeProgramOptimization>false</WholeProgramOptimization> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> <ConfigurationType>StaticLibrary</ConfigurationType> @@ -68,6 +68,7 @@ <OmitDefaultLibName>true</OmitDefaultLibName> <MultiProcessorCompilation>true</MultiProcessorCompilation> <AdditionalIncludeDirectories>../include/</AdditionalIncludeDirectories> + <WholeProgramOptimization>false</WholeProgramOptimization> </ClCompile> </ItemDefinitionGroup> <ItemGroup> Modified: trunk/OpenMPT/unlha/unlha_10.vcxproj =================================================================== --- trunk/OpenMPT/unlha/unlha_10.vcxproj 2013-03-17 14:02:00 UTC (rev 1589) +++ trunk/OpenMPT/unlha/unlha_10.vcxproj 2013-03-17 14:05:53 UTC (rev 1590) @@ -19,6 +19,7 @@ <ConfigurationType>StaticLibrary</ConfigurationType> <UseOfMfc>false</UseOfMfc> <CharacterSet>MultiByte</CharacterSet> + <WholeProgramOptimization>false</WholeProgramOptimization> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> <ConfigurationType>StaticLibrary</ConfigurationType> @@ -85,6 +86,7 @@ <ProgramDataBaseFileName>.\Release/</ProgramDataBaseFileName> <WarningLevel>Level3</WarningLevel> <MultiProcessorCompilation>true</MultiProcessorCompilation> + <WholeProgramOptimization>false</WholeProgramOptimization> </ClCompile> <ResourceCompile> <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> Modified: trunk/OpenMPT/unrar/unrar_10.vcxproj =================================================================== --- trunk/OpenMPT/unrar/unrar_10.vcxproj 2013-03-17 14:02:00 UTC (rev 1589) +++ trunk/OpenMPT/unrar/unrar_10.vcxproj 2013-03-17 14:05:53 UTC (rev 1590) @@ -18,6 +18,7 @@ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> <ConfigurationType>StaticLibrary</ConfigurationType> <UseOfMfc>false</UseOfMfc> + <WholeProgramOptimization>false</WholeProgramOptimization> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> <ConfigurationType>StaticLibrary</ConfigurationType> @@ -81,6 +82,7 @@ <ProgramDataBaseFileName>.\Release/</ProgramDataBaseFileName> <WarningLevel>Level3</WarningLevel> <MultiProcessorCompilation>true</MultiProcessorCompilation> + <WholeProgramOptimization>false</WholeProgramOptimization> </ClCompile> <ResourceCompile> <Culture>0x0409</Culture> Modified: trunk/OpenMPT/unzip/unzip_10.vcxproj =================================================================== --- trunk/OpenMPT/unzip/unzip_10.vcxproj 2013-03-17 14:02:00 UTC (rev 1589) +++ trunk/OpenMPT/unzip/unzip_10.vcxproj 2013-03-17 14:05:53 UTC (rev 1590) @@ -25,7 +25,7 @@ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> <ConfigurationType>StaticLibrary</ConfigurationType> <CharacterSet>MultiByte</CharacterSet> - <WholeProgramOptimization>true</WholeProgramOptimization> + <WholeProgramOptimization>false</WholeProgramOptimization> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> <ConfigurationType>StaticLibrary</ConfigurationType> @@ -74,6 +74,7 @@ <OmitDefaultLibName>true</OmitDefaultLibName> <MultiProcessorCompilation>true</MultiProcessorCompilation> <AdditionalIncludeDirectories>../include/zlib/</AdditionalIncludeDirectories> + <WholeProgramOptimization>false</WholeProgramOptimization> </ClCompile> </ItemDefinitionGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> Modified: trunk/OpenMPT/xsoundlib/xsoundlib_10.vcxproj =================================================================== --- trunk/OpenMPT/xsoundlib/xsoundlib_10.vcxproj 2013-03-17 14:02:00 UTC (rev 1589) +++ trunk/OpenMPT/xsoundlib/xsoundlib_10.vcxproj 2013-03-17 14:05:53 UTC (rev 1590) @@ -19,6 +19,7 @@ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> <ConfigurationType>StaticLibrary</ConfigurationType> <CharacterSet>MultiByte</CharacterSet> + <WholeProgramOptimization>false</WholeProgramOptimization> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> <ConfigurationType>StaticLibrary</ConfigurationType> @@ -69,6 +70,8 @@ <WarningLevel>Level3</WarningLevel> <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> <MultiProcessorCompilation>true</MultiProcessorCompilation> + <WholeProgramOptimization>false</WholeProgramOptimization> + <FunctionLevelLinking>true</FunctionLevelLinking> </ClCompile> <Lib> <OutputFile>$(OutDir)xsoundlib.lib</OutputFile> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2013-03-17 14:35:13
|
Revision: 1592 http://sourceforge.net/p/modplug/code/1592 Author: saga-games Date: 2013-03-17 14:35:03 +0000 (Sun, 17 Mar 2013) Log Message: ----------- [New] Chord Editor: Added a possibility to make chords relative to a note entered in the pattern (http://bugs.openmpt.org/view.php?id=360) [Mod] OpenMPT: Version is now 1.21.01.22 Modified Paths: -------------- trunk/OpenMPT/common/version.h trunk/OpenMPT/mptrack/MainFrm.cpp trunk/OpenMPT/mptrack/Mainbar.cpp trunk/OpenMPT/mptrack/Mainbar.h trunk/OpenMPT/mptrack/Mainfrm.h trunk/OpenMPT/mptrack/PatternEditorDialogs.cpp trunk/OpenMPT/mptrack/TrackerSettings.h trunk/OpenMPT/mptrack/View_pat.cpp trunk/OpenMPT/mptrack/View_pat.h Modified: trunk/OpenMPT/common/version.h =================================================================== --- trunk/OpenMPT/common/version.h 2013-03-17 14:06:32 UTC (rev 1591) +++ trunk/OpenMPT/common/version.h 2013-03-17 14:35:03 UTC (rev 1592) @@ -19,7 +19,7 @@ #define VER_MAJORMAJOR 1 #define VER_MAJOR 21 #define VER_MINOR 01 -#define VER_MINORMINOR 21 +#define VER_MINORMINOR 22 //Creates version number from version parts that appears in version string. //For example MAKE_VERSION_NUMERIC(1,17,02,28) gives version number of Modified: trunk/OpenMPT/mptrack/MainFrm.cpp =================================================================== --- trunk/OpenMPT/mptrack/MainFrm.cpp 2013-03-17 14:06:32 UTC (rev 1591) +++ trunk/OpenMPT/mptrack/MainFrm.cpp 2013-03-17 14:35:03 UTC (rev 1592) @@ -1274,8 +1274,8 @@ ///////////////////////////////////////////////////////////////////////////// // CMainFrame operations -UINT CMainFrame::GetBaseOctave() -//------------------------------ +UINT CMainFrame::GetBaseOctave() const +//------------------------------------ { return m_wndToolBar.GetBaseOctave(); } Modified: trunk/OpenMPT/mptrack/Mainbar.cpp =================================================================== --- trunk/OpenMPT/mptrack/Mainbar.cpp 2013-03-17 14:06:32 UTC (rev 1591) +++ trunk/OpenMPT/mptrack/Mainbar.cpp 2013-03-17 14:35:03 UTC (rev 1592) @@ -393,8 +393,8 @@ } -UINT CMainToolBar::GetBaseOctave() -//-------------------------------- +UINT CMainToolBar::GetBaseOctave() const +//-------------------------------------- { if (nCurrentOctave >= MIN_BASEOCTAVE) return (UINT)nCurrentOctave; return 4; Modified: trunk/OpenMPT/mptrack/Mainbar.h =================================================================== --- trunk/OpenMPT/mptrack/Mainbar.h 2013-03-17 14:06:32 UTC (rev 1591) +++ trunk/OpenMPT/mptrack/Mainbar.h 2013-03-17 14:35:03 UTC (rev 1592) @@ -68,7 +68,7 @@ public: BOOL Create(CWnd *parent); void Init(CMainFrame *); - UINT GetBaseOctave(); + UINT GetBaseOctave() const; BOOL SetBaseOctave(UINT nOctave); BOOL SetCurrentSong(CSoundFile *pModDoc); Modified: trunk/OpenMPT/mptrack/Mainfrm.h =================================================================== --- trunk/OpenMPT/mptrack/Mainfrm.h 2013-03-17 14:06:32 UTC (rev 1591) +++ trunk/OpenMPT/mptrack/Mainfrm.h 2013-03-17 14:35:03 UTC (rev 1592) @@ -420,11 +420,12 @@ void SetInfoText(LPCSTR lpszText); void SetXInfoText(LPCSTR lpszText); //rewbs.xinfo void SetHelpText(LPCSTR lpszText); - UINT GetBaseOctave(); + UINT GetBaseOctave() const; CModDoc *GetActiveDoc(); CView *GetActiveView(); //rewbs.customKeys CImageList *GetImageList() { return &m_ImageList; } MPTChords &GetChords() { return TrackerSettings::Instance().Chords; } + const MPTChords &GetChords() const { return TrackerSettings::Instance().Chords; } void OnDocumentCreated(CModDoc *pModDoc); void OnDocumentClosed(CModDoc *pModDoc); void UpdateTree(CModDoc *pModDoc, DWORD lHint=0, CObject *pHint=NULL); Modified: trunk/OpenMPT/mptrack/PatternEditorDialogs.cpp =================================================================== --- trunk/OpenMPT/mptrack/PatternEditorDialogs.cpp 2013-03-17 14:06:32 UTC (rev 1591) +++ trunk/OpenMPT/mptrack/PatternEditorDialogs.cpp 2013-03-17 14:35:03 UTC (rev 1592) @@ -1303,11 +1303,12 @@ pMainFrm = CMainFrame::GetMainFrame(); if (!pMainFrm) return TRUE; // Fills the shortcut key combo box - AppendNotesToControl(m_CbnShortcut, 0, 3*12-1); + AppendNotesToControl(m_CbnShortcut, 0, 3 * 12 - 1); m_CbnShortcut.SetCurSel(0); // Base Note combo box - AppendNotesToControl(m_CbnBaseNote, 0, 3*12-1); + m_CbnBaseNote.SetItemData(m_CbnBaseNote.AddString("Relative"), MPTChord::relativeMode); + AppendNotesToControl(m_CbnBaseNote, 0, 3 * 12 - 1); // Minor notes for (int inotes=-1; inotes<24; inotes++) @@ -1371,7 +1372,10 @@ chord = m_CbnShortcut.GetCurSel(); if (chord >= 0) chord = m_CbnShortcut.GetItemData(chord); if ((chord < 0) || (chord >= CountOf(chords))) chord = 0; - m_CbnBaseNote.SetCurSel(chords[chord].key); + if(chords[chord].key != MPTChord::relativeMode) + m_CbnBaseNote.SetCurSel(chords[chord].key + 1); + else + m_CbnBaseNote.SetCurSel(0); m_CbnNote1.SetCurSel(chords[chord].notes[0]); m_CbnNote2.SetCurSel(chords[chord].notes[1]); m_CbnNote3.SetCurSel(chords[chord].notes[2]); @@ -1393,8 +1397,13 @@ if ((chord < 0) || (chord >= CountOf(chords))) chord = 0; note = chords[chord].key % 12; octave = chords[chord].key / 12; - for (UINT i=0; i<2*12; i++) + if(chords[chord].key == MPTChord::relativeMode) { + note = -1; + octave = 0; + } + for(UINT i=0; i<2*12; i++) + { BOOL b = FALSE; if (i == note) b = TRUE; @@ -1417,12 +1426,9 @@ int chord = m_CbnShortcut.GetCurSel(); if (chord >= 0) chord = m_CbnShortcut.GetItemData(chord); if ((chord < 0) || (chord >= CountOf(chords))) chord = 0; - int basenote = m_CbnBaseNote.GetCurSel(); - if (basenote >= 0) - { - chords[chord].key = (uint8)basenote; - UpdateKeyboard(); - } + int basenote = m_CbnBaseNote.GetItemData(m_CbnBaseNote.GetCurSel()); + chords[chord].key = (uint8)basenote; + UpdateKeyboard(); } Modified: trunk/OpenMPT/mptrack/TrackerSettings.h =================================================================== --- trunk/OpenMPT/mptrack/TrackerSettings.h 2013-03-17 14:06:32 UTC (rev 1591) +++ trunk/OpenMPT/mptrack/TrackerSettings.h 2013-03-17 14:35:03 UTC (rev 1592) @@ -126,8 +126,13 @@ // Chords struct MPTChord { - uint8 key; - uint8 notes[3]; + enum + { + relativeMode = 0x3F, + }; + + uint8 key; // Base note + uint8 notes[3]; // Additional chord notes }; typedef MPTChord MPTChords[3 * 12]; // 3 octaves Modified: trunk/OpenMPT/mptrack/View_pat.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_pat.cpp 2013-03-17 14:06:32 UTC (rev 1591) +++ trunk/OpenMPT/mptrack/View_pat.cpp 2013-03-17 14:35:03 UTC (rev 1592) @@ -186,7 +186,7 @@ m_nFoundInstrument = 0; m_nLastPlayedRow = 0; m_nLastPlayedOrder = 0; - prevChordNote = 0; + prevChordNote = NOTE_NONE; } @@ -4723,11 +4723,16 @@ m_Status.reset(psChordPlaying); ModCommand::NOTE notes[4]; - int numNotes = ConstructChord(note, notes); + int numNotes = ConstructChord(note, notes, prevChordBaseNote); + if(!numNotes) + { + return; + } for(int i = 0; i < numNotes; i++) { pModDoc->NoteOff(notes[i], true, ins, GetCurrentChannel(), playWholeRow ? chordPlayChannels[i] : CHANNELINDEX_INVALID); } + prevChordNote = NOTE_NONE; } else { pModDoc->NoteOff(note, ((TrackerSettings::Instance().m_dwPatternSetup & PATTERN_NOTEFADE) || pSndFile->GetNumInstruments() == 0), ins, nChnCursor, playWholeRow ? nChn : CHANNELINDEX_INVALID); @@ -5216,34 +5221,51 @@ // Construct a chord from the chord presets. Returns number of notes in chord. -int CViewPattern::ConstructChord(int note, ModCommand::NOTE (&outNotes)[4]) -//------------------------------------------------------------------------- +int CViewPattern::ConstructChord(int note, ModCommand::NOTE (&outNotes)[4], ModCommand::NOTE baseNote) +//---------------------------------------------------------------------------------------------------- { - CMainFrame *pMainFrm = CMainFrame::GetMainFrame(); - MPTChords &chords = pMainFrm->GetChords(); + const CMainFrame *pMainFrm = CMainFrame::GetMainFrame(); + const MPTChords &chords = pMainFrm->GetChords(); UINT baseOctave = pMainFrm->GetBaseOctave(); - UINT chordNum = note - baseOctave * 12 - 1; + UINT chordNum = note - baseOctave * 12 - NOTE_MIN; if(chordNum >= CountOf(chords)) { return 0; } - MPTChord &chord = chords[chordNum]; + const MPTChord &chord = chords[chordNum]; - ModCommand::NOTE baseNote = static_cast<ModCommand::NOTE>(chord.key + baseOctave * 12 + 1); - if(!ModCommand::IsNote(baseNote)) + const bool relativeMode = (chord.key == MPTChord::relativeMode); // Notes are relative to a previously entered note in the pattern + ModCommand::NOTE key; + if(relativeMode) { + // Relative mode: Use pattern note as base note. + // If there is no valid note in the pattern: Use shortcut note as relative base note + key = ModCommand::IsNote(baseNote) ? baseNote : static_cast<ModCommand::NOTE>(note); + } else + { + // Default mode: Use base key + key = static_cast<ModCommand::NOTE>(chord.key + baseOctave * 12 + NOTE_MIN); + } + if(!ModCommand::IsNote(key)) + { return 0; } int numNotes = 1; - outNotes[0] = baseNote; + outNotes[0] = key; for(size_t i = 0; i < CountOf(chord.notes); i++) { if(chord.notes[i]) { - ModCommand::NOTE note = static_cast<ModCommand::NOTE>(((baseNote - 1) / 12) * 12 + chord.notes[i]); + ModCommand::NOTE note = key - NOTE_MIN; + if(!relativeMode) + { + // Only use octave information from the base key + note = (note / 12) * 12; + } + note += chord.notes[i]; if(ModCommand::IsNote(note)) { outNotes[numNotes++] = note; @@ -5266,15 +5288,16 @@ } CSoundFile &sndFile = pModDoc->GetrSoundFile(); - ModCommand::NOTE chordNotes[4]; - int numNotes = ConstructChord(note, chordNotes); + const CHANNELINDEX chn = GetCurrentChannel(); + const PatternRow rowBase = sndFile.Patterns[m_nPattern].GetRow(GetCurrentRow()); + + ModCommand::NOTE chordNotes[4], baseNote = rowBase[chn].note; + int numNotes = ConstructChord(note, chordNotes, baseNote); if(!numNotes) { return; } - const CHANNELINDEX chn = GetCurrentChannel(); - const PatternRow rowBase = sndFile.Patterns[m_nPattern].GetRow(GetCurrentRow()); // Save old row contents std::vector<ModCommand> newRow(rowBase, rowBase + sndFile.GetNumChannels()); @@ -5342,11 +5365,13 @@ // -- play note if((TrackerSettings::Instance().m_dwPatternSetup & (PATTERN_PLAYNEWNOTE | PATTERN_PLAYEDITROW)) || !recordEnabled) { - if(prevChordNote) + if(prevChordNote != NOTE_NONE) { TempStopChord(prevChordNote); - prevChordNote = note; } + prevChordNote = note; + prevChordBaseNote = baseNote; + const bool playWholeRow = ((TrackerSettings::Instance().m_dwPatternSetup & PATTERN_PLAYEDITROW) && !liveRecord); if(playWholeRow) { Modified: trunk/OpenMPT/mptrack/View_pat.h =================================================================== --- trunk/OpenMPT/mptrack/View_pat.h 2013-03-17 14:06:32 UTC (rev 1591) +++ trunk/OpenMPT/mptrack/View_pat.h 2013-03-17 14:35:03 UTC (rev 1592) @@ -195,10 +195,12 @@ WORD ChnVUMeters[MAX_BASECHANNELS]; WORD OldVUMeters[MAX_BASECHANNELS]; + // Chord preview + CHANNELINDEX chordPlayChannels[4]; + ModCommand::NOTE prevChordNote, prevChordBaseNote; + BYTE activeNoteChannel[NOTE_MAX + 1]; BYTE splitActiveNoteChannel[NOTE_MAX + 1]; - CHANNELINDEX chordPlayChannels[4]; - ModCommand::NOTE prevChordNote; public: CEffectVis *m_pEffectVis; //rewbs.fxVis @@ -310,7 +312,7 @@ void EnterAftertouch(int note, int atValue); // Construct a chord from the chord presets. Returns number of notes in chord. - int ConstructChord(int note, ModCommand::NOTE (&outNotes)[4]); + static int ConstructChord(int note, ModCommand::NOTE (&outNotes)[4], ModCommand::NOTE baseNote); void QuantizeRow(PATTERNINDEX &pat, ROWINDEX &row) const; PATTERNINDEX GetNextPattern() const; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2013-03-17 16:06:03
|
Revision: 1593 http://sourceforge.net/p/modplug/code/1593 Author: saga-games Date: 2013-03-17 16:05:52 +0000 (Sun, 17 Mar 2013) Log Message: ----------- [Ref] Small changes here and there. Modified Paths: -------------- trunk/OpenMPT/mptrack/mptrack.rc trunk/OpenMPT/soundlib/ITTools.cpp trunk/OpenMPT/soundlib/ITTools.h trunk/OpenMPT/soundlib/Load_it.cpp trunk/OpenMPT/soundlib/ModChannel.h trunk/OpenMPT/soundlib/ModInstrument.cpp trunk/OpenMPT/soundlib/ModInstrument.h trunk/OpenMPT/soundlib/RowVisitor.cpp trunk/OpenMPT/soundlib/SampleFormats.cpp trunk/OpenMPT/soundlib/Snd_defs.h trunk/OpenMPT/soundlib/Snd_fx.cpp trunk/OpenMPT/soundlib/WAVTools.cpp trunk/OpenMPT/soundlib/WAVTools.h trunk/OpenMPT/soundlib/XMTools.cpp Modified: trunk/OpenMPT/mptrack/mptrack.rc =================================================================== --- trunk/OpenMPT/mptrack/mptrack.rc 2013-03-17 14:35:03 UTC (rev 1592) +++ trunk/OpenMPT/mptrack/mptrack.rc 2013-03-17 16:05:52 UTC (rev 1593) @@ -1333,25 +1333,25 @@ PUSHBUTTON "Macro Help",IDC_BUTTON3,300,84,50,14 END -IDD_CHORDEDIT DIALOGEX 0, 0, 245, 148 -STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +IDD_CHORDEDIT DIALOGEX 0, 0, 245, 156 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Chord Editor" FONT 8, "MS Shell Dlg", 0, 0, 0x1 BEGIN DEFPUSHBUTTON "Close",IDOK,191,10,50,14 CONTROL "",IDC_KEYBOARD1,"Static",SS_WHITERECT | SS_NOTIFY,4,76,237,56,WS_EX_CLIENTEDGE - GROUPBOX "",IDC_STATIC,4,4,183,67 - COMBOBOX IDC_COMBO1,10,24,83,114,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - LTEXT "Shortcut Key:",IDC_STATIC,10,14,57,8 - LTEXT "Base Key:",IDC_STATIC,104,14,40,8 - COMBOBOX IDC_COMBO2,104,24,48,89,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - COMBOBOX IDC_COMBO3,10,52,48,80,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - LTEXT "Note #1",IDC_STATIC,10,42,39,8 - COMBOBOX IDC_COMBO4,67,52,48,80,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - LTEXT "Note #2",IDC_STATIC,67,42,39,8 - COMBOBOX IDC_COMBO5,123,52,48,80,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - LTEXT "Note #3",IDC_STATIC,123,42,39,8 - LTEXT "Note: you need to enable multichannel-record in order to enter chords.",IDC_STATIC,4,136,237,10 + GROUPBOX "",IDC_STATIC,4,4,185,67 + COMBOBOX IDC_COMBO1,12,24,52,114,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + LTEXT "Shortcut Key:",IDC_STATIC,12,12,57,8 + LTEXT "Base Key:",IDC_STATIC,72,12,40,8 + COMBOBOX IDC_COMBO2,72,24,52,89,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + COMBOBOX IDC_COMBO3,12,54,52,80,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + LTEXT "Note #1",IDC_STATIC,12,42,39,8 + COMBOBOX IDC_COMBO4,72,54,52,80,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + LTEXT "Note #2",IDC_STATIC,72,42,39,8 + COMBOBOX IDC_COMBO5,132,54,52,80,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + LTEXT "Note #3",IDC_STATIC,132,42,39,8 + LTEXT "In ""Relative"" base note mode, all notes are relative to a previously entered note in the pattern cell where the chord is entered.",IDC_STATIC,6,136,234,20 END IDD_LAYER3CONVERT DIALOGEX 0, 0, 280, 202 @@ -1796,7 +1796,7 @@ LEFTMARGIN, 4 RIGHTMARGIN, 241 TOPMARGIN, 4 - BOTTOMMARGIN, 146 + BOTTOMMARGIN, 154 END IDD_LAYER3CONVERT, DIALOG Modified: trunk/OpenMPT/soundlib/ITTools.cpp =================================================================== --- trunk/OpenMPT/soundlib/ITTools.cpp 2013-03-17 14:35:03 UTC (rev 1592) +++ trunk/OpenMPT/soundlib/ITTools.cpp 2013-03-17 16:05:52 UTC (rev 1593) @@ -72,8 +72,8 @@ // Convert IT/MPTM envelope data into OpenMPT's internal envelope format - To be used by ITInstrToMPT() -void ITEnvelope::ConvertToMPT(InstrumentEnvelope &mptEnv, BYTE envOffset, int maxNodes) const -//------------------------------------------------------------------------------------------- +void ITEnvelope::ConvertToMPT(InstrumentEnvelope &mptEnv, uint8 envOffset, int maxNodes) const +//-------------------------------------------------------------------------------------------- { // Envelope Flags mptEnv.dwFlags.set(ENV_ENABLED, (flags & ITEnvelope::envEnabled) != 0); @@ -149,7 +149,7 @@ // Sample Map for(size_t i = 0; i < 120; i++) { - BYTE note = keyboard[i * 2]; + uint8 note = keyboard[i * 2]; SAMPLEINDEX ins = keyboard[i * 2 + 1]; if(ins < MAX_SAMPLES) { @@ -160,7 +160,7 @@ mptIns.NoteMap[i] = note + 1u; } else { - mptIns.NoteMap[i] = static_cast<BYTE>(i + 1); + mptIns.NoteMap[i] = static_cast<uint8>(i + 1); } } @@ -354,7 +354,7 @@ // Sample Map for(size_t i = 0; i < 120; i++) { - BYTE note = keyboard[i * 2]; + uint8 note = keyboard[i * 2]; SAMPLEINDEX ins = keyboard[i * 2 + 1]; if(ins < MAX_SAMPLES) { @@ -365,7 +365,7 @@ mptIns.NoteMap[i] = note + 1u; } else { - mptIns.NoteMap[i] = static_cast<BYTE>(i + 1); + mptIns.NoteMap[i] = static_cast<uint8>(i + 1); } } @@ -479,9 +479,9 @@ //StringFixer::WriteString<StringFixer::nullTerminated>(name, m_szNames[nsmp]); // Volume / Panning - gvl = static_cast<BYTE>(mptSmp.nGlobalVol); - vol = static_cast<BYTE>(mptSmp.nVolume / 4); - dfp = static_cast<BYTE>(mptSmp.nPan / 4); + gvl = static_cast<uint8>(mptSmp.nGlobalVol); + vol = static_cast<uint8>(mptSmp.nVolume / 4); + dfp = static_cast<uint8>(mptSmp.nPan / 4); if(mptSmp.uFlags & CHN_PANNING) dfp |= ITSample::enablePanning; // Sample Format / Loop Flags @@ -508,7 +508,7 @@ flags |= ITSample::sampleCompressed; if(compressIT215) { - cvt |= ITSample::cvtIT215Compression; + cvt |= ITSample::cvtDelta; } } } else @@ -555,11 +555,11 @@ // Volume / Panning mptSmp.nVolume = vol * 4; - LimitMax(mptSmp.nVolume, WORD(256)); + LimitMax(mptSmp.nVolume, uint16(256)); mptSmp.nGlobalVol = gvl; - LimitMax(mptSmp.nGlobalVol, WORD(64)); + LimitMax(mptSmp.nGlobalVol, uint16(64)); mptSmp.nPan = (dfp & 0x7F) * 4; - LimitMax(mptSmp.nPan, WORD(256)); + LimitMax(mptSmp.nPan, uint16(256)); if(dfp & ITSample::enablePanning) mptSmp.uFlags |= CHN_PANNING; // Loop Flags @@ -611,7 +611,7 @@ if(flags & ITSample::sampleCompressed) { // IT 2.14 packed sample - sampleIO |= (cvt & ITSample::cvtIT215Compression) ? SampleIO::IT215 : SampleIO::IT214; + sampleIO |= (cvt & ITSample::cvtDelta) ? SampleIO::IT215 : SampleIO::IT214; } else { // MODPlugin :( Modified: trunk/OpenMPT/soundlib/ITTools.h =================================================================== --- trunk/OpenMPT/soundlib/ITTools.h 2013-03-17 14:35:03 UTC (rev 1592) +++ trunk/OpenMPT/soundlib/ITTools.h 2013-03-17 16:05:52 UTC (rev 1593) @@ -103,9 +103,9 @@ uint8 reserved; // Reserved // Convert OpenMPT's internal envelope format to an IT/MPTM envelope. - void ConvertToIT(const InstrumentEnvelope &mptEnv, BYTE envOffset, BYTE envDefault); + void ConvertToIT(const InstrumentEnvelope &mptEnv, uint8 envOffset, uint8 envDefault); // Convert IT/MPTM envelope data into OpenMPT's internal envelope format - To be used by ITInstrToMPT() - void ConvertToMPT(InstrumentEnvelope &mptEnv, BYTE envOffset, int maxNodes) const; + void ConvertToMPT(InstrumentEnvelope &mptEnv, uint8 envOffset, int maxNodes) const; }; STATIC_ASSERT(sizeof(ITEnvelope) == 82); @@ -258,7 +258,6 @@ enablePanning = 0x80, cvtSignedSample = 0x01, - cvtIT215Compression = 0x04, cvtADPCMSample = 0xFF, // MODPlugin :( // ITTECH.TXT says these convert flags are "safe to ignore". IT doesn't ignore them, though, so why should we? :) Modified: trunk/OpenMPT/soundlib/Load_it.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_it.cpp 2013-03-17 14:35:03 UTC (rev 1592) +++ trunk/OpenMPT/soundlib/Load_it.cpp 2013-03-17 16:05:52 UTC (rev 1593) @@ -57,11 +57,11 @@ return false; } -void ReadTuningCollection(istream& iStrm, CTuningCollection& tc, const size_t) {tc.Deserialize(iStrm);} -void WriteTuningCollection(ostream& oStrm, const CTuningCollection& tc) {tc.Serialize(oStrm);} +static void ReadTuningCollection(istream& iStrm, CTuningCollection& tc, const size_t) {tc.Deserialize(iStrm);} +static void WriteTuningCollection(ostream& oStrm, const CTuningCollection& tc) {tc.Serialize(oStrm);} -void WriteTuningMap(ostream& oStrm, const CSoundFile& sf) -//------------------------------------------------------- +static void WriteTuningMap(ostream& oStrm, const CSoundFile& sf) +//-------------------------------------------------------------- { if(sf.GetNumInstruments() > 0) { @@ -120,6 +120,7 @@ } } + template<class TUNNUMTYPE, class STRSIZETYPE> static bool ReadTuningMap(istream& iStrm, map<uint16, string>& shortToTNameMap, const size_t maxNum = 500) //-------------------------------------------------------------------------------------------------------- @@ -147,8 +148,9 @@ return true; } -void ReadTuningMap(istream& iStrm, CSoundFile& csf, const size_t = 0) -//------------------------------------------------------------------- + +static void ReadTuningMap(istream& iStrm, CSoundFile& csf, const size_t = 0) +//-------------------------------------------------------------------------- { typedef map<WORD, string> MAP; typedef MAP::iterator MAP_ITER; @@ -225,8 +227,8 @@ // Impulse Tracker IT file support -uint8 ConvertVolParam(const ModCommand *m) -//---------------------------------------- +static uint8 ConvertVolParam(const ModCommand *m) +//----------------------------------------------- { return min(m->vol, 9); } @@ -266,8 +268,8 @@ } -void CopyPatternName(CPattern &pattern, FileReader &file) -//------------------------------------------------------- +static void CopyPatternName(CPattern &pattern, FileReader &file) +//-------------------------------------------------------------- { char name[MAX_PATTERNNAME] = ""; file.ReadString<StringFixer::maybeNullTerminated>(name, MAX_PATTERNNAME); @@ -410,7 +412,7 @@ // Reading Channels Pan Positions for(CHANNELINDEX i = 0; i < 64; i++) if(fileHeader.chnpan[i] != 0xFF) { - ChnSettings[i].nVolume = fileHeader.chnvol[i]; + ChnSettings[i].nVolume = Clamp(fileHeader.chnvol[i], uint8(0), uint8(64)); ChnSettings[i].nPan = 128; ChnSettings[i].dwFlags.reset(); if(fileHeader.chnpan[i] & 0x80) ChnSettings[i].dwFlags.set(CHN_MUTE); @@ -977,7 +979,7 @@ return bytes_written; // Write number of history entries - fnum = LittleEndianW(fnum); + SwapBytesLE(fnum); fwrite(&fnum, 2, 1, f); #ifdef MODPLUG_TRACKER @@ -1042,8 +1044,8 @@ itHeader.id = ITFileHeader::itMagic; StringFixer::WriteString<StringFixer::nullTerminated>(itHeader.songname, m_szNames[0]); - itHeader.highlight_minor = (BYTE)min(m_nDefaultRowsPerBeat, 0xFF); - itHeader.highlight_major = (BYTE)min(m_nDefaultRowsPerMeasure, 0xFF); + itHeader.highlight_minor = (uint8)Util::Min(m_nDefaultRowsPerBeat, ROWINDEX(uint8_max)); + itHeader.highlight_major = (uint8)Util::Min(m_nDefaultRowsPerMeasure, ROWINDEX(uint8_max)); if(GetType() == MOD_TYPE_MPT) { @@ -1056,13 +1058,13 @@ { // An additional "---" pattern is appended so Impulse Tracker won't ignore the last order item. // Interestingly, this can exceed IT's 256 order limit. Also, IT will always save at least two orders. - itHeader.ordnum = min(Order.GetLengthTailTrimmed(), specs.ordersMax) + 1; + itHeader.ordnum = Util::Min(Order.GetLengthTailTrimmed(), specs.ordersMax) + 1; if(itHeader.ordnum < 2) itHeader.ordnum = 2; } - itHeader.insnum = min(m_nInstruments, specs.instrumentsMax); - itHeader.smpnum = min(m_nSamples, specs.samplesMax); - itHeader.patnum = min(Patterns.GetNumPatterns(), specs.patternsMax); + itHeader.insnum = Util::Min(m_nInstruments, specs.instrumentsMax); + itHeader.smpnum = Util::Min(m_nSamples, specs.samplesMax); + itHeader.patnum = Util::Min(Patterns.GetNumPatterns(), specs.patternsMax); // Parapointers vector<uint32> patpos(itHeader.patnum, 0); @@ -1098,7 +1100,7 @@ } } - itHeader.flags = ITFileHeader::useStereoPlayback; + itHeader.flags = ITFileHeader::useStereoPlayback | ITFileHeader::useMIDIPitchController; itHeader.special = ITFileHeader::embedEditHistory | ITFileHeader::embedPatternHighlights; if(m_nInstruments) itHeader.flags |= ITFileHeader::instrumentMode; if(m_SongFlags[SONG_LINEARSLIDES]) itHeader.flags |= ITFileHeader::linearSlides; @@ -1171,10 +1173,11 @@ dwExtra += SaveITEditHistory(this, nullptr); // Comments + uint16 msglength = 0; if(m_lpszSongComments) { itHeader.special |= ITFileHeader::embedSongMessage; - itHeader.msglength = (uint16)min(strlen(m_lpszSongComments) + 1, uint16_max); + itHeader.msglength = msglength = (uint16)min(strlen(m_lpszSongComments) + 1, uint16_max); itHeader.msgoffset = dwHdrPos + dwExtra + (itHeader.insnum + itHeader.smpnum + itHeader.patnum) * 4; } @@ -1240,8 +1243,8 @@ dwPos = dwHdrPos + dwExtra + (itHeader.insnum + itHeader.smpnum + itHeader.patnum) * 4; if(itHeader.special & ITFileHeader::embedSongMessage) { - dwPos += itHeader.msglength; - fwrite(m_lpszSongComments, 1, itHeader.msglength, f); + dwPos += msglength; + fwrite(m_lpszSongComments, 1, msglength, f); } // Writing instruments @@ -1254,8 +1257,8 @@ { instSize = iti.ConvertToIT(*Instruments[nins], compatibilityExport, *this); } else - // Save Empty Instrument { + // Save Empty Instrument ModInstrument dummy; instSize = iti.ConvertToIT(dummy, compatibilityExport, *this); } @@ -1487,7 +1490,7 @@ bool compress = (::GetPrivateProfileInt("Misc", Samples[nsmp].GetNumChannels() > 1 ? "ITCompressionStereo" : "ITCompressionMono", 0, theApp.GetConfigFileName()) & type) != 0; #else bool compress = false; -#endif +#endif // MODPLUG_TRACKER // Old MPT will only consider the IT2.15 compression flag if the header version also indicates IT2.15. itss.ConvertToIT(Samples[nsmp], GetType(), compress, itHeader.cmwt >= 0x215); @@ -1513,9 +1516,9 @@ // Updating offsets fseek(f, dwHdrPos, SEEK_SET); - if (itHeader.insnum) fwrite(&inspos[0], 4, itHeader.insnum, f); - if (itHeader.smpnum) fwrite(&smppos[0], 4, itHeader.smpnum, f); - if (itHeader.patnum) fwrite(&patpos[0], 4, itHeader.patnum, f); + if(itHeader.insnum) fwrite(&inspos[0], 4, itHeader.insnum, f); + if(itHeader.smpnum) fwrite(&smppos[0], 4, itHeader.smpnum, f); + if(itHeader.patnum) fwrite(&patpos[0], 4, itHeader.patnum, f); if(GetType() == MOD_TYPE_IT) { @@ -1534,19 +1537,19 @@ srlztn::Ssb ssb(fout); ssb.BeginWrite("mptm", MptVersion::num); - if (GetTuneSpecificTunings().GetNumTunings() > 0) + if(GetTuneSpecificTunings().GetNumTunings() > 0) ssb.WriteItem(GetTuneSpecificTunings(), "0", 1, &WriteTuningCollection); - if (AreNonDefaultTuningsUsed(*this)) + if(AreNonDefaultTuningsUsed(*this)) ssb.WriteItem(*this, "1", 1, &WriteTuningMap); - if (Order.NeedsExtraDatafield()) + if(Order.NeedsExtraDatafield()) ssb.WriteItem(Order, "2", 1, &WriteModSequenceOld); - if (bNeedsMptPatSave) + if(bNeedsMptPatSave) ssb.WriteItem(Patterns, FileIdPatterns, strlen(FileIdPatterns), &WriteModPatterns); ssb.WriteItem(Order, FileIdSequences, strlen(FileIdSequences), &WriteModSequences); ssb.FinishWrite(); - if (ssb.m_Status & srlztn::SNT_FAILURE) + if(ssb.m_Status & srlztn::SNT_FAILURE) { #ifdef MODPLUG_TRACKER if(GetpModDoc()) @@ -1580,10 +1583,8 @@ UINT CSoundFile::SaveMixPlugins(FILE *f, BOOL bUpdate) //---------------------------------------------------- { - - uint32 chinfo[MAX_BASECHANNELS]; - CHAR s[32]; + char id[4]; uint32 nPluginSize; uint32 nTotalSize = 0; uint32 nChInfo = 0; @@ -1610,72 +1611,62 @@ nPluginSize += MPTxPlugDataSize + 4; //+4 is for size itself: sizeof(DWORD) is 4 // rewbs.modularPlugData - if (f) + if(f) { // write plugin ID - s[0] = 'F'; - s[1] = 'X'; - s[2] = '0' + (i/10); - s[3] = '0' + (i%10); - fwrite(s, 1, 4, f); + id[0] = 'F'; + id[1] = 'X'; + id[2] = '0' + (i / 10); + id[3] = '0' + (i % 10); + fwrite(id, 1, 4, f); // write plugin size: fwrite(&nPluginSize, 1, 4, f); fwrite(&plugin.Info, 1, sizeof(SNDMIXPLUGININFO), f); fwrite(&m_MixPlugins[i].nPluginDataSize, 1, 4, f); - if (m_MixPlugins[i].pPluginData) + if(m_MixPlugins[i].pPluginData) { fwrite(m_MixPlugins[i].pPluginData, 1, m_MixPlugins[i].nPluginDataSize, f); } - //rewbs.dryRatio fwrite(&MPTxPlugDataSize, 1, 4, f); //write ID for this xPlugData chunk: - s[0] = 'D'; s[1] = 'W'; s[2] = 'R'; s[3] = 'T'; - fwrite(s, 1, 4, f); + memcpy(id, "DWRT", 4); + fwrite(id, 1, 4, f); //Write chunk data itself (Could include size if you want variable size. Not necessary here.) fwrite(&(m_MixPlugins[i].fDryRatio), 1, sizeof(float), f); - //end rewbs.dryRatio - //rewbs.plugDefaultProgram - //if (nProgram>=0) { - s[0] = 'P'; s[1] = 'R'; s[2] = 'O'; s[3] = 'G'; - fwrite(s, 1, 4, f); - //Write chunk data itself (Could include size if you want variable size. Not necessary here.) - fwrite(&(m_MixPlugins[i].defaultProgram), 1, sizeof(long), f); - //} - //end rewbs.plugDefaultProgram + memcpy(id, "PROG", 4); + fwrite(id, 1, 4, f); + //Write chunk data itself (Could include size if you want variable size. Not necessary here.) + fwrite(&(m_MixPlugins[i].defaultProgram), 1, sizeof(long), f); } nTotalSize += nPluginSize + 8; } } - for (UINT j=0; j<m_nChannels; j++) + for(CHANNELINDEX j = 0; j < m_nChannels; j++) { -// -> CODE#0006 -// -> DESC="misc quantity changes" -// if (j < 64) - if (j < MAX_BASECHANNELS) -// -! BEHAVIOUR_CHANGE#0006 + if(j < MAX_BASECHANNELS) { - if ((chinfo[j] = ChnSettings[j].nMixPlugin) != 0) + if((chinfo[j] = ChnSettings[j].nMixPlugin) != 0) { - nChInfo = j+1; + nChInfo = j + 1; } } } - if (nChInfo) + if(nChInfo) { - if (f) + if(f) { - memcpy(&nPluginSize, "CHFX", 4); + memcpy(id, "CHFX", 4); + fwrite(id, 1, 4, f); + nPluginSize = nChInfo * 4; fwrite(&nPluginSize, 1, 4, f); - nPluginSize = nChInfo*4; - fwrite(&nPluginSize, 1, 4, f); fwrite(chinfo, 1, nPluginSize, f); } - nTotalSize += nChInfo*4 + 8; + nTotalSize += nChInfo * 4 + 8; } return nTotalSize; } Modified: trunk/OpenMPT/soundlib/ModChannel.h =================================================================== --- trunk/OpenMPT/soundlib/ModChannel.h 2013-03-17 14:35:03 UTC (rev 1592) +++ trunk/OpenMPT/soundlib/ModChannel.h 2013-03-17 16:05:52 UTC (rev 1593) @@ -46,8 +46,9 @@ FlagSet<ChannelFlags> dwOldFlags; // Flags from previous tick int32 nRampRightVol; int32 nRampLeftVol; - float nFilter_Y1, nFilter_Y2, nFilter_Y3, nFilter_Y4; - float nFilter_A0, nFilter_B0, nFilter_B1; + float nFilter_Y1, nFilter_Y2; // Mono / left channel filter memory + float nFilter_Y3, nFilter_Y4; // Right channel filter memory + float nFilter_A0, nFilter_B0, nFilter_B1; // Filter coeffs int32 nFilter_HP; int32 nROfs, nLOfs; int32 nRampLength; Modified: trunk/OpenMPT/soundlib/ModInstrument.cpp =================================================================== --- trunk/OpenMPT/soundlib/ModInstrument.cpp 2013-03-17 14:35:03 UTC (rev 1592) +++ trunk/OpenMPT/soundlib/ModInstrument.cpp 2013-03-17 16:05:52 UTC (rev 1593) @@ -225,3 +225,38 @@ nCutSwing = nResSwing = 0; } } + + +// Get a set of all samples referenced by this instrument +std::set<SAMPLEINDEX> ModInstrument::GetSamples() const +//----------------------------------------------------- +{ + std::set<SAMPLEINDEX> referencedSamples; + + for(size_t i = 0; i < CountOf(Keyboard); i++) + { + // 0 isn't a sample. + if(Keyboard[i] != 0) + { + referencedSamples.insert(Keyboard[i]); + } + } + + return referencedSamples; +} + + +// Write sample references into a bool vector. If a sample is referenced by this instrument, true is written. +// The caller has to initialize the vector. +void ModInstrument::GetSamples(std::vector<bool> &referencedSamples) const +//------------------------------------------------------------------------ +{ + for(size_t i = 0; i < CountOf(Keyboard); i++) + { + // 0 isn't a sample. + if(Keyboard[i] != 0 && Keyboard[i] < referencedSamples.size()) + { + referencedSamples[Keyboard[i]] = true; + } + } +} Modified: trunk/OpenMPT/soundlib/ModInstrument.h =================================================================== --- trunk/OpenMPT/soundlib/ModInstrument.h 2013-03-17 14:35:03 UTC (rev 1592) +++ trunk/OpenMPT/soundlib/ModInstrument.h 2013-03-17 16:05:52 UTC (rev 1593) @@ -10,22 +10,21 @@ #pragma once -#include "../common/misc_util.h" -#include "../soundlib/tuning.h" +#include "tuning.h" #include <set> // Instrument Envelopes struct InstrumentEnvelope { - FlagSet<EnvelopeFlags> dwFlags; // envelope flags - uint32 nNodes; // amount of nodes used - uint8 nLoopStart; // loop start node - uint8 nLoopEnd; // loop end node - uint8 nSustainStart; // sustain start node - uint8 nSustainEnd; // sustain end node - uint8 nReleaseNode; // release node - uint16 Ticks[MAX_ENVPOINTS]; // envelope point position (x axis) - uint8 Values[MAX_ENVPOINTS]; // envelope point value (y axis) + FlagSet<EnvelopeFlags> dwFlags; // Envelope flags + uint32 nNodes; // Amount of nodes used + uint8 nLoopStart; // Loop start node + uint8 nLoopEnd; // Loop end node + uint8 nSustainStart; // Sustain start node + uint8 nSustainEnd; // Sustain end node + uint8 nReleaseNode; // Release node + uint16 Ticks[MAX_ENVPOINTS]; // Envelope point position (x axis) + uint8 Values[MAX_ENVPOINTS]; // Envelope point value (y axis) InstrumentEnvelope() { @@ -152,35 +151,11 @@ } // Get a set of all samples referenced by this instrument - std::set<SAMPLEINDEX> GetSamples() const - { - std::set<SAMPLEINDEX> referencedSamples; + std::set<SAMPLEINDEX> GetSamples() const; - for(size_t i = 0; i < CountOf(Keyboard); i++) - { - // 0 isn't a sample. - if(Keyboard[i] != 0) - { - referencedSamples.insert(Keyboard[i]); - } - } - - return referencedSamples; - } - // Write sample references into a bool vector. If a sample is referenced by this instrument, true is written. // The caller has to initialize the vector. - void GetSamples(std::vector<bool> &referencedSamples) const - { - for(size_t i = 0; i < CountOf(Keyboard); i++) - { - // 0 isn't a sample. - if(Keyboard[i] != 0 && Keyboard[i] < referencedSamples.size()) - { - referencedSamples[Keyboard[i]] = true; - } - } - } + void GetSamples(std::vector<bool> &referencedSamples) const; // Translate instrument properties between two given formats. void Convert(MODTYPE fromType, MODTYPE toType); Modified: trunk/OpenMPT/soundlib/RowVisitor.cpp =================================================================== --- trunk/OpenMPT/soundlib/RowVisitor.cpp 2013-03-17 14:35:03 UTC (rev 1592) +++ trunk/OpenMPT/soundlib/RowVisitor.cpp 2013-03-17 16:05:52 UTC (rev 1593) @@ -2,7 +2,7 @@ * RowVisitor.cpp * -------------- * Purpose: Class for managing which rows of a song has already been visited. Useful for detecting backwards jumps, loops, etc. - * Notes : The class keepts track of rows that have been visited by the player before. + * Notes : The class keeps track of rows that have been visited by the player before. * This way, we can tell when the module starts to loop, i.e. we can determine the song length, * or find out that a given point of the module can never be reached. * Modified: trunk/OpenMPT/soundlib/SampleFormats.cpp =================================================================== --- trunk/OpenMPT/soundlib/SampleFormats.cpp 2013-03-17 14:35:03 UTC (rev 1592) +++ trunk/OpenMPT/soundlib/SampleFormats.cpp 2013-03-17 16:05:52 UTC (rev 1593) @@ -2019,7 +2019,10 @@ // Check if we're dealing with FLAC in an OGG container. // We won't check for the "fLaC" signature but let libFLAC decide whether a file is valid or not, as some FLAC files might have e.g. leading ID3v2 data. file.Rewind(); - const bool isOgg = FLAC_API_SUPPORTS_OGG_FLAC && file.ReadMagic("OggS") && file.Seek(29) && file.ReadMagic("FLAC"); + if(!file.ReadMagic("fLaC")) + { + return false; + } file.Rewind(); FLAC__StreamDecoder *decoder = FLAC__stream_decoder_new(); @@ -2034,11 +2037,7 @@ FLACDecoder client(file, *this, sample); // Init decoder - FLAC__StreamDecoderInitStatus initStatus; - if(isOgg) - initStatus = FLAC__stream_decoder_init_ogg_stream(decoder, FLACDecoder::read_cb, FLACDecoder::seek_cb, FLACDecoder::tell_cb, FLACDecoder::length_cb, FLACDecoder::eof_cb, FLACDecoder::write_cb, FLACDecoder::metadata_cb, FLACDecoder::error_cb, &client); - else - initStatus = FLAC__stream_decoder_init_stream(decoder, FLACDecoder::read_cb, FLACDecoder::seek_cb, FLACDecoder::tell_cb, FLACDecoder::length_cb, FLACDecoder::eof_cb, FLACDecoder::write_cb, FLACDecoder::metadata_cb, FLACDecoder::error_cb, &client); + FLAC__StreamDecoderInitStatus initStatus = FLAC__stream_decoder_init_stream(decoder, FLACDecoder::read_cb, FLACDecoder::seek_cb, FLACDecoder::tell_cb, FLACDecoder::length_cb, FLACDecoder::eof_cb, FLACDecoder::write_cb, FLACDecoder::metadata_cb, FLACDecoder::error_cb, &client); if(initStatus != FLAC__STREAM_DECODER_INIT_STATUS_OK) { return false; Modified: trunk/OpenMPT/soundlib/Snd_defs.h =================================================================== --- trunk/OpenMPT/soundlib/Snd_defs.h 2013-03-17 14:35:03 UTC (rev 1592) +++ trunk/OpenMPT/soundlib/Snd_defs.h 2013-03-17 16:05:52 UTC (rev 1593) @@ -167,11 +167,11 @@ // Envelope value boundaries -#define ENVELOPE_MIN 0 // vertical min value of a point -#define ENVELOPE_MID 32 // vertical middle line -#define ENVELOPE_MAX 64 // vertical max value of a point +#define ENVELOPE_MIN 0 // Vertical min value of a point +#define ENVELOPE_MID 32 // Vertical middle line +#define ENVELOPE_MAX 64 // Vertical max value of a point #define MAX_ENVPOINTS 240 // Maximum length of each instrument envelope -#define ENVELOPE_MAX_LENGTH 0x3FFF // max envelope length in ticks. note: this value seems to be conservatively low... +#define ENVELOPE_MAX_LENGTH 0x3FFF // Max envelope length in ticks. note: this value is only really required because too long envelopes won't be displayed properly in the instrument editor (win32 scrollbar issues) // Flags of 'dF..' datafield in extended instrument properties. Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp =================================================================== --- trunk/OpenMPT/soundlib/Snd_fx.cpp 2013-03-17 14:35:03 UTC (rev 1592) +++ trunk/OpenMPT/soundlib/Snd_fx.cpp 2013-03-17 16:05:52 UTC (rev 1593) @@ -3521,7 +3521,18 @@ break; // SBx: Pattern Loop // SCx: Note Cut - case 0xC0: NoteCut(nChn, param); break; + case 0xC0: + if(param == 0) + { + //IT compatibility 22. SC0 == SC1 + if(GetType() & (MOD_TYPE_IT | MOD_TYPE_MPT)) + param = 1; + // ST3 doesn't cut notes with SC0 + else if(GetType() == MOD_TYPE_S3M) + return; + } + NoteCut(nChn, param); + break; // SDx: Note Delay // SEx: Pattern Delay for x rows // SFx: S3M: Not used, IT: Set Active Midi Macro @@ -4237,16 +4248,6 @@ void CSoundFile::NoteCut(CHANNELINDEX nChn, UINT nTick) //----------------------------------------------------- { - if(nTick == 0) - { - //IT compatibility 22. SC0 == SC1 - if(GetType() & (MOD_TYPE_IT | MOD_TYPE_MPT)) - nTick = 1; - // ST3 doesn't cut notes with SC0 - else if(GetType() == MOD_TYPE_S3M) - return; - } - if (m_nTickCount == nTick) { ModChannel *pChn = &Chn[nChn]; Modified: trunk/OpenMPT/soundlib/WAVTools.cpp =================================================================== --- trunk/OpenMPT/soundlib/WAVTools.cpp 2013-03-17 14:35:03 UTC (rev 1592) +++ trunk/OpenMPT/soundlib/WAVTools.cpp 2013-03-17 16:05:52 UTC (rev 1593) @@ -9,6 +9,7 @@ #include "stdafx.h" +#include "Loaders.h" #include "WAVTools.h" Modified: trunk/OpenMPT/soundlib/WAVTools.h =================================================================== --- trunk/OpenMPT/soundlib/WAVTools.h 2013-03-17 14:35:03 UTC (rev 1592) +++ trunk/OpenMPT/soundlib/WAVTools.h 2013-03-17 16:05:52 UTC (rev 1593) @@ -10,7 +10,6 @@ #pragma once -#include "Loaders.h" #include "ChunkReader.h" #pragma pack(push, 1) Modified: trunk/OpenMPT/soundlib/XMTools.cpp =================================================================== --- trunk/OpenMPT/soundlib/XMTools.cpp 2013-03-17 14:35:03 UTC (rev 1592) +++ trunk/OpenMPT/soundlib/XMTools.cpp 2013-03-17 16:05:52 UTC (rev 1593) @@ -52,7 +52,7 @@ void XMInstrument::ConvertEnvelopeToXM(const InstrumentEnvelope &mptEnv, uint8 &numPoints, uint8 &flags, uint8 &sustain, uint8 &loopStart, uint8 &loopEnd, uint16 (&envData)[24]) //------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- { - numPoints = static_cast<uint8>(min(12, mptEnv.nNodes)); + numPoints = static_cast<uint8>(Util::Min(12u, mptEnv.nNodes)); // Envelope Data for(size_t i = 0; i < numPoints; i++) @@ -67,9 +67,9 @@ if(mptEnv.dwFlags[ENV_LOOP]) flags |= XMInstrument::envLoop; // Envelope Loops - sustain = static_cast<uint8>(min(12, mptEnv.nSustainStart)); - loopStart = static_cast<uint8>(min(12, mptEnv.nLoopStart)); - loopEnd = static_cast<uint8>(min(12, mptEnv.nLoopEnd)); + sustain = Util::Min(uint8(12), mptEnv.nSustainStart); + loopStart = Util::Min(uint8(12), mptEnv.nLoopStart); + loopEnd = Util::Min(uint8(12), mptEnv.nLoopEnd); } @@ -370,8 +370,8 @@ MemsetZero(*this); // Volume / Panning - vol = static_cast<uint8>(min(mptSmp.nVolume / 4, 64)); - pan = static_cast<uint8>(min(mptSmp.nPan, 255)); + vol = static_cast<uint8>(Util::Min(mptSmp.nVolume / 4u, 64u)); + pan = static_cast<uint8>(Util::Min(mptSmp.nPan, uint16(255))); // Sample Frequency if((fromType & (MOD_TYPE_MOD | MOD_TYPE_XM))) @@ -386,9 +386,9 @@ } flags = 0; - if((mptSmp.uFlags & CHN_LOOP)) + if(mptSmp.uFlags[CHN_LOOP]) { - flags |= (mptSmp.uFlags & CHN_PINGPONGLOOP) ? XMSample::sampleBidiLoop : XMSample::sampleLoop; + flags |= mptSmp.uFlags[CHN_PINGPONGLOOP] ? XMSample::sampleBidiLoop : XMSample::sampleLoop; } // Sample Length and Loops @@ -396,7 +396,7 @@ loopStart = mptSmp.nLoopStart; loopLength = mptSmp.nLoopEnd - mptSmp.nLoopStart; - if((mptSmp.uFlags & CHN_16BIT)) + if(mptSmp.uFlags[CHN_16BIT]) { flags |= XMSample::sample16Bit; length *= 2; @@ -404,7 +404,7 @@ loopLength *= 2; } - if((mptSmp.uFlags & CHN_STEREO) && !compatibilityExport) + if(mptSmp.uFlags[CHN_STEREO] && !compatibilityExport) { flags |= XMSample::sampleStereo; length *= 2; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2013-03-17 17:05:59
|
Revision: 1595 http://sourceforge.net/p/modplug/code/1595 Author: saga-games Date: 2013-03-17 17:05:51 +0000 (Sun, 17 Mar 2013) Log Message: ----------- [Var] Added more files to SVN ignore list Property Changed: ---------------- trunk/OpenMPT/mptrack/ trunk/OpenMPT/plugins/ trunk/OpenMPT/plugins/MidiInOut/ trunk/OpenMPT/plugins/bin/ Index: trunk/OpenMPT/mptrack =================================================================== --- trunk/OpenMPT/mptrack 2013-03-17 16:07:00 UTC (rev 1594) +++ trunk/OpenMPT/mptrack 2013-03-17 17:05:51 UTC (rev 1595) Property changes on: trunk/OpenMPT/mptrack ___________________________________________________________________ Modified: svn:ignore ## -6,3 +6,4 ## Release ReleaseLTCG ipch +mptrack.aps Index: trunk/OpenMPT/plugins =================================================================== --- trunk/OpenMPT/plugins 2013-03-17 16:07:00 UTC (rev 1594) +++ trunk/OpenMPT/plugins 2013-03-17 17:05:51 UTC (rev 1595) Property changes on: trunk/OpenMPT/plugins ___________________________________________________________________ Added: svn:ignore ## -0,0 +1,3 ## +*.sdf +*.suo +ipch Index: trunk/OpenMPT/plugins/MidiInOut =================================================================== --- trunk/OpenMPT/plugins/MidiInOut 2013-03-17 16:07:00 UTC (rev 1594) +++ trunk/OpenMPT/plugins/MidiInOut 2013-03-17 17:05:51 UTC (rev 1595) Property changes on: trunk/OpenMPT/plugins/MidiInOut ___________________________________________________________________ Added: svn:ignore ## -0,0 +1 ## +*.user Index: trunk/OpenMPT/plugins/bin =================================================================== --- trunk/OpenMPT/plugins/bin 2013-03-17 16:07:00 UTC (rev 1594) +++ trunk/OpenMPT/plugins/bin 2013-03-17 17:05:51 UTC (rev 1595) Property changes on: trunk/OpenMPT/plugins/bin ___________________________________________________________________ Added: svn:ignore ## -0,0 +1,3 ## +Debug +Release +build This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <man...@us...> - 2013-03-19 20:56:40
|
Revision: 1602 http://sourceforge.net/p/modplug/code/1602 Author: manxorist Date: 2013-03-19 20:56:21 +0000 (Tue, 19 Mar 2013) Log Message: ----------- [Var] Remove old and unused code from xsoundlib directory. [Var] Sanitize building of the only remaining file (smbPitchShift.cpp) by building it in the xsoundlib project and adding dependencies from mptrack project to xsoundlib and remove the inclusion of smbPitchShift.cpp directly in mptrack/Ctrl_smp.cpp. Modified Paths: -------------- trunk/OpenMPT/mptrack/Ctrl_smp.cpp trunk/OpenMPT/mptrack/MPTRACK_08.sln trunk/OpenMPT/mptrack/mptrack_08.vcproj trunk/OpenMPT/mptrack/mptrack_10.vcxproj trunk/OpenMPT/xsoundlib/smbPitchShift.cpp trunk/OpenMPT/xsoundlib/xsoundlib_08.vcproj trunk/OpenMPT/xsoundlib/xsoundlib_10.vcxproj trunk/OpenMPT/xsoundlib/xsoundlib_10.vcxproj.filters Removed Paths: ------------- trunk/OpenMPT/xsoundlib/AUTHORS trunk/OpenMPT/xsoundlib/COPYING trunk/OpenMPT/xsoundlib/ReadMe.txt trunk/OpenMPT/xsoundlib/TBIsolator.cpp trunk/OpenMPT/xsoundlib/common.h trunk/OpenMPT/xsoundlib/config.h trunk/OpenMPT/xsoundlib/fastest_coeffs.h trunk/OpenMPT/xsoundlib/float_cast.h trunk/OpenMPT/xsoundlib/high_qual_coeffs.h trunk/OpenMPT/xsoundlib/mid_qual_coeffs.h trunk/OpenMPT/xsoundlib/samplerate.cpp trunk/OpenMPT/xsoundlib/samplerate.h trunk/OpenMPT/xsoundlib/src_linear.cpp trunk/OpenMPT/xsoundlib/src_sinc.cpp trunk/OpenMPT/xsoundlib/src_zoh.cpp trunk/OpenMPT/xsoundlib/stdafx.cpp trunk/OpenMPT/xsoundlib/stdafx.h trunk/OpenMPT/xsoundlib/unistd.h trunk/OpenMPT/xsoundlib/xsoundlib.vcproj Modified: trunk/OpenMPT/mptrack/Ctrl_smp.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_smp.cpp 2013-03-19 17:32:39 UTC (rev 1601) +++ trunk/OpenMPT/mptrack/Ctrl_smp.cpp 2013-03-19 20:56:21 UTC (rev 1602) @@ -23,9 +23,7 @@ #include "soundtouch/SoundTouch.h" #include "soundtouch/TDStretch.h" #include "soundtouch/SoundTouchDLL.h" -#pragma warning(disable:4244) //"conversion from 'type1' to 'type2', possible loss of data" -#include "smbPitchShift.cpp" -#pragma warning(default:4244) //"conversion from 'type1' to 'type2', possible loss of data" +#include "xsoundlib/smbPitchShift.h" #include "modsmp_ctrl.h" #include "Autotune.h" #include "../common/StringFixer.h" Modified: trunk/OpenMPT/mptrack/MPTRACK_08.sln =================================================================== --- trunk/OpenMPT/mptrack/MPTRACK_08.sln 2013-03-19 17:32:39 UTC (rev 1601) +++ trunk/OpenMPT/mptrack/MPTRACK_08.sln 2013-03-19 20:56:21 UTC (rev 1602) @@ -4,6 +4,7 @@ ProjectSection(ProjectDependencies) = postProject {94CD7910-649A-4075-9F33-7EBEE614FD45} = {94CD7910-649A-4075-9F33-7EBEE614FD45} {44316F22-904E-48AA-B841-5A3A6AC77319} = {44316F22-904E-48AA-B841-5A3A6AC77319} + {DCC2BB2F-6778-4FD3-9C00-D6CD8DC917B8} = {DCC2BB2F-6778-4FD3-9C00-D6CD8DC917B8} {FAE39936-1DC7-40BB-AD3F-3B5B9E9AB0E8} = {FAE39936-1DC7-40BB-AD3F-3B5B9E9AB0E8} {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8} = {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8} {4CEFBC84-C215-11DB-8314-0800200C9A66} = {4CEFBC84-C215-11DB-8314-0800200C9A66} Modified: trunk/OpenMPT/mptrack/mptrack_08.vcproj =================================================================== --- trunk/OpenMPT/mptrack/mptrack_08.vcproj 2013-03-19 17:32:39 UTC (rev 1601) +++ trunk/OpenMPT/mptrack/mptrack_08.vcproj 2013-03-19 20:56:21 UTC (rev 1602) @@ -48,7 +48,7 @@ <Tool Name="VCCLCompilerTool" Optimization="0" - AdditionalIncludeDirectories="..\common;..\soundlib;..\include;..\include\vstsdk2.4\;..\include\ASIOSDK2\common\;..\xsoundlib;..\" + AdditionalIncludeDirectories="..\common;..\soundlib;..\include;..\include\vstsdk2.4\;..\include\ASIOSDK2\common\;..\" PreprocessorDefinitions="_DEBUG,WIN32,_WINDOWS,MODPLUG_TRACKER" StringPooling="true" ExceptionHandling="2" @@ -156,7 +156,7 @@ Name="VCCLCompilerTool" Optimization="2" InlineFunctionExpansion="2" - AdditionalIncludeDirectories="..\common;..\soundlib;..\include;..\include\vstsdk2.4\;..\include\ASIOSDK2\common\;..\xsoundlib;..\" + AdditionalIncludeDirectories="..\common;..\soundlib;..\include;..\include\vstsdk2.4\;..\include\ASIOSDK2\common\;..\" PreprocessorDefinitions="NDEBUG,WIN32,_WINDOWS,MODPLUG_TRACKER" StringPooling="true" ExceptionHandling="2" @@ -325,10 +325,6 @@ > </File> <File - RelativePath=".\VstPresets.cpp" - > - </File> - <File RelativePath=".\globals.cpp" > </File> @@ -349,6 +345,10 @@ > </File> <File + RelativePath="..\soundlib\ITCompression.cpp" + > + </File> + <File RelativePath="..\soundlib\plugins\JBridge.cpp" > </File> @@ -489,10 +489,6 @@ > </File> <File - RelativePath="..\soundlib\ITCompression.cpp" - > - </File> - <File RelativePath="..\common\serialization_utils.cpp" > </File> @@ -613,6 +609,10 @@ > </File> <File + RelativePath=".\VstPresets.cpp" + > + </File> + <File RelativePath="..\soundlib\Waveform.cpp" > </File> @@ -887,15 +887,15 @@ > </File> <File - RelativePath=".\VstPresets.h" + RelativePath=".\globals.h" > </File> <File - RelativePath=".\globals.h" + RelativePath="InputHandler.h" > </File> <File - RelativePath="InputHandler.h" + RelativePath="..\soundlib\ITCompression.h" > </File> <File @@ -1035,10 +1035,6 @@ > </File> <File - RelativePath="..\soundlib\ITCompression.h" - > - </File> - <File RelativePath="..\common\serialization_utils.h" > </File> @@ -1127,6 +1123,10 @@ > </File> <File + RelativePath=".\VstPresets.h" + > + </File> + <File RelativePath="..\soundlib\Wav.h" > </File> Modified: trunk/OpenMPT/mptrack/mptrack_10.vcxproj =================================================================== --- trunk/OpenMPT/mptrack/mptrack_10.vcxproj 2013-03-19 17:32:39 UTC (rev 1601) +++ trunk/OpenMPT/mptrack/mptrack_10.vcxproj 2013-03-19 20:56:21 UTC (rev 1602) @@ -77,7 +77,7 @@ <ClCompile> <AdditionalOptions>/EHsc %(AdditionalOptions)</AdditionalOptions> <Optimization>Disabled</Optimization> - <AdditionalIncludeDirectories>..\common;..\soundlib;..\include;..\include\vstsdk2.4\;..\include\ASIOSDK2\common\;..\xsoundlib;..\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <AdditionalIncludeDirectories>..\common;..\soundlib;..\include;..\include\vstsdk2.4\;..\include\ASIOSDK2\common\;..\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <PreprocessorDefinitions>_DEBUG;WIN32;_WINDOWS;MODPLUG_TRACKER;%(PreprocessorDefinitions)</PreprocessorDefinitions> <StringPooling>true</StringPooling> <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> @@ -133,7 +133,7 @@ <ClCompile> <Optimization>MaxSpeed</Optimization> <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion> - <AdditionalIncludeDirectories>..\common;..\soundlib;..\include;..\include\vstsdk2.4\;..\include\ASIOSDK2\common\;..\xsoundlib;..\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <AdditionalIncludeDirectories>..\common;..\soundlib;..\include;..\include\vstsdk2.4\;..\include\ASIOSDK2\common\;..\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <PreprocessorDefinitions>NDEBUG;WIN32;_WINDOWS;MODPLUG_TRACKER;%(PreprocessorDefinitions)</PreprocessorDefinitions> <StringPooling>true</StringPooling> <RuntimeLibrary>MultiThreaded</RuntimeLibrary> @@ -193,7 +193,7 @@ <ClCompile> <Optimization>MaxSpeed</Optimization> <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion> - <AdditionalIncludeDirectories>..\common;..\soundlib;..\include;..\include\vstsdk2.4\;..\include\ASIOSDK2\common\;..\xsoundlib;..\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <AdditionalIncludeDirectories>..\common;..\soundlib;..\include;..\include\vstsdk2.4\;..\include\ASIOSDK2\common\;..\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <PreprocessorDefinitions>NDEBUG;WIN32;_WINDOWS;MODPLUG_TRACKER;%(PreprocessorDefinitions)</PreprocessorDefinitions> <StringPooling>true</StringPooling> <RuntimeLibrary>MultiThreaded</RuntimeLibrary> @@ -560,6 +560,9 @@ <ProjectReference Include="..\unzip\unzip_10.vcxproj"> <Project>{f23cc68d-1d58-4eb1-9425-a28f5058eb31}</Project> </ProjectReference> + <ProjectReference Include="..\xsoundlib\xsoundlib_10.vcxproj"> + <Project>{dcc2bb2f-6778-4fd3-9c00-d6cd8dc917b8}</Project> + </ProjectReference> </ItemGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <ImportGroup Label="ExtensionTargets"> Deleted: trunk/OpenMPT/xsoundlib/AUTHORS =================================================================== --- trunk/OpenMPT/xsoundlib/AUTHORS 2013-03-19 17:32:39 UTC (rev 1601) +++ trunk/OpenMPT/xsoundlib/AUTHORS 2013-03-19 20:56:21 UTC (rev 1602) @@ -1 +0,0 @@ -Erik de Castro Lopo <er...@me...> Deleted: trunk/OpenMPT/xsoundlib/COPYING =================================================================== --- trunk/OpenMPT/xsoundlib/COPYING 2013-03-19 17:32:39 UTC (rev 1601) +++ trunk/OpenMPT/xsoundlib/COPYING 2013-03-19 20:56:21 UTC (rev 1602) @@ -1,340 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - <one line to give the program's name and a brief idea of what it does.> - Copyright (C) <year> <name of author> - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program 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 General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - <signature of Ty Coon>, 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Library General -Public License instead of this License. Deleted: trunk/OpenMPT/xsoundlib/ReadMe.txt =================================================================== --- trunk/OpenMPT/xsoundlib/ReadMe.txt 2013-03-19 17:32:39 UTC (rev 1601) +++ trunk/OpenMPT/xsoundlib/ReadMe.txt 2013-03-19 20:56:21 UTC (rev 1602) @@ -1,29 +0,0 @@ -======================================================================== - BIBLIOTH\xC8QUE STATIQUE : vue d'ensemble du projet xsoundlib -======================================================================== - -AppWizard a cr\xE9\xE9 ce projet de biblioth\xE8que xsoundlib pour vous. -Ce fichier contient un r\xE9sum\xE9 du contenu de chacun des fichiers qui -constituent votre application xsoundlib. - - -xsoundlib.vcproj - Il s'agit du fichier projet principal pour les projets VC++ g\xE9n\xE9r\xE9s en utilisant un Assistant Application. - Il contient les informations sur la version de Visual C++ qui a g\xE9n\xE9r\xE9 le fichier et - les informations sur les plates-formes, les configurations et les fonctionnalit\xE9s du projet s\xE9lectionn\xE9es avec - l'Assistant Application. - - -///////////////////////////////////////////////////////////////////////////// - -StdAfx.h, StdAfx.cpp - Ces fichiers sont utilis\xE9s pour g\xE9n\xE9rer un fichier d'en-t\xEAte pr\xE9compil\xE9 (PCH) - nomm\xE9 xsoundlib.pch et un fichier de type pr\xE9compil\xE9 nomm\xE9 StdAfx.obj. - -///////////////////////////////////////////////////////////////////////////// -Autres remarques\xA0: - -AppWizard utilise des commentaires "TODO\xA0:" pour indiquer les parties du code source o\xF9 vous -pouvez ajouter ou modifier du code. - -///////////////////////////////////////////////////////////////////////////// Deleted: trunk/OpenMPT/xsoundlib/TBIsolator.cpp =================================================================== --- trunk/OpenMPT/xsoundlib/TBIsolator.cpp 2013-03-19 17:32:39 UTC (rev 1601) +++ trunk/OpenMPT/xsoundlib/TBIsolator.cpp 2013-03-19 20:56:21 UTC (rev 1602) @@ -1,63 +0,0 @@ -#include <stdafx.h> -#include <string.h> -#include <math.h> -#include "FFTReal.h" - -/* ============================================================= */ -/* nFFTSize must be a power of 2 */ -/* ============================================================= */ -/* Usage examples: */ -/* - suppress the center: fAmpL = 1.f, fAmpC = 0.f, fAmpR = 1.f */ -/* - keep only the center: fAmpL = 0.f, fAmpC = 1.f, fAmpR = 0.f */ -/* ============================================================= */ - -void processTBIsolator(float *pIns[2], float *pOuts[2], long nFFTSize, float fAmpL, float fAmpC, float fAmpR) -{ - float fModL, fModR; - float fRealL, fRealC, fRealR; - float fImagL, fImagC, fImagR; - double u; - - for ( long i = 0, j = nFFTSize / 2; i < nFFTSize / 2; i++, j++ ) - { - fModL = pIns[0][i] * pIns[0][i] + pIns[0][j] * pIns[0][j]; - fModR = pIns[1][i] * pIns[1][i] + pIns[1][j] * pIns[1][j]; - - // min on complex numbers - if ( fModL > fModR ) - { - fRealC = pIns[1][i]; - fImagC = pIns[1][j]; - } - else - { - fRealC = pIns[0][i]; - fImagC = pIns[0][j]; - } - - // phase correction... - u = fabs(atan2(pIns[0][j], pIns[0][i]) - atan2(pIns[1][j], pIns[1][i])) / 3.141592653589; - - if ( u >= 1 ) u = 2 - u; - - u = pow(1 - u*u*u, 24); - - fRealC *= (float) u; - fImagC *= (float) u; - - // center extraction... - fRealL = pIns[0][i] - fRealC; - fImagL = pIns[0][j] - fImagC; - - fRealR = pIns[1][i] - fRealC; - fImagR = pIns[1][j] - fImagC; - - // You can do some treatments here... - - pOuts[0][i] = fRealL * fAmpL + fRealC * fAmpC; - pOuts[0][j] = fImagL * fAmpL + fImagC * fAmpC; - - pOuts[1][i] = fRealR * fAmpR + fRealC * fAmpC; - pOuts[1][j] = fImagR * fAmpR + fImagC * fAmpC; - } -} Deleted: trunk/OpenMPT/xsoundlib/common.h =================================================================== --- trunk/OpenMPT/xsoundlib/common.h 2013-03-19 17:32:39 UTC (rev 1601) +++ trunk/OpenMPT/xsoundlib/common.h 2013-03-19 20:56:21 UTC (rev 1602) @@ -1,124 +0,0 @@ -/* -** Copyright (C) 2002-2004 Erik de Castro Lopo <er...@me...> -** -** This program is free software; you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation; either version 2 of the License, or -** (at your option) any later version. -** -** This program 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 General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program; if not, write to the Free Software -** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. -*/ - -#ifndef COMMON_H_INCLUDED -#define COMMON_H_INCLUDED - -#ifdef HAVE_STDINT_H -#include <stdint.h> -#elif (SIZEOF_INT == 4) -typedef int int32_t ; -#elif (SIZEOF_LONG == 4) -typedef long int32_t ; -#endif - -#define SRC_MAX_RATIO 256 -#define SRC_MIN_RATIO_DIFF (1e-20) - -#define MAX(a,b) (((a) > (b)) ? (a) : (b)) -#define MIN(a,b) (((a) < (b)) ? (a) : (b)) - -#define MAKE_MAGIC(a,b,c,d,e,f) ((a) + ((b) << 4) + ((c) << 8) + ((d) << 12) + ((e) << 16) + ((f) << 20)) - -#include "samplerate.h" - -enum -{ SRC_FALSE = 0, - SRC_TRUE = 1, - - SRC_MODE_PROCESS = 555, - SRC_MODE_CALLBACK = 556 -} ; - -enum -{ SRC_ERR_NO_ERROR = 0, - - SRC_ERR_MALLOC_FAILED, - SRC_ERR_BAD_STATE, - SRC_ERR_BAD_DATA, - SRC_ERR_BAD_DATA_PTR, - SRC_ERR_NO_PRIVATE, - SRC_ERR_BAD_SRC_RATIO, - SRC_ERR_BAD_PROC_PTR, - SRC_ERR_SHIFT_BITS, - SRC_ERR_FILTER_LEN, - SRC_ERR_BAD_CONVERTER, - SRC_ERR_BAD_CHANNEL_COUNT, - SRC_ERR_SINC_BAD_BUFFER_LEN, - SRC_ERR_SIZE_INCOMPATIBILITY, - SRC_ERR_BAD_PRIV_PTR, - SRC_ERR_BAD_SINC_STATE, - SRC_ERR_DATA_OVERLAP, - SRC_ERR_BAD_CALLBACK, - SRC_ERR_BAD_MODE, - SRC_ERR_NULL_CALLBACK, - - /* This must be the last error number. */ - SRC_ERR_MAX_ERROR -} ; - -typedef struct SRC_PRIVATE_tag -{ double last_ratio, last_position ; - - int error ; - int channels ; - - /* SRC_MODE_PROCESS or SRC_MODE_CALLBACK */ - int mode ; - - /* Pointer to data to converter specific data. */ - void *private_data ; - - int (*process) (struct SRC_PRIVATE_tag *psrc, SRC_DATA *data) ; - void (*reset) (struct SRC_PRIVATE_tag *psrc) ; - - /* Data specific to SRC_MODE_CALLBACK. */ - src_callback_t callback_func ; - void *user_callback_data ; - long saved_frames ; - float *saved_data ; -} SRC_PRIVATE ; - -/* In src_sinc.c */ -const char* sinc_get_name (int src_enum) ; -const char* sinc_get_description (int src_enum) ; - -int sinc_set_converter (SRC_PRIVATE *psrc, int src_enum) ; - -/* In src_linear.c */ -const char* linear_get_name (int src_enum) ; -const char* linear_get_description (int src_enum) ; - -int linear_set_converter (SRC_PRIVATE *psrc, int src_enum) ; - -/* In src_zoh.c */ -const char* zoh_get_name (int src_enum) ; -const char* zoh_get_description (int src_enum) ; - -int zoh_set_converter (SRC_PRIVATE *psrc, int src_enum) ; - -#endif /* COMMON_H_INCLUDED */ - -/* -** Do not edit or modify anything in this comment block. -** The arch-tag line is a file identity tag for the GNU Arch -** revision control system. -** -** arch-tag: 737d46dc-a2f8-4025-bb88-fc8915c69085 -*/ - Deleted: trunk/OpenMPT/xsoundlib/config.h =================================================================== --- trunk/OpenMPT/xsoundlib/config.h 2013-03-19 17:32:39 UTC (rev 1601) +++ trunk/OpenMPT/xsoundlib/config.h 2013-03-19 20:56:21 UTC (rev 1602) @@ -1,182 +0,0 @@ -/* -** Copyright (C) 2002-2004 Erik de Castro Lopo <er...@me...> -** -** This program is free software; you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation; either version 2 of the License, or -** (at your option) any later version. -** -** This program 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 General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program; if not, write to the Free Software -** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. -*/ - -/* -** This is the Win32 specific config.h header file. -** -** On Unix (including MacOSX), this header file is automatically generated -** during the configure process while on Win32 this has to be hand edited -** to keep it up to date. -** -** This is also a good file to add Win32 specific things. -*/ - -/* -** MSVC++ assumes that all floating point constants without a trailing -** letter 'f' are double precision. -** -** If this assumption is incorrect and one of these floating point constants -** is assigned to a float variable MSVC++ generates a warning. -** -** Since there are currently about 25000 of these warnings generated in -** src/src_sinc.c this slows down compile times considerably. The -** following #pragma disables the warning. -*/ - -#pragma warning(disable: 4305) - -/*---------------------------------------------------------------------------- -** Normal #defines follow. -*/ - -/* Set to 1 if the compile is GNU GCC. */ -#define COMPILER_IS_GCC 0 - -/* Target processor clips on negative float to int conversion. */ -#define CPU_CLIPS_NEGATIVE 1 - -/* Target processor clips on positive float to int conversion. */ -#define CPU_CLIPS_POSITIVE 0 - -/* Set to 1 to enable debugging. */ -#define ENABLE_DEBUG 0 - -/* Major version of GCC or 3 otherwise. */ -/* #undef GCC_MAJOR_VERSION */ - -/* Define to 1 if you have the `calloc' function. */ -#define HAVE_CALLOC 1 - -/* Define to 1 if you have the `ceil' function. */ -#define HAVE_CEIL 1 - -/* Define to 1 if you have the <dlfcn.h> header file. */ -/* #undef HAVE_DLFCN_H */ - -/* Set to 1 if you have libfftw3. */ -/* #undef HAVE_FFTW3 */ - -/* Define to 1 if you have the `floor' function. */ -#define HAVE_FLOOR 1 - -/* Define to 1 if you have the `fmod' function. */ -#define HAVE_FMOD 1 - -/* Define to 1 if you have the `free' function. */ -#define HAVE_FREE 1 - -/* Define to 1 if you have the <inttypes.h> header file. */ -/* #undef HAVE_INTTYPES_H */ - -/* Define to 1 if you have the `efence' library (-lefence). */ -/* #undef HAVE_LIBEFENCE */ - -/* Define to 1 if you have the `m' library (-lm). */ -/* #undef HAVE_LIBM */ - -/* Define if you have C99's lrint function. */ -/* #undef HAVE_LRINT */ - -/* Define if you have C99's lrintf function. */ -/* #undef HAVE_LRINTF */ - -/* Define to 1 if you have the `malloc' function. */ -#define HAVE_MALLOC 1 - -/* Define to 1 if you have the `memcpy' function. */ -#define HAVE_MEMCPY 1 - -/* Define to 1 if you have the `memmove' function. */ -#define HAVE_MEMMOVE 1 - -/* Define to 1 if you have the <memory.h> header file. */ -#define HAVE_MEMORY_H 1 - -/* Set to 1 if you have libsndfile. */ -#define HAVE_SNDFILE 1 - -/* Define to 1 if you have the <stdint.h> header file. */ -/* #undef HAVE_STDINT_H */ - -/* Define to 1 if you have the <stdlib.h> header file. */ -#define HAVE_STDLIB_H 1 - -/* Define to 1 if you have the <strings.h> header file. */ -#define HAVE_STRINGS_H 1 - -/* Define to 1 if you have the <string.h> header file. */ -#define HAVE_STRING_H 1 - -/* Define to 1 if you have the <sys/stat.h> header file. */ -#define HAVE_SYS_STAT_H 1 - -/* Define to 1 if you have the <sys/times.h> header file. */ -/* #undef HAVE_SYS_TIMES_H */ - -/* Define to 1 if you have the <sys/types.h> header file. */ -#define HAVE_SYS_TYPES_H 1 - -/* Define to 1 if you have the <unistd.h> header file. */ -#define HAVE_UNISTD_H 1 - -/* Set to 1 if compiling for Win32 */ -#define OS_IS_WIN32 1 - -/* Name of package */ -#define PACKAGE "libsamplerate" - -/* Define to the address where bug reports for this package should be sent. */ -#define PACKAGE_BUGREPORT "" - -/* Define to the full name of this package. */ -#define PACKAGE_NAME "" - -/* Define to the full name and version of this package. */ -#define PACKAGE_STRING "" - -/* Define to the one symbol short name of this package. */ -#define PACKAGE_TARNAME "" - -/* Define to the version of this package. */ -#define PACKAGE_VERSION "" - -/* The size of a `double', as computed by sizeof. */ -#define SIZEOF_DOUBLE 8 - -/* The size of a `float', as computed by sizeof. */ -#define SIZEOF_FLOAT 4 - -/* The size of a `int', as computed by sizeof. */ -#define SIZEOF_INT 4 - -/* The size of a `long', as computed by sizeof. */ -#define SIZEOF_LONG 4 - -/* Define to 1 if you have the ANSI C header files. */ -#define STDC_HEADERS 1 - -/* Version number of package */ -#define VERSION "0.1.2" - -/* -** Do not edit or modify anything in this comment block. -** The arch-tag line is a file identity tag for the GNU Arch -** revision control system. -** -** arch-tag: 7c5a8910-8149-4e89-98ce-be92835e435b -*/ Deleted: trunk/OpenMPT/xsoundlib/fastest_coeffs.h =================================================================== --- trunk/OpenMPT/xsoundlib/fastest_coeffs.h 2013-03-19 17:32:39 UTC (rev 1601) +++ trunk/OpenMPT/xsoundlib/fastest_coeffs.h 2013-03-19 20:56:21 UTC (rev 1602) @@ -1,2501 +0,0 @@ -/* -** Copyright (C) 2002-2004 Erik de Castro Lopo <er...@me...> -** -** This program is free software; you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation; either version 2 of the License, or -** (at your option) any later version. -** -** This program 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 General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program; if not, write to the Free Software -** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. -*/ - - -/* -** f = make_filter (8, 128, 100.3) ; -** Pass band width : 0.0039062 (should be 0.0039062) -** Stop band atten. : 100.71 dB -** -3dB band width : 0.484 -** half length : 2463 -** increment : 128 -*/ - - 8.31472372954840555082e-01, - 8.31414005540308198583e-01, - 8.31238918266223869580e-01, - 8.30947156036480505392e-01, - 8.30538793675450581766e-01, - 8.30013935904800659316e-01, - 8.29372717311066987023e-01, - 8.28615302303967515840e-01, - 8.27741885065490623496e-01, - 8.26752689489751890761e-01, - 8.25647969113678215081e-01, - 8.24428007038499943704e-01, - 8.23093115842108757896e-01, - 8.21643637482293187624e-01, - 8.20079943190897053817e-01, - 8.18402433358933589780e-01, - 8.16611537412689103554e-01, - 8.14707713680854150873e-01, - 8.12691449252757824873e-01, - 8.10563259827706050764e-01, - 8.08323689555523805517e-01, - 8.05973310868314363198e-01, - 8.03512724303517833491e-01, - 8.00942558318331943035e-01, - 7.98263469095534694553e-01, - 7.95476140340800830231e-01, - 7.92581283071560838138e-01, - 7.89579635397499868255e-01, - 7.86471962292734527722e-01, - 7.83259055359786127148e-01, - 7.79941732585400893107e-01, - 7.76520838088307852054e-01, - 7.72997241859018080490e-01, - 7.69371839491718167992e-01, - 7.65645551908390675777e-01, - 7.61819325075220210586e-01, - 7.57894129711408459649e-01, - 7.53870960990470018181e-01, - 7.49750838234153449413e-01, - 7.45534804599028211314e-01, - 7.41223926755909090502e-01, - 7.36819294562192195208e-01, - 7.32322020727209643809e-01, - 7.27733240470738174110e-01, - 7.23054111174766811487e-01, - 7.18285812028632841830e-01, - 7.13429543667664534112e-01, - 7.08486527805442301009e-01, - 7.03458006859804640953e-01, - 6.98345243572719653891e-01, - 6.93149520624175785599e-01, - 6.87872140240182283755e-01, - 6.82514423795047564525e-01, - 6.77077711408058502407e-01, - 6.71563361534684655219e-01, - 6.65972750552474845875e-01, - 6.60307272341742135247e-01, - 6.54568337861228477514e-01, - 6.48757374718860524432e-01, - 6.42875826737744904271e-01, - 6.36925153517562181449e-01, - 6.30906829991492501541e-01, - 6.24822345978837789815e-01, - 6.18673205733470954470e-01, - 6.12460927488293727095e-01, - 6.06187042995817604307e-01, - 5.99853097065060292259e-01, - 5.93460647094893878339e-01, - 5.87011262603992944875e-01, - 5.80506524757569142281e-01, - 5.73948025891025337408e-01, - 5.67337369030688098981e-01, - 5.60676167411809700525e-01, - 5.53966043993961543279e-01, - 5.47208630974010734604e-01, - 5.40405569296826038261e-01, - 5.33558508163880174102e-01, - 5.26669104539922661168e-01, - 5.19739022657876970079e-01, - 5.12769933522119303326e-01, - 5.05763514410336290084e-01, - 4.98721448374081555155e-01, - 4.91645423738241937883e-01, - 4.84537133599546865348e-01, - 4.77398275324308896117e-01, - 4.70230550045545592219e-01, - 4.63035662159660077464e-01, - 4.55815318822846149427e-01, - 4.48571229447379538069e-01, - 4.41305105197960123586e-01, - 4.34018658488283970431e-01, - 4.26713602477997000495e-01, - 4.19391650570203500248e-01, - 4.12054515909689722530e-01, - 4.04703910882034223473e-01, - 3.97341546613763640927e-01, - 3.89969132473721613596e-01, - 3.82588375575806771689e-01, - 3.75200980283257823356e-01, - 3.67808647714624070701e-01, - 3.60413075251609871241e-01, - 3.53015956048925771960e-01, - 3.45618978546330835044e-01, - 3.38223825983006376461e-01, - 3.30832175914426429575e-01, - 3.23445699731881031180e-01, - 3.16066062184803764357e-01, - 3.08694920906066150312e-01, - 3.01333925940378832831e-01, - 2.93984719275965256102e-01, - 2.86648934379644393378e-01, - 2.79328195735489559492e-01, - 2.72024118387182545220e-01, - 2.64738307484245039003e-01, - 2.57472357832259801658e-01, - 2.50227853447243409057e-01, - 2.43006367114305704691e-01, - 2.35809459950733935063e-01, - 2.28638680973647728800e-01, - 2.21495566672345989279e-01, - 2.14381640585498134399e-01, - 2.07298412883298144305e-01, - 2.00247379954717363848e-01, - 1.93230023999986955108e-01, - 1.86247812628430653437e-01, - 1.79302198461779749294e-01, - 1.72394618743085786816e-01, - 1.65526494951356295537e-01, - 1.58699232422028796430e-01, - 1.51914219973401071195e-01, - 1.45172829539132269838e-01, - 1.38476415806921215879e-01, - 1.31826315863480453272e-01, - 1.25223848845901208904e-01, - 1.18670315599523901184e-01, - 1.12166998342411894374e-01, - 1.05715160336527447260e-01, - 9.93160455657086521652e-02, - 9.29708784205405536216e-02, - 8.66808633902153846673e-02, - 8.04471847614677826321e-02, - 7.42710063246745516574e-02, - 6.81534710872001986415e-02, - 6.20957009940759641076e-02, - 5.60987966560835549235e-02, - 5.01638370853247708703e-02, - 4.42918794383505357026e-02, - 3.84839587669171534490e-02, - 3.27410877764400740086e-02, - 2.70642565922108620236e-02, - 2.14544325334371267788e-02, - 1.59125598951669576520e-02, - 1.04395597381551803740e-02, - 5.03632968672305773861e-03, --2.96256265336385191805e-04, --5.55734794075828358179e-03, --1.07461191566687631893e-02, --1.58617678942645466689e-02, --2.09035164602743607498e-02, --2.58706116401622790435e-02, --3.07623248430414844568e-02, --3.55779522382659724178e-02, --4.03168148836769782428e-02, --4.49782588454727128013e-02, --4.95616553096875425699e-02, --5.40664006852556791594e-02, --5.84919166986474642345e-02, --6.28376504800633867154e-02, --6.71030746411782619276e-02, --7.12876873444269476554e-02, --7.53910123638282386738e-02, --7.94125991373483691715e-02, --8.33520228108008270906e-02, --8.72088842732959695914e-02, --9.09828101842390379872e-02, --9.46734529918955292072e-02, --9.82804909435327500589e-02, --1.01803628087157427284e-01, --1.05242594264867719844e-01, --1.08597145097841310535e-01, --1.11867061962988789681e-01, --1.15052151961296145188e-01, --1.18152247877890054228e-01, --1.21167208133862752684e-01, --1.24096916729885473063e-01, --1.26941283181660202750e-01, --1.29700242447243679900e-01, --1.32373754846295377252e-01, --1.34961805971292009287e-01, --1.37464406590764143257e-01, --1.39881592544604443917e-01, --1.42213424631507739937e-01, --1.44459988488595730827e-01, --1.46621394463294696386e-01, --1.48697777477524800682e-01, --1.50689296884269657850e-01, --1.52596136316595465399e-01, --1.54418503529190731527e-01, --1.56156630232500315270e-01, --1.57810771919529219121e-01, --1.59381207685401427021e-01, --1.60868240039743037872e-01, --1.62272194711985145998e-01, --1.63593420449666626659e-01, --1.64832288809824062392e-01, --1.65989193943563151379e-01, --1.67064552373901109572e-01, --1.68058802766975601273e-01, --1.68972405696717037360e-01, --1.69805843403086798027e-01, --1.70559619543971530131e-01, --1.71234258940853617537e-01, --1.71830307318344255307e-01, --1.72348331037702334756e-01, --1.72788916824434257702e-01, --1.73152671490098081231e-01, --1.73440221648409775845e-01, --1.73652213425782242506e-01, --1.73789312166397952319e-01, --1.73852202131942051855e-01, --1.73841586196111674845e-01, --1.73758185534021086793e-01, --1.73602739306629005878e-01, --1.73376004340306061335e-01, --1.73078754801670009478e-01, --1.72711781867818603420e-01, --1.72275893392080048372e-01, --1.71771913565416961545e-01, --1.71200682573611373538e-01, --1.70563056250360139954e-01, --1.69859905726417126370e-01, --1.69092117074913228514e-01, --1.68260590952989147473e-01, --1.67366242239875284703e-01, --1.66409999671557895518e-01, --1.65392805472166642966e-01, --1.64315614982222552021e-01, --1.63179396283883837437e-01, --1.61985129823331186483e-01, --1.60733808030429803360e-01, --1.59426434935813571281e-01, --1.58064025785527417778e-01, --1.56647606653372045704e-01, --1.55178214051094831571e-01, --1.53656894536566474008e-01, --1.52084704320088470730e-01, --1.50462708868975059140e-01, --1.48791982510548842500e-01, --1.47073608033699704256e-01, --1.45308676289147314931e-01, --1.43498285788550977715e-01, --1.41643542302611558092e-01, --1.39745558458309881988e-01, --1.37805453335422323224e-01, --1.35824352062461073398e-01, --1.33803385412180564362e-01, --1.31743689396791985313e-01, --1.29646404863030306753e-01, --1.27512677087215337002e-01, --1.25343655370452389253e-01, --1.23140492634104758984e-01, --1.20904345015691472298e-01, --1.18636371465341922127e-01, --1.16337733342949820048e-01, --1.14009594016166518338e-01, --1.11653118459372716065e-01, --1.09269472853762789066e-01, --1.06859824188683741331e-01, --1.04425339864360325337e-01, --1.01967187296145456177e-01, --9.94865335204263567803e-02, --9.69845448023236023083e-02, --9.44623862453117940641e-02, --9.19212214028948121358e-02, --8.93622118924671249296e-02, --8.67865170114848205607e-02, --8.41952933560805999447e-02, --8.15896944422443981537e-02, --7.89708703296961439522e-02, --7.63399672485739477779e-02, --7.36981272290610500697e-02, --7.10464877340710454501e-02, --6.83861812951113146042e-02, --6.57183351514422919859e-02, --6.30440708926501142129e-02, --6.03645041047437408421e-02, --5.76807440198948140342e-02, --5.49938931699267691267e-02, --5.23050470436661057994e-02, --4.96152937482609926456e-02, --4.69257136745778041798e-02, --4.42373791667729082677e-02, --4.15513541961495605492e-02, --3.88686940393953503370e-02, --3.61904449613011935938e-02, --3.35176439020573244121e-02, --3.08513181692228674602e-02, --2.81924851344595717162e-02, --2.55421519351213023585e-02, --2.29013151807887539724e-02, --2.02709606648342685609e-02, --1.76520630811025022733e-02, --1.50455857457888787787e-02, --1.24524803245954687053e-02, --9.87368656524285036313e-03, --7.31013203541311037958e-03, --4.76273186619807602227e-03, --2.23238850112297869746e-03, - 2.80008549183706099625e-04, - 2.77358294660976899965e-03, - 5.24747175940274562800e-03, - 7.70082569017439908660e-03, - 1.01328092980087648006e-02, - 1.25426012146140665460e-02, - 1.49293943544662570388e-02, - 1.72923961188884665885e-02, - 1.96308285940195309527e-02, - 2.19439287426209730936e-02, - 2.42309485896793734561e-02, - 2.64911554017603391442e-02, - 2.87238318600733545660e-02, - 3.09282762272103349532e-02, - 3.31038025075217068327e-02, - 3.52497406010981520486e-02, - 3.73654364513253609004e-02, - 3.94502521859858221176e-02, - 4.15035662518817155542e-02, - 4.35247735429537541130e-02, - 4.55132855218787699125e-02, - 4.74685303351244439196e-02, - 4.93899529214478216765e-02, - 5.12770151138242716304e-02, - 5.31291957347935772660e-02, - 5.49459906852194576721e-02, - 5.67269130264521220797e-02, - 5.84714930558940249039e-02, - 6.01792783759655322551e-02, - 6.18498339564735599705e-02, - 6.34827421903864652641e-02, - 6.50776029430226859995e-02, - 6.66340335946605799577e-02, - 6.81516690765814614483e-02, - 6.96301619005592065115e-02, - 7.10691821818139612965e-02, - 7.24684176554465098175e-02, - 7.38275736863740761340e-02, - 7.51463732727930683319e-02, - 7.64245570431912463194e-02, - 7.76618832469397474272e-02, - 7.88581277384926976337e-02, - 8.00130839552289779837e-02, - 8.11265628889681067459e-02, - 8.21983930512013155623e-02, - 8.32284204320703352442e-02, - 8.42165084531432683868e-02, - 8.51625379140240473808e-02, - 8.60664069328434949702e-02, - 8.69280308806818224898e-02, - 8.77473423099686122839e-02, - 8.85242908769151987114e-02, - 8.92588432580306151420e-02, - 8.99509830607803234637e-02, - 9.06007107284422380511e-02, - 9.12080434392217309636e-02, - 9.17730149996878741270e-02, - 9.22956757325926607782e-02, - 9.27760923591415126443e-02, - 9.32143478757788968014e-02, - 9.36105414255621187669e-02, - 9.39647881641913207407e-02, - 9.42772191207702781046e-02, - 9.45479810533706027664e-02, - 9.47772362994778183598e-02, - 9.49651626213951355338e-02, - 9.51119530466846413441e-02, - 9.52178157037280176178e-02, - 9.52829736524876819148e-02, - 9.53076647105531166160e-02, - 9.52921412745576373871e-02, - 9.52366701370536278271e-02, - 9.51415322989309503177e-02, - 9.50070227774735681647e-02, - 9.48334504101390751707e-02, - 9.46211376541590265532e-02, - 9.43704203820504156086e-02, - 9.40816476731309581094e-02, - 9.37551816011396865758e-02, - 9.33913970180541563870e-02, - 9.29906813342047527948e-02, - 9.25534342947849225647e-02, - 9.20800677528557931506e-02, - 9.15710054389489019888e-02, - 9.10266827273659706599e-02, - 9.04475463992783224043e-02, - 8.98340544027328158361e-02, - 8.91866756096650198371e-02, - 8.85058895700238101867e-02, - 8.77921862631190763615e-02, - 8.70460658462897246546e-02, - 8.62680384010083983748e-02, - 8.54586236765221690659e-02, - 8.46183508311429133375e-02, - 8.37477581712920277068e-02, - 8.28473928884114751980e-02, - 8.19178107938471483651e-02, - 8.09595760518180135312e-02, - 7.99732609105757996648e-02, - 7.89594454318716387764e-02, - 7.79187172188340326784e-02, - 7.68516711423724852015e-02, - 7.57589090662164482692e-02, - 7.46410395707000073884e-02, - 7.34986776754032733461e-02, - 7.23324445607601979047e-02, - 7.11429672887474440213e-02, - 6.99308785227581580779e-02, - 6.86968162467783832748e-02, - 6.74414234839716131287e-02, - 6.61653480147834510694e-02, - 6.48692420946761771905e-02, - 6.35537621716019962559e-02, - 6.22195686033254202751e-02, - 6.08673253747022482973e-02, - 5.94976998150253330588e-02, - 5.81113623155428762890e-02, - 5.67089860472591994478e-02, - 5.52912466791220663653e-02, - 5.38588220967053943333e-02, - 5.24123921214928872869e-02, - 5.09526382308646275110e-02, - 4.94802432788957607945e-02, - 4.79958912180662375380e-02, - 4.65002668219884549017e-02, - 4.49940554092515265783e-02, - 4.34779425684853407241e-02, - 4.19526138847447563340e-02, - 4.04187546673120054463e-02, - 3.88770496790168534895e-02, - 3.73281828671714888124e-02, - 3.57728370962169389680e-02, - 3.42116938821758476141e-02, - 3.26454331290065291604e-02, - 3.10747328669506231447e-02, - 2.95002689929673225788e-02, - 2.79227150133440210622e-02, - 2.63427417885741359249e-02, - 2.47610172805882329528e-02, - 2.31782063024293799591e-02, - 2.15949702704538760989e-02, - 2.00119669591453143431e-02, - 1.84298502586232419709e-02, - 1.68492699349288496680e-02, - 1.52708713931675090641e-02, - 1.36952954435869880129e-02, - 1.21231780706691841254e-02, - 1.05551502053105091677e-02, - 8.99183750016553651196e-03, - 7.43386010822696258193e-03, - 5.88183246471273707412e-03, - 4.33636307232945251988e-03, - 2.79805428998205086427e-03, - 1.26750212499337003291e-03, --2.54703971099550386531e-04, --1.76798130311027175757e-03, --3.27175412906725469539e-03, --4.76545385331804925710e-03, --6.24851921581533794464e-03, --7.72039647752874400727e-03, --9.18053960192777122884e-03, --1.06284104324833178490e-02, --1.20634788661366718077e-02, --1.34852230226875247771e-02, --1.48931294100519973078e-02, --1.62866930853476296615e-02, --1.76654178117594401476e-02, --1.90288162111466874205e-02, --2.03764099123495759369e-02, --2.17077296951579609696e-02, --2.30223156299061669505e-02, --2.43197172126588360974e-02, --2.55994934959561624976e-02, --2.68612132150869431513e-02, --2.81044549098614510063e-02, --2.93288070418574950415e-02, --3.05338681071131295974e-02, --3.17192467442452205595e-02, --3.28845618379712614776e-02, --3.40294426180154721551e-02, --3.51535287533818185945e-02, --3.62564704419792716017e-02, --3.73379284955845242022e-02, --3.83975744201309962533e-02, --3.94350904913155775322e-02, --4.04501698255130062720e-02, --4.14425164459938585870e-02, --4.24118453444415760556e-02, --4.33578825377650758921e-02, --4.42803651202084772032e-02, --4.51790413107587551789e-02, --4.60536704958539877541e-02, --4.69040232673985507672e-02, --4.77298814560914094751e-02, --4.85310381600771723054e-02, --4.93072977689298017068e-02, --5.00584759829825892696e-02, --5.07843998280173986037e-02, --5.14849076653303427964e-02, --5.21598491971914657306e-02, --5.28090854677170859488e-02, --5.34324888591782357072e-02, --5.40299430837655400572e-02, --5.46013431708381041796e-02, --5.51465954496810906171e-02, --5.56656175277993395256e-02, --5.61583382647804357779e-02, --5.66246977417538960298e-02, --5.70646472264832865795e-02, --5.74781491341238848225e-02, --5.78651769836829588112e-02, --5.82257153502198851469e-02, --5.85597598128258789441e-02, --5.88673168984241990120e-02, --5.91484040214318093631e-02, --5.94030494193287308957e-02, --5.96312920841784027681e-02, --5.98331816901454746627e-02, --6.00087785170606569096e-02, --6.01581533700810480725e-02, --6.02813874954959694197e-02, --6.03785724927326447609e-02, --6.04498102226119424230e-02, --6.04952127119116611631e-02, --6.05149020542914278797e-02, --6.05090103076376881197e-02, --6.04776793878847099273e-02, --6.04210609593744951695e-02, --6.03393163218124903291e-02, --6.02326162938837256222e-02, --6.01011410935896536745e-02, --5.99450802153716350018e-02, --5.97646323040843391317e-02, --5.95600050258849322837e-02, --5.93314149361059764431e-02, --5.90790873441773764507e-02, --5.88032561756684640786e-02, --5.85041638315173181950e-02, --5.81820610445198463379e-02, --5.78372067331465664064e-02, --5.74698678527617162759e-02, --5.70803192443151696800e-02, --5.66688434805820984153e-02, --5.62357307100216502471e-02, --5.57812784983319834287e-02, --5.53057916677746758127e-02, --5.48095821343453915020e-02, --5.42929687428649263015e-02, --5.37562771000702349644e-02, --5.31998394057807341695e-02, --5.26239942822169029513e-02, --5.20290866015511582754e-02, --5.14154673117670768523e-02, --5.07834932609073572141e-02, --5.01335270197884388943e-02, --4.94659367032617980353e-02, --4.87810957901005926018e-02, --4.80793829415919610204e-02, --4.73611818189140221236e-02, --4.66268808993793651418e-02, --4.58768732916221277929e-02, --4.51115565498113532672e-02, --4.43313324869706107401e-02, --4.35366069874822472774e-02, --4.27277898188581847783e-02, --4.19052944428566706558e-02, --4.10695378260253277092e-02, --4.02209402497498702544e-02, --3.93599251198885058400e-02, --3.84869187760717781921e-02, --3.76023503007467674308e-02, --3.67066513280452297319e-02, --3.58002558525536487832e-02, --3.48836000380640318119e-02, --3.39571220263849699039e-02, --3.30212617462878818553e-02, --3.20764607226682249563e-02, --3.11231618859974003277e-02, --3.01618093821427596390e-02, --2.91928483826300218251e-02, --2.82167248954252464221e-02, --2.72338855763107207109e-02, --2.62447775409285488646e-02, --2.52498481775659533444e-02, --2.42495449607560524530e-02, --2.32443152657647901516e-02, --2.22346061840382018537e-02, --2.12208643396787077773e-02, --2.02035357070221716080e-02, --1.91830654293842946256e-02, --1.81598976390459701524e-02, --1.71344752785447841659e-02, --1.61072399233397958729e-02, --1.50786316059164128556e-02, --1.40490886413957953571e-02, --1.30190474547137412242e-02, --1.19889424094323342185e-02, --1.09592056382471266657e-02, --9.93026687525074697183e-03, --8.90255329001433948211e-03, --7.87648932354562125724e-03, --6.85249652618241146540e-03, --5.83099339747908569642e-03, --4.81239522814202146106e-03, --3.79711394406930576734e-03, --2.78555795254968683455e-03, --1.77813199067227692071e-03, --7.75236976000132386663e-04, - 2.227301404421266... [truncated message content] |
From: <sag...@us...> - 2013-03-19 21:44:35
|
Revision: 1603 http://sourceforge.net/p/modplug/code/1603 Author: saga-games Date: 2013-03-19 21:44:23 +0000 (Tue, 19 Mar 2013) Log Message: ----------- [Ref] Removed CModDoc::SetPause (m_bPause was never read) [Ref] Changed all CSoundFile* to CSoundFile& in ctrl_seq [Ref] Removed unused modplug player code [Ref] Various small changes here and there. Modified Paths: -------------- trunk/OpenMPT/common/typedefs.h trunk/OpenMPT/mptrack/Ctrl_pat.h trunk/OpenMPT/mptrack/Ctrl_seq.cpp trunk/OpenMPT/mptrack/KeyConfigDlg.h trunk/OpenMPT/mptrack/MainFrm.cpp trunk/OpenMPT/mptrack/Mainfrm.h trunk/OpenMPT/mptrack/Moddoc.cpp trunk/OpenMPT/mptrack/Moddoc.h trunk/OpenMPT/soundlib/Fastmix.cpp trunk/OpenMPT/soundlib/LOAD_DBM.CPP trunk/OpenMPT/soundlib/LOAD_DSM.CPP trunk/OpenMPT/soundlib/Load_mdl.cpp trunk/OpenMPT/soundlib/Load_med.cpp trunk/OpenMPT/soundlib/Load_ptm.cpp trunk/OpenMPT/soundlib/Sndfile.cpp trunk/OpenMPT/soundlib/Sndfile.h trunk/OpenMPT/soundlib/Sndmix.cpp Modified: trunk/OpenMPT/common/typedefs.h =================================================================== --- trunk/OpenMPT/common/typedefs.h 2013-03-19 20:56:21 UTC (rev 1602) +++ trunk/OpenMPT/common/typedefs.h 2013-03-19 21:44:23 UTC (rev 1603) @@ -28,7 +28,7 @@ #define CountOf(x) (sizeof(x)/sizeof(x[0])) #endif -//Compile time assert. +// Compile time assert. #ifndef C_ASSERT #define C_ASSERT(expr) typedef char __C_ASSERT__[(expr)?1:-1] #endif @@ -38,6 +38,19 @@ #define static_assert(expr, msg) C_ASSERT(expr) #endif +// Advanced inline attributes +#if defined(_MSC_VER) +#define forceinline __forceinline +#define noinline __declspec(noinline) +#elif defined(__GNUC__) +#define forceinline __attribute__((always_inline)) inline +#define noinline __attribute__((noinline)) +#else +#define forceinline inline +#define noinline +#endif + + typedef __int8 int8; typedef __int16 int16; typedef __int32 int32; Modified: trunk/OpenMPT/mptrack/Ctrl_pat.h =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_pat.h 2013-03-19 20:56:21 UTC (rev 1602) +++ trunk/OpenMPT/mptrack/Ctrl_pat.h 2013-03-19 21:44:23 UTC (rev 1603) @@ -60,7 +60,8 @@ if(isSelectionKeyPressed && m_nScrollPos2nd == ORDERINDEX_INVALID) m_nScrollPos2nd = m_nScrollPos; else if(!isSelectionKeyPressed && m_nScrollPos2nd != ORDERINDEX_INVALID) m_nScrollPos2nd = ORDERINDEX_INVALID; }; - bool SetCurSel(ORDERINDEX sel, bool bEdit = true, bool bShiftClick = false, bool bIgnoreCurSel = false); + // Why VC wants to inline this huge function is beyond my understanding... + noinline bool SetCurSel(ORDERINDEX sel, bool bEdit = true, bool bShiftClick = false, bool bIgnoreCurSel = false); BOOL UpdateScrollInfo(); void UpdateInfoText(); int GetFontWidth(); Modified: trunk/OpenMPT/mptrack/Ctrl_seq.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_seq.cpp 2013-03-19 20:56:21 UTC (rev 1602) +++ trunk/OpenMPT/mptrack/Ctrl_seq.cpp 2013-03-19 21:44:23 UTC (rev 1603) @@ -161,19 +161,20 @@ if ((m_pModDoc) && (m_cxFont > 0) && (rcClient.right > 0)) { CRect rect; - CSoundFile *pSndFile = m_pModDoc->GetSoundFile(); + CSoundFile &sndFile = m_pModDoc->GetrSoundFile(); SCROLLINFO info; UINT nPage; int nMax = 0; - if(pSndFile->GetType() & (MOD_TYPE_MOD | MOD_TYPE_XM)) - { // With MOD / XM, cut shown sequence to first '---' item... - nMax = pSndFile->Order.GetLengthFirstEmpty(); + if(sndFile.GetType() & (MOD_TYPE_MOD | MOD_TYPE_XM)) + { + // With MOD / XM, cut shown sequence to first '---' item... + nMax = sndFile.Order.GetLengthFirstEmpty(); + } else + { + // ...for S3M/IT/MPT, show sequence until the last used item. + nMax = sndFile.Order.GetLengthTailTrimmed(); } - else - { // ...for S3M/IT/MPT, show sequence until the last used item. - nMax = pSndFile->Order.GetLengthTailTrimmed(); - } GetScrollInfo(SB_HORZ, &info, SIF_PAGE|SIF_RANGE); info.fMask = SIF_PAGE|SIF_RANGE; @@ -266,8 +267,8 @@ else result.lastOrd = m_nScrollPos2nd; } - LimitMax(result.firstOrd, m_pModDoc->GetSoundFile()->Order.GetLastIndex()); - LimitMax(result.lastOrd, m_pModDoc->GetSoundFile()->Order.GetLastIndex()); + LimitMax(result.firstOrd, m_pModDoc->GetrSoundFile().Order.GetLastIndex()); + LimitMax(result.lastOrd, m_pModDoc->GetrSoundFile().Order.GetLastIndex()); return result; } @@ -276,10 +277,10 @@ //------------------------------------------------------------------------------------------ { CMainFrame *pMainFrm = CMainFrame::GetMainFrame(); - CSoundFile *pSndFile = m_pModDoc->GetSoundFile(); + CSoundFile &sndFile = m_pModDoc->GetrSoundFile(); ORDERINDEX &nOrder = bShiftClick ? m_nScrollPos2nd : m_nScrollPos; - if ((sel < 0) || (sel >= pSndFile->Order.GetLength()) || (!m_pParent) || (!pMainFrm)) return false; + if ((sel < 0) || (sel >= sndFile.Order.GetLength()) || (!m_pParent) || (!pMainFrm)) return false; if (!bIgnoreCurSel && sel == nOrder) return true; const ORDERINDEX nShownLength = GetLength(); InvalidateSelection(); @@ -312,41 +313,41 @@ InvalidateSelection(); if ((m_pParent) && (m_pModDoc) && (bEdit)) { - PATTERNINDEX n = pSndFile->Order[m_nScrollPos]; - if ((n < pSndFile->Patterns.Size()) && (pSndFile->Patterns[n]) && !bShiftClick) + PATTERNINDEX n = sndFile.Order[m_nScrollPos]; + if ((n < sndFile.Patterns.Size()) && (sndFile.Patterns[n]) && !bShiftClick) { CriticalSection cs; bool isPlaying = (pMainFrm->GetModPlaying() == m_pModDoc); bool changedPos = false; - if(isPlaying && pSndFile->m_SongFlags[SONG_PATTERNLOOP]) + if(isPlaying && sndFile.m_SongFlags[SONG_PATTERNLOOP]) { // update channel parameters and play time m_pModDoc->SetElapsedTime(m_nScrollPos, 0); - pSndFile->m_nPattern = n; - pSndFile->m_nCurrentOrder = pSndFile->m_nNextOrder = m_nScrollPos; + sndFile.m_nPattern = n; + sndFile.m_nCurrentOrder = sndFile.m_nNextOrder = m_nScrollPos; pMainFrm->ResetNotificationBuffer(); - pSndFile->m_nNextRow = 0; + sndFile.m_nNextRow = 0; changedPos = true; } else if(m_pParent->GetFollowSong()) { - SongFlags pausedFlags = pSndFile->m_SongFlags & (SONG_PAUSED | SONG_STEP | SONG_PATTERNLOOP); + SongFlags pausedFlags = sndFile.m_SongFlags & (SONG_PAUSED | SONG_STEP | SONG_PATTERNLOOP); // update channel parameters and play time m_pModDoc->SetElapsedTime(m_nScrollPos, 0); - pSndFile->m_nCurrentOrder = m_nScrollPos; - pSndFile->SetCurrentOrder(m_nScrollPos); - pSndFile->m_SongFlags.set(pausedFlags); + sndFile.m_nCurrentOrder = m_nScrollPos; + sndFile.SetCurrentOrder(m_nScrollPos); + sndFile.m_SongFlags.set(pausedFlags); if(isPlaying) pMainFrm->ResetNotificationBuffer(); changedPos = true; } - if(changedPos && pSndFile->Order.IsPositionLocked(m_nScrollPos)) + if(changedPos && sndFile.Order.IsPositionLocked(m_nScrollPos)) { // Users wants to go somewhere else, so let him do that. OnUnlockPlayback(); @@ -364,10 +365,9 @@ UINT COrderList::GetCurrentPattern() const //---------------------------------------- { - CSoundFile* pSndFile = m_pModDoc ? m_pModDoc->GetSoundFile() : NULL; - if ((pSndFile) && (m_nScrollPos < pSndFile->Order.GetLength())) + if(m_pModDoc && (m_nScrollPos < m_pModDoc->GetrSoundFile().Order.GetLength())) { - return pSndFile->Order[m_nScrollPos]; + return m_pModDoc->GetrSoundFile().Order[m_nScrollPos]; } return 0; } @@ -437,10 +437,10 @@ // fallthroughs intended. case kcOrderlistNavigateLastSelect: case kcOrderlistNavigateLast: - if((m_pModDoc != nullptr) && (m_pModDoc->GetSoundFile() != nullptr)) + if(m_pModDoc != nullptr) { SetCurSelTo2ndSel(wParam == kcOrderlistNavigateLastSelect || wParam == kcEditSelectAll); - ORDERINDEX nLast = m_pModDoc->GetSoundFile()->Order.GetLengthTailTrimmed(); + ORDERINDEX nLast = m_pModDoc->GetrSoundFile().Order.GetLengthTailTrimmed(); if(nLast > 0) nLast--; SetCurSel(nLast); } @@ -511,17 +511,16 @@ //-------------------------------------------- { if (m_pModDoc == nullptr) return; - CSoundFile *pSndFile = m_pModDoc->GetSoundFile(); - if(pSndFile == nullptr) return; + CSoundFile &sndFile = m_pModDoc->GetrSoundFile(); - PATTERNINDEX nCurNdx = (m_nScrollPos < pSndFile->Order.GetLength()) ? pSndFile->Order[m_nScrollPos] : pSndFile->Order.GetInvalidPatIndex(); + PATTERNINDEX nCurNdx = (m_nScrollPos < sndFile.Order.GetLength()) ? sndFile.Order[m_nScrollPos] : sndFile.Order.GetInvalidPatIndex(); PATTERNINDEX nMaxNdx = 0; - for(PATTERNINDEX nPat = 0; nPat < pSndFile->Patterns.Size(); nPat++) - if (pSndFile->Patterns.IsValidPat(nPat)) nMaxNdx = nPat; + for(PATTERNINDEX nPat = 0; nPat < sndFile.Patterns.Size(); nPat++) + if (sndFile.Patterns.IsValidPat(nPat)) nMaxNdx = nPat; if (enterNum >= 0 && enterNum <= 9) // enter 0...9 { - if (nCurNdx >= pSndFile->Patterns.Size()) nCurNdx = 0; + if (nCurNdx >= sndFile.Patterns.Size()) nCurNdx = 0; nCurNdx = nCurNdx * 10 + static_cast<PATTERNINDEX>(enterNum); STATIC_ASSERT(MAX_PATTERNS < 10000); @@ -530,9 +529,9 @@ if ((nCurNdx >= 10) && (nCurNdx > nMaxNdx)) nCurNdx %= 10; } else if (enterNum == 10) // decrease pattern index { - const PATTERNINDEX nFirstInvalid = pSndFile->GetModSpecifications().hasIgnoreIndex ? pSndFile->Order.GetIgnoreIndex() : pSndFile->Order.GetInvalidPatIndex(); + const PATTERNINDEX nFirstInvalid = sndFile.GetModSpecifications().hasIgnoreIndex ? sndFile.Order.GetIgnoreIndex() : sndFile.Order.GetInvalidPatIndex(); if (nCurNdx == 0) - nCurNdx = pSndFile->Order.GetInvalidPatIndex(); + nCurNdx = sndFile.Order.GetInvalidPatIndex(); else { nCurNdx--; @@ -540,31 +539,31 @@ } } else if (enterNum == 11) // increase pattern index { - if(nCurNdx >= pSndFile->Order.GetInvalidPatIndex()) + if(nCurNdx >= sndFile.Order.GetInvalidPatIndex()) { nCurNdx = 0; } else { nCurNdx++; - const PATTERNINDEX nFirstInvalid = pSndFile->GetModSpecifications().hasIgnoreIndex ? pSndFile->Order.GetIgnoreIndex() : pSndFile->Order.GetInvalidPatIndex(); + const PATTERNINDEX nFirstInvalid = sndFile.GetModSpecifications().hasIgnoreIndex ? sndFile.Order.GetIgnoreIndex() : sndFile.Order.GetInvalidPatIndex(); if(nCurNdx > nMaxNdx && nCurNdx < nFirstInvalid) nCurNdx = nFirstInvalid; } } else if (enterNum == 12) // ignore index (+++) { - if (pSndFile->GetModSpecifications().hasIgnoreIndex) + if (sndFile.GetModSpecifications().hasIgnoreIndex) { - nCurNdx = pSndFile->Order.GetIgnoreIndex(); + nCurNdx = sndFile.Order.GetIgnoreIndex(); } } else if (enterNum == 13) // invalid index (---) { - nCurNdx = pSndFile->Order.GetInvalidPatIndex(); + nCurNdx = sndFile.Order.GetInvalidPatIndex(); } // apply - if (nCurNdx != pSndFile->Order[m_nScrollPos]) + if (nCurNdx != sndFile.Order[m_nScrollPos]) { - pSndFile->Order[m_nScrollPos] = nCurNdx; + sndFile.Order[m_nScrollPos] = nCurNdx; m_pModDoc->SetModified(); m_pModDoc->UpdateAllViews(NULL, HINT_MODSEQUENCE, this); InvalidateSelection(); @@ -585,7 +584,7 @@ { const OrdSelection ordsel = GetCurSel(false); BeginWaitCursor(); - PatternClipboard::Copy(*m_pModDoc->GetSoundFile(), ordsel.firstOrd, ordsel.lastOrd); + PatternClipboard::Copy(m_pModDoc->GetrSoundFile(), ordsel.firstOrd, ordsel.lastOrd); PatternClipboardDialog::UpdateList(); EndWaitCursor(); } @@ -613,14 +612,14 @@ //------------------------------- { CMainFrame *pMainFrm = CMainFrame::GetMainFrame(); - CSoundFile *pSndFile; - if ((pMainFrm != nullptr) && (m_pModDoc != nullptr) && (pSndFile = m_pModDoc->GetSoundFile()) != nullptr && (::GetFocus() == m_hWnd)) + if(pMainFrm != nullptr && m_pModDoc != nullptr && ::GetFocus() == m_hWnd) { + CSoundFile &sndFile = m_pModDoc->GetrSoundFile(); CHAR s[128]; strcpy(s, ""); // MOD orderlist always ends after first empty pattern - const ORDERINDEX nLength = (pSndFile->GetType() & MOD_TYPE_MOD) ? pSndFile->Order.GetLengthFirstEmpty() : pSndFile->Order.GetLengthTailTrimmed(); + const ORDERINDEX nLength = (sndFile.GetType() & MOD_TYPE_MOD) ? sndFile.Order.GetLengthFirstEmpty() : sndFile.Order.GetLengthTailTrimmed(); if(TrackerSettings::Instance().m_dwPatternSetup & PATTERN_HEXDISPLAY) { @@ -631,13 +630,13 @@ wsprintf(s, "Position %d of %d (%02Xh of %02Xh)", m_nScrollPos, nLength, m_nScrollPos, nLength); } - if (m_nScrollPos < pSndFile->Order.GetLength()) + if (m_nScrollPos < sndFile.Order.GetLength()) { - PATTERNINDEX nPat = pSndFile->Order[m_nScrollPos]; - if (nPat < pSndFile->Patterns.Size()) + PATTERNINDEX nPat = sndFile.Order[m_nScrollPos]; + if (nPat < sndFile.Patterns.Size()) { char szpat[MAX_PATTERNNAME] = ""; - if (pSndFile->Patterns[nPat].GetName(szpat) && strcmp(szpat, "")) + if (sndFile.Patterns[nPat].GetName(szpat) && strcmp(szpat, "")) { wsprintf(s + strlen(s), ": %s", szpat); } @@ -673,17 +672,17 @@ UpdateScrollInfo(); BOOL bFocus = (::GetFocus() == m_hWnd); dc.SetBkMode(TRANSPARENT); - CSoundFile *pSndFile = m_pModDoc->GetSoundFile(); GetClientRect(&rcClient); rect = rcClient; ORDERINDEX nIndex = m_nXScroll; OrdSelection selection = GetCurSel(false); - ORDERINDEX maxEntries = pSndFile->GetModSpecifications().ordersMax; - if(pSndFile->Order.GetLength() > maxEntries) + CSoundFile &sndFile = m_pModDoc->GetrSoundFile(); + ORDERINDEX maxEntries = sndFile.GetModSpecifications().ordersMax; + if(sndFile.Order.GetLength() > maxEntries) { // Only computed if potentially needed. - maxEntries = Util::Max(maxEntries, pSndFile->Order.GetLengthTailTrimmed()); + maxEntries = Util::Max(maxEntries, sndFile.Order.GetLengthTailTrimmed()); } // Scrolling the shown orders(the showns rectangles)? @@ -691,7 +690,7 @@ { dc.SetTextColor(colorText); bool bHighLight = ((bFocus) && (nIndex >= selection.firstOrd && nIndex <= selection.lastOrd)); - const PATTERNINDEX nPat = (nIndex < pSndFile->Order.GetLength()) ? pSndFile->Order[nIndex] : PATTERNINDEX_INVALID; + const PATTERNINDEX nPat = (nIndex < sndFile.Order.GetLength()) ? sndFile.Order[nIndex] : PATTERNINDEX_INVALID; if ((rect.right = rect.left + m_cxFont) > rcClient.right) rect.right = rcClient.right; rect.right--; @@ -699,7 +698,7 @@ { // Currently selected order item FillRect(dc.m_hDC, &rect, CMainFrame::brushHighLight); - } else if(pSndFile->Order.IsPositionLocked(nIndex)) + } else if(sndFile.Order.IsPositionLocked(nIndex)) { // "Playback lock" indicator - grey out all order items which aren't played. FillRect(dc.m_hDC, &rect, CMainFrame::brushGray); @@ -720,14 +719,14 @@ LineTo(dc.m_hDC, rect.right, rect.bottom); // Drawing the 'ctrl-transition' indicator - if(nIndex == pSndFile->m_nSeqOverride) + if(nIndex == sndFile.m_nSeqOverride) { MoveToEx(dc.m_hDC, rect.left + 4, rect.bottom - 4, NULL); LineTo(dc.m_hDC, rect.right - 4, rect.bottom - 4); } // Drawing 'playing'-indicator. - if(nIndex == pSndFile->GetCurrentOrder() && CMainFrame::GetMainFrame()->IsPlaying()) + if(nIndex == sndFile.GetCurrentOrder() && CMainFrame::GetMainFrame()->IsPlaying()) { MoveToEx(dc.m_hDC, rect.left + 4, rect.top + 2, NULL); LineTo(dc.m_hDC, rect.right - 4, rect.top + 2); @@ -736,16 +735,16 @@ s[0] = '\0'; if(nIndex < maxEntries && (rect.left + m_cxFont - 4) <= rcClient.right) { - if(nPat == pSndFile->Order.GetInvalidPatIndex()) strcpy(s, "---"); - else if(nPat == pSndFile->Order.GetIgnoreIndex()) strcpy(s, "+++"); - else if(nPat < Util::Max(pSndFile->Patterns.Size(), pSndFile->GetModSpecifications().patternsMax)) wsprintf(s, "%u", nPat); + if(nPat == sndFile.Order.GetInvalidPatIndex()) strcpy(s, "---"); + else if(nPat == sndFile.Order.GetIgnoreIndex()) strcpy(s, "+++"); + else if(nPat < Util::Max(sndFile.Patterns.Size(), sndFile.GetModSpecifications().patternsMax)) wsprintf(s, "%u", nPat); else strcpy(s, "???"); } const COLORREF &textCol = (bHighLight ? colorTextSel // Highlighted pattern - : (pSndFile->Patterns.IsValidPat(nPat) + : (sndFile.Patterns.IsValidPat(nPat) ? colorText // Normal pattern : colorInvalid)); // Non-existent pattern dc.SetTextColor(textCol); @@ -910,9 +909,9 @@ ORDERINDEX n = ORDERINDEX_INVALID; if (rect.PtInRect(pt)) { - CSoundFile *pSndFile = m_pModDoc->GetSoundFile(); + CSoundFile &sndFile = m_pModDoc->GetrSoundFile(); n = GetOrderFromPoint(rect, pt); - if (n >= pSndFile->Order.GetLength() || n >= pSndFile->GetModSpecifications().ordersMax) n = ORDERINDEX_INVALID; + if (n >= sndFile.Order.GetLength() || n >= sndFile.GetModSpecifications().ordersMax) n = ORDERINDEX_INVALID; } if (n != m_nDropPos) { @@ -953,21 +952,21 @@ } if (pt.y >= rect.bottom) return; - CSoundFile *pSndFile = m_pModDoc->GetSoundFile(); - bool multiSelection = (m_nScrollPos2nd != ORDERINDEX_INVALID); if(!multiSelection) SetCurSel(GetOrderFromPoint(rect, pt)); SetFocus(); HMENU hMenu = ::CreatePopupMenu(); if(!hMenu) return; - + + CSoundFile &sndFile = m_pModDoc->GetrSoundFile(); + // Check if at least one pattern in the current selection exists bool patExists = false; OrdSelection selection = GetCurSel(false); for(ORDERINDEX ord = selection.firstOrd; ord <= selection.lastOrd && !patExists; ord++) { - patExists = pSndFile->Patterns.IsValidPat(pSndFile->Order[ord]); + patExists = sndFile.Patterns.IsValidPat(sndFile.Order[ord]); } const DWORD greyed = patExists ? 0 : MF_GRAYED; @@ -989,7 +988,7 @@ { // Only one pattern is selected AppendMenu(hMenu, MF_STRING, ID_ORDERLIST_INSERT, "&Insert Pattern\t" + ih->GetKeyTextFromCommand(kcOrderlistEditInsert)); - if(pSndFile->GetModSpecifications().hasIgnoreIndex) + if(sndFile.GetModSpecifications().hasIgnoreIndex) { AppendMenu(hMenu, MF_STRING, ID_ORDERLIST_INSERT_SEPARATOR, "&Insert Separator\t" + ih->GetKeyTextFromCommand(kcOrderlistPatIgnore)); } @@ -999,41 +998,41 @@ AppendMenu(hMenu, MF_STRING | greyed, ID_ORDERLIST_COPY, "&Duplicate Pattern\t" + ih->GetKeyTextFromCommand(kcDuplicatePattern)); AppendMenu(hMenu, MF_STRING | greyed, ID_PATTERNCOPY, "&Copy Pattern"); AppendMenu(hMenu, MF_STRING, ID_PATTERNPASTE, "P&aste Pattern\t" + ih->GetKeyTextFromCommand(kcEditPaste)); - if (pSndFile->TypeIsIT_MPT_XM()) + if (sndFile.TypeIsIT_MPT_XM()) { AppendMenu(hMenu, MF_SEPARATOR, NULL, ""); AppendMenu(hMenu, MF_STRING | greyed, ID_PATTERN_PROPERTIES, "&Pattern Properties..."); } - if (pSndFile->GetType() == MOD_TYPE_MPT) + if (sndFile.GetType() == MOD_TYPE_MPT) { AppendMenu(hMenu, MF_SEPARATOR, NULL, ""); HMENU menuSequence = ::CreatePopupMenu(); AppendMenu(hMenu, MF_POPUP, (UINT_PTR)menuSequence, TEXT("Sequences")); - const SEQUENCEINDEX numSequences = pSndFile->Order.GetNumSequences(); + const SEQUENCEINDEX numSequences = sndFile.Order.GetNumSequences(); for(SEQUENCEINDEX i = 0; i < numSequences; i++) { CString str; - if(pSndFile->Order.GetSequence(i).m_sName.IsEmpty()) + if(sndFile.Order.GetSequence(i).m_sName.IsEmpty()) str.Format(TEXT("Sequence %u"), i); else - str.Format(TEXT("%u: %s"), i, (LPCTSTR)pSndFile->Order.GetSequence(i).m_sName); - const UINT flags = (pSndFile->Order.GetCurrentSequenceIndex() == i) ? MF_STRING|MF_CHECKED : MF_STRING; + str.Format(TEXT("%u: %s"), i, (LPCTSTR)sndFile.Order.GetSequence(i).m_sName); + const UINT flags = (sndFile.Order.GetCurrentSequenceIndex() == i) ? MF_STRING|MF_CHECKED : MF_STRING; AppendMenu(menuSequence, flags, ID_SEQUENCE_ITEM + i, str); } - if (pSndFile->Order.GetNumSequences() < MAX_SEQUENCES) + if (sndFile.Order.GetNumSequences() < MAX_SEQUENCES) { AppendMenu(menuSequence, MF_STRING, ID_SEQUENCE_ITEM + MAX_SEQUENCES, TEXT("&Duplicate current sequence")); AppendMenu(menuSequence, MF_STRING, ID_SEQUENCE_ITEM + MAX_SEQUENCES + 1, TEXT("&Create empty sequence")); } - if (pSndFile->Order.GetNumSequences() > 1) + if (sndFile.Order.GetNumSequences() > 1) AppendMenu(menuSequence, MF_STRING, ID_SEQUENCE_ITEM + MAX_SEQUENCES + 2, TEXT("D&elete current sequence")); } } AppendMenu(hMenu, MF_SEPARATOR, NULL, ""); - AppendMenu(hMenu, ((selection.firstOrd == pSndFile->m_lockOrderStart && selection.lastOrd == pSndFile->m_lockOrderEnd) ? (MF_STRING | MF_CHECKED) : MF_STRING), ID_ORDERLIST_LOCKPLAYBACK, "&Lock Playback to Selection\t" + ih->GetKeyTextFromCommand(kcOrderlistLockPlayback)); - AppendMenu(hMenu, (pSndFile->m_lockOrderStart == ORDERINDEX_INVALID ? (MF_STRING | MF_GRAYED) : MF_STRING), ID_ORDERLIST_UNLOCKPLAYBACK, "&Unlock Playback\t" + ih->GetKeyTextFromCommand(kcOrderlistUnlockPlayback)); + AppendMenu(hMenu, ((selection.firstOrd == sndFile.m_lockOrderStart && selection.lastOrd == sndFile.m_lockOrderEnd) ? (MF_STRING | MF_CHECKED) : MF_STRING), ID_ORDERLIST_LOCKPLAYBACK, "&Lock Playback to Selection\t" + ih->GetKeyTextFromCommand(kcOrderlistLockPlayback)); + AppendMenu(hMenu, (sndFile.m_lockOrderStart == ORDERINDEX_INVALID ? (MF_STRING | MF_GRAYED) : MF_STRING), ID_ORDERLIST_UNLOCKPLAYBACK, "&Unlock Playback\t" + ih->GetKeyTextFromCommand(kcOrderlistUnlockPlayback)); AppendMenu(hMenu, MF_SEPARATOR, NULL, ""); AppendMenu(hMenu, MF_STRING | greyed, ID_ORDERLIST_RENDER, "Render to &Wave"); @@ -1051,8 +1050,7 @@ { m_nScrollPos2nd = ORDERINDEX_INVALID; SetFocus(); - CSoundFile *pSndFile = m_pModDoc->GetSoundFile(); - m_pParent->SetCurrentPattern(pSndFile->Order[m_nScrollPos]); + m_pParent->SetCurrentPattern(m_pModDoc->GetrSoundFile().Order[m_nScrollPos]); } } @@ -1120,7 +1118,7 @@ // insert the same order(s) after the currently selected order(s) if (m_pModDoc) { - CSoundFile *pSndFile = m_pModDoc->GetSoundFile(); + CSoundFile &sndFile = m_pModDoc->GetrSoundFile(); const OrdSelection selection = GetCurSel(false); const ORDERINDEX nInsertCount = selection.lastOrd - selection.firstOrd, nInsertEnd = selection.lastOrd; @@ -1128,25 +1126,25 @@ for(ORDERINDEX i = 0; i <= nInsertCount; i++) { // Checking whether there is some pattern at the end of orderlist. - if (pSndFile->Order.GetLength() < 1 || pSndFile->Order.Last() < pSndFile->Patterns.Size()) + if (sndFile.Order.GetLength() < 1 || sndFile.Order.Last() < sndFile.Patterns.Size()) { - if(pSndFile->Order.GetLength() < pSndFile->GetModSpecifications().ordersMax) - pSndFile->Order.Append(); + if(sndFile.Order.GetLength() < sndFile.GetModSpecifications().ordersMax) + sndFile.Order.Append(); } - for(int j = pSndFile->Order.GetLastIndex(); j > nInsertEnd; j--) - pSndFile->Order[j] = pSndFile->Order[j - 1]; + for(int j = sndFile.Order.GetLastIndex(); j > nInsertEnd; j--) + sndFile.Order[j] = sndFile.Order[j - 1]; } // now that there is enough space in the order list, overwrite the orders for(ORDERINDEX i = 0; i <= nInsertCount; i++) { - if(nInsertEnd + i + 1 < pSndFile->GetModSpecifications().ordersMax + if(nInsertEnd + i + 1 < sndFile.GetModSpecifications().ordersMax && - nInsertEnd + i + 1 < pSndFile->Order.GetLength()) - pSndFile->Order[nInsertEnd + i + 1] = pSndFile->Order[nInsertEnd - nInsertCount + i]; + nInsertEnd + i + 1 < sndFile.Order.GetLength()) + sndFile.Order[nInsertEnd + i + 1] = sndFile.Order[nInsertEnd - nInsertCount + i]; } - m_nScrollPos = min(nInsertEnd + 1, pSndFile->Order.GetLastIndex()); + m_nScrollPos = min(nInsertEnd + 1, sndFile.Order.GetLastIndex()); if(nInsertCount > 0) - m_nScrollPos2nd = min(m_nScrollPos + nInsertCount, pSndFile->Order.GetLastIndex()); + m_nScrollPos2nd = min(m_nScrollPos + nInsertCount, sndFile.Order.GetLastIndex()); else m_nScrollPos2nd = ORDERINDEX_INVALID; @@ -1168,27 +1166,27 @@ // Insert a separator pattern after the current pattern, don't move order list cursor if (m_pModDoc) { - CSoundFile *pSndFile = m_pModDoc->GetSoundFile(); + CSoundFile &sndFile = m_pModDoc->GetrSoundFile(); const OrdSelection selection = GetCurSel(true); ORDERINDEX insertPos = selection.firstOrd; - if(pSndFile->Order[selection.firstOrd] != pSndFile->Order.GetInvalidPatIndex()) + if(sndFile.Order[selection.firstOrd] != sndFile.Order.GetInvalidPatIndex()) { // If we're not inserting on a stop (---) index, we move on by one position. insertPos++; // Checking whether there is some pattern at the end of orderlist. - if (pSndFile->Order.GetLength() < 1 || pSndFile->Order.Last() < pSndFile->Patterns.Size()) + if (sndFile.Order.GetLength() < 1 || sndFile.Order.Last() < sndFile.Patterns.Size()) { - if(pSndFile->Order.GetLength() < pSndFile->GetModSpecifications().ordersMax) - pSndFile->Order.Append(); + if(sndFile.Order.GetLength() < sndFile.GetModSpecifications().ordersMax) + sndFile.Order.Append(); } - for(int j = pSndFile->Order.GetLastIndex(); j > selection.firstOrd; j--) - pSndFile->Order[j] = pSndFile->Order[j - 1]; + for(int j = sndFile.Order.GetLastIndex(); j > selection.firstOrd; j--) + sndFile.Order[j] = sndFile.Order[j - 1]; } - pSndFile->Order[insertPos] = pSndFile->Order.GetIgnoreIndex(); + sndFile.Order[insertPos] = sndFile.Order.GetIgnoreIndex(); InvalidateRect(NULL, FALSE); m_pModDoc->SetModified(); @@ -1210,21 +1208,21 @@ { if (m_pModDoc) { - CSoundFile *pSndFile = m_pModDoc->GetSoundFile(); + CSoundFile &sndFile = m_pModDoc->GetrSoundFile(); OrdSelection selection = GetCurSel(false); // remove selection m_nScrollPos2nd = ORDERINDEX_INVALID; - pSndFile->Order.Remove(selection.firstOrd, selection.lastOrd); + sndFile.Order.Remove(selection.firstOrd, selection.lastOrd); m_pModDoc->SetModified(); InvalidateRect(NULL, FALSE); m_pModDoc->UpdateAllViews(NULL, HINT_MODSEQUENCE, this); SetCurSel(selection.firstOrd); - PATTERNINDEX nNewPat = pSndFile->Order[selection.firstOrd]; - if ((nNewPat < pSndFile->Patterns.Size()) && (pSndFile->Patterns[nNewPat] != nullptr) && (m_pParent)) + PATTERNINDEX nNewPat = sndFile.Order[selection.firstOrd]; + if ((nNewPat < sndFile.Patterns.Size()) && (sndFile.Patterns[nNewPat] != nullptr) && (m_pParent)) { m_pParent->SetCurrentPattern(nNewPat); } @@ -1308,16 +1306,15 @@ LPDRAGONDROP pDropInfo = (LPDRAGONDROP)lParam; ORDERINDEX posdest; BOOL canDrop; - CSoundFile *pSndFile; CPoint pt; if ((!pDropInfo) || (!m_pModDoc) || (m_pModDoc != pDropInfo->pModDoc) || (!m_cxFont)) return FALSE; - pSndFile = m_pModDoc->GetSoundFile(); + CSoundFile &sndFile = m_pModDoc->GetrSoundFile(); canDrop = FALSE; switch(pDropInfo->dwDropType) { case DRAGONDROP_ORDER: - if (pDropInfo->dwDropItem >= pSndFile->Order.size()) break; + if (pDropInfo->dwDropItem >= sndFile.Order.size()) break; case DRAGONDROP_PATTERN: canDrop = TRUE; break; @@ -1327,15 +1324,15 @@ ScreenToClient(&pt); if (pt.x < 0) pt.x = 0; posdest = static_cast<ORDERINDEX>(m_nXScroll + (pt.x / m_cxFont)); - if (posdest >= pSndFile->Order.GetLength()) return FALSE; + if (posdest >= sndFile.Order.GetLength()) return FALSE; switch(pDropInfo->dwDropType) { case DRAGONDROP_PATTERN: - pSndFile->Order[posdest] = static_cast<PATTERNINDEX>(pDropInfo->dwDropItem); + sndFile.Order[posdest] = static_cast<PATTERNINDEX>(pDropInfo->dwDropItem); break; case DRAGONDROP_ORDER: - pSndFile->Order[posdest] = pSndFile->Order[pDropInfo->dwDropItem]; + sndFile.Order[posdest] = sndFile.Order[pDropInfo->dwDropItem]; break; } if (canDrop) @@ -1362,27 +1359,25 @@ CriticalSection cs; CMainFrame::GetMainFrame()->ResetNotificationBuffer(); - CSoundFile& rSf = *m_pModDoc->GetSoundFile(); + CSoundFile &sndFile = m_pModDoc->GetrSoundFile(); if(nSeq == MAX_SEQUENCES + 2) { - CString strParam; strParam.Format(TEXT("%u: %s"), rSf.Order.GetCurrentSequenceIndex(), (LPCTSTR)rSf.Order.m_sName); + CString strParam; strParam.Format(TEXT("%u: %s"), sndFile.Order.GetCurrentSequenceIndex(), (LPCTSTR)sndFile.Order.m_sName); CString str; AfxFormatString1(str, IDS_CONFIRM_SEQUENCE_DELETE, strParam); if (Reporting::Confirm(str) == cnfYes) - rSf.Order.RemoveSequence(); + sndFile.Order.RemoveSequence(); else - { return; - } } else if(nSeq == MAX_SEQUENCES || nSeq == MAX_SEQUENCES + 1) - rSf.Order.AddSequence((nSeq == MAX_SEQUENCES)); - else if(nSeq < rSf.Order.GetNumSequences()) - rSf.Order.SetSequence(nSeq); - ORDERINDEX nPosCandidate = rSf.Order.GetLengthTailTrimmed() - 1; + sndFile.Order.AddSequence((nSeq == MAX_SEQUENCES)); + else if(nSeq < sndFile.Order.GetNumSequences()) + sndFile.Order.SetSequence(nSeq); + ORDERINDEX nPosCandidate = sndFile.Order.GetLengthTailTrimmed() - 1; SetCurSel(min(m_nScrollPos, nPosCandidate), true, false, true); if (m_pParent) - m_pParent->SetCurrentPattern(rSf.Order[m_nScrollPos]); + m_pParent->SetCurrentPattern(sndFile.Order[m_nScrollPos]); UpdateScrollInfo(); // This won't make sense anymore in the new sequence. @@ -1404,35 +1399,34 @@ if(!rect.PtInRect(pt)) return; if(m_pModDoc == nullptr) return; - CSoundFile *pSndFile = m_pModDoc->GetSoundFile(); - if(pSndFile == nullptr) return; + CSoundFile &sndFile = m_pModDoc->GetrSoundFile(); - const PATTERNINDEX ignoreIndex = pSndFile->Order.GetIgnoreIndex(); - const PATTERNINDEX stopIndex = pSndFile->Order.GetInvalidPatIndex(); - const ORDERINDEX length = pSndFile->Order.GetLength(); + const PATTERNINDEX ignoreIndex = sndFile.Order.GetIgnoreIndex(); + const PATTERNINDEX stopIndex = sndFile.Order.GetInvalidPatIndex(); + const ORDERINDEX length = sndFile.Order.GetLength(); ORDERINDEX order = GetOrderFromPoint(rect, pt); // If this is not a playable order item, find the next valid item. - while(order < length && (pSndFile->Order[order] == ignoreIndex || pSndFile->Order[order] == stopIndex)) + while(order < length && (sndFile.Order[order] == ignoreIndex || sndFile.Order[order] == stopIndex)) { order++; } if(order < length) { - if(pSndFile->m_nSeqOverride == order) + if(sndFile.m_nSeqOverride == order) { // This item is already queued: Dequeue it. - pSndFile->m_nSeqOverride = ORDERINDEX_INVALID; + sndFile.m_nSeqOverride = ORDERINDEX_INVALID; } else { - if(pSndFile->Order.IsPositionLocked(order)) + if(sndFile.Order.IsPositionLocked(order)) { // Users wants to go somewhere else, so let him do that. OnUnlockPlayback(); } - pSndFile->m_nSeqOverride = order; + sndFile.m_nSeqOverride = order; } InvalidateRect(NULL, FALSE); } @@ -1442,16 +1436,16 @@ void COrderList::OnLockPlayback() //------------------------------- { - CSoundFile *pSndFile = m_pModDoc->GetSoundFile(); + CSoundFile &sndFile = m_pModDoc->GetrSoundFile(); OrdSelection selection = GetCurSel(false); - if(selection.firstOrd == pSndFile->m_lockOrderStart && selection.lastOrd == pSndFile->m_lockOrderEnd) + if(selection.firstOrd == sndFile.m_lockOrderStart && selection.lastOrd == sndFile.m_lockOrderEnd) { OnUnlockPlayback(); } else { - pSndFile->m_lockOrderStart = selection.firstOrd; - pSndFile->m_lockOrderEnd = selection.lastOrd; + sndFile.m_lockOrderStart = selection.firstOrd; + sndFile.m_lockOrderEnd = selection.lastOrd; InvalidateRect(NULL, FALSE); } } @@ -1460,7 +1454,7 @@ void COrderList::OnUnlockPlayback() //---------------------------------- { - CSoundFile *pSndFile = m_pModDoc->GetSoundFile(); - pSndFile->m_lockOrderStart = pSndFile->m_lockOrderEnd = ORDERINDEX_INVALID; + CSoundFile &sndFile = m_pModDoc->GetrSoundFile(); + sndFile.m_lockOrderStart = sndFile.m_lockOrderEnd = ORDERINDEX_INVALID; InvalidateRect(NULL, FALSE); } Modified: trunk/OpenMPT/mptrack/KeyConfigDlg.h =================================================================== --- trunk/OpenMPT/mptrack/KeyConfigDlg.h 2013-03-19 20:56:21 UTC (rev 1602) +++ trunk/OpenMPT/mptrack/KeyConfigDlg.h 2013-03-19 21:44:23 UTC (rev 1603) @@ -9,7 +9,6 @@ #pragma once -#include "stdafx.h" #include "mptrack.h" #include "MainFrm.h" #include "mpdlgs.h" Modified: trunk/OpenMPT/mptrack/MainFrm.cpp =================================================================== --- trunk/OpenMPT/mptrack/MainFrm.cpp 2013-03-19 20:56:21 UTC (rev 1602) +++ trunk/OpenMPT/mptrack/MainFrm.cpp 2013-03-19 21:44:23 UTC (rev 1603) @@ -1341,9 +1341,6 @@ if (bPaused) { pSndFile->m_SongFlags.set(SONG_PAUSED); - } else - { - pModDoc->SetPause(FALSE); } } pSndFile->SetRepeatCount((TrackerSettings::Instance().gbLoopSong) ? -1 : 0); @@ -1388,7 +1385,6 @@ } if (m_pModPlaying) { - m_pModPlaying->SetPause(TRUE); m_wndTree.UpdatePlayPos(m_pModPlaying, NULL); } if (m_pSndFile) @@ -1422,10 +1418,8 @@ //---------------------------------------- { if ((pModDoc) && (pModDoc != m_pModPlaying)) return FALSE; - CModDoc *pPlay = m_pModPlaying; CSoundFile *pSndFile = m_pSndFile; PauseMod(); - if (pPlay) pPlay->SetPause(FALSE); if (pSndFile) pSndFile->SetCurrentPos(0); return TRUE; } @@ -1614,14 +1608,6 @@ } -void CMainFrame::StopPreview() -//---------------------------- -{ - StopSoundFile(&m_WaveFile); - m_WaveFile.Destroy(); -} - - BOOL CMainFrame::SetFollowSong(CModDoc *pDoc, HWND hwnd, BOOL bFollowSong, DWORD dwType) //-------------------------------------------------------------------------------------- { Modified: trunk/OpenMPT/mptrack/Mainfrm.h =================================================================== --- trunk/OpenMPT/mptrack/Mainfrm.h 2013-03-19 20:56:21 UTC (rev 1602) +++ trunk/OpenMPT/mptrack/Mainfrm.h 2013-03-19 21:44:23 UTC (rev 1603) @@ -464,7 +464,7 @@ BOOL StopSoundFile(CSoundFile *); void InitPreview(); void PreparePreview(ModCommand::NOTE note); - void StopPreview(); + void StopPreview() { StopSoundFile(&m_WaveFile); } inline BOOL IsPlaying() const { return (m_dwStatus & MODSTATUS_PLAYING); } inline BOOL IsRendering() const { return (m_dwStatus & MODSTATUS_RENDERING); } inline CModDoc *GetModPlaying() const { return (IsPlaying()||IsRendering()) ? m_pModPlaying : NULL; } Modified: trunk/OpenMPT/mptrack/Moddoc.cpp =================================================================== --- trunk/OpenMPT/mptrack/Moddoc.cpp 2013-03-19 20:56:21 UTC (rev 1602) +++ trunk/OpenMPT/mptrack/Moddoc.cpp 2013-03-19 21:44:23 UTC (rev 1603) @@ -122,7 +122,6 @@ //---------------- { m_bHasValidPath = false; - m_bPaused = TRUE; m_lpszLog = NULL; m_hWndFollow = NULL; @@ -925,11 +924,8 @@ CriticalSection cs; - //find a channel if required - //if (nCurrentChn == CHANNELINDEX_INVALID) - { - nChn = FindAvailableChannel(); - } + // Find a channel to play on + nChn = FindAvailableChannel(); ModChannel *pChn = &m_SndFile.Chn[nChn]; @@ -2584,7 +2580,7 @@ if(nStoppedChannel != CHANNELINDEX_INVALID) return nStoppedChannel; - //Last resort: go for first virutal channel. + //Last resort: go for first virtual channel. return m_SndFile.m_nChannels; } Modified: trunk/OpenMPT/mptrack/Moddoc.h =================================================================== --- trunk/OpenMPT/mptrack/Moddoc.h 2013-03-19 20:56:21 UTC (rev 1602) +++ trunk/OpenMPT/mptrack/Moddoc.h 2013-03-19 21:44:23 UTC (rev 1603) @@ -119,10 +119,11 @@ }; bool IsSplitActive() const { return (octaveLink && (octaveModifier != 0)) || (splitInstrument > 0) || (splitVolume != 0); } + + int octaveModifier; // determines by how many octaves the notes should be transposed up or down ModCommand::NOTE splitNote; ModCommand::INSTR splitInstrument; ModCommand::VOL splitVolume; - int octaveModifier; // determines by how many octaves the notes should be transposed up or down bool octaveLink; // apply octaveModifier SplitKeyboardSettings() @@ -151,27 +152,25 @@ std::basic_ostringstream<TCHAR> m_logEvents; // Log for general progress and error events. CSoundFile m_SndFile; - BOOL m_bPaused; HWND m_hWndFollow; DWORD m_dwNotifyType; + CSize m_szOldPatternScrollbarsPos; - bool bModifiedAutosave; // Modified since last autosave? - - bool m_ShowSavedialog; - -// -> CODE#0015 -// -> DESC="channels management dlg" - std::bitset<MAX_BASECHANNELS> m_bsMultiRecordMask; - std::bitset<MAX_BASECHANNELS> m_bsMultiSplitRecordMask; -// -! NEW_FEATURE#0015 - CPatternUndo m_PatternUndo; CSampleUndo m_SampleUndo; SplitKeyboardSettings m_SplitKeyboardSettings; // this is maybe not the best place to keep them, but it should do the job - vector<FileHistory> m_FileHistory; // File edit history + std::vector<FileHistory> m_FileHistory; // File edit history time_t m_creationTime; + bool bModifiedAutosave; // Modified since last autosave? + bool m_ShowSavedialog; public: + bool m_bHasValidPath; //becomes true if document is loaded or saved. + +protected: + std::bitset<MAX_BASECHANNELS> m_bsMultiRecordMask; + std::bitset<MAX_BASECHANNELS> m_bsMultiSplitRecordMask; +public: std::bitset<MAX_INSTRUMENTS> m_bsInstrumentModified; // which instruments have been modified? (for ITP functionality) protected: // create from serialization only @@ -186,7 +185,6 @@ const CSoundFile &GetrSoundFile() const { return m_SndFile; } void InitPlayer(); - void SetPause(BOOL bPause) { m_bPaused = bPause; } void SetModified(BOOL bModified=TRUE) { SetModifiedFlag(bModified); bModifiedAutosave = (bModified != FALSE); } bool ModifiedSinceLastAutosave() { bool bRetval = bModifiedAutosave; bModifiedAutosave = false; return bRetval; } // return "IsModified" value and reset it until the next SetModified() (as this is only used for polling) void SetShowSaveDialog(bool b) {m_ShowSavedialog = b;} @@ -199,7 +197,7 @@ LPCSTR GetLog() const { return m_lpszLog; } BOOL ClearLog(); UINT ShowLog(LPCSTR lpszTitle=NULL, CWnd *parent=NULL); - void ClearFilePath() {m_strPathName.Empty();} + void ClearFilePath() { m_strPathName.Empty(); } // Logging for general progress and error events. void AddLogEvent(LogEventType eventType, LPCTSTR pszFuncName, LPCTSTR pszFormat, ...); @@ -257,19 +255,17 @@ bool UpdateChannelMuteStatus(CHANNELINDEX nChn); bool MuteSample(SAMPLEINDEX nSample, bool bMute); bool MuteInstrument(INSTRUMENTINDEX nInstr, bool bMute); -// -> CODE#0012 -// -> DESC="midi keyboard split" + bool SoloChannel(CHANNELINDEX nChn, bool bSolo); bool IsChannelSolo(CHANNELINDEX nChn) const; -// -! NEW_FEATURE#0012 + bool SurroundChannel(CHANNELINDEX nChn, bool bSurround); bool SetChannelGlobalVolume(CHANNELINDEX nChn, uint16 nVolume); bool SetChannelDefaultPan(CHANNELINDEX nChn, uint16 nPan); bool IsChannelMuted(CHANNELINDEX nChn) const; bool IsSampleMuted(SAMPLEINDEX nSample) const; bool IsInstrumentMuted(INSTRUMENTINDEX nInstr) const; -// -> CODE#0015 -// -> DESC="channels management dlg" + bool NoFxChannel(CHANNELINDEX nChn, bool bNoFx, bool updateMix = true); bool IsChannelNoFx(CHANNELINDEX nChn) const; bool IsChannelRecord1(CHANNELINDEX channel) const; @@ -278,7 +274,7 @@ void Record1Channel(CHANNELINDEX channel, bool select = true); void Record2Channel(CHANNELINDEX channel, bool select = true); void ReinitRecordState(bool unselect = true); -// -! NEW_FEATURE#0015 + CHANNELINDEX GetNumChannels() const { return m_SndFile.m_nChannels; } UINT GetPatternSize(PATTERNINDEX nPat) const; BOOL AdjustEndOfSample(UINT nSample); @@ -294,9 +290,9 @@ LRESULT ActivateView(UINT nIdView, DWORD dwParam); void UpdateAllViews(CView *pSender, LPARAM lHint=0L, CObject *pHint=NULL); - HWND GetEditPosition(ROWINDEX &row, PATTERNINDEX &pat, ORDERINDEX &ord); //rewbs.customKeys - LRESULT OnCustomKeyMsg(WPARAM, LPARAM); //rewbs.customKeys - void TogglePluginEditor(UINT m_nCurrentPlugin); //rewbs.patPlugNames + HWND GetEditPosition(ROWINDEX &row, PATTERNINDEX &pat, ORDERINDEX &ord); + LRESULT OnCustomKeyMsg(WPARAM, LPARAM); + void TogglePluginEditor(UINT m_nCurrentPlugin); void RecordParamChange(int slot, long param); void LearnMacro(int macro, long param); void SetElapsedTime(ORDERINDEX nOrd, ROWINDEX nRow); @@ -309,7 +305,6 @@ void FixNullStrings(); - bool m_bHasValidPath; //becomes true if document is loaded or saved. // Fix: save pattern scrollbar position when switching to other tab CSize GetOldPatternScrollbarsPos() const { return m_szOldPatternScrollbarsPos; }; void SetOldPatternScrollbarsPos( CSize s ){ m_szOldPatternScrollbarsPos = s; }; @@ -327,7 +322,6 @@ // protected members protected: - CSize m_szOldPatternScrollbarsPos; BOOL InitializeMod(); void* GetChildFrame(); //rewbs.customKeys Modified: trunk/OpenMPT/soundlib/Fastmix.cpp =================================================================== --- trunk/OpenMPT/soundlib/Fastmix.cpp 2013-03-19 20:56:21 UTC (rev 1602) +++ trunk/OpenMPT/soundlib/Fastmix.cpp 2013-03-19 21:44:23 UTC (rev 1603) @@ -15,13 +15,6 @@ #include "stdafx.h" #include "sndfile.h" -#if defined(_MSC_VER) -#elif defined(__GNUC__) -#define __forceinline __attribute__((always_inline)) -#else -#define __forceinline inline -#endif - #include "WindowedFIR.h" #pragma bss_seg(".modplug") @@ -344,8 +337,8 @@ #define ClipFilter(x) Clamp(x, 2.0f * (float)int16_min, 2.0f * (float)int16_max) // Resonant filter for Mono samples -static __forceinline void ProcessMonoFilter(int &vol, ModChannel *pChn) -//--------------------------------------------------------------------- +static forceinline void ProcessMonoFilter(int &vol, ModChannel *pChn) +//------------------------------------------------------------------- { float fy1 = pChn->nFilter_Y1; float fy2 = pChn->nFilter_Y2; @@ -361,8 +354,8 @@ // Resonant filter for Stereo samples -static __forceinline void ProcessStereoFilter(int &vol_l, int &vol_r, ModChannel *pChn) -//------------------------------------------------------------------------------------- +static forceinline void ProcessStereoFilter(int &vol_l, int &vol_r, ModChannel *pChn) +//----------------------------------------------------------------------------------- { // Left channel float fy1 = pChn->nFilter_Y1; Modified: trunk/OpenMPT/soundlib/LOAD_DBM.CPP =================================================================== --- trunk/OpenMPT/soundlib/LOAD_DBM.CPP 2013-03-19 20:56:21 UTC (rev 1602) +++ trunk/OpenMPT/soundlib/LOAD_DBM.CPP 2013-03-19 21:44:23 UTC (rev 1603) @@ -467,12 +467,13 @@ if(sampleflags & 3) { + FileReader chunk(psh->sampledata, samplesize); SampleIO( (sampleflags & 2) ? SampleIO::_16bit : SampleIO::_8bit, SampleIO::mono, SampleIO::bigEndian, SampleIO::signedPCM) - .ReadSample(sample, (LPSTR)(psh->sampledata), samplesize); + .ReadSample(sample, chunk); } chunk_pos += samplesize; } Modified: trunk/OpenMPT/soundlib/LOAD_DSM.CPP =================================================================== --- trunk/OpenMPT/soundlib/LOAD_DSM.CPP 2013-03-19 20:56:21 UTC (rev 1602) +++ trunk/OpenMPT/soundlib/LOAD_DSM.CPP 2013-03-19 21:44:23 UTC (rev 1603) @@ -230,12 +230,13 @@ sample.nVolume = (WORD)(pSmp->volume << 2); if (sample.nVolume > 256) sample.nVolume = 256; + FileReader chunk(lpStream + dwPos, dwMemLength - dwPos); SampleIO( SampleIO::_8bit, SampleIO::mono, SampleIO::littleEndian, (pSmp->flags & 2) ? SampleIO::signedPCM : SampleIO::unsignedPCM) - .ReadSample(sample, (LPCSTR)(lpStream + dwPos), dwMemLength - dwPos); + .ReadSample(sample, chunk); nSmp++; } else Modified: trunk/OpenMPT/soundlib/Load_mdl.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_mdl.cpp 2013-03-19 20:56:21 UTC (rev 1602) +++ trunk/OpenMPT/soundlib/Load_mdl.cpp 2013-03-19 21:44:23 UTC (rev 1603) @@ -593,7 +593,8 @@ if (!smpinfo[i]) { - dwPos += sampleIO.ReadSample(sample, (LPSTR)(lpStream+dwPos), dwMemLength - dwPos); + FileReader chunk(lpStream + dwPos, dwMemLength - dwPos); + dwPos += sampleIO.ReadSample(sample, chunk); } else { DWORD dwLen = *((DWORD *)(lpStream+dwPos)); @@ -601,7 +602,8 @@ if ( (dwLen <= dwMemLength) && (dwPos <= dwMemLength - dwLen) && (dwLen > 4) ) { sampleIO |= SampleIO::MDL; - sampleIO.ReadSample(sample, (LPSTR)(lpStream+dwPos), dwLen); + FileReader chunk(lpStream + dwPos , dwLen); + sampleIO.ReadSample(sample, chunk); } dwPos += dwLen; } Modified: trunk/OpenMPT/soundlib/Load_med.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_med.cpp 2013-03-19 20:56:21 UTC (rev 1602) +++ trunk/OpenMPT/soundlib/Load_med.cpp 2013-03-19 21:44:23 UTC (rev 1603) @@ -802,7 +802,8 @@ } } Samples[iSmp + 1].nLength = len; - sampleIO.ReadSample(Samples[iSmp + 1], psdata, dwMemLength - dwPos - 6); + FileReader chunk(psdata, dwMemLength - dwPos - 6); + sampleIO.ReadSample(Samples[iSmp + 1], chunk); } // Reading patterns (blocks) if (wNumBlocks > MAX_PATTERNS) wNumBlocks = MAX_PATTERNS; Modified: trunk/OpenMPT/soundlib/Load_ptm.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_ptm.cpp 2013-03-19 20:56:21 UTC (rev 1602) +++ trunk/OpenMPT/soundlib/Load_ptm.cpp 2013-03-19 21:44:23 UTC (rev 1603) @@ -138,7 +138,8 @@ } if(sample.nLength && samplepos && samplepos < dwMemLength) { - sampleIO.ReadSample(sample, (LPSTR)(lpStream + samplepos), dwMemLength - samplepos); + FileReader chunk(lpStream + samplepos, dwMemLength - samplepos); + sampleIO.ReadSample(sample, chunk); } } } Modified: trunk/OpenMPT/soundlib/Sndfile.cpp =================================================================== --- trunk/OpenMPT/soundlib/Sndfile.cpp 2013-03-19 20:56:21 UTC (rev 1602) +++ trunk/OpenMPT/soundlib/Sndfile.cpp 2013-03-19 21:44:23 UTC (rev 1603) @@ -192,7 +192,7 @@ // Convenient macro to help WRITE_HEADER declaration for single type members ONLY (non-array) // -------------------------------------------------------------------------------------------- #define WRITE_MPTHEADER_sized_member(name,type,code) \ -static_assert(sizeof(input->name) >= sizeof(type), "");\ +static_assert(sizeof(input->name) >= sizeof(type), "Instrument property does not fit into specified type!");\ fcode = #@code;\ fwrite(& fcode , 1 , sizeof( __int32 ) , file);\ fsize = sizeof( type );\ Modified: trunk/OpenMPT/soundlib/Sndfile.h =================================================================== --- trunk/OpenMPT/soundlib/Sndfile.h 2013-03-19 20:56:21 UTC (rev 1602) +++ trunk/OpenMPT/soundlib/Sndfile.h 2013-03-19 21:44:23 UTC (rev 1603) @@ -232,7 +232,6 @@ static UINT m_nProLogicDepth, m_nProLogicDelay; static UINT m_nStereoSeparation; static UINT m_nMaxMixChannels; - static LONG m_nStreamVolume; static DWORD gdwSysInfo, gdwSoundSetup, gdwMixingFreq, gnBitsPerSample, gnChannels; static UINT gnAGC; static double gdWFIRCutoff; @@ -336,8 +335,6 @@ bool TypeIsIT_MPT() const { return (m_nType & (MOD_TYPE_IT | MOD_TYPE_MPT)) != 0; } bool TypeIsIT_MPT_XM() const { return (m_nType & (MOD_TYPE_IT | MOD_TYPE_MPT | MOD_TYPE_XM)) != 0; } bool TypeIsS3M_IT_MPT() const { return (m_nType & (MOD_TYPE_S3M | MOD_TYPE_IT | MOD_TYPE_MPT)) != 0; } - bool TypeIsXM_MOD() const { return (m_nType & (MOD_TYPE_XM | MOD_TYPE_MOD)) != 0; } - bool TypeIsMOD_S3M() const { return (m_nType & (MOD_TYPE_MOD | MOD_TYPE_S3M)) != 0; } void SetMasterVolume(UINT vol, bool adjustAGC = false); UINT GetMasterVolume() const { return m_nMasterVolume; } @@ -463,7 +460,6 @@ void RecalculateGainForAllPlugs(); void ResetChannels(); UINT Read(LPVOID lpBuffer, UINT cbBuffer); - UINT ReadMix(LPVOID lpBuffer, UINT cbBuffer, CSoundFile *, DWORD *, LPBYTE ps=NULL); UINT CreateStereoMix(int count); UINT GetResamplingFlag(const ModChannel *pChannel); BOOL FadeSong(UINT msec); Modified: trunk/OpenMPT/soundlib/Sndmix.cpp =================================================================== --- trunk/OpenMPT/soundlib/Sndmix.cpp 2013-03-19 20:56:21 UTC (rev 1602) +++ trunk/OpenMPT/soundlib/Sndmix.cpp 2013-03-19 21:44:23 UTC (rev 1603) @@ -27,7 +27,6 @@ // SNDMIX: These are global flags for playback control UINT CSoundFile::m_nStereoSeparation = 128; -LONG CSoundFile::m_nStreamVolume = 0x8000; UINT CSoundFile::m_nMaxMixChannels = MAX_CHANNELS; // Mixing Configuration (SetWaveConfig) DWORD CSoundFile::gdwSysInfo = 0; @@ -391,202 +390,6 @@ } -#ifdef MODPLUG_PLAYER -UINT CSoundFile::ReadMix(LPVOID lpDestBuffer, UINT cbBuffer, CSoundFile *pSndFile, DWORD *pstatus, LPBYTE pstream) -//---------------------------------------------------------------------------------------------------------------- -{ - LPBYTE lpBuffer = (LPBYTE)lpDestBuffer; - LPCONVERTPROC pCvt = X86_Convert32To8; - UINT lRead, lMax, lSampleSize, lCount, lSampleCount, nStat1=0, nStat2=0; - BOOL active1, active2, bstream = FALSE, b16stream = FALSE; - DWORD dwenable = *pstatus; - UINT nMaxPlugins; - - { - nMaxPlugins = MAX_MIXPLUGINS; - while ((nMaxPlugins > 0) && (!m_MixPlugins[nMaxPlugins-1].pMixPlugin)) nMaxPlugins--; - } - lSampleSize = gnChannels; - if (gnBitsPerSample == 16) { lSampleSize *= 2; pCvt = X86_Convert32To16; } - else if (gnBitsPerSample == 24) { lSampleSize *= 3; pCvt = X86_Convert32To24; } - else if (gnBitsPerSample == 32) { lSampleSize *= 4; pCvt = X86_Convert32To32; } - lMax = cbBuffer / lSampleSize; - if ((!lMax) || (!lpBuffer) || (!pSndFile) || (!pstatus)) return 0; - if (*pstatus & 4) bstream = TRUE; - if (*pstatus & 8) b16stream = TRUE; - m_nMixStat = 0; - pSndFile->m_nMixStat = 0; - lRead = lMax; - *pstatus = 0; - while (lRead > 0) - { - active1 = active2 = FALSE; - lCount = 0; - if ((m_nChannels) && (dwenable & 1)) - { - if (!m_nBufferCount) - { - if(m_SongFlags[SONG_ENDREACHED]) - { - m_nBufferCount = 0; - *pstatus &= ~1; - } else - if(m_SongFlags[SONG_FADINGSONG]) - { - m_SongFlags.set(SONG_ENDREACHED); - m_nBufferCount = lRead; - *pstatus &= ~1; - } else - if (!ReadNote()) - { - if (!FadeSong(FADESONGDELAY)) - { - m_SongFlags.set(SONG_ENDREACHED); - m_nBufferCount = lRead; - *pstatus &= ~1; - } - } - } - lCount = m_nBufferCount; - if (lCount) - { - *pstatus |= 1; - active1 = TRUE; - } - } - if ((pSndFile->m_nChannels) && (dwenable & 2)) - { - if (!pSndFile->m_nBufferCount) - { - if(pSndFile->m_SongFlags[SONG_ENDREACHED]) - { - pSndFile->m_nBufferCount = 0; - *pstatus &= ~2; - } else - if(pSndFile->m_SongFlags[SONG_FADINGSONG]) - { - pSndFile->m_SongFlags.set(SONG_ENDREACHED); - pSndFile->m_nBufferCount = lRead; - *pstatus &= ~2; - } else - if (!pSndFile->ReadNote()) - { - if (!pSndFile->FadeSong(FADESONGDELAY)) - { - pSndFile->m_SongFlags.set(SONG_ENDREACHED); - pSndFile->m_nBufferCount = lRead; - *pstatus &= ~2; - } - } - } - if (pSndFile->m_nBufferCount) - { - *pstatus |= 2; - active2 = TRUE; - if ((!lCount) || (pSndFile->m_nBufferCount < lCount)) lCount = pSndFile->m_nBufferCount; - } - } - // No sound? - if (!lCount) - { - if ((lRead == lMax) && (!bstream)) break; - lCount = lRead; - } - if (lCount > MIXBUFFERSIZE) lCount = MIXBUFFERSIZE; - if (lCount > lRead) lCount = lRead; - lSampleCount = lCount; - if (!lCount) break; - // Resetting sound buffer - #ifndef NO_REVERB - gnReverbSend = 0; - #endif - X86_StereoFill(MixSoundBuffer, lSampleCount, &gnDryROfsVol, &gnDryLOfsVol); - if (pstream) - { - if (b16stream) - { - signed short *p = (signed short *)pstream; - for (UINT i=0; i<lSampleCount; i++, p++) - { - int k = (int)(*p) * (m_nStreamVolume >> MIXING_ATTENUATION); - MixSoundBuffer[i*2] += k; - MixSoundBuffer[i*2+1] += k; - } - pstream = (LPBYTE)p; - } else - { - BYTE *p = (BYTE *)pstream; - for (UINT i=0; i<lSampleCount; i++, p++) - { - int k = ((((int)(*p)) - 0x80) << 8) * (m_nStreamVolume >> MIXING_ATTENUATION); - MixSoundBuffer[i*2] += k; - MixSoundBuffer[i*2+1] += k; - } - pstream = (LPBYTE)p; - } - } - if (gnChannels >= 2) - { - lSampleCount *= 2; - if (active1) { m_nMixStat += CreateStereoMix(lCount); nStat1++; } - if (active2) { pSndFile->m_nMixStat += pSndFile->CreateStereoMix(lCount); nStat2++; } - #ifndef NO_REVERB - ProcessReverb(lCount); - #endif - ProcessStereoDSP(lCount); - } else - { - if (active1) { m_nMixStat += CreateStereoMix(lCount); nStat1++; } - if (active2) { pSndFile->m_nMixStat += pSndFile->CreateStereoMix(lCount); nStat2++; } - #ifndef NO_REVERB - ProcessReverb(lCount); - #endif - X86_MonoFromStereo(MixSoundBuffer, lCount); - ProcessMonoDSP(lCount); - } -#ifdef ENABLE_EQ - if (gdwSoundSetup & SNDMIX_EQ) - { - if (gnChannels >= 2) - EQStereo(MixSoundBuffer, lCount); - else - EQMono(MixSoundBuffer, lCount); - } -#endif -#ifndef NO_AGC - // Automatic Gain Control - if (gdwSoundSetup & SNDMIX_AGC) ProcessAGC(lSampleCount); -#endif - UINT lTotalSampleCount = lSampleCount; - // Multichannel - if (gnChannels > 2) - { - X86_InterleaveFrontRear(MixSoundBuffer, MixRearBuffer, lSampleCount); - lTotalSampleCount *= 2; - } - // Noise Shaping - if (gnBitsPerSample <= 24) - { - if ((gdwSoundSetup & SNDMIX_HQRESAMPLER) - && ((gnCPUUsage < 25) || (gdwSoundSetup & SNDMIX_DIRECTTODISK))) - X86_Dither(MixSoundBuffer, lTotalSampleCount, gnBitsPerSample); - } - - // Perform clipping + VU-Meter - lpBuffer += pCvt(lpBuffer, MixSoundBuffer, lTotalSampleCount); - // Buffer ready - lRead -= lCount; - if (active1) m_nBufferCount -= lCount; - if (active2) pSndFile->m_nBufferCount -= lCount; - } - if (lRead) memset(lpBuffer, (gnBitsPerSample == 8) ? 0x80 : 0, lRead * lSampleSize); - if (nStat1) { m_nMixStat += nStat1 - 1; m_nMixStat /= nStat1; } - if (nStat2) { pSndFile->m_nMixStat += nStat2 - 1; pSndFile->m_nMixStat /= nStat2; } - return lMax - lRead; -} -#endif // MODPLUG_PLAYER - - ///////////////////////////////////////////////////////////////////////////// // Handles navigation/effects @@ -2127,22 +1930,9 @@ IncrementEnvelopePositions(pChn); } -#ifdef MODPLUG_PLAYER - // Limit CPU -> > 80% -> don't ramp - if ((gnCPUUsage >= 80) && (!pChn->nRealVolume)) - { - pChn->nLeftVol = pChn->nRightVol = 0; - } -#endif // MODPLUG_PLAYER - // Volume ramping pChn->dwFlags.set(CHN_VOLUMERAMP, (pChn->nRealVolume | pChn->nLeftVol | pChn->nRightVol) != 0); -#ifdef MODPLUG_PLAYER - // Decrease VU-Meter - if (pChn->nVUMeter > VUMETER_DECAY) pChn->nVUMeter -= VUMETER_DECAY; else pChn->nVUMeter = 0; -#endif // MODPLUG_PLAYER - #ifdef ENABLE_STEREOVU if (pChn->nLeftVU > VUMETER_DECAY) pChn->nLeftVU -= VUMETER_DECAY; else pChn->nLeftVU = 0; if (pChn->nRightVU > VUMETER_DECAY) pChn->nRightVU -= VUMETER_DECAY; else pChn->nRightVU = 0; @@ -2155,14 +1945,6 @@ if (pChn->pCurrentSample) { // Update VU-Meter (nRealVolume is 14-bit) -#ifdef MODPLUG_PLAYER - UINT vutmp = pChn->nRealVolume >> (14 - 8); - if (vutmp > 0xFF) vutmp = 0xFF; - if (pChn->nVUMeter >= 0x100) pChn->nVUMeter = vutmp; - vutmp >>= 1; - if (pChn->nVUMeter < vutmp) pChn->nVUMeter = vutmp; -#endif // MODPLUG_PLAYER - #ifdef ENABLE_STEREOVU UINT vul = (pChn->nRealVolume * pChn->nRealPan) >> 14; if (vul > 127) vul = 127; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2013-03-19 22:49:05
|
Revision: 1604 http://sourceforge.net/p/modplug/code/1604 Author: saga-games Date: 2013-03-19 22:48:56 +0000 (Tue, 19 Mar 2013) Log Message: ----------- [Mod] Instrument Editor: Filter mode is now also disabled for IT modules. [Mod] OpenMPT: Version is now 1.21.01.23 Modified Paths: -------------- trunk/OpenMPT/common/version.h trunk/OpenMPT/mptrack/Ctrl_ins.cpp trunk/OpenMPT/mptrack/TrackerSettings.cpp trunk/OpenMPT/soundlib/ModInstrument.cpp Modified: trunk/OpenMPT/common/version.h =================================================================== --- trunk/OpenMPT/common/version.h 2013-03-19 21:44:23 UTC (rev 1603) +++ trunk/OpenMPT/common/version.h 2013-03-19 22:48:56 UTC (rev 1604) @@ -19,7 +19,7 @@ #define VER_MAJORMAJOR 1 #define VER_MAJOR 21 #define VER_MINOR 01 -#define VER_MINORMINOR 22 +#define VER_MINORMINOR 23 //Creates version number from version parts that appears in version string. //For example MAKE_VERSION_NUMERIC(1,17,02,28) gives version number of Modified: trunk/OpenMPT/mptrack/Ctrl_ins.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_ins.cpp 2013-03-19 21:44:23 UTC (rev 1603) +++ trunk/OpenMPT/mptrack/Ctrl_ins.cpp 2013-03-19 22:48:56 UTC (rev 1604) @@ -1226,9 +1226,6 @@ m_ComboNNA.EnableWindow(bITandMPT); m_SliderVolSwing.EnableWindow(bITandMPT); m_SliderPanSwing.EnableWindow(bITandMPT); - m_SliderCutSwing.EnableWindow((m_pSndFile->GetType() == MOD_TYPE_MPT || (pIns != nullptr && pIns->nCutSwing != 0)) ? TRUE : FALSE); - m_SliderResSwing.EnableWindow((m_pSndFile->GetType() == MOD_TYPE_MPT || (pIns != nullptr && pIns->nResSwing != 0)) ? TRUE : FALSE); - m_CbnFilterMode.EnableWindow(bITandMPT); m_ComboDCT.EnableWindow(bITandMPT); m_ComboDCA.EnableWindow(bITandMPT); m_ComboPPC.EnableWindow(bITandMPT); @@ -1267,6 +1264,11 @@ } if (dwHintMask & (HINT_INSTRUMENT|HINT_MODTYPE)) { + // Backwards compatibility with IT modules that use now deprecated hack features. + m_SliderCutSwing.EnableWindow((pIns != nullptr && (m_pSndFile->GetType() == MOD_TYPE_MPT || pIns->nCutSwing != 0)) ? TRUE : FALSE); + m_SliderResSwing.EnableWindow((pIns != nullptr && (m_pSndFile->GetType() == MOD_TYPE_MPT || pIns->nResSwing != 0)) ? TRUE : FALSE); + m_CbnFilterMode.EnableWindow((pIns != nullptr && (m_pSndFile->GetType() == MOD_TYPE_MPT || pIns->nFilterMode != FLTMODE_UNCHANGED)) ? TRUE : FALSE); + CHAR s[128]; if (pIns) { Modified: trunk/OpenMPT/mptrack/TrackerSettings.cpp =================================================================== --- trunk/OpenMPT/mptrack/TrackerSettings.cpp 2013-03-19 21:44:23 UTC (rev 1603) +++ trunk/OpenMPT/mptrack/TrackerSettings.cpp 2013-03-19 22:48:56 UTC (rev 1604) @@ -251,7 +251,7 @@ } // GUI Stuff - m_ShowSplashScreen = CMainFrame::GetPrivateProfileLong("Display", "ShowSplashScreen", m_ShowSplashScreen, iniFile); + m_ShowSplashScreen = !!CMainFrame::GetPrivateProfileLong("Display", "ShowSplashScreen", m_ShowSplashScreen, iniFile); gbMdiMaximize = CMainFrame::GetPrivateProfileLong("Display", "MDIMaximize", gbMdiMaximize, iniFile); glTreeWindowWidth = CMainFrame::GetPrivateProfileLong("Display", "MDITreeWidth", glTreeWindowWidth, iniFile); glTreeSplitRatio = CMainFrame::GetPrivateProfileLong("Display", "MDITreeRatio", glTreeSplitRatio, iniFile); Modified: trunk/OpenMPT/soundlib/ModInstrument.cpp =================================================================== --- trunk/OpenMPT/soundlib/ModInstrument.cpp 2013-03-19 21:44:23 UTC (rev 1603) +++ trunk/OpenMPT/soundlib/ModInstrument.cpp 2013-03-19 22:48:56 UTC (rev 1604) @@ -217,12 +217,13 @@ LimitMax(nFadeOut, 8192u); } - // MPT-specific features - remove instrument tunings, Pitch/Tempo Lock for other formats + // MPT-specific features - remove instrument tunings, Pitch/Tempo Lock, cutoff / resonance swing and filter mode for other formats if(!(toType & MOD_TYPE_MPT)) { SetTuning(nullptr); wPitchToTempoLock = 0; nCutSwing = nResSwing = 0; + nFilterMode = FLTMODE_UNCHANGED; } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2013-03-22 17:57:48
|
Revision: 1623 http://sourceforge.net/p/modplug/code/1623 Author: saga-games Date: 2013-03-22 17:57:40 +0000 (Fri, 22 Mar 2013) Log Message: ----------- [Imp] MIDI Input / Output plugin also stores program name now. [Fix] MIDI Input / Output plugin could crash when changing input/output devices while something was playing. Modified Paths: -------------- trunk/OpenMPT/plugins/MidiInOut/MidiInOut.cpp trunk/OpenMPT/plugins/MidiInOut/MidiInOut.h Added Paths: ----------- trunk/OpenMPT/common/mutex.h Added: trunk/OpenMPT/common/mutex.h =================================================================== --- trunk/OpenMPT/common/mutex.h (rev 0) +++ trunk/OpenMPT/common/mutex.h 2013-03-22 17:57:40 UTC (rev 1623) @@ -0,0 +1,51 @@ +/* + * mutex.h + * ------- + * Purpose: Partially implement c++ mutexes as far as openmpt needs them. Can eventually go away when we only support c++11 compilers some time. + * Notes : (currently none) + * Authors: OpenMPT Devs + * The OpenMPT source code is released under the BSD license. Read LICENSE for more details. + */ + +#pragma once + +#define WIN32_LEAN_AND_MEAN +#define VC_EXTRALEAN +#define NOMINMAX +#include <windows.h> + +namespace Util { + +// compatible with c++11 std::mutex, can eventually be replaced without touching any usage site +class mutex { +private: + CRITICAL_SECTION impl; +public: + mutex() { InitializeCriticalSection(&impl); } + ~mutex() { DeleteCriticalSection(&impl); } + void lock() { EnterCriticalSection(&impl); } + void unlock() { LeaveCriticalSection(&impl); } +}; + +// compatible with c++11 std::recursive_mutex, can eventually be replaced without touching any usage site +class recursive_mutex { +private: + CRITICAL_SECTION impl; +public: + recursive_mutex() { InitializeCriticalSection(&impl); } + ~recursive_mutex() { DeleteCriticalSection(&impl); } + void lock() { EnterCriticalSection(&impl); } + void unlock() { LeaveCriticalSection(&impl); } +}; + +// compatible with c++11 std::lock_guard, can eventually be replaced without touching any usage site +template< typename mutex_type > +class lock_guard { +private: + mutex_type & mutex; +public: + lock_guard( mutex_type & m ) : mutex(m) { mutex.lock(); } + ~lock_guard() { mutex.unlock(); } +}; + +} // namespace Util Modified: trunk/OpenMPT/plugins/MidiInOut/MidiInOut.cpp =================================================================== --- trunk/OpenMPT/plugins/MidiInOut/MidiInOut.cpp 2013-03-22 15:19:43 UTC (rev 1622) +++ trunk/OpenMPT/plugins/MidiInOut/MidiInOut.cpp 2013-03-22 17:57:40 UTC (rev 1623) @@ -47,8 +47,6 @@ chunk = nullptr; isProcessing = false; isBypassed = false; - OpenDevice(inputDevice.index, true); - OpenDevice(outputDevice.index, true); vst_strncpy(programName, "Default", kVstMaxProgNameLen); // default program name } @@ -85,7 +83,9 @@ VstInt32 MidiInOut::getChunk(void **data, bool /*isPreset*/) //---------------------------------------------------------- { - VstInt32 byteSize = 5 * sizeof(VstInt32) + const VstInt32 programNameLen = strlen(programName); + VstInt32 byteSize = 8 * sizeof(VstInt32) + + programNameLen + inputDevice.name.size() + outputDevice.name.size(); @@ -95,12 +95,16 @@ { VstInt32 *header = reinterpret_cast<VstInt32 *>(chunk); header[0] = cEffect.version; - header[1] = inputDevice.index; - header[2] = inputDevice.name.size(); - header[3] = outputDevice.index; - header[4] = outputDevice.name.size(); - strncpy(chunk + 5 * sizeof(VstInt32), inputDevice.name.c_str(), header[2]); - strncpy(chunk + 5 * sizeof(VstInt32) + header[2], outputDevice.name.c_str(), header[4]); + header[1] = 1; // Number of programs + header[2] = programNameLen; + header[3] = inputDevice.index; + header[4] = inputDevice.name.size(); + header[5] = outputDevice.index; + header[6] = outputDevice.name.size(); + header[7] = 0; // Reserved + strncpy(chunk + 8 * sizeof(VstInt32), programName, programNameLen); + strncpy(chunk + 8 * sizeof(VstInt32) + programNameLen, inputDevice.name.c_str(), header[4]); + strncpy(chunk + 8 * sizeof(VstInt32) + programNameLen + header[2], outputDevice.name.c_str(), header[6]); return byteSize; } else { @@ -112,7 +116,7 @@ VstInt32 MidiInOut::setChunk(void *data, VstInt32 byteSize, bool /*isPreset*/) //---------------------------------------------------------------------------- { - if(byteSize < 5 * sizeof(VstInt32)) + if(byteSize < 8 * sizeof(VstInt32)) { return 0; } @@ -125,13 +129,14 @@ return 0; } - VstInt32 inStrSize = std::min(header[2], byteSize - VstInt32(5 * sizeof(VstInt32))); - VstInt32 outStrSize = std::min(header[4], byteSize - VstInt32(5 * sizeof(VstInt32) + inStrSize)); - PmDeviceID inID = header[1]; - PmDeviceID outID = header[3]; + VstInt32 nameStrSize = std::min(header[2], byteSize - VstInt32(8 * sizeof(VstInt32))); + VstInt32 inStrSize = std::min(header[4], byteSize - VstInt32(8 * sizeof(VstInt32) - nameStrSize)); + VstInt32 outStrSize = std::min(header[6], byteSize - VstInt32(8 * sizeof(VstInt32) - nameStrSize - inStrSize)); + PmDeviceID inID = header[3]; + PmDeviceID outID = header[5]; - const char *inStr = reinterpret_cast<const char *>(data) + 5 * sizeof(VstInt32); - const char *outStr = reinterpret_cast<const char *>(data) + 5 * sizeof(VstInt32) + inStrSize; + const char *inStr = reinterpret_cast<const char *>(data) + 8 * sizeof(VstInt32) + header[2]; + const char *outStr = reinterpret_cast<const char *>(data) + 8 * sizeof(VstInt32) + header[2] + inStrSize; if(strncmp(inStr, GetDeviceName(inID), inStrSize)) { @@ -281,6 +286,8 @@ return; } + Util::lock_guard<Util::mutex> lock(mutex); + VstEvents events; events.numEvents = 1; events.reserved = 0; @@ -410,6 +417,7 @@ // Don't open MIDI devices if we're not processing. // This has to be done since we receive MIDI events in processReplacing(), // so if no processing is happening, some irrelevant events might be queued until the next processing happens... + Util::lock_guard<Util::mutex> lock(mutex); if(asInputDevice) { result = Pm_OpenInput(&device.stream, newDevice, nullptr, 0, nullptr, nullptr); @@ -438,6 +446,7 @@ { if(device.stream != nullptr) { + Util::lock_guard<Util::mutex> lock(mutex); Pm_Close(device.stream); device.stream = nullptr; } Modified: trunk/OpenMPT/plugins/MidiInOut/MidiInOut.h =================================================================== --- trunk/OpenMPT/plugins/MidiInOut/MidiInOut.h 2013-03-22 15:19:43 UTC (rev 1622) +++ trunk/OpenMPT/plugins/MidiInOut/MidiInOut.h 2013-03-22 17:57:40 UTC (rev 1623) @@ -10,6 +10,7 @@ #pragma once +#include "../common/mutex.h" #include <vstsdk2.4/public.sdk/source/vst2.x/audioeffectx.h> #include <portmidi/pm_common/portmidi.h> #include <string> @@ -53,6 +54,7 @@ }; // For getChunk + Util::mutex mutex; char *chunk; // I/O device settings @@ -99,12 +101,12 @@ // MIDI channels virtual VstInt32 getNumMidiInputChannels() { - return (inputDevice.index != noDevice) ? 16 : 0; + return 16; } virtual VstInt32 getNumMidiOutputChannels() { - return (outputDevice.index != noDevice) ? 16 : 0; + return 16; } // Effect name + version stuff This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2013-03-22 20:54:48
|
Revision: 1625 http://sourceforge.net/p/modplug/code/1625 Author: saga-games Date: 2013-03-22 20:54:36 +0000 (Fri, 22 Mar 2013) Log Message: ----------- [Ref] More FileReader usage to get rid of deprecated version of SampleIO::ReadSample [Ref] Small changes Modified Paths: -------------- trunk/OpenMPT/mptrack/AutoSaver.cpp trunk/OpenMPT/mptrack/CloseMainDialog.cpp trunk/OpenMPT/mptrack/Ctrl_smp.cpp trunk/OpenMPT/mptrack/EffectVis.cpp trunk/OpenMPT/mptrack/MainFrm.cpp trunk/OpenMPT/mptrack/Moddoc.cpp trunk/OpenMPT/mptrack/Vstplug.cpp trunk/OpenMPT/soundlib/Dlsbank.cpp trunk/OpenMPT/soundlib/Load_mt2.cpp trunk/OpenMPT/soundlib/ModChannel.h trunk/OpenMPT/soundlib/SampleFormats.cpp trunk/OpenMPT/soundlib/SampleIO.h trunk/OpenMPT/soundlib/Sndmix.cpp trunk/OpenMPT/soundlib/modcommand.h Modified: trunk/OpenMPT/mptrack/AutoSaver.cpp =================================================================== --- trunk/OpenMPT/mptrack/AutoSaver.cpp 2013-03-22 18:13:13 UTC (rev 1624) +++ trunk/OpenMPT/mptrack/AutoSaver.cpp 2013-03-22 20:54:36 UTC (rev 1625) @@ -9,11 +9,8 @@ #include "stdafx.h" -#include "autosaver.h" -#include "stdafx.h" #include "mptrack.h" #include "mainfrm.h" -#include "sndfile.h" #include "moddoc.h" #include "AutoSaver.h" #include "moptions.h" @@ -87,7 +84,7 @@ while (posDocument) //for all open documents { pModDoc = (CModDoc*)(pDocTemplate->GetNextDoc(posDocument)); - if (pModDoc && pModDoc->ModifiedSinceLastAutosave() && pModDoc->GetSoundFile()) + if(pModDoc && pModDoc->ModifiedSinceLastAutosave()) { if (SaveSingleFile(pModDoc)) { @@ -238,7 +235,7 @@ } else { // if it doesnt, put it in settings dir - name = theApp.GetConfigPath() + pModDoc->GetTitle(); + name = theApp.GetConfigPath() + pModDoc->GetTitle(); } } else @@ -250,12 +247,12 @@ name.Append(".AutoSave."); //append backup tag name.Append(timeStamp); //append timestamp name.Append("."); //append extension - if(pModDoc->GetSoundFile()->m_SongFlags[SONG_ITPROJECT]) + if(pModDoc->GetrSoundFile().m_SongFlags[SONG_ITPROJECT]) { name.Append("itp"); } else { - name.Append(pModDoc->GetSoundFile()->GetModSpecifications().fileExtension); + name.Append(pModDoc->GetrSoundFile().GetModSpecifications().fileExtension); } return name; @@ -268,39 +265,36 @@ // We do not call CModDoc::DoSave as this populates the Recent Files // list with backups... hence we have duplicated code.. :( bool success = false; - CSoundFile* pSndFile = pModDoc->GetSoundFile(); + CSoundFile &sndFile = pModDoc->GetrSoundFile(); - if (pSndFile) + CString fileName = BuildFileName(pModDoc); + + switch (pModDoc->GetModType()) { - CString fileName = BuildFileName(pModDoc); + case MOD_TYPE_MOD: + success = sndFile.SaveMod(fileName); + break; - switch (pModDoc->GetModType()) - { - case MOD_TYPE_MOD: - success = pSndFile->SaveMod(fileName); - break; + case MOD_TYPE_S3M: + success = sndFile.SaveS3M(fileName); + break; - case MOD_TYPE_S3M: - success = pSndFile->SaveS3M(fileName); - break; + case MOD_TYPE_XM: + success = sndFile.SaveXM(fileName); + break; - case MOD_TYPE_XM: - success = pSndFile->SaveXM(fileName); - break; + case MOD_TYPE_IT: + success = sndFile.m_SongFlags[SONG_ITPROJECT] ? + sndFile.SaveITProject(fileName) : + sndFile.SaveIT(fileName); + break; - case MOD_TYPE_IT: - success = pSndFile->m_SongFlags[SONG_ITPROJECT] ? - pSndFile->SaveITProject(fileName) : - pSndFile->SaveIT(fileName); - break; - - case MOD_TYPE_MPT: - //Using IT save function also for MPT. - success = pSndFile->SaveIT(fileName); - break; - //default: - //Do nothing - } + case MOD_TYPE_MPT: + //Using IT save function also for MPT. + success = sndFile.SaveIT(fileName); + break; + //default: + //Do nothing } return success; } Modified: trunk/OpenMPT/mptrack/CloseMainDialog.cpp =================================================================== --- trunk/OpenMPT/mptrack/CloseMainDialog.cpp 2013-03-22 18:13:13 UTC (rev 1624) +++ trunk/OpenMPT/mptrack/CloseMainDialog.cpp 2013-03-22 20:54:36 UTC (rev 1625) @@ -37,7 +37,7 @@ //------------------------------------------------------------------------- { const CString &path = (!fullPath || pModDoc->GetPathName().IsEmpty()) ? pModDoc->GetTitle() : pModDoc->GetPathName(); - return pModDoc->GetSoundFile()->GetTitle() + CString(" (") + path + CString(")"); + return pModDoc->GetrSoundFile().GetTitle() + CString(" (") + path + CString(")"); } Modified: trunk/OpenMPT/mptrack/Ctrl_smp.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_smp.cpp 2013-03-22 18:13:13 UTC (rev 1624) +++ trunk/OpenMPT/mptrack/Ctrl_smp.cpp 2013-03-22 20:54:36 UTC (rev 1625) @@ -801,7 +801,8 @@ sample.nLength /= 2; } - if (sampleIO.ReadSample(sample, lpFile, len)) + FileReader chunk(lpFile, len); + if(sampleIO.ReadSample(sample, chunk)) { bOk = true; @@ -906,8 +907,8 @@ { if (m_pSndFile->m_nInstruments) { - UINT k = m_pParent->GetInstrumentChange(); - if (!m_pModDoc->IsChildSample(k, m_nSample)) + INSTRUMENTINDEX k = static_cast<INSTRUMENTINDEX>(m_pParent->GetInstrumentChange()); + if(!m_pModDoc->IsChildSample(k, m_nSample)) { INSTRUMENTINDEX nins = m_pModDoc->FindSampleParent(m_nSample); if(nins != INSTRUMENTINDEX_INVALID) Modified: trunk/OpenMPT/mptrack/EffectVis.cpp =================================================================== --- trunk/OpenMPT/mptrack/EffectVis.cpp 2013-03-22 18:13:13 UTC (rev 1624) +++ trunk/OpenMPT/mptrack/EffectVis.cpp 2013-03-22 20:54:36 UTC (rev 1625) @@ -31,7 +31,7 @@ // EffectVis dialog IMPLEMENT_DYNAMIC(CEffectVis, CDialog) -CEffectVis::CEffectVis(CViewPattern *pViewPattern, UINT startRow, UINT endRow, UINT nchn, CModDoc* pModDoc, UINT pat) : effectInfo(*pModDoc->GetSoundFile()) +CEffectVis::CEffectVis(CViewPattern *pViewPattern, UINT startRow, UINT endRow, UINT nchn, CModDoc* pModDoc, UINT pat) : effectInfo(pModDoc->GetrSoundFile()) { m_pViewPattern = pViewPattern; m_dwStatus = 0x00; @@ -578,7 +578,7 @@ { m_pModDoc = pModDoc; m_startRow = startRow; - m_endRow = endRow; + m_endRow = endRow; m_nRows = endRow - startRow; m_nChan = static_cast<CHANNELINDEX>(nchn); m_nPattern = pat; Modified: trunk/OpenMPT/mptrack/MainFrm.cpp =================================================================== --- trunk/OpenMPT/mptrack/MainFrm.cpp 2013-03-22 18:13:13 UTC (rev 1624) +++ trunk/OpenMPT/mptrack/MainFrm.cpp 2013-03-22 20:54:36 UTC (rev 1625) @@ -1074,7 +1074,7 @@ else if (m_dwNotifyType & MPTNOTIFY_PANENV) notifyEnv = ENV_PANNING; - const ModChannelEnvInfo &chnEnv = pChn->GetEnvelope(notifyEnv); + const ModChannel::EnvInfo &chnEnv = pChn->GetEnvelope(notifyEnv); if(chnEnv.flags[ENV_ENABLED]) { @@ -1396,6 +1396,7 @@ m_WaveFile.Destroy(); } else { + // Stop sample preview channels for(CHANNELINDEX i = m_pSndFile->m_nChannels; i < MAX_CHANNELS; i++) { if(!(m_pSndFile->Chn[i].nMasterChn)) @@ -1547,9 +1548,9 @@ void CMainFrame::InitPreview() //---------------------------- { - // Avoid global volume ramping when trying samples in the treeview. m_WaveFile.Destroy(); m_WaveFile.Create(NULL, 0); + // Avoid global volume ramping when trying samples in the treeview. m_WaveFile.m_pConfig->setGlobalVolumeAppliesToMaster(false); m_WaveFile.m_nDefaultGlobalVolume = m_WaveFile.m_nGlobalVolume = MAX_GLOBAL_VOLUME; m_WaveFile.m_nDefaultTempo = 125; Modified: trunk/OpenMPT/mptrack/Moddoc.cpp =================================================================== --- trunk/OpenMPT/mptrack/Moddoc.cpp 2013-03-22 18:13:13 UTC (rev 1624) +++ trunk/OpenMPT/mptrack/Moddoc.cpp 2013-03-22 20:54:36 UTC (rev 1625) @@ -2195,7 +2195,6 @@ //------------------------------------------------------------------------------ { HWND followSonghWnd; - PATTERNVIEWSTATE *patternViewState; CChildFrame *pChildFrm = (CChildFrame *) GetChildFrame(); if(strcmp("CViewPattern", pChildFrm->GetCurrentViewClassName()) == 0) // dirty HACK @@ -2211,7 +2210,7 @@ { //patern editor object does not exist (i.e. is not active) - use saved state. followSonghWnd = NULL; - patternViewState = pChildFrm->GetPatternViewState(); + PATTERNVIEWSTATE *patternViewState = pChildFrm->GetPatternViewState(); pat = patternViewState->nPattern; row = patternViewState->cursor.GetRow(); @@ -2647,7 +2646,7 @@ CHANNELINDEX nNewChannels = CLAMP(dlg.m_nChannels, m_SndFile.GetModSpecifications().channelsMin, m_SndFile.GetModSpecifications().channelsMax); - if (nNewChannels != GetSoundFile()->GetNumChannels()) + if (nNewChannels != GetNumChannels()) { const bool showCancelInRemoveDlg = m_SndFile.GetModSpecifications().channelsMax >= m_SndFile.GetNumChannels(); if(ChangeNumChannels(nNewChannels, showCancelInRemoveDlg)) bShowLog = true; Modified: trunk/OpenMPT/mptrack/Vstplug.cpp =================================================================== --- trunk/OpenMPT/mptrack/Vstplug.cpp 2013-03-22 18:13:13 UTC (rev 1624) +++ trunk/OpenMPT/mptrack/Vstplug.cpp 2013-03-22 20:54:36 UTC (rev 1625) @@ -2632,7 +2632,7 @@ if(pVstEditor && pVstEditor->m_hWnd) { // Mark track modified if GUI is open and format supports plugins - if(pModDoc->GetSoundFile() && pModDoc->GetSoundFile()->GetModSpecifications().supportsPlugins) + if(pModDoc->GetrSoundFile().GetModSpecifications().supportsPlugins) { CMainFrame::GetMainFrame()->ThreadSafeSetModified(pModDoc); } @@ -2647,7 +2647,7 @@ CMainFrame::GetInputHandler()->SetModifierMask(0); // Make sure that the dialog will open only once. const HWND oldMIDIRecondWnd = CMainFrame::GetMainFrame()->GetMidiRecordWnd(); - CMIDIMappingDialog dlg(pVstEditor, *pModDoc->GetSoundFile()); + CMIDIMappingDialog dlg(pVstEditor, pModDoc->GetrSoundFile()); dlg.m_Setting.SetParamIndex(param); dlg.m_Setting.SetPlugIndex(GetSlot() + 1); dlg.DoModal(); @@ -2804,12 +2804,10 @@ m_pEditor = nullptr; } else { - //rewbs.defaultPlugGui if (HasEditor()) m_pEditor = new COwnerVstEditor(this); else m_pEditor = new CDefaultVstEditor(this); - //end rewbs.defaultPlugGui if (m_pEditor) m_pEditor->OpenEditor(CMainFrame::GetMainFrame()); @@ -2832,7 +2830,6 @@ } -//rewbs.defaultPlugGui CAbstractVstEditor* CVstPlugin::GetEditor() //----------------------------------------- { @@ -2854,10 +2851,6 @@ } -//end rewbs.defaultPlugGui -//rewbs.defaultPlugGui: CVstEditor now COwnerVstEditor - - void CVstPlugin::NotifySongPlaying(bool playing) //---------------------------------------------- { Modified: trunk/OpenMPT/soundlib/Dlsbank.cpp =================================================================== --- trunk/OpenMPT/soundlib/Dlsbank.cpp 2013-03-22 18:13:13 UTC (rev 1624) +++ trunk/OpenMPT/soundlib/Dlsbank.cpp 2013-03-22 20:54:36 UTC (rev 1625) @@ -1507,12 +1507,13 @@ sample.nFineTune = p->chPitchCorrection; sample.Convert(MOD_TYPE_IT, pSndFile->GetType()); + FileReader chunk(pWaveForm, dwLen); SampleIO( SampleIO::_16bit, SampleIO::mono, SampleIO::littleEndian, SampleIO::signedPCM) - .ReadSample(sample, (LPSTR)pWaveForm, dwLen); + .ReadSample(sample, chunk); } bWaveForm = (sample.pSample) ? TRUE : FALSE; } else Modified: trunk/OpenMPT/soundlib/Load_mt2.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_mt2.cpp 2013-03-22 18:13:13 UTC (rev 1624) +++ trunk/OpenMPT/soundlib/Load_mt2.cpp 2013-03-22 20:54:36 UTC (rev 1625) @@ -599,12 +599,13 @@ Log(" Reading sample #%d at offset 0x%04X (len=%d)\n", iData+1, dwMemPos, psmp->nLength); #endif + FileReader chunk(lpStream + dwMemPos, dwMemLength - dwMemPos); dwMemPos += SampleIO( (sample.uFlags & CHN_16BIT) ? SampleIO::_16bit : SampleIO::_8bit, (pms->nChannels == 2) ? SampleIO::stereoSplit : SampleIO::mono, SampleIO::littleEndian, SampleIO::deltaPCM) - .ReadSample(sample, (LPCSTR)(lpStream + dwMemPos), dwMemLength - dwMemPos); + .ReadSample(sample, chunk); } } else if (dwMemPos+4 < dwMemLength) Modified: trunk/OpenMPT/soundlib/ModChannel.h =================================================================== --- trunk/OpenMPT/soundlib/ModChannel.h 2013-03-22 18:13:13 UTC (rev 1624) +++ trunk/OpenMPT/soundlib/ModChannel.h 2013-03-22 20:54:36 UTC (rev 1625) @@ -10,26 +10,27 @@ #pragma once -// Envelope playback info for each ModChannel -struct ModChannelEnvInfo -{ - FlagSet<EnvelopeFlags> flags; - uint32 nEnvPosition; - int32 nEnvValueAtReleaseJump; - void Reset() - { - nEnvPosition = 0; - nEnvValueAtReleaseJump = NOT_YET_RELEASED; - } -}; - - #pragma warning(disable : 4324) //structure was padded due to __declspec(align()) // Mix Channel Struct typedef struct __declspec(align(32)) ModChannel_ { + // Envelope playback info + struct EnvInfo + { + FlagSet<EnvelopeFlags> flags; + uint32 nEnvPosition; + int32 nEnvValueAtReleaseJump; + + void Reset() + { + nEnvPosition = 0; + nEnvValueAtReleaseJump = NOT_YET_RELEASED; + } + }; + + // Information used in the mixer (should be kept tight for better caching) LPSTR pCurrentSample; // Currently playing sample (nullptr if no sample is playing) uint32 nPos; uint32 nPosLo; // actually 16-bit (fractional part) @@ -43,7 +44,6 @@ SmpLength nLoopStart; SmpLength nLoopEnd; FlagSet<ChannelFlags> dwFlags; - FlagSet<ChannelFlags> dwOldFlags; // Flags from previous tick int32 nRampRightVol; int32 nRampLeftVol; float nFilter_Y1, nFilter_Y2; // Mono / left channel filter memory @@ -52,16 +52,18 @@ int32 nFilter_HP; int32 nROfs, nLOfs; int32 nRampLength; + // Information not used in the mixer + FlagSet<ChannelFlags> dwOldFlags; // Flags from previous tick LPSTR pSample; // Currently playing sample, or previously played sample if no sample is playing. + ModSample *pModSample; // Currently assigned sample slot + ModInstrument *pModInstrument; // Currently assigned instrument slot int32 nNewRightVol, nNewLeftVol; int32 nRealVolume, nRealPan; int32 nVolume, nPan, nFadeOutVol; int32 nPeriod, nC5Speed, nPortamentoDest; int32 nCalcVolume; // Calculated channel volume, 14-Bit (without global volume, pre-amp etc applied) - for MIDI macros - ModInstrument *pModInstrument; // Currently assigned instrument slot - ModChannelEnvInfo VolEnv, PanEnv, PitchEnv; // Envelope playback info - ModSample *pModSample; // Currently assigned sample slot + EnvInfo VolEnv, PanEnv, PitchEnv; // Envelope playback info uint32 nVUMeter; int32 nGlobalVol; // Channel volume (CV in ITTECH.TXT) int32 nInsVol; // Sample / Instrument volume (SV * IV in ITTECH.TXT) @@ -108,7 +110,7 @@ void ClearRowCmd() { rowCommand = ModCommand::Empty(); } // Get a reference to a specific envelope of this channel - const ModChannelEnvInfo &GetEnvelope(enmEnvelopeTypes envType) const + const EnvInfo &GetEnvelope(enmEnvelopeTypes envType) const { switch(envType) { @@ -122,9 +124,9 @@ } } - ModChannelEnvInfo &GetEnvelope(enmEnvelopeTypes envType) + EnvInfo &GetEnvelope(enmEnvelopeTypes envType) { - return const_cast<ModChannelEnvInfo &>(static_cast<const ModChannel &>(*this).GetEnvelope(envType)); + return const_cast<EnvInfo &>(static_cast<const ModChannel &>(*this).GetEnvelope(envType)); } void ResetEnvelopes() Modified: trunk/OpenMPT/soundlib/SampleFormats.cpp =================================================================== --- trunk/OpenMPT/soundlib/SampleFormats.cpp 2013-03-22 18:13:13 UTC (rev 1624) +++ trunk/OpenMPT/soundlib/SampleFormats.cpp 2013-03-22 20:54:36 UTC (rev 1625) @@ -717,7 +717,8 @@ sample.nLoopStart /= 2; sample.nLoopEnd /= 2; } - sampleIO.ReadSample(sample, (LPSTR)(lpStream+dwMemPos), dwMemLength-dwMemPos); + FileReader chunk(lpStream + dwMemPos, dwMemLength - dwMemPos); + sampleIO.ReadSample(sample, chunk); } @@ -912,12 +913,13 @@ sample.Convert(MOD_TYPE_S3M, GetType()); + FileReader chunk(lpMemFile + dwMemPos, dwFileLength - dwMemPos); SampleIO( (pss->flags & 0x04) ? SampleIO::_16bit : SampleIO::_8bit, (pss->flags & 0x02) ? SampleIO::stereoSplit : SampleIO::mono, SampleIO::littleEndian, SampleIO::unsignedPCM) - .ReadSample(sample, (LPSTR)(lpMemFile + dwMemPos), dwFileLength - dwMemPos); + .ReadSample(sample, chunk); return true; } @@ -1824,12 +1826,13 @@ sample.nLength = len; if ((sample.nLoopStart + 4 < sample.nLoopEnd) && (sample.nLoopEnd <= sample.nLength)) sample.uFlags |= CHN_LOOP; + FileReader chunk(pChunkData, len); SampleIO( SampleIO::_8bit, SampleIO::mono, SampleIO::bigEndian, SampleIO::signedPCM) - .ReadSample(sample, (LPSTR)(pChunkData), len); + .ReadSample(sample, chunk); } } break; Modified: trunk/OpenMPT/soundlib/SampleIO.h =================================================================== --- trunk/OpenMPT/soundlib/SampleIO.h 2013-03-22 18:13:13 UTC (rev 1624) +++ trunk/OpenMPT/soundlib/SampleIO.h 2013-03-22 20:54:36 UTC (rev 1625) @@ -12,7 +12,7 @@ #pragma once -#include "../soundlib/FileReader.h" +class FileReader; // Sample import / export formats //============ @@ -143,12 +143,6 @@ // Read a sample from memory size_t ReadSample(ModSample &sample, FileReader &file) const; - // Legacy implementation of above function - /*__declspec(deprecated)*/ size_t ReadSample(ModSample &sample, const void *memFile, size_t memLength) const - { - FileReader file(static_cast<const char *>(memFile), memLength); - return ReadSample(sample, file); - } #ifndef MODPLUG_NO_FILESAVE // Write a sample to file Modified: trunk/OpenMPT/soundlib/Sndmix.cpp =================================================================== --- trunk/OpenMPT/soundlib/Sndmix.cpp 2013-03-22 18:13:13 UTC (rev 1624) +++ trunk/OpenMPT/soundlib/Sndmix.cpp 2013-03-22 20:54:36 UTC (rev 1625) @@ -978,7 +978,7 @@ void CSoundFile::IncrementEnvelopePosition(ModChannel *pChn, enmEnvelopeTypes envType) //------------------------------------------------------------------------------------ { - ModChannelEnvInfo &chnEnv = pChn->GetEnvelope(envType); + ModChannel::EnvInfo &chnEnv = pChn->GetEnvelope(envType); if(pChn->pModInstrument == nullptr || !chnEnv.flags[ENV_ENABLED]) { Modified: trunk/OpenMPT/soundlib/modcommand.h =================================================================== --- trunk/OpenMPT/soundlib/modcommand.h 2013-03-22 18:13:13 UTC (rev 1624) +++ trunk/OpenMPT/soundlib/modcommand.h 2013-03-22 20:54:36 UTC (rev 1625) @@ -13,15 +13,15 @@ #include "Snd_defs.h" // Note definitions -#define NOTE_NONE 0 -#define NOTE_MIN 1 -#define NOTE_MAX 120 // Defines maximum notevalue(with index starting from 1) as well as maximum number of notes. -#define NOTE_MIDDLEC (5 * 12 + NOTE_MIN) -#define NOTE_KEYOFF 0xFF // 255 -#define NOTE_NOTECUT 0xFE // 254 -#define NOTE_FADE 0xFD // 253, IT's action for illegal notes - DO NOT SAVE AS 253 as this is IT's internal representation of "no note"! -#define NOTE_PC 0xFC // 252, Param Control 'note'. Changes param value on first tick. -#define NOTE_PCS 0xFB // 251, Param Control (Smooth) 'note'. Changes param value during the whole row. +#define NOTE_NONE (ModCommand::NOTE(0)) +#define NOTE_MIN (ModCommand::NOTE(1)) +#define NOTE_MAX (ModCommand::NOTE(120)) // Defines maximum notevalue(with index starting from 1) as well as maximum number of notes. +#define NOTE_MIDDLEC (ModCommand::NOTE(5 * 12 + NOTE_MIN)) +#define NOTE_KEYOFF (ModCommand::NOTE(0xFF)) // 255 +#define NOTE_NOTECUT (ModCommand::NOTE(0xFE)) // 254 +#define NOTE_FADE (ModCommand::NOTE(0xFD)) // 253, IT's action for illegal notes - DO NOT SAVE AS 253 as this is IT's internal representation of "no note"! +#define NOTE_PC (ModCommand::NOTE(0xFC)) // 252, Param Control 'note'. Changes param value on first tick. +#define NOTE_PCS (ModCommand::NOTE(0xFB)) // 251, Param Control (Smooth) 'note'. Interpolates param value during the whole row. #define NOTE_MAX_SPECIAL NOTE_KEYOFF #define NOTE_MIN_SPECIAL NOTE_PCS This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |