Keep track of the sound pitch

actorid
Chris Robinson 13 years ago
parent cbf6c0404a
commit 4944a29b21

@ -261,7 +261,7 @@ bool OpenAL_SoundStream::isPlaying()
void OpenAL_SoundStream::update()
{
ALfloat gain = mVolume*mBaseVolume;
ALfloat pitch = 1.0f;
ALfloat pitch = mPitch;
if(!(mFlags&Play_NoEnv) && mOutput.mLastEnvironment == Env_Underwater)
{
gain *= 0.9f;
@ -398,7 +398,7 @@ bool OpenAL_Sound::isPlaying()
void OpenAL_Sound::update()
{
ALfloat gain = mVolume*mBaseVolume;
ALfloat pitch = 1.0f;
ALfloat pitch = mPitch;
if(!(mFlags&Play_NoEnv) && mOutput.mLastEnvironment == Env_Underwater)
{
gain *= 0.9f;
@ -416,7 +416,7 @@ void OpenAL_Sound::update()
void OpenAL_Sound3D::update()
{
ALfloat gain = mVolume*mBaseVolume;
ALfloat pitch = 1.0f;
ALfloat pitch = mPitch;
if(mPos.squaredDistance(mOutput.mPos) > mMaxDistance*mMaxDistance)
gain = 0.0f;
else if(!(mFlags&Play_NoEnv) && mOutput.mLastEnvironment == Env_Underwater)

@ -16,6 +16,7 @@ namespace MWSound
Ogre::Vector3 mPos;
float mVolume; /* NOTE: Real volume = mVolume*mBaseVolume */
float mBaseVolume;
float mPitch;
float mMinDistance;
float mMaxDistance;
int mFlags;
@ -29,6 +30,7 @@ namespace MWSound
Sound() : mPos(0.0f, 0.0f, 0.0f)
, mVolume(1.0f)
, mBaseVolume(1.0f)
, mPitch(1.0f)
, mMinDistance(20.0f) /* 1 * min_range_scale */
, mMaxDistance(12750.0f) /* 255 * max_range_scale */
, mFlags(Play_Normal)

@ -216,6 +216,7 @@ namespace MWSound
sound = mOutput->playSound(file, volume*basevol, pitch, mode);
sound->mVolume = volume;
sound->mBaseVolume = basevol;
sound->mPitch = pitch;
sound->mMinDistance = min;
sound->mMaxDistance = max;
sound->mFlags = mode;
@ -246,6 +247,7 @@ namespace MWSound
sound->mPos = objpos;
sound->mVolume = volume;
sound->mBaseVolume = basevol;
sound->mPitch = pitch;
sound->mMinDistance = min;
sound->mMaxDistance = max;
sound->mFlags = mode;

Loading…
Cancel
Save