Add SoundData:getDuration, returns the duration in seconds

This commit is contained in:
Bart van Strien
2013-01-29 23:19:26 +01:00
parent 7a16e4cb49
commit 8fba362fc5
4 changed files with 16 additions and 0 deletions
+5
View File
@@ -147,6 +147,11 @@ int SoundData::getSampleRate() const
return sampleRate;
}
int SoundData::getDuration() const
{
return size/(channels*sampleRate*bits/8);
}
void SoundData::setSample(int i, float sample)
{
// Check range.