From: <sag...@us...> - 2009-09-06 12:45:22
|
Revision: 353 http://modplug.svn.sourceforge.net/modplug/?rev=353&view=rev Author: saga-games Date: 2009-09-06 12:45:07 +0000 (Sun, 06 Sep 2009) Log Message: ----------- [Fix] Playback: Fixed a severe bug that caused a crash when trying to play a module that has an empty order list. (introduced in rev. 338) [Fix] IT Loader: The fix for old instrument header versions was wrong. [Fix] Note Properties: When double-clicking on a note in the pattern editor, the noteMin offset was not taken into consideration, which lead to wrong information for some formats. [Fix] Note Properties: Works partly with PC notes now. [Imp] Instrument editor: When inserting new envelope points using Shift+Click, the point can now be instantly dragged. [Imp] Setup: Added note to "always center active row" hint that this is required to be enabled for greyed out patterns [Imp] XI Saver: Fill out the "created with" field properly (OpenMPT instead of FastTracker 2) [Ref] Find/Replace: Partly rewrote Ins+/-1 code, does not work yet (didn't work before, either) [Ref] Renamed Echo Paste to Overflow Paste Modified Paths: -------------- trunk/OpenMPT/mptrack/CommandSet.cpp trunk/OpenMPT/mptrack/CommandSet.h trunk/OpenMPT/mptrack/Ctrl_ins.cpp trunk/OpenMPT/mptrack/Ctrl_pat.cpp trunk/OpenMPT/mptrack/Ctrl_pat.h trunk/OpenMPT/mptrack/Ctrl_smp.cpp trunk/OpenMPT/mptrack/Mainfrm.h trunk/OpenMPT/mptrack/Modedit.cpp trunk/OpenMPT/mptrack/Moptions.cpp trunk/OpenMPT/mptrack/View_ins.cpp trunk/OpenMPT/mptrack/View_ins.h trunk/OpenMPT/mptrack/View_pat.cpp trunk/OpenMPT/mptrack/View_pat.h trunk/OpenMPT/mptrack/dlg_misc.cpp trunk/OpenMPT/mptrack/dlg_misc.h trunk/OpenMPT/mptrack/mptrack.rc trunk/OpenMPT/mptrack/res/patterns.bmp trunk/OpenMPT/mptrack/resource.h trunk/OpenMPT/soundlib/Load_it.cpp trunk/OpenMPT/soundlib/Load_psm.cpp trunk/OpenMPT/soundlib/Sampleio.cpp trunk/OpenMPT/soundlib/Sndmix.cpp Modified: trunk/OpenMPT/mptrack/CommandSet.cpp =================================================================== --- trunk/OpenMPT/mptrack/CommandSet.cpp 2009-09-01 22:08:43 UTC (rev 352) +++ trunk/OpenMPT/mptrack/CommandSet.cpp 2009-09-06 12:45:07 UTC (rev 353) @@ -2315,10 +2315,10 @@ commands[kcChannelReset].isDummy = false; commands[kcChannelReset].Message = "Reset channel"; - commands[kcSwitchEchoPaste].UID = 1787; - commands[kcSwitchEchoPaste].Message = "Switch echo paste"; - commands[kcSwitchEchoPaste].isHidden = false; - commands[kcSwitchEchoPaste].isDummy = false; + commands[kcSwitchOverflowPaste].UID = 1787; + commands[kcSwitchOverflowPaste].Message = "Toggle overflow paste"; + commands[kcSwitchOverflowPaste].isHidden = false; + commands[kcSwitchOverflowPaste].isDummy = false; commands[kcNotePC].UID = 1788; commands[kcNotePC].isHidden = false; Modified: trunk/OpenMPT/mptrack/CommandSet.h =================================================================== --- trunk/OpenMPT/mptrack/CommandSet.h 2009-09-01 22:08:43 UTC (rev 352) +++ trunk/OpenMPT/mptrack/CommandSet.h 2009-09-06 12:45:07 UTC (rev 353) @@ -84,7 +84,7 @@ kcEditPaste, kcEditMixPaste, kcEditMixPasteITStyle, - kcSwitchEchoPaste, + kcSwitchOverflowPaste, kcEditSelectAll, kcEditFind, kcEditFindNext, Modified: trunk/OpenMPT/mptrack/Ctrl_ins.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_ins.cpp 2009-09-01 22:08:43 UTC (rev 352) +++ trunk/OpenMPT/mptrack/Ctrl_ins.cpp 2009-09-06 12:45:07 UTC (rev 353) @@ -314,7 +314,10 @@ } wsprintf(s, "Map all notes to sample %d", pIns->Keyboard[m_nNote]); AppendMenu(hMenu, MF_STRING, ID_NOTEMAP_COPY_SMP, s); - wsprintf(s, "Map all notes to %s", pSndFile->GetNoteName(pIns->NoteMap[m_nNote], m_nInstrument).c_str()); + if(pIns->NoteMap[m_nNote] < NOTE_MIN_SPECIAL) + wsprintf(s, "Map all notes to %s", pSndFile->GetNoteName(pIns->NoteMap[m_nNote], m_nInstrument).c_str()); + else + wsprintf(s, "Map all notes to %s", szSpecialNoteNames[pIns->NoteMap[m_nNote] - NOTE_MIN_SPECIAL]); AppendMenu(hMenu, MF_STRING, ID_NOTEMAP_COPY_NOTE, s); AppendMenu(hMenu, MF_STRING, ID_NOTEMAP_RESET, "Reset note mapping"); AppendMenu(hMenu, MF_STRING, ID_INSTRUMENT_DUPLICATE, "Duplicate Instrument\tShift+New"); Modified: trunk/OpenMPT/mptrack/Ctrl_pat.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_pat.cpp 2009-09-01 22:08:43 UTC (rev 352) +++ trunk/OpenMPT/mptrack/Ctrl_pat.cpp 2009-09-06 12:45:07 UTC (rev 353) @@ -52,7 +52,7 @@ ON_COMMAND(ID_PATTERNDETAIL_LO, OnDetailLo) ON_COMMAND(ID_PATTERNDETAIL_MED, OnDetailMed) ON_COMMAND(ID_PATTERNDETAIL_HI, OnDetailHi) - ON_COMMAND(ID_ECHOPASTE, OnToggleEchoPaste) + ON_COMMAND(ID_OVERFLOWPASTE, OnToggleOverflowPaste) ON_CBN_SELCHANGE(IDC_COMBO_INSTRUMENT, OnInstrumentChanged) // -> CODE#0012 // -> DESC="midi keyboard split" @@ -158,7 +158,7 @@ m_ToolBar.AddButton(ID_PATTERNDETAIL_MED, 31, TBSTYLE_CHECK, TBSTATE_ENABLED); m_ToolBar.AddButton(ID_PATTERNDETAIL_HI, 32, TBSTYLE_CHECK, TBSTATE_ENABLED|TBSTATE_CHECKED); m_ToolBar.AddButton(ID_SEPARATOR, 0, TBSTYLE_SEP); - m_ToolBar.AddButton(ID_ECHOPASTE, 38, TBSTYLE_CHECK, ((CMainFrame::m_dwPatternSetup & PATTERN_ECHOPASTE) ? TBSTATE_CHECKED : 0) | TBSTATE_ENABLED); + m_ToolBar.AddButton(ID_OVERFLOWPASTE, 38, TBSTYLE_CHECK, ((CMainFrame::m_dwPatternSetup & PATTERN_OVERFLOWPASTE) ? TBSTATE_CHECKED : 0) | TBSTATE_ENABLED); // Special edit controls -> tab switch to view m_EditSpacing.SetParent(this); @@ -297,7 +297,7 @@ // -> CODE#0007 // -> DESC="uncheck follow song checkbox by default" CheckDlgButton(IDC_PATTERN_FOLLOWSONG, (CMainFrame::m_dwPatternSetup & PATTERN_FOLLOWSONGOFF) ? MF_UNCHECKED : MF_CHECKED); - m_ToolBar.SetState(ID_ECHOPASTE, ((CMainFrame::m_dwPatternSetup & PATTERN_ECHOPASTE) ? TBSTATE_CHECKED : 0) | TBSTATE_ENABLED); + m_ToolBar.SetState(ID_OVERFLOWPASTE, ((CMainFrame::m_dwPatternSetup & PATTERN_OVERFLOWPASTE) ? TBSTATE_CHECKED : 0) | TBSTATE_ENABLED); // -! BEHAVIOUR_CHANGE#0007 } if (dwHintMask & (HINT_MODTYPE|HINT_INSNAMES|HINT_SMPNAMES|HINT_PATNAMES)) @@ -1216,10 +1216,10 @@ SwitchToView(); } -void CCtrlPatterns::OnToggleEchoPaste() +void CCtrlPatterns::OnToggleOverflowPaste() //------------------------------------- { - CMainFrame::m_dwPatternSetup ^= PATTERN_ECHOPASTE; + CMainFrame::m_dwPatternSetup ^= PATTERN_OVERFLOWPASTE; UpdateView(HINT_MPTOPTIONS, NULL); SwitchToView(); } Modified: trunk/OpenMPT/mptrack/Ctrl_pat.h =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_pat.h 2009-09-01 22:08:43 UTC (rev 352) +++ trunk/OpenMPT/mptrack/Ctrl_pat.h 2009-09-06 12:45:07 UTC (rev 353) @@ -227,7 +227,7 @@ afx_msg void OnUpdateRecord(CCmdUI *pCmdUI); afx_msg void TogglePluginEditor(); //rewbs.instroVST afx_msg void ToggleSplitPluginEditor(); //rewbs.instroVST - afx_msg void OnToggleEchoPaste(); + afx_msg void OnToggleOverflowPaste(); //}}AFX_MSG DECLARE_MESSAGE_MAP() Modified: trunk/OpenMPT/mptrack/Ctrl_smp.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_smp.cpp 2009-09-01 22:08:43 UTC (rev 352) +++ trunk/OpenMPT/mptrack/Ctrl_smp.cpp 2009-09-06 12:45:07 UTC (rev 353) @@ -618,7 +618,7 @@ DWORD d; // Length / Type - wsprintf(s, "%d-bit %s, len: %d", (pSmp->uFlags & CHN_16BIT) ? 16 : 8, (pSmp->uFlags & CHN_STEREO) ? "stereo" : "mono", pSmp->nLength); + wsprintf(s, "%d-bit %s, len: %d", pSmp->GetElementarySampleSize() * 8, (pSmp->uFlags & CHN_STEREO) ? "stereo" : "mono", pSmp->nLength); SetDlgItemText(IDC_TEXT5, s); // Name memcpy(s, m_pSndFile->m_szNames[m_nSample], 32); Modified: trunk/OpenMPT/mptrack/Mainfrm.h =================================================================== --- trunk/OpenMPT/mptrack/Mainfrm.h 2009-09-01 22:08:43 UTC (rev 352) +++ trunk/OpenMPT/mptrack/Mainfrm.h 2009-09-06 12:45:07 UTC (rev 353) @@ -207,7 +207,7 @@ #define PATTERN_SYNCMUTE 0x1000000 #define PATTERN_AUTODELAY 0x2000000 #define PATTERN_NOTEFADE 0x4000000 -#define PATTERN_ECHOPASTE 0x8000000 +#define PATTERN_OVERFLOWPASTE 0x8000000 #define PATTERN_POSITIONAWARETIMER 0x10000000 #define PATTERN_RESETCHANNELS 0x20000000 Modified: trunk/OpenMPT/mptrack/Modedit.cpp =================================================================== --- trunk/OpenMPT/mptrack/Modedit.cpp 2009-09-01 22:08:43 UTC (rev 352) +++ trunk/OpenMPT/mptrack/Modedit.cpp 2009-09-06 12:45:07 UTC (rev 353) @@ -2315,7 +2315,7 @@ nrow++; //jojo.echopaste - if(CMainFrame::m_dwPatternSetup & PATTERN_ECHOPASTE) + if(CMainFrame::m_dwPatternSetup & PATTERN_OVERFLOWPASTE) { while(nrow >= m_SndFile.PatternSize[nPattern]) { Modified: trunk/OpenMPT/mptrack/Moptions.cpp =================================================================== --- trunk/OpenMPT/mptrack/Moptions.cpp 2009-09-01 22:08:43 UTC (rev 352) +++ trunk/OpenMPT/mptrack/Moptions.cpp 2009-09-06 12:45:07 UTC (rev 353) @@ -605,7 +605,7 @@ OPTGEN_SYNCMUTE, OPTGEN_AUTODELAY, OPTGEN_PATNOTEFADE, - OPTGEN_ECHOPASTE, + OPTGEN_OVERFLOWPASTE, OPTGEN_POSITIONAWARETIMER, OPTGEN_RESETCHANNELS, OPTGEN_MAXOPTIONS @@ -625,7 +625,7 @@ {"Ignored muted channels", "Notes will not be played on muted channels (unmuting will only start on a new note)."}, {"Quick cursor paste Auto-Repeat", "Leaving the space bar pressed will auto-repeat the action"}, {"No loud samples", "Disable loud playback of samples in the sample/instrument editor"}, - {"Show Prev/Next patterns", "Displays grayed-out version of the previous/next patterns in the pattern editor"}, + {"Show Prev/Next patterns", "Displays grayed-out version of the previous/next patterns in the pattern editor. Does not work if \"always center active row\" is disabled."}, {"Continuous scroll", "Jumps to the next pattern when moving past the end of a pattern"}, {"Record note off", "Record note off when a key is released on the PC keyboard (Only works in instrument mode)."}, {"Follow song off by default", "Ensure follow song is off when opening or starting a new song."}, //rewbs.noFollow @@ -644,7 +644,7 @@ {"Maintain sample sync on mute", "Samples continue to be processed when channels are muted (like in IT2 and FT2)"}, {"Automatic delay commands", "Automatically insert appropriate note-delay commands when recording notes during live playback."}, {"Note fade on key up", "Enable to fade/stop notes on key up in pattern tab." }, - {"Echo paste mode", "Wrap pasted pattern data into next pattern. This is useful for creating echo channels."}, + {"Overflow paste mode", "Wrap pasted pattern data into next pattern. This is useful for creating echo channels."}, {"Position aware timer", "If enabled, timer will show the playback position time if possible instead of running timer."}, {"Reset channels on loop", "If enabled, channels will be reset to their initial state when song looping is enabled.\nNote: This does not affect manual song loops (i.e. triggered by pattern commands)"}, }; @@ -709,7 +709,7 @@ case OPTGEN_AUTODELAY: bCheck = (CMainFrame::m_dwPatternSetup & PATTERN_AUTODELAY); break; case OPTGEN_PATNOTEFADE: bCheck = (CMainFrame::m_dwPatternSetup & PATTERN_NOTEFADE); break; - case OPTGEN_ECHOPASTE: bCheck = (CMainFrame::m_dwPatternSetup & PATTERN_ECHOPASTE); break; + case OPTGEN_OVERFLOWPASTE: bCheck = (CMainFrame::m_dwPatternSetup & PATTERN_OVERFLOWPASTE); break; case OPTGEN_POSITIONAWARETIMER: bCheck = (CMainFrame::m_dwPatternSetup & PATTERN_POSITIONAWARETIMER); break; case OPTGEN_RESETCHANNELS: bCheck = (CMainFrame::m_dwPatternSetup & PATTERN_RESETCHANNELS); break; } @@ -774,13 +774,13 @@ // case OPTGEN_ALTERNTIVEBPMSPEED: mask = PATTERN_ALTERNTIVEBPMSPEED; break; // rewbs: this options is now available under song settings. It is therefore saved with the song. // -! NEW_FEATURE#0022 - case OPTGEN_PATTERNCTXMENUSTYLE: mask = PATTERN_OLDCTXMENUSTYLE; break; - case OPTGEN_SYNCMUTE: mask = PATTERN_SYNCMUTE; break; - case OPTGEN_AUTODELAY: mask = PATTERN_AUTODELAY; break; - case OPTGEN_PATNOTEFADE: mask = PATTERN_NOTEFADE; break; - case OPTGEN_ECHOPASTE: mask = PATTERN_ECHOPASTE; break; - case OPTGEN_POSITIONAWARETIMER: mask = PATTERN_POSITIONAWARETIMER; break; - case OPTGEN_RESETCHANNELS: mask = PATTERN_RESETCHANNELS; break; + case OPTGEN_PATTERNCTXMENUSTYLE: mask = PATTERN_OLDCTXMENUSTYLE; break; + case OPTGEN_SYNCMUTE: mask = PATTERN_SYNCMUTE; break; + case OPTGEN_AUTODELAY: mask = PATTERN_AUTODELAY; break; + case OPTGEN_PATNOTEFADE: mask = PATTERN_NOTEFADE; break; + case OPTGEN_OVERFLOWPASTE: mask = PATTERN_OVERFLOWPASTE; break; + case OPTGEN_POSITIONAWARETIMER: mask = PATTERN_POSITIONAWARETIMER; break; + case OPTGEN_RESETCHANNELS: mask = PATTERN_RESETCHANNELS; break; } if (bCheck) CMainFrame::m_dwPatternSetup |= mask; else CMainFrame::m_dwPatternSetup &= ~mask; Modified: trunk/OpenMPT/mptrack/View_ins.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_ins.cpp 2009-09-01 22:08:43 UTC (rev 352) +++ trunk/OpenMPT/mptrack/View_ins.cpp 2009-09-06 12:45:07 UTC (rev 353) @@ -1204,7 +1204,117 @@ return envelope->Ticks[EnvGetReleaseNode()]; } +bool CViewInstrument::EnvRemovePoint() +//-------------------------------------- +{ + CModDoc *pModDoc = GetDocument(); + if ((pModDoc) && (m_nDragItem) && (m_nDragItem-1 <= EnvGetLastPoint())) + { + CSoundFile *pSndFile = pModDoc->GetSoundFile(); + MODINSTRUMENT *pIns = pSndFile->Instruments[m_nInstrument]; + if (pIns) + { + INSTRUMENTENVELOPE *envelope = GetEnvelopePtr(); + if(envelope == nullptr || envelope->nNodes == 0) return false; + UINT nPoint = m_nDragItem - 1; + + envelope->nNodes--; + for (UINT i=nPoint; i<envelope->nNodes; i++) + { + envelope->Ticks[i] = envelope->Ticks[i + 1]; + envelope->Values[i] = envelope->Values[i + 1]; + } + if (nPoint >= envelope->nNodes) nPoint = envelope->nNodes-1; + if (envelope->nLoopStart > nPoint) envelope->nLoopStart--; + if (envelope->nLoopEnd > nPoint) envelope->nLoopEnd--; + if (envelope->nSustainStart > nPoint) envelope->nSustainStart--; + if (envelope->nSustainEnd > nPoint) envelope->nSustainEnd--; + if (envelope->nReleaseNode>nPoint && envelope->nReleaseNode!=ENV_RELEASE_NODE_UNSET) envelope->nReleaseNode--; + envelope->Ticks[0] = 0; + + pModDoc->SetModified(); + pModDoc->UpdateAllViews(NULL, (m_nInstrument << HINT_SHIFT_INS) | HINT_ENVELOPE, NULL); + return true; + } + } + return false; +} + +// Insert point. Returns 0 if error occured, else point ID + 1. +UINT CViewInstrument::EnvInsertPoint() +//------------------------------------ +{ + CModDoc *pModDoc = GetDocument(); + if (pModDoc) + { + CSoundFile *pSndFile = pModDoc->GetSoundFile(); + MODINSTRUMENT *pIns = pSndFile->Instruments[m_nInstrument]; + if (pIns) + { + int nTick = ScreenToTick(m_ptMenu.x); + int nValue = ScreenToValue(m_ptMenu.y); + if(nTick < 0) return false; + + UINT maxpoints = (pSndFile->m_nType == MOD_TYPE_XM) ? 12 : 25; + //To check: Should there be MAX_ENVPOINTS? + + nValue = CLAMP(nValue, 0, 64); + + INSTRUMENTENVELOPE *envelope = GetEnvelopePtr(); + if(envelope == nullptr) return false; + BYTE cDefaultValue; + + switch(m_nEnv) + { + case ENV_VOLUME: + cDefaultValue = 64; + break; + case ENV_PANNING: + cDefaultValue = 32; + break; + case ENV_PITCH: + cDefaultValue = (pIns->dwFlags & ENV_FILTER) ? 64 : 32; + break; + default: + return false; + } + + if (envelope->nNodes < maxpoints) + { + if (!envelope->nNodes) + { + envelope->Ticks[0] = 0; + envelope->Values[0] = cDefaultValue; + envelope->nNodes = 1; + } + UINT i = 0; + for (i = 0; i < envelope->nNodes; i++) if (nTick <= envelope->Ticks[i]) break; + for (UINT j = envelope->nNodes; j > i; j--) + { + envelope->Ticks[j] = envelope->Ticks[j - 1]; + envelope->Values[j] = envelope->Values[j - 1]; + } + envelope->Ticks[i] = (WORD)nTick; + envelope->Values[i] = (BYTE)nValue; + envelope->nNodes++; + if (envelope->nLoopStart >= i) envelope->nLoopStart++; + if (envelope->nLoopEnd >= i) envelope->nLoopEnd++; + if (envelope->nSustainStart >= i) envelope->nSustainStart++; + if (envelope->nSustainEnd >= i) envelope->nSustainEnd++; + if (envelope->nReleaseNode >= i && envelope->nReleaseNode != ENV_RELEASE_NODE_UNSET) envelope->nReleaseNode++; + + pModDoc->SetModified(); + pModDoc->UpdateAllViews(NULL, (m_nInstrument << HINT_SHIFT_INS) | HINT_ENVELOPE, NULL); + return i + 1; + } + } + } + return 0; +} + + + void CViewInstrument::DrawPositionMarks(HDC hdc) //---------------------------------------------- { @@ -1705,7 +1815,13 @@ if(CMainFrame::GetMainFrame()->GetInputHandler()->ShiftPressed()) { m_ptMenu = pt; - OnEnvInsertPoint(); + m_nDragItem = EnvInsertPoint(); // returns point ID + 1 if successful, else 0. + if(m_nDragItem > 0) + { + // Drag point if successful + SetCapture(); + m_dwStatus |= INSSTATUS_DRAGGING; + } } } } @@ -1939,106 +2055,13 @@ void CViewInstrument::OnEnvRemovePoint() //-------------------------------------- { - CModDoc *pModDoc = GetDocument(); - if ((pModDoc) && (m_nDragItem) && (m_nDragItem-1 <= EnvGetLastPoint())) - { - CSoundFile *pSndFile = pModDoc->GetSoundFile(); - MODINSTRUMENT *pIns = pSndFile->Instruments[m_nInstrument]; - if (pIns) - { - INSTRUMENTENVELOPE *envelope = GetEnvelopePtr(); - if(envelope == nullptr || envelope->nNodes == 0) return; - - UINT nPoint = m_nDragItem - 1; - - envelope->nNodes--; - for (UINT i=nPoint; i<envelope->nNodes; i++) - { - envelope->Ticks[i] = envelope->Ticks[i + 1]; - envelope->Values[i] = envelope->Values[i + 1]; - } - if (nPoint >= envelope->nNodes) nPoint = envelope->nNodes-1; - if (envelope->nLoopStart > nPoint) envelope->nLoopStart--; - if (envelope->nLoopEnd > nPoint) envelope->nLoopEnd--; - if (envelope->nSustainStart > nPoint) envelope->nSustainStart--; - if (envelope->nSustainEnd > nPoint) envelope->nSustainEnd--; - if (envelope->nReleaseNode>nPoint && envelope->nReleaseNode!=ENV_RELEASE_NODE_UNSET) envelope->nReleaseNode--; - envelope->Ticks[0] = 0; - - pModDoc->SetModified(); - pModDoc->UpdateAllViews(NULL, (m_nInstrument << HINT_SHIFT_INS) | HINT_ENVELOPE, NULL); - } - } + EnvRemovePoint(); } - void CViewInstrument::OnEnvInsertPoint() //-------------------------------------- { - CModDoc *pModDoc = GetDocument(); - if (pModDoc) - { - CSoundFile *pSndFile = pModDoc->GetSoundFile(); - MODINSTRUMENT *pIns = pSndFile->Instruments[m_nInstrument]; - if (pIns) - { - int nTick = ScreenToTick(m_ptMenu.x); - int nValue = ScreenToValue(m_ptMenu.y); - if(nTick < 0) return; - - UINT maxpoints = (pSndFile->m_nType == MOD_TYPE_XM) ? 12 : 25; - //To check: Should there be MAX_ENVPOINTS? - - nValue = CLAMP(nValue, 0, 64); - - INSTRUMENTENVELOPE *envelope = GetEnvelopePtr(); - if(envelope == nullptr) return; - BYTE cDefaultValue; - - switch(m_nEnv) - { - case ENV_VOLUME: - cDefaultValue = 64; - break; - case ENV_PANNING: - cDefaultValue = 32; - break; - case ENV_PITCH: - cDefaultValue = (pIns->dwFlags & ENV_FILTER) ? 64 : 32; - break; - default: - return; - } - - if (envelope->nNodes < maxpoints) - { - if (!envelope->nNodes) - { - envelope->Ticks[0] = 0; - envelope->Values[0] = cDefaultValue; - envelope->nNodes = 1; - } - UINT i = 0; - for (i = 0; i < envelope->nNodes; i++) if (nTick <= envelope->Ticks[i]) break; - for (UINT j = envelope->nNodes; j > i; j--) - { - envelope->Ticks[j] = envelope->Ticks[j - 1]; - envelope->Values[j] = envelope->Values[j - 1]; - } - envelope->Ticks[i] = (WORD)nTick; - envelope->Values[i] = (BYTE)nValue; - envelope->nNodes++; - if (envelope->nLoopStart >= i) envelope->nLoopStart++; - if (envelope->nLoopEnd >= i) envelope->nLoopEnd++; - if (envelope->nSustainStart >= i) envelope->nSustainStart++; - if (envelope->nSustainEnd >= i) envelope->nSustainEnd++; - if (envelope->nReleaseNode >= i && envelope->nReleaseNode != ENV_RELEASE_NODE_UNSET) envelope->nReleaseNode++; - - pModDoc->SetModified(); - pModDoc->UpdateAllViews(NULL, (m_nInstrument << HINT_SHIFT_INS) | HINT_ENVELOPE, NULL); - } - } - } + EnvInsertPoint(); } Modified: trunk/OpenMPT/mptrack/View_ins.h =================================================================== --- trunk/OpenMPT/mptrack/View_ins.h 2009-09-01 22:08:43 UTC (rev 352) +++ trunk/OpenMPT/mptrack/View_ins.h 2009-09-06 12:45:07 UTC (rev 353) @@ -69,6 +69,8 @@ bool EnvSetPanEnv(bool bEnable); bool EnvSetPitchEnv(bool bEnable); bool EnvSetFilterEnv(bool bEnable); + UINT EnvInsertPoint(); + bool EnvRemovePoint(); int TickToScreen(int nTick) const; int PointToScreen(int nPoint) const; int ScreenToTick(int x) const; Modified: trunk/OpenMPT/mptrack/View_pat.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_pat.cpp 2009-09-01 22:08:43 UTC (rev 352) +++ trunk/OpenMPT/mptrack/View_pat.cpp 2009-09-06 12:45:07 UTC (rev 353) @@ -29,6 +29,7 @@ DWORD CViewPattern::m_dwReplaceFlags = 0; UINT CViewPattern::m_nFindMinChn = 0; UINT CViewPattern::m_nFindMaxChn = 0; +signed char cInstrRelChange = 0; IMPLEMENT_SERIAL(CViewPattern, CModScrollView, 0) @@ -1688,6 +1689,7 @@ pageReplace.m_nCommand = m_cmdReplace.command; pageReplace.m_nParam = m_cmdReplace.param; pageReplace.m_dwFlags = m_dwReplaceFlags; + pageReplace.cInstrRelChange = m_cInstrRelChange; dlg.AddPage(&pageFind); dlg.AddPage(&pageReplace); if (dlg.DoModal() == IDOK) @@ -1708,6 +1710,7 @@ m_cmdReplace.command = pageReplace.m_nCommand; m_cmdReplace.param = pageReplace.m_nParam; m_dwReplaceFlags = pageReplace.m_dwFlags; + m_cInstrRelChange = pageReplace.cInstrRelChange; m_bContinueSearch = FALSE; OnEditFindNext(); } @@ -1866,7 +1869,7 @@ if (!(m_dwReplaceFlags & PATSEARCH_REPLACE)) goto EndSearch; if (!(m_dwReplaceFlags & PATSEARCH_REPLACEALL)) { - UINT ans = MessageBox("Replace this occurrence ?", "Replace", MB_YESNOCANCEL); + UINT ans = MessageBox("Replace this occurrence?", "Replace", MB_YESNOCANCEL); if (ans == IDYES) bReplace = TRUE; else if (ans == IDNO) bReplace = FALSE; else goto EndSearch; } @@ -1875,22 +1878,22 @@ if ((m_dwReplaceFlags & PATSEARCH_NOTE)) { // -1 octave - if (m_cmdReplace.note == CFindReplaceTab::replaceMinusOctave) + if (m_cmdReplace.note == CFindReplaceTab::replaceNoteMinusOctave) { if (m->note > 12) m->note -= 12; } else // +1 octave - if (m_cmdReplace.note == CFindReplaceTab::replacePlusOctave) + if (m_cmdReplace.note == CFindReplaceTab::replaceNotePlusOctave) { if (m->note <= NOTE_MAX - 12) m->note += 12; } else // Note-- - if (m_cmdReplace.note == CFindReplaceTab::replaceMinusOne) + if (m_cmdReplace.note == CFindReplaceTab::replaceNoteMinusOne) { if (m->note > 1) m->note--; } else // Note++ - if (m_cmdReplace.note == CFindReplaceTab::replacePlusOne) + if (m_cmdReplace.note == CFindReplaceTab::replaceNotePlusOne) { if (m->note < NOTE_MAX) m->note++; } else m->note = m_cmdReplace.note; @@ -1898,15 +1901,12 @@ if ((m_dwReplaceFlags & PATSEARCH_INSTR)) { // Instr-- - if (m_cmdReplace.instr == CFindReplaceTab::replaceMinusOne) - { + if (m_cInstrRelChange == -1) if (m->instr > 1) m->instr--; - } else // Instr++ - if (m_cmdReplace.instr == CFindReplaceTab::replacePlusOne) - { - if (m->instr < MAX_INSTRUMENTS-1) m->instr++; - } else m->instr = m_cmdReplace.instr; + else if (m_cInstrRelChange == 1) + if (m->instr < MAX_INSTRUMENTS - 1) m->instr++; + else m->instr = m_cmdReplace.instr; } if ((m_dwReplaceFlags & PATSEARCH_VOLCMD)) { @@ -3609,7 +3609,7 @@ case kcChangeLoopStatus: SendCtrlMessage(CTRLMSG_PAT_LOOP, -1); return wParam; case kcNewPattern: SendCtrlMessage(CTRLMSG_PAT_NEWPATTERN); return wParam; case kcSwitchToOrderList: OnSwitchToOrderList(); - case kcSwitchEchoPaste: CMainFrame::m_dwPatternSetup ^= PATTERN_ECHOPASTE; return wParam; + case kcSwitchOverflowPaste: CMainFrame::m_dwPatternSetup ^= PATTERN_OVERFLOWPASTE; return wParam; } //Ranges: Modified: trunk/OpenMPT/mptrack/View_pat.h =================================================================== --- trunk/OpenMPT/mptrack/View_pat.h 2009-09-01 22:08:43 UTC (rev 352) +++ trunk/OpenMPT/mptrack/View_pat.h 2009-09-06 12:45:07 UTC (rev 353) @@ -76,6 +76,7 @@ static MODCOMMAND m_cmdFind, m_cmdReplace, m_cmdOld; static DWORD m_dwFindFlags, m_dwReplaceFlags; static UINT m_nFindMinChn, m_nFindMaxChn; + signed char m_cInstrRelChange; // relative instrument change (quick'n'dirty fix) protected: CFastBitmap m_Dib; Modified: trunk/OpenMPT/mptrack/dlg_misc.cpp =================================================================== --- trunk/OpenMPT/mptrack/dlg_misc.cpp 2009-09-01 22:08:43 UTC (rev 352) +++ trunk/OpenMPT/mptrack/dlg_misc.cpp 2009-09-06 12:45:07 UTC (rev 353) @@ -667,10 +667,10 @@ combo->SetItemData(combo->AddString("..."), 0); if (m_bReplace) { - combo->SetItemData(combo->AddString("note-1"), replaceMinusOne); - combo->SetItemData(combo->AddString("note+1"), replacePlusOne); - combo->SetItemData(combo->AddString("-1 oct"), replaceMinusOctave); - combo->SetItemData(combo->AddString("+1 oct"), replacePlusOctave); + combo->SetItemData(combo->AddString("note-1"), replaceNoteMinusOne); + combo->SetItemData(combo->AddString("note+1"), replaceNotePlusOne); + combo->SetItemData(combo->AddString("-1 oct"), replaceNoteMinusOctave); + combo->SetItemData(combo->AddString("+1 oct"), replaceNotePlusOctave); } else { combo->SetItemData(combo->AddString("any"), findAny); @@ -690,8 +690,8 @@ combo->SetItemData(combo->AddString(".."), 0); if (m_bReplace) { - combo->SetItemData(combo->AddString("ins-1"), replaceMinusOne); - combo->SetItemData(combo->AddString("ins+1"), replacePlusOne); + combo->SetItemData(combo->AddString("ins-1"), replaceInstrumentMinusOne); + combo->SetItemData(combo->AddString("ins+1"), replaceInstrumentPlusOne); } for (UINT n=1; n<MAX_INSTRUMENTS; n++) { @@ -705,10 +705,13 @@ combo->SetItemData(combo->AddString(s), n); } UINT ncount = combo->GetCount(); - for (UINT i=0; i<ncount; i++) if (m_nInstr == combo->GetItemData(i)) + for (UINT i=0; i<ncount; i++) { - combo->SetCurSel(i); - break; + if (m_nInstr == combo->GetItemData(i) || (cInstrRelChange == -1 && combo->GetItemData(i) == replaceInstrumentMinusOne) || (cInstrRelChange == 1 && combo->GetItemData(i) == replaceInstrumentPlusOne)) + { + combo->SetCurSel(i); + break; + } } } // Volume Command @@ -844,7 +847,19 @@ // Instrument if ((combo = (CComboBox *)GetDlgItem(IDC_COMBO2)) != NULL) { - m_nInstr = combo->GetItemData(combo->GetCurSel()); + switch(combo->GetItemData(combo->GetCurSel())) + { + case replaceInstrumentMinusOne: + cInstrRelChange = -1; + break; + case replaceInstrumentPlusOne: + cInstrRelChange = 1; + break; + default: + m_nInstr = combo->GetItemData(combo->GetCurSel()); + cInstrRelChange = 0; + break; + } } // Volume Command if (((combo = (CComboBox *)GetDlgItem(IDC_COMBO3)) != NULL) && (m_pModDoc)) @@ -1230,7 +1245,10 @@ AppendNotesToControlEx(*combo, pSndFile, m_nInstr); if (m_nNote <= NOTE_MAX) - combo->SetCurSel(m_nNote); + { + const MODCOMMAND::NOTE noteStart = (pSndFile != nullptr) ? pSndFile->GetModSpecifications().noteMin : 1; + combo->SetCurSel(m_nNote - (noteStart - 1)); + } else { for(int i = combo->GetCount() - 1; i >= 0; --i) @@ -1248,21 +1266,31 @@ if ((combo = (CComboBox *)GetDlgItem(IDC_COMBO2)) != NULL) { combo->ResetContent(); - combo->SetItemData(combo->AddString("No Instrument"), 0); - UINT max = pSndFile->m_nInstruments; - if (!max) max = pSndFile->m_nSamples; - for (UINT i=1; i<=max; i++) + + if(m_nNote == NOTE_PC || m_nNote == NOTE_PCS) { - wsprintf(s, "%02d:", i); - int k = strlen(s); - if (pSndFile->m_nInstruments) + // control plugin param note + combo->SetItemData(combo->AddString("No Effect"), 0); + AddPluginNamesToCombobox(*combo, pSndFile->m_MixPlugins, false); + } else + { + // instrument / sample + combo->SetItemData(combo->AddString("No Instrument"), 0); + UINT max = max(pSndFile->m_nInstruments, pSndFile->m_nSamples); // instrument / sample mode + for (UINT i = 1; i <= max; i++) { - if (pSndFile->Instruments[i]) - memcpy(s+k, pSndFile->Instruments[i]->name, 32); - } else - memcpy(s+k, pSndFile->m_szNames[i], 32); - s[k+32] = 0; - combo->SetItemData(combo->AddString(s), i); + wsprintf(s, "%02d: ", i); + int k = strlen(s); + // instrument / sample + if (pSndFile->m_nInstruments) + { + if (pSndFile->Instruments[i]) + memcpy(s+k, pSndFile->Instruments[i]->name, 32); + } else + memcpy(s+k, pSndFile->m_szNames[i], 32); + s[k+32] = 0; + combo->SetItemData(combo->AddString(s), i); + } } combo->SetCurSel(m_nInstr); } @@ -1272,6 +1300,8 @@ void CPageEditNote::OnNoteChanged() //--------------------------------- { + bool bWasParamControl = (m_nNote == NOTE_PC || m_nNote == NOTE_PCS) ? true : false; + CComboBox *combo; if ((combo = (CComboBox *)GetDlgItem(IDC_COMBO1)) != NULL) { @@ -1294,6 +1324,10 @@ } } } + bool bIsNowParamControl = (m_nNote == NOTE_PC || m_nNote == NOTE_PCS) ? true : false; + if(bWasParamControl != bIsNowParamControl) + UpdateDialog(); + if (m_pParent) m_pParent->UpdateNote(m_nNote, m_nInstr); } @@ -1324,7 +1358,7 @@ if ((combo = (CComboBox *)GetDlgItem(IDC_COMBO1)) != NULL) { CSoundFile *pSndFile = m_pModDoc->GetSoundFile(); - if (pSndFile->m_nType == MOD_TYPE_MOD) + if (pSndFile->m_nType == MOD_TYPE_MOD || m_bIsParamControl) { combo->EnableWindow(FALSE); return; @@ -1427,18 +1461,27 @@ pSndFile = m_pModDoc->GetSoundFile(); if ((combo = (CComboBox *)GetDlgItem(IDC_COMBO1)) != NULL) { - UINT numfx = m_pModDoc->GetNumEffects(); - UINT fxndx = m_pModDoc->GetIndexFromEffect(m_nCommand, m_nParam); combo->ResetContent(); - combo->SetItemData(combo->AddString(" None"), (DWORD)-1); - if (!m_nCommand) combo->SetCurSel(0); - for (UINT i=0; i<numfx; i++) + if(m_bIsParamControl) { - if (m_pModDoc->GetEffectInfo(i, s, TRUE)) + // plugin param control note + AddPluginParameternamesToCombobox(*combo, pSndFile->m_MixPlugins[m_nPlugin]); + combo->SetCurSel(m_nPluginParam); + } else + { + // process as effect + UINT numfx = m_pModDoc->GetNumEffects(); + UINT fxndx = m_pModDoc->GetIndexFromEffect(m_nCommand, m_nParam); + combo->SetItemData(combo->AddString(" None"), (DWORD)-1); + if (!m_nCommand) combo->SetCurSel(0); + for (UINT i=0; i<numfx; i++) { - int k = combo->AddString(s); - combo->SetItemData(k, i); - if (i == fxndx) combo->SetCurSel(k); + if (m_pModDoc->GetEffectInfo(i, s, TRUE)) + { + int k = combo->AddString(s); + combo->SetItemData(k, i); + if (i == fxndx) combo->SetCurSel(k); + } } } } Modified: trunk/OpenMPT/mptrack/dlg_misc.h =================================================================== --- trunk/OpenMPT/mptrack/dlg_misc.h 2009-09-01 22:08:43 UTC (rev 352) +++ trunk/OpenMPT/mptrack/dlg_misc.h 2009-09-06 12:45:07 UTC (rev 353) @@ -133,6 +133,7 @@ public: UINT m_nNote, m_nInstr, m_nVolCmd, m_nVol, m_nCommand, m_nParam, m_nMinChannel, m_nMaxChannel; + signed char cInstrRelChange; DWORD m_dwFlags; enum findItem @@ -143,10 +144,13 @@ enum replaceItem { - replaceMinusOctave = NOTE_MIN_SPECIAL - 1, - replacePlusOctave = NOTE_MIN_SPECIAL - 2, - replaceMinusOne = NOTE_MIN_SPECIAL - 3, - replacePlusOne = NOTE_MIN_SPECIAL - 4 + replaceNotePlusOne = NOTE_MAX + 1, + replaceNoteMinusOne = NOTE_MAX + 2, + replaceNotePlusOctave = NOTE_MAX + 3, + replaceNoteMinusOctave = NOTE_MAX + 4, + + replaceInstrumentPlusOne = MAX_INSTRUMENTS + 1, + replaceInstrumentMinusOne = MAX_INSTRUMENTS + 2, }; // Make sure there's unused notes between NOTE_MAX and NOTE_MIN_SPECIAL. @@ -235,10 +239,11 @@ { protected: UINT m_nVolCmd, m_nVolume; + bool m_bIsParamControl; public: CPageEditVolume(CModDoc *pModDoc, CEditCommand *parent):CPageEditCommand(pModDoc, parent, IDD_PAGEEDITVOLUME) {} - void Init(MODCOMMAND &m) { m_nVolCmd = m.volcmd; m_nVolume = m.vol; } + void Init(MODCOMMAND &m) { m_nVolCmd = m.volcmd; m_nVolume = m.vol; m_bIsParamControl = (m.note == NOTE_PC || m.note == NOTE_PCS) ? true : false;} void UpdateDialog(); void UpdateRanges(); @@ -256,7 +261,9 @@ //============================================ { protected: - UINT m_nCommand, m_nParam; + UINT m_nCommand, m_nParam, m_nPlugin; + UINT m_nPluginParam; + bool m_bIsParamControl; // -> CODE#0010 // -> DESC="add extended parameter mechanism to pattern effects" UINT m_nXParam, m_nMultiplier; @@ -268,7 +275,7 @@ CPageEditEffect(CModDoc *pModDoc, CEditCommand *parent):CPageEditCommand(pModDoc, parent, IDD_PAGEEDITEFFECT) {} // -> CODE#0010 // -> DESC="add extended parameter mechanism to pattern effects" - void Init(MODCOMMAND &m) { m_nCommand = m.command; m_nParam = m.param; m_pModcommand = &m;} + void Init(MODCOMMAND &m) { m_nCommand = m.command; m_nParam = m.param; m_pModcommand = &m; m_bIsParamControl = (m.note == NOTE_PC || m.note == NOTE_PCS) ? true : false; m_nPlugin = m.instr; m_nPluginParam = MODCOMMAND::GetValueVolCol(m.volcmd, m.vol);} void XInit(UINT xparam = 0, UINT multiplier = 1) { m_nXParam = xparam; m_nMultiplier = multiplier; } // -! NEW_FEATURE#0010 void UpdateDialog(); Modified: trunk/OpenMPT/mptrack/mptrack.rc =================================================================== --- trunk/OpenMPT/mptrack/mptrack.rc 2009-09-01 22:08:43 UTC (rev 352) +++ trunk/OpenMPT/mptrack/mptrack.rc 2009-09-06 12:45:07 UTC (rev 353) @@ -2120,7 +2120,7 @@ BEGIN ID_EDIT_GOTO_MENU "Go to row / channel / pattern / order" ID_CLEANUP_COMPO "Reset attributes to defaults (useful for creating sample packs)\nCompo Cleanup" - ID_ECHOPASTE "Toggle echo paste\nToggle echo paste" + ID_OVERFLOWPASTE "Toggle overflow paste\nToggle overflow paste" END STRINGTABLE Modified: trunk/OpenMPT/mptrack/res/patterns.bmp =================================================================== (Binary files differ) Modified: trunk/OpenMPT/mptrack/resource.h =================================================================== --- trunk/OpenMPT/mptrack/resource.h 2009-09-01 22:08:43 UTC (rev 352) +++ trunk/OpenMPT/mptrack/resource.h 2009-09-06 12:45:07 UTC (rev 353) @@ -1113,7 +1113,7 @@ #define ID_CLEANUP_COMPO 59221 #define ID_SAMPLE_DRAW 59224 #define ID_SAMPLE_ADDSILENCE 59225 -#define ID_ECHOPASTE 59226 +#define ID_OVERFLOWPASTE 59226 #define ID_NOTEMAP_COPY_NOTE 59227 #define ID_CLEANUP_REARRANGESAMPLES 59228 Modified: trunk/OpenMPT/soundlib/Load_it.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_it.cpp 2009-09-01 22:08:43 UTC (rev 352) +++ trunk/OpenMPT/soundlib/Load_it.cpp 2009-09-06 12:45:07 UTC (rev 353) @@ -230,7 +230,7 @@ const ITOLDINSTRUMENT *pis = (const ITOLDINSTRUMENT *)p; memcpy(pIns->name, pis->name, 26); memcpy(pIns->filename, pis->filename, 12); - pIns->nFadeOut = pis->fadeout << 7; + pIns->nFadeOut = pis->fadeout << 6; pIns->nGlobalVol = 64; for (UINT j=0; j<NOTE_MAX; j++) { Modified: trunk/OpenMPT/soundlib/Load_psm.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_psm.cpp 2009-09-01 22:08:43 UTC (rev 352) +++ trunk/OpenMPT/soundlib/Load_psm.cpp 2009-09-06 12:45:07 UTC (rev 353) @@ -776,7 +776,10 @@ for(uint32 nCell = 0; nCell < m_nChannels * Patterns[endPattern].GetNumRows(); nCell++) { if(row_data->command == CMD_PATTERNBREAK || row_data->command == CMD_POSITIONJUMP) + { lastRow = nCell / m_nChannels; + break; + } row_data++; } TryWriteEffect(endPattern, lastRow, CMD_POSITIONJUMP, (BYTE)subsongs[i].restartPos, false, CHANNELINDEX_INVALID, false, true); Modified: trunk/OpenMPT/soundlib/Sampleio.cpp =================================================================== --- trunk/OpenMPT/soundlib/Sampleio.cpp 2009-09-01 22:08:43 UTC (rev 352) +++ trunk/OpenMPT/soundlib/Sampleio.cpp 2009-09-06 12:45:07 UTC (rev 353) @@ -1324,7 +1324,7 @@ memcpy(xfh.extxi, "Extended Instrument: ", 21); memcpy(xfh.name, pIns->name, 22); xfh.name[22] = 0x1A; - memcpy(xfh.trkname, "FastTracker v2.00 ", 20); + memcpy(xfh.trkname, "Created by OpenMPT ", 20); xfh.shsize = 0x102; fwrite(&xfh, 1, sizeof(xfh), f); // XI Instrument Header Modified: trunk/OpenMPT/soundlib/Sndmix.cpp =================================================================== --- trunk/OpenMPT/soundlib/Sndmix.cpp 2009-09-01 22:08:43 UTC (rev 352) +++ trunk/OpenMPT/soundlib/Sndmix.cpp 2009-09-06 12:45:07 UTC (rev 353) @@ -642,16 +642,18 @@ if ((m_nPattern < Patterns.Size()) && (!Patterns[m_nPattern])) m_nPattern = Order.GetIgnoreIndex(); while (m_nPattern >= Patterns.Size()) { - // End of song ? + // End of song? if ((m_nPattern == Order.GetInvalidPatIndex()) || (m_nCurrentPattern >= Order.size())) { if (!m_nRepeatCount) return FALSE; ORDERINDEX nRestartPosOverride = m_nRestartPos; - if(!m_nRestartPos && m_nCurrentPattern <= Order.size()) + if(!m_nRestartPos && m_nCurrentPattern <= Order.size() && m_nCurrentPattern > 0) { - // if we're in a subtune and there's no restart position, go to the first order of the subtune + /* Subtune detection. Subtunes are separated by "---" order items, so if we're in a + subtune and there's no restart position, we go to the first order of the subtune + (i.e. the first order after the previous "---" item) */ for(ORDERINDEX iOrd = m_nCurrentPattern - 1; iOrd > 0; iOrd--) { if(Order[iOrd] == Order.GetInvalidPatIndex()) @@ -709,7 +711,6 @@ //Handle Repeat position if (m_nRepeatCount > 0) m_nRepeatCount--; m_nCurrentPattern = nRestartPosOverride; - //m_nRow = 0; m_dwSongFlags &= ~SONG_BREAKTOROW; //If restart pos points to +++, move along while (Order[m_nCurrentPattern] == Order.GetIgnoreIndex()) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |