From: <sv...@op...> - 2024-10-21 19:54:05
|
Author: sagamusix Date: Mon Oct 21 21:53:53 2024 New Revision: 21910 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=21910 Log: [Ref] More GetNumSamples(), less m_nSamples. Modified: trunk/OpenMPT/mptrack/CleanupSong.cpp trunk/OpenMPT/mptrack/Ctrl_ins.cpp trunk/OpenMPT/mptrack/Ctrl_pat.cpp trunk/OpenMPT/mptrack/SampleGenerator.cpp trunk/OpenMPT/mptrack/mod2midi.cpp Modified: trunk/OpenMPT/mptrack/CleanupSong.cpp ============================================================================== --- trunk/OpenMPT/mptrack/CleanupSong.cpp Mon Oct 21 20:16:04 2024 (r21909) +++ trunk/OpenMPT/mptrack/CleanupSong.cpp Mon Oct 21 21:53:53 2024 (r21910) @@ -784,7 +784,7 @@ return false; } - for(SAMPLEINDEX smp = 1; smp <= sndFile.m_nSamples; smp++) + for(SAMPLEINDEX smp = 1; smp <= sndFile.GetNumSamples(); smp++) { ModSample &sample = sndFile.GetSample(smp); Modified: trunk/OpenMPT/mptrack/Ctrl_ins.cpp ============================================================================== --- trunk/OpenMPT/mptrack/Ctrl_ins.cpp Mon Oct 21 20:16:04 2024 (r21909) +++ trunk/OpenMPT/mptrack/Ctrl_ins.cpp Mon Oct 21 21:53:53 2024 (r21910) @@ -676,11 +676,11 @@ if (c != ' ') { n = (10 * pIns->Keyboard[m_nNote] + (c - '0')) % 10000; - if ((n >= MAX_SAMPLES) || ((sndFile.m_nSamples < 1000) && (n >= 1000))) + if ((n >= MAX_SAMPLES) || ((sndFile.GetNumSamples() < 1000) && (n >= 1000))) n = (n % 1000); - if ((n >= MAX_SAMPLES) || ((sndFile.m_nSamples < 100) && (n >= 100))) + if ((n >= MAX_SAMPLES) || ((sndFile.GetNumSamples() < 100) && (n >= 100))) n = (n % 100); - else if ((n > 31) && (sndFile.m_nSamples < 32) && (n % 10)) + else if ((n > 31) && (sndFile.GetNumSamples() < 32) && (n % 10)) n = (n % 10); } Modified: trunk/OpenMPT/mptrack/Ctrl_pat.cpp ============================================================================== --- trunk/OpenMPT/mptrack/Ctrl_pat.cpp Mon Oct 21 20:16:04 2024 (r21909) +++ trunk/OpenMPT/mptrack/Ctrl_pat.cpp Mon Oct 21 21:53:53 2024 (r21910) @@ -706,7 +706,7 @@ if(n >= 0) { n = static_cast<int>(m_CbnInstrument.GetItemData(n)); - int nmax = (m_sndFile.m_nInstruments) ? m_sndFile.m_nInstruments : m_sndFile.m_nSamples; + int nmax = m_sndFile.GetNumInstruments() ? m_sndFile.GetNumInstruments() : m_sndFile.GetNumSamples(); if((n >= 0) && (n <= nmax) && (n != (int)m_nInstrument)) { m_nInstrument = static_cast<INSTRUMENTINDEX>(n); Modified: trunk/OpenMPT/mptrack/SampleGenerator.cpp ============================================================================== --- trunk/OpenMPT/mptrack/SampleGenerator.cpp Mon Oct 21 20:16:04 2024 (r21909) +++ trunk/OpenMPT/mptrack/SampleGenerator.cpp Mon Oct 21 21:53:53 2024 (r21910) @@ -110,7 +110,7 @@ // Actual render loop. bool CSampleGenerator::RenderSample(CSoundFile *pSndFile, SAMPLEINDEX nSample) { - if(!CanRenderSample() || !TestExpression() || (pSndFile == nullptr) || (nSample < 1) || (nSample > pSndFile->m_nSamples)) return false; + if(!CanRenderSample() || !TestExpression() || (pSndFile == nullptr) || (nSample < 1) || (nSample > pSndFile->GetNumSamples())) return false; // allocate a new buffer sample_buffer = (mu::value_type *)malloc(sample_length * sizeof(mu::value_type)); Modified: trunk/OpenMPT/mptrack/mod2midi.cpp ============================================================================== --- trunk/OpenMPT/mptrack/mod2midi.cpp Mon Oct 21 20:16:04 2024 (r21909) +++ trunk/OpenMPT/mptrack/mod2midi.cpp Mon Oct 21 21:53:53 2024 (r21910) @@ -454,7 +454,7 @@ } if(!m_wasInstrumentMode) { - m_sndFile.m_nInstruments = std::min<INSTRUMENTINDEX>(m_sndFile.m_nSamples, MAX_INSTRUMENTS - 1u); + m_sndFile.m_nInstruments = std::min<INSTRUMENTINDEX>(m_sndFile.GetNumSamples(), MAX_INSTRUMENTS - 1u); } m_tracks.reserve(m_sndFile.GetNumInstruments() + 1); |