No more dynamic memory, and indent fixes.
parent
e06391734c
commit
60043a093d
|
|
@ -832,9 +832,9 @@ F64 LLAudioEngine::mapWindVecToPan(LLVector3 wind_vec)
|
|||
|
||||
|
||||
void LLAudioEngine::triggerSound(const LLUUID &audio_uuid, const LLUUID& owner_id, const F32 gain,
|
||||
// / <FS:Testy> Optional parameter for setting the audio source UUID
|
||||
// / <FS:Testy> Optional parameter for setting the audio source UUID
|
||||
// const S32 type, const LLVector3d &pos_global, const LLUUID& source_object)
|
||||
const S32 type, const LLVector3d &pos_global, const LLUUID& source_object, const LLUUID& audio_source_id)
|
||||
const S32 type, const LLVector3d &pos_global, const LLUUID& source_object, const LLUUID& audio_source_id)
|
||||
{
|
||||
// Create a new source (since this can't be associated with an existing source.
|
||||
//LL_INFOS() << "Localized: " << audio_uuid << LL_ENDL;
|
||||
|
|
@ -845,14 +845,14 @@ void LLAudioEngine::triggerSound(const LLUUID &audio_uuid, const LLUUID& owner_i
|
|||
return;
|
||||
}
|
||||
|
||||
// <FS:Testy> Only generate the id if one wasn't passed to the method
|
||||
//LLUUID source_id;
|
||||
//source_id.generate();
|
||||
LLUUID source_id = audio_source_id;
|
||||
if (source_id.isNull())
|
||||
{
|
||||
source_id.generate();
|
||||
}
|
||||
// <FS:Testy> Only generate the id if one wasn't passed to the method
|
||||
//LLUUID source_id;
|
||||
//source_id.generate();
|
||||
LLUUID source_id = audio_source_id;
|
||||
if (source_id.isNull())
|
||||
{
|
||||
source_id.generate();
|
||||
}
|
||||
|
||||
LLAudioSource *asp = new LLAudioSource(source_id, owner_id, gain, type, source_object, true);
|
||||
addAudioSource(asp);
|
||||
|
|
|
|||
|
|
@ -150,10 +150,10 @@ public:
|
|||
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,
|
||||
// <FS:Testy> Optional parameter for setting the audio source UUID
|
||||
// const LLUUID& source_object = LLUUID::null);
|
||||
const LLUUID& source_object = LLUUID::null,
|
||||
const LLUUID& audio_source_id = LLUUID::null);
|
||||
// <FS:Testy> Optional parameter for setting the audio source UUID
|
||||
// const LLUUID& source_object = LLUUID::null);
|
||||
const LLUUID& source_object = LLUUID::null,
|
||||
const LLUUID& audio_source_id = LLUUID::null);
|
||||
|
||||
// NaCl End
|
||||
void triggerSound(SoundData& soundData);
|
||||
|
|
|
|||
|
|
@ -64,13 +64,7 @@ NACLFloaterExploreSounds::~NACLFloaterExploreSounds()
|
|||
}
|
||||
mBlacklistAvatarNameCacheConnections.clear();
|
||||
|
||||
uuid_list_t::iterator audio_source_id_iter = mLocalPlayingAudioSourceIDs.begin();
|
||||
uuid_list_t::iterator audio_source_id_end = mLocalPlayingAudioSourceIDs.end();
|
||||
for (; audio_source_id_iter != audio_source_id_end; ++audio_source_id_iter)
|
||||
{
|
||||
delete *audio_source_id_iter;
|
||||
}
|
||||
mLocalPlayingAudioSourceIDs.clear();
|
||||
mLocalPlayingAudioSourceIDs.clear();
|
||||
}
|
||||
|
||||
BOOL NACLFloaterExploreSounds::postBuild()
|
||||
|
|
@ -79,7 +73,7 @@ BOOL NACLFloaterExploreSounds::postBuild()
|
|||
getChild<LLButton>("look_at_btn")->setClickedCallback(boost::bind(&NACLFloaterExploreSounds::handleLookAt, this));
|
||||
getChild<LLButton>("stop_btn")->setClickedCallback(boost::bind(&NACLFloaterExploreSounds::handleStop, this));
|
||||
getChild<LLButton>("bl_btn")->setClickedCallback(boost::bind(&NACLFloaterExploreSounds::blacklistSound, this));
|
||||
getChild<LLButton>("stop_locally_btn")->setClickedCallback(boost::bind(&NACLFloaterExploreSounds::handleStopLocally, this));
|
||||
getChild<LLButton>("stop_locally_btn")->setClickedCallback(boost::bind(&NACLFloaterExploreSounds::handleStopLocally, this));
|
||||
|
||||
mHistoryScroller = getChild<LLScrollListCtrl>("sound_list");
|
||||
mHistoryScroller->setCommitCallback(boost::bind(&NACLFloaterExploreSounds::handleSelection, this));
|
||||
|
|
@ -305,31 +299,31 @@ BOOL NACLFloaterExploreSounds::tick()
|
|||
mHistoryScroller->selectMultiple(selected_ids);
|
||||
mHistoryScroller->setScrollPos(scroll_pos);
|
||||
|
||||
// Clean up stopped local audio source IDs
|
||||
typedef std::vector<LLUUID*> uuid_vector_t;
|
||||
uuid_vector_t stopped_audio_src_ids;
|
||||
uuid_list_t::iterator audio_src_id_iter = mLocalPlayingAudioSourceIDs.begin();
|
||||
uuid_list_t::iterator audio_src_id_end = mLocalPlayingAudioSourceIDs.end();
|
||||
for (; audio_src_id_iter != audio_src_id_end; ++audio_src_id_iter)
|
||||
{
|
||||
LLUUID* audio_src_id = *audio_src_id_iter;
|
||||
LLAudioSource* audio_source = gAudiop->findAudioSource(*audio_src_id);
|
||||
if (!audio_source || audio_source->isDone())
|
||||
{
|
||||
stopped_audio_src_ids.push_back(audio_src_id);
|
||||
}
|
||||
}
|
||||
// Clean up stopped local audio source IDs
|
||||
uuid_vec_t stopped_audio_src_ids;
|
||||
uuid_vec_t::iterator audio_src_id_iter = mLocalPlayingAudioSourceIDs.begin();
|
||||
uuid_vec_t::iterator audio_src_id_end = mLocalPlayingAudioSourceIDs.end();
|
||||
for (; audio_src_id_iter != audio_src_id_end; ++audio_src_id_iter)
|
||||
{
|
||||
LLUUID audio_src_id = *audio_src_id_iter;
|
||||
LLAudioSource* audio_source = gAudiop->findAudioSource(audio_src_id);
|
||||
if (!audio_source || audio_source->isDone())
|
||||
{
|
||||
stopped_audio_src_ids.push_back(audio_src_id);
|
||||
}
|
||||
}
|
||||
|
||||
uuid_vector_t::iterator stopped_audio_src_ids_iter = stopped_audio_src_ids.begin();
|
||||
uuid_vector_t::iterator stopped_audio_src_ids_end = stopped_audio_src_ids.end();
|
||||
for (; stopped_audio_src_ids_iter != stopped_audio_src_ids_end; ++stopped_audio_src_ids_iter)
|
||||
{
|
||||
LLUUID* audio_src_id = *stopped_audio_src_ids_iter;
|
||||
mLocalPlayingAudioSourceIDs.remove(audio_src_id);
|
||||
delete audio_src_id;
|
||||
}
|
||||
for (uuid_vec_t::iterator stopped_audio_src_ids_iter = stopped_audio_src_ids.begin();
|
||||
stopped_audio_src_ids_iter != stopped_audio_src_ids.end(); ++stopped_audio_src_ids_iter)
|
||||
{
|
||||
uuid_vec_t::iterator find_iter = std::find(mLocalPlayingAudioSourceIDs.begin(), mLocalPlayingAudioSourceIDs.end(), *stopped_audio_src_ids_iter);
|
||||
if (find_iter != mLocalPlayingAudioSourceIDs.end())
|
||||
{
|
||||
mLocalPlayingAudioSourceIDs.erase(find_iter);
|
||||
}
|
||||
}
|
||||
|
||||
childSetEnabled("stop_locally_btn", mLocalPlayingAudioSourceIDs.size() > 0);
|
||||
childSetEnabled("stop_locally_btn", mLocalPlayingAudioSourceIDs.size() > 0);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
|
@ -348,14 +342,13 @@ void NACLFloaterExploreSounds::handlePlayLocally()
|
|||
if(std::find(asset_list.begin(), asset_list.end(), item.mAssetID) == asset_list.end())
|
||||
{
|
||||
asset_list.push_back(item.mAssetID);
|
||||
LLUUID* audio_source_id = new LLUUID();
|
||||
audio_source_id->generate();
|
||||
gAudiop->triggerSound(item.mAssetID, gAgent.getID(), 1.0f, LLAudioEngine::AUDIO_TYPE_UI, LLVector3d::zero, LLUUID::null, *audio_source_id);
|
||||
mLocalPlayingAudioSourceIDs.push_back(audio_source_id);
|
||||
LLUUID audio_source_id = LLUUID::generateNewID();
|
||||
gAudiop->triggerSound(item.mAssetID, gAgent.getID(), 1.0f, LLAudioEngine::AUDIO_TYPE_UI, LLVector3d::zero, LLUUID::null, audio_source_id);
|
||||
mLocalPlayingAudioSourceIDs.push_back(audio_source_id);
|
||||
}
|
||||
}
|
||||
|
||||
childSetEnabled("stop_locally_btn", mLocalPlayingAudioSourceIDs.size() > 0);
|
||||
childSetEnabled("stop_locally_btn", mLocalPlayingAudioSourceIDs.size() > 0);
|
||||
}
|
||||
|
||||
void NACLFloaterExploreSounds::handleLookAt()
|
||||
|
|
@ -426,21 +419,19 @@ void NACLFloaterExploreSounds::handleStop()
|
|||
|
||||
void NACLFloaterExploreSounds::handleStopLocally()
|
||||
{
|
||||
uuid_list_t::iterator audio_source_id_iter = mLocalPlayingAudioSourceIDs.begin();
|
||||
uuid_list_t::iterator audio_source_id_end = mLocalPlayingAudioSourceIDs.end();
|
||||
for (; audio_source_id_iter != audio_source_id_end; ++audio_source_id_iter)
|
||||
{
|
||||
LLUUID* audio_source_id = *audio_source_id_iter;
|
||||
LLAudioSource* audio_source = gAudiop->findAudioSource(*audio_source_id);
|
||||
if (audio_source && !audio_source->isDone())
|
||||
{
|
||||
audio_source->play(LLUUID::null);
|
||||
}
|
||||
uuid_vec_t::iterator audio_source_id_iter = mLocalPlayingAudioSourceIDs.begin();
|
||||
uuid_vec_t::iterator audio_source_id_end = mLocalPlayingAudioSourceIDs.end();
|
||||
for (; audio_source_id_iter != audio_source_id_end; ++audio_source_id_iter)
|
||||
{
|
||||
LLUUID audio_source_id = *audio_source_id_iter;
|
||||
LLAudioSource* audio_source = gAudiop->findAudioSource(audio_source_id);
|
||||
if (audio_source && !audio_source->isDone())
|
||||
{
|
||||
audio_source->play(LLUUID::null);
|
||||
}
|
||||
}
|
||||
|
||||
delete audio_source_id;
|
||||
}
|
||||
|
||||
mLocalPlayingAudioSourceIDs.clear();
|
||||
mLocalPlayingAudioSourceIDs.clear();
|
||||
}
|
||||
|
||||
//add sound to blacklist
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ private:
|
|||
void handlePlayLocally();
|
||||
void handleLookAt();
|
||||
void handleStop();
|
||||
void handleStopLocally();
|
||||
void handleStopLocally();
|
||||
void handleSelection();
|
||||
void blacklistSound();
|
||||
|
||||
|
|
@ -42,8 +42,7 @@ private:
|
|||
|
||||
std::list<LLSoundHistoryItem> mLastHistory;
|
||||
|
||||
typedef std::list<LLUUID*> uuid_list_t;
|
||||
uuid_list_t mLocalPlayingAudioSourceIDs;
|
||||
uuid_vec_t mLocalPlayingAudioSourceIDs;
|
||||
|
||||
typedef std::map<LLUUID, boost::signals2::connection> blacklist_avatar_name_cache_connection_map_t;
|
||||
blacklist_avatar_name_cache_connection_map_t mBlacklistAvatarNameCacheConnections;
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@
|
|||
<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" enabled="false"/>
|
||||
<button bottom_delta="0" follows="left|bottom" height="20" label="Stop Locally" name="stop_locally_btn" left_delta="100" width="95" enabled="false"/>
|
||||
<button bottom_delta="0" follows="left|bottom" height="20" label="Stop Locally" name="stop_locally_btn" left_delta="100" width="95" enabled="false"/>
|
||||
<button bottom_delta="0" follows="left|bottom" height="20" label="Look At" name="look_at_btn" left_delta="100" width="95" enabled="false"/>
|
||||
|
||||
<button bottom_delta="0" follows="left|bottom" height="20" label="Stop" name="stop_btn" right="-10" width="95" enabled="false"/>
|
||||
|
|
|
|||
Loading…
Reference in New Issue