From: <sag...@us...> - 2015-05-24 22:14:53
|
Revision: 5156 http://sourceforge.net/p/modplug/code/5156 Author: saga-games Date: 2015-05-24 22:14:47 +0000 (Sun, 24 May 2015) Log Message: ----------- [Ref] Small changes here and there with no functional changes Modified Paths: -------------- trunk/OpenMPT/common/mptPathString.h trunk/OpenMPT/mptrack/InputHandler.cpp trunk/OpenMPT/mptrack/Mainbar.cpp trunk/OpenMPT/soundlib/ITTools.cpp trunk/OpenMPT/soundlib/ITTools.h trunk/OpenMPT/soundlib/Load_umx.cpp trunk/OpenMPT/soundlib/ModInstrument.h trunk/OpenMPT/soundlib/Snd_flt.cpp trunk/OpenMPT/soundlib/SoundFilePlayConfig.cpp trunk/OpenMPT/soundlib/SoundFilePlayConfig.h trunk/OpenMPT/unarchiver/ungzip.cpp Modified: trunk/OpenMPT/common/mptPathString.h =================================================================== --- trunk/OpenMPT/common/mptPathString.h 2015-05-24 22:10:36 UTC (rev 5155) +++ trunk/OpenMPT/common/mptPathString.h 2015-05-24 22:14:47 UTC (rev 5156) @@ -100,6 +100,7 @@ // Verify if this path represents a valid directory on the file system. bool IsDirectory() const { return ::PathIsDirectoryW(path.c_str()) != FALSE; } + // Verify if this path exists and is a file on the file system. bool IsFile() const { DWORD dwAttrib = ::GetFileAttributesW(path.c_str()); @@ -119,15 +120,12 @@ { if(empty()) return false; - const RawPathString::value_type &c = path[path.length() - 1]; + const RawPathString::const_reference c = path.back(); #if MPT_OS_WINDOWS - if(c == L'\\' || c == L'/') - return true; + return (c == L'\\' || c == L'/'); #else - if(c == '/') - return true; + return (c == '/'); #endif - return false; } // Relative / absolute paths conversion Modified: trunk/OpenMPT/mptrack/InputHandler.cpp =================================================================== --- trunk/OpenMPT/mptrack/InputHandler.cpp 2015-05-24 22:10:36 UTC (rev 5155) +++ trunk/OpenMPT/mptrack/InputHandler.cpp 2015-05-24 22:14:47 UTC (rev 5156) @@ -51,7 +51,7 @@ if (bNoExistingKbdFileSetting) TrackerSettings::Instance().m_szKbdFile = sDefaultPath; bool bSuccess = false; - if (PathFileExistsW(sDefaultPath.AsNative().c_str()) == TRUE) + if (sDefaultPath.IsFile()) bSuccess = activeCommandSet->LoadFile(sDefaultPath); if (!bSuccess) { @@ -510,14 +510,14 @@ case ID_VIEW_GRAPH: s = _T("G&raph"); c = kcViewGraph; break; //rewbs.graph case MAINVIEW: s = _T("&Main"); c = kcViewMain; break; case IDD_TREEVIEW: s = _T("&Tree"); c = kcViewTree; break; - case ID_VIEW_OPTIONS: s = _T("S&etup..."); c = kcViewOptions; break; - case ID_HELPSHOW: s = _T("&Help..."); c = kcHelp; break; - case ID_PLUGIN_SETUP: s = _T("Pl&ugin Manager..."); c = kcViewAddPlugin; break; - case ID_CHANNEL_MANAGER: s = _T("Ch&annel Manager..."); c = kcViewChannelManager; break; - case ID_CLIPBOARD_MANAGER: s = _T("C&lipboard Manager..."); c = kcToggleClipboardManager; break; - case ID_VIEW_SONGPROPERTIES:s = _T("Song P&roperties..."); c = kcViewSongProperties; break; //rewbs.graph - case ID_VIEW_MIDIMAPPING: s = _T("&MIDI Mapping..."); c = kcViewMIDImapping; break; - case ID_VIEW_EDITHISTORY: s = _T("Edit &History..."); c = kcViewEditHistory; break; + case ID_VIEW_OPTIONS: s = _T("S&etup"); c = kcViewOptions; break; + case ID_HELPSHOW: s = _T("&Help"); c = kcHelp; break; + case ID_PLUGIN_SETUP: s = _T("Pl&ugin Manager"); c = kcViewAddPlugin; break; + case ID_CHANNEL_MANAGER: s = _T("Ch&annel Manager"); c = kcViewChannelManager; break; + case ID_CLIPBOARD_MANAGER: s = _T("C&lipboard Manager"); c = kcToggleClipboardManager; break; + case ID_VIEW_SONGPROPERTIES:s = _T("Song P&roperties"); c = kcViewSongProperties; break; + case ID_VIEW_MIDIMAPPING: s = _T("&MIDI Mapping"); c = kcViewMIDImapping; break; + case ID_VIEW_EDITHISTORY: s = _T("Edit &History"); c = kcViewEditHistory; break; // Help submenu: case ID_EXAMPLE_MODULES: return _T("&Example Modules"); Modified: trunk/OpenMPT/mptrack/Mainbar.cpp =================================================================== --- trunk/OpenMPT/mptrack/Mainbar.cpp 2015-05-24 22:10:36 UTC (rev 5155) +++ trunk/OpenMPT/mptrack/Mainbar.cpp 2015-05-24 22:14:47 UTC (rev 5156) @@ -602,6 +602,7 @@ HMENU hMenu = ::CreatePopupMenu(); MIDIINCAPS mic; UINT ndevs = midiInGetNumDevs(); + if(ndevs > MAX_MIDI_DEVICES) ndevs = MAX_MIDI_DEVICES; UINT current = TrackerSettings::Instance().m_nMidiDevice; for(UINT i = 0; i < ndevs; i++) { Modified: trunk/OpenMPT/soundlib/ITTools.cpp =================================================================== --- trunk/OpenMPT/soundlib/ITTools.cpp 2015-05-24 22:10:36 UTC (rev 5155) +++ trunk/OpenMPT/soundlib/ITTools.cpp 2015-05-24 22:14:47 UTC (rev 5156) @@ -360,10 +360,10 @@ } if(note < 120) { - mptIns.NoteMap[i] = note + 1u; + mptIns.NoteMap[i] = note + NOTE_MIN; } else { - mptIns.NoteMap[i] = static_cast<uint8>(i + 1); + mptIns.NoteMap[i] = static_cast<uint8>(i + NOTE_MIN); } } Modified: trunk/OpenMPT/soundlib/ITTools.h =================================================================== --- trunk/OpenMPT/soundlib/ITTools.h 2015-05-24 22:10:36 UTC (rev 5155) +++ trunk/OpenMPT/soundlib/ITTools.h 2015-05-24 22:14:47 UTC (rev 5156) @@ -88,7 +88,7 @@ envFilter = 0x80, }; - uint8 flags; // Envelope Flags + uint8 flags; // Envelope Flags uint8 num; // Number of Envelope Nodes uint8 lpb; // Loop Start uint8 lpe; // Loop End Modified: trunk/OpenMPT/soundlib/Load_umx.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_umx.cpp 2015-05-24 22:10:36 UTC (rev 5155) +++ trunk/OpenMPT/soundlib/Load_umx.cpp 2015-05-24 22:14:47 UTC (rev 5156) @@ -158,7 +158,7 @@ ReadUMXIndex(chunk); // Object parent if(packageVersion >= 60) { - chunk.Skip(4); // Internal package / group of the object + chunk.Skip(4); // Internal package / group of the object } objName = ReadUMXIndex(chunk); // Object name (offset into the name table) chunk.Skip(4); // Object flags Modified: trunk/OpenMPT/soundlib/ModInstrument.h =================================================================== --- trunk/OpenMPT/soundlib/ModInstrument.h 2015-05-24 22:10:36 UTC (rev 5155) +++ trunk/OpenMPT/soundlib/ModInstrument.h 2015-05-24 22:14:47 UTC (rev 5156) @@ -77,7 +77,7 @@ int8 nPPS; // Pitch/Pan separation (i.e. how wide the panning spreads, -32...32) uint8 nPPC; // Pitch/Pan centre - PLUGINDEX nMixPlug; // Plugin assigned to this instrument + PLUGINDEX nMixPlug; // Plugin assigned to this instrument (0 = no plugin, 1 = first plugin) uint8 nCutSwing; // Random cutoff factor (0...64) uint8 nResSwing; // Random resonance factor (0...64) uint8 nFilterMode; // Default filter mode Modified: trunk/OpenMPT/soundlib/Snd_flt.cpp =================================================================== --- trunk/OpenMPT/soundlib/Snd_flt.cpp 2015-05-24 22:10:36 UTC (rev 5155) +++ trunk/OpenMPT/soundlib/Snd_flt.cpp 2015-05-24 22:14:47 UTC (rev 5156) @@ -14,7 +14,7 @@ #include "Tables.h" #define _USE_MATH_DEFINES -#include <math.h> +#include <cmath> #ifndef M_PI #define M_PI 3.1415926535897932385 #endif @@ -30,15 +30,11 @@ DWORD CSoundFile::CutOffToFrequency(UINT nCutOff, int flt_modifier) const //----------------------------------------------------------------------- { - float Fc; MPT_ASSERT(nCutOff < 128); - if(m_SongFlags[SONG_EXFILTERRANGE]) - Fc = 110.0f * pow(2.0f, 0.25f + ((float)(nCutOff * (flt_modifier + 256))) / (20.0f * 512.0f)); - else - Fc = 110.0f * pow(2.0f, 0.25f + ((float)(nCutOff * (flt_modifier + 256))) / (24.0f * 512.0f)); - LONG freq = (LONG)Fc; + float Fc = 110.0f * std::pow(2.0f, 0.25f + ((float)(nCutOff * (flt_modifier + 256))) / (m_SongFlags[SONG_EXFILTERRANGE] ? 20.0f * 512.0f : 24.0f * 512.0f)); + int freq = static_cast<int>(Fc); Limit(freq, 120, 20000); - if (freq * 2 > (LONG)m_MixerSettings.gdwMixingFreq) freq = m_MixerSettings.gdwMixingFreq >> 1; + if (freq * 2 > (int)m_MixerSettings.gdwMixingFreq) freq = m_MixerSettings.gdwMixingFreq / 2; return (DWORD)freq; } Modified: trunk/OpenMPT/soundlib/SoundFilePlayConfig.cpp =================================================================== --- trunk/OpenMPT/soundlib/SoundFilePlayConfig.cpp 2015-05-24 22:10:36 UTC (rev 5155) +++ trunk/OpenMPT/soundlib/SoundFilePlayConfig.cpp 2015-05-24 22:14:47 UTC (rev 5156) @@ -26,8 +26,8 @@ { } -void CSoundFilePlayConfig::SetMixLevels(int mixLevelType) -//------------------------------------------------------- +void CSoundFilePlayConfig::SetMixLevels(mixLevels mixLevelType) +//------------------------------------------------------------- { switch (mixLevelType) { Modified: trunk/OpenMPT/soundlib/SoundFilePlayConfig.h =================================================================== --- trunk/OpenMPT/soundlib/SoundFilePlayConfig.h 2015-05-24 22:10:36 UTC (rev 5155) +++ trunk/OpenMPT/soundlib/SoundFilePlayConfig.h 2015-05-24 22:14:47 UTC (rev 5156) @@ -50,7 +50,7 @@ CSoundFilePlayConfig(void); ~CSoundFilePlayConfig(void); - void SetMixLevels(int mixLevelType); + void SetMixLevels(mixLevels mixLevelType); //getters/setters bool getGlobalVolumeAppliesToMaster() const { return m_globalVolumeAppliesToMaster; } Modified: trunk/OpenMPT/unarchiver/ungzip.cpp =================================================================== --- trunk/OpenMPT/unarchiver/ungzip.cpp 2015-05-24 22:10:36 UTC (rev 5155) +++ trunk/OpenMPT/unarchiver/ungzip.cpp 2015-05-24 22:14:47 UTC (rev 5156) @@ -94,7 +94,8 @@ return false; } - try { + try + { data.resize(trailer.isize); } catch(...) { @@ -119,15 +120,7 @@ inflateEnd(&strm); // Everything went OK? Check return code, number of written bytes and CRC32. - if(retVal == Z_STREAM_END && trailer.isize == strm.total_out && trailer.crc32_ == crc32(0, (Bytef *)&data[0], trailer.isize)) - { - // Success! :) - return true; - } else - { - // Fail :( - return false; - } + return (retVal == Z_STREAM_END && trailer.isize == strm.total_out && trailer.crc32_ == crc32(0, (Bytef *)&data[0], trailer.isize)); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |