summaryrefslogtreecommitdiff
path: root/indra/newview/llvieweraudio.cpp
diff options
context:
space:
mode:
authorsimon <none@none>2014-03-26 10:04:53 -0700
committersimon <none@none>2014-03-26 10:04:53 -0700
commit33dfc0a8a1ed56d7d24611981736fd5baf6b03c2 (patch)
tree5dfdbcede0d8c689e796cf65ebc21bb149c17b8e /indra/newview/llvieweraudio.cpp
parent00a325ccb90b1c6800ec78e1211b5097d9c27a58 (diff)
parent5c20e06dbd0845e2d45daae610c43fc89e24028f (diff)
Pull in downstream -bear, viewer-release and become version 3.7.5
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 826d296117..fce42a1587 100755
--- a/indra/newview/llvieweraudio.cpp
+++ b/indra/newview/llvieweraudio.cpp
@@ -93,7 +93,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 +120,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:
+ llwarns << "Unknown fading state: " << mFadeState << llendl;
+ break;
}
}
@@ -157,19 +162,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 +193,7 @@ bool LLViewerAudio::onIdleUpdate()
}
else if (mFadeState == FADE_IN)
{
- if (mNextStreamURI != gAudiop->getInternetStreamURL())
+ if (gAudiop && mNextStreamURI != gAudiop->getInternetStreamURL())
{
mFadeState = FADE_OUT;
startFading();
@@ -203,9 +215,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 +282,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
@@ -393,9 +408,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 +441,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 +541,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())
{