summaryrefslogtreecommitdiff
path: root/indra/newview/llvieweraudio.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llvieweraudio.cpp')
-rwxr-xr-xindra/newview/llvieweraudio.cpp83
1 files changed, 52 insertions, 31 deletions
diff --git a/indra/newview/llvieweraudio.cpp b/indra/newview/llvieweraudio.cpp
index 826d296117..7ce9d858dd 100755
--- a/indra/newview/llvieweraudio.cpp
+++ b/indra/newview/llvieweraudio.cpp
@@ -37,6 +37,7 @@
#include "llviewerwindow.h"
#include "llvoiceclient.h"
#include "llviewermedia.h"
+#include "llviewerregion.h"
#include "llprogressview.h"
#include "llcallbacklist.h"
#include "llstartup.h"
@@ -93,7 +94,12 @@ void LLViewerAudio::startInternetStreamWithAutoFade(std::string streamURI)
switch (mFadeState)
{
- case FADE_IDLE:
+ case FADE_IDLE:
+ if (!gAudiop)
+ {
+ LL_WARNS("AudioEngine") << "LLAudioEngine instance doesn't exist!" << LL_ENDL;
+ break;
+ }
// If a stream is playing fade it out first
if (!gAudiop->getInternetStreamURL().empty())
{
@@ -115,18 +121,18 @@ void LLViewerAudio::startInternetStreamWithAutoFade(std::string streamURI)
break;
}
- case FADE_OUT:
- startFading();
- registerIdleListener();
- break;
+ case FADE_OUT:
+ startFading();
+ registerIdleListener();
+ break;
- case FADE_IN:
- registerIdleListener();
- break;
+ case FADE_IN:
+ registerIdleListener();
+ break;
- default:
- llwarns << "Unknown fading state: " << mFadeState << llendl;
- break;
+ default:
+ LL_WARNS() << "Unknown fading state: " << mFadeState << LL_ENDL;
+ break;
}
}
@@ -157,19 +163,26 @@ bool LLViewerAudio::onIdleUpdate()
// we have finished the current fade operation
if (mFadeState == FADE_OUT)
{
- // Clear URI
- gAudiop->startInternetStream(LLStringUtil::null);
- gAudiop->stopInternetStream();
+ if (gAudiop)
+ {
+ // Clear URI
+ gAudiop->startInternetStream(LLStringUtil::null);
+ gAudiop->stopInternetStream();
+ }
if (!mNextStreamURI.empty())
{
mFadeState = FADE_IN;
- LLStreamingAudioInterface *stream = gAudiop->getStreamingAudioImpl();
- if(stream && stream->supportsAdjustableBufferSizes())
- stream->setBufferSizes(gSavedSettings.getU32("FMODExStreamBufferSize"),gSavedSettings.getU32("FMODExDecodeBufferSize"));
+ if (gAudiop)
+ {
+ LLStreamingAudioInterface *stream = gAudiop->getStreamingAudioImpl();
+ if(stream && stream->supportsAdjustableBufferSizes())
+ stream->setBufferSizes(gSavedSettings.getU32("FMODExStreamBufferSize"),gSavedSettings.getU32("FMODExDecodeBufferSize"));
+
+ gAudiop->startInternetStream(mNextStreamURI);
+ }
- gAudiop->startInternetStream(mNextStreamURI);
startFading();
}
else
@@ -181,7 +194,7 @@ bool LLViewerAudio::onIdleUpdate()
}
else if (mFadeState == FADE_IN)
{
- if (mNextStreamURI != gAudiop->getInternetStreamURL())
+ if (gAudiop && mNextStreamURI != gAudiop->getInternetStreamURL())
{
mFadeState = FADE_OUT;
startFading();
@@ -203,9 +216,12 @@ void LLViewerAudio::stopInternetStreamWithAutoFade()
mFadeState = FADE_IDLE;
mNextStreamURI = LLStringUtil::null;
mDone = true;
-
- gAudiop->startInternetStream(LLStringUtil::null);
- gAudiop->stopInternetStream();
+
+ if (gAudiop)
+ {
+ gAudiop->startInternetStream(LLStringUtil::null);
+ gAudiop->stopInternetStream();
+ }
}
void LLViewerAudio::startFading()
@@ -267,7 +283,7 @@ F32 LLViewerAudio::getFadeVolume()
void LLViewerAudio::onTeleportStarted()
{
- if (!LLViewerAudio::getInstance()->getForcedTeleportFade())
+ if (gAudiop && !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
@@ -291,7 +307,7 @@ void LLViewerAudio::onTeleportFailed()
if (parcel)
{
mNextStreamURI = parcel->getMusicURL();
- llinfos << "Teleport failed -- setting music stream to " << mNextStreamURI << llendl;
+ LL_INFOS() << "Teleport failed -- setting music stream to " << mNextStreamURI << LL_ENDL;
}
}
mWasPlaying = false;
@@ -309,7 +325,7 @@ void LLViewerAudio::onTeleportFinished(const LLVector3d& pos, const bool& local)
if (parcel)
{
mNextStreamURI = parcel->getMusicURL();
- llinfos << "Intraparcel teleport -- setting music stream to " << mNextStreamURI << llendl;
+ LL_INFOS() << "Intraparcel teleport -- setting music stream to " << mNextStreamURI << LL_ENDL;
}
}
mWasPlaying = false;
@@ -319,7 +335,7 @@ void init_audio()
{
if (!gAudiop)
{
- llwarns << "Failed to create an appropriate Audio Engine" << llendl;
+ LL_WARNS() << "Failed to create an appropriate Audio Engine" << LL_ENDL;
return;
}
LLVector3d lpos_global = gAgentCamera.getCameraPositionGlobal();
@@ -393,9 +409,10 @@ void audio_update_volume(bool force_update)
}
F32 mute_volume = mute_audio ? 0.0f : 1.0f;
- // Sound Effects
if (gAudiop)
{
+ // Sound Effects
+
gAudiop->setMasterGain ( master_volume );
gAudiop->setDopplerFactor(gSavedSettings.getF32("AudioLevelDoppler"));
@@ -425,11 +442,9 @@ void audio_update_volume(bool force_update)
gSavedSettings.getBOOL("MuteUI") ? 0.f : gSavedSettings.getF32("AudioLevelUI"));
gAudiop->setSecondaryGain(LLAudioEngine::AUDIO_TYPE_AMBIENT,
gSavedSettings.getBOOL("MuteAmbient") ? 0.f : gSavedSettings.getF32("AudioLevelAmbient"));
- }
- // Streaming Music
- if (gAudiop)
- {
+ // Streaming Music
+
if (!progress_view_visible && LLViewerAudio::getInstance()->getForcedTeleportFade())
{
LLViewerAudio::getInstance()->setWasPlaying(!gAudiop->getInternetStreamURL().empty());
@@ -527,6 +542,12 @@ void audio_update_wind(bool force_update)
volume_delta = 1.f;
}
+ if (!gAudiop)
+ {
+ LL_WARNS("AudioEngine") << "LLAudioEngine instance doesn't exist!" << LL_ENDL;
+ return;
+ }
+
// mute wind when not flying
if (gAgent.getFlying())
{