summaryrefslogtreecommitdiff
path: root/indra/llaudio
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llaudio')
-rw-r--r--[-rwxr-xr-x]indra/llaudio/CMakeLists.txt0
-rw-r--r--[-rwxr-xr-x]indra/llaudio/llaudiodecodemgr.cpp2
-rw-r--r--[-rwxr-xr-x]indra/llaudio/llaudiodecodemgr.h0
-rw-r--r--[-rwxr-xr-x]indra/llaudio/llaudioengine.cpp73
-rw-r--r--[-rwxr-xr-x]indra/llaudio/llaudioengine.h9
-rw-r--r--[-rwxr-xr-x]indra/llaudio/llaudioengine_fmod.cpp0
-rw-r--r--[-rwxr-xr-x]indra/llaudio/llaudioengine_fmod.h0
-rw-r--r--[-rwxr-xr-x]indra/llaudio/llaudioengine_openal.cpp0
-rw-r--r--[-rwxr-xr-x]indra/llaudio/llaudioengine_openal.h0
-rw-r--r--[-rwxr-xr-x]indra/llaudio/lllistener.cpp0
-rw-r--r--[-rwxr-xr-x]indra/llaudio/lllistener.h0
-rw-r--r--[-rwxr-xr-x]indra/llaudio/lllistener_ds3d.h0
-rw-r--r--[-rwxr-xr-x]indra/llaudio/lllistener_fmod.cpp0
-rw-r--r--[-rwxr-xr-x]indra/llaudio/lllistener_fmod.h0
-rw-r--r--[-rwxr-xr-x]indra/llaudio/lllistener_openal.cpp0
-rw-r--r--[-rwxr-xr-x]indra/llaudio/lllistener_openal.h0
-rw-r--r--[-rwxr-xr-x]indra/llaudio/llstreamingaudio.h0
-rw-r--r--[-rwxr-xr-x]indra/llaudio/llstreamingaudio_fmod.cpp0
-rw-r--r--[-rwxr-xr-x]indra/llaudio/llstreamingaudio_fmod.h0
-rw-r--r--[-rwxr-xr-x]indra/llaudio/llvorbisencode.cpp0
-rw-r--r--[-rwxr-xr-x]indra/llaudio/llvorbisencode.h0
-rw-r--r--[-rwxr-xr-x]indra/llaudio/llwindgen.h0
22 files changed, 55 insertions, 29 deletions
diff --git a/indra/llaudio/CMakeLists.txt b/indra/llaudio/CMakeLists.txt
index e869b9717c..e869b9717c 100755..100644
--- a/indra/llaudio/CMakeLists.txt
+++ b/indra/llaudio/CMakeLists.txt
diff --git a/indra/llaudio/llaudiodecodemgr.cpp b/indra/llaudio/llaudiodecodemgr.cpp
index fc2190707a..86532bb439 100755..100644
--- a/indra/llaudio/llaudiodecodemgr.cpp
+++ b/indra/llaudio/llaudiodecodemgr.cpp
@@ -224,7 +224,7 @@ BOOL LLVorbisDecodeState::initDecode()
S32 sample_count = ov_pcm_total(&mVF, -1);
size_t size_guess = (size_t)sample_count;
vorbis_info* vi = ov_info(&mVF, -1);
- size_guess *= vi->channels;
+ size_guess *= (vi? vi->channels : 1);
size_guess *= 2;
size_guess += 2048;
diff --git a/indra/llaudio/llaudiodecodemgr.h b/indra/llaudio/llaudiodecodemgr.h
index 040506c551..040506c551 100755..100644
--- a/indra/llaudio/llaudiodecodemgr.h
+++ b/indra/llaudio/llaudiodecodemgr.h
diff --git a/indra/llaudio/llaudioengine.cpp b/indra/llaudio/llaudioengine.cpp
index 9f4c108dff..e55d07598d 100755..100644
--- a/indra/llaudio/llaudioengine.cpp
+++ b/indra/llaudio/llaudioengine.cpp
@@ -103,6 +103,7 @@ void LLAudioEngine::setDefaults()
}
mMasterGain = 1.f;
+ mInternalGain = 0.f;
mNextWindUpdate = 0.f;
mStreamingAudioImpl = NULL;
@@ -253,15 +254,6 @@ void LLAudioEngine::idle(F32 max_decode_time)
// Primarily does position updating, cleanup of unused audio sources.
// Also does regeneration of the current priority of each audio source.
- if (getMuted())
- {
- setInternalGain(0.f);
- }
- else
- {
- setInternalGain(getMasterGain());
- }
-
S32 i;
for (i = 0; i < MAX_BUFFERS; i++)
{
@@ -290,6 +282,12 @@ void LLAudioEngine::idle(F32 max_decode_time)
continue;
}
+ if (sourcep->isMuted())
+ {
+ ++iter;
+ continue;
+ }
+
if (!sourcep->getChannel() && sourcep->getCurrentBuffer())
{
// We could potentially play this sound if its priority is high enough.
@@ -342,9 +340,9 @@ void LLAudioEngine::idle(F32 max_decode_time)
// attached to each channel, since only those with active channels
// can have anything interesting happen with their queue? (Maybe not true)
LLAudioSource *sourcep = iter->second;
- if (!sourcep->mQueuedDatap)
+ if (!sourcep->mQueuedDatap || sourcep->isMuted())
{
- // Nothing queued, so we don't care.
+ // Muted, or nothing queued, so we don't care.
continue;
}
@@ -424,6 +422,10 @@ void LLAudioEngine::idle(F32 max_decode_time)
for (iter = mAllSources.begin(); iter != mAllSources.end(); ++iter)
{
LLAudioSource *sourcep = iter->second;
+ if (sourcep->isMuted())
+ {
+ continue;
+ }
if (sourcep->isSyncMaster())
{
if (sourcep->getPriority() > max_sm_priority)
@@ -697,15 +699,23 @@ bool LLAudioEngine::isWindEnabled()
void LLAudioEngine::setMuted(bool muted)
{
- mMuted = muted;
+ if (muted != mMuted)
+ {
+ mMuted = muted;
+ setMasterGain(mMasterGain);
+ }
enableWind(!mMuted);
}
-
void LLAudioEngine::setMasterGain(const F32 gain)
{
mMasterGain = gain;
- setInternalGain(gain);
+ F32 internal_gain = getMuted() ? 0.f : gain;
+ if (internal_gain != mInternalGain)
+ {
+ mInternalGain = internal_gain;
+ setInternalGain(mInternalGain);
+ }
}
F32 LLAudioEngine::getMasterGain()
@@ -1249,13 +1259,14 @@ LLAudioSource::LLAudioSource(const LLUUID& id, const LLUUID& owner_id, const F32
mOwnerID(owner_id),
mPriority(0.f),
mGain(gain),
- mType(type),
+ mSourceMuted(false),
mAmbient(false),
mLoop(false),
mSyncMaster(false),
mSyncSlave(false),
mQueueSounds(false),
mPlayedOnce(false),
+ mType(type),
mChannelp(NULL),
mCurrentDatap(NULL),
mQueuedDatap(NULL)
@@ -1307,6 +1318,10 @@ void LLAudioSource::updatePriority()
{
mPriority = 1.f;
}
+ else if (isMuted())
+ {
+ mPriority = 0.f;
+ }
else
{
// Priority is based on distance
@@ -1355,25 +1370,33 @@ bool LLAudioSource::setupChannel()
bool LLAudioSource::play(const LLUUID &audio_uuid)
{
+ // Special abuse of play(); don't play a sound, but kill it.
if (audio_uuid.isNull())
{
if (getChannel())
{
getChannel()->setSource(NULL);
setChannel(NULL);
- addAudioData(NULL, true);
+ if (!isMuted())
+ {
+ mCurrentDatap = NULL;
+ }
}
+ return false;
}
+
// Reset our age timeout if someone attempts to play the source.
mAgeTimer.reset();
LLAudioData *adp = gAudiop->getAudioData(audio_uuid);
-
- bool has_buffer = gAudiop->updateBufferForData(adp, audio_uuid);
-
-
addAudioData(adp);
+ if (isMuted())
+ {
+ return false;
+ }
+
+ bool has_buffer = gAudiop->updateBufferForData(adp, audio_uuid);
if (!has_buffer)
{
// Don't bother trying to set up a channel or anything, we don't have an audio buffer.
@@ -1398,10 +1421,11 @@ bool LLAudioSource::play(const LLUUID &audio_uuid)
}
-bool LLAudioSource::isDone()
+bool LLAudioSource::isDone() const
{
const F32 MAX_AGE = 60.f;
const F32 MAX_UNPLAYED_AGE = 15.f;
+ const F32 MAX_MUTED_AGE = 11.f;
if (isLoop())
{
@@ -1409,7 +1433,6 @@ bool LLAudioSource::isDone()
return false;
}
-
if (hasPendingPreloads())
{
return false;
@@ -1426,10 +1449,10 @@ bool LLAudioSource::isDone()
// This is a single-play source
if (!mChannelp)
{
- if ((elapsed > MAX_UNPLAYED_AGE) || mPlayedOnce)
+ if ((elapsed > (mSourceMuted ? MAX_MUTED_AGE : MAX_UNPLAYED_AGE)) || mPlayedOnce)
{
// We don't have a channel assigned, and it's been
- // over 5 seconds since we tried to play it. Don't bother.
+ // over 15 seconds since we tried to play it. Don't bother.
//llinfos << "No channel assigned, source is done" << llendl;
return true;
}
@@ -1455,7 +1478,7 @@ bool LLAudioSource::isDone()
if ((elapsed > MAX_UNPLAYED_AGE) || mPlayedOnce)
{
- // The sound isn't playing back after 5 seconds or we're already done playing it, kill it.
+ // The sound isn't playing back after 15 seconds or we're already done playing it, kill it.
return true;
}
diff --git a/indra/llaudio/llaudioengine.h b/indra/llaudio/llaudioengine.h
index 5876cef4ea..74c75ef085 100755..100644
--- a/indra/llaudio/llaudioengine.h
+++ b/indra/llaudio/llaudioengine.h
@@ -124,8 +124,8 @@ public:
// Use these for temporarily muting the audio system.
// Does not change buffers, initialization, etc. but
// stops playing new sounds.
- virtual void setMuted(bool muted);
- virtual bool getMuted() const { return mMuted; }
+ void setMuted(bool muted);
+ bool getMuted() const { return mMuted; }
#ifdef USE_PLUGIN_MEDIA
LLPluginClassMedia* initializeMedia(const std::string& media_type);
#endif
@@ -245,6 +245,7 @@ protected:
LLAudioBuffer *mBuffers[MAX_BUFFERS];
F32 mMasterGain;
+ F32 mInternalGain; // Actual gain set; either mMasterGain or 0 when mMuted is true.
F32 mSecondaryGain[AUDIO_TYPE_COUNT];
F32 mNextWindUpdate;
@@ -309,7 +310,8 @@ public:
virtual void setGain(const F32 gain) { mGain = llclamp(gain, 0.f, 1.f); }
const LLUUID &getID() const { return mID; }
- bool isDone();
+ bool isDone() const;
+ bool isMuted() const { return mSourceMuted; }
LLAudioData *getCurrentData();
LLAudioData *getQueuedData();
@@ -331,6 +333,7 @@ protected:
LLUUID mOwnerID; // owner of the object playing the sound
F32 mPriority;
F32 mGain;
+ bool mSourceMuted;
bool mAmbient;
bool mLoop;
bool mSyncMaster;
diff --git a/indra/llaudio/llaudioengine_fmod.cpp b/indra/llaudio/llaudioengine_fmod.cpp
index 7a8a04afa1..7a8a04afa1 100755..100644
--- a/indra/llaudio/llaudioengine_fmod.cpp
+++ b/indra/llaudio/llaudioengine_fmod.cpp
diff --git a/indra/llaudio/llaudioengine_fmod.h b/indra/llaudio/llaudioengine_fmod.h
index 0e386a3884..0e386a3884 100755..100644
--- a/indra/llaudio/llaudioengine_fmod.h
+++ b/indra/llaudio/llaudioengine_fmod.h
diff --git a/indra/llaudio/llaudioengine_openal.cpp b/indra/llaudio/llaudioengine_openal.cpp
index 887c791790..887c791790 100755..100644
--- a/indra/llaudio/llaudioengine_openal.cpp
+++ b/indra/llaudio/llaudioengine_openal.cpp
diff --git a/indra/llaudio/llaudioengine_openal.h b/indra/llaudio/llaudioengine_openal.h
index 16125b2476..16125b2476 100755..100644
--- a/indra/llaudio/llaudioengine_openal.h
+++ b/indra/llaudio/llaudioengine_openal.h
diff --git a/indra/llaudio/lllistener.cpp b/indra/llaudio/lllistener.cpp
index 846c6bccb5..846c6bccb5 100755..100644
--- a/indra/llaudio/lllistener.cpp
+++ b/indra/llaudio/lllistener.cpp
diff --git a/indra/llaudio/lllistener.h b/indra/llaudio/lllistener.h
index e94fbe853f..e94fbe853f 100755..100644
--- a/indra/llaudio/lllistener.h
+++ b/indra/llaudio/lllistener.h
diff --git a/indra/llaudio/lllistener_ds3d.h b/indra/llaudio/lllistener_ds3d.h
index 1ff9c170c4..1ff9c170c4 100755..100644
--- a/indra/llaudio/lllistener_ds3d.h
+++ b/indra/llaudio/lllistener_ds3d.h
diff --git a/indra/llaudio/lllistener_fmod.cpp b/indra/llaudio/lllistener_fmod.cpp
index 57ad461b02..57ad461b02 100755..100644
--- a/indra/llaudio/lllistener_fmod.cpp
+++ b/indra/llaudio/lllistener_fmod.cpp
diff --git a/indra/llaudio/lllistener_fmod.h b/indra/llaudio/lllistener_fmod.h
index 5a48ec8b68..5a48ec8b68 100755..100644
--- a/indra/llaudio/lllistener_fmod.h
+++ b/indra/llaudio/lllistener_fmod.h
diff --git a/indra/llaudio/lllistener_openal.cpp b/indra/llaudio/lllistener_openal.cpp
index a96ebd5dba..a96ebd5dba 100755..100644
--- a/indra/llaudio/lllistener_openal.cpp
+++ b/indra/llaudio/lllistener_openal.cpp
diff --git a/indra/llaudio/lllistener_openal.h b/indra/llaudio/lllistener_openal.h
index 0dfeea5c90..0dfeea5c90 100755..100644
--- a/indra/llaudio/lllistener_openal.h
+++ b/indra/llaudio/lllistener_openal.h
diff --git a/indra/llaudio/llstreamingaudio.h b/indra/llaudio/llstreamingaudio.h
index aa89e6a177..aa89e6a177 100755..100644
--- a/indra/llaudio/llstreamingaudio.h
+++ b/indra/llaudio/llstreamingaudio.h
diff --git a/indra/llaudio/llstreamingaudio_fmod.cpp b/indra/llaudio/llstreamingaudio_fmod.cpp
index fe94688565..fe94688565 100755..100644
--- a/indra/llaudio/llstreamingaudio_fmod.cpp
+++ b/indra/llaudio/llstreamingaudio_fmod.cpp
diff --git a/indra/llaudio/llstreamingaudio_fmod.h b/indra/llaudio/llstreamingaudio_fmod.h
index 968ab53a0b..968ab53a0b 100755..100644
--- a/indra/llaudio/llstreamingaudio_fmod.h
+++ b/indra/llaudio/llstreamingaudio_fmod.h
diff --git a/indra/llaudio/llvorbisencode.cpp b/indra/llaudio/llvorbisencode.cpp
index 0c1ad8191c..0c1ad8191c 100755..100644
--- a/indra/llaudio/llvorbisencode.cpp
+++ b/indra/llaudio/llvorbisencode.cpp
diff --git a/indra/llaudio/llvorbisencode.h b/indra/llaudio/llvorbisencode.h
index 6531c1919e..6531c1919e 100755..100644
--- a/indra/llaudio/llvorbisencode.h
+++ b/indra/llaudio/llvorbisencode.h
diff --git a/indra/llaudio/llwindgen.h b/indra/llaudio/llwindgen.h
index 0e6d0aa2ca..0e6d0aa2ca 100755..100644
--- a/indra/llaudio/llwindgen.h
+++ b/indra/llaudio/llwindgen.h