summaryrefslogtreecommitdiff
path: root/indra/llui
diff options
context:
space:
mode:
authorGilbert Gonzales <gilbert@lindenlab.com>2013-01-25 17:47:36 -0800
committerGilbert Gonzales <gilbert@lindenlab.com>2013-01-25 17:47:36 -0800
commitc418d616276ce16d910c6e5528f6aa058803e1c7 (patch)
treeaf7c6d992eb34c37d58ffb55561e5a62893617c3 /indra/llui
parentdaa9db305a5ae2c0c5b0c2425d6482de6dee7b2c (diff)
CHUI-667 Upon exit from DND mode, a maximum of one sound should be played. Solution. Added a deferred sound class which will have sound id's added to it and upon unmuting the deferred sounds will be played.
Diffstat (limited to 'indra/llui')
-rw-r--r--indra/llui/llui.cpp31
-rw-r--r--indra/llui/llui.h3
2 files changed, 30 insertions, 4 deletions
diff --git a/indra/llui/llui.cpp b/indra/llui/llui.cpp
index ee09625890..2a774d54a3 100644
--- a/indra/llui/llui.cpp
+++ b/indra/llui/llui.cpp
@@ -77,6 +77,7 @@ std::list<std::string> gUntranslated;
/*static*/ LLUI::settings_map_t LLUI::sSettingGroups;
/*static*/ LLImageProviderInterface* LLUI::sImageProvider = NULL;
/*static*/ LLUIAudioCallback LLUI::sAudioCallback = NULL;
+/*static*/ LLUIAudioCallback LLUI::sDeferredAudioCallback = NULL;
/*static*/ LLVector2 LLUI::sGLScaleFactor(1.f, 1.f);
/*static*/ LLWindow* LLUI::sWindow = NULL;
/*static*/ LLView* LLUI::sRootView = NULL;
@@ -101,16 +102,18 @@ static LLDefaultChildRegistry::Register<LLToolBar> register_toolbar("toolbar");
//
// Functions
//
-void make_ui_sound(const char* namep)
+
+LLUUID find_ui_sound(const char * namep)
{
std::string name = ll_safe_string(namep);
+ LLUUID uuid = LLUUID(NULL);
if (!LLUI::sSettingGroups["config"]->controlExists(name))
{
llwarns << "tried to make UI sound for unknown sound name: " << name << llendl;
}
else
{
- LLUUID uuid(LLUI::sSettingGroups["config"]->getString(name));
+ uuid = LLUUID(LLUI::sSettingGroups["config"]->getString(name));
if (uuid.isNull())
{
if (LLUI::sSettingGroups["config"]->getString(name) == LLUUID::null.asString())
@@ -124,7 +127,6 @@ void make_ui_sound(const char* namep)
{
llwarns << "UI sound named: " << name << " does not translate to a valid uuid" << llendl;
}
-
}
else if (LLUI::sAudioCallback != NULL)
{
@@ -132,9 +134,28 @@ void make_ui_sound(const char* namep)
{
llinfos << "UI sound name: " << name << llendl;
}
- LLUI::sAudioCallback(uuid);
}
}
+
+ return uuid;
+}
+
+void make_ui_sound(const char* namep)
+{
+ LLUUID soundUUID = find_ui_sound(namep);
+ if(soundUUID.notNull())
+ {
+ LLUI::sAudioCallback(soundUUID);
+ }
+}
+
+void make_ui_sound_deferred(const char* namep)
+{
+ LLUUID soundUUID = find_ui_sound(namep);
+ if(soundUUID.notNull())
+ {
+ LLUI::sDeferredAudioCallback(soundUUID);
+ }
}
BOOL ui_point_in_rect(S32 x, S32 y, S32 left, S32 top, S32 right, S32 bottom)
@@ -1608,6 +1629,7 @@ void gl_segmented_rect_3d_tex(const LLRectf& clip_rect, const LLRectf& center_uv
void LLUI::initClass(const settings_map_t& settings,
LLImageProviderInterface* image_provider,
LLUIAudioCallback audio_callback,
+ LLUIAudioCallback deferred_audio_callback,
const LLVector2* scale_factor,
const std::string& language)
{
@@ -1622,6 +1644,7 @@ void LLUI::initClass(const settings_map_t& settings,
sImageProvider = image_provider;
sAudioCallback = audio_callback;
+ sDeferredAudioCallback = deferred_audio_callback;
sGLScaleFactor = (scale_factor == NULL) ? LLVector2(1.f, 1.f) : *scale_factor;
sWindow = NULL; // set later in startup
LLFontGL::sShadowColor = LLUIColorTable::instance().getColor("ColorDropShadow");
diff --git a/indra/llui/llui.h b/indra/llui/llui.h
index e54cae1d78..4c1703392a 100644
--- a/indra/llui/llui.h
+++ b/indra/llui/llui.h
@@ -62,6 +62,7 @@ class LLHelp;
// UI colors
extern const LLColor4 UI_VERTEX_COLOR;
void make_ui_sound(const char* name);
+void make_ui_sound_deferred(const char * name);
BOOL ui_point_in_rect(S32 x, S32 y, S32 left, S32 top, S32 right, S32 bottom);
void gl_state_for_2d(S32 width, S32 height);
@@ -274,6 +275,7 @@ public:
static void initClass(const settings_map_t& settings,
LLImageProviderInterface* image_provider,
LLUIAudioCallback audio_callback = NULL,
+ LLUIAudioCallback deferred_audio_callback = NULL,
const LLVector2 *scale_factor = NULL,
const std::string& language = LLStringUtil::null);
static void cleanupClass();
@@ -359,6 +361,7 @@ public:
//
static settings_map_t sSettingGroups;
static LLUIAudioCallback sAudioCallback;
+ static LLUIAudioCallback sDeferredAudioCallback;
static LLVector2 sGLScaleFactor;
static LLWindow* sWindow;
static LLView* sRootView;