diff --git a/src/engine/client/sound.cpp b/src/engine/client/sound.cpp index 865407730..aae7e5897 100644 --- a/src/engine/client/sound.cpp +++ b/src/engine/client/sound.cpp @@ -623,7 +623,7 @@ float CSound::GetSampleTotalTime(int SampleID) if(SampleID == -1 || SampleID >= NUM_SAMPLES) 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) diff --git a/src/engine/client/sound.h b/src/engine/client/sound.h index ea5eb5766..d033130c7 100644 --- a/src/engine/client/sound.h +++ b/src/engine/client/sound.h @@ -20,6 +20,11 @@ struct CSample int m_LoopStart; int m_LoopEnd; int m_PausedAt; + + float TotalTime() const + { + return m_NumFrames / (float)m_Rate; + } }; struct CChannel