From 993ac3b95ca79312b3309a2d539b19fe6f89c318 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Fri, 26 Nov 2021 22:56:20 +0200 Subject: SL-16339 Rename setAmbient to not cause confusion setAmbient has nothing to do with ambient sounds --- indra/llaudio/llaudioengine.cpp | 7 ++++--- indra/llaudio/llaudioengine.h | 6 +++--- indra/llaudio/llaudioengine_fmodstudio.cpp | 4 ++-- 3 files changed, 9 insertions(+), 8 deletions(-) (limited to 'indra/llaudio') diff --git a/indra/llaudio/llaudioengine.cpp b/indra/llaudio/llaudioengine.cpp index 1d447f32ae..8089d8cb8f 100644 --- a/indra/llaudio/llaudioengine.cpp +++ b/indra/llaudio/llaudioengine.cpp @@ -831,7 +831,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 { @@ -1278,7 +1279,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), @@ -1344,7 +1345,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 97674f15f7..bba4492daa 100644 --- a/indra/llaudio/llaudioengine.h +++ b/indra/llaudio/llaudioengine.h @@ -277,8 +277,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; } @@ -331,7 +331,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 70b3a08473..5450577134 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 -- cgit v1.2.3 From 59ceaf556960cec87edbcf93a00a77f54c0e9a1a Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Sat, 27 Nov 2021 18:28:23 +0200 Subject: SL-16339 Rename setAmbient in openal --- indra/llaudio/llaudioengine_openal.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llaudio') diff --git a/indra/llaudio/llaudioengine_openal.cpp b/indra/llaudio/llaudioengine_openal.cpp index 3bdd0302ee..305aa1ecb5 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); -- cgit v1.2.3 From 2f78338aeb3d0297813bc9c9c7a9d75a2055000d Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Thu, 11 Jun 2020 15:25:35 +0300 Subject: Debug Fmod with logging --- indra/llaudio/llaudioengine_fmodstudio.cpp | 8 ++++++++ indra/llaudio/llstreamingaudio_fmodstudio.cpp | 1 + 2 files changed, 9 insertions(+) (limited to 'indra/llaudio') diff --git a/indra/llaudio/llaudioengine_fmodstudio.cpp b/indra/llaudio/llaudioengine_fmodstudio.cpp index 5450577134..e9d0fbd6d8 100644 --- a/indra/llaudio/llaudioengine_fmodstudio.cpp +++ b/indra/llaudio/llaudioengine_fmodstudio.cpp @@ -97,6 +97,14 @@ bool LLAudioEngine_FMODSTUDIO::init(const S32 num_channels, void* userdata, cons << " expected:" << FMOD_VERSION << LL_ENDL; } + Check_FMOD_Error(result, "FMOD::System::getVersion"); + std::string logfile = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, "fmod.log"); + result = FMOD::Debug_Initialize(FMOD_DEBUG_LEVEL_LOG, FMOD_DEBUG_MODE_FILE, 0, logfile.c_str()); + if (Check_FMOD_Error(result, "FMOD::System_Create")) + { + LL_WARNS() << "Failed to init logging" << LL_ENDL; + } + // In this case, all sounds, PLUS wind and stream will be software. result = mSystem->setSoftwareChannels(num_channels + 2); Check_FMOD_Error(result, "FMOD::System::setSoftwareChannels"); diff --git a/indra/llaudio/llstreamingaudio_fmodstudio.cpp b/indra/llaudio/llstreamingaudio_fmodstudio.cpp index 08d19209aa..d6fedb2952 100644 --- a/indra/llaudio/llstreamingaudio_fmodstudio.cpp +++ b/indra/llaudio/llstreamingaudio_fmodstudio.cpp @@ -157,6 +157,7 @@ void LLStreamingAudio_FMODSTUDIO::update() } else if (open_state == FMOD_OPENSTATE_ERROR) { + LL_INFOS() << "getOpenState returned FMOD_OPENSTATE_ERROR" << LL_ENDL; stop(); return; } -- cgit v1.2.3 From be820f2eb90519ac0fa8d13be9dc5a798e8bfc7f Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Mon, 14 Mar 2022 18:21:16 +0200 Subject: Revert "Debug Fmod with logging" This reverts commits b21c17eee973dc06c1392dd45dbc19c1ce394852 and 2f78338aeb3d0297813bc9c9c7a9d75a2055000d. 'Debug Fmod' was not an intended commit, was meant for local testing. But might be a good idea to make this a part of DebWithRelInfo or provide a cmake switch. --- indra/llaudio/llaudioengine_fmodstudio.cpp | 8 -------- 1 file changed, 8 deletions(-) (limited to 'indra/llaudio') diff --git a/indra/llaudio/llaudioengine_fmodstudio.cpp b/indra/llaudio/llaudioengine_fmodstudio.cpp index 72d7577ab2..e5752d3dad 100644 --- a/indra/llaudio/llaudioengine_fmodstudio.cpp +++ b/indra/llaudio/llaudioengine_fmodstudio.cpp @@ -97,14 +97,6 @@ bool LLAudioEngine_FMODSTUDIO::init(const S32 num_channels, void* userdata, cons << " expected:" << FMOD_VERSION << LL_ENDL; } - Check_FMOD_Error(result, "FMOD::System::getVersion"); - std::string logfile = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, "fmod.log"); - result = FMOD::Debug_Initialize(FMOD_DEBUG_LEVEL_LOG, FMOD_DEBUG_MODE_FILE, 0, logfile.c_str()); - if (Check_FMOD_Error(result, "FMOD::System_Create")) - { - LL_WARNS() << "Failed to init logging" << LL_ENDL; - } - // In this case, all sounds, PLUS wind and stream will be software. result = mSystem->setSoftwareChannels(num_channels + 2); Check_FMOD_Error(result, "FMOD::System::setSoftwareChannels"); -- cgit v1.2.3 From 478c1e47bef0d316bd9ecaff6563fb9ad1a21c3e Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Mon, 4 Apr 2022 22:43:55 +0300 Subject: SL-16902 Fmod better logging --- indra/llaudio/llstreamingaudio_fmodstudio.cpp | 31 ++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) (limited to 'indra/llaudio') diff --git a/indra/llaudio/llstreamingaudio_fmodstudio.cpp b/indra/llaudio/llstreamingaudio_fmodstudio.cpp index 1ad29a3f59..7d176e7582 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 @@ -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; + } } -- cgit v1.2.3 From d1265cda36f31d0273b0cd57e1e6c762dfc0b29f Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Fri, 20 May 2022 00:14:12 +0300 Subject: SL-17425 Crash when closing two dependent floaters dependent_it in llfloater was not valid after dependent floater removed itself from the list --- indra/llaudio/llaudioengine.cpp | 2 +- indra/llaudio/llstreamingaudio_fmodstudio.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/llaudio') diff --git a/indra/llaudio/llaudioengine.cpp b/indra/llaudio/llaudioengine.cpp index 2a00fe7c5a..9e897a7ce8 100644 --- a/indra/llaudio/llaudioengine.cpp +++ b/indra/llaudio/llaudioengine.cpp @@ -276,7 +276,7 @@ void LLAudioEngine::idle(F32 max_decode_time) { // The source is done playing, clean it up. delete sourcep; - mAllSources.erase(iter++); + iter = mAllSources.erase(iter); continue; } diff --git a/indra/llaudio/llstreamingaudio_fmodstudio.cpp b/indra/llaudio/llstreamingaudio_fmodstudio.cpp index 7d176e7582..85577992a6 100644 --- a/indra/llaudio/llstreamingaudio_fmodstudio.cpp +++ b/indra/llaudio/llstreamingaudio_fmodstudio.cpp @@ -138,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 { -- cgit v1.2.3