summaryrefslogtreecommitdiff
path: root/indra/newview/llpreviewsound.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llpreviewsound.cpp')
-rw-r--r--indra/newview/llpreviewsound.cpp80
1 files changed, 34 insertions, 46 deletions
diff --git a/indra/newview/llpreviewsound.cpp b/indra/newview/llpreviewsound.cpp
index 3c23bf15ae..6b53b45990 100644
--- a/indra/newview/llpreviewsound.cpp
+++ b/indra/newview/llpreviewsound.cpp
@@ -2,40 +2,34 @@
* @file llpreviewsound.cpp
* @brief LLPreviewSound class implementation
*
- * $LicenseInfo:firstyear=2002&license=viewergpl$
- *
- * Copyright (c) 2002-2007, Linden Research, Inc.
- *
+ * $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
- * The source code in this file ("Source Code") is provided by Linden Lab
- * to you under the terms of the GNU General Public License, version 2.0
- * ("GPL"), unless you have obtained a separate licensing agreement
- * ("Other License"), formally executed by you and Linden Lab. Terms of
- * the GPL can be found in doc/GPL-license.txt in this distribution, or
- * online at http://secondlife.com/developers/opensource/gplv2
+ * Copyright (C) 2010, Linden Research, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
*
- * There are special exceptions to the terms and conditions of the GPL as
- * it is applied to this Source Code. View the full text of the exception
- * in the file doc/FLOSS-exception.txt in this software distribution, or
- * online at http://secondlife.com/developers/opensource/flossexception
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * By copying, modifying or distributing this software, you acknowledge
- * that you have read and understood your obligations described above,
- * and agree to abide by those obligations.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
- * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
- * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
- * COMPLETENESS OR PERFORMANCE.
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#include "llviewerprecompiledheaders.h"
-#include "audioengine.h"
+#include "llaudioengine.h"
#include "llagent.h" // gAgent
#include "llbutton.h"
#include "llinventory.h"
-#include "llinventoryview.h"
#include "lllineeditor.h"
#include "llpreviewsound.h"
#include "llresmgr.h"
@@ -48,12 +42,23 @@ extern LLAgent gAgent;
const F32 SOUND_GAIN = 1.0f;
-LLPreviewSound::LLPreviewSound(const std::string& name, const LLRect& rect, const std::string& title, const LLUUID& item_uuid, const LLUUID& object_uuid) :
- LLPreview( name, rect, title, item_uuid, object_uuid)
+LLPreviewSound::LLPreviewSound(const LLSD& key)
+ : LLPreview( key )
{
-
- LLUICtrlFactory::getInstance()->buildFloater(this,"floater_preview_sound.xml");
+ //Called from floater reg: LLUICtrlFactory::getInstance()->buildFloater(this,"floater_preview_sound.xml", FALSE);
+}
+// virtual
+BOOL LLPreviewSound::postBuild()
+{
+ const LLInventoryItem* item = getItem();
+ if (item)
+ {
+ getChild<LLUICtrl>("desc")->setValue(item->getDescription());
+ if (gAudiop)
+ gAudiop->preloadSound(item->getAssetUUID()); // preload the sound
+ }
+
childSetAction("Sound play btn",&LLPreviewSound::playSound,this);
childSetAction("Sound audition btn",&LLPreviewSound::auditionSound,this);
@@ -63,26 +68,10 @@ LLPreviewSound::LLPreviewSound(const std::string& name, const LLRect& rect, cons
button = getChild<LLButton>("Sound audition btn");
button->setSoundFlags(LLView::SILENT);
- const LLInventoryItem* item = getItem();
-
childSetCommitCallback("desc", LLPreview::onText, this);
- childSetText("desc", item->getDescription());
- childSetPrevalidate("desc", &LLLineEditor::prevalidatePrintableNotPipe);
-
- // preload the sound
- if(item && gAudiop)
- {
- gAudiop->preloadSound(item->getAssetUUID());
- }
-
- setTitle(title);
-
- if (!getHost())
- {
- LLRect curRect = getRect();
- translate(rect.mLeft - curRect.mLeft, rect.mTop - curRect.mTop);
- }
+ getChild<LLLineEditor>("desc")->setPrevalidate(&LLTextValidate::validateASCIIPrintableNoPipe);
+ return LLPreview::postBuild();
}
// static
@@ -106,7 +95,6 @@ void LLPreviewSound::auditionSound( void *userdata )
if(item && gAudiop)
{
LLVector3d lpos_global = gAgent.getPositionGlobal();
- F32 volume = gSavedSettings.getBOOL("MuteSounds") ? 0.f : SOUND_GAIN * gSavedSettings.getF32("AudioLevelSFX");
- gAudiop->triggerSound(item->getAssetUUID(), gAgent.getID(), volume, lpos_global);
+ gAudiop->triggerSound(item->getAssetUUID(), gAgent.getID(), SOUND_GAIN, LLAudioEngine::AUDIO_TYPE_UI, lpos_global);
}
}