This commit is contained in:
Shyotl
2011-05-14 22:31:35 -05:00
5 changed files with 69 additions and 6 deletions

View File

@@ -337,6 +337,7 @@ public:
friend class LLAudioChannel;
protected:
void setChannel(LLAudioChannel *channelp);
public:
LLAudioChannel *getChannel() const { return mChannelp; }
protected:
@@ -430,17 +431,22 @@ public:
friend class LLAudioEngine;
friend class LLAudioSource;
protected:
virtual void play() = 0;
virtual void playSynced(LLAudioChannel *channelp) = 0;
virtual void cleanup() = 0;
void setWaiting(bool waiting) { mWaiting = waiting; }
public:
virtual bool isPlaying() = 0;
void setWaiting(const bool waiting) { mWaiting = waiting; }
bool isWaiting() const { return mWaiting; }
protected:
virtual bool updateBuffer(); // Check to see if the buffer associated with the source changed, and update if necessary.
virtual void update3DPosition() = 0;
virtual void updateLoop() = 0; // Update your loop/completion status, for use by queueing/syncing.
protected:
LLAudioSource *mCurrentSourcep;
LLAudioBuffer *mCurrentBufferp;

View File

@@ -51,6 +51,14 @@ template<typename T> struct AIReadAccess;
template<typename T> struct AIWriteAccess;
template<typename T> struct AIAccess;
#if LL_WINDOWS
template<typename T> class AIThreadSafeBits;
template<typename T>
struct AIThreadSafeWindowsHack {
AIThreadSafeWindowsHack(AIThreadSafeBits<T>& var, T* object);
};
#endif
template<typename T>
class AIThreadSafeBits
{
@@ -73,6 +81,9 @@ public:
void* memory() const { return const_cast<long*>(&mMemory[0]); }
protected:
#if LL_WINDOWS
template<typename T2> friend struct AIThreadSafeWindowsHack;
#endif
// Accessors.
T const* ptr() const { return reinterpret_cast<T const*>(mMemory); }
T* ptr() { return reinterpret_cast<T*>(mMemory); }
@@ -168,7 +179,12 @@ protected:
public:
// Only for use by AITHREADSAFE, see below.
AIThreadSafe(T* object) { llassert(object == AIThreadSafeBits<T>::ptr()); }
AIThreadSafe(T* object)
{
#if !LL_WINDOWS
llassert(object == AIThreadSafeBits<T>::ptr());
#endif
}
};
/**
@@ -191,7 +207,18 @@ public:
* Note: This macro does not allow to allocate such object on the heap.
* If that is needed, have a look at AIThreadSafeDC.
*/
#if LL_WINDOWS
template<typename T>
AIThreadSafeWindowsHack<T>::AIThreadSafeWindowsHack(AIThreadSafeBits<T>& var, T* object)
{
llassert(object == var.ptr());
}
#define AITHREADSAFE(type, var, paramlist) \
AIThreadSafe<type> var(NULL); \
AIThreadSafeWindowsHack<type> dummy_##var(var, new (var.memory()) type paramlist)
#else
#define AITHREADSAFE(type, var, paramlist) AIThreadSafe<type> var(new (var.memory()) type paramlist)
#endif
/**
* @brief A wrapper class for objects that need to be accessed by more than one thread.
@@ -278,7 +305,11 @@ struct AIReadAccessConst
protected:
//! Constructor used by AIReadAccess.
AIReadAccessConst(AIThreadSafe<T>& wrapper, state_type state)
: mWrapper(wrapper), mState(state) { }
: mWrapper(wrapper), mState(state)
#if AI_NEED_ACCESS_CC
, mIsCopyConstructed(false)
#endif
{ }
AIThreadSafe<T>& mWrapper; //!< Reference to the object that we provide access to.
state_type const mState; //!< The lock state that mWrapper is in.

View File

@@ -980,6 +980,7 @@ void LLViewerObjectList::cleanDeadObjects(BOOL use_timer)
// No dead objects, don't need to scan object list.
return;
}
llwarns << "ENTERING LLViewerObjectList::cleanDeadObjects" << llendl;
S32 num_removed = 0;
LLViewerObject *objectp;
@@ -1008,6 +1009,7 @@ void LLViewerObjectList::cleanDeadObjects(BOOL use_timer)
// before blowing away the dead list.
mDeadObjects.clear();
mNumDeadObjects = 0;
llwarns << "LEAVING LLViewerObjectList::cleanDeadObjects" << llendl;
}
void LLViewerObjectList::updateActive(LLViewerObject *objectp)

View File

@@ -553,7 +553,7 @@ public:
}
if (LLPipeline::getRenderSoundBeacons(NULL))
{
addText(xpos, ypos, "Viewing sound beacons (yellow)");
addText(xpos, ypos, "Viewing sound beacons (blue/cyan/green/yellow/red)");
ypos += y_inc;
}
}

View File

@@ -2548,8 +2548,32 @@ void LLPipeline::postSort(LLCamera& camera)
LLVector3 pos = gAgent.getPosAgentFromGlobal(pos_global);
if (gPipeline.sRenderBeacons)
{
//pos += LLVector3(0.f, 0.f, 0.2f);
gObjectList.addDebugBeacon(pos, "", LLColor4(1.f, 1.f, 0.f, 0.5f), LLColor4(1.f, 1.f, 1.f, 0.5f), gSavedSettings.getS32("DebugBeaconLineWidth"));
LLAudioChannel* channel = sourcep->getChannel();
bool const is_playing = channel && channel->isPlaying();
S32 width = 2;
LLColor4 color = LLColor4(0.f, 0.f, 1.f, 0.5f);
if (is_playing)
{
llassert(!sourcep->isMuted());
F32 gain = sourcep->getGain() * channel->getSecondaryGain();
if (gain == 0.f)
{
color = LLColor4(1.f, 0.f, 0.f, 0.5f);
}
else if (gain == 1.f)
{
color = LLColor4(0.f, 1.f, 0.f, 0.5f);
width = gSavedSettings.getS32("DebugBeaconLineWidth");
}
else
{
color = LLColor4(1.f, 1.f, 0.f, 0.5f);
width = 1 + gain * (gSavedSettings.getS32("DebugBeaconLineWidth") - 1);
}
}
else if (sourcep->isMuted())
color = LLColor4(0.f, 1.f, 1.f, 0.5f);
gObjectList.addDebugBeacon(pos, "", color, LLColor4(1.f, 1.f, 1.f, 0.5f), width);
}
}
// now deal with highlights for all those seeable sound sources