From: <rel...@us...> - 2011-07-30 20:40:37
|
Revision: 944 http://modplug.svn.sourceforge.net/modplug/?rev=944&view=rev Author: relabsoluness Date: 2011-07-30 20:40:29 +0000 (Sat, 30 Jul 2011) Log Message: ----------- [Ref] Clean up: Building mptrack-project should now generate much less warnings. Modified Paths: -------------- trunk/OpenMPT/mptrack/ColourEdit.cpp trunk/OpenMPT/mptrack/Draw_pat.cpp trunk/OpenMPT/mptrack/EffectVis.cpp trunk/OpenMPT/mptrack/EffectVis.h trunk/OpenMPT/mptrack/HyperEdit.cpp trunk/OpenMPT/mptrack/HyperEdit2.cpp trunk/OpenMPT/mptrack/ModConvert.cpp trunk/OpenMPT/mptrack/OpenGLControl.cpp trunk/OpenMPT/mptrack/OpenGLControl.h trunk/OpenMPT/mptrack/OpenGLDevice.cpp trunk/OpenMPT/mptrack/OpenGLEditor.cpp trunk/OpenMPT/mptrack/OpenGLEditor.h trunk/OpenMPT/mptrack/PSRatioCalc.cpp trunk/OpenMPT/mptrack/PatternGotoDialog.cpp trunk/OpenMPT/mptrack/SoundFilePlayConfig.h trunk/OpenMPT/mptrack/TrackerSettings.cpp trunk/OpenMPT/mptrack/View_pat.cpp trunk/OpenMPT/mptrack/View_pat.h trunk/OpenMPT/mptrack/misc_util.h trunk/OpenMPT/mptrack/test/test.cpp trunk/OpenMPT/soundlib/Dlsbank.cpp trunk/OpenMPT/soundlib/Dlsbank.h trunk/OpenMPT/soundlib/LOAD_DMF.CPP trunk/OpenMPT/soundlib/LOAD_DSM.CPP trunk/OpenMPT/soundlib/Load_med.cpp trunk/OpenMPT/soundlib/Load_mod.cpp trunk/OpenMPT/soundlib/Snd_defs.h trunk/OpenMPT/soundlib/Snd_flt.cpp trunk/OpenMPT/soundlib/Snddev.cpp trunk/OpenMPT/soundlib/Sndmix.cpp trunk/OpenMPT/soundlib/Tables.cpp trunk/OpenMPT/soundlib/WindowedFIR.cpp trunk/OpenMPT/soundlib/mod_specifications.h Modified: trunk/OpenMPT/mptrack/ColourEdit.cpp =================================================================== --- trunk/OpenMPT/mptrack/ColourEdit.cpp 2011-07-30 20:32:17 UTC (rev 943) +++ trunk/OpenMPT/mptrack/ColourEdit.cpp 2011-07-30 20:40:29 UTC (rev 944) @@ -25,6 +25,7 @@ HBRUSH CColourEdit::CtlColor(CDC* pDC, UINT nCtlColor) { + UNREFERENCED_PARAMETER(nCtlColor); pDC->SetTextColor(m_crText); //set text color pDC->SetBkColor(m_crBackGnd); //set the text's background color return m_brBackGnd; //return the brush used for background - this sets control background Modified: trunk/OpenMPT/mptrack/Draw_pat.cpp =================================================================== --- trunk/OpenMPT/mptrack/Draw_pat.cpp 2011-07-30 20:32:17 UTC (rev 943) +++ trunk/OpenMPT/mptrack/Draw_pat.cpp 2011-07-30 20:40:29 UTC (rev 944) @@ -374,7 +374,7 @@ { if(pTuning) { // Drawing custom note names - string noteStr = pTuning->GetNoteName(note-NOTE_MIDDLEC); + string noteStr = pTuning->GetNoteName(static_cast<CTuningBase::NOTEINDEXTYPE>(note-NOTE_MIDDLEC)); if(noteStr.size() < 3) noteStr.resize(3, ' '); @@ -528,7 +528,7 @@ DrawButtonRect(hdc, &rect, s, (pSndFile->ChnSettings[ncolhdr].dwFlags & CHN_MUTE) ? TRUE : FALSE, ((m_bInItemRect) && ((m_nDragItem & DRAGITEM_MASK) == DRAGITEM_CHNHEADER) && ((m_nDragItem & DRAGITEM_VALUEMASK) == ncolhdr)) ? TRUE : FALSE, - pModDoc->IsChannelRecord(ncolhdr) ? DT_RIGHT : DT_CENTER); + pModDoc->IsChannelRecord(static_cast<CHANNELINDEX>(ncolhdr)) ? DT_RIGHT : DT_CENTER); // When dragging around channel headers, mark insertion position if(m_bDragging && !m_bInItemRect @@ -550,7 +550,7 @@ CRect insRect; insRect.SetRect(xpaint, ypaint, xpaint+nColumnWidth / 8 + 3, ypaint + 16); // if (MultiRecordMask[ncolhdr>>3] & (1 << (ncolhdr&7))) - if (pModDoc->IsChannelRecord1(ncolhdr)) + if (pModDoc->IsChannelRecord1(static_cast<CHANNELINDEX>(ncolhdr))) { // rect.DeflateRect(1, 1); // InvertRect(hdc, &rect); @@ -562,7 +562,7 @@ DrawButtonRect(hdc, &insRect, s, FALSE, FALSE, DT_CENTER); FrameRect(hdc,&insRect,CMainFrame::brushBlack); } - else if (pModDoc->IsChannelRecord2(ncolhdr)) + else if (pModDoc->IsChannelRecord2(static_cast<CHANNELINDEX>(ncolhdr))) { FrameRect(hdc,&rect,CMainFrame::brushGray); InvertRect(hdc, &rect); @@ -1003,7 +1003,7 @@ { if (m->command) { - UINT command = m->command & 0x3F; + MODCOMMAND::COMMAND command = m->command & 0x3F; int n = pSndFile->GetModSpecifications().GetEffectLetter(command); ASSERT(n > ' '); //if (n <= ' ') n = '?'; @@ -1484,7 +1484,7 @@ { CSoundFile *pSndFile = pModDoc->GetSoundFile(); CHAR s[512]; - UINT nChn; + CHANNELINDEX nChn; wsprintf(s, "Row %d, Col %d", GetCurrentRow(), GetCurrentChannel() + 1); pMainFrm->SetUserText(s); if (::GetFocus() == m_hWnd) Modified: trunk/OpenMPT/mptrack/EffectVis.cpp =================================================================== --- trunk/OpenMPT/mptrack/EffectVis.cpp 2011-07-30 20:32:17 UTC (rev 943) +++ trunk/OpenMPT/mptrack/EffectVis.cpp 2011-07-30 20:40:29 UTC (rev 944) @@ -37,7 +37,7 @@ m_nParamToErase = -1; m_nLastDrawnRow = -1; m_nLastDrawnY = -1; - m_nOldPlayPos = -1; + m_nOldPlayPos = UINT_MAX; m_nFillEffect = m_pModDoc->GetIndexFromEffect(CMD_SMOOTHMIDI, 0); m_nAction=kAction_OverwriteFX; m_templatePCNote.Set(NOTE_PCS, 1, 0, 0); @@ -334,6 +334,7 @@ //----------------------------------------------------------------------------------------- void CEffectVis::ShowVis(CDC * pDC, CRect rectBorder) { + UNREFERENCED_PARAMETER(rectBorder); if (m_boolForceRedraw) { m_boolForceRedraw = FALSE ; @@ -438,7 +439,7 @@ //--------------------------------------- { //erase - if (m_nRowToErase<m_startRow || m_nParamToErase < 0) + if ((UINT)m_nRowToErase<m_startRow || m_nParamToErase < 0) { ::FillRect(m_dcNodes.m_hDC, &m_rcDraw, m_brushBlack); } @@ -461,7 +462,7 @@ void CEffectVis::InvalidateRow(int row) { - if ((row < m_startRow) || (row > m_endRow)) return; + if (((UINT)row < m_startRow) || ((UINT)row > m_endRow)) return; //It seems this optimisation doesn't work properly yet. Disable in Update() @@ -538,6 +539,9 @@ void CEffectVis::OnSize(UINT nType, int cx, int cy) { + UNREFERENCED_PARAMETER(nType); + UNREFERENCED_PARAMETER(cx); + UNREFERENCED_PARAMETER(cy); GetClientRect(&m_rcFullWin); m_rcDraw.SetRect( m_rcFullWin.left + LEFTBORDER, m_rcFullWin.top + TOPBORDER, m_rcFullWin.right - RIGHTBORDER, m_rcFullWin.bottom - BOTTOMBORDER); @@ -585,7 +589,7 @@ m_startRow = startRow; m_endRow = endRow; m_nRows = endRow - startRow; - m_nChan = nchn; + m_nChan = static_cast<CHANNELINDEX>(nchn); m_nPattern = pat; //Check document exists @@ -648,7 +652,7 @@ rect.SetRect(x-NODEHALF, y-NODEHALF, x+NODEHALF+1, y+NODEHALF+1); if (rect.PtInRect(point)) { - m_pModDoc->GetPatternUndo()->PrepareUndo(m_nPattern, m_nChan, row, m_nChan+1, row+1); + m_pModDoc->GetPatternUndo()->PrepareUndo(static_cast<PATTERNINDEX>(m_nPattern), m_nChan, row, m_nChan+1, row+1); m_nDragItem = row; } } @@ -687,7 +691,7 @@ { // Interpolate if we detect that rows have been skipped but the left mouse button was not released. // This ensures we produce a smooth curve even when we are not notified of mouse movements at a high frequency (e.g. if CPU usage is high) - if ((m_nLastDrawnRow>(int)m_startRow) && (row != m_nLastDrawnRow) && (row != m_nLastDrawnRow+1) && (row != m_nLastDrawnRow-1)) + if ((m_nLastDrawnRow>(int)m_startRow) && ((int)row != m_nLastDrawnRow) && ((int)row != m_nLastDrawnRow+1) && ((int)row != m_nLastDrawnRow-1)) { int steps = abs((long)row-(long)m_nLastDrawnRow); ASSERT(steps!=0); @@ -698,7 +702,7 @@ for (int i=1; i<=steps; i++) { currentRow = m_nLastDrawnRow+(direction*i); - int interpolatedY = m_nLastDrawnY+((float)i*factor+0.5f); + int interpolatedY = static_cast<int>(m_nLastDrawnY+((float)i*factor+0.5f)); MakeChange(currentRow, interpolatedY); } @@ -746,7 +750,7 @@ SetFocus(); SetCapture(); - m_pModDoc->GetPatternUndo()->PrepareUndo(m_nPattern, m_nChan, m_startRow, m_nChan+1, m_endRow); + m_pModDoc->GetPatternUndo()->PrepareUndo(static_cast<PATTERNINDEX>(m_nPattern), m_nChan, m_startRow, m_nChan+1, m_endRow); m_dwStatus |= FXVSTATUS_LDRAGGING; } @@ -806,7 +810,7 @@ { k =m_cmbEffectList.AddString(s); m_cmbEffectList.SetItemData(k, i); - if (i==m_nFillEffect) + if ((long)i == m_nFillEffect) m_cmbEffectList.SetCurSel(k); } } Modified: trunk/OpenMPT/mptrack/EffectVis.h =================================================================== --- trunk/OpenMPT/mptrack/EffectVis.h 2011-07-30 20:32:17 UTC (rev 943) +++ trunk/OpenMPT/mptrack/EffectVis.h 2011-07-30 20:40:29 UTC (rev 944) @@ -62,7 +62,7 @@ UINT m_startRow; UINT m_endRow; UINT m_nRows; - UINT m_nChan; + CHANNELINDEX m_nChan; UINT m_nPattern; long m_nFillEffect, m_nAction; Modified: trunk/OpenMPT/mptrack/HyperEdit.cpp =================================================================== --- trunk/OpenMPT/mptrack/HyperEdit.cpp 2011-07-30 20:32:17 UTC (rev 943) +++ trunk/OpenMPT/mptrack/HyperEdit.cpp 2011-07-30 20:40:29 UTC (rev 944) @@ -21,6 +21,8 @@ #include "stdafx.h" #include "HyperEdit.h" +#pragma warning(disable:4018) // "'<' : signed/unsigned mismatch" + #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE @@ -215,3 +217,5 @@ CEdit::OnTimer(nIDEvent); } +#pragma warning(default:4018) + Modified: trunk/OpenMPT/mptrack/HyperEdit2.cpp =================================================================== --- trunk/OpenMPT/mptrack/HyperEdit2.cpp 2011-07-30 20:32:17 UTC (rev 943) +++ trunk/OpenMPT/mptrack/HyperEdit2.cpp 2011-07-30 20:40:29 UTC (rev 944) @@ -20,6 +20,9 @@ #include "stdafx.h" #include "HyperEdit.h" +#pragma warning(disable:4244) // "conversion from 'type1' to 'type2', possible loss of data" +#pragma warning(disable:4018) // "'<' : signed/unsigned mismatch" + #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE @@ -235,3 +238,5 @@ return FALSE; // Not a valid token by default } +#pragma warning(default:4244) +#pragma warning(default:4018) Modified: trunk/OpenMPT/mptrack/ModConvert.cpp =================================================================== --- trunk/OpenMPT/mptrack/ModConvert.cpp 2011-07-30 20:32:17 UTC (rev 943) +++ trunk/OpenMPT/mptrack/ModConvert.cpp 2011-07-30 20:40:29 UTC (rev 944) @@ -51,7 +51,7 @@ //--------------------------------------------------------------------------------------------------------- { // shorten instrument envelope if necessary (for mod conversion) - const UINT iEnvMax = pSndFile->GetModSpecifications().envelopePointsMax; + const uint8 iEnvMax = pSndFile->GetModSpecifications().envelopePointsMax; #define TRIMENV(iEnvLen) if(iEnvLen > iEnvMax) { iEnvLen = iEnvMax; CHANGEMODTYPE_WARNING(wTrimmedEnvelopes); } Modified: trunk/OpenMPT/mptrack/OpenGLControl.cpp =================================================================== --- trunk/OpenMPT/mptrack/OpenGLControl.cpp 2011-07-30 20:32:17 UTC (rev 943) +++ trunk/OpenMPT/mptrack/OpenGLControl.cpp 2011-07-30 20:40:29 UTC (rev 944) @@ -2,6 +2,7 @@ // #include "stdafx.h" +#if 0 #include "OpenGLControl.h" #ifdef _DEBUG @@ -164,3 +165,5 @@ { return TRUE; } + +#endif // 0 Modified: trunk/OpenMPT/mptrack/OpenGLControl.h =================================================================== --- trunk/OpenMPT/mptrack/OpenGLControl.h 2011-07-30 20:32:17 UTC (rev 943) +++ trunk/OpenMPT/mptrack/OpenGLControl.h 2011-07-30 20:40:29 UTC (rev 944) @@ -1,6 +1,8 @@ #if !defined(AFX_OPENGLCONTROL_H__52A6B63B_01A2_449D_8691_1FF59EECAB71__INCLUDED_) #define AFX_OPENGLCONTROL_H__52A6B63B_01A2_449D_8691_1FF59EECAB71__INCLUDED_ +#if 0 + #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 @@ -63,4 +65,6 @@ //{{AFX_INSERT_LOCATION}} // Microsoft Visual C++ f\xFCgt unmittelbar vor der vorhergehenden Zeile zus\xE4tzliche Deklarationen ein. +#endif // 0 + #endif // AFX_OPENGLCONTROL_H__52A6B63B_01A2_449D_8691_1FF59EECAB71__INCLUDED_ Modified: trunk/OpenMPT/mptrack/OpenGLDevice.cpp =================================================================== --- trunk/OpenMPT/mptrack/OpenGLDevice.cpp 2011-07-30 20:32:17 UTC (rev 943) +++ trunk/OpenMPT/mptrack/OpenGLDevice.cpp 2011-07-30 20:40:29 UTC (rev 944) @@ -13,6 +13,7 @@ ////////////////////////////////////////////////////////////////////// #include "stdafx.h" +#if 0 #include "OpenGLDevice.h" ////////////////////////////////////////////////////////////////////// @@ -152,4 +153,6 @@ } return true; -} \ No newline at end of file +} + +#endif // 0 Modified: trunk/OpenMPT/mptrack/OpenGLEditor.cpp =================================================================== --- trunk/OpenMPT/mptrack/OpenGLEditor.cpp 2011-07-30 20:32:17 UTC (rev 943) +++ trunk/OpenMPT/mptrack/OpenGLEditor.cpp 2011-07-30 20:40:29 UTC (rev 944) @@ -1,4 +1,5 @@ #include "stdafx.h" +#if 0 #include "mptrack.h" #include "mainfrm.h" #include "childfrm.h" @@ -83,3 +84,5 @@ CDialog::OnPaint(); } } + +#endif // 0 Modified: trunk/OpenMPT/mptrack/OpenGLEditor.h =================================================================== --- trunk/OpenMPT/mptrack/OpenGLEditor.h 2011-07-30 20:32:17 UTC (rev 943) +++ trunk/OpenMPT/mptrack/OpenGLEditor.h 2011-07-30 20:40:29 UTC (rev 944) @@ -1,4 +1,7 @@ #pragma once + +#if 0 + #include "globals.h" #include "OpenGLControl.h" @@ -25,3 +28,5 @@ public: afx_msg void OnPaint(); }; + +#endif // 0 Modified: trunk/OpenMPT/mptrack/PSRatioCalc.cpp =================================================================== --- trunk/OpenMPT/mptrack/PSRatioCalc.cpp 2011-07-30 20:32:17 UTC (rev 943) +++ trunk/OpenMPT/mptrack/PSRatioCalc.cpp 2011-07-30 20:40:29 UTC (rev 944) @@ -16,7 +16,7 @@ , m_lSamplesOrig(samples), m_nSpeed(speed), m_nTempo(tempo), m_dRatio(ratio), m_nRowsPerBeat(rowsPerBeat), m_nTempoMode(tempoMode) { //Sample rate will not change. We can calculate original duration once and disgard sampleRate. - m_lMsOrig=1000.0*((double)m_lSamplesOrig / sampleRate); + m_lMsOrig= static_cast<ULONGLONG>(1000.0*((double)m_lSamplesOrig / sampleRate)); CalcSamples(); CalcMs(); CalcRows(); @@ -122,13 +122,13 @@ void CPSRatioCalc::CalcSamples() { - m_lSamplesNew=m_lSamplesOrig*(m_dRatio/100.0); + m_lSamplesNew = static_cast<ULONGLONG>(m_lSamplesOrig*(m_dRatio/100.0)); return; } void CPSRatioCalc::CalcMs() { - m_lMsNew=m_lMsOrig*(m_dRatio/100.0); + m_lMsNew = static_cast<ULONGLONG>(m_lMsOrig*(m_dRatio/100.0)); return; } Modified: trunk/OpenMPT/mptrack/PatternGotoDialog.cpp =================================================================== --- trunk/OpenMPT/mptrack/PatternGotoDialog.cpp 2011-07-30 20:32:17 UTC (rev 943) +++ trunk/OpenMPT/mptrack/PatternGotoDialog.cpp 2011-07-30 20:40:29 UTC (rev 944) @@ -48,7 +48,7 @@ { m_nRow = row; m_nChannel = chan; - m_nPattern = pat; + m_nPattern = static_cast<PATTERNINDEX>(pat); m_nActiveOrder = ord; m_nOrder = ord; m_pSndFile = pSndFile; @@ -103,7 +103,7 @@ } UpdateData(); - m_nOrder = m_pSndFile->FindOrder(m_nPattern, m_nActiveOrder); + m_nOrder = m_pSndFile->FindOrder(static_cast<PATTERNINDEX>(m_nPattern), m_nActiveOrder); if (m_nOrder >= m_pSndFile->Order.size()) { m_nOrder=0; Modified: trunk/OpenMPT/mptrack/SoundFilePlayConfig.h =================================================================== --- trunk/OpenMPT/mptrack/SoundFilePlayConfig.h 2011-07-30 20:32:17 UTC (rev 943) +++ trunk/OpenMPT/mptrack/SoundFilePlayConfig.h 2011-07-30 20:40:29 UTC (rev 944) @@ -85,9 +85,9 @@ float m_VSTiAttenuation; float m_VSTiVolume; - float m_normalSamplePreAmp; - float m_normalVSTiVol; - float m_normalGlobalVol; + double m_normalSamplePreAmp; + double m_normalVSTiVol; + double m_normalGlobalVol; bool m_globalVolumeAppliesToMaster; bool m_ignorePreAmp; Modified: trunk/OpenMPT/mptrack/TrackerSettings.cpp =================================================================== --- trunk/OpenMPT/mptrack/TrackerSettings.cpp 2011-07-30 20:32:17 UTC (rev 943) +++ trunk/OpenMPT/mptrack/TrackerSettings.cpp 2011-07-30 20:40:29 UTC (rev 944) @@ -337,7 +337,8 @@ CSoundFile::m_nStereoSeparation = CMainFrame::GetPrivateProfileLong("Sound Settings", "StereoSeparation", CSoundFile::m_nStereoSeparation, iniFile); CSoundFile::m_nMaxMixChannels = CMainFrame::GetPrivateProfileLong("Sound Settings", "MixChannels", CSoundFile::m_nMaxMixChannels, iniFile); gbWFIRType = static_cast<BYTE>(CMainFrame::GetPrivateProfileDWord("Sound Settings", "XMMSModplugResamplerWFIRType", gbWFIRType, iniFile)); - gdWFIRCutoff = static_cast<double>(CMainFrame::GetPrivateProfileLong("Sound Settings", "ResamplerWFIRCutoff", gdWFIRCutoff * 100.0, iniFile)) / 100.0; + //gdWFIRCutoff = static_cast<double>(CMainFrame::GetPrivateProfileLong("Sound Settings", "ResamplerWFIRCutoff", gdWFIRCutoff * 100.0, iniFile)) / 100.0; + gdWFIRCutoff = static_cast<double>(CMainFrame::GetPrivateProfileLong("Sound Settings", "ResamplerWFIRCutoff", Util::Round<long>(gdWFIRCutoff * 100.0), iniFile)) / 100.0; glVolumeRampSamples = CMainFrame::GetPrivateProfileLong("Sound Settings", "VolumeRampSamples", glVolumeRampSamples, iniFile); m_dwMidiSetup = CMainFrame::GetPrivateProfileDWord("MIDI Settings", "MidiSetup", m_dwMidiSetup, iniFile); Modified: trunk/OpenMPT/mptrack/View_pat.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_pat.cpp 2011-07-30 20:32:17 UTC (rev 943) +++ trunk/OpenMPT/mptrack/View_pat.cpp 2011-07-30 20:40:29 UTC (rev 944) @@ -136,7 +136,7 @@ CViewPattern::CViewPattern() //-------------------------- { - m_pOpenGLEditor = NULL; //rewbs.fxvis + //m_pOpenGLEditor = NULL; //rewbs.fxvis m_pEffectVis = NULL; //rewbs.fxvis m_pRandomizer = NULL; m_bLastNoteEntryBlocked=false; @@ -436,10 +436,11 @@ { UINT ncol = GetCurrentColumn(); UINT xofs = GetXScrollPos(); - int nchn = ncol >> 3; + const UINT nchn = ncol >> 3; if (nchn < xofs) { - scroll.cx = (int)(nchn - xofs) * m_szCell.cx; + scroll.cx = (int)(xofs - nchn) * m_szCell.cx; + scroll.cx *= -1; } else if (nchn > xofs) { @@ -713,11 +714,13 @@ m_pRandomizer=NULL; } + /* if (m_pOpenGLEditor) { m_pOpenGLEditor->DoClose(); delete m_pOpenGLEditor; m_pOpenGLEditor = NULL; } + */ CModScrollView::OnDestroy(); @@ -770,14 +773,14 @@ const DWORD endSel = (GetRowFromCursor(m_dwBeginSel) < GetRowFromCursor(m_dwEndSel)) ? m_dwEndSel : m_dwBeginSel; pModDoc->GetPatternUndo()->PrepareUndo(m_nPattern, 0, 0, pSndFile->GetNumChannels(), pSndFile->Patterns[m_nPattern].GetNumRows()); - int finalDest = GetRowFromCursor(startSel) + (GetRowFromCursor(endSel) - GetRowFromCursor(startSel))*2; + const ROWINDEX finalDest = GetRowFromCursor(startSel) + (GetRowFromCursor(endSel) - GetRowFromCursor(startSel))*2; for (int row = finalDest; row > (int)GetRowFromCursor(startSel); row -= 2) { int offset = row - GetRowFromCursor(startSel); for (UINT i=(startSel & 0xFFFF); i<=(endSel & 0xFFFF); i++) if (GetColTypeFromCursor(i) <= LAST_COLUMN) { UINT chn = GetChanFromCursor(i); - if ((chn >= pSndFile->GetNumChannels()) || (row >= pSndFile->Patterns[m_nPattern].GetNumRows())) continue; + if ((chn >= pSndFile->GetNumChannels()) || (ROWINDEX(row) >= pSndFile->Patterns[m_nPattern].GetNumRows())) continue; MODCOMMAND *dest = &p[row * pSndFile->GetNumChannels() + chn]; MODCOMMAND *src = &p[(row-offset/2) * pSndFile->GetNumChannels() + chn]; MODCOMMAND *blank= &p[(row-1) * pSndFile->GetNumChannels() + chn]; @@ -820,12 +823,12 @@ const DWORD endSel = (GetRowFromCursor(m_dwBeginSel) < GetRowFromCursor(m_dwEndSel)) ? m_dwEndSel : m_dwBeginSel; pModDoc->GetPatternUndo()->PrepareUndo(m_nPattern, 0, 0, pSndFile->GetNumChannels(), pSndFile->Patterns[m_nPattern].GetNumRows()); - int finalDest = GetRowFromCursor(startSel) + (GetRowFromCursor(endSel) - GetRowFromCursor(startSel))/2; + const ROWINDEX finalDest = GetRowFromCursor(startSel) + (GetRowFromCursor(endSel) - GetRowFromCursor(startSel))/2; - for (int row = GetRowFromCursor(startSel); row <= finalDest; row++) + for (ROWINDEX row = GetRowFromCursor(startSel); row <= finalDest; row++) { - int offset = row - GetRowFromCursor(startSel); - int srcRow = GetRowFromCursor(startSel) + (offset * 2); + const ROWINDEX offset = row - GetRowFromCursor(startSel); + const ROWINDEX srcRow = GetRowFromCursor(startSel) + (offset * 2); for (UINT i = (startSel & 0xFFFF); i <= (endSel & 0xFFFF); i++) if (GetColTypeFromCursor(i) <= LAST_COLUMN) { @@ -865,7 +868,7 @@ } } } - for (int row = finalDest + 1; row <= GetRowFromCursor(endSel); row++) + for (ROWINDEX row = finalDest + 1; row <= GetRowFromCursor(endSel); row++) { for (UINT i = (startSel & 0xFFFF); i <= (endSel & 0xFFFF); i++) if (GetColTypeFromCursor(i) <= LAST_COLUMN) { @@ -2385,8 +2388,9 @@ bool doPCinterpolation = false; - int vsrc, vdest, vcmd = 0, verr = 0, distance; - distance = row1 - row0; + int vsrc, vdest, vcmd = 0, verr = 0; + ASSERT(row1 >= row0); + UINT distance = row1 - row0; const MODCOMMAND srcCmd = *pSndFile->Patterns[m_nPattern].GetpModCommand(row0, nchn); const MODCOMMAND destCmd = *pSndFile->Patterns[m_nPattern].GetpModCommand(row1, nchn); @@ -3014,7 +3018,7 @@ if (vol > 64) vol = 64; m->vol = (BYTE)vol; } - if ((((nChn << 3) | 3) >= (m_dwBeginSel & 0xFFFF)) && (((nChn << 3) | 3) <= (m_dwEndSel & 0xFFFF))) + if ((((nChn << 3) | 3u) >= (m_dwBeginSel & 0xFFFF)) && (((nChn << 3) | 3u) <= (m_dwEndSel & 0xFFFF))) { if ((m->command == CMD_VOLUME) && (m->param <= 64)) { @@ -3698,7 +3702,7 @@ SetCurrentColumn(m_dwCursor - 1); return wParam; case kcNavigateRightSelect: - case kcNavigateRight: if ((CMainFrame::GetSettings().m_dwPatternSetup & PATTERN_WRAP) && (m_dwCursor >= (((pSndFile->m_nChannels-1) << 3) | 4))) + case kcNavigateRight: if ((CMainFrame::GetSettings().m_dwPatternSetup & PATTERN_WRAP) && (m_dwCursor >= (((pSndFile->m_nChannels-1) << 3u) | 4u))) SetCurrentColumn(0); else SetCurrentColumn(m_dwCursor + 1); @@ -3725,12 +3729,12 @@ case kcHomeAbsolute: if (m_dwCursor) SetCurrentColumn(0); if (m_nRow > 0) SetCurrentRow(0); return wParam; case kcEndHorizontalSelect: - case kcEndHorizontal: if (m_dwCursor!=(((pSndFile->GetNumChannels() - 1) << 3) | 4)) SetCurrentColumn(((pSndFile->m_nChannels-1) << 3) | 4); + case kcEndHorizontal: if (m_dwCursor!=(((pSndFile->GetNumChannels() - 1u) << 3u) | 4)) SetCurrentColumn(((pSndFile->m_nChannels-1) << 3) | 4); else if (m_nRow < pModDoc->GetPatternSize(m_nPattern) - 1) SetCurrentRow(pModDoc->GetPatternSize(m_nPattern) - 1); return wParam; case kcEndVerticalSelect: case kcEndVertical: if (m_nRow < pModDoc->GetPatternSize(m_nPattern) - 1) SetCurrentRow(pModDoc->GetPatternSize(m_nPattern) - 1); - else if (m_dwCursor!=(((pSndFile->GetNumChannels() - 1) << 3) | 4)) SetCurrentColumn(((pSndFile->m_nChannels-1) << 3) | 4); + else if (m_dwCursor!=(((pSndFile->GetNumChannels() - 1) << 3u) | 4u)) SetCurrentColumn(((pSndFile->m_nChannels-1) << 3u) | 4); return wParam; case kcEndAbsoluteSelect: case kcEndAbsolute: SetCurrentColumn(((pSndFile->GetNumChannels() - 1) << 3) | 4); if (m_nRow < pModDoc->GetPatternSize(m_nPattern) - 1) SetCurrentRow(pModDoc->GetPatternSize(m_nPattern) - 1); return wParam; @@ -3990,9 +3994,9 @@ void CViewPattern::SetSpacing(int n) //---------------------------------- { - if (n != m_nSpacing) + if (static_cast<UINT>(n) != m_nSpacing) { - m_nSpacing = n; + m_nSpacing = static_cast<UINT>(n); PostCtrlMessage(CTRLMSG_SETSPACING, m_nSpacing); } } Modified: trunk/OpenMPT/mptrack/View_pat.h =================================================================== --- trunk/OpenMPT/mptrack/View_pat.h 2011-07-30 20:32:17 UTC (rev 943) +++ trunk/OpenMPT/mptrack/View_pat.h 2011-07-30 20:40:29 UTC (rev 944) @@ -142,7 +142,7 @@ CPatternRandomizer *m_pRandomizer; //rewbs.fxVis public: CEffectVis *m_pEffectVis; //rewbs.fxVis - COpenGLEditor *m_pOpenGLEditor; //rewbs.fxVis + //COpenGLEditor *m_pOpenGLEditor; //rewbs.fxVis CViewPattern(); @@ -347,7 +347,7 @@ static ROWINDEX GetRowFromCursor(DWORD cursor) { return (cursor >> 16); }; static CHANNELINDEX GetChanFromCursor(DWORD cursor) { return static_cast<CHANNELINDEX>((cursor & 0xFFFF) >> 3); }; - static UINT GetColTypeFromCursor(DWORD cursor) { return (cursor & 0x07); }; + static PatternColumns GetColTypeFromCursor(DWORD cursor) { return static_cast<PatternColumns>((cursor & 0x07)); }; static DWORD CreateCursor(ROWINDEX row, CHANNELINDEX channel = 0, UINT column = 0) { return (row << 16) | ((channel << 3) & 0x1FFF) | (column & 0x07); }; private: Modified: trunk/OpenMPT/mptrack/misc_util.h =================================================================== --- trunk/OpenMPT/mptrack/misc_util.h 2011-07-30 20:32:17 UTC (rev 943) +++ trunk/OpenMPT/mptrack/misc_util.h 2011-07-30 20:40:29 UTC (rev 944) @@ -253,6 +253,20 @@ // Returns maximum value of given integer type. template <class T> inline T MaxValueOfType(const T&) {static_assert(std::numeric_limits<T>::is_integer == true, "Only interger types are allowed."); return (std::numeric_limits<T>::max)();} + /// Returns value rounded to nearest integer. + inline double Round(const double& val) {return std::floor(val + 0.5);} + + /// Rounds given double value to nearest integer value of type T. + template <class T> inline T Round(const double& val) + { + static_assert(std::numeric_limits<T>::is_integer == true, "Type is a not an integer"); + static_assert(sizeof(T) <= 4, "Revise the implementation for integers > 32-bits."); + const double valRounded = Round(val); + ASSERT(valRounded >= (std::numeric_limits<T>::min)() && valRounded <= (std::numeric_limits<T>::max)()); + const T intval = static_cast<T>(valRounded); + return intval; + } + }; Modified: trunk/OpenMPT/mptrack/test/test.cpp =================================================================== --- trunk/OpenMPT/mptrack/test/test.cpp 2011-07-30 20:32:17 UTC (rev 943) +++ trunk/OpenMPT/mptrack/test/test.cpp 2011-07-30 20:40:29 UTC (rev 944) @@ -220,6 +220,31 @@ VERIFY_EQUAL(CModSpecifications::ExtensionToType(_T("s2m")), MOD_TYPE_NONE); VERIFY_EQUAL(CModSpecifications::ExtensionToType(_T("")), MOD_TYPE_NONE); VERIFY_EQUAL(CModSpecifications::ExtensionToType(LPCTSTR(nullptr)), MOD_TYPE_NONE); + + VERIFY_EQUAL( Util::Round(1.99), 2.0 ); + VERIFY_EQUAL( Util::Round(1.5), 2.0 ); + VERIFY_EQUAL( Util::Round(1.1), 1.0 ); + VERIFY_EQUAL( Util::Round(-0.1), 0.0 ); + VERIFY_EQUAL( Util::Round(-0.5), 0.0 ); + VERIFY_EQUAL( Util::Round(-0.9), -1.0 ); + VERIFY_EQUAL( Util::Round(-1.4), -1.0 ); + VERIFY_EQUAL( Util::Round(-1.7), -2.0 ); + VERIFY_EQUAL( Util::Round<int32>(int32_max + 0.1), int32_max ); + VERIFY_EQUAL( Util::Round<int32>(int32_max - 0.4), int32_max ); + VERIFY_EQUAL( Util::Round<int32>(int32_min + 0.1), int32_min ); + VERIFY_EQUAL( Util::Round<int32>(int32_min - 0.1), int32_min ); + VERIFY_EQUAL( Util::Round<uint32>(uint32_max + 0.499), uint32_max ); + VERIFY_EQUAL( Util::Round<int8>(110.1), 110 ); + VERIFY_EQUAL( Util::Round<int8>(-110.1), -110 ); + + // These should fail to compile + //Util::Round<std::string>(1.0); + //Util::Round<int64>(1.0); + //Util::Round<uint64>(1.0); + + // This should trigger assert in Round. + //VERIFY_EQUAL( Util::Round<int8>(-129), 0 ); + } @@ -461,14 +486,10 @@ theApp.RemoveMruItem(0); } - -template<class T> -T Round(double a) {return static_cast<T>(floor(a + 0.5));} - double Rand01() {return rand() / double(RAND_MAX);} template <class T> -T Rand(const T& min, const T& max) {return Round<T>(min + Rand01() * (max - min));} +T Rand(const T& min, const T& max) {return Util::Round<T>(min + Rand01() * (max - min));} Modified: trunk/OpenMPT/soundlib/Dlsbank.cpp =================================================================== --- trunk/OpenMPT/soundlib/Dlsbank.cpp 2011-07-30 20:32:17 UTC (rev 943) +++ trunk/OpenMPT/soundlib/Dlsbank.cpp 2011-07-30 20:40:29 UTC (rev 944) @@ -1468,7 +1468,7 @@ } -BOOL CDLSBank::ExtractSample(CSoundFile *pSndFile, UINT nSample, UINT nIns, UINT nRgn, int transpose) +BOOL CDLSBank::ExtractSample(CSoundFile *pSndFile, SAMPLEINDEX nSample, UINT nIns, UINT nRgn, int transpose) //--------------------------------------------------------------------------------------------------- { DLSINSTRUMENT *pDlsIns; @@ -1602,13 +1602,14 @@ } -BOOL CDLSBank::ExtractInstrument(CSoundFile *pSndFile, UINT nInstr, UINT nIns, UINT nDrumRgn) +BOOL CDLSBank::ExtractInstrument(CSoundFile *pSndFile, INSTRUMENTINDEX nInstr, UINT nIns, UINT nDrumRgn) //------------------------------------------------------------------------------------------- { BYTE RgnToSmp[DLSMAXREGIONS]; DLSINSTRUMENT *pDlsIns; MODINSTRUMENT *pIns; - UINT nSample, nRgnMin, nRgnMax, nEnv; + UINT nRgnMin, nRgnMax, nEnv; + SAMPLEINDEX nSample; if ((!m_pInstruments) || (nIns >= m_nInstruments) || (!pSndFile)) return FALSE; pDlsIns = &m_pInstruments[nIns]; Modified: trunk/OpenMPT/soundlib/Dlsbank.h =================================================================== --- trunk/OpenMPT/soundlib/Dlsbank.h 2011-07-30 20:32:17 UTC (rev 943) +++ trunk/OpenMPT/soundlib/Dlsbank.h 2011-07-30 20:40:29 UTC (rev 944) @@ -2,6 +2,7 @@ #define _DLS_BANK_H_ class CSoundFile; +#include "Snd_defs.h" #pragma pack(1) @@ -121,8 +122,8 @@ UINT GetRegionFromKey(UINT nIns, UINT nKey); BOOL FreeWaveForm(LPBYTE p); BOOL ExtractWaveForm(UINT nIns, UINT nRgn, LPBYTE *ppWave, DWORD *pLen); - BOOL ExtractSample(CSoundFile *pSndFile, UINT nSample, UINT nIns, UINT nRgn, int transpose=0); - BOOL ExtractInstrument(CSoundFile *pSndFile, UINT nInstr, UINT nIns, UINT nDrumRgn); + BOOL ExtractSample(CSoundFile *pSndFile, SAMPLEINDEX nSample, UINT nIns, UINT nRgn, int transpose=0); + BOOL ExtractInstrument(CSoundFile *pSndFile, INSTRUMENTINDEX nInstr, UINT nIns, UINT nDrumRgn); // Internal Loader Functions protected: Modified: trunk/OpenMPT/soundlib/LOAD_DMF.CPP =================================================================== --- trunk/OpenMPT/soundlib/LOAD_DMF.CPP 2011-07-30 20:32:17 UTC (rev 943) +++ trunk/OpenMPT/soundlib/LOAD_DMF.CPP 2011-07-30 20:40:29 UTC (rev 944) @@ -1120,7 +1120,7 @@ DMFNewNode(&tree); value = 0; - for (int i = 0; i < maxlen; i++) + for (UINT i = 0; i < maxlen; i++) { actnode = 0; sign = DMFReadBits(&tree, 1); Modified: trunk/OpenMPT/soundlib/LOAD_DSM.CPP =================================================================== --- trunk/OpenMPT/soundlib/LOAD_DSM.CPP 2011-07-30 20:32:17 UTC (rev 943) +++ trunk/OpenMPT/soundlib/LOAD_DSM.CPP 2011-07-30 20:40:29 UTC (rev 944) @@ -91,7 +91,8 @@ DSMFILEHEADER *pfh = (DSMFILEHEADER *)lpStream; DSMSONG *psong; DWORD dwMemPos; - UINT nPat, nSmp; + UINT nSmp; + PATTERNINDEX nPat; if ((!lpStream) || (dwMemLength < 1024) || (pfh->id_RIFF != DSMID_RIFF) || (pfh->riff_len + 8 > dwMemLength) || (pfh->riff_len < 1024) Modified: trunk/OpenMPT/soundlib/Load_med.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_med.cpp 2011-07-30 20:32:17 UTC (rev 943) +++ trunk/OpenMPT/soundlib/Load_med.cpp 2011-07-30 20:40:29 UTC (rev 944) @@ -271,7 +271,7 @@ { const BYTE bpmvals[9] = { 179,164,152,141,131,123,116,110,104}; - UINT command = p->command; + MODCOMMAND::COMMAND command = p->command; UINT param = p->param; switch(command) { @@ -467,10 +467,11 @@ // 0x2E ? Log("Unknown command: cmd=0x%02X param=0x%02X\n", command, param); #endif - command = param = 0; + command = 0; + param = 0; } p->command = command; - p->param = param; + p->param = static_cast<MODCOMMAND::PARAM>(param); } @@ -636,13 +637,13 @@ playtransp = pmsh->playtransp; } else { - UINT nOrders, nSections; + UINT nSections; + ORDERINDEX nOrders = 0; WORD nTrks = BigEndianW(pmsh2->numtracks); if ((nTrks >= 4) && (nTrks <= 32)) m_nChannels = nTrks; DWORD playseqtable = BigEndian(pmsh2->playseqtable); UINT numplayseqs = BigEndianW(pmsh2->numpseqs); if (!numplayseqs) numplayseqs = 1; - nOrders = 0; nSections = BigEndianW(pmsh2->numsections); DWORD sectiontable = BigEndian(pmsh2->sectiontable); if ((!nSections) || (!sectiontable) || (sectiontable >= dwMemLength-2)) nSections = 1; @@ -736,7 +737,7 @@ } // Track Names DWORD trackinfo_ofs = BigEndian(pmex->trackinfo_ofs); - if ((trackinfo_ofs) && (trackinfo_ofs < dwMemLength) && (m_nChannels * 4 < dwMemLength - trackinfo_ofs)) + if ((trackinfo_ofs) && (trackinfo_ofs < dwMemLength) && (m_nChannels * 4u < dwMemLength - trackinfo_ofs)) { DWORD *ptrktags = (DWORD *)(lpStream + trackinfo_ofs); for (UINT i=0; i<m_nChannels; i++) @@ -830,7 +831,7 @@ BYTE instr = s[1] >> 4; if (s[0] & 0x80) instr |= 0x10; if (s[0] & 0x40) instr |= 0x20; - if ((note) && (note <= 132)) p->note = note + playtransp; + if ((note) && (note <= 132)) p->note = static_cast<BYTE>(note + playtransp); p->instr = instr; p->command = s[1] & 0x0F; p->param = s[2]; Modified: trunk/OpenMPT/soundlib/Load_mod.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_mod.cpp 2011-07-30 20:32:17 UTC (rev 943) +++ trunk/OpenMPT/soundlib/Load_mod.cpp 2011-07-30 20:40:29 UTC (rev 944) @@ -40,7 +40,7 @@ case 0x0C: command = CMD_VOLUME; break; case 0x0D: command = CMD_PATTERNBREAK; param = ((param >> 4) * 10) + (param & 0x0F); break; case 0x0E: command = CMD_MODCMDEX; break; - case 0x0F: command = (param <= ((m_nType & (MOD_TYPE_MOD)) ? 0x20 : 0x1F)) ? CMD_SPEED : CMD_TEMPO; + case 0x0F: command = (param <= ((m_nType & (MOD_TYPE_MOD)) ? 0x20u : 0x1Fu)) ? CMD_SPEED : CMD_TEMPO; if ((param == 0xFF) && (m_nSamples == 15) && (m_nType & MOD_TYPE_MOD)) command = 0; break; //<rewbs> what the hell is this?! :) //<jojo> it's the "stop tune" command! :-P // Extension for XM extended effects case 'G' - 55: command = CMD_GLOBALVOLUME; break; //16 @@ -123,8 +123,8 @@ case CMD_VOLUME: command = 0x0C; break; case CMD_PATTERNBREAK: command = 0x0D; param = ((param / 10) << 4) | (param % 10); break; case CMD_MODCMDEX: command = 0x0E; break; - case CMD_SPEED: command = 0x0F; param = min(param, (bXM) ? 0x1F : 0x20); break; - case CMD_TEMPO: command = 0x0F; param = max(param, (bXM) ? 0x20 : 0x21); break; + case CMD_SPEED: command = 0x0F; param = min(param, (bXM) ? 0x1Fu : 0x20u); break; + case CMD_TEMPO: command = 0x0F; param = max(param, (bXM) ? 0x20u : 0x21u); break; case CMD_GLOBALVOLUME: command = 'G' - 55; break; case CMD_GLOBALVOLSLIDE: command = 'H' - 55; break; case CMD_KEYOFF: command = 'K' - 55; break; @@ -395,7 +395,7 @@ norders--; m_nRestartPos = pMagic->nRestartPos; if (m_nRestartPos >= 0x78) m_nRestartPos = 0; - if (m_nRestartPos + 1 >= (UINT)norders) m_nRestartPos = 0; + if (m_nRestartPos + 1u >= norders) m_nRestartPos = 0; if (!nbp) return false; DWORD dwWowTest = dwTotalSampleLen+dwMemPos; if ((IsMagic(pMagic->Magic, "M.K.")) && (dwWowTest + nbp*8*256 == dwMemLength)) m_nChannels = 8; @@ -706,7 +706,7 @@ MODSAMPLE *pSmp = &Samples[insmap[ismpd]]; if(bCompatibilityExport == true) // first two bytes have to be 0 due to PT's one-shot loop ("no loop") { - int iOverwriteLen = 2 * pSmp->GetBytesPerSample(); + size_t iOverwriteLen = 2 * pSmp->GetBytesPerSample(); memset(pSmp->pSample, 0, min(iOverwriteLen, pSmp->GetSampleSizeInBytes())); } UINT flags = RS_PCM8S; Modified: trunk/OpenMPT/soundlib/Snd_defs.h =================================================================== --- trunk/OpenMPT/soundlib/Snd_defs.h 2011-07-30 20:32:17 UTC (rev 943) +++ trunk/OpenMPT/soundlib/Snd_defs.h 2011-07-30 20:40:29 UTC (rev 944) @@ -10,6 +10,8 @@ #ifndef SND_DEF_H #define SND_DEF_H +#include "../mptrack/typedefs.h" + #ifndef LPCBYTE typedef const BYTE * LPCBYTE; #endif Modified: trunk/OpenMPT/soundlib/Snd_flt.cpp =================================================================== --- trunk/OpenMPT/soundlib/Snd_flt.cpp 2011-07-30 20:32:17 UTC (rev 943) +++ trunk/OpenMPT/soundlib/Snd_flt.cpp 2011-07-30 20:40:29 UTC (rev 944) @@ -86,16 +86,16 @@ { if(pChn->nCutSwing) { - pChn->nCutOff += pChn->nCutSwing; - if(pChn->nCutOff > 127) pChn->nCutOff = 127; - if(pChn->nCutOff < 0) pChn->nCutOff = 0; + static_assert(sizeof(pChn->nCutOff) == 1, "check cast if this fails"); + pChn->nCutOff = static_cast<BYTE>(pChn->nCutOff + pChn->nCutSwing); + Limit(pChn->nCutOff, BYTE(0), BYTE(127)); pChn->nCutSwing = 0; } if(pChn->nResSwing) { - pChn->nResonance += pChn->nResSwing; - if(pChn->nResonance > 127) pChn->nResonance = 127; - if(pChn->nResonance < 0) pChn->nResonance = 0; + static_assert(sizeof(pChn->nResonance) == 1, "check cast if this fails"); + pChn->nResonance = static_cast<BYTE>(pChn->nResonance + pChn->nResSwing); + Limit(pChn->nResonance, BYTE(0), BYTE(127)); pChn->nResSwing = 0; } cutoff = max( min((int)pChn->nCutOff,127), 0); // cap cutoff Modified: trunk/OpenMPT/soundlib/Snddev.cpp =================================================================== --- trunk/OpenMPT/soundlib/Snddev.cpp 2011-07-30 20:32:17 UTC (rev 943) +++ trunk/OpenMPT/soundlib/Snddev.cpp 2011-07-30 20:40:29 UTC (rev 944) @@ -173,7 +173,9 @@ void CWaveDevice::SilenceAudioBuffer(ISoundSource *pSource, ULONG nMaxLatency, DWORD dwBuffer) { - + UNREFERENCED_PARAMETER(pSource); + UNREFERENCED_PARAMETER(nMaxLatency); + UNREFERENCED_PARAMETER(dwBuffer); } @@ -506,7 +508,9 @@ void CDSoundDevice::SilenceAudioBuffer(ISoundSource *pSource, ULONG nMaxLatency, DWORD dwBuffer) { - + UNREFERENCED_PARAMETER(pSource); + UNREFERENCED_PARAMETER(nMaxLatency); + UNREFERENCED_PARAMETER(dwBuffer); } BOOL CDSoundDevice::FillAudioBuffer(ISoundSource *pSource, ULONG nMaxLatency, DWORD) @@ -902,6 +906,8 @@ void CASIODevice::SilenceAudioBuffer(ISoundSource *pSource, ULONG nMaxLatency, DWORD dwBuffer) //-------------------------------------------------------------------------------------------- { + UNREFERENCED_PARAMETER(pSource); + UNREFERENCED_PARAMETER(nMaxLatency); for (UINT ich=0; ich<m_nChannels; ich++){ memset(m_BufferInfo[ich].buffers[dwBuffer], 0, m_nAsioBufferLen); } @@ -911,6 +917,8 @@ BOOL CASIODevice::FillAudioBuffer(ISoundSource *pSource, ULONG nMaxLatency, DWORD dwBuffer) //----------------------------------------------------------------------------------------- { + UNREFERENCED_PARAMETER(nMaxLatency); + DWORD dwSampleSize = m_nChannels*(m_nBitsPerSample>>3); DWORD dwSamplesLeft = m_nAsioBufferLen; DWORD dwFrameLen = (ASIO_BLOCK_LEN*sizeof(int)) / dwSampleSize; @@ -1006,6 +1014,7 @@ void CASIODevice::BufferSwitch(long doubleBufferIndex, ASIOBool directProcess) //---------------------------------------------------------------------------- { + UNREFERENCED_PARAMETER(directProcess); if ((gpCurrentAsio) && (gpCurrentAsio->m_bMixRunning)) SoundDeviceCallback(doubleBufferIndex); } @@ -1013,12 +1022,16 @@ void CASIODevice::SampleRateDidChange(ASIOSampleRate sRate) //--------------------------------------------------------- { + UNREFERENCED_PARAMETER(sRate); } long CASIODevice::AsioMessage(long selector, long value, void* message, double* opt) //---------------------------------------------------------------------------------- { + UNREFERENCED_PARAMETER(value); + UNREFERENCED_PARAMETER(message); + UNREFERENCED_PARAMETER(opt); #ifdef ASIO_LOG // Log("AsioMessage(%d, %d)\n", selector, value); #endif Modified: trunk/OpenMPT/soundlib/Sndmix.cpp =================================================================== --- trunk/OpenMPT/soundlib/Sndmix.cpp 2011-07-30 20:32:17 UTC (rev 943) +++ trunk/OpenMPT/soundlib/Sndmix.cpp 2011-07-30 20:40:29 UTC (rev 944) @@ -1318,8 +1318,8 @@ { switch(m_nTickCount % 3) { - case 1: period = period / TwoToPowerXOver12(pChn->nArpeggio >> 4); break; - case 2: period = period / TwoToPowerXOver12(pChn->nArpeggio & 0x0F); break; + case 1: period = Util::Round<int>(period / TwoToPowerXOver12(pChn->nArpeggio >> 4)); break; + case 2: period = Util::Round<int>(period / TwoToPowerXOver12(pChn->nArpeggio & 0x0F)); break; } } } @@ -1747,7 +1747,7 @@ { if(pChn->m_CalculateFreq || (pChn->m_ReCalculateFreqOnFirstTick && m_nTickCount == 0)) { - pChn->m_Freq = pChn->nC5Speed * vibratoFactor * pIns->pTuning->GetRatio(pChn->nNote - NOTE_MIDDLEC + arpeggioSteps, pChn->nFineTune+pChn->m_PortamentoFineSteps); + pChn->m_Freq = Util::Round<UINT>(pChn->nC5Speed * vibratoFactor * pIns->pTuning->GetRatio(pChn->nNote - NOTE_MIDDLEC + arpeggioSteps, pChn->nFineTune+pChn->m_PortamentoFineSteps)); if(!pChn->m_CalculateFreq) pChn->m_ReCalculateFreqOnFirstTick = false; else @@ -1759,7 +1759,7 @@ //Applying Pitch/Tempo lock. if(m_nType & (MOD_TYPE_IT | MOD_TYPE_MPT) && pIns && pIns->wPitchToTempoLock) - freq *= (float)m_nMusicTempo / (float)pIns->wPitchToTempoLock; + freq = MulDiv(freq, m_nMusicTempo, pIns->wPitchToTempoLock); if ((m_nType & (MOD_TYPE_IT | MOD_TYPE_MPT)) && (freq < 256)) @@ -2304,7 +2304,8 @@ step = delta/static_cast<long>(m_nSamplesToGlobalVolRampDest); UINT maxStep = max(50, (10000/gnVolumeRampSamples+1)); //define max step size as some factor of user defined ramping value: the lower the value, the more likely the click. - while (abs(step)>maxStep) { //if step is too big (might cause click), extend ramp length. + while (static_cast<UINT>(abs(step)) > maxStep) //if step is too big (might cause click), extend ramp length. + { m_nSamplesToGlobalVolRampDest += gnVolumeRampSamples; step = delta/static_cast<long>(m_nSamplesToGlobalVolRampDest); } Modified: trunk/OpenMPT/soundlib/Tables.cpp =================================================================== --- trunk/OpenMPT/soundlib/Tables.cpp 2011-07-30 20:32:17 UTC (rev 943) +++ trunk/OpenMPT/soundlib/Tables.cpp 2011-07-30 20:40:29 UTC (rev 944) @@ -618,7 +618,7 @@ fsinc = sin(x*kPi) * izero(beta*sqrt(1-x*x*(1.0/16.0))) / (izero_beta*x*kPi); // Kaiser window } int n = (int)(fsinc * lowpass_factor * (16384*256)); - *psinc++ = (n+0x80)>>8; // force rounding + *psinc++ = static_cast<short>((n+0x80)>>8); // force rounding } } Modified: trunk/OpenMPT/soundlib/WindowedFIR.cpp =================================================================== --- trunk/OpenMPT/soundlib/WindowedFIR.cpp 2011-07-30 20:32:17 UTC (rev 943) +++ trunk/OpenMPT/soundlib/WindowedFIR.cpp 2011-07-30 20:40:29 UTC (rev 944) @@ -66,7 +66,7 @@ int _LPcl; float _LPcllen = (float)(1L<<WFIR_FRACBITS); // number of precalculated lines for 0..1 (-1..0) float _LNorm = 1.0f / (float)(2.0f * _LPcllen); - float _LCut = CMainFrame::GetSettings().gdWFIRCutoff; + float _LCut = static_cast<float>(CMainFrame::GetSettings().gdWFIRCutoff); float _LScale = (float)WFIR_QUANTSCALE; for( _LPcl=0;_LPcl<WFIR_LUTLEN;_LPcl++ ) { Modified: trunk/OpenMPT/soundlib/mod_specifications.h =================================================================== --- trunk/OpenMPT/soundlib/mod_specifications.h 2011-07-30 20:32:17 UTC (rev 943) +++ trunk/OpenMPT/soundlib/mod_specifications.h 2011-07-30 20:40:29 UTC (rev 944) @@ -50,7 +50,7 @@ UINT speedMin; // Minimum ticks per frame UINT speedMax; // Maximum ticks per frame bool hasComments; // True if format has a comments field - UINT envelopePointsMax; // Maximum number of points of each envelope + uint8 envelopePointsMax; // Maximum number of points of each envelope bool hasReleaseNode; // Envelope release node char commands[MAX_EFFECTS + 1]; // An array holding all commands this format supports; commands that are not supported are marked with "?" char volcommands[MAX_VOLCMDS + 1]; // dito, but for volume column This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |