summaryrefslogtreecommitdiff
path: root/indra/newview/llvieweraudio.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llvieweraudio.cpp')
-rwxr-xr-xindra/newview/llvieweraudio.cpp76
1 files changed, 48 insertions, 28 deletions
diff --git a/indra/newview/llvieweraudio.cpp b/indra/newview/llvieweraudio.cpp
index e27ebe8663..7ce9d858dd 100755
--- a/indra/newview/llvieweraudio.cpp
+++ b/indra/newview/llvieweraudio.cpp
@@ -94,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())
{
@@ -116,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:
- LL_WARNS() << "Unknown fading state: " << mFadeState << LL_ENDL;
- break;
+ default:
+ LL_WARNS() << "Unknown fading state: " << mFadeState << LL_ENDL;
+ break;
}
}
@@ -158,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
@@ -182,7 +194,7 @@ bool LLViewerAudio::onIdleUpdate()
}
else if (mFadeState == FADE_IN)
{
- if (mNextStreamURI != gAudiop->getInternetStreamURL())
+ if (gAudiop && mNextStreamURI != gAudiop->getInternetStreamURL())
{
mFadeState = FADE_OUT;
startFading();
@@ -204,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()
@@ -268,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
@@ -394,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"));
@@ -426,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());
@@ -528,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())
{