From: <sag...@us...> - 2012-12-03 00:35:57
|
Revision: 1444 http://modplug.svn.sourceforge.net/modplug/?rev=1444&view=rev Author: saga-games Date: 2012-12-03 00:35:49 +0000 (Mon, 03 Dec 2012) Log Message: ----------- [Imp] Added quantize settings shortcut [Fix] Note quantization also works on the first played note when using "continue playing as soon as MIDI notes are being received". Modified Paths: -------------- trunk/OpenMPT/mptrack/CommandSet.cpp trunk/OpenMPT/mptrack/CommandSet.h trunk/OpenMPT/mptrack/View_pat.cpp trunk/OpenMPT/mptrack/View_pat.h Modified: trunk/OpenMPT/mptrack/CommandSet.cpp =================================================================== --- trunk/OpenMPT/mptrack/CommandSet.cpp 2012-12-02 16:11:56 UTC (rev 1443) +++ trunk/OpenMPT/mptrack/CommandSet.cpp 2012-12-03 00:35:49 UTC (rev 1444) @@ -644,6 +644,7 @@ DefineKeyCommand(kcSampleMonoLeft, 1889, _T("Convert to Mono (Left Channel)")); DefineKeyCommand(kcSampleMonoRight, 1890, _T("Convert to Mono (Right Channel)")); DefineKeyCommand(kcSampleMonoSplit, 1891, _T("Convert to Mono (Split Sample)")); + DefineKeyCommand(kcQuantizeSettings, 1892, _T("Quantize Settings")); // Add new key commands here. @@ -975,11 +976,12 @@ switch (inCmd) { case kcSelect: cmdOff = kcSelectOff; break; - case kcSelectWithNav: cmdOff = kcSelectOffWithNav; break; - case kcCopySelect: cmdOff = kcCopySelectOff; break; - case kcCopySelectWithNav: cmdOff = kcCopySelectOffWithNav; break; + case kcSelectWithNav: cmdOff = kcSelectOffWithNav; break; + case kcCopySelect: cmdOff = kcCopySelectOff; break; + case kcCopySelectWithNav: cmdOff = kcCopySelectOffWithNav; break; case kcSelectWithCopySelect: cmdOff = kcSelectOffWithCopySelect; break; case kcCopySelectWithSelect: cmdOff = kcCopySelectOffWithSelect; break; + default: ruleApplies = false; } Modified: trunk/OpenMPT/mptrack/CommandSet.h =================================================================== --- trunk/OpenMPT/mptrack/CommandSet.h 2012-12-02 16:11:56 UTC (rev 1443) +++ trunk/OpenMPT/mptrack/CommandSet.h 2012-12-03 00:35:49 UTC (rev 1444) @@ -21,7 +21,7 @@ enum InputTargetContext { - kCtxUnknownContext = -1, + kCtxUnknownContext = -1, kCtxAllContexts = 0, kCtxViewGeneral, @@ -250,7 +250,8 @@ kcChangeLoopStatus, kcShowEditMenu, kcTimeAtRow, - kcEndPatternEditMisc=kcTimeAtRow, + kcQuantizeSettings, + kcEndPatternEditMisc=kcQuantizeSettings, kcStartChannelKeys, kcChannelMute = kcStartChannelKeys, Modified: trunk/OpenMPT/mptrack/View_pat.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_pat.cpp 2012-12-02 16:11:56 UTC (rev 1443) +++ trunk/OpenMPT/mptrack/View_pat.cpp 2012-12-03 00:35:49 UTC (rev 1444) @@ -43,6 +43,7 @@ }; // Static initializers +ROWINDEX CViewPattern::m_nQuantize = 0; ModCommand CViewPattern::m_cmdOld = ModCommand::Empty(); PatternClipboard CViewPattern::patternClipboard; @@ -176,7 +177,6 @@ m_nPlayPat = PATTERNINDEX_INVALID; m_nPlayRow = 0; m_nMidRow = 0; - m_nQuantize = 0; m_nDragItem = 0; m_bDragging = false; m_bInItemRect = false; @@ -1496,6 +1496,7 @@ { s.Append("Settings..."); } + s.Append("\t" + ih->GetKeyTextFromCommand(kcQuantizeSettings)); AppendMenu(hMenu, MF_STRING | (m_nQuantize != 0 ? MF_CHECKED : 0), ID_SETQUANTIZE, s); } @@ -3820,12 +3821,12 @@ nVol = CMainFrame::ApplyVolumeRelatedSettings(dwMidiData, midivolume); if(nVol < 0) nVol = -1; else nVol = (nVol + 3) / 4; //Value from [0,256] to [0,64] - TempEnterNote(nNote, true, nVol); - + TempEnterNote(nNote, true, nVol, true); + // continue playing as soon as MIDI notes are being received (http://forum.openmpt.org/index.php?topic=2813.0) if(pSndFile->IsPaused() && (CMainFrame::GetSettings().m_dwMidiSetup & MIDISETUP_PLAYPATTERNONMIDIIN)) pModDoc->OnPatternPlayNoLoop(); - + break; case MIDIEvents::evPolyAftertouch: // Polyphonic aftertouch @@ -4340,6 +4341,7 @@ case kcSwitchToOrderList: OnSwitchToOrderList(); case kcSwitchOverflowPaste: CMainFrame::GetSettings().m_dwPatternSetup ^= PATTERN_OVERFLOWPASTE; return wParam; case kcPatternEditPCNotePlugin: OnTogglePCNotePluginEditor(); return wParam; + case kcQuantizeSettings: OnSetQuantize(); return wParam; case kcChannelSettings: { // Open centered Quick Channel Settings dialog. @@ -4748,8 +4750,8 @@ if(usePlaybackPosition) SetEditPos(*pSndFile, nRow, nPat, nRowPlayback, nPatPlayback); - const bool quantize = usePlaybackPosition && (m_nQuantize != 0); - if(quantize) + const bool doQuantize = (liveRecord || (fromMidi && (CMainFrame::GetSettings().m_dwMidiSetup & MIDISETUP_PLAYPATTERNONMIDIIN))) && m_nQuantize != 0; + if(doQuantize) { QuantizeRow(nPat, nRow); } @@ -4777,7 +4779,7 @@ pModDoc->GetPatternUndo().PrepareUndo(nPat, nChn, nRow, 1, 1, "Note Stop Entry"); // -- write sdx if playing live - if(usePlaybackPosition && nTick && pTarget->command == CMD_NONE && !quantize) + if(usePlaybackPosition && nTick && pTarget->command == CMD_NONE && !doQuantize) { pTarget->command = (pSndFile->TypeIsS3M_IT_MPT()) ? CMD_S3MCMDEX : CMD_MODCMDEX; pTarget->param = 0xD0 | min(0xF, nTick); @@ -4796,7 +4798,7 @@ } else { // we don't have anything to cut (MOD format) - use volume or ECx - if(usePlaybackPosition && nTick && !quantize) // ECx + if(usePlaybackPosition && nTick && !doQuantize) // ECx { pTarget->command = (pSndFile->TypeIsS3M_IT_MPT()) ? CMD_S3MCMDEX : CMD_MODCMDEX; pTarget->param = 0xC0 | min(0xF, nTick); @@ -4922,8 +4924,8 @@ // Enter a note in the pattern -void CViewPattern::TempEnterNote(int note, bool oldStyle, int vol) -//---------------------------------------------------------------- +void CViewPattern::TempEnterNote(int note, bool oldStyle, int vol, bool fromMidi) +//------------------------------------------------------------------------------- { CMainFrame *pMainFrm = CMainFrame::GetMainFrame(); CModDoc *pModDoc = GetDocument(); @@ -4997,7 +4999,7 @@ SetEditPos(*pSndFile, nRow, nPat, nRowPlayback, nPatPlayback); // Quantize - const bool doQuantize = usePlaybackPosition && (m_nQuantize != 0); + const bool doQuantize = (liveRecord || (fromMidi && (CMainFrame::GetSettings().m_dwMidiSetup & MIDISETUP_PLAYPATTERNONMIDIIN))) && m_nQuantize != 0; if(doQuantize) { QuantizeRow(nPat, nRow); Modified: trunk/OpenMPT/mptrack/View_pat.h =================================================================== --- trunk/OpenMPT/mptrack/View_pat.h 2012-12-02 16:11:56 UTC (rev 1443) +++ trunk/OpenMPT/mptrack/View_pat.h 2012-12-03 00:35:49 UTC (rev 1444) @@ -139,7 +139,7 @@ UINT m_nMidRow, m_nSpacing, m_nAccelChar, m_nLastPlayedRow, m_nLastPlayedOrder; PATTERNINDEX m_nPlayPat; ROWINDEX m_nPlayRow; - ROWINDEX m_nQuantize; + static ROWINDEX m_nQuantize; int m_nXScroll, m_nYScroll; PatternCursor::Columns m_nDetailLevel; // Visible Columns @@ -281,8 +281,8 @@ //rewbs.customKeys void CursorJump(DWORD distance, bool upwards, bool snap); - void TempEnterNote(int n, bool oldStyle = false, int vol = -1); - void TempStopNote(int note, bool fromMidi=false, const bool bChordMode=false); + void TempEnterNote(int n, bool oldStyle = false, int vol = -1, bool fromMidi = false); + void TempStopNote(int note, bool fromMidi = false, const bool bChordMode = false); void TempEnterChord(int n); void TempStopChord(int note) {TempStopNote(note, false, true);} void TempEnterIns(int val); @@ -462,13 +462,14 @@ // Return true if recording live (i.e. editing while following playback). bool IsLiveRecord() const { - CMainFrame *mainFrm = CMainFrame::GetMainFrame(); - if(mainFrm == nullptr || GetDocument() == nullptr || GetSoundFile() == nullptr) + const CMainFrame *mainFrm = CMainFrame::GetMainFrame(); + const CSoundFile *sndFile = GetSoundFile(); + if(mainFrm == nullptr || sndFile == nullptr) { return false; } // (following song) && (following in correct document) && (playback is on) - return (m_dwStatus & psFollowSong) && mainFrm->GetFollowSong(GetDocument()) == m_hWnd && !GetSoundFile()->IsPaused(); + return (m_dwStatus & psFollowSong) && mainFrm->GetFollowSong(GetDocument()) == m_hWnd && !sndFile->IsPaused(); }; // If given edit positions are valid, sets them to iRow and iPat. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |