Old VWR-14914 spin-off sound beacon patch.

This makes sound beacons green when playing at
full volume, yellow when playing at a lower volume
and red when they are muted (aka, in another parcel
that you can't hear the sounds of).

Originally this was a debug patch as muted sound
sources used to be implemented by setting the volume
to zero, which happens to use like three times more
CPU: so, having a lot of muted sound source caused
the audio thread to never release a mutex anymore
(cause it was never idle anymore), causing the main
loop to hang, waiting on that mutex - dropping the
FPS drastically. Hence it was necessary to see which
sound sources were muted for debugging purposes.
(Since VWR-14914, muted source source are not played
at all anymore, so they do not take extra CPU).

It's still fun to see this extra information though,
now the patch exists anyway.
This commit is contained in:
Aleric Inglewood
2011-05-15 02:23:13 +02:00
parent 2d648c1da0
commit 697f0ad054
4 changed files with 36 additions and 4 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

@@ -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