diff options
author | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2023-08-23 22:40:17 +0300 |
---|---|---|
committer | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2023-08-23 22:40:17 +0300 |
commit | 3d73a10da3e051b232b4ddc89c1463a8b097ca7f (patch) | |
tree | 8b32d955d0628ca1138301177e1413cc419229fd /indra/llaudio/llaudioengine.cpp | |
parent | 4b5b048cb6280cbd9fd303acd96fce73461d1fb4 (diff) | |
parent | d454512050e636a19e4b7545515dea4f4b1bbf0d (diff) |
Merge branch main (DRTVWR-582) into DRTVWR-567
# Conflicts:
# indra/newview/app_settings/settings.xml
# indra/newview/llinventoryfunctions.cpp
# indra/newview/llinventoryfunctions.h
# indra/newview/llinventorymodel.cpp
# indra/newview/llinventoryobserver.cpp
# indra/newview/llinventoryobserver.h
# indra/newview/skins/default/xui/ja/floater_inventory_item_properties.xml
Diffstat (limited to 'indra/llaudio/llaudioengine.cpp')
-rw-r--r-- | indra/llaudio/llaudioengine.cpp | 103 |
1 files changed, 48 insertions, 55 deletions
diff --git a/indra/llaudio/llaudioengine.cpp b/indra/llaudio/llaudioengine.cpp index ddc508455f..a387bb23cd 100644 --- a/indra/llaudio/llaudioengine.cpp +++ b/indra/llaudio/llaudioengine.cpp @@ -204,7 +204,8 @@ std::string LLAudioEngine::getInternetStreamURL() { if (mStreamingAudioImpl) return mStreamingAudioImpl->getURL(); - else return std::string(); + + return std::string(); } @@ -345,42 +346,43 @@ void LLAudioEngine::idle() } continue; } - else + + // Check to see if the current sound is done playing. + if (!channelp->isPlaying()) { - // Check to see if the current sound is done playing, or looped. - if (!channelp->isPlaying()) + sourcep->mCurrentDatap = sourcep->mQueuedDatap; + sourcep->mQueuedDatap = NULL; + + // Reset the timer so the source doesn't die. + sourcep->mAgeTimer.reset(); + + // Make sure we have the buffer set up if we just decoded the data + if (sourcep->mCurrentDatap) { - sourcep->mCurrentDatap = sourcep->mQueuedDatap; - sourcep->mQueuedDatap = NULL; + updateBufferForData(sourcep->mCurrentDatap); + } - // Reset the timer so the source doesn't die. - sourcep->mAgeTimer.reset(); + // Actually play the associated data. + sourcep->setupChannel(); + channelp->updateBuffer(); + sourcep->getChannel()->play(); + continue; + } - // Make sure we have the buffer set up if we just decoded the data - if (sourcep->mCurrentDatap) - { - updateBufferForData(sourcep->mCurrentDatap); - } + // Check to see if the current sound is looped. + if (sourcep->isLoop()) + { + // It's a loop, we need to check and see if we're done with it. + if (channelp->mLoopedThisFrame) + { + sourcep->mCurrentDatap = sourcep->mQueuedDatap; + sourcep->mQueuedDatap = NULL; - // Actually play the associated data. + // Actually, should do a time sync so if we're a loop master/slave + // we don't drift away. sourcep->setupChannel(); - channelp->updateBuffer(); sourcep->getChannel()->play(); } - else if (sourcep->isLoop()) - { - // It's a loop, we need to check and see if we're done with it. - if (channelp->mLoopedThisFrame) - { - sourcep->mCurrentDatap = sourcep->mQueuedDatap; - sourcep->mQueuedDatap = NULL; - - // Actually, should do a time sync so if we're a loop master/slave - // we don't drift away. - sourcep->setupChannel(); - sourcep->getChannel()->play(); - } - } } } @@ -396,18 +398,11 @@ void LLAudioEngine::idle() for (source_map::value_type& src_pair : mAllSources) { LLAudioSource *sourcep = src_pair.second; - if (sourcep->isMuted()) - { - continue; - } - if (sourcep->isSyncMaster()) + if (sourcep->isMuted() && sourcep->isSyncMaster() && sourcep->getPriority() > max_sm_priority) { - if (sourcep->getPriority() > max_sm_priority) - { - sync_masterp = sourcep; - master_channelp = sync_masterp->getChannel(); - max_sm_priority = sourcep->getPriority(); - } + sync_masterp = sourcep; + master_channelp = sync_masterp->getChannel(); + max_sm_priority = sourcep->getPriority(); } } @@ -737,7 +732,7 @@ F64 LLAudioEngine::mapWindVecToGain(LLVector3 wind_vec) } return (gain); -} +} F64 LLAudioEngine::mapWindVecToPitch(LLVector3 wind_vec) @@ -964,12 +959,11 @@ void LLAudioEngine::cleanupAudioSource(LLAudioSource *asp) else { LL_DEBUGS("AudioEngine") << "Cleaning up audio sources for "<< asp->getID() <<LL_ENDL; - delete asp; - mAllSources.erase(iter); -} + delete asp; + mAllSources.erase(iter); + } } - bool LLAudioEngine::hasDecodedFile(const LLUUID &uuid) { std::string uuid_str; @@ -1687,20 +1681,19 @@ void LLAudioChannel::setSource(LLAudioSource *sourcep) { LL_DEBUGS("AudioEngine") << "( id: " << sourcep->getID() << ")" << LL_ENDL; - if (sourcep == mCurrentSourcep) - { - // Don't reallocate the channel, this will make FMOD goofy. - //LL_INFOS() << "Calling setSource with same source!" << LL_ENDL; - } + if (sourcep == mCurrentSourcep) + { + // Don't reallocate the channel, this will make FMOD goofy. + //LL_INFOS() << "Calling setSource with same source!" << LL_ENDL; + } - mCurrentSourcep = sourcep; + mCurrentSourcep = sourcep; - updateBuffer(); - update3DPosition(); -} + updateBuffer(); + update3DPosition(); + } } - bool LLAudioChannel::updateBuffer() { if (!gAudiop) |