From: <sv...@op...> - 2024-08-11 17:51:33
|
Author: sagamusix Date: Sun Aug 11 19:51:21 2024 New Revision: 21380 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=21380 Log: [Ref] Remove CSoundFile::SetModSpecsPointer. Modified: trunk/OpenMPT/soundlib/Sndfile.cpp trunk/OpenMPT/soundlib/Sndfile.h Modified: trunk/OpenMPT/soundlib/Sndfile.cpp ============================================================================== --- trunk/OpenMPT/soundlib/Sndfile.cpp Sun Aug 11 09:38:54 2024 (r21379) +++ trunk/OpenMPT/soundlib/Sndfile.cpp Sun Aug 11 19:51:21 2024 (r21380) @@ -183,7 +183,7 @@ // This is such an odd behaviour that it's unlikely that any of the other formats will need it by default. Re-enable as needed. m_playBehaviour.reset(kITInitialNoteMemory); } - SetModSpecsPointer(m_pModSpecs, bestType); + m_pModSpecs = &GetModSpecifications(bestType); // Delete instruments in case some previously called loader already created them. for(INSTRUMENTINDEX i = 1; i <= m_nInstruments; i++) @@ -709,7 +709,7 @@ return false; } - SetModSpecsPointer(m_pModSpecs, GetBestSaveFormat()); + m_pModSpecs = &GetModSpecifications(GetBestSaveFormat()); // When reading a file made with an older version of MPT, it might be necessary to upgrade some settings automatically. if(m_dwLastSavedWithVersion) @@ -1660,29 +1660,29 @@ #endif // MODPLUG_TRACKER -void CSoundFile::SetModSpecsPointer(const CModSpecifications*& pModSpecs, const MODTYPE type) +const CModSpecifications &CSoundFile::GetModSpecifications(const MODTYPE type) { switch(type) { case MOD_TYPE_MPT: - pModSpecs = &ModSpecs::mptm; + return ModSpecs::mptm; break; case MOD_TYPE_IT: - pModSpecs = &ModSpecs::itEx; + return ModSpecs::itEx; break; case MOD_TYPE_XM: - pModSpecs = &ModSpecs::xmEx; + return ModSpecs::xmEx; break; case MOD_TYPE_S3M: - pModSpecs = &ModSpecs::s3mEx; + return ModSpecs::s3mEx; break; case MOD_TYPE_MOD: default: - pModSpecs = &ModSpecs::mod; + return ModSpecs::mod; break; } } @@ -1692,7 +1692,7 @@ { m_nType = type; m_playBehaviour = GetDefaultPlaybackBehaviour(GetBestSaveFormat()); - SetModSpecsPointer(m_pModSpecs, GetBestSaveFormat()); + m_pModSpecs = &GetModSpecifications(GetBestSaveFormat()); } @@ -1702,7 +1702,7 @@ { const MODTYPE oldType = GetType(); m_nType = newType; - SetModSpecsPointer(m_pModSpecs, m_nType); + m_pModSpecs = &GetModSpecifications(m_nType); if(oldType == newType || !adjust) return; @@ -1901,14 +1901,6 @@ } -const CModSpecifications& CSoundFile::GetModSpecifications(const MODTYPE type) -{ - const CModSpecifications* p = nullptr; - SetModSpecsPointer(p, type); - return *p; -} - - ChannelFlags CSoundFile::GetChannelMuteFlag() { #ifdef MODPLUG_TRACKER Modified: trunk/OpenMPT/soundlib/Sndfile.h ============================================================================== --- trunk/OpenMPT/soundlib/Sndfile.h Sun Aug 11 09:38:54 2024 (r21379) +++ trunk/OpenMPT/soundlib/Sndfile.h Sun Aug 11 19:51:21 2024 (r21380) @@ -443,9 +443,6 @@ private: CTuningCollection* m_pTuningsTuneSpecific = nullptr; -private: //Misc private methods. - static void SetModSpecsPointer(const CModSpecifications* &pModSpecs, const MODTYPE type); - private: //Misc data const CModSpecifications *m_pModSpecs; |