summaryrefslogtreecommitdiff
path: root/indra/newview/llviewerparcelmgr.cpp
diff options
context:
space:
mode:
authorJonathan Yap <none@none>2011-10-28 17:48:24 -0400
committerJonathan Yap <none@none>2011-10-28 17:48:24 -0400
commit4cdf3961253b49093bf3e2fceda0099cedef4295 (patch)
tree8854004b22e6a8dcd980d30d84bd94c96f67f2eb /indra/newview/llviewerparcelmgr.cpp
parent1b173ed82b65c7bb5f5d5294847a721b64f8cf35 (diff)
STORM-591 As a music fan, I want audio to fade in gently so my immersion is increased
Co-written with Robin Cornelius
Diffstat (limited to 'indra/newview/llviewerparcelmgr.cpp')
-rw-r--r--indra/newview/llviewerparcelmgr.cpp55
1 files changed, 27 insertions, 28 deletions
diff --git a/indra/newview/llviewerparcelmgr.cpp b/indra/newview/llviewerparcelmgr.cpp
index 8db72da1ee..928a84e7eb 100644
--- a/indra/newview/llviewerparcelmgr.cpp
+++ b/indra/newview/llviewerparcelmgr.cpp
@@ -67,6 +67,7 @@
#include "llworld.h"
#include "roles_constants.h"
#include "llweb.h"
+#include "llvieweraudio.h"
const F32 PARCEL_COLLISION_DRAW_SECS = 1.f;
@@ -1725,7 +1726,11 @@ void LLViewerParcelMgr::processParcelProperties(LLMessageSystem *msg, void **use
}
else
{
- // look for music.
+ // Check for video
+ LLViewerParcelMedia::update( parcel );
+
+ // Then check for music. Do this last, as there may be a delay waiting for
+ // the stream fading thread to finish.
if (gAudiop)
{
if (parcel)
@@ -1736,46 +1741,36 @@ void LLViewerParcelMgr::processParcelProperties(LLMessageSystem *msg, void **use
std::string music_url = music_url_raw;
LLStringUtil::trim(music_url);
- // On entering a new parcel, stop the last stream if the
- // new parcel has a different music url. (Empty URL counts
- // as different.)
const std::string& stream_url = gAudiop->getInternetStreamURL();
- if (music_url.empty() || music_url != stream_url)
+ // If there is a new music URL and it's valid, play it.
+ if (music_url.size() > 12)
{
- // URL is different from one currently playing.
- gAudiop->stopInternetStream();
-
- // If there is a new music URL and it's valid, play it.
- if (music_url.size() > 12)
+ if (music_url.substr(0,7) == "http://")
{
- if (music_url.substr(0,7) == "http://")
- {
- optionally_start_music(music_url);
- }
- else
- {
- llinfos << "Stopping parcel music (invalid audio stream URL)" << llendl;
- // clears the URL
- gAudiop->startInternetStream(LLStringUtil::null);
- }
+ optionally_start_music(music_url);
}
- else if (!gAudiop->getInternetStreamURL().empty())
+ else
{
- llinfos << "Stopping parcel music (parcel stream URL is empty)" << llendl;
- gAudiop->startInternetStream(LLStringUtil::null);
+ llinfos << "Stopping parcel music (invalid audio stream URL)" << llendl;
+ // clears the URL
+ // null value causes fade out
+ LLViewerAudio::getInstance()->startInternetStreamWithAutoFade(LLStringUtil::null);
}
}
+ else if (!gAudiop->getInternetStreamURL().empty())
+ {
+ llinfos << "Stopping parcel music (parcel stream URL is empty)" << llendl;
+ // null value causes fade out
+ LLViewerAudio::getInstance()->startInternetStreamWithAutoFade(LLStringUtil::null);
+ }
}
else
{
// Public land has no music
- gAudiop->stopInternetStream();
+ LLViewerAudio::getInstance()->stopInternetStreamWithAutoFade();
}
}//if gAudiop
-
- // now check for video
- LLViewerParcelMedia::update( parcel );
};
}
@@ -1794,7 +1789,11 @@ void optionally_start_music(const std::string& music_url)
gSavedSettings.getBOOL("MediaTentativeAutoPlay")))
{
llinfos << "Starting parcel music " << music_url << llendl;
- gAudiop->startInternetStream(music_url);
+ LLViewerAudio::getInstance()->startInternetStreamWithAutoFade(music_url);
+ }
+ else
+ {
+ LLViewerAudio::getInstance()->startInternetStreamWithAutoFade(LLStringUtil::null);
}
}
}