From d29c01be26dc1b86e637b2888a51b9fb6ba29e1a Mon Sep 17 00:00:00 2001 From: epochwon Date: Fri, 2 May 2025 21:41:37 -0400 Subject: [PATCH] appease clang + docs --- apps/openmw/mwsound/openaloutput.cpp | 16 ++++++++-------- apps/openmw/mwsound/openaloutput.hpp | 12 ++++++------ apps/openmw/mwsound/sound.hpp | 2 +- apps/openmw/mwsound/soundoutput.hpp | 4 ++-- apps/openmw/mwworld/worldimp.cpp | 2 +- docs/source/reference/modding/settings/sound.rst | 10 ++++++++++ 6 files changed, 28 insertions(+), 18 deletions(-) diff --git a/apps/openmw/mwsound/openaloutput.cpp b/apps/openmw/mwsound/openaloutput.cpp index a8bc166c94..a586fc611a 100644 --- a/apps/openmw/mwsound/openaloutput.cpp +++ b/apps/openmw/mwsound/openaloutput.cpp @@ -1185,8 +1185,8 @@ namespace MWSound alSourcefv(source, AL_VELOCITY, vel.ptr()); } - void OpenALOutput::updateCommon( - ALuint source, const osg::Vec3f& pos, const osg::Vec3f& vel, ALfloat maxdist, ALfloat gain, ALfloat pitch, bool useenv) + void OpenALOutput::updateCommon(ALuint source, const osg::Vec3f& pos, const osg::Vec3f& vel, ALfloat maxdist, + ALfloat gain, ALfloat pitch, bool useenv) { if (useenv && mListenerEnv == Env_Underwater && !mWaterFilter) { @@ -1315,8 +1315,8 @@ namespace MWSound return; ALuint source = GET_PTRID(sound->mHandle); - updateCommon(source, sound->getPosition(), sound->getVelocity(), sound->getMaxDistance(), sound->getRealVolume(), - getTimeScaledPitch(sound), sound->getUseEnv()); + updateCommon(source, sound->getPosition(), sound->getVelocity(), sound->getMaxDistance(), + sound->getRealVolume(), getTimeScaledPitch(sound), sound->getUseEnv()); getALError(); } @@ -1363,8 +1363,8 @@ namespace MWSound if (sound->getIsLooping()) Log(Debug::Warning) << "Warning: cannot loop stream \"" << decoder->getName() << "\""; - initCommon3D(source, sound->getPosition(), sound->getVelocity(), sound->getMinDistance(), sound->getMaxDistance(), - sound->getRealVolume(), getTimeScaledPitch(sound), false, sound->getUseEnv()); + initCommon3D(source, sound->getPosition(), sound->getVelocity(), sound->getMinDistance(), + sound->getMaxDistance(), sound->getRealVolume(), getTimeScaledPitch(sound), false, sound->getUseEnv()); if (getALError() != AL_NO_ERROR) return false; @@ -1446,8 +1446,8 @@ namespace MWSound OpenAL_SoundStream* stream = reinterpret_cast(sound->mHandle); ALuint source = stream->mSource; - updateCommon(source, sound->getPosition(), sound->getVelocity(), sound->getMaxDistance(), sound->getRealVolume(), - getTimeScaledPitch(sound), sound->getUseEnv()); + updateCommon(source, sound->getPosition(), sound->getVelocity(), sound->getMaxDistance(), + sound->getRealVolume(), getTimeScaledPitch(sound), sound->getUseEnv()); getALError(); } diff --git a/apps/openmw/mwsound/openaloutput.hpp b/apps/openmw/mwsound/openaloutput.hpp index e7089388c3..d689d08546 100644 --- a/apps/openmw/mwsound/openaloutput.hpp +++ b/apps/openmw/mwsound/openaloutput.hpp @@ -65,11 +65,11 @@ namespace MWSound std::unique_ptr mDefaultDeviceThread; void initCommon2D(ALuint source, const osg::Vec3f& pos, ALfloat gain, ALfloat pitch, bool loop, bool useenv); - void initCommon3D(ALuint source, const osg::Vec3f& pos, const osg::Vec3f& vel, ALfloat mindist, ALfloat maxdist, ALfloat gain, - ALfloat pitch, bool loop, bool useenv); + void initCommon3D(ALuint source, const osg::Vec3f& pos, const osg::Vec3f& vel, ALfloat mindist, ALfloat maxdist, + ALfloat gain, ALfloat pitch, bool loop, bool useenv); - void updateCommon( - ALuint source, const osg::Vec3f& pos, const osg::Vec3f& vel, ALfloat maxdist, ALfloat gain, ALfloat pitch, bool useenv); + void updateCommon(ALuint source, const osg::Vec3f& pos, const osg::Vec3f& vel, ALfloat maxdist, ALfloat gain, + ALfloat pitch, bool useenv); float getTimeScaledPitch(SoundBase* sound); @@ -109,8 +109,8 @@ namespace MWSound void startUpdate() override; void finishUpdate() override; - void updateListener( - const osg::Vec3f& pos, const osg::Vec3f& atdir, const osg::Vec3f& updir, const osg::Vec3f& vel, Environment env) override; + void updateListener(const osg::Vec3f& pos, const osg::Vec3f& atdir, const osg::Vec3f& updir, + const osg::Vec3f& vel, Environment env) override; void pauseSounds(int types) override; void resumeSounds(int types) override; diff --git a/apps/openmw/mwsound/sound.hpp b/apps/openmw/mwsound/sound.hpp index 0ac30d0ccd..7d020c31f9 100644 --- a/apps/openmw/mwsound/sound.hpp +++ b/apps/openmw/mwsound/sound.hpp @@ -155,7 +155,7 @@ namespace MWSound const osg::Vec3f& getPosition() const { return mParams.mPos; } const osg::Vec3f& getLastPosition() const { return mParams.mLastPos; } - const osg::Vec3f& getVelocity() const {return mParams.mVel; } + const osg::Vec3f& getVelocity() const { return mParams.mVel; } float getRealVolume() const { return mParams.mVolume * mParams.mBaseVolume * mParams.mFadeVolume; } float getPitch() const { return mParams.mPitch; } float getMinDistance() const { return mParams.mMinDistance; } diff --git a/apps/openmw/mwsound/soundoutput.hpp b/apps/openmw/mwsound/soundoutput.hpp index d0024e9a7c..4b24f159d3 100644 --- a/apps/openmw/mwsound/soundoutput.hpp +++ b/apps/openmw/mwsound/soundoutput.hpp @@ -61,8 +61,8 @@ namespace MWSound virtual void startUpdate() = 0; virtual void finishUpdate() = 0; - virtual void updateListener( - const osg::Vec3f& pos, const osg::Vec3f& atdir, const osg::Vec3f& updir, const osg::Vec3f& vel, Environment env) + virtual void updateListener(const osg::Vec3f& pos, const osg::Vec3f& atdir, const osg::Vec3f& updir, + const osg::Vec3f& vel, Environment env) = 0; virtual void pauseSounds(int types) = 0; diff --git a/apps/openmw/mwworld/worldimp.cpp b/apps/openmw/mwworld/worldimp.cpp index cf9a0d7b07..eaa8799e84 100644 --- a/apps/openmw/mwworld/worldimp.cpp +++ b/apps/openmw/mwworld/worldimp.cpp @@ -1467,7 +1467,7 @@ namespace MWWorld void World::queueMovement(const Ptr& ptr, const osg::Vec3f& velocity) { mPhysics->queueObjectMovement(ptr, velocity); - if(ptr == MWMechanics::getPlayer()) + if (ptr == MWMechanics::getPlayer()) MWBase::Environment::get().getSoundManager()->setListenerVel(velocity); } diff --git a/docs/source/reference/modding/settings/sound.rst b/docs/source/reference/modding/settings/sound.rst index e38cd9de78..b462428ad1 100644 --- a/docs/source/reference/modding/settings/sound.rst +++ b/docs/source/reference/modding/settings/sound.rst @@ -121,3 +121,13 @@ Sound Settings When true, uses the camera position and direction for audio instead of the player position. This makes audio in third person sound relative to camera instead of the player. False is vanilla Morrowind behaviour. + +.. omw-setting:: + :title: doppler factor + :type: float32 + :range: 0.0 (disabled), 1.0 (maximum strength) + :default: 0.25 + :location: :bdg-success:`Launcher > Settings > Audio` + + This setting controls the strength of the doppler effect. Doppler effect increases or decreases the pitch of sounds + relative to the velocity of the source and the listener. \ No newline at end of file