diff --git a/indra/llaudio/llaudioengine.cpp b/indra/llaudio/llaudioengine.cpp index 19d37c131..ad0c7a583 100644 --- a/indra/llaudio/llaudioengine.cpp +++ b/indra/llaudio/llaudioengine.cpp @@ -1249,6 +1249,9 @@ void LLAudioEngine::startNextTransfer() // static void LLAudioEngine::assetCallback(LLVFS *vfs, const LLUUID &uuid, LLAssetType::EType type, void *user_data, S32 result_code, LLExtStat ext_status) { + if(!gAudiop) + return; + if (result_code) { LL_INFOS("AudioEngine") << "Boom, error in audio file transfer: " << LLAssetStorage::getErrorString( result_code ) << " (" << result_code << ")" << LL_ENDL; @@ -1469,6 +1472,19 @@ bool LLAudioSource::play(const LLUUID &audio_uuid) return true; } } + else if(mCurrentDatap == adp) //Desired sound did not change. Just re-play it. + { + if(getChannel() && getChannel()->isPlaying()) + getChannel()->play(); + return true; + } + else //Desired sound did change. Release the old channel if set. + { + if(getChannel()) + getChannel()->cleanup(); + mPlayedOnce = false; //Reset the played flag so the new sound is actually started up. + } + mCurrentDatap = adp; // Make sure the audio engine knows that we want to request this sound. diff --git a/indra/llaudio/llaudioengine_fmod.cpp b/indra/llaudio/llaudioengine_fmod.cpp index 4c4f4f48d..116a37314 100644 --- a/indra/llaudio/llaudioengine_fmod.cpp +++ b/indra/llaudio/llaudioengine_fmod.cpp @@ -600,6 +600,12 @@ void LLAudioChannelFMOD::play() llwarns << "Playing without a channelID, aborting" << llendl; return; } + + if(!FSOUND_IsPaused(mChannelID)) + { + FSOUND_SetPaused(mChannelID, true); + FSOUND_SetCurrentPosition(mChannelID, 0); + } if (!FSOUND_SetPaused(mChannelID, false)) { diff --git a/indra/llaudio/llaudioengine_fmodex.cpp b/indra/llaudio/llaudioengine_fmodex.cpp index 0c297494d..506c8d4ad 100644 --- a/indra/llaudio/llaudioengine_fmodex.cpp +++ b/indra/llaudio/llaudioengine_fmodex.cpp @@ -823,6 +823,13 @@ void LLAudioChannelFMODEX::play() gSoundCheck.assertActiveState(this,true); + bool paused=true; + Check_FMOD_Error(mChannelp->getPaused(&paused), "FMOD::Channel::getPaused"); + if(!paused) + { + Check_FMOD_Error(mChannelp->setPaused(true), "FMOD::Channel::setPaused"); + Check_FMOD_Error(mChannelp->setPosition(0,FMOD_TIMEUNIT_PCMBYTES), "FMOD::Channel::setPosition"); + } Check_FMOD_Error(mChannelp->setPaused(false), "FMOD::Channel::setPaused"); if(sVerboseDebugging) diff --git a/indra/llaudio/llaudioengine_openal.cpp b/indra/llaudio/llaudioengine_openal.cpp index 10ce5e6ed..27596c107 100644 --- a/indra/llaudio/llaudioengine_openal.cpp +++ b/indra/llaudio/llaudioengine_openal.cpp @@ -199,11 +199,13 @@ void LLAudioChannelOpenAL::play() return; } - if(!isPlaying()) + if(isPlaying()) { - alSourcePlay(mALSource); - getSource()->setPlayedOnce(true); + alSourceStop(mALSource); } + + alSourcePlay(mALSource); + getSource()->setPlayedOnce(true); } void LLAudioChannelOpenAL::playSynced(LLAudioChannel *channelp) diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index 27bf2c7f8..ab7881a12 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -4901,11 +4901,7 @@ void LLViewerObject::setAttachedSound(const LLUUID &audio_uuid, const LLUUID& ow mAudioSourcep->setSyncMaster(flags & LL_SOUND_FLAG_SYNC_MASTER); mAudioSourcep->setSyncSlave(flags & LL_SOUND_FLAG_SYNC_SLAVE); mAudioSourcep->setQueueSounds(queue); - if(!queue) // stop any current sound first to avoid "farts of doom" (SL-1541) -MG - { - mAudioSourcep->play(LLUUID::null); - } - + // Play this sound if region maturity permits if( gAgent.canAccessMaturityAtGlobal(this->getPositionGlobal()) ) {