From: <sv...@op...> - 2024-06-16 16:32:15
|
Author: sagamusix Date: Sun Jun 16 18:32:07 2024 New Revision: 21036 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=21036 Log: [Ref] Small cleanups. Modified: trunk/OpenMPT/mptrack/Ctrl_smp.cpp trunk/OpenMPT/soundlib/Load_it.cpp trunk/OpenMPT/soundlib/Load_s3m.cpp Modified: trunk/OpenMPT/mptrack/Ctrl_smp.cpp ============================================================================== --- trunk/OpenMPT/mptrack/Ctrl_smp.cpp Sun Jun 16 10:52:23 2024 (r21035) +++ trunk/OpenMPT/mptrack/Ctrl_smp.cpp Sun Jun 16 18:32:07 2024 (r21036) @@ -3293,15 +3293,14 @@ // Return currently selected part of the sample. // The whole sample size will be returned if no part of the sample is selected. -// However, point.bSelected indicates whether a sample selection exists or not. +// However, points.selectionActive indicates whether a sample selection exists or not. CCtrlSamples::SampleSelectionPoints CCtrlSamples::GetSelectionPoints() { SampleSelectionPoints points; - SAMPLEVIEWSTATE viewstate; + SAMPLEVIEWSTATE viewstate{}; const ModSample &sample = m_sndFile.GetSample(m_nSample); - Clear(viewstate); - SendViewMessage(VIEWMSG_SAVESTATE, (LPARAM)&viewstate); + SendViewMessage(VIEWMSG_SAVESTATE, reinterpret_cast<LPARAM>(&viewstate)); points.nStart = viewstate.dwBeginSel; points.nEnd = viewstate.dwEndSel; if(points.nEnd > sample.nLength) points.nEnd = sample.nLength; @@ -3325,13 +3324,12 @@ Limit(nStart, SmpLength(0), sample.nLength); Limit(nEnd, SmpLength(0), sample.nLength); - SAMPLEVIEWSTATE viewstate; - Clear(viewstate); - SendViewMessage(VIEWMSG_SAVESTATE, (LPARAM)&viewstate); + SAMPLEVIEWSTATE viewstate{}; + SendViewMessage(VIEWMSG_SAVESTATE, reinterpret_cast<LPARAM>(&viewstate)); viewstate.dwBeginSel = nStart; viewstate.dwEndSel = nEnd; - SendViewMessage(VIEWMSG_LOADSTATE, (LPARAM)&viewstate); + SendViewMessage(VIEWMSG_LOADSTATE, reinterpret_cast<LPARAM>(&viewstate)); } Modified: trunk/OpenMPT/soundlib/Load_it.cpp ============================================================================== --- trunk/OpenMPT/soundlib/Load_it.cpp Sun Jun 16 10:52:23 2024 (r21035) +++ trunk/OpenMPT/soundlib/Load_it.cpp Sun Jun 16 18:32:07 2024 (r21036) @@ -654,7 +654,7 @@ } else if(possiblyUNMO3 && fileHeader.special <= 1) { // UNMO3 < v2.4.0.1 will set the edit history special bit iff the MIDI macro embed bit is also set, - // but it always writes the two extra bytes for the edit history length (zeroes). + // but it always writes the two extra bytes for the edit history length (zeros). // If MIDI macros are embedded, we are fine and end up in the first case of the if statement (read edit history). // Otherwise we end up here and might have to read the edit history length. if(file.ReadUint16LE() == 0) @@ -875,7 +875,7 @@ numPats = 0; } - // Checking for number of used channels, which is not explicitely specified in the file. + // Checking for number of used channels, which is not explicitly specified in the file. CHANNELINDEX numChannels = GetNumChannels(); for(PATTERNINDEX pat = 0; pat < numPats; pat++) { @@ -1083,14 +1083,11 @@ if(note > NOTE_MAX && note < 0xFD) note = NOTE_FADE; else if(note == 0xFD) note = NOTE_NONE; } - m.note = note; - lastValue[ch].note = note; + m.note = lastValue[ch].note = note; } if(chnMask[ch] & 2) { - uint8 instr = patternData.ReadUint8(); - m.instr = instr; - lastValue[ch].instr = instr; + m.instr = lastValue[ch].instr = patternData.ReadUint8(); } if(chnMask[ch] & 4) { Modified: trunk/OpenMPT/soundlib/Load_s3m.cpp ============================================================================== --- trunk/OpenMPT/soundlib/Load_s3m.cpp Sun Jun 16 10:52:23 2024 (r21035) +++ trunk/OpenMPT/soundlib/Load_s3m.cpp Sun Jun 16 18:32:07 2024 (r21036) @@ -426,7 +426,9 @@ // Global Volume m_nDefaultGlobalVolume = std::min(fileHeader.globalVol.get(), uint8(64)) * 4u; // The following check is probably not very reliable, but it fixes a few tunes, e.g. - // DARKNESS.S3M by Purple Motion (ST 3.00) and "Image of Variance" by C.C.Catch (ST 3.01): + // DARKNESS.S3M by Purple Motion (ST 3.00) and "Image of Variance" by C.C.Catch (ST 3.01). + // Note that even ST 3.01b imports these files with a global volume of 0, + // so it's not clear if these files ever played "as intended" in any ST3 versions (I don't have any older ST3 versions). if(m_nDefaultGlobalVolume == 0 && fileHeader.cwtv < S3MFileHeader::trkST3_20) { m_nDefaultGlobalVolume = MAX_GLOBAL_VOLUME; @@ -496,7 +498,7 @@ } if(GetNumChannels() < 32 && m_dwLastSavedWithVersion == MPT_V("1.16")) { - // MPT 1.0 alpha 6 up to 1.16.203 set ths panning bit for all channels, regardless of whether they are used or not. + // MPT 1.0 alpha 6 up to 1.16.203 set the panning bit for all channels, regardless of whether they are used or not. if(hasChannelsWithoutPanning) m_modFormat.madeWithTracker = U_("ModPlug Tracker 1.16 / OpenMPT 1.17"); else @@ -597,6 +599,7 @@ ROWINDEX row = 0; auto rowBase = Patterns[pat].GetRow(0); + ModCommand dummy; while(row < 64) { uint8 info = file.ReadUint8(); @@ -612,7 +615,6 @@ } CHANNELINDEX channel = (info & s3mChannelMask); - ModCommand dummy; ModCommand &m = (channel < GetNumChannels()) ? rowBase[channel] : dummy; if(info & s3mNotePresent) |