diff options
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/llvieweraudio.cpp | 46 | ||||
-rw-r--r-- | indra/newview/llvieweraudio.h | 7 | ||||
-rw-r--r-- | indra/newview/llviewerparcelmgr.cpp | 3 |
3 files changed, 50 insertions, 6 deletions
diff --git a/indra/newview/llvieweraudio.cpp b/indra/newview/llvieweraudio.cpp index f01fe174a4..2447f5dea8 100644 --- a/indra/newview/llvieweraudio.cpp +++ b/indra/newview/llvieweraudio.cpp @@ -38,6 +38,9 @@ #include "llviewermedia.h" #include "llprogressview.h" #include "llcallbacklist.h" +#include "llstartup.h" +#include "llviewerparcelmgr.h" +#include "llparcel.h" ///////////////////////////////////////////////////////// @@ -45,12 +48,16 @@ LLViewerAudio::LLViewerAudio() : mDone(true), mFadeState(FADE_IDLE), mFadeTime(), - mIdleListnerActive(false) + mIdleListnerActive(false), + mForcedTeleportFade(false) { + mTeleportFailedConnection = LLViewerParcelMgr::getInstance()-> + setTeleportFailedCallback(boost::bind(&LLViewerAudio::onTeleportFailed, this)); } LLViewerAudio::~LLViewerAudio() { + mTeleportFailedConnection.disconnect(); } void LLViewerAudio::registerIdleListener() @@ -108,14 +115,21 @@ void LLViewerAudio::startInternetStreamWithAutoFade(std::string streamURI) } } -// We want onIdleUpdate callback to keep firing whilst we are fading out. Once we have completed the fade -// out, we switch the stream and start a fade in, and we don't care about idle updates anymore. // A return of false from onIdleUpdate means it will be called again next idle update. // A return of true means we have finished with it and the callback will be deleted. bool LLViewerAudio::onIdleUpdate() { bool fadeIsFinished = false; + // There is a delay in the login sequence between when the parcel information has + // arrived and the music stream is started and when the audio system is called to set + // initial volume levels. This code extends the fade time so you hear a full fade in. + if ((LLStartUp::getStartupState() < STATE_STARTED)) + { + stream_fade_timer.reset(); + stream_fade_timer.setTimerExpirySec(mFadeTime); + } + if (mDone) { // This should be a rare or never occurring state. @@ -231,6 +245,18 @@ F32 LLViewerAudio::getFadeVolume() return fade_volume; } +void LLViewerAudio::onTeleportFailed() +{ + if (gAudiop) + { + LLParcel* parcel = LLViewerParcelMgr::getInstance()->getAgentParcel(); + if (parcel) + { + mNextStreamURI = parcel->getMusicURL(); + } + } +} + void init_audio() { if (!gAudiop) @@ -333,7 +359,19 @@ void audio_update_volume(bool force_update) // Streaming Music if (gAudiop) - { + { + if (progress_view_visible && !LLViewerAudio::getInstance()->getForcedTeleportFade()) + { + LLViewerAudio::getInstance()->setForcedTeleportFade(true); + LLViewerAudio::getInstance()->startInternetStreamWithAutoFade(LLStringUtil::null); + LLViewerAudio::getInstance()->setNextStreamURI(LLStringUtil::null); + } + + if (!progress_view_visible && LLViewerAudio::getInstance()->getForcedTeleportFade() == true) + { + LLViewerAudio::getInstance()->setForcedTeleportFade(false); + } + F32 music_volume = gSavedSettings.getF32("AudioLevelMusic"); BOOL music_muted = gSavedSettings.getBOOL("MuteMusic"); F32 fade_volume = LLViewerAudio::getInstance()->getFadeVolume(); diff --git a/indra/newview/llvieweraudio.h b/indra/newview/llvieweraudio.h index 26062a2818..a3da9fc6b8 100644 --- a/indra/newview/llvieweraudio.h +++ b/indra/newview/llvieweraudio.h @@ -63,6 +63,9 @@ public: EFadeState getFadeState() { return mFadeState; } bool isDone() { return mDone; }; F32 getFadeVolume(); + bool getForcedTeleportFade() { return mForcedTeleportFade; }; + void setForcedTeleportFade(bool fade) { mForcedTeleportFade = fade;} ; + void setNextStreamURI(std::string stream) { mNextStreamURI = stream; } ; private: @@ -72,10 +75,14 @@ private: EFadeState mFadeState; LLFrameTimer stream_fade_timer; bool mIdleListnerActive; + bool mForcedTeleportFade; + boost::signals2::connection mTeleportFailedConnection; void registerIdleListener(); void deregisterIdleListener() { mIdleListnerActive = false; }; void startFading(); + void onTeleportFailed(); + }; #endif //LL_VIEWER_H diff --git a/indra/newview/llviewerparcelmgr.cpp b/indra/newview/llviewerparcelmgr.cpp index c18665a3c3..7ce9672299 100644 --- a/indra/newview/llviewerparcelmgr.cpp +++ b/indra/newview/llviewerparcelmgr.cpp @@ -1729,8 +1729,7 @@ void LLViewerParcelMgr::processParcelProperties(LLMessageSystem *msg, void **use // 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. + // Then check for music if (gAudiop) { if (parcel) |