Updates to the Sound Explorer to make it more TPV compliant.
Signed-off-by: Beeks <HgDelirium@gmail.com>
This commit is contained in:
@@ -79,10 +79,7 @@ BOOL LLFloaterExploreSounds::postBuild(void)
|
||||
childSetDoubleClickCallback("sound_list", handle_play_locally, this);
|
||||
|
||||
childSetAction("play_locally_btn", handle_play_locally, this);
|
||||
childSetAction("play_in_world_btn", handle_play_in_world, this);
|
||||
childSetAction("play_ambient_btn", handle_play_ambient, this);
|
||||
childSetAction("look_at_btn", handle_look_at, this);
|
||||
childSetAction("copy_uuid_btn", handle_copy_uuid, this);
|
||||
childSetAction("stop_btn", handle_stop, this);
|
||||
|
||||
LLScrollListCtrl* list = getChild<LLScrollListCtrl>("sound_list");
|
||||
@@ -209,13 +206,27 @@ BOOL LLFloaterExploreSounds::tick()
|
||||
|
||||
LLSD& playing_column = element["columns"][0];
|
||||
playing_column["column"] = "playing";
|
||||
if(item.mPlaying)
|
||||
if (item.mIsLooped)
|
||||
{
|
||||
playing_column["value"] = " Looping";
|
||||
}
|
||||
else if(item.mPlaying)
|
||||
{
|
||||
playing_column["value"] = " Playing";
|
||||
}
|
||||
else
|
||||
playing_column["value"] = llformat("%.1f min ago", (LLTimer::getElapsedSeconds() - item.mTimeStopped) / 60.f);
|
||||
{
|
||||
|
||||
S32 time = (LLTimer::getElapsedSeconds() - item.mTimeStopped);
|
||||
S32 hours = time / 3600;
|
||||
S32 mins = time / 60;
|
||||
S32 secs = time % 60;
|
||||
playing_column["value"] = llformat("%d:%02d:%02d", hours,mins,secs);
|
||||
}
|
||||
|
||||
LLSD& type_column = element["columns"][1];
|
||||
type_column["column"] = "type";
|
||||
type_column["type"] = "icon";
|
||||
if(item.mType == LLAudioEngine::AUDIO_TYPE_UI)
|
||||
{
|
||||
// this shouldn't happen for now, as UI is forbidden in the log
|
||||
@@ -224,16 +235,18 @@ BOOL LLFloaterExploreSounds::tick()
|
||||
else
|
||||
{
|
||||
std::string type;
|
||||
|
||||
std::string icon;
|
||||
if(is_avatar)
|
||||
{
|
||||
type = "Avatar";
|
||||
icon = "inv_item_gesture.tga";
|
||||
}
|
||||
else
|
||||
{
|
||||
if(item.mIsTrigger)
|
||||
{
|
||||
type = "llTriggerSound";
|
||||
icon = "inv_item_sound.tga";
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -241,10 +254,12 @@ BOOL LLFloaterExploreSounds::tick()
|
||||
type = "llLoopSound";
|
||||
else
|
||||
type = "llPlaySound";
|
||||
icon = "inv_item_object.tga";
|
||||
}
|
||||
}
|
||||
|
||||
type_column["value"] = type;
|
||||
type_column["value"] = icon;
|
||||
type_column["tool_tip"] = type;
|
||||
}
|
||||
|
||||
LLSD& owner_column = element["columns"][2];
|
||||
@@ -262,10 +277,8 @@ BOOL LLFloaterExploreSounds::tick()
|
||||
LLSD& sound_column = element["columns"][3];
|
||||
sound_column["column"] = "sound";
|
||||
|
||||
if (item.mOwnerID == gAgent.getID())
|
||||
sound_column["value"] = item.mAssetID.asString();
|
||||
else
|
||||
sound_column["value"] = LLUUID::null.asString();
|
||||
std::string uuid = item.mAssetID.asString();
|
||||
sound_column["value"] = uuid.substr(0, uuid.find_first_of("-")) + "...";
|
||||
|
||||
list->addElement(element, ADD_BOTTOM);
|
||||
}
|
||||
@@ -298,80 +311,6 @@ void LLFloaterExploreSounds::handle_play_locally(void* user_data)
|
||||
}
|
||||
}
|
||||
|
||||
// static
|
||||
void LLFloaterExploreSounds::handle_play_in_world(void* user_data)
|
||||
{
|
||||
LLFloaterExploreSounds* floater = (LLFloaterExploreSounds*)user_data;
|
||||
LLScrollListCtrl* list = floater->getChild<LLScrollListCtrl>("sound_list");
|
||||
std::vector<LLScrollListItem*> selection = list->getAllSelected();
|
||||
std::vector<LLScrollListItem*>::iterator selection_iter = selection.begin();
|
||||
std::vector<LLScrollListItem*>::iterator selection_end = selection.end();
|
||||
for( ; selection_iter != selection_end; ++selection_iter)
|
||||
{
|
||||
LLSoundHistoryItem item = floater->getItem((*selection_iter)->getValue());
|
||||
if(item.mID.isNull()) continue;
|
||||
|
||||
LLMessageSystem* msg = gMessageSystem;
|
||||
msg->newMessageFast(_PREHASH_SoundTrigger);
|
||||
msg->nextBlockFast(_PREHASH_SoundData);
|
||||
msg->addUUIDFast(_PREHASH_SoundID, item.mAssetID);
|
||||
// Client untrusted, ids set on sim
|
||||
msg->addUUIDFast(_PREHASH_OwnerID, LLUUID::null );
|
||||
msg->addUUIDFast(_PREHASH_ObjectID, LLUUID::null );
|
||||
msg->addUUIDFast(_PREHASH_ParentID, LLUUID::null );
|
||||
msg->addU64Fast(_PREHASH_Handle, gAgent.getRegion()->getHandle());
|
||||
LLVector3 position = gAgent.getPositionAgent();
|
||||
msg->addVector3Fast(_PREHASH_Position, position);
|
||||
msg->addF32Fast(_PREHASH_Gain, 1.0f);
|
||||
|
||||
gAgent.sendMessage();
|
||||
}
|
||||
}
|
||||
|
||||
// static
|
||||
void LLFloaterExploreSounds::handle_play_ambient(void* user_data)
|
||||
{
|
||||
LLParcel *parcel = LLViewerParcelMgr::getInstance()->getAgentParcel();
|
||||
if(!gAgent.isInGroup(parcel->getGroupID()))
|
||||
{
|
||||
LLChat chat;
|
||||
chat.mSourceType = CHAT_SOURCE_SYSTEM;
|
||||
chat.mText = llformat("Can't play ambient sound: Must be on land you're grouped to.");
|
||||
LLFloaterChat::addChat(chat);
|
||||
return;
|
||||
}
|
||||
|
||||
LLFloaterExploreSounds* floater = (LLFloaterExploreSounds*)user_data;
|
||||
LLScrollListCtrl* list = floater->getChild<LLScrollListCtrl>("sound_list");
|
||||
std::vector<LLScrollListItem*> selection = list->getAllSelected();
|
||||
std::vector<LLScrollListItem*>::iterator selection_iter = selection.begin();
|
||||
std::vector<LLScrollListItem*>::iterator selection_end = selection.end();
|
||||
for( ; selection_iter != selection_end; ++selection_iter)
|
||||
{
|
||||
LLSoundHistoryItem item = floater->getItem((*selection_iter)->getValue());
|
||||
if(item.mID.isNull()) continue;
|
||||
int gain = 0.01f;
|
||||
for(int i = 0; i < 2; i++)
|
||||
{
|
||||
gMessageSystem->newMessageFast(_PREHASH_SoundTrigger);
|
||||
gMessageSystem->nextBlockFast(_PREHASH_SoundData);
|
||||
gMessageSystem->addUUIDFast(_PREHASH_SoundID, item.mAssetID);
|
||||
gMessageSystem->addUUIDFast(_PREHASH_OwnerID, LLUUID::null);
|
||||
gMessageSystem->addUUIDFast(_PREHASH_ObjectID, LLUUID::null);
|
||||
gMessageSystem->addUUIDFast(_PREHASH_ParentID, LLUUID::null);
|
||||
gMessageSystem->addU64Fast(_PREHASH_Handle, gAgent.getRegion()->getHandle());
|
||||
LLVector3d pos = -from_region_handle(gAgent.getRegion()->getHandle());
|
||||
gMessageSystem->addVector3Fast(_PREHASH_Position, (LLVector3)pos);
|
||||
gMessageSystem->addF32Fast(_PREHASH_Gain, gain);
|
||||
|
||||
gMessageSystem->sendReliable(gAgent.getRegionHost());
|
||||
|
||||
gain = 1.0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// static
|
||||
void LLFloaterExploreSounds::handle_look_at(void* user_data)
|
||||
{
|
||||
@@ -407,34 +346,6 @@ void LLFloaterExploreSounds::handle_look_at(void* user_data)
|
||||
gAgent.setCameraAnimating(FALSE);
|
||||
}
|
||||
|
||||
// static
|
||||
void LLFloaterExploreSounds::handle_open(void* user_data)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// static
|
||||
void LLFloaterExploreSounds::handle_copy_uuid(void* user_data)
|
||||
{
|
||||
LLFloaterExploreSounds* floater = (LLFloaterExploreSounds*)user_data;
|
||||
LLScrollListCtrl* list = floater->getChild<LLScrollListCtrl>("sound_list");
|
||||
LLUUID selection = list->getSelectedValue().asUUID(); // Single item only
|
||||
LLSoundHistoryItem item = floater->getItem(selection);
|
||||
if(item.mID.isNull()) return;
|
||||
|
||||
if (item.mOwnerID == gAgent.getID())
|
||||
{
|
||||
gViewerWindow->mWindow->copyTextToClipboard(utf8str_to_wstring(item.mAssetID.asString()));
|
||||
}
|
||||
else
|
||||
{
|
||||
LLChat chat;
|
||||
chat.mSourceType = CHAT_SOURCE_SYSTEM;
|
||||
chat.mText = llformat("Can't copy UUIDs you don't own.");
|
||||
LLFloaterChat::addChat(chat);
|
||||
}
|
||||
}
|
||||
|
||||
// static
|
||||
void LLFloaterExploreSounds::handle_stop(void* user_data)
|
||||
{
|
||||
|
||||
@@ -1,41 +1,37 @@
|
||||
// <edit>
|
||||
|
||||
#ifndef LL_LLFLOATEREXPLORESOUNDS_H
|
||||
#define LL_LLFLOATEREXPLORESOUNDS_H
|
||||
|
||||
#include "llfloater.h"
|
||||
#include "llaudioengine.h"
|
||||
|
||||
class LLFloaterExploreSounds
|
||||
: public LLFloater, public LLEventTimer
|
||||
{
|
||||
public:
|
||||
LLFloaterExploreSounds();
|
||||
BOOL postBuild(void);
|
||||
void close(bool app_quitting);
|
||||
|
||||
BOOL tick();
|
||||
|
||||
LLSoundHistoryItem getItem(LLUUID itemID);
|
||||
|
||||
static void handle_play_locally(void* user_data);
|
||||
static void handle_play_in_world(void* user_data);
|
||||
static void handle_play_ambient(void* user_data);
|
||||
static void handle_look_at(void* user_data);
|
||||
static void handle_open(void* user_data);
|
||||
static void handle_copy_uuid(void* user_data);
|
||||
static void handle_stop(void* user_data);
|
||||
|
||||
private:
|
||||
virtual ~LLFloaterExploreSounds();
|
||||
std::list<LLSoundHistoryItem> mLastHistory;
|
||||
|
||||
// static stuff!
|
||||
public:
|
||||
static LLFloaterExploreSounds* sInstance;
|
||||
|
||||
static void toggle();
|
||||
};
|
||||
|
||||
#endif
|
||||
// </edit>
|
||||
// <edit>
|
||||
|
||||
#ifndef LL_LLFLOATEREXPLORESOUNDS_H
|
||||
#define LL_LLFLOATEREXPLORESOUNDS_H
|
||||
|
||||
#include "llfloater.h"
|
||||
#include "llaudioengine.h"
|
||||
|
||||
class LLFloaterExploreSounds
|
||||
: public LLFloater, public LLEventTimer
|
||||
{
|
||||
public:
|
||||
LLFloaterExploreSounds();
|
||||
BOOL postBuild(void);
|
||||
void close(bool app_quitting);
|
||||
|
||||
BOOL tick();
|
||||
|
||||
LLSoundHistoryItem getItem(LLUUID itemID);
|
||||
|
||||
static void handle_play_locally(void* user_data);
|
||||
static void handle_look_at(void* user_data);
|
||||
static void handle_stop(void* user_data);
|
||||
|
||||
private:
|
||||
virtual ~LLFloaterExploreSounds();
|
||||
std::list<LLSoundHistoryItem> mLastHistory;
|
||||
|
||||
// static stuff!
|
||||
public:
|
||||
static LLFloaterExploreSounds* sInstance;
|
||||
|
||||
static void toggle();
|
||||
};
|
||||
|
||||
#endif
|
||||
// </edit>
|
||||
|
||||
@@ -1,31 +1,41 @@
|
||||
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
|
||||
<floater can_close="true" can_drag_on_left="false" can_minimize="true"
|
||||
can_resize="true" height="300" width="500" min_width="500" min_height="170"
|
||||
name="floater_explore_sounds" title="Sounds" rect_control="FloaterSoundsRect">
|
||||
<check_box follows="top|left" bottom_delta="-40" left="5" width="64" name="avatars_chk" label="Avatars" control_name="FloaterSoundsLogAvatars" />
|
||||
<check_box follows="top|left" bottom_delta="0" left_delta="64" width="64" name="objects_chk" label="Objects" initial_value="true" control_name="FloaterSoundsLogObjects" />
|
||||
<check_box follows="top|left" bottom_delta="0" left_delta="64" width="160" name="collision_chk" label="Default Collision Sounds" control_name="FloaterSoundsLogCollisions" />
|
||||
<check_box follows="top|left" bottom_delta="0" left_delta="160" width="110" name="repeated_asset_chk" label="Repeated Asset" control_name="FloaterSoundsLogRepeats" />
|
||||
<check_box follows="top|left" bottom_delta="0" left_delta="110" width="80" name="pause_chk" label="Pause Log" initial_value="false"/>
|
||||
<scroll_list bottom="50" can_resize="true" column_padding="0" draw_heading="true"
|
||||
can_resize="true" height="300" width="350" min_width="350" min_height="170"
|
||||
name="floater_explore_sounds" title="Sounds" rect_control="FloaterSoundsRect">
|
||||
<text type="string" length="50" bg_visible="false" border_drop_shadow_visible="false" border_visible="false"
|
||||
bottom="-32" drop_shadow_visible="true" enabled="true" follows="left|top"
|
||||
font="SansSerifSmall" h_pad="0" halign="left" height="12" left="10"
|
||||
mouse_opaque="true" name="result_label" v_pad="0" width="60">
|
||||
Sources:
|
||||
</text>
|
||||
<check_box follows="top|left" bottom_delta="-5" left_delta="55" width="64" name="avatars_chk"
|
||||
label="Avatars" control_name="FloaterSoundsLogAvatars" />
|
||||
<check_box follows="top|left" bottom_delta="0" left_delta="64" width="64" name="objects_chk"
|
||||
label="Objects" initial_value="true" control_name="FloaterSoundsLogObjects" />
|
||||
<check_box follows="top|left" bottom_delta="0" left_delta="64" width="160" name="collision_chk"
|
||||
label="Default Collision Sounds" control_name="FloaterSoundsLogCollisions" />
|
||||
<text type="string" length="50" bg_visible="false" border_drop_shadow_visible="false" border_visible="false"
|
||||
bottom="-52" drop_shadow_visible="true" enabled="true" follows="left|top"
|
||||
font="SansSerifSmall" h_pad="0" halign="left" height="12" left="10"
|
||||
mouse_opaque="true" name="result_label" v_pad="0" width="60">
|
||||
Controls:
|
||||
</text>
|
||||
<check_box follows="top|left" bottom_delta="-5" left_delta="55" width="110" name="repeated_asset_chk"
|
||||
label="Show Repeats" control_name="FloaterSoundsLogRepeats" />
|
||||
<check_box follows="top|left" bottom_delta="0" left_delta="110" width="80" name="pause_chk"
|
||||
label="Pause Log" initial_value="false"/>
|
||||
<scroll_list bottom="30" can_resize="true" column_padding="0" draw_heading="true"
|
||||
follows="left|top|bottom|right" left="10" multi_select="true"
|
||||
name="sound_list" search_column="0" top="-40" right="-10">
|
||||
<column dynamicwidth="false" width="80" label="Playing" name="playing" />
|
||||
<column dynamicwidth="false" width="100" label="Type" name="type" />
|
||||
<column dynamicwidth="true" label="Owner" name="owner" />
|
||||
<column dynamicwidth="true" label="Sound" name="sound" />
|
||||
name="sound_list" search_column="0" top="-60" right="-10">
|
||||
<column width="20" tool_tip="Type" name="type" />
|
||||
<column width="50" label="Time" name="playing" />
|
||||
<column dynamicwidth="true" width="150" label="Owner" name="owner" />
|
||||
<column width="80" label="Sound" name="sound" />
|
||||
</scroll_list>
|
||||
<button bottom="28" follows="bottom|left" height="20" label="Play Locally" name="play_locally_btn"
|
||||
<button bottom="6" follows="bottom|left" height="20" label="Stop" name="stop_btn"
|
||||
left="10" width="95"/>
|
||||
<button bottom_delta="0" follows="bottom|left" height="20" label="Play In World" name="play_in_world_btn"
|
||||
<button bottom_delta="0" follows="bottom|left" height="20" label="Look At" name="look_at_btn"
|
||||
left_delta="100" width="95"/>
|
||||
<button bottom="28" follows="bottom|left" height="20" label="Play Ambient" name="play_ambient_btn"
|
||||
left_delta="100" width="95"/>
|
||||
|
||||
<button bottom="6" follows="bottom|left" height="20" label="Look At" name="look_at_btn"
|
||||
left="10" width="95"/>
|
||||
<button bottom_delta="0" follows="bottom|left" height="20" label="Copy UUID" name="copy_uuid_btn"
|
||||
left_delta="100" width="95"/>
|
||||
<button bottom_delta="0" follows="bottom|left" height="20" label="Stop" name="stop_btn"
|
||||
<button bottom_delta="0" follows="bottom|left" height="20" label="Play Locally" name="play_locally_btn"
|
||||
left_delta="100" width="95"/>
|
||||
</floater>
|
||||
|
||||
Reference in New Issue
Block a user