This commit is contained in:
Beeks
2010-08-22 15:14:30 -04:00
parent 88cf144936
commit 5ce4286fd7
164 changed files with 31303 additions and 22286 deletions

View File

@@ -815,9 +815,9 @@ F64 LLAudioEngine::mapWindVecToPan(LLVector3 wind_vec)
void LLAudioEngine::triggerSound(const LLUUID &audio_uuid, const LLUUID& owner_id, const F32 gain,
// <edit>
//const S32 type, const LLVector3d &pos_global)
const S32 type, const LLVector3d &pos_global, const LLUUID source_object)
// <edit>
//const S32 type, const LLVector3d &pos_global)
const S32 type, const LLVector3d &pos_global, const LLUUID source_object)
// </edit>
{
// Create a new source (since this can't be associated with an existing source.
@@ -831,9 +831,9 @@ void LLAudioEngine::triggerSound(const LLUUID &audio_uuid, const LLUUID& owner_i
LLUUID source_id;
source_id.generate();
// <edit>
//LLAudioSource *asp = new LLAudioSource(source_id, owner_id, gain, type);
LLAudioSource *asp = new LLAudioSource(source_id, owner_id, gain, type, source_object, true);
// <edit>
//LLAudioSource *asp = new LLAudioSource(source_id, owner_id, gain, type);
LLAudioSource *asp = new LLAudioSource(source_id, owner_id, gain, type, source_object, true);
// </edit>
gAudiop->addAudioSource(asp);
if (pos_global.isExactlyZero())
@@ -1261,9 +1261,9 @@ void LLAudioEngine::assetCallback(LLVFS *vfs, const LLUUID &uuid, LLAssetType::E
//
// <edit>
//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)
// <edit>
//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)
// </edit>
: mID(id),
mOwnerID(owner_id),
@@ -1277,9 +1277,9 @@ LLAudioSource::LLAudioSource(const LLUUID& id, const LLUUID& owner_id, const F32
mQueueSounds(false),
mPlayedOnce(false),
mType(type),
// <edit>
mSourceID(source_id),
mIsTrigger(isTrigger),
// <edit>
mSourceID(source_id),
mIsTrigger(isTrigger),
// </edit>
mChannelp(NULL),
mCurrentDatap(NULL),
@@ -1299,9 +1299,9 @@ LLAudioSource::~LLAudioSource()
mChannelp->setSource(NULL);
mChannelp = NULL;
}
// <edit>
if(mType != LLAudioEngine::AUDIO_TYPE_UI) // && mSourceID.notNull())
logSoundStop(mLogID);
// <edit>
if(mType != LLAudioEngine::AUDIO_TYPE_UI) // && mSourceID.notNull())
logSoundStop(mLogID);
// </edit>
}
@@ -1391,9 +1391,9 @@ bool LLAudioSource::setupChannel()
bool LLAudioSource::play(const LLUUID &audio_uuid)
{
// <edit>
if(mType != LLAudioEngine::AUDIO_TYPE_UI) //&& mSourceID.notNull())
logSoundPlay(mLogID, this, mPositionGlobal, mType, audio_uuid, mOwnerID, mSourceID, mIsTrigger, mLoop); // is mID okay for source id?
// <edit>
if(mType != LLAudioEngine::AUDIO_TYPE_UI) //&& mSourceID.notNull())
logSoundPlay(mLogID, this, mPositionGlobal, mType, audio_uuid, mOwnerID, mSourceID, mIsTrigger, mLoop); // is mID okay for source id?
// </edit>
// Special abuse of play(); don't play a sound, but kill it.
if (audio_uuid.isNull())
@@ -1795,67 +1795,66 @@ bool LLAudioData::load()
return true;
}
// <edit>
std::map<LLUUID, LLSoundHistoryItem> gSoundHistory;
// static
void 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 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 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);
}
}
}
// </edit>
// <edit>
std::map<LLUUID, LLSoundHistoryItem> gSoundHistory;
// static
void 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 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 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);
}
}
}
// </edit>