From: <sag...@us...> - 2010-06-05 12:45:34
|
Revision: 615 http://modplug.svn.sourceforge.net/modplug/?rev=615&view=rev Author: saga-games Date: 2010-06-05 12:45:27 +0000 (Sat, 05 Jun 2010) Log Message: ----------- [Ref] Quite a bit of refactoring... [Imp] To make the menus a bit more consistent, WAV and MP3 menu points are now also called "Export as" instead of "Save as". [Mod] Updated muParser vc2008 project file Modified Paths: -------------- trunk/OpenMPT/mptrack/CleanupSong.cpp trunk/OpenMPT/mptrack/CommandSet.cpp trunk/OpenMPT/mptrack/InputHandler.cpp trunk/OpenMPT/mptrack/Undo.cpp trunk/OpenMPT/mptrack/Undo.h trunk/OpenMPT/mptrack/Vstplug.cpp trunk/OpenMPT/muParser/build/msvc2008/muparser_muParser.vcproj trunk/OpenMPT/soundlib/Load_mo3.cpp trunk/OpenMPT/soundlib/Snd_fx.cpp trunk/OpenMPT/soundlib/Sndfile.cpp trunk/OpenMPT/soundlib/Sndfile.h trunk/OpenMPT/soundlib/Sndmix.cpp trunk/OpenMPT/soundlib/modcommand.h trunk/OpenMPT/soundlib/pattern.cpp Modified: trunk/OpenMPT/mptrack/CleanupSong.cpp =================================================================== --- trunk/OpenMPT/mptrack/CleanupSong.cpp 2010-06-03 20:39:27 UTC (rev 614) +++ trunk/OpenMPT/mptrack/CleanupSong.cpp 2010-06-05 12:45:27 UTC (rev 615) @@ -388,26 +388,32 @@ } for (PATTERNINDEX nPat = maxpat; nPat < maxPatIndex; nPat++) if ((pSndFile->Patterns[nPat]) && (nPat >= nMinToRemove)) { - MODCOMMAND *m = pSndFile->Patterns[nPat]; - UINT ncmd = pSndFile->m_nChannels * pSndFile->Patterns[nPat].GetNumRows(); - for (UINT i=0; i<ncmd; i++) + const MODCOMMAND *m = pSndFile->Patterns[nPat]; + bool bEmptyPat = true; + size_t ncmd = pSndFile->m_nChannels * pSndFile->Patterns[nPat].GetNumRows(); + for (size_t i = 0; i < ncmd; i++) { - if ((m[i].note) || (m[i].instr) || (m[i].volcmd) || (m[i].command)) goto NotEmpty; + if(m[i].IsEmpty()) + { + bEmptyPat = false; + break; + } } - pSndFile->Patterns.Remove(nPat); - nPatRemoved++; -NotEmpty: - ; + if(bEmptyPat) + { + pSndFile->Patterns.Remove(nPat); + nPatRemoved++; + } } - UINT bWaste = 0; + UINT nWaste = 0; for (UINT ichk=0; ichk < maxPatIndex; ichk++) { - if ((pSndFile->Patterns[ichk]) && (!bPatUsed[ichk])) bWaste++; + if ((pSndFile->Patterns[ichk]) && (!bPatUsed[ichk])) nWaste++; } - if ((bRemove) && (bWaste)) + if ((bRemove) && (nWaste)) { EndWaitCursor(); - wsprintf(s, "%d pattern%s present in file, but not used in the song\nDo you want to reorder the sequence list and remove these patterns?", bWaste, (bWaste == 1) ? "" : "s"); + wsprintf(s, "%d pattern%s present in file, but not used in the song\nDo you want to reorder the sequence list and remove these patterns?", nWaste, (nWaste == 1) ? "" : "s"); if (m_wParent->MessageBox(s, "Pattern Cleanup", MB_YESNO) != IDYES) return false; BeginWaitCursor(); } @@ -431,7 +437,7 @@ } } // Add unused patterns at the end - if ((!bRemove) || (!bWaste)) + if ((!bRemove) || (!nWaste)) { for(PATTERNINDEX iadd = 0; iadd < maxPatIndex; iadd++) { @@ -539,7 +545,7 @@ MODCOMMAND *p = pSndFile->Patterns[nPat]; if (p) { - UINT jmax = pSndFile->Patterns[nPat].GetNumRows() * pSndFile->m_nChannels; + UINT jmax = pSndFile->Patterns[nPat].GetNumRows() * pSndFile->GetNumChannels(); for (UINT j=0; j<jmax; j++, p++) { if ((p->note) && (p->note <= NOTE_MAX)) @@ -706,7 +712,7 @@ for (PATTERNINDEX nPat = 0; nPat < pSndFile->Patterns.Size(); nPat++) if (pSndFile->Patterns[nPat]) { MODCOMMAND *m = pSndFile->Patterns[nPat]; - for(UINT len = pSndFile->Patterns[nPat].GetNumRows() * pSndFile->m_nChannels; len; m++, len--) + for(UINT len = pSndFile->Patterns[nPat].GetNumRows() * pSndFile->GetNumChannels(); len; m++, len--) { if(m->instr <= pSndFile->m_nSamples) m->instr = (BYTE)nSampleMap[m->instr]; } Modified: trunk/OpenMPT/mptrack/CommandSet.cpp =================================================================== --- trunk/OpenMPT/mptrack/CommandSet.cpp 2010-06-03 20:39:27 UTC (rev 614) +++ trunk/OpenMPT/mptrack/CommandSet.cpp 2010-06-05 12:45:27 UTC (rev 615) @@ -1812,12 +1812,12 @@ commands[kcFileSaveAs].isDummy = false; commands[kcFileSaveAsWave].UID = 1351; - commands[kcFileSaveAsWave].Message = "File/Save as Wave"; + commands[kcFileSaveAsWave].Message = "File/Export as Wave"; commands[kcFileSaveAsWave].isHidden = false; commands[kcFileSaveAsWave].isDummy = false; commands[kcFileSaveAsMP3].UID = 1352; - commands[kcFileSaveAsMP3].Message = "File/Save as MP3"; + commands[kcFileSaveAsMP3].Message = "File/Export as MP3"; commands[kcFileSaveAsMP3].isHidden = false; commands[kcFileSaveAsMP3].isDummy = false; Modified: trunk/OpenMPT/mptrack/InputHandler.cpp =================================================================== --- trunk/OpenMPT/mptrack/InputHandler.cpp 2010-06-03 20:39:27 UTC (rev 614) +++ trunk/OpenMPT/mptrack/InputHandler.cpp 2010-06-05 12:45:27 UTC (rev 615) @@ -420,8 +420,8 @@ case ID_FILE_CLOSE: s="&Close\t"; c=kcFileClose; break; case ID_FILE_SAVE: s="&Save\t"; c=kcFileSave; break; case ID_FILE_SAVE_AS: s="Save &As...\t"; c=kcFileSaveAs; break; - case ID_FILE_SAVEASWAVE: s="Save as &Wave...\t"; c=kcFileSaveAsWave; break; - case ID_FILE_SAVEASMP3: s="Save as M&P3...\t"; c=kcFileSaveAsMP3; break; + case ID_FILE_SAVEASWAVE: s="Export as &Wave...\t"; c=kcFileSaveAsWave; break; + case ID_FILE_SAVEASMP3: s="Export as M&P3...\t"; c=kcFileSaveAsMP3; break; case ID_FILE_SAVEMIDI: s="Export as M&IDI...\t"; c=kcFileSaveMidi; break; case ID_FILE_SAVECOMPAT: s="Compatibility &Export...\t"; c=kcFileExportCompat; break; case ID_IMPORT_MIDILIB: s="Import &MIDI Library...\t"; c=kcFileImportMidiLib; break; Modified: trunk/OpenMPT/mptrack/Undo.cpp =================================================================== --- trunk/OpenMPT/mptrack/Undo.cpp 2010-06-03 20:39:27 UTC (rev 614) +++ trunk/OpenMPT/mptrack/Undo.cpp 2010-06-05 12:45:27 UTC (rev 615) @@ -33,13 +33,13 @@ // Create undo point. // Parameter list: // - pattern: Pattern of which an undo step should be created from. -// - x: first channel -// - y: first row -// - cx: width -// - cy: height -// - linkToPrevious: Don't create a separate undo step, but link this to the previous undo event. -bool CPatternUndo::PrepareUndo(PATTERNINDEX pattern, UINT x, UINT y, UINT cx, UINT cy, bool linkToPrevious) -//--------------------------------------------------------------------------------------------------------- +// - firstChn: first channel, 0-based. +// - firstRow: first row, 0-based. +// - numChns: width +// - numRows: height +// - linkToPrevious: Don't create a separate undo step, but link this to the previous undo event. Useful for commands that modify several patterns at once. +bool CPatternUndo::PrepareUndo(PATTERNINDEX pattern, CHANNELINDEX firstChn, ROWINDEX firstRow, CHANNELINDEX numChns, ROWINDEX numRows, bool linkToPrevious) +//--------------------------------------------------------------------------------------------------------------------------------------------------------- { if(m_pModDoc == nullptr) return false; CSoundFile *pSndFile = m_pModDoc->GetSoundFile(); @@ -47,16 +47,16 @@ PATTERNUNDOBUFFER sUndo; MODCOMMAND *pUndoData, *pPattern; - UINT nRows; + ROWINDEX nRows; if (!pSndFile->Patterns.IsValidPat(pattern)) return false; nRows = pSndFile->Patterns[pattern].GetNumRows(); pPattern = pSndFile->Patterns[pattern]; - if ((y >= nRows) || (cx < 1) || (cy < 1) || (x >= pSndFile->m_nChannels)) return false; - if (y + cy >= nRows) cy = nRows - y; - if (x + cx >= pSndFile->m_nChannels) cx = pSndFile->m_nChannels - x; + if ((firstRow >= nRows) || (numChns < 1) || (numRows < 1) || (firstChn >= pSndFile->m_nChannels)) return false; + if (firstRow + numRows >= nRows) numRows = nRows - firstRow; + if (firstChn + numChns >= pSndFile->m_nChannels) numChns = pSndFile->m_nChannels - firstChn; - pUndoData = new MODCOMMAND[cx * cy]; + pUndoData = new MODCOMMAND[numChns * numRows]; if (!pUndoData) return false; const bool bUpdate = !CanUndo(); // update undo status? @@ -69,17 +69,17 @@ sUndo.pattern = pattern; sUndo.patternsize = pSndFile->Patterns[pattern].GetNumRows(); - sUndo.column = x; - sUndo.row = y; - sUndo.cx = cx; - sUndo.cy = cy; + sUndo.firstChannel = firstChn; + sUndo.firstRow = firstRow; + sUndo.numChannels = numChns; + sUndo.numRows = numRows; sUndo.pbuffer = pUndoData; sUndo.linkToPrevious = linkToPrevious; - pPattern += x + y * pSndFile->m_nChannels; - for (UINT iy = 0; iy < cy; iy++) + pPattern += firstChn + firstRow * pSndFile->m_nChannels; + for(ROWINDEX iy = 0; iy < numRows; iy++) { - memcpy(pUndoData, pPattern, cx * sizeof(MODCOMMAND)); - pUndoData += cx; + memcpy(pUndoData, pPattern, numChns * sizeof(MODCOMMAND)); + pUndoData += numChns; pPattern += pSndFile->m_nChannels; } @@ -99,7 +99,7 @@ // Restore an undo point. Returns which pattern has been modified. -// linkedFromPrevious is true if a connected undo even is going to be deleted. +// linkedFromPrevious is true if a connected undo event is going to be deleted (can only be called internally). PATTERNINDEX CPatternUndo::Undo(bool linkedFromPrevious) //------------------------------------------------------ { @@ -128,7 +128,7 @@ nPattern = pUndo->pattern; nRows = pUndo->patternsize; - if(pUndo->column + pUndo->cx <= pSndFile->m_nChannels) + if(pUndo->firstChannel + pUndo->numChannels <= pSndFile->m_nChannels) { if((!pSndFile->Patterns[nPattern]) || (pSndFile->Patterns[nPattern].GetNumRows() < nRows)) { @@ -147,12 +147,12 @@ pUndoData = pUndo->pbuffer; pPattern = pSndFile->Patterns[nPattern]; if (!pSndFile->Patterns[nPattern]) return PATTERNINDEX_INVALID; - pPattern += pUndo->column + (pUndo->row * pSndFile->m_nChannels); - for(UINT iy = 0; iy < pUndo->cy; iy++) + pPattern += pUndo->firstChannel + (pUndo->firstRow * pSndFile->m_nChannels); + for(ROWINDEX iy = 0; iy < pUndo->numRows; iy++) { - memcpy(pPattern, pUndoData, pUndo->cx * sizeof(MODCOMMAND)); + memcpy(pPattern, pUndoData, pUndo->numChannels * sizeof(MODCOMMAND)); pPattern += pSndFile->m_nChannels; - pUndoData += pUndo->cx; + pUndoData += pUndo->numChannels; } } Modified: trunk/OpenMPT/mptrack/Undo.h =================================================================== --- trunk/OpenMPT/mptrack/Undo.h 2010-06-03 20:39:27 UTC (rev 614) +++ trunk/OpenMPT/mptrack/Undo.h 2010-06-05 12:45:27 UTC (rev 615) @@ -18,8 +18,8 @@ { PATTERNINDEX pattern; ROWINDEX patternsize; - UINT column, row; - UINT cx, cy; + CHANNELINDEX firstChannel, numChannels; + ROWINDEX firstRow, numRows; MODCOMMAND *pbuffer; bool linkToPrevious; }; @@ -42,7 +42,7 @@ // Pattern undo functions void ClearUndo(); - bool PrepareUndo(PATTERNINDEX pattern, UINT x, UINT y, UINT cx, UINT cy, bool linkToPrevious = false); + bool PrepareUndo(PATTERNINDEX pattern, CHANNELINDEX firstChn, ROWINDEX firstRow, CHANNELINDEX numChns, ROWINDEX numRows, bool linkToPrevious = false); PATTERNINDEX Undo(); bool CanUndo(); void RemoveLastUndoStep(); @@ -69,7 +69,7 @@ // We will differentiate between different types of undo actions so that we don't have to copy the whole sample everytime. enum sampleUndoTypes { - sundo_none = 0, // no changes to sample itself, e.g. loop point update + sundo_none, // no changes to sample itself, e.g. loop point update sundo_update, // silence, amplify, normalize, dc offset - update complete sample section sundo_delete, // delete part of the sample sundo_invert, // invert sample phase, apply again to undo Modified: trunk/OpenMPT/mptrack/Vstplug.cpp =================================================================== --- trunk/OpenMPT/mptrack/Vstplug.cpp 2010-06-03 20:39:27 UTC (rev 614) +++ trunk/OpenMPT/mptrack/Vstplug.cpp 2010-06-05 12:45:27 UTC (rev 615) @@ -2828,73 +2828,13 @@ //rewbs.smoothVST UINT CVstPlugin::GetZxxParameter(UINT nParam) -//-------------------------------------------------------- +//------------------------------------------- { return (UINT) (GetParameter(nParam) * 127.0f+0.5f); } //end rewbs.smoothVST -//rewbs.VSTCompliance: not keeping Eric's preset load/save -// code as he is not using the standard fxp format. -/* -// -> CODE#0002 -// -> DESC="VST plugins presets" -BOOL CVstPlugin::SavePreset(LPCSTR lpszFileName) -{ - FILE *f; - UINT nParams = (m_pEffect->numParams > 0) ? m_pEffect->numParams : 0; - - if((!lpszFileName) || (!nParams) || ((f = fopen(lpszFileName, "wb")) == NULL)) return FALSE; - - CHAR name[256]; - if(!GetDefaultEffectName(&name[0])) wsprintf(&name[0],"unknown"); - - DWORD nLen = strlen(name) + 1; - fwrite(&nLen, 1, sizeof(DWORD), f); // name string length - fwrite(&name[0], 1, nLen, f); // name string - nLen = nParams; - fwrite(&nLen, 1, sizeof(DWORD), f); // number of params - - for(UINT i=0; i<nParams; i++){ - FLOAT p = GetParameter(i); - fwrite(&p, 1, sizeof(FLOAT), f); // i'th param - } - - fclose(f); - return TRUE; -} - -BOOL CVstPlugin::LoadPreset(LPCSTR lpszFileName) -{ - FILE *f; - UINT nParams = (m_pEffect->numParams > 0) ? m_pEffect->numParams : 0; - - if((!lpszFileName) || ((f = fopen(lpszFileName, "r")) == NULL)) return FALSE; - - FLOAT p; - DWORD nLen; - CHAR name[256]; - CHAR ename[256]; - - fread(&nLen, 1, sizeof(DWORD), f); // name string length - fread(&name[0], 1, nLen, f); // name string - fread(&nLen, 1, sizeof(DWORD), f); // number of params - - if(!GetDefaultEffectName(&ename[0])) wsprintf(&ename[0],"unknown"); - if(strcmp(name,ename) != 0 || nLen != nParams) { fclose(f); return FALSE; } - - for(UINT i=0; i<nParams; i++){ - fread(&p, 1, sizeof(FLOAT), f); // i'th param - SetParameter(i, p); - } - - fclose(f); - return TRUE; -} -// -! NEW_FEATURE#0002 -*/ - void CVstPlugin::SaveAllParameters() //---------------------------------- { @@ -3097,15 +3037,13 @@ bool CVstPlugin::Bypass(bool bypass) //----------------------------------- { - if (bypass) { + if (bypass) m_pMixStruct->Info.dwInputRouting |= MIXPLUG_INPUTF_BYPASS; - } else { - m_pMixStruct->Info.dwInputRouting &=~ MIXPLUG_INPUTF_BYPASS; - } + else + m_pMixStruct->Info.dwInputRouting &= ~MIXPLUG_INPUTF_BYPASS; - if (m_pModDoc) { + if (m_pModDoc) m_pModDoc->UpdateAllViews(NULL, HINT_MIXPLUGINS, NULL); - } return bypass; } Modified: trunk/OpenMPT/muParser/build/msvc2008/muparser_muParser.vcproj =================================================================== --- trunk/OpenMPT/muParser/build/msvc2008/muparser_muParser.vcproj 2010-06-03 20:39:27 UTC (rev 614) +++ trunk/OpenMPT/muParser/build/msvc2008/muparser_muParser.vcproj 2010-06-05 12:45:27 UTC (rev 615) @@ -216,7 +216,7 @@ BufferSecurityCheck="true" RuntimeTypeInfo="true" ObjectFile="obj\vc_static_dbg\muParser\" - ProgramDataBaseFileName="..\..\lib\muparserd.pdb" + ProgramDataBaseFileName="..\..\lib\muparser.pdb" WarningLevel="4" SuppressStartupBanner="true" DebugInformationFormat="3" @@ -235,7 +235,7 @@ /> <Tool Name="VCLibrarianTool" - OutputFile="..\..\lib\muparserd.lib" + OutputFile="..\..\lib\muparser.lib" SuppressStartupBanner="true" /> <Tool Modified: trunk/OpenMPT/soundlib/Load_mo3.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_mo3.cpp 2010-06-03 20:39:27 UTC (rev 614) +++ trunk/OpenMPT/soundlib/Load_mo3.cpp 2010-06-05 12:45:27 UTC (rev 615) @@ -34,15 +34,15 @@ if(lpStream[3] > 31) return false; #ifdef MODPLUG_TRACKER - if(m_pModDoc != nullptr) m_pModDoc->AddToLog(GetStrI18N(__TEXT("The file appears to be a MO3 file, but this OpenMPT build does not support loading MO3 files."))); + if(m_pModDoc != nullptr) m_pModDoc->AddToLog(GetStrI18N(_TEXT("The file appears to be a MO3 file, but this OpenMPT build does not support loading MO3 files."))); #endif // MODPLUG_TRACKER return false; #else - bool b_result = false; // result of trying to load the module, false == fail. + bool bResult = false; // result of trying to load the module, false == fail. int iLen = static_cast<int>(dwMemLength); - void ** mo3Stream = (void **)&lpStream; + void **mo3Stream = (void **)&lpStream; // try to load unmo3.dll dynamically. HMODULE unmo3 = LoadLibrary(_TEXT("unmo3.dll")); @@ -54,24 +54,26 @@ } else //case: dll loaded succesfully. { - UNMO3_DECODE UNMO3_Decode = (UNMO3_DECODE)GetProcAddress(unmo3, "UNMO3_Decode"); - UNMO3_FREE UNMO3_Free = (UNMO3_FREE)GetProcAddress(unmo3, "UNMO3_Free"); + UNMO3_DECODE UNMO3_Decode = (UNMO3_DECODE)GetProcAddress(unmo3, _TEXT("UNMO3_Decode")); + UNMO3_FREE UNMO3_Free = (UNMO3_FREE)GetProcAddress(unmo3, _TEXT("UNMO3_Free")); - if(UNMO3_Decode != NULL && UNMO3_Free != NULL) { - if(UNMO3_Decode(mo3Stream, &iLen) == 0) { + if(UNMO3_Decode != NULL && UNMO3_Free != NULL) + { + if(UNMO3_Decode(mo3Stream, &iLen) == 0) + { /* if decoding was successful, mo3Stream and iLen will keep the new pointers now. */ if(iLen > 0) { - b_result = true; + bResult = true; if ((!ReadXM((const BYTE *)*mo3Stream, (DWORD)iLen)) && (!ReadIT((const BYTE *)*mo3Stream, (DWORD)iLen)) && (!ReadS3M((const BYTE *)*mo3Stream, (DWORD)iLen)) #ifndef FASTSOUNDLIB && (!ReadMTM((const BYTE *)*mo3Stream, (DWORD)iLen)) - #endif - && (!ReadMod((const BYTE *)*mo3Stream, (DWORD)iLen))) b_result = false; + #endif // FASTSOUNDLIB + && (!ReadMod((const BYTE *)*mo3Stream, (DWORD)iLen))) bResult = false; } UNMO3_Free(*mo3Stream); @@ -79,8 +81,6 @@ } FreeLibrary(unmo3); } - return b_result; + return bResult; #endif // NO_MO3_SUPPORT } - - Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp =================================================================== --- trunk/OpenMPT/soundlib/Snd_fx.cpp 2010-06-03 20:39:27 UTC (rev 614) +++ trunk/OpenMPT/soundlib/Snd_fx.cpp 2010-06-05 12:45:27 UTC (rev 615) @@ -1868,7 +1868,7 @@ // Set Channel Global Volume case CMD_CHANNELVOLUME: - if (m_nTickCount) break; + if ((m_dwSongFlags & SONG_FIRSTTICK) == 0) break; if (param <= 64) { pChn->nGlobalVol = param; @@ -1913,7 +1913,8 @@ // Position Jump case CMD_POSITIONJUMP: nPosJump = param; - if((m_dwSongFlags & SONG_PATTERNLOOP && m_nSeqOverride == 0)) { + if((m_dwSongFlags & SONG_PATTERNLOOP && m_nSeqOverride == 0)) + { m_nSeqOverride = param + 1; //Releasing pattern loop after position jump could cause //instant jumps - modifying behavior so that now position jumps @@ -1927,16 +1928,20 @@ // Pattern Break case CMD_PATTERNBREAK: m = NULL; - if (m_nRow < Patterns[m_nPattern].GetNumRows()-1) { + if (m_nRow < Patterns[m_nPattern].GetNumRows()-1) + { m = Patterns[m_nPattern] + (m_nRow+1) * m_nChannels + nChn; } - if (m && m->command == CMD_XPARAM) { + if (m && m->command == CMD_XPARAM) + { nBreakRow = (param<<8) + m->param; - } else { + } else + { nBreakRow = param; } - if((m_dwSongFlags & SONG_PATTERNLOOP)) { + if((m_dwSongFlags & SONG_PATTERNLOOP)) + { //If song is set to loop and a pattern break occurs we should stay on the same pattern. //Use nPosJump to force playback to "jump to this pattern" rather than move to next, as by default. //rewbs.to @@ -1944,25 +1949,22 @@ } break; - // Midi Controller + // Midi Controller (on first tick only) case CMD_MIDI: if(!(m_dwSongFlags & SONG_FIRSTTICK)) break; - if (param < 0x80){ + if (param < 0x80) ProcessMidiMacro(nChn, &m_MidiCfg.szMidiSFXExt[pChn->nActiveMacro << 5], param); - } else { + else ProcessMidiMacro(nChn, &m_MidiCfg.szMidiZXXExt[(param & 0x7F) << 5], 0); - } break; - //rewbs.smoothVST: Smooth Macro slide + // Midi Controller (smooth, i.e. on every tick) case CMD_SMOOTHMIDI: - if (param < 0x80) { + if (param < 0x80) ProcessSmoothMidiMacro(nChn, &m_MidiCfg.szMidiSFXExt[pChn->nActiveMacro << 5], param); - } else { + else ProcessSmoothMidiMacro(nChn, &m_MidiCfg.szMidiZXXExt[(param & 0x7F) << 5], 0); - } break; - //rewbs.smoothVST end // IMF Commands case CMD_NOTESLIDEUP: @@ -2040,7 +2042,8 @@ void CSoundFile::resetEnvelopes(MODCHANNEL* pChn, int envToReset) //--------------------------------------------------------------- { - switch (envToReset) { + switch (envToReset) + { case ENV_RESET_ALL: pChn->nVolEnvPosition = 0; pChn->nPanEnvPosition = 0; Modified: trunk/OpenMPT/soundlib/Sndfile.cpp =================================================================== --- trunk/OpenMPT/soundlib/Sndfile.cpp 2010-06-03 20:39:27 UTC (rev 614) +++ trunk/OpenMPT/soundlib/Sndfile.cpp 2010-06-05 12:45:27 UTC (rev 615) @@ -1149,11 +1149,11 @@ { double bpm; - if (m_nTempoMode == tempo_mode_modern) { // With modern mode, we trust that true bpm - bpm = static_cast<double>(m_nMusicTempo); // is be close enough to what user chose. - } // This avoids oscillation due to tick-to-tick corrections. - - else { //with other modes, we calculate it: + if (m_nTempoMode == tempo_mode_modern) // With modern mode, we trust that true bpm + { // is close enough to what user chose. + bpm = static_cast<double>(m_nMusicTempo); // This avoids oscillation due to tick-to-tick corrections. + } else + { //with other modes, we calculate it: double ticksPerBeat = m_nMusicSpeed*m_nRowsPerBeat; //ticks/beat = ticks/row * rows/beat double samplesPerBeat = m_nSamplesPerTick*ticksPerBeat; //samps/beat = samps/tick * ticks/beat bpm = gdwMixingFreq/samplesPerBeat*60; //beats/sec = samps/sec / samps/beat @@ -1204,7 +1204,7 @@ MODCOMMAND *p = Patterns[Order[nPattern]]; if ((p) && (nRow < Patterns[Order[nPattern]].GetNumRows())) { - BOOL bOk = FALSE; + bool bOk = false; while ((!bOk) && (nRow > 0)) { UINT n = nRow * m_nChannels; @@ -1212,7 +1212,7 @@ { if (p[n].note) { - bOk = TRUE; + bOk = true; break; } } @@ -1360,7 +1360,7 @@ m_nBufferCount = 0; for (UINT i=0; i<MAX_CHANNELS; i++) { - Chn[i].nROfs = Chn[i].nLOfs = 0; + Chn[i].nROfs = Chn[i].nLOfs = Chn[i].nLength = 0; } } Modified: trunk/OpenMPT/soundlib/Sndfile.h =================================================================== --- trunk/OpenMPT/soundlib/Sndfile.h 2010-06-03 20:39:27 UTC (rev 614) +++ trunk/OpenMPT/soundlib/Sndfile.h 2010-06-05 12:45:27 UTC (rev 615) @@ -478,7 +478,7 @@ // Is compatible mode for a specific tracker turned on? // Hint 1: No need to poll for MOD_TYPE_MPT, as it will automatically be linked with MOD_TYPE_IT when using TRK_IMPULSETRACKER // Hint 2: Always returns true for MOD / S3M format (if that is the format of the current file) - bool IsCompatibleMode(MODTYPE type) + bool IsCompatibleMode(MODTYPE type) const { if(GetType() & type & (MOD_TYPE_MOD | MOD_TYPE_S3M)) return true; // S3M and MOD format don't have compatibility flags, so we will always return true @@ -1154,10 +1154,10 @@ typedef struct MODFORMATINFO { - DWORD dwFormatId; // MOD_TYPE_XXXX - LPCSTR lpszFormatName; // "ProTracker" - LPCSTR lpszExtension; // ".xxx" - DWORD dwPadding; + MODTYPE mtFormatId; // MOD_TYPE_XXXX + LPCSTR lpszFormatName; // "ProTracker" + LPCSTR lpszExtension; // ".xxx" + DWORD dwPadding; } MODFORMATINFO; extern MODFORMATINFO gModFormatInfo[MAX_MODTYPE]; Modified: trunk/OpenMPT/soundlib/Sndmix.cpp =================================================================== --- trunk/OpenMPT/soundlib/Sndmix.cpp 2010-06-03 20:39:27 UTC (rev 614) +++ trunk/OpenMPT/soundlib/Sndmix.cpp 2010-06-05 12:45:27 UTC (rev 615) @@ -49,7 +49,7 @@ LONG gnDryROfsVol = 0; LONG gnDryLOfsVol = 0; int gbInitPlugins = 0; -int gbInitTables = 0; +bool gbInitTables = 0; typedef DWORD (MPPASMCALL * LPCONVERTPROC)(LPVOID, int *, DWORD); @@ -218,7 +218,7 @@ if (!gbInitTables) { SndMixInitializeTables(); - gbInitTables = 1; + gbInitTables = true; } #endif if (m_nMaxMixChannels > MAX_CHANNELS) m_nMaxMixChannels = MAX_CHANNELS; @@ -681,11 +681,13 @@ m_nMusicSpeed = m_nDefaultSpeed; m_nMusicTempo = m_nDefaultTempo; m_nGlobalVolume = m_nDefaultGlobalVolume; - for (UINT i=0; i<MAX_CHANNELS; i++) { + for (UINT i=0; i<MAX_CHANNELS; i++) + { Chn[i].dwFlags |= CHN_NOTEFADE | CHN_KEYOFF; Chn[i].nFadeOutVol = 0; - if (i < m_nChannels) { + if (i < m_nChannels) + { Chn[i].nGlobalVol = ChnSettings[i].nVolume; Chn[i].nVolume = ChnSettings[i].nVolume; Chn[i].nPan = ChnSettings[i].nPan; @@ -696,7 +698,8 @@ Chn[i].nOldHiOffset = 0; Chn[i].nPortamentoDest = 0; - if (!Chn[i].nLength) { + if (!Chn[i].nLength) + { Chn[i].dwFlags = ChnSettings[i].dwFlags; Chn[i].nLoopStart = 0; Chn[i].nLoopEnd = 0; @@ -715,7 +718,8 @@ m_nCurrentPattern = nRestartPosOverride; m_dwSongFlags &= ~SONG_BREAKTOROW; //If restart pos points to +++, move along - while (Order[m_nCurrentPattern] == Order.GetIgnoreIndex()) { + while (Order[m_nCurrentPattern] == Order.GetIgnoreIndex()) + { m_nCurrentPattern++; } //Check for end of song or bad pattern @@ -726,19 +730,18 @@ return FALSE; } - } else { + } else + { m_nCurrentPattern++; } - if (m_nCurrentPattern < Order.size()) { + if (m_nCurrentPattern < Order.size()) m_nPattern = Order[m_nCurrentPattern]; - } else { + else m_nPattern = Order.GetInvalidPatIndex(); - } - if ((m_nPattern < Patterns.Size()) && (!Patterns[m_nPattern])) { + if ((m_nPattern < Patterns.Size()) && (!Patterns[m_nPattern])) m_nPattern = Order.GetIgnoreIndex(); - } } m_nNextPattern = m_nCurrentPattern; @@ -1184,7 +1187,8 @@ } } // vol is 14-bits - if (vol) { + if (vol) + { // IMPORTANT: pChn->nRealVolume is 14 bits !!! // -> _muldiv( 14+8, 6+6, 18); => RealVolume: 14-bit result (22+12-20) @@ -1192,11 +1196,14 @@ //Don't let global volume affect level of sample if //global volume is going to be applied to master output anyway. - if (pChn->dwFlags&CHN_SYNCMUTE) { + if (pChn->dwFlags & CHN_SYNCMUTE) + { pChn->nRealVolume = 0; - } else if (m_pConfig->getGlobalVolumeAppliesToMaster()) { + } else if (m_pConfig->getGlobalVolumeAppliesToMaster()) + { pChn->nRealVolume = _muldiv(vol*MAX_GLOBAL_VOLUME, pChn->nGlobalVol * pChn->nInsVol, 1 << 20); - } else { + } else + { pChn->nRealVolume = _muldiv(vol * m_nGlobalVolume, pChn->nGlobalVol * pChn->nInsVol, 1 << 20); } } @@ -1901,7 +1908,7 @@ if (nRampLength < (LONG)gnVolumeRampSamples) nRampLength = gnVolumeRampSamples; } } -#endif +#endif // FASTSOUNDLIB pChn->nRightRamp = nRightDelta / nRampLength; pChn->nLeftRamp = nLeftDelta / nRampLength; pChn->nRightVol = pChn->nNewRightVol - ((pChn->nRightRamp * nRampLength) >> VOLUMERAMPPRECISION); @@ -1931,7 +1938,7 @@ // Note change but no sample if (pChn->nLeftVU > 128) pChn->nLeftVU = 0; if (pChn->nRightVU > 128) pChn->nRightVU = 0; -#endif +#endif // ENABLE_STEREOVU if (pChn->nVUMeter > 0xFF) pChn->nVUMeter = 0; pChn->nLeftVol = pChn->nRightVol = 0; pChn->nLength = 0; Modified: trunk/OpenMPT/soundlib/modcommand.h =================================================================== --- trunk/OpenMPT/soundlib/modcommand.h 2010-06-03 20:39:27 UTC (rev 614) +++ trunk/OpenMPT/soundlib/modcommand.h 2010-06-05 12:45:27 UTC (rev 615) @@ -52,15 +52,21 @@ void Clear() {memset(this, 0, sizeof(MODCOMMAND));} // Returns true if modcommand is empty, false otherwise. - bool IsEmpty() const {return (this->note == 0 && this->instr == 0 && this->volcmd == 0 && this->command == 0);} - //bool IsEmpty() const {return (*this == Empty());} + // If ignoreEffectValues is true (default), effect values are ignored are ignored if there is no effect command present. + bool IsEmpty(bool ignoreEffectValues = true) const + { + if(ignoreEffectValues) + return (this->note == 0 && this->instr == 0 && this->volcmd == 0 && this->command == 0); + else + return (*this == Empty()); + } // Returns true if instrument column represents plugin index. bool IsInstrPlug() const {return IsPcNote();} // Returns true if and only if note is NOTE_PC or NOTE_PCS. - bool IsPcNote() const {return note == NOTE_PC || note == NOTE_PCS;} - static bool IsPcNote(NOTE note_id) {return note_id == NOTE_PC || note_id == NOTE_PCS;} + bool IsPcNote() const { return note == NOTE_PC || note == NOTE_PCS; } + static bool IsPcNote(NOTE note_id) { return note_id == NOTE_PC || note_id == NOTE_PCS; } // Swap volume and effect column (doesn't do any conversion as it's mainly for importing formats with multiple effect columns, so beware!) void SwapEffects() Modified: trunk/OpenMPT/soundlib/pattern.cpp =================================================================== --- trunk/OpenMPT/soundlib/pattern.cpp 2010-06-03 20:39:27 UTC (rev 614) +++ trunk/OpenMPT/soundlib/pattern.cpp 2010-06-05 12:45:27 UTC (rev 615) @@ -116,7 +116,6 @@ //--------------------- { MODCOMMAND *newPattern, *oldPattern; - UINT nRows, nChns; CSoundFile& sndFile = m_rPatternContainer.GetSoundFile(); if(sndFile.m_pModDoc == NULL) return true; @@ -126,21 +125,21 @@ if ((!m_ModCommands) || (m_Rows > sndFile.GetModSpecifications().patternRowsMax / 2)) return true; rModDoc.BeginWaitCursor(); - nRows = m_Rows; - nChns = sndFile.m_nChannels; - newPattern = CSoundFile::AllocatePattern(nRows*2, nChns); + const ROWINDEX nRows = m_Rows; + const CHANNELINDEX nChns = sndFile.m_nChannels; + newPattern = CSoundFile::AllocatePattern(nRows * 2, nChns); if (!newPattern) return true; - const UINT nPattern = m_rPatternContainer.GetIndex(this); - rModDoc.GetPatternUndo()->PrepareUndo(nPattern, 0,0, nChns, nRows); + const PATTERNINDEX nPattern = m_rPatternContainer.GetIndex(this); + rModDoc.GetPatternUndo()->PrepareUndo(nPattern, 0, 0, nChns, nRows); oldPattern = m_ModCommands; - for (UINT y=0; y<nRows; y++) + for (ROWINDEX y = 0; y < nRows; y++) { - memcpy(newPattern+y*2*nChns, oldPattern+y*nChns, nChns*sizeof(MODCOMMAND)); + memcpy(newPattern + y * 2 * nChns, oldPattern + y * nChns, nChns * sizeof(MODCOMMAND)); } m_ModCommands = newPattern; m_Rows = nRows * 2; - CSoundFile::FreePattern(oldPattern); oldPattern= NULL; + CSoundFile::FreePattern(oldPattern); oldPattern = nullptr; rModDoc.SetModified(); rModDoc.UpdateAllViews(NULL, HINT_PATTERNDATA | (nPattern << HINT_SHIFT_PAT), NULL); rModDoc.EndWaitCursor(); @@ -150,8 +149,6 @@ bool CPattern::Shrink() //--------------------- { - UINT nRows, nChns; - CSoundFile& sndFile = m_rPatternContainer.GetSoundFile(); if(sndFile.m_pModDoc == NULL) return true; @@ -160,16 +157,16 @@ if (!m_ModCommands || m_Rows < sndFile.GetModSpecifications().patternRowsMin * 2) return true; rModDoc.BeginWaitCursor(); - nRows = m_Rows; - nChns = sndFile.m_nChannels; - const UINT nPattern = m_rPatternContainer.GetIndex(this); - rModDoc.GetPatternUndo()->PrepareUndo(nPattern, 0,0, nChns, nRows); + ROWINDEX nRows = m_Rows; + const CHANNELINDEX nChns = sndFile.m_nChannels; + const PATTERNINDEX nPattern = m_rPatternContainer.GetIndex(this); + rModDoc.GetPatternUndo()->PrepareUndo(nPattern, 0, 0, nChns, nRows); nRows /= 2; - for (UINT y=0; y<nRows; y++) + for (ROWINDEX y = 0; y < nRows; y++) { MODCOMMAND *psrc = sndFile.Patterns[nPattern] + (y * 2 * nChns); MODCOMMAND *pdest = sndFile.Patterns[nPattern] + (y * nChns); - for (UINT x=0; x<nChns; x++) + for (CHANNELINDEX x = 0; x < nChns; x++) { pdest[x] = psrc[x]; if ((!pdest[x].note) && (!pdest[x].instr)) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |