f
This commit is contained in:
@@ -251,24 +251,24 @@ BOOL LLVorbisDecodeState::initDecode()
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// <edit>
|
||||
try
|
||||
{
|
||||
// </edit>
|
||||
mWAVBuffer.reserve(size_guess);
|
||||
mWAVBuffer.resize(WAV_HEADER_SIZE);
|
||||
// <edit>
|
||||
}
|
||||
catch(std::bad_alloc)
|
||||
{
|
||||
llwarns << "bad_alloc" << llendl;
|
||||
if(mInFilep)
|
||||
{
|
||||
// <edit>
|
||||
try
|
||||
{
|
||||
// </edit>
|
||||
mWAVBuffer.reserve(size_guess);
|
||||
mWAVBuffer.resize(WAV_HEADER_SIZE);
|
||||
// <edit>
|
||||
}
|
||||
catch(std::bad_alloc)
|
||||
{
|
||||
llwarns << "bad_alloc" << llendl;
|
||||
if(mInFilep)
|
||||
{
|
||||
delete mInFilep;
|
||||
mInFilep = NULL;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
// </edit>
|
||||
|
||||
{
|
||||
@@ -442,9 +442,9 @@ BOOL LLVorbisDecodeState::finishDecode()
|
||||
char pcmout[4096]; /*Flawfinder: ignore*/
|
||||
|
||||
fade_length = llmin((S32)128,(S32)(data_length-36)/8);
|
||||
// <edit>
|
||||
//if((S32)mWAVBuffer.size() >= (WAV_HEADER_SIZE + 2* fade_length))
|
||||
if((S32)mWAVBuffer.size() > (WAV_HEADER_SIZE + 2* fade_length))
|
||||
// <edit>
|
||||
//if((S32)mWAVBuffer.size() >= (WAV_HEADER_SIZE + 2* fade_length))
|
||||
if((S32)mWAVBuffer.size() > (WAV_HEADER_SIZE + 2* fade_length))
|
||||
// </edit>
|
||||
{
|
||||
memcpy(pcmout, &mWAVBuffer[WAV_HEADER_SIZE], (2 * fade_length)); /*Flawfinder: ignore*/
|
||||
@@ -464,9 +464,9 @@ BOOL LLVorbisDecodeState::finishDecode()
|
||||
memcpy(&mWAVBuffer[WAV_HEADER_SIZE], pcmout, (2 * fade_length)); /*Flawfinder: ignore*/
|
||||
}
|
||||
S32 near_end = mWAVBuffer.size() - (2 * fade_length);
|
||||
// <edit>
|
||||
//if ((S32)mWAVBuffer.size() >= ( near_end + 2* fade_length))
|
||||
if ((S32)mWAVBuffer.size() > ( near_end + 2* fade_length))
|
||||
// <edit>
|
||||
//if ((S32)mWAVBuffer.size() >= ( near_end + 2* fade_length))
|
||||
if ((S32)mWAVBuffer.size() > ( near_end + 2* fade_length))
|
||||
// </edit>
|
||||
{
|
||||
memcpy(pcmout, &mWAVBuffer[near_end], (2 * fade_length)); /*Flawfinder: ignore*/
|
||||
@@ -566,17 +566,17 @@ void LLAudioDecodeMgr::Impl::processQueue(const F32 num_secs)
|
||||
{
|
||||
if (mCurrentDecodep)
|
||||
{
|
||||
// <edit> rawrning
|
||||
//BOOL res;
|
||||
BOOL res = false;
|
||||
// <edit> rawrning
|
||||
//BOOL res;
|
||||
BOOL res = false;
|
||||
// </edit>
|
||||
|
||||
// Decode in a loop until we're done or have run out of time.
|
||||
/* <edit> */ try{ /* </edit> */
|
||||
while(!(res = mCurrentDecodep->decodeSection()) && (decode_timer.getElapsedTimeF32() < num_secs))
|
||||
{
|
||||
// decodeSection does all of the work above
|
||||
}
|
||||
/* <edit> */ try{ /* </edit> */
|
||||
while(!(res = mCurrentDecodep->decodeSection()) && (decode_timer.getElapsedTimeF32() < num_secs))
|
||||
{
|
||||
// decodeSection does all of the work above
|
||||
}
|
||||
/* <edit> */ }catch(std::bad_alloc){llerrs<<"bad_alloc whilst decoding"<<llendl;} /* </edit> */
|
||||
|
||||
if (mCurrentDecodep->isDone() && !mCurrentDecodep->isValid())
|
||||
@@ -692,6 +692,4 @@ BOOL LLAudioDecodeMgr::addDecodeRequest(const LLUUID &uuid)
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -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>
|
||||
|
||||
@@ -139,10 +139,10 @@ public:
|
||||
// Owner ID is the owner of the object making the request
|
||||
void triggerSound(const LLUUID &sound_id, const LLUUID& owner_id, const F32 gain,
|
||||
const S32 type = LLAudioEngine::AUDIO_TYPE_NONE,
|
||||
// <edit>
|
||||
//const LLVector3d &pos_global = LLVector3d::zero);
|
||||
const LLVector3d &pos_global = LLVector3d::zero,
|
||||
const LLUUID source_object = LLUUID::null);
|
||||
// <edit>
|
||||
//const LLVector3d &pos_global = LLVector3d::zero);
|
||||
const LLVector3d &pos_global = LLVector3d::zero,
|
||||
const LLUUID source_object = LLUUID::null);
|
||||
// </edit>
|
||||
bool preloadSound(const LLUUID &id);
|
||||
|
||||
@@ -265,9 +265,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
|
||||
// <edit>
|
||||
//LLAudioSource(const LLUUID &id, const LLUUID& owner_id, const F32 gain, const S32 type = LLAudioEngine::AUDIO_TYPE_NONE);
|
||||
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);
|
||||
// <edit>
|
||||
//LLAudioSource(const LLUUID &id, const LLUUID& owner_id, const F32 gain, const S32 type = LLAudioEngine::AUDIO_TYPE_NONE);
|
||||
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);
|
||||
// </edit>
|
||||
virtual ~LLAudioSource();
|
||||
|
||||
@@ -308,8 +308,8 @@ public:
|
||||
virtual void setGain(const F32 gain) { mGain = llclamp(gain, 0.f, 1.f); }
|
||||
|
||||
const LLUUID &getID() const { return mID; }
|
||||
// <edit>
|
||||
const LLUUID &getLogID() const { return mLogID; }
|
||||
// <edit>
|
||||
const LLUUID &getLogID() const { return mLogID; }
|
||||
// </edit>
|
||||
bool isDone() const;
|
||||
bool isMuted() const { return mSourceMuted; }
|
||||
@@ -344,10 +344,10 @@ protected:
|
||||
S32 mType;
|
||||
LLVector3d mPositionGlobal;
|
||||
LLVector3 mVelocity;
|
||||
// <edit>
|
||||
LLUUID mLogID;
|
||||
LLUUID mSourceID;
|
||||
bool mIsTrigger;
|
||||
// <edit>
|
||||
LLUUID mLogID;
|
||||
LLUUID mSourceID;
|
||||
bool mIsTrigger;
|
||||
// </edit>
|
||||
|
||||
//LLAudioSource *mSyncMasterp; // If we're a slave, the source that we're synced to.
|
||||
@@ -467,32 +467,32 @@ protected:
|
||||
|
||||
extern LLAudioEngine* gAudiop;
|
||||
|
||||
// <edit>
|
||||
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;
|
||||
|
||||
extern void logSoundPlay(LLUUID id, LLAudioSource* audio_source, LLVector3d position, S32 type, LLUUID assetid, LLUUID ownerid, LLUUID sourceid, bool is_trigger, bool is_looped);
|
||||
extern void logSoundStop(LLUUID id);
|
||||
extern void pruneSoundLog();
|
||||
extern int gSoundHistoryPruneCounter;
|
||||
|
||||
// <edit>
|
||||
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;
|
||||
|
||||
extern void logSoundPlay(LLUUID id, LLAudioSource* audio_source, LLVector3d position, S32 type, LLUUID assetid, LLUUID ownerid, LLUUID sourceid, bool is_trigger, bool is_looped);
|
||||
extern void logSoundStop(LLUUID id);
|
||||
extern void pruneSoundLog();
|
||||
extern int gSoundHistoryPruneCounter;
|
||||
|
||||
// </edit>
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user