mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-19 21:23:52 +00:00
Don't analyze the loudness for sounds that don't need it
This commit is contained in:
parent
965aaebbdb
commit
dc1b010cf0
4 changed files with 9 additions and 8 deletions
|
@ -225,7 +225,7 @@ private:
|
||||||
friend class OpenAL_Output;
|
friend class OpenAL_Output;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
OpenAL_SoundStream(ALuint src, DecoderPtr decoder);
|
OpenAL_SoundStream(ALuint src, DecoderPtr decoder, bool getLoudnessData=false);
|
||||||
~OpenAL_SoundStream();
|
~OpenAL_SoundStream();
|
||||||
|
|
||||||
bool isPlaying();
|
bool isPlaying();
|
||||||
|
@ -313,7 +313,7 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
OpenAL_SoundStream::OpenAL_SoundStream(ALuint src, DecoderPtr decoder)
|
OpenAL_SoundStream::OpenAL_SoundStream(ALuint src, DecoderPtr decoder, bool getLoudnessData)
|
||||||
: mSource(src), mCurrentBufIdx(0), mFrameSize(0), mSilence(0), mDecoder(decoder), mIsFinished(false)
|
: mSource(src), mCurrentBufIdx(0), mFrameSize(0), mSilence(0), mDecoder(decoder), mIsFinished(false)
|
||||||
{
|
{
|
||||||
alGenBuffers(sNumBuffers, mBuffers);
|
alGenBuffers(sNumBuffers, mBuffers);
|
||||||
|
@ -339,6 +339,7 @@ OpenAL_SoundStream::OpenAL_SoundStream(ALuint src, DecoderPtr decoder)
|
||||||
mBufferSize = static_cast<ALuint>(sBufferLength*srate);
|
mBufferSize = static_cast<ALuint>(sBufferLength*srate);
|
||||||
mBufferSize *= mFrameSize;
|
mBufferSize *= mFrameSize;
|
||||||
|
|
||||||
|
if (getLoudnessData)
|
||||||
mLoudnessAnalyzer.reset(new Sound_Loudness(sLoudnessFPS, mSampleRate, chans, type));
|
mLoudnessAnalyzer.reset(new Sound_Loudness(sLoudnessFPS, mSampleRate, chans, type));
|
||||||
}
|
}
|
||||||
catch(std::exception&)
|
catch(std::exception&)
|
||||||
|
@ -962,7 +963,7 @@ void OpenAL_Output::streamSound(DecoderPtr decoder, MWBase::SoundStreamPtr sound
|
||||||
sound->mHandle = stream;
|
sound->mHandle = stream;
|
||||||
}
|
}
|
||||||
|
|
||||||
void OpenAL_Output::streamSound3D(DecoderPtr decoder, MWBase::SoundStreamPtr sound)
|
void OpenAL_Output::streamSound3D(DecoderPtr decoder, MWBase::SoundStreamPtr sound, bool getLoudnessData)
|
||||||
{
|
{
|
||||||
OpenAL_SoundStream *stream = 0;
|
OpenAL_SoundStream *stream = 0;
|
||||||
ALuint source;
|
ALuint source;
|
||||||
|
@ -979,7 +980,7 @@ void OpenAL_Output::streamSound3D(DecoderPtr decoder, MWBase::SoundStreamPtr sou
|
||||||
sound->getRealVolume(), sound->getPitch(), false, sound->getUseEnv());
|
sound->getRealVolume(), sound->getPitch(), false, sound->getUseEnv());
|
||||||
throwALerror();
|
throwALerror();
|
||||||
|
|
||||||
stream = new OpenAL_SoundStream(source, decoder);
|
stream = new OpenAL_SoundStream(source, decoder, getLoudnessData);
|
||||||
mStreamThread->add(stream);
|
mStreamThread->add(stream);
|
||||||
mActiveStreams.push_back(sound);
|
mActiveStreams.push_back(sound);
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,7 +63,7 @@ namespace MWSound
|
||||||
virtual void updateSound(MWBase::SoundPtr sound);
|
virtual void updateSound(MWBase::SoundPtr sound);
|
||||||
|
|
||||||
virtual void streamSound(DecoderPtr decoder, MWBase::SoundStreamPtr sound);
|
virtual void streamSound(DecoderPtr decoder, MWBase::SoundStreamPtr sound);
|
||||||
virtual void streamSound3D(DecoderPtr decoder, MWBase::SoundStreamPtr sound);
|
virtual void streamSound3D(DecoderPtr decoder, MWBase::SoundStreamPtr sound, bool getLoudnessData);
|
||||||
virtual void finishStream(MWBase::SoundStreamPtr sound);
|
virtual void finishStream(MWBase::SoundStreamPtr sound);
|
||||||
virtual double getStreamDelay(MWBase::SoundStreamPtr sound);
|
virtual double getStreamDelay(MWBase::SoundStreamPtr sound);
|
||||||
virtual double getStreamOffset(MWBase::SoundStreamPtr sound);
|
virtual double getStreamOffset(MWBase::SoundStreamPtr sound);
|
||||||
|
|
|
@ -41,7 +41,7 @@ namespace MWSound
|
||||||
virtual void updateSound(MWBase::SoundPtr sound) = 0;
|
virtual void updateSound(MWBase::SoundPtr sound) = 0;
|
||||||
|
|
||||||
virtual void streamSound(DecoderPtr decoder, MWBase::SoundStreamPtr sound) = 0;
|
virtual void streamSound(DecoderPtr decoder, MWBase::SoundStreamPtr sound) = 0;
|
||||||
virtual void streamSound3D(DecoderPtr decoder, MWBase::SoundStreamPtr sound) = 0;
|
virtual void streamSound3D(DecoderPtr decoder, MWBase::SoundStreamPtr sound, bool getLoudnessData) = 0;
|
||||||
virtual void finishStream(MWBase::SoundStreamPtr sound) = 0;
|
virtual void finishStream(MWBase::SoundStreamPtr sound) = 0;
|
||||||
virtual double getStreamDelay(MWBase::SoundStreamPtr sound) = 0;
|
virtual double getStreamDelay(MWBase::SoundStreamPtr sound) = 0;
|
||||||
virtual double getStreamOffset(MWBase::SoundStreamPtr sound) = 0;
|
virtual double getStreamOffset(MWBase::SoundStreamPtr sound) = 0;
|
||||||
|
|
|
@ -258,7 +258,7 @@ namespace MWSound
|
||||||
{
|
{
|
||||||
sound.reset(new Stream(pos, 1.0f, basevol, 1.0f, minDistance, maxDistance,
|
sound.reset(new Stream(pos, 1.0f, basevol, 1.0f, minDistance, maxDistance,
|
||||||
Play_Normal|Play_TypeVoice|Play_3D));
|
Play_Normal|Play_TypeVoice|Play_3D));
|
||||||
mOutput->streamSound3D(decoder, sound);
|
mOutput->streamSound3D(decoder, sound, true);
|
||||||
}
|
}
|
||||||
return sound;
|
return sound;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue