mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-11 09:36:37 +00:00
e197f5318b
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
24 lines
531 B
C++
24 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;
|
|
}
|
|
|
|
}
|