mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-18 14:08:19 +00:00
Add CSample::TotalTime
function
This commit is contained in:
parent
0f1171a501
commit
7a84a746e0
|
@ -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)
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue