- added a new check to faction validator to report on sound files with a bitrate > 200K

This commit is contained in:
Mark Vejvoda
2011-04-09 03:14:05 +00:00
parent 5d96e8f3ab
commit c71480739b
5 changed files with 38 additions and 0 deletions

View File

@@ -26,6 +26,7 @@ SoundInfo::SoundInfo(){
samplesPerSecond= 0;
bitsPerSample= 0;
size= 0;
bitRate=0;
}
// =====================================================

View File

@@ -91,6 +91,8 @@ void WavSoundFileLoader::open(const string &path, SoundInfo *soundInfo){
f.read((char*) &size16, 2);
soundInfo->setBitsPerSample(size16);
soundInfo->setBitRate(soundInfo->getSamplesPerSecond() * soundInfo->getChannels() * soundInfo->getBitsPerSample() / 8);
if (soundInfo->getBitsPerSample() != 8 && soundInfo->getBitsPerSample()!=16){
throw runtime_error("Bits per sample must be 8 or 16: " + path);
}
@@ -167,6 +169,7 @@ void OggSoundFileLoader::open(const string &path, SoundInfo *soundInfo){
soundInfo->setsamplesPerSecond(vi->rate);
soundInfo->setBitsPerSample(16);
soundInfo->setSize(samples * 2 * vi->channels);
soundInfo->setBitRate(vi->bitrate_nominal);
}
uint32 OggSoundFileLoader::read(int8 *samples, uint32 size){