Fix sound explorer.

Looping sounds were always showing as 'Looping', even after they
stopped. Detection of stopped sounds is much better now.
Instead of only logging a sound as stopped when the audio source
is destroyed, we now detect whether or not it is associated with
an audio channel or not (the normal way to stop a sound is to set
the channel to NULL). This is still a bit fuzzy, since an
audio channel doesn't necessarily have to be playing, but states
where an audio source is associated with a non-playing audio channel
are only short temporary states that don't affect the usefulness
of the sound explorer.
This commit is contained in:
Aleric Inglewood
2011-06-03 22:51:46 +02:00
parent e3742734f0
commit 613c6755e9
3 changed files with 61 additions and 48 deletions

View File

@@ -110,9 +110,9 @@ class LLSoundHistoryItemCompare
public:
bool operator() (LLSoundHistoryItem first, LLSoundHistoryItem second)
{
if(first.mPlaying)
if(first.isPlaying())
{
if(second.mPlaying)
if(second.isPlaying())
{
return (first.mTimeStarted > second.mTimeStarted);
}
@@ -121,7 +121,7 @@ public:
return true;
}
}
else if(second.mPlaying)
else if(second.isPlaying())
{
return false;
}
@@ -205,17 +205,12 @@ BOOL LLFloaterExploreSounds::tick()
LLSD& playing_column = element["columns"][0];
playing_column["column"] = "playing";
if (item.mIsLooped)
if(item.isPlaying())
{
playing_column["value"] = " Looping";
}
else if(item.mPlaying)
{
playing_column["value"] = " Playing";
playing_column["value"] = item.mIsLooped ? " Looping" : " Playing";
}
else
{
S32 time = (LLTimer::getElapsedSeconds() - item.mTimeStopped);
S32 hours = time / 3600;
S32 mins = time / 60;
@@ -358,23 +353,15 @@ void LLFloaterExploreSounds::handle_stop(void* user_data)
{
LLSoundHistoryItem item = floater->getItem((*selection_iter)->getValue());
if(item.mID.isNull()) continue;
if(item.mPlaying)
if(item.isPlaying())
{
if(item.mAudioSource)
{
S32 type = item.mType;
item.mAudioSource->setType(LLAudioEngine::AUDIO_TYPE_UI);
if(item.mAudioSource)
item.mAudioSource->play(LLUUID::null);
if(item.mAudioSource)
item.mAudioSource->setType(type);
}
item.mAudioSource->play(LLUUID::null);
}
}
}
void LLFloaterExploreSounds::blacklistSound(void* user_data)
{
LLFloaterBlacklist::show();
LLFloaterExploreSounds* floater = (LLFloaterExploreSounds*)user_data;
LLScrollListCtrl* list = floater->getChild<LLScrollListCtrl>("sound_list");