1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-16 10:49:57 +00:00
openmw-tes3mp/apps/openmw/mwsound/sound.cpp
dteviot e197f5318b fixing MSVC 2013 warning C4244: & C4305
conversion from 'const float' to 'int', possible loss of data
conversion from 'double' to 'int', possible loss of data
conversion from 'float' to 'int', possible loss of data
2015-03-08 13:07:29 +13:00

23 lines
531 B
C++

#include "sound.hpp"
namespace MWSound
{
float Sound::getCurrentLoudness()
{
if (mLoudnessVector.empty())
return 0.f;
int index = static_cast<int>(getTimeOffset() * mLoudnessFPS);
index = std::max(0, std::min(index, int(mLoudnessVector.size()-1)));
return mLoudnessVector[index];
}
void Sound::setLoudnessVector(const std::vector<float> &loudnessVector, float loudnessFPS)
{
mLoudnessVector = loudnessVector;
mLoudnessFPS = loudnessFPS;
}
}