reintroduce sound explorer port from NACL viewer
parent
3c7328fe15
commit
4a0c5ee693
|
|
@ -46,6 +46,9 @@ extern void request_sound(const LLUUID &sound_guid);
|
|||
|
||||
LLAudioEngine* gAudiop = NULL;
|
||||
|
||||
// NaCl - Sound explorer
|
||||
int LLAudioSource::gSoundHistoryPruneCounter;
|
||||
// NaCl End
|
||||
|
||||
//
|
||||
// LLAudioEngine implementation
|
||||
|
|
@ -812,12 +815,13 @@ F64 LLAudioEngine::mapWindVecToPan(LLVector3 wind_vec)
|
|||
|
||||
|
||||
void LLAudioEngine::triggerSound(const LLUUID &audio_uuid, const LLUUID& owner_id, const F32 gain,
|
||||
const S32 type, const LLVector3d &pos_global)
|
||||
const S32 type, const LLVector3d &pos_global, const LLUUID source_object)
|
||||
{
|
||||
// Create a new source (since this can't be associated with an existing source.
|
||||
//llinfos << "Localized: " << audio_uuid << llendl;
|
||||
|
||||
if (mMuted)
|
||||
// NaCl - Do not load silent sounds.
|
||||
if (mMuted || gain <FLT_EPSILON*2)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
@ -825,7 +829,7 @@ void LLAudioEngine::triggerSound(const LLUUID &audio_uuid, const LLUUID& owner_i
|
|||
LLUUID source_id;
|
||||
source_id.generate();
|
||||
|
||||
LLAudioSource *asp = new LLAudioSource(source_id, owner_id, gain, type);
|
||||
LLAudioSource *asp = new LLAudioSource(source_id, owner_id, gain, type, source_object, true);
|
||||
gAudiop->addAudioSource(asp);
|
||||
if (pos_global.isExactlyZero())
|
||||
{
|
||||
|
|
@ -1259,7 +1263,7 @@ void LLAudioEngine::assetCallback(LLVFS *vfs, const LLUUID &uuid, LLAssetType::E
|
|||
//
|
||||
|
||||
|
||||
LLAudioSource::LLAudioSource(const LLUUID& id, const LLUUID& owner_id, const F32 gain, const S32 type)
|
||||
LLAudioSource::LLAudioSource(const LLUUID& id, const LLUUID& owner_id, const F32 gain, const S32 type, const LLUUID source_id, const bool isTrigger)
|
||||
: mID(id),
|
||||
mOwnerID(owner_id),
|
||||
mPriority(0.f),
|
||||
|
|
@ -1275,10 +1279,77 @@ LLAudioSource::LLAudioSource(const LLUUID& id, const LLUUID& owner_id, const F32
|
|||
mType(type),
|
||||
mChannelp(NULL),
|
||||
mCurrentDatap(NULL),
|
||||
mQueuedDatap(NULL)
|
||||
mQueuedDatap(NULL),
|
||||
// NaCl - Sound explorer
|
||||
mSourceID(source_id),
|
||||
mIsTrigger(isTrigger)
|
||||
{
|
||||
mLogID.generate();
|
||||
}
|
||||
|
||||
std::map<LLUUID, LLSoundHistoryItem> gSoundHistory;
|
||||
|
||||
// static
|
||||
void LLAudioSource::logSoundPlay(LLUUID id, LLAudioSource* audio_source, LLVector3d position, S32 type, LLUUID assetid, LLUUID ownerid, LLUUID sourceid, bool is_trigger, bool is_looped)
|
||||
{
|
||||
LLSoundHistoryItem item;
|
||||
item.mID = id;
|
||||
item.mAudioSource = audio_source;
|
||||
item.mPosition = position;
|
||||
item.mType = type;
|
||||
item.mAssetID = assetid;
|
||||
item.mOwnerID = ownerid;
|
||||
item.mSourceID = sourceid;
|
||||
item.mPlaying = true;
|
||||
item.mTimeStarted = LLTimer::getElapsedSeconds();
|
||||
item.mTimeStopped = F64_MAX;
|
||||
item.mIsTrigger = is_trigger;
|
||||
item.mIsLooped = is_looped;
|
||||
|
||||
item.mReviewed = false;
|
||||
item.mReviewedCollision = false;
|
||||
|
||||
gSoundHistory[id] = item;
|
||||
}
|
||||
|
||||
// static
|
||||
void LLAudioSource::logSoundStop(LLUUID id)
|
||||
{
|
||||
if(gSoundHistory.find(id) != gSoundHistory.end())
|
||||
{
|
||||
gSoundHistory[id].mPlaying = false;
|
||||
gSoundHistory[id].mTimeStopped = LLTimer::getElapsedSeconds();
|
||||
gSoundHistory[id].mAudioSource = NULL; // just in case
|
||||
pruneSoundLog();
|
||||
}
|
||||
}
|
||||
|
||||
// static
|
||||
void LLAudioSource::pruneSoundLog()
|
||||
{
|
||||
if(++gSoundHistoryPruneCounter >= 64)
|
||||
{
|
||||
gSoundHistoryPruneCounter = 0;
|
||||
while(gSoundHistory.size() > 256)
|
||||
{
|
||||
std::map<LLUUID, LLSoundHistoryItem>::iterator iter = gSoundHistory.begin();
|
||||
std::map<LLUUID, LLSoundHistoryItem>::iterator end = gSoundHistory.end();
|
||||
U64 lowest_time = (*iter).second.mTimeStopped;
|
||||
LLUUID lowest_id = (*iter).first;
|
||||
for( ; iter != end; ++iter)
|
||||
{
|
||||
if((*iter).second.mTimeStopped < lowest_time)
|
||||
{
|
||||
lowest_time = (*iter).second.mTimeStopped;
|
||||
lowest_id = (*iter).first;
|
||||
}
|
||||
}
|
||||
gSoundHistory.erase(lowest_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
// NaCl End
|
||||
|
||||
|
||||
LLAudioSource::~LLAudioSource()
|
||||
{
|
||||
|
|
@ -1287,6 +1358,10 @@ LLAudioSource::~LLAudioSource()
|
|||
// Stop playback of this sound
|
||||
mChannelp->setSource(NULL);
|
||||
mChannelp = NULL;
|
||||
// NaCl - Sound Explorer
|
||||
if(mType != LLAudioEngine::AUDIO_TYPE_UI) // && mSourceID.notNull())
|
||||
logSoundStop(mLogID);
|
||||
// NaCl End
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1387,11 +1462,18 @@ bool LLAudioSource::setupChannel()
|
|||
|
||||
bool LLAudioSource::play(const LLUUID &audio_uuid)
|
||||
{
|
||||
// NaCl - Sound Explorer
|
||||
if(mType != LLAudioEngine::AUDIO_TYPE_UI) //&& mSourceID.notNull())
|
||||
logSoundPlay(mLogID, this, mPositionGlobal, mType, audio_uuid, mOwnerID, mSourceID, mIsTrigger, mLoop);
|
||||
// NaCl End
|
||||
// Special abuse of play(); don't play a sound, but kill it.
|
||||
if (audio_uuid.isNull())
|
||||
{
|
||||
if (getChannel())
|
||||
{
|
||||
// NaCl - Sound Explorer
|
||||
if(getChannel()->getSource())
|
||||
// NaCl End
|
||||
getChannel()->setSource(NULL);
|
||||
setChannel(NULL);
|
||||
if (!isMuted())
|
||||
|
|
|
|||
|
|
@ -141,9 +141,12 @@ public:
|
|||
|
||||
// Methods actually related to setting up and removing sounds
|
||||
// Owner ID is the owner of the object making the request
|
||||
// NaCl - Sound Explorer
|
||||
void triggerSound(const LLUUID &sound_id, const LLUUID& owner_id, const F32 gain,
|
||||
const S32 type = LLAudioEngine::AUDIO_TYPE_NONE,
|
||||
const LLVector3d &pos_global = LLVector3d::zero);
|
||||
const LLVector3d &pos_global = LLVector3d::zero,
|
||||
const LLUUID source_object = LLUUID::null);
|
||||
// NaCl End
|
||||
bool preloadSound(const LLUUID &id);
|
||||
|
||||
void addAudioSource(LLAudioSource *asp);
|
||||
|
|
@ -265,7 +268,9 @@ class LLAudioSource
|
|||
public:
|
||||
// owner_id is the id of the agent responsible for making this sound
|
||||
// play, for example, the owner of the object currently playing it
|
||||
LLAudioSource(const LLUUID &id, const LLUUID& owner_id, const F32 gain, const S32 type = LLAudioEngine::AUDIO_TYPE_NONE);
|
||||
// NaCl - Sound Explorer
|
||||
LLAudioSource(const LLUUID &id, const LLUUID& owner_id, const F32 gain, const S32 type = LLAudioEngine::AUDIO_TYPE_NONE, const LLUUID source_id = LLUUID::null, const bool isTrigger = true);
|
||||
// NaCl End
|
||||
virtual ~LLAudioSource();
|
||||
|
||||
virtual void update(); // Update this audio source
|
||||
|
|
@ -305,6 +310,9 @@ public:
|
|||
virtual void setGain(const F32 gain) { mGain = llclamp(gain, 0.f, 1.f); }
|
||||
|
||||
const LLUUID &getID() const { return mID; }
|
||||
// NaCl - Sound Explorer
|
||||
const LLUUID &getLogID() const { return mLogID; }
|
||||
// NaCl End
|
||||
bool isDone() const;
|
||||
bool isMuted() const { return mSourceMuted; }
|
||||
|
||||
|
|
@ -322,6 +330,12 @@ public:
|
|||
protected:
|
||||
void setChannel(LLAudioChannel *channelp);
|
||||
LLAudioChannel *getChannel() const { return mChannelp; }
|
||||
// NaCl - Sound Explorer
|
||||
static void logSoundPlay(LLUUID id, LLAudioSource* audio_source, LLVector3d position, S32 type, LLUUID assetid, LLUUID ownerid, LLUUID sourceid, bool is_trigger, bool is_looped);
|
||||
static void logSoundStop(LLUUID id);
|
||||
static void pruneSoundLog();
|
||||
static int gSoundHistoryPruneCounter;
|
||||
// NaCl End
|
||||
|
||||
protected:
|
||||
LLUUID mID; // The ID of the source is that of the object if it's attached to an object.
|
||||
|
|
@ -339,6 +353,11 @@ protected:
|
|||
S32 mType;
|
||||
LLVector3d mPositionGlobal;
|
||||
LLVector3 mVelocity;
|
||||
// NaCl - Sound explorer
|
||||
LLUUID mLogID;
|
||||
LLUUID mSourceID;
|
||||
bool mIsTrigger;
|
||||
// NaCl end
|
||||
|
||||
//LLAudioSource *mSyncMasterp; // If we're a slave, the source that we're synced to.
|
||||
LLAudioChannel *mChannelp; // If we're currently playing back, this is the channel that we're assigned to.
|
||||
|
|
@ -457,7 +476,27 @@ protected:
|
|||
};
|
||||
|
||||
|
||||
|
||||
extern LLAudioEngine* gAudiop;
|
||||
|
||||
// NaCl - Sound explorer
|
||||
typedef struct
|
||||
{
|
||||
LLUUID mID;
|
||||
LLVector3d mPosition;
|
||||
S32 mType;
|
||||
bool mPlaying;
|
||||
LLUUID mAssetID;
|
||||
LLUUID mOwnerID;
|
||||
LLUUID mSourceID;
|
||||
bool mIsTrigger;
|
||||
bool mIsLooped;
|
||||
F64 mTimeStarted;
|
||||
F64 mTimeStopped;
|
||||
bool mReviewed;
|
||||
bool mReviewedCollision;
|
||||
LLAudioSource* mAudioSource;
|
||||
} LLSoundHistoryItem;
|
||||
extern std::map<LLUUID, LLSoundHistoryItem> gSoundHistory;
|
||||
// NaCl End
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -664,6 +664,34 @@ boost::signals2::connection LLCacheName::get(const LLUUID& id, bool is_group, co
|
|||
return res;
|
||||
}
|
||||
|
||||
// NaCl - Sound explorer
|
||||
BOOL LLCacheName::getIfThere(const LLUUID& id, std::string& fullname, BOOL& is_group)
|
||||
{
|
||||
if(id.isNull())
|
||||
{
|
||||
fullname = "";
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
LLCacheNameEntry* entry = get_ptr_in_map(impl.mCache, id );
|
||||
if (entry)
|
||||
{
|
||||
if (entry->mIsGroup)
|
||||
{
|
||||
fullname = entry->mGroupName;
|
||||
}
|
||||
else
|
||||
{
|
||||
fullname = entry->mFirstName + " " + entry->mLastName;
|
||||
}
|
||||
is_group = entry->mIsGroup;
|
||||
return TRUE;
|
||||
}
|
||||
fullname = "";
|
||||
return FALSE;
|
||||
}
|
||||
// NaCl end
|
||||
|
||||
boost::signals2::connection LLCacheName::getGroup(const LLUUID& group_id,
|
||||
const LLCacheNameCallback& callback)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -108,6 +108,10 @@ public:
|
|||
// available. There is no garuntee the callback will ever be called.
|
||||
boost::signals2::connection get(const LLUUID& id, bool is_group, const LLCacheNameCallback& callback);
|
||||
|
||||
// NaCl - Sound explorer
|
||||
BOOL getIfThere(const LLUUID& id, std::string& fullname, BOOL& is_group);
|
||||
// NaCl end
|
||||
|
||||
// Convenience method for looking up a group name, so you can
|
||||
// tell the difference between avatar lookup and group lookup
|
||||
// in global searches
|
||||
|
|
|
|||
|
|
@ -687,6 +687,7 @@ set(viewer_SOURCE_FILES
|
|||
streamtitledisplay.cpp
|
||||
utilitybar.cpp
|
||||
NACLantispam.cpp
|
||||
NACLfloaterexploresounds.cpp
|
||||
)
|
||||
|
||||
if (HAS_OPENSIM_SUPPORT)
|
||||
|
|
@ -1313,6 +1314,7 @@ set(viewer_HEADER_FILES
|
|||
kvfloaterflickrauth.h
|
||||
kvfloaterflickrupload.h
|
||||
NACLantispam.h
|
||||
NACLfloaterexploresounds.h
|
||||
)
|
||||
|
||||
# AO Get our viewer version & channel at this point
|
||||
|
|
|
|||
|
|
@ -0,0 +1,369 @@
|
|||
// <edit>
|
||||
|
||||
#include "llviewerprecompiledheaders.h"
|
||||
|
||||
#include "NACLfloaterexploresounds.h"
|
||||
#include "lluictrlfactory.h"
|
||||
#include "llscrolllistctrl.h"
|
||||
#include "llagent.h"
|
||||
#include "llagentcamera.h"
|
||||
#include "llviewerwindow.h"
|
||||
#include "llviewerobjectlist.h"
|
||||
#include "llviewerregion.h"
|
||||
#include "fswsassetblacklist.h"
|
||||
|
||||
static const size_t num_collision_sounds = 28;
|
||||
const LLUUID collision_sounds[num_collision_sounds] =
|
||||
{
|
||||
LLUUID("dce5fdd4-afe4-4ea1-822f-dd52cac46b08"),
|
||||
LLUUID("51011582-fbca-4580-ae9e-1a5593f094ec"),
|
||||
LLUUID("68d62208-e257-4d0c-bbe2-20c9ea9760bb"),
|
||||
LLUUID("75872e8c-bc39-451b-9b0b-042d7ba36cba"),
|
||||
LLUUID("6a45ba0b-5775-4ea8-8513-26008a17f873"),
|
||||
LLUUID("992a6d1b-8c77-40e0-9495-4098ce539694"),
|
||||
LLUUID("2de4da5a-faf8-46be-bac6-c4d74f1e5767"),
|
||||
LLUUID("6e3fb0f7-6d9c-42ca-b86b-1122ff562d7d"),
|
||||
LLUUID("14209133-4961-4acc-9649-53fc38ee1667"),
|
||||
LLUUID("bc4a4348-cfcc-4e5e-908e-8a52a8915fe6"),
|
||||
LLUUID("9e5c1297-6eed-40c0-825a-d9bcd86e3193"),
|
||||
LLUUID("e534761c-1894-4b61-b20c-658a6fb68157"),
|
||||
LLUUID("8761f73f-6cf9-4186-8aaa-0948ed002db1"),
|
||||
LLUUID("874a26fd-142f-4173-8c5b-890cd846c74d"),
|
||||
LLUUID("0e24a717-b97e-4b77-9c94-b59a5a88b2da"),
|
||||
LLUUID("75cf3ade-9a5b-4c4d-bb35-f9799bda7fb2"),
|
||||
LLUUID("153c8bf7-fb89-4d89-b263-47e58b1b4774"),
|
||||
LLUUID("55c3e0ce-275a-46fa-82ff-e0465f5e8703"),
|
||||
LLUUID("24babf58-7156-4841-9a3f-761bdbb8e237"),
|
||||
LLUUID("aca261d8-e145-4610-9e20-9eff990f2c12"),
|
||||
LLUUID("0642fba6-5dcf-4d62-8e7b-94dbb529d117"),
|
||||
LLUUID("25a863e8-dc42-4e8a-a357-e76422ace9b5"),
|
||||
LLUUID("9538f37c-456e-4047-81be-6435045608d4"),
|
||||
LLUUID("8c0f84c3-9afd-4396-b5f5-9bca2c911c20"),
|
||||
LLUUID("be582e5d-b123-41a2-a150-454c39e961c8"),
|
||||
LLUUID("c70141d4-ba06-41ea-bcbc-35ea81cb8335"),
|
||||
LLUUID("7d1826f4-24c4-4aac-8c2e-eff45df37783"),
|
||||
LLUUID("063c97d3-033a-4e9b-98d8-05c8074922cb")
|
||||
};
|
||||
|
||||
NACLFloaterExploreSounds* NACLFloaterExploreSounds::sInstance;
|
||||
|
||||
NACLFloaterExploreSounds::NACLFloaterExploreSounds(const LLSD& key)
|
||||
: LLFloater(key), LLEventTimer(0.25f)
|
||||
{
|
||||
NACLFloaterExploreSounds::sInstance = this;
|
||||
}
|
||||
|
||||
NACLFloaterExploreSounds::~NACLFloaterExploreSounds()
|
||||
{
|
||||
NACLFloaterExploreSounds::sInstance = NULL;
|
||||
}
|
||||
|
||||
BOOL NACLFloaterExploreSounds::postBuild(void)
|
||||
{
|
||||
childSetAction("play_locally_btn", handle_play_locally, this);
|
||||
childSetAction("look_at_btn", handle_look_at, this);
|
||||
childSetAction("stop_btn", handle_stop, this);
|
||||
childSetAction("bl_btn", blacklistSound, this);
|
||||
|
||||
LLScrollListCtrl* list = getChild<LLScrollListCtrl>("sound_list");
|
||||
list->setDoubleClickCallback(boost::bind(&NACLFloaterExploreSounds::handle_play_locally, this));
|
||||
list->sortByColumn("playing", TRUE);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
LLSoundHistoryItem NACLFloaterExploreSounds::getItem(LLUUID itemID)
|
||||
{
|
||||
if(gSoundHistory.find(itemID) != gSoundHistory.end())
|
||||
return gSoundHistory[itemID];
|
||||
else
|
||||
{
|
||||
// If log is paused, hopefully we can find it in mLastHistory
|
||||
std::list<LLSoundHistoryItem>::iterator iter = mLastHistory.begin();
|
||||
std::list<LLSoundHistoryItem>::iterator end = mLastHistory.end();
|
||||
for( ; iter != end; ++iter)
|
||||
{
|
||||
if((*iter).mID == itemID) return (*iter);
|
||||
}
|
||||
}
|
||||
LLSoundHistoryItem item;
|
||||
item.mID = LLUUID::null;
|
||||
return item;
|
||||
}
|
||||
|
||||
class LLSoundHistoryItemCompare
|
||||
{
|
||||
public:
|
||||
bool operator() (LLSoundHistoryItem first, LLSoundHistoryItem second)
|
||||
{
|
||||
if(first.mPlaying)
|
||||
{
|
||||
if(second.mPlaying)
|
||||
{
|
||||
return (first.mTimeStarted > second.mTimeStarted);
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if(second.mPlaying)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return (first.mTimeStopped > second.mTimeStopped);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// static
|
||||
BOOL NACLFloaterExploreSounds::tick()
|
||||
{
|
||||
//if(childGetValue("pause_chk").asBoolean()) return FALSE;
|
||||
|
||||
bool show_collision_sounds = childGetValue("collision_chk").asBoolean();
|
||||
bool show_repeated_assets = childGetValue("repeated_asset_chk").asBoolean();
|
||||
bool show_avatars = childGetValue("avatars_chk").asBoolean();
|
||||
bool show_objects = childGetValue("objects_chk").asBoolean();
|
||||
|
||||
std::list<LLSoundHistoryItem> history;
|
||||
if(childGetValue("pause_chk").asBoolean())
|
||||
{
|
||||
history = mLastHistory;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::map<LLUUID, LLSoundHistoryItem>::iterator map_iter = gSoundHistory.begin();
|
||||
std::map<LLUUID, LLSoundHistoryItem>::iterator map_end = gSoundHistory.end();
|
||||
for( ; map_iter != map_end; ++map_iter)
|
||||
{
|
||||
history.push_back((*map_iter).second);
|
||||
}
|
||||
LLSoundHistoryItemCompare c;
|
||||
history.sort(c);
|
||||
mLastHistory = history;
|
||||
}
|
||||
|
||||
LLScrollListCtrl* list = getChild<LLScrollListCtrl>("sound_list");
|
||||
|
||||
// Save scroll pos and selection so they can be restored
|
||||
S32 scroll_pos = list->getScrollPos();
|
||||
LLDynamicArray<LLUUID> selected_ids;
|
||||
std::vector<LLScrollListItem*> selected_items = list->getAllSelected();
|
||||
std::vector<LLScrollListItem*>::iterator selection_iter = selected_items.begin();
|
||||
std::vector<LLScrollListItem*>::iterator selection_end = selected_items.end();
|
||||
for(; selection_iter != selection_end; ++selection_iter)
|
||||
selected_ids.push_back((*selection_iter)->getUUID());
|
||||
|
||||
list->clearRows();
|
||||
|
||||
std::list<LLUUID> unique_asset_list;
|
||||
|
||||
std::list<LLSoundHistoryItem>::iterator iter = history.begin();
|
||||
std::list<LLSoundHistoryItem>::iterator end = history.end();
|
||||
for( ; iter != end; ++iter)
|
||||
{
|
||||
LLSoundHistoryItem item = (*iter);
|
||||
|
||||
bool is_avatar = item.mOwnerID == item.mSourceID;
|
||||
if(is_avatar && !show_avatars) continue;
|
||||
|
||||
bool is_object = !is_avatar;
|
||||
if(is_object && !show_objects) continue;
|
||||
|
||||
bool is_repeated_asset = std::find(unique_asset_list.begin(), unique_asset_list.end(), item.mAssetID) != unique_asset_list.end();
|
||||
if(is_repeated_asset && !show_repeated_assets) continue;
|
||||
|
||||
if(!item.mReviewed)
|
||||
{
|
||||
item.mReviewedCollision = std::find(&collision_sounds[0], &collision_sounds[num_collision_sounds], item.mAssetID) != &collision_sounds[num_collision_sounds];
|
||||
item.mReviewed = true;
|
||||
}
|
||||
bool is_collision_sound = item.mReviewedCollision;
|
||||
if(is_collision_sound && !show_collision_sounds) continue;
|
||||
|
||||
unique_asset_list.push_back(item.mAssetID);
|
||||
|
||||
LLSD element;
|
||||
element["id"] = item.mID;
|
||||
|
||||
LLSD& playing_column = element["columns"][0];
|
||||
playing_column["column"] = "playing";
|
||||
if(item.mPlaying)
|
||||
playing_column["value"] = " Playing";
|
||||
else
|
||||
playing_column["value"] = llformat("%.1f min ago", (LLTimer::getElapsedSeconds() - item.mTimeStopped) / 60.f);
|
||||
|
||||
LLSD& type_column = element["columns"][1];
|
||||
type_column["column"] = "type";
|
||||
if(item.mType == LLAudioEngine::AUDIO_TYPE_UI)
|
||||
{
|
||||
// this shouldn't happen for now, as UI is forbidden in the log
|
||||
type_column["value"] = "UI";
|
||||
}
|
||||
else
|
||||
{
|
||||
std::string type;
|
||||
|
||||
if(is_avatar)
|
||||
{
|
||||
type = "Avatar";
|
||||
}
|
||||
else
|
||||
{
|
||||
if(item.mIsTrigger)
|
||||
{
|
||||
type = "llTriggerSound";
|
||||
}
|
||||
else
|
||||
{
|
||||
if(item.mIsLooped)
|
||||
type = "llLoopSound";
|
||||
else
|
||||
type = "llPlaySound";
|
||||
}
|
||||
}
|
||||
|
||||
type_column["value"] = type;
|
||||
}
|
||||
|
||||
LLSD& owner_column = element["columns"][2];
|
||||
owner_column["column"] = "owner";
|
||||
std::string fullname;
|
||||
BOOL is_group;
|
||||
if(gCacheName->getIfThere(item.mOwnerID, fullname, is_group))
|
||||
{
|
||||
if(is_group) fullname += " (Group)";
|
||||
owner_column["value"] = fullname;
|
||||
}
|
||||
else
|
||||
owner_column["value"] = item.mOwnerID.asString();
|
||||
|
||||
LLSD& sound_column = element["columns"][3];
|
||||
sound_column["column"] = "sound";
|
||||
sound_column["value"] = item.mAssetID.asString().substr(0,16);
|
||||
|
||||
list->addElement(element, ADD_BOTTOM);
|
||||
}
|
||||
|
||||
list->selectMultiple(selected_ids);
|
||||
list->setScrollPos(scroll_pos);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// static
|
||||
void NACLFloaterExploreSounds::handle_play_locally(void* user_data)
|
||||
{
|
||||
NACLFloaterExploreSounds* floater = (NACLFloaterExploreSounds*)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();
|
||||
std::vector<LLUUID> asset_list;
|
||||
for( ; selection_iter != selection_end; ++selection_iter)
|
||||
{
|
||||
LLSoundHistoryItem item = floater->getItem((*selection_iter)->getValue());
|
||||
if(item.mID.isNull()) continue;
|
||||
// Unique assets only
|
||||
if(std::find(asset_list.begin(), asset_list.end(), item.mAssetID) == asset_list.end())
|
||||
{
|
||||
asset_list.push_back(item.mAssetID);
|
||||
gAudiop->triggerSound(item.mAssetID, gAgent.getID(), 1.0f, LLAudioEngine::AUDIO_TYPE_UI);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// static
|
||||
void NACLFloaterExploreSounds::handle_look_at(void* user_data)
|
||||
{
|
||||
NACLFloaterExploreSounds* floater = (NACLFloaterExploreSounds*)user_data;
|
||||
LLScrollListCtrl* list = floater->getChild<LLScrollListCtrl>("sound_list");
|
||||
LLUUID selection = list->getSelectedValue().asUUID();
|
||||
LLSoundHistoryItem item = floater->getItem(selection); // Single item only
|
||||
if(item.mID.isNull()) return;
|
||||
|
||||
LLVector3d pos_global = item.mPosition;
|
||||
|
||||
// Try to find object position
|
||||
if(item.mSourceID.notNull())
|
||||
{
|
||||
LLViewerObject* object = gObjectList.findObject(item.mSourceID);
|
||||
if(object)
|
||||
{
|
||||
pos_global = object->getPositionGlobal();
|
||||
}
|
||||
}
|
||||
|
||||
// Move the camera
|
||||
// Find direction to self (reverse)
|
||||
LLVector3d cam = gAgent.getPositionGlobal() - pos_global;
|
||||
cam.normalize();
|
||||
// Go 4 meters back and 3 meters up
|
||||
cam *= 4.0f;
|
||||
cam += pos_global;
|
||||
cam += LLVector3d(0.f, 0.f, 3.0f);
|
||||
|
||||
gAgentCamera.setFocusOnAvatar(FALSE, FALSE);
|
||||
gAgentCamera.setCameraPosAndFocusGlobal(cam, pos_global, item.mSourceID);
|
||||
gAgentCamera.setCameraAnimating(FALSE);
|
||||
}
|
||||
|
||||
// static
|
||||
void NACLFloaterExploreSounds::handle_stop(void* user_data)
|
||||
{
|
||||
NACLFloaterExploreSounds* floater = (NACLFloaterExploreSounds*)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();
|
||||
std::vector<LLUUID> asset_list;
|
||||
for( ; selection_iter != selection_end; ++selection_iter)
|
||||
{
|
||||
LLSoundHistoryItem item = floater->getItem((*selection_iter)->getValue());
|
||||
if(item.mID.isNull()) continue;
|
||||
if(item.mPlaying)
|
||||
{
|
||||
if(item.mAudioSource)
|
||||
{
|
||||
S32 type = item.mType;
|
||||
item.mAudioSource->setType(LLAudioEngine::AUDIO_TYPE_UI);
|
||||
if(item.mAudioSource)
|
||||
item.mAudioSource->play(LLUUID::null);
|
||||
if(item.mAudioSource)
|
||||
item.mAudioSource->setType(type);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
void NACLFloaterExploreSounds::blacklistSound(void* user_data)
|
||||
{
|
||||
NACLFloaterExploreSounds* floater = (NACLFloaterExploreSounds*)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();
|
||||
std::vector<LLUUID> asset_list;
|
||||
for( ; selection_iter != selection_end; ++selection_iter)
|
||||
{
|
||||
LLSoundHistoryItem item = floater->getItem((*selection_iter)->getValue());
|
||||
if(item.mID.isNull()) continue;
|
||||
|
||||
LLSD sound_data;
|
||||
std::string agent;
|
||||
gCacheName->getFullName(item.mOwnerID, agent);
|
||||
LLViewerRegion* cur_region = gAgent.getRegion();
|
||||
|
||||
if(cur_region)
|
||||
sound_data["entry_name"] = llformat("Sound played by %s in region %s",agent.c_str(),cur_region->getName().c_str());
|
||||
else
|
||||
sound_data["entry_name"] = llformat("Sound played by %s",agent.c_str());
|
||||
sound_data["entry_type"] = (LLAssetType::EType)item.mType;
|
||||
sound_data["entry_agent"] = gAgent.getID();
|
||||
//NACLFloaterBlacklist::addEntry(item.mAssetID,sound_data); //for origonal asset blacklist
|
||||
FSWSAssetBlacklist::getInstance()->addNewItemToBlacklist(item.mAssetID,"Sometext",LLAssetType::AT_SOUND,true);
|
||||
}
|
||||
}
|
||||
|
||||
// </edit>
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
// <edit>
|
||||
|
||||
#ifndef LL_LLFLOATEREXPLORESOUNDS_H
|
||||
#define LL_LLFLOATEREXPLORESOUNDS_H
|
||||
|
||||
#include "llfloater.h"
|
||||
#include "lleventtimer.h"
|
||||
#include "llaudioengine.h"
|
||||
|
||||
class NACLFloaterExploreSounds
|
||||
: public LLFloater, public LLEventTimer
|
||||
{
|
||||
friend class LLFloaterReg;
|
||||
public:
|
||||
NACLFloaterExploreSounds(const LLSD& key);
|
||||
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_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);
|
||||
static void blacklistSound(void* user_data);
|
||||
|
||||
private:
|
||||
virtual ~NACLFloaterExploreSounds();
|
||||
std::list<LLSoundHistoryItem> mLastHistory;
|
||||
|
||||
// static stuff!
|
||||
public:
|
||||
static NACLFloaterExploreSounds* sInstance;
|
||||
|
||||
static void toggle();
|
||||
};
|
||||
|
||||
#endif
|
||||
// </edit>
|
||||
|
|
@ -175,6 +175,9 @@
|
|||
//<FS:WS asset blacklist>
|
||||
#include "fsfloaterwsassetblacklist.h"
|
||||
//</FS:WS>
|
||||
// NaCl - Sound explorer
|
||||
#include "NACLfloaterexploresounds.h"
|
||||
// NaCl End
|
||||
|
||||
// handle secondlife:///app/openfloater/{NAME} URLs
|
||||
class LLFloaterOpenHandler : public LLCommandHandler
|
||||
|
|
@ -371,6 +374,10 @@ void LLViewerFloaterReg::registerFloaters()
|
|||
// AO: Firestorm Money (tip) tracker
|
||||
LLFloaterReg::add("money_tracker", "floater_fs_money_tracker.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<FSMoneyTracker>);
|
||||
LLFloaterReg::add("quickprefs", "floater_quickprefs.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<FloaterQuickPrefs>); // Quick Preferences panel -WoLf
|
||||
|
||||
// NaC - Sound explorer
|
||||
LLFloaterReg::add("sound_explorer", "floater_NACL_explore_sounds.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<NACLFloaterExploreSounds>);
|
||||
// NaCl End
|
||||
|
||||
LLFloaterReg::add("animation_overrider", "floater_ao.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<FloaterAO>); // ## Zi: Animation Overrider
|
||||
LLFloaterReg::add("area_search", "floater_fs_area_search.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<FSAreaSearch>);
|
||||
|
|
|
|||
|
|
@ -5211,8 +5211,10 @@ void process_sound_trigger(LLMessageSystem *msg, void **)
|
|||
if ((!gSavedSettings.getBOOL("EnableGestureSounds")) &&
|
||||
(owner_id != gAgent.getID()) &&
|
||||
(owner_id == object_id)) return;
|
||||
|
||||
gAudiop->triggerSound(sound_id, owner_id, gain, LLAudioEngine::AUDIO_TYPE_SFX, pos_global);
|
||||
|
||||
// NaCl - Sound Explorer
|
||||
gAudiop->triggerSound(sound_id, owner_id, gain, LLAudioEngine::AUDIO_TYPE_SFX, pos_global, object_id);
|
||||
// NaCl End
|
||||
}
|
||||
|
||||
void process_preload_sound(LLMessageSystem *msg, void **user_data)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,22 @@
|
|||
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
|
||||
<floater can_close="true" can_minimize="true" open_centered="true" can_resize="true" height="300" width="550" min_width="550" min_height="170" name="sound_explorer" title="Sounds" save_rect="true"
|
||||
save_visibility="true"
|
||||
single_instance="true">
|
||||
<check_box follows="top|left" bottom_delta="20" 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 can_resize="true" column_padding="0" draw_heading="true" follows="all" left="10" multi_select="true" name="sound_list" search_column="0" top="40" right="-10" bottom="-60">
|
||||
<columns dynamicwidth="false" width="80" label="Playing" name="playing" />
|
||||
<columns dynamicwidth="false" width="100" label="Type" name="type" />
|
||||
<columns dynamicwidth="true" label="Owner" name="owner" />
|
||||
<columns dynamicwidth="false" width="0" label="Sound" name="sound" />
|
||||
</scroll_list>
|
||||
<button bottom_delta="25" follows="left|bottom" height="20" label="Play Locally" name="play_locally_btn" left="10" width="95"/>
|
||||
<button bottom_delta="0" follows="left|bottom" height="20" label="Play Ambient" name="play_ambient_btn" left_delta="100" width="95"/>
|
||||
<button bottom_delta="0" follows="left|bottom" height="20" label="Look At" name="look_at_btn" left_delta="100" width="95"/>
|
||||
|
||||
<button bottom_delta="0" follows="left|bottom" height="20" label="Stop" name="stop_btn" right="-10" width="95"/>
|
||||
<button bottom_delta="0" follows="left|bottom" height="20" label="Blacklist" name="bl_btn" right="-110" width="95"/>
|
||||
</floater>
|
||||
|
|
@ -986,6 +986,16 @@
|
|||
function="Floater.Toggle"
|
||||
parameter="area_search" />
|
||||
</menu_item_call>
|
||||
<menu_item_check
|
||||
label="Sound Explorer"
|
||||
name="Sound Explorer">
|
||||
<menu_item_check.on_check
|
||||
function="Floater.Visible"
|
||||
parameter="sound_explorer" />
|
||||
<menu_item_check.on_click
|
||||
function="Floater.Toggle"
|
||||
parameter="sound_explorer" />
|
||||
</menu_item_check>
|
||||
<menu_item_call
|
||||
label="Asset Blacklist"
|
||||
name="asset_blacklist">
|
||||
|
|
|
|||
Loading…
Reference in New Issue