From: <rel...@us...> - 2009-04-04 20:15:26
|
Revision: 254 http://modplug.svn.sourceforge.net/modplug/?rev=254&view=rev Author: relabsoluness Date: 2009-04-04 20:15:12 +0000 (Sat, 04 Apr 2009) Log Message: ----------- (Patches from Jojo, merged slightly modified) + Sample tab: Can now normalize sample selections. . Envelope view: Middle line will now be drawn in panning and pitch/filter envelopes even if row guidelines are enabled. / PackageTemplate:: Update to DE_jojo-keymap Modified Paths: -------------- trunk/OpenMPT/mptrack/Ctrl_smp.cpp trunk/OpenMPT/mptrack/View_ins.cpp trunk/OpenMPT/packageTemplate/extraKeymaps/DE_jojo.mkb Modified: trunk/OpenMPT/mptrack/Ctrl_smp.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_smp.cpp 2009-04-04 19:09:48 UTC (rev 253) +++ trunk/OpenMPT/mptrack/Ctrl_smp.cpp 2009-04-04 20:15:12 UTC (rev 254) @@ -1037,7 +1037,9 @@ //Default case: Normalize current sample UINT iMinSample = m_nSample, iMaxSample = m_nSample; - + //If only one sample is selected, parts of it may be amplified + UINT iStart = 0, iEnd = 0; + //Shift -> Normalize all samples if(CMainFrame::GetInputHandler()->ShiftPressed()) { @@ -1045,6 +1047,13 @@ if(ans == IDNO) return; iMinSample = 1; iMaxSample = m_pSndFile->m_nSamples; + } else { + SAMPLEVIEWSTATE viewstate; + memset(&viewstate, 0, sizeof(viewstate)); + SendViewMessage(VIEWMSG_SAVESTATE, (LPARAM)&viewstate); + + iStart = viewstate.dwBeginSel; + iEnd = viewstate.dwEndSel; } @@ -1058,13 +1067,26 @@ BOOL bOk = FALSE; MODINSTRUMENT *pins = &m_pSndFile->Ins[iSmp]; + if(iMinSample != iMaxSample) { + //if more than one sample is selected, always amplify the whole sample. + iStart = 0; + iEnd = pins->nLength; + } else { + //one sample: correct the boundaries, if needed + if (iEnd > pins->nLength) iEnd = pins->nLength; + if (iStart > iEnd) iStart = iEnd; + if (iStart == iEnd) { + iStart = 0; + iEnd = pins->nLength; + } + } + if (pins->uFlags & CHN_STEREO) { iStart *= 2; iEnd *= 2; } + if (pins->uFlags & CHN_16BIT) { - UINT len = pins->nLength; signed short *p = (signed short *)pins->pSample; - if (pins->uFlags & CHN_STEREO) len *= 2; int max = 1; - for (UINT i=0; i<len; i++) + for (UINT i = iStart; i < iEnd; i++) { if (p[i] > max) max = p[i]; if (-p[i] > max) max = -p[i]; @@ -1072,7 +1094,7 @@ if (max < 32767) { max++; - for (UINT j=0; j<len; j++) + for (UINT j = iStart; j < iEnd; j++) { int l = p[j]; p[j] = (l << 15) / max; @@ -1081,11 +1103,9 @@ } } else { - UINT len = pins->nLength; signed char *p = (signed char *)pins->pSample; - if (pins->uFlags & CHN_STEREO) len *= 2; int max = 1; - for (UINT i=0; i<len; i++) + for (UINT i = iStart; i < iEnd; i++) { if (p[i] > max) max = p[i]; if (-p[i] > max) max = -p[i]; @@ -1093,7 +1113,7 @@ if (max < 127) { max++; - for (UINT j=0; j<len; j++) + for (UINT j = iStart; j < iEnd; j++) { int l = p[j]; p[j] = (l << 7) / max; Modified: trunk/OpenMPT/mptrack/View_ins.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_ins.cpp 2009-04-04 19:09:48 UTC (rev 253) +++ trunk/OpenMPT/mptrack/View_ins.cpp 2009-04-04 20:15:12 UTC (rev 254) @@ -1268,15 +1268,15 @@ //hdc = pDC->m_hDC; oldpen = m_dcMemMain.SelectObject(CMainFrame::penDarkGray); m_dcMemMain.FillRect(&m_rcClient, CBrush::FromHandle(CMainFrame::brushBlack)); + if (m_bGrid) + { + DrawGrid(&m_dcMemMain, pSndFile->m_nMusicSpeed); + } if (m_nEnv != ENV_VOLUME) { m_dcMemMain.MoveTo(0, ymed); m_dcMemMain.LineTo(m_rcClient.right, ymed); } - if (m_bGrid) - { - DrawGrid(&m_dcMemMain, pSndFile->m_nMusicSpeed); - } m_dcMemMain.SelectObject(CMainFrame::penDarkGray); // Drawing Loop Start/End if (EnvGetLoop()) Modified: trunk/OpenMPT/packageTemplate/extraKeymaps/DE_jojo.mkb =================================================================== --- trunk/OpenMPT/packageTemplate/extraKeymaps/DE_jojo.mkb 2009-04-04 19:09:48 UTC (rev 253) +++ trunk/OpenMPT/packageTemplate/extraKeymaps/DE_jojo.mkb 2009-04-04 20:15:12 UTC (rev 254) @@ -6,6 +6,7 @@ //----( Global Context (0) )------------ 0:1347:2:78:1 //File/New: Ctrl+N (KeyDown) 0:1346:2:79:1 //File/Open: Ctrl+O (KeyDown) +0:1348:2:87:1 //File/Close: Ctrl+W (KeyDown) 0:1349:2:83:1 //File/Save: Ctrl+S (KeyDown) 0:1030:0:116:1 //Play song/Pause song: F5 (KeyDown) 0:1031:0:119:1 //Pause song: F8 (KeyDown) @@ -19,6 +20,7 @@ 0:1361:2:67:1 //Copy: Ctrl+C (KeyDown) 0:1361:2:45:1 //Copy: Ctrl+EINFG (KeyDown) 0:1362:2:86:1 //Paste: Ctrl+V (KeyDown) +0:1363:3:86:1 //Mix Paste: Shift+Ctrl+V (KeyDown) 0:1686:1:86:1 //Mix Paste (old IT Style): Shift+V (KeyDown) 0:1364:2:53:1 //SelectAll: Ctrl+5 (KeyDown) 0:1365:2:70:1 //Find: Ctrl+F (KeyDown) @@ -62,6 +64,7 @@ 2:1049:6:35:1 //Go to last row of last channel: Ctrl+Alt+ENDE (KeyDown) 2:1050:1:16:1 //Selection key: Shift+UMSCHALT (KeyDown) 2:1011:2:76:1 //Select channel / Select all: Ctrl+L (KeyDown) +2:1663:0:145:1 //Toggle follow song: ROLLEN-FESTSTELL (KeyDown) 2:1003:0:13:1 //Quick copy: EINGABE (KeyDown) 2:1004:0:32:5 //Quick paste: LEER (KeyDown|KeyHold) 2:1001:2:32:1 //Enable recording: Ctrl+LEER (KeyDown) @@ -79,10 +82,12 @@ 2:1014:2:74:1 //Interpolate volume: Ctrl+J (KeyDown) 2:1015:2:75:1 //Interpolate effect: Ctrl+K (KeyDown) 2:1016:4:66:1 //Open effect visualizer: Alt+B (KeyDown) +2:1766:2:71:1 //Go to row/channel/...: Ctrl+G (KeyDown) 2:1013:2:73:1 //Apply current instrument: Ctrl+I (KeyDown) 2:1660:4:69:5 //Grow selection: Alt+E (KeyDown|KeyHold) 2:1661:4:68:5 //Shrink selection: Alt+D (KeyDown|KeyHold) 2:1059:2:46:1 //Clear row and step: Ctrl+ENTF (KeyDown) +2:1060:1:46:1 //Clear field and step: Shift+ENTF (KeyDown) 2:1665:0:46:1 //Clear field and step (IT Style): ENTF (KeyDown) 2:1061:0:8:5 //Delete rows: R\xDCCK (KeyDown|KeyHold) 2:1377:2:8:5 //Delete all rows: Ctrl+R\xDCCK (KeyDown|KeyHold) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |