Add CSample::TotalTime function

This commit is contained in:
Robert Müller 2023-12-29 00:00:33 +01:00
parent 0f1171a501
commit 7a84a746e0
2 changed files with 6 additions and 1 deletions

View file

@ -623,7 +623,7 @@ float CSound::GetSampleTotalTime(int SampleID)
if(SampleID == -1 || SampleID >= NUM_SAMPLES) if(SampleID == -1 || SampleID >= NUM_SAMPLES)
return 0.0f; return 0.0f;
return (m_aSamples[SampleID].m_NumFrames / (float)m_aSamples[SampleID].m_Rate); return m_aSamples[SampleID].TotalTime();
} }
float CSound::GetSampleCurrentTime(int SampleID) float CSound::GetSampleCurrentTime(int SampleID)

View file

@ -20,6 +20,11 @@ struct CSample
int m_LoopStart; int m_LoopStart;
int m_LoopEnd; int m_LoopEnd;
int m_PausedAt; int m_PausedAt;
float TotalTime() const
{
return m_NumFrames / (float)m_Rate;
}
}; };
struct CChannel struct CChannel