summaryrefslogtreecommitdiff
path: root/indra/llaudio
diff options
context:
space:
mode:
authorAndrey Lihatskiy <alihatskiy@productengine.com>2022-09-15 20:44:04 +0300
committerAndrey Lihatskiy <alihatskiy@productengine.com>2022-09-15 20:44:04 +0300
commit329268c5f7520a288e76e253f9bffea9dc212488 (patch)
treedffda1aca4433b5acd7cd759714b03a6e85feb67 /indra/llaudio
parentc50dd63ca38ce44f6c6997a052a114989db8c942 (diff)
parentc2a27c474dc11dff4f93b0bd319cfec7de27bb22 (diff)
Merge branch 'master' into DRTVWR-548-maint-N
# Conflicts: # indra/newview/llmodelpreview.h
Diffstat (limited to 'indra/llaudio')
-rw-r--r--indra/llaudio/llaudioengine.cpp9
-rwxr-xr-xindra/llaudio/llaudioengine.h6
-rw-r--r--indra/llaudio/llaudioengine_fmodstudio.cpp4
-rw-r--r--indra/llaudio/llaudioengine_openal.cpp2
-rw-r--r--indra/llaudio/llstreamingaudio_fmodstudio.cpp33
5 files changed, 38 insertions, 16 deletions
diff --git a/indra/llaudio/llaudioengine.cpp b/indra/llaudio/llaudioengine.cpp
index cae6bb62d9..008e1827c5 100644
--- a/indra/llaudio/llaudioengine.cpp
+++ b/indra/llaudio/llaudioengine.cpp
@@ -254,7 +254,7 @@ void LLAudioEngine::idle()
{
// The source is done playing, clean it up.
delete sourcep;
- mAllSources.erase(iter++);
+ iter = mAllSources.erase(iter);
continue;
}
@@ -805,7 +805,8 @@ void LLAudioEngine::triggerSound(const LLUUID &audio_uuid, const LLUUID& owner_i
addAudioSource(asp);
if (pos_global.isExactlyZero())
{
- asp->setAmbient(true);
+ // For sound preview and UI
+ asp->setForcedPriority(true);
}
else
{
@@ -1252,7 +1253,7 @@ LLAudioSource::LLAudioSource(const LLUUID& id, const LLUUID& owner_id, const F32
mPriority(0.f),
mGain(gain),
mSourceMuted(false),
- mAmbient(false),
+ mForcedPriority(false),
mLoop(false),
mSyncMaster(false),
mSyncSlave(false),
@@ -1322,7 +1323,7 @@ void LLAudioSource::update()
void LLAudioSource::updatePriority()
{
- if (isAmbient())
+ if (isForcedPriority())
{
mPriority = 1.f;
}
diff --git a/indra/llaudio/llaudioengine.h b/indra/llaudio/llaudioengine.h
index 65356ba00e..0fe8b3d756 100755
--- a/indra/llaudio/llaudioengine.h
+++ b/indra/llaudio/llaudioengine.h
@@ -265,8 +265,8 @@ public:
void addAudioData(LLAudioData *adp, bool set_current = TRUE);
- void setAmbient(const bool ambient) { mAmbient = ambient; }
- bool isAmbient() const { return mAmbient; }
+ void setForcedPriority(const bool ambient) { mForcedPriority = ambient; }
+ bool isForcedPriority() const { return mForcedPriority; }
void setLoop(const bool loop) { mLoop = loop; }
bool isLoop() const { return mLoop; }
@@ -325,7 +325,7 @@ protected:
F32 mPriority;
F32 mGain;
bool mSourceMuted;
- bool mAmbient;
+ bool mForcedPriority; // ignore mute, set high priority, researved for sound preview and UI
bool mLoop;
bool mSyncMaster;
bool mSyncSlave;
diff --git a/indra/llaudio/llaudioengine_fmodstudio.cpp b/indra/llaudio/llaudioengine_fmodstudio.cpp
index ce2c7d5551..ba743020b5 100644
--- a/indra/llaudio/llaudioengine_fmodstudio.cpp
+++ b/indra/llaudio/llaudioengine_fmodstudio.cpp
@@ -519,9 +519,9 @@ void LLAudioChannelFMODSTUDIO::update3DPosition()
return;
}
- if (mCurrentSourcep->isAmbient())
+ if (mCurrentSourcep->isForcedPriority())
{
- // Ambient sound, don't need to do any positional updates.
+ // Prioritized UI and preview sounds don't need to do any positional updates.
set3DMode(false);
}
else
diff --git a/indra/llaudio/llaudioengine_openal.cpp b/indra/llaudio/llaudioengine_openal.cpp
index a87b4c07e2..0a79614424 100644
--- a/indra/llaudio/llaudioengine_openal.cpp
+++ b/indra/llaudio/llaudioengine_openal.cpp
@@ -297,7 +297,7 @@ void LLAudioChannelOpenAL::update3DPosition()
{
return;
}
- if (mCurrentSourcep->isAmbient())
+ if (mCurrentSourcep->isForcedPriority())
{
alSource3f(mALSource, AL_POSITION, 0.0, 0.0, 0.0);
alSource3f(mALSource, AL_VELOCITY, 0.0, 0.0, 0.0);
diff --git a/indra/llaudio/llstreamingaudio_fmodstudio.cpp b/indra/llaudio/llstreamingaudio_fmodstudio.cpp
index 1ad29a3f59..85577992a6 100644
--- a/indra/llaudio/llstreamingaudio_fmodstudio.cpp
+++ b/indra/llaudio/llstreamingaudio_fmodstudio.cpp
@@ -70,7 +70,11 @@ mRetryCount(0)
// Must be larger than the usual Second Life frame stutter time.
const U32 buffer_seconds = 10; //sec
const U32 estimated_bitrate = 128; //kbit/sec
- mSystem->setStreamBufferSize(estimated_bitrate * buffer_seconds * 128/*bytes/kbit*/, FMOD_TIMEUNIT_RAWBYTES);
+ FMOD_RESULT result = mSystem->setStreamBufferSize(estimated_bitrate * buffer_seconds * 128/*bytes/kbit*/, FMOD_TIMEUNIT_RAWBYTES);
+ if (result != FMOD_OK)
+ {
+ LL_WARNS("FMOD") << "setStreamBufferSize error: " << FMOD_ErrorString(result) << LL_ENDL;
+ }
// Here's where we set the size of the network buffer and some buffering
// parameters. In this case we want a network buffer of 16k, we want it
@@ -134,7 +138,7 @@ void LLStreamingAudio_FMODSTUDIO::killDeadStreams()
{
LL_INFOS("FMOD") << "Closed dead stream" << LL_ENDL;
delete streamp;
- mDeadStreams.erase(iter++);
+ iter = mDeadStreams.erase(iter);
}
else
{
@@ -404,7 +408,11 @@ FMOD::Channel *LLAudioStreamManagerFMODSTUDIO::startStream()
if (mStreamChannel)
return mStreamChannel; //Already have a channel for this stream.
- mSystem->playSound(mInternetStream, NULL, true, &mStreamChannel);
+ FMOD_RESULT result = mSystem->playSound(mInternetStream, NULL, true, &mStreamChannel);
+ if (result != FMOD_OK)
+ {
+ LL_WARNS("FMOD") << FMOD_ErrorString(result) << LL_ENDL;
+ }
return mStreamChannel;
}
@@ -445,16 +453,29 @@ bool LLAudioStreamManagerFMODSTUDIO::stopStream()
FMOD_OPENSTATE LLAudioStreamManagerFMODSTUDIO::getOpenState(unsigned int* percentbuffered, bool* starving, bool* diskbusy)
{
FMOD_OPENSTATE state;
- mInternetStream->getOpenState(&state, percentbuffered, starving, diskbusy);
+ FMOD_RESULT result = mInternetStream->getOpenState(&state, percentbuffered, starving, diskbusy);
+ if (result != FMOD_OK)
+ {
+ LL_WARNS("FMOD") << FMOD_ErrorString(result) << LL_ENDL;
+ }
return state;
}
void LLStreamingAudio_FMODSTUDIO::setBufferSizes(U32 streambuffertime, U32 decodebuffertime)
{
- mSystem->setStreamBufferSize(streambuffertime / 1000 * 128 * 128, FMOD_TIMEUNIT_RAWBYTES);
+ FMOD_RESULT result = mSystem->setStreamBufferSize(streambuffertime / 1000 * 128 * 128, FMOD_TIMEUNIT_RAWBYTES);
+ if (result != FMOD_OK)
+ {
+ LL_WARNS("FMOD") << "setStreamBufferSize error: " << FMOD_ErrorString(result) << LL_ENDL;
+ return;
+ }
FMOD_ADVANCEDSETTINGS settings;
memset(&settings, 0, sizeof(settings));
settings.cbSize = sizeof(settings);
settings.defaultDecodeBufferSize = decodebuffertime;//ms
- mSystem->setAdvancedSettings(&settings);
+ result = mSystem->setAdvancedSettings(&settings);
+ if (result != FMOD_OK)
+ {
+ LL_WARNS("FMOD") << "setAdvancedSettings error: " << FMOD_ErrorString(result) << LL_ENDL;
+ }
}