summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llpanelnearbymedia.cpp2
-rw-r--r--indra/newview/llvieweraudio.cpp61
-rw-r--r--indra/newview/llvieweraudio.h7
-rwxr-xr-xindra/newview/llviewermessage.cpp9
-rw-r--r--indra/newview/llviewermessage.h14
-rw-r--r--indra/newview/llviewerparcelmgr.cpp9
-rw-r--r--indra/newview/llviewerparcelmgr.h6
7 files changed, 86 insertions, 22 deletions
diff --git a/indra/newview/llpanelnearbymedia.cpp b/indra/newview/llpanelnearbymedia.cpp
index c01adc3c35..a50d9074f7 100644
--- a/indra/newview/llpanelnearbymedia.cpp
+++ b/indra/newview/llpanelnearbymedia.cpp
@@ -176,7 +176,7 @@ void LLPanelNearByMedia::handleMediaAutoPlayChanged(const LLSD& newvalue)
{
// update mParcelAudioAutoStart if AUTO_PLAY_MEDIA_SETTING changes
mParcelAudioAutoStart = gSavedSettings.getBOOL(LLViewerMedia::AUTO_PLAY_MEDIA_SETTING) &&
- gSavedSettings.getBOOL("MediaTentativeAutoPlay");
+ gSavedSettings.getBOOL("MediaTentativeAutoPlay");
}
/*virtual*/
diff --git a/indra/newview/llvieweraudio.cpp b/indra/newview/llvieweraudio.cpp
index 2447f5dea8..8d8c401dac 100644
--- a/indra/newview/llvieweraudio.cpp
+++ b/indra/newview/llvieweraudio.cpp
@@ -41,6 +41,7 @@
#include "llstartup.h"
#include "llviewerparcelmgr.h"
#include "llparcel.h"
+#include "llviewermessage.h"
/////////////////////////////////////////////////////////
@@ -49,15 +50,22 @@ LLViewerAudio::LLViewerAudio() :
mFadeState(FADE_IDLE),
mFadeTime(),
mIdleListnerActive(false),
- mForcedTeleportFade(false)
+ mForcedTeleportFade(false),
+ mWasPlaying(false)
{
mTeleportFailedConnection = LLViewerParcelMgr::getInstance()->
setTeleportFailedCallback(boost::bind(&LLViewerAudio::onTeleportFailed, this));
+ mTeleportFinishedConnection = LLViewerParcelMgr::getInstance()->
+ setTeleportFinishedCallback(boost::bind(&LLViewerAudio::onTeleportFinished, this, _1, _2));
+ mTeleportStartedConnection = LLViewerMessage::getInstance()->
+ setTeleportStartedCallback(boost::bind(&LLViewerAudio::onTeleportStarted, this));
}
LLViewerAudio::~LLViewerAudio()
{
mTeleportFailedConnection.disconnect();
+ mTeleportFinishedConnection.disconnect();
+ mTeleportStartedConnection.disconnect();
}
void LLViewerAudio::registerIdleListener()
@@ -67,7 +75,6 @@ void LLViewerAudio::registerIdleListener()
mIdleListnerActive = true;
doOnIdleRepeating(boost::bind(boost::bind(&LLViewerAudio::onIdleUpdate, this)));
}
-
}
void LLViewerAudio::startInternetStreamWithAutoFade(std::string streamURI)
@@ -245,16 +252,54 @@ F32 LLViewerAudio::getFadeVolume()
return fade_volume;
}
+void LLViewerAudio::onTeleportStarted()
+{
+ if (!LLViewerAudio::getInstance()->getForcedTeleportFade())
+ {
+ // Even though the music was turned off it was starting up (with autoplay disabled) occasionally
+ // after a failed teleport or after an intra-parcel teleport. Also, the music sometimes was not
+ // restarting after a successful intra-parcel teleport. Setting mWasPlaying fixes these issues.
+ LLViewerAudio::getInstance()->setWasPlaying(!gAudiop->getInternetStreamURL().empty());
+ LLViewerAudio::getInstance()->setForcedTeleportFade(true);
+ LLViewerAudio::getInstance()->startInternetStreamWithAutoFade(LLStringUtil::null);
+ LLViewerAudio::getInstance()->setNextStreamURI(LLStringUtil::null);
+ }
+}
+
void LLViewerAudio::onTeleportFailed()
{
- if (gAudiop)
+ // Calling audio_update_volume makes sure that the music stream is properly set to be restored to
+ // its previous value
+ audio_update_volume(false);
+
+ if (gAudiop && mWasPlaying)
+ {
+ LLParcel* parcel = LLViewerParcelMgr::getInstance()->getAgentParcel();
+ if (parcel)
+ {
+ mNextStreamURI = parcel->getMusicURL();
+ llinfos << "Teleport failed -- setting music stream to " << mNextStreamURI << llendl;
+ }
+ }
+ mWasPlaying = false;
+}
+
+void LLViewerAudio::onTeleportFinished(const LLVector3d& pos, const bool& local)
+{
+ // Calling audio_update_volume makes sure that the music stream is properly set to be restored to
+ // its previous value
+ audio_update_volume(false);
+
+ if (gAudiop && local && mWasPlaying)
{
LLParcel* parcel = LLViewerParcelMgr::getInstance()->getAgentParcel();
if (parcel)
{
mNextStreamURI = parcel->getMusicURL();
+ llinfos << "Intraparcel teleport -- setting music stream to " << mNextStreamURI << llendl;
}
}
+ mWasPlaying = false;
}
void init_audio()
@@ -360,15 +405,9 @@ 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)
+ if (!progress_view_visible && LLViewerAudio::getInstance()->getForcedTeleportFade())
{
+ LLViewerAudio::getInstance()->setWasPlaying(!gAudiop->getInternetStreamURL().empty());
LLViewerAudio::getInstance()->setForcedTeleportFade(false);
}
diff --git a/indra/newview/llvieweraudio.h b/indra/newview/llvieweraudio.h
index a3da9fc6b8..8c302c6549 100644
--- a/indra/newview/llvieweraudio.h
+++ b/indra/newview/llvieweraudio.h
@@ -66,6 +66,7 @@ public:
bool getForcedTeleportFade() { return mForcedTeleportFade; };
void setForcedTeleportFade(bool fade) { mForcedTeleportFade = fade;} ;
void setNextStreamURI(std::string stream) { mNextStreamURI = stream; } ;
+ void setWasPlaying(bool playing) { mWasPlaying = playing;} ;
private:
@@ -76,13 +77,17 @@ private:
LLFrameTimer stream_fade_timer;
bool mIdleListnerActive;
bool mForcedTeleportFade;
+ bool mWasPlaying;
boost::signals2::connection mTeleportFailedConnection;
+ boost::signals2::connection mTeleportFinishedConnection;
+ boost::signals2::connection mTeleportStartedConnection;
void registerIdleListener();
void deregisterIdleListener() { mIdleListnerActive = false; };
void startFading();
void onTeleportFailed();
-
+ void onTeleportFinished(const LLVector3d& pos, const bool& local);
+ void onTeleportStarted();
};
#endif //LL_VIEWER_H
diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp
index a9bff67f40..1813611c35 100755
--- a/indra/newview/llviewermessage.cpp
+++ b/indra/newview/llviewermessage.cpp
@@ -3441,6 +3441,9 @@ void process_teleport_start(LLMessageSystem *msg, void**)
LL_DEBUGS("Messaging") << "Got TeleportStart with TeleportFlags=" << teleport_flags << ". gTeleportDisplay: " << gTeleportDisplay << ", gAgent.mTeleportState: " << gAgent.getTeleportState() << LL_ENDL;
+ // *NOTE: The server sends two StartTeleport packets when you are teleporting to a LM
+ LLViewerMessage::getInstance()->mTeleportStartedSignal();
+
if (teleport_flags & TELEPORT_FLAGS_DISABLE_CANCEL)
{
gViewerWindow->setProgressCancelButtonVisible(FALSE);
@@ -3460,11 +3463,17 @@ void process_teleport_start(LLMessageSystem *msg, void**)
make_ui_sound("UISndTeleportOut");
LL_INFOS("Messaging") << "Teleport initiated by remote TeleportStart message with TeleportFlags: " << teleport_flags << LL_ENDL;
+
// Don't call LLFirstUse::useTeleport here because this could be
// due to being killed, which would send you home, not to a Telehub
}
}
+boost::signals2::connection LLViewerMessage::setTeleportStartedCallback(teleport_started_callback_t cb)
+{
+ return mTeleportStartedSignal.connect(cb);
+}
+
void process_teleport_progress(LLMessageSystem* msg, void**)
{
LLUUID agent_id;
diff --git a/indra/newview/llviewermessage.h b/indra/newview/llviewermessage.h
index 46bfb2dad0..594c22ed9c 100644
--- a/indra/newview/llviewermessage.h
+++ b/indra/newview/llviewermessage.h
@@ -37,6 +37,9 @@
#include "llnotifications.h"
#include "llextendedstatus.h"
+#include <boost/function.hpp>
+#include <boost/signals2.hpp>
+
//
// Forward declarations
//
@@ -205,6 +208,15 @@ bool highlight_offered_object(const LLUUID& obj_id);
void set_dad_inventory_item(LLInventoryItem* inv_item, const LLUUID& into_folder_uuid);
void set_dad_inbox_object(const LLUUID& object_id);
+class LLViewerMessage : public LLSingleton<LLViewerMessage>
+{
+public:
+ typedef boost::function<void()> teleport_started_callback_t;
+ typedef boost::signals2::signal<void()> teleport_started_signal_t;
+ boost::signals2::connection setTeleportStartedCallback(teleport_started_callback_t cb);
+
+ teleport_started_signal_t mTeleportStartedSignal;
+};
class LLOfferInfo : public LLNotificationResponderInterface
{
@@ -253,5 +265,3 @@ private:
void process_feature_disabled_message(LLMessageSystem* msg, void**);
#endif
-
-
diff --git a/indra/newview/llviewerparcelmgr.cpp b/indra/newview/llviewerparcelmgr.cpp
index 9db784101d..ae9c31bfe7 100644
--- a/indra/newview/llviewerparcelmgr.cpp
+++ b/indra/newview/llviewerparcelmgr.cpp
@@ -82,7 +82,6 @@ LLPointer<LLViewerTexture> sBlockedImage;
LLPointer<LLViewerTexture> sPassImage;
// Local functions
-void optionally_start_music(const std::string& music_url);
void callback_start_music(S32 option, void* data);
void optionally_prepare_video(const LLParcel *parcelp);
void callback_prepare_video(S32 option, void* data);
@@ -1589,7 +1588,7 @@ void LLViewerParcelMgr::processParcelProperties(LLMessageSystem *msg, void **use
if (instance->mTeleportInProgress)
{
instance->mTeleportInProgress = FALSE;
- instance->mTeleportFinishedSignal(gAgent.getPositionGlobal());
+ instance->mTeleportFinishedSignal(gAgent.getPositionGlobal(), false);
}
}
}
@@ -1773,13 +1772,13 @@ void LLViewerParcelMgr::processParcelProperties(LLMessageSystem *msg, void **use
};
}
-void optionally_start_music(const std::string& music_url)
+void LLViewerParcelMgr::optionally_start_music(const std::string& music_url)
{
if (gSavedSettings.getBOOL("AudioStreamingMusic"))
{
// only play music when you enter a new parcel if the UI control for this
// was not *explicitly* stopped by the user. (part of SL-4878)
- LLPanelNearByMedia* nearby_media_panel = gStatusBar->getNearbyMediaPanel();;
+ LLPanelNearByMedia* nearby_media_panel = gStatusBar->getNearbyMediaPanel();
if ((nearby_media_panel &&
nearby_media_panel->getParcelAudioAutoStart()) ||
// or they have expressed no opinion in the UI, but have autoplay on...
@@ -2559,7 +2558,7 @@ void LLViewerParcelMgr::onTeleportFinished(bool local, const LLVector3d& new_pos
{
// Local teleport. We already have the agent parcel data.
// Emit the signal immediately.
- getInstance()->mTeleportFinishedSignal(new_pos);
+ getInstance()->mTeleportFinishedSignal(new_pos, local);
}
else
{
diff --git a/indra/newview/llviewerparcelmgr.h b/indra/newview/llviewerparcelmgr.h
index cac8d8391c..2a11549426 100644
--- a/indra/newview/llviewerparcelmgr.h
+++ b/indra/newview/llviewerparcelmgr.h
@@ -78,8 +78,8 @@ class LLViewerParcelMgr : public LLSingleton<LLViewerParcelMgr>
{
public:
- typedef boost::function<void (const LLVector3d&)> teleport_finished_callback_t;
- typedef boost::signals2::signal<void (const LLVector3d&)> teleport_finished_signal_t;
+ typedef boost::function<void (const LLVector3d&, const bool& local)> teleport_finished_callback_t;
+ typedef boost::signals2::signal<void (const LLVector3d&, const bool&)> teleport_finished_signal_t;
typedef boost::function<void()> parcel_changed_callback_t;
typedef boost::signals2::signal<void()> parcel_changed_signal_t;
@@ -275,6 +275,8 @@ public:
// *NOTE: Taken out 2005-03-21. Phoenix.
//void makeLandmarkAtSelection();
+ static void optionally_start_music(const std::string& music_url);
+
static void processParcelOverlay(LLMessageSystem *msg, void **user_data);
static void processParcelProperties(LLMessageSystem *msg, void **user_data);
static void processParcelAccessListReply(LLMessageSystem *msg, void **user);