From 35f1a85fe1c7f18256f305f68c8b1e46f7b8696d Mon Sep 17 00:00:00 2001 From: McCabe Maxsted Date: Sat, 7 Mar 2009 10:39:53 -0700 Subject: Applied patch by Zwagoth Klaar for muting sounds before decoding --- linden/indra/llaudio/audioengine.cpp | 3 ++- linden/indra/newview/llviewermessage.cpp | 9 ++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) (limited to 'linden') diff --git a/linden/indra/llaudio/audioengine.cpp b/linden/indra/llaudio/audioengine.cpp index 7bb65e9..75901e8 100644 --- a/linden/indra/llaudio/audioengine.cpp +++ b/linden/indra/llaudio/audioengine.cpp @@ -879,7 +879,8 @@ void LLAudioEngine::triggerSound(const LLUUID &audio_uuid, const LLUUID& owner_i // Create a new source (since this can't be associated with an existing source. //LL_INFOS("AudioEngine") << "Localized: " << audio_uuid << llendl; - if (mMuted) + //If we cannot hear it, dont even try to load the sound. + if (mMuted || gain == 0.0) { return; } diff --git a/linden/indra/newview/llviewermessage.cpp b/linden/indra/newview/llviewermessage.cpp index b947f95..221de59 100644 --- a/linden/indra/newview/llviewermessage.cpp +++ b/linden/indra/newview/llviewermessage.cpp @@ -3286,6 +3286,10 @@ void process_sound_trigger(LLMessageSystem *msg, void **) msg->getVector3Fast(_PREHASH_SoundData, _PREHASH_Position, pos_local); msg->getF32Fast(_PREHASH_SoundData, _PREHASH_Gain, gain); + //If we have sounds muted, don't even try to load or trigger the sound. + if(gSavedSettings.getBOOL("MuteSounds") || gain == 0.0) + return; + // adjust sound location to true global coords LLVector3d pos_global = from_region_handle(region_handle); pos_global.mdV[VX] += pos_local.mV[VX]; @@ -3317,7 +3321,7 @@ void process_sound_trigger(LLMessageSystem *msg, void **) void process_preload_sound(LLMessageSystem *msg, void **user_data) { - if (!gAudiop) + if (!gAudiop || gSavedSettings.getBOOL("MuteSounds")) { return; } @@ -3363,6 +3367,9 @@ void process_attached_sound(LLMessageSystem *msg, void **user_data) msg->getF32Fast(_PREHASH_DataBlock, _PREHASH_Gain, gain); msg->getU8Fast(_PREHASH_DataBlock, _PREHASH_Flags, flags); + if(gSavedSettings.getBOOL("MuteSounds") || gain == 0.0) + return; + LLViewerObject *objectp = gObjectList.findObject(object_id); if (!objectp) { -- cgit v1.1